diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2021-05-04 06:32:59 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2021-05-04 06:32:59 +0000 |
commit | bc561a2d134620fd47fe4c162bfb7dfd4bd64e6d (patch) | |
tree | ff22394035fced8cb691c68739ce4cb734998d16 | |
parent | 717646a7d497459f4f1df413e293f783b21a2528 (diff) |
Check that fdt hart id matches boot hart id before associating an fdt
node with the primary cpu.
Prompted by the polarfire icicle where hart 0 is an mmuless e51 core.
ok drahn@ mlarkin@
-rw-r--r-- | sys/arch/riscv64/dev/mainbus.c | 4 | ||||
-rw-r--r-- | sys/arch/riscv64/riscv64/machdep.c | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/sys/arch/riscv64/dev/mainbus.c b/sys/arch/riscv64/dev/mainbus.c index c94c43f58fb..faa9831427f 100644 --- a/sys/arch/riscv64/dev/mainbus.c +++ b/sys/arch/riscv64/dev/mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.c,v 1.2 2021/05/03 21:25:48 kettenis Exp $ */ +/* $OpenBSD: mainbus.c,v 1.3 2021/05/04 06:32:58 jsg Exp $ */ /* * Copyright (c) 2016 Patrick Wildt <patrick@blueri.se> * Copyright (c) 2017 Mark Kettenis <kettenis@openbsd.org> @@ -323,7 +323,7 @@ mainbus_match_primary(struct device *parent, void *match, void *aux) struct fdt_attach_args *fa = aux; struct cfdata *cf = match; - if (fa->fa_nreg < 1) + if (fa->fa_nreg < 1 || fa->fa_reg[0].addr != boot_hart) return 0; return (*cf->cf_attach->ca_match)(parent, match, aux); diff --git a/sys/arch/riscv64/riscv64/machdep.c b/sys/arch/riscv64/riscv64/machdep.c index f33a3526948..7fae71ce895 100644 --- a/sys/arch/riscv64/riscv64/machdep.c +++ b/sys/arch/riscv64/riscv64/machdep.c @@ -567,6 +567,10 @@ initriscv(struct riscv_bootparams *rbp) int len; static uint8_t lladdr[6]; + len = fdt_node_property(node, "boot-hartid", &prop); + if (len == sizeof(boot_hart)) + boot_hart = bemtoh32((uint32_t *)prop); + len = fdt_node_property(node, "bootargs", &prop); if (len > 0) collect_kernel_args(prop); |