diff options
Diffstat (limited to 'dev/Kernel/HALKit/ARM64/APM')
| -rw-r--r-- | dev/Kernel/HALKit/ARM64/APM/.gitkeep | 0 | ||||
| -rw-r--r-- | dev/Kernel/HALKit/ARM64/APM/APM.cc | 37 |
2 files changed, 37 insertions, 0 deletions
diff --git a/dev/Kernel/HALKit/ARM64/APM/.gitkeep b/dev/Kernel/HALKit/ARM64/APM/.gitkeep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/dev/Kernel/HALKit/ARM64/APM/.gitkeep diff --git a/dev/Kernel/HALKit/ARM64/APM/APM.cc b/dev/Kernel/HALKit/ARM64/APM/APM.cc new file mode 100644 index 00000000..d861420b --- /dev/null +++ b/dev/Kernel/HALKit/ARM64/APM/APM.cc @@ -0,0 +1,37 @@ +/* ------------------------------------------- + + Copyright (C) 2024, TQ B.V, all rights reserved. + +------------------------------------------- */ + +#include <Modules/APM/APM.h> +#include <KernelKit/LPC.h> + +using namespace Kernel; + +/// @brief Send a APM command into it's own IO space. +/// @param base_dma the IO base port. +/// @param cmd the command. +/// @return status code. +EXTERN_C Int32 apm_send_io_command(UInt16 cmd, APMPowerCmd value) +{ + switch (cmd) + { + case kAPMPowerCommandReboot: { + asm volatile( + "ldr x0, =0x84000009\n" + "hvc #0\n"); + + return kErrorSuccess; + } + case kAPMPowerCommandShutdown: { + asm volatile( + "ldr x0, =0x84000008\n" + "hvc #0\n"); + + return kErrorSuccess; + } + default: + return kErrorInvalidData; + } +} |
