diff options
Diffstat (limited to 'dev/modules/MBCI')
| -rw-r--r-- | dev/modules/MBCI/MBCI.h | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/dev/modules/MBCI/MBCI.h b/dev/modules/MBCI/MBCI.h index 1038f17c..f2bd7f71 100644 --- a/dev/modules/MBCI/MBCI.h +++ b/dev/modules/MBCI/MBCI.h @@ -96,27 +96,24 @@ enum MBCIHostState { /// @brief An AuthKey is a context used to tokenize data for an MBCI packet. typedef UInt32 MBCIAuthKeyType; +/// @internal +inline BOOL busi_test_mmio(_Input volatile struct IMBCIHost* host, const UInt32 test) { + host->MMIOTest = test; + while (host->MMIOTest == test); + + return host->MMIOTest == 0; +} + /// @brief Read Auth key for MBCI host. /// @param host the mbci host to get the key on. /// @return the 24-bit key. inline MBCIAuthKeyType mbci_read_auth_key(_Input volatile struct IMBCIHost* host) { - constexpr auto const kChallengeMBCI = 0xdeadbeef; - - host->MMIOTest = kChallengeMBCI; - - if (host->MMIOTest == kChallengeMBCI) { - return (host->Esb[kMBCIESBSz - 1] << 16) | (host->Esb[kMBCIESBSz - 2] << 8) | - (host->Esb[kMBCIESBSz - 3] & 0xFF); - } - - return kChallengeMBCI; -} + auto const kChallengeMBCI = 0x1; // MBCI Challenge test -inline BOOL mbci_test_mmio(_Input volatile struct IMBCIHost* host) { - constexpr auto const kChallengeMBCI = 0xdeadbeef; + if (!busi_test_mmio(host, kChallengeMBCI)) return ~0; - host->MMIOTest = kChallengeMBCI; - return host->MMIOTest == kChallengeMBCI; + return (host->Esb[kMBCIESBSz - 1] << 16) | (host->Esb[kMBCIESBSz - 2] << 8) | + (host->Esb[kMBCIESBSz - 3] & 0xFF); } } // namespace Kernel |
