AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
psci.c
Go to the documentation of this file.
1
9
10#include <core/system.h>
11#include <core/arch.h>
12
13/* The PSCI functions' IDs. */
14#define PSCI_SYSTEM_OFF 0x84000008
15#define PSCI_SYSTEM_RESET 0x84000009
16
18static void psci(uint64_t fn)
19{
20 register uint64_t x0 asm("x0") = fn;
21 asm volatile("hvc #0" : "+r"(x0) :: "memory");
22}
23
24/* Restarts the machine. */
25void arch_reboot(void)
26{
28}
29
30/* Powers off the machine, or halts it if the firmware doesn't. */
31void arch_poweroff(void)
32{
34 arch_halt();
35}
36
37/* Halts the CPU for good, with interrupts masked. */
38void arch_halt(void)
39{
41
42 for (;;)
43 asm volatile("wfi");
44}
static void arch_interrupts_disable(void)
Masks IRQs.
Definition arch.h:77
static void psci(uint64_t fn)
Calls a PSCI function.
Definition psci.c:18
void arch_reboot(void)
Restarts the machine.
Definition psci.c:25
void arch_halt(void)
Stops the CPU for good, with interrupts off.
Definition psci.c:38
#define PSCI_SYSTEM_RESET
Definition psci.c:15
void arch_poweroff(void)
Powers the machine off, or halts it if it can't be powered off.
Definition psci.c:31
#define PSCI_SYSTEM_OFF
Definition psci.c:14
unsigned long long int uint64_t
Definition stddef.h:23