diff options
| author | Amlal <amlal@nekernel.org> | 2025-05-07 10:19:31 +0200 |
|---|---|---|
| committer | Amlal <amlal@nekernel.org> | 2025-05-07 10:19:31 +0200 |
| commit | f7492b792e5ef083a856787fde2f581f369fa200 (patch) | |
| tree | a767d71cc74478b98b96726f71e85c79cbe44dcd | |
| parent | 1eaea2474bb377cc0b9eab6b8cdc9336170988c4 (diff) | |
feat(modules/MBCI): Finalize MBCI base module.
Signed-off-by: Amlal <amlal@nekernel.org>
| -rw-r--r-- | dev/kernel/src/DriveMgr.cc | 2 | ||||
| -rw-r--r-- | dev/kernel/src/FS/HeFS+FileSystemParser.cc | 2 | ||||
| -rw-r--r-- | dev/modules/MBCI/MBCI.h | 27 |
3 files changed, 14 insertions, 17 deletions
diff --git a/dev/kernel/src/DriveMgr.cc b/dev/kernel/src/DriveMgr.cc index 96ff2766..449640f9 100644 --- a/dev/kernel/src/DriveMgr.cc +++ b/dev/kernel/src/DriveMgr.cc @@ -4,8 +4,8 @@ ------------------------------------------- */ -#include <FirmwareKit/VEPM.h> #include <FirmwareKit/GPT.h> +#include <FirmwareKit/VEPM.h> #include <KernelKit/DebugOutput.h> #include <KernelKit/DriveMgr.h> #include <NewKit/Utils.h> diff --git a/dev/kernel/src/FS/HeFS+FileSystemParser.cc b/dev/kernel/src/FS/HeFS+FileSystemParser.cc index d3331710..465cfc32 100644 --- a/dev/kernel/src/FS/HeFS+FileSystemParser.cc +++ b/dev/kernel/src/FS/HeFS+FileSystemParser.cc @@ -1018,7 +1018,7 @@ _Output Bool HeFileSystemParser::INodeManip(_Input DriveTrait* mnt, VoidPtr bloc if (!nodes) return NO; - SizeT sz_out = 0; + SizeT sz_out = 0; for (SizeT i = 0UL; i < cnt; ++i) { auto& start = nodes[i]; 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 |
