Create a new PSCI error code and use it to signal that starting the CPU is

impossible as the PSCI firmware is missing.

Sponsored by:	ABT Systmes Ltd
This commit is contained in:
andrew 2016-10-25 14:18:27 +00:00
parent 96474ac2aa
commit d01cc693f9
3 changed files with 13 additions and 5 deletions

View File

@ -461,9 +461,13 @@ cpu_init_fdt(u_int id, phandle_t node, u_int addr_size, pcell_t *reg)
err = psci_cpu_on(target_cpu, pa, cpuid); err = psci_cpu_on(target_cpu, pa, cpuid);
if (err != PSCI_RETVAL_SUCCESS) { if (err != PSCI_RETVAL_SUCCESS) {
/* Panic here if INVARIANTS are enabled */ /*
KASSERT(0, ("Failed to start CPU %u (%lx)\n", id, * Panic here if INVARIANTS are enabled and PSCI failed to
target_cpu)); * start the requested CPU. If psci_cpu_on returns PSCI_MISSING
* to indicate we are unable to use it to start the given CPU.
*/
KASSERT(err == PSCI_MISSING,
("Failed to start CPU %u (%lx)\n", id, target_cpu));
pcpu_destroy(pcpup); pcpu_destroy(pcpup);
kmem_free(kernel_arena, (vm_offset_t)dpcpu[cpuid - 1], kmem_free(kernel_arena, (vm_offset_t)dpcpu[cpuid - 1],

View File

@ -189,12 +189,12 @@ psci_cpu_on(unsigned long cpu, unsigned long entry, unsigned long context_id)
node = ofw_bus_find_compatible(OF_peer(0), "arm,psci-0.2"); node = ofw_bus_find_compatible(OF_peer(0), "arm,psci-0.2");
if (node == 0) if (node == 0)
/* TODO: Handle psci 0.1 */ /* TODO: Handle psci 0.1 */
return (PSCI_RETVAL_INTERNAL_FAILURE); return (PSCI_MISSING);
fnid = PSCI_FNID_CPU_ON; fnid = PSCI_FNID_CPU_ON;
callfn = psci_get_callfn(node); callfn = psci_get_callfn(node);
if (callfn == NULL) if (callfn == NULL)
return (PSCI_RETVAL_INTERNAL_FAILURE); return (PSCI_MISSING);
} else { } else {
callfn = psci_softc->psci_call; callfn = psci_softc->psci_call;
fnid = psci_softc->psci_fnids[PSCI_FN_CPU_ON]; fnid = psci_softc->psci_fnids[PSCI_FN_CPU_ON];

View File

@ -54,6 +54,10 @@ int psci_smc_despatch(register_t, register_t, register_t, register_t);
#define PSCI_RETVAL_INTERNAL_FAILURE -6 #define PSCI_RETVAL_INTERNAL_FAILURE -6
#define PSCI_RETVAL_NOT_PRESENT -7 #define PSCI_RETVAL_NOT_PRESENT -7
#define PSCI_RETVAL_DISABLED -8 #define PSCI_RETVAL_DISABLED -8
/*
* Used to signal PSCI is not available, e.g. to start a CPU.
*/
#define PSCI_MISSING 1
/* /*
* PSCI function codes (as per PSCI v0.2). * PSCI function codes (as per PSCI v0.2).