-/* $OpenBSD: cpu.c,v 1.26 2023/06/15 22:18:07 cheloha Exp $ */
+/* $OpenBSD: cpu.c,v 1.27 2023/08/19 00:47:51 gkoehler Exp $ */
/*
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
ci->ci_initstack_end = km_alloc(PAGE_SIZE, &kv_any, &kp_zero,
&kd_waitok) + PAGE_SIZE;
- opal_start_cpu(ci->ci_pir, (vaddr_t)cpu_hatch);
-
- atomic_setbits_int(&ci->ci_flags, CPUF_IDENTIFY);
- membar_sync();
-
- while ((ci->ci_flags & CPUF_IDENTIFIED) == 0 &&
- --timeout)
- delay(1000);
- if (timeout == 0) {
- printf(" failed to identify");
+ if (opal_start_cpu(ci->ci_pir, (vaddr_t)cpu_hatch) ==
+ OPAL_SUCCESS) {
+ atomic_setbits_int(&ci->ci_flags, CPUF_IDENTIFY);
+ membar_sync();
+
+ while ((ci->ci_flags & CPUF_IDENTIFIED) == 0 &&
+ --timeout)
+ delay(1000);
+ if (timeout == 0) {
+ printf(" failed to identify");
+ ci->ci_flags = 0;
+ }
+ } else {
+ printf(" failed to start");
ci->ci_flags = 0;
}
}
if (CPU_IS_PRIMARY(ci))
continue;
+ if ((ci->ci_flags & CPUF_PRESENT) == 0)
+ continue;
ci->ci_randseed = (arc4random() & 0x7fffffff) + 1;
cpu_boot_secondary(ci);