-/* $OpenBSD: cpu.c,v 1.14 2018/02/20 23:46:48 kettenis Exp $ */
+/* $OpenBSD: cpu.c,v 1.15 2018/02/23 19:08:56 kettenis Exp $ */
/*
* Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com>
return 0;
}
-int (*cpu_on_fn)(register_t, register_t);
-
#ifdef MULTIPROCESSOR
void cpu_boot_secondary(struct cpu_info *ci);
switch (method) {
case 1:
/* psci */
- if (cpu_on_fn != 0)
- rc = !cpu_on_fn(ci->ci_mpidr, startaddr);
+#if NPSCI > 0
+ rc = (psci_cpu_on(ci->ci_mpidr, startaddr, 0) == PSCI_SUCCESS);
+#endif
break;
case 2:
/* spin-table */
-/* $OpenBSD: psci.c,v 1.5 2018/01/28 12:48:20 jsg Exp $ */
+/* $OpenBSD: psci.c,v 1.6 2018/02/23 19:08:56 kettenis Exp $ */
/*
* Copyright (c) 2016 Jonathan Gray <jsg@openbsd.org>
extern void (*cpuresetfn)(void);
extern void (*powerdownfn)(void);
-extern int (*cpu_on_fn)(register_t, register_t);
#define PSCI_VERSION 0x84000000
#define SYSTEM_OFF 0x84000008
void psci_attach(struct device *, struct device *, void *);
void psci_reset(void);
void psci_powerdown(void);
-int psci_cpu_on(register_t, register_t);
extern register_t hvc_call(register_t, register_t, register_t, register_t);
extern register_t smc_call(register_t, register_t, register_t, register_t);
powerdownfn = psci_powerdown;
if (sc->sc_system_reset != 0)
cpuresetfn = psci_reset;
- if (sc->sc_cpu_on != 0)
- cpu_on_fn = psci_cpu_on;
}
uint32_t
(*sc->sc_callfn)(sc->sc_system_off, 0, 0, 0);
}
-int
-psci_cpu_on(register_t mpidr, register_t pc)
+int32_t
+psci_cpu_on(register_t target_cpu, register_t entry_point_address,
+ register_t context_id)
{
struct psci_softc *sc = psci_sc;
- if (sc->sc_callfn)
- return (*sc->sc_callfn)(sc->sc_cpu_on, mpidr, pc, 0);
- return -1;
+
+ if (sc && sc->sc_callfn && sc->sc_cpu_on != 0)
+ return (*sc->sc_callfn)(sc->sc_cpu_on, target_cpu,
+ entry_point_address, context_id);
+
+ return PSCI_NOT_SUPPORTED;
}
#ifndef _SYS_DEV_FDT_PSCIVAR_H_
#define _SYS_DEV_FDT_PSCIVAR_H_
+#define PSCI_SUCCESS 0
+#define PSCI_NOT_SUPPORTED -1
+
uint32_t psci_version(void);
+int32_t psci_cpu_on(register_t, register_t, register_t);
#endif /* _SYS_DEV_FDT_PSCIVAR_H_ */