.section .text.platform
.global platform.init
platform.init:
str lr, [sp, #-16]!
// Stash the devicetree.
adr x0, root_process.data.devicetree_ptr
mov x1, #0x40000000
str x1, [x0]
// Initialize the PSCI. This is a hack until devicetree parsing works.
mov x0, #1
bl psci.init_with
// Set the PSCI's poweroff function as the panic function, replacing
// the system hanging.
adr x0, psci.system_off
adr x1, panic.function
str x0, [x1]
ldr lr, [sp], #16
ret
.global platform.debug_print
platform.debug_print:
ldr x2, =0x09000000
platform.debug_print.loop:
cbz x1, platform.debug_print.end
platform.debug_print.wait_for_ok_to_tx:
ldrb w3, [x2, #0x18]
tbz w3, 7, platform.debug_print.wait_for_ok_to_tx
ldrb w3, [x0], #1
sub x1, x1, #1
strb w3, [x2]
b platform.debug_print.loop
platform.debug_print.end:
ret
.global platform.idle
platform.idle:
wfi
ret
// vim: set ft=arm64asm :