summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel/FirmwareKit/EFI/API.h
diff options
context:
space:
mode:
authorAmlal <amlal@nekernel.org>2025-04-25 13:08:33 +0200
committerAmlal <amlal@nekernel.org>2025-04-25 13:08:33 +0200
commitfb790b07aeba8e22e4190cf3e1834d11ecde6c96 (patch)
tree4cec7d1b321307b1d5935577631dae116a658a37 /dev/kernel/FirmwareKit/EFI/API.h
parent63a2d92c5dfe976175cda024ec01905d11b43738 (diff)
dev: better .clang-format, ran format command.
Signed-off-by: Amlal <amlal@nekernel.org>
Diffstat (limited to 'dev/kernel/FirmwareKit/EFI/API.h')
-rw-r--r--dev/kernel/FirmwareKit/EFI/API.h112
1 files changed, 51 insertions, 61 deletions
diff --git a/dev/kernel/FirmwareKit/EFI/API.h b/dev/kernel/FirmwareKit/EFI/API.h
index 87ab697b..0b937477 100644
--- a/dev/kernel/FirmwareKit/EFI/API.h
+++ b/dev/kernel/FirmwareKit/EFI/API.h
@@ -1,6 +1,6 @@
/* -------------------------------------------
- Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
+ Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
------------------------------------------- */
@@ -12,7 +12,7 @@
#include <KernelKit/MSDOS.h>
#include <KernelKit/PE.h>
-#define kNeWebsiteMacro "https://aker.com/help"
+#define kNeWebsiteMacro "https://aker.com/help"
#define kNeKernelSubsystem (StrLen(kNeWebsiteMacro))
#ifdef __BOOTZ__
@@ -23,79 +23,69 @@ class BootTextWriter;
#include <BootKit/BootKit.h>
#include <modules/CoreGfx/CoreGfx.h>
-#endif // ifdef __BOOTZ__
+#endif // ifdef __BOOTZ__
-inline EfiSystemTable* ST = nullptr;
+inline EfiSystemTable* ST = nullptr;
inline EfiBootServices* BS = nullptr;
EXTERN_C void rt_cli();
EXTERN_C void rt_hlt();
-namespace Boot
-{
- /// @brief Halt and clear interrupts.
- /// @return
- inline Void Stop() noexcept
- {
- while (YES)
- {
- rt_cli();
- rt_hlt();
- }
- }
-
- /**
+namespace Boot {
+/// @brief Halt and clear interrupts.
+/// @return
+inline Void Stop() noexcept {
+ while (YES) {
+ rt_cli();
+ rt_hlt();
+ }
+}
+
+/**
@brief Exit EFI API to let the OS load correctly.
Bascially frees everything we have in the EFI side.
*/
- inline Void ExitBootServices(UInt64 MapKey, EfiHandlePtr ImageHandle) noexcept
- {
- if (!ST)
- return;
-
- ST->BootServices->ExitBootServices(ImageHandle, MapKey);
- }
-
- inline UInt32 Platform() noexcept
- {
- return kPeMachineAMD64;
- }
-
- /***
- * @brief Throw an error, stop execution as well.
- * @param ErrorCode error code to be print.
- * @param Reason reason to be print.
- */
- inline void ThrowError(const EfiCharType* ErrorCode,
- const EfiCharType* Reason) noexcept
- {
- ST->ConOut->OutputString(ST->ConOut, L"\r*** STOP ***\r");
-
- ST->ConOut->OutputString(ST->ConOut, L"*** ERROR: ");
- ST->ConOut->OutputString(ST->ConOut, ErrorCode);
-
- ST->ConOut->OutputString(ST->ConOut, L" ***\r *** REASON: ");
- ST->ConOut->OutputString(ST->ConOut, Reason);
-
- ST->ConOut->OutputString(ST->ConOut, L" ***\r");
-
- Boot::Stop();
- }
-} // namespace Boot
-
-inline void fw_init_efi(EfiSystemTable* SystemTable) noexcept
-{
- if (!SystemTable)
- return;
-
- ST = SystemTable;
- BS = ST->BootServices;
+inline Void ExitBootServices(UInt64 MapKey, EfiHandlePtr ImageHandle) noexcept {
+ if (!ST) return;
+
+ ST->BootServices->ExitBootServices(ImageHandle, MapKey);
+}
+
+inline UInt32 Platform() noexcept {
+ return kPeMachineAMD64;
+}
+
+/***
+ * @brief Throw an error, stop execution as well.
+ * @param ErrorCode error code to be print.
+ * @param Reason reason to be print.
+ */
+inline void ThrowError(const EfiCharType* ErrorCode, const EfiCharType* Reason) noexcept {
+ ST->ConOut->OutputString(ST->ConOut, L"\r*** STOP ***\r");
+
+ ST->ConOut->OutputString(ST->ConOut, L"*** ERROR: ");
+ ST->ConOut->OutputString(ST->ConOut, ErrorCode);
+
+ ST->ConOut->OutputString(ST->ConOut, L" ***\r *** REASON: ");
+ ST->ConOut->OutputString(ST->ConOut, Reason);
+
+ ST->ConOut->OutputString(ST->ConOut, L" ***\r");
+
+ Boot::Stop();
+}
+} // namespace Boot
+
+inline void fw_init_efi(EfiSystemTable* SystemTable) noexcept {
+ if (!SystemTable) return;
+
+ ST = SystemTable;
+ BS = ST->BootServices;
}
#ifdef __BOOTZ__
#include <BootKit/Platform.h>
-#endif // ifdef __BOOTZ__
+#endif // ifdef __BOOTZ__
#endif /* ifndef __EFI_API__ */