AquilaOS documentation
How it works, and its code
Toggle main menu visibility
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
18
static
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. */
25
void
arch_reboot
(
void
)
26
{
27
psci
(
PSCI_SYSTEM_RESET
);
28
}
29
30
/* Powers off the machine, or halts it if the firmware doesn't. */
31
void
arch_poweroff
(
void
)
32
{
33
psci
(
PSCI_SYSTEM_OFF
);
34
arch_halt
();
35
}
36
37
/* Halts the CPU for good, with interrupts masked. */
38
void
arch_halt
(
void
)
39
{
40
arch_interrupts_disable
();
41
42
for
(;;)
43
asm
volatile
(
"wfi"
);
44
}
arch_interrupts_disable
static void arch_interrupts_disable(void)
Masks IRQs.
Definition
arch.h:77
arch.h
system.h
psci
static void psci(uint64_t fn)
Calls a PSCI function.
Definition
psci.c:18
arch_reboot
void arch_reboot(void)
Restarts the machine.
Definition
psci.c:25
arch_halt
void arch_halt(void)
Stops the CPU for good, with interrupts off.
Definition
psci.c:38
PSCI_SYSTEM_RESET
#define PSCI_SYSTEM_RESET
Definition
psci.c:15
arch_poweroff
void arch_poweroff(void)
Powers the machine off, or halts it if it can't be powered off.
Definition
psci.c:31
PSCI_SYSTEM_OFF
#define PSCI_SYSTEM_OFF
Definition
psci.c:14
uint64_t
unsigned long long int uint64_t
Definition
stddef.h:23
kernel
arch
aarch64
platform
virt
psci.c
Generated by
1.18.0