arm64: Add a CPU reset hook instead of expecting PSCI

Some SoCs do not include a PSCI for power management and defer it to
something else instead. Add a CPU reset hook to account for this, and
use it in the psci driver.

Reviewed by:	andrew
Obtained from:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D44535
This commit is contained in:
Stephen J. Kiernan 2024-04-05 17:37:15 -04:00
parent 1b60bbfe65
commit 3bbe8ed1a7
2 changed files with 11 additions and 1 deletions

View file

@ -54,6 +54,13 @@
#include <dev/psci/psci.h>
/*
* psci.c is "default" in ARM64 kernel config files
* psci_reset will do nothing until/unless the psci device probes/attaches.
* Therefore, it is safe to default the cpu_reset_hook to psci_reset.
*/
cpu_reset_hook_t cpu_reset_hook = psci_reset;
/*
* Finish a fork operation, with process p2 nearly set up.
* Copy and update the pcb, set up the stack so that the child
@ -123,7 +130,7 @@ void
cpu_reset(void)
{
psci_reset();
cpu_reset_hook();
printf("cpu_reset failed");
while(1)

View file

@ -206,6 +206,9 @@ extern uint64_t __cpu_affinity[];
struct arm64_addr_mask;
extern struct arm64_addr_mask elf64_addr_mask;
typedef void (*cpu_reset_hook_t)(void);
extern cpu_reset_hook_t cpu_reset_hook;
void cpu_halt(void) __dead2;
void cpu_reset(void) __dead2;
void fork_trampoline(void);