// SPDX-License-Identifier: Apache-2.0 // Copyright 2024-2026, Amlal El Mahrouss (amlal@nekernel.org) // Licensed under the Apache License, Version 2.0 (see LICENSE file) // Official repository: https://github.com/ne-foss-org/nekernel #include #include using namespace Kernel; /// @brief Send APM command to its 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) { switch (cmd) { case kAPMPowerCommandReboot: { asm volatile( "ldr x0, =0x84000004\n" "svc #0\n"); return kErrorSuccess; } case kAPMPowerCommandShutdown: { asm volatile( "ldr x0, =0x84000008\n" "svc #0\n"); return kErrorSuccess; } default: return kErrorInvalidData; } }