Hi, While code-reading the riscv64 port (which leans on some arm64 code), I have found a small gotcha in /sys/arch/arm64/dev/mainbus.c. The patch is self explanatory and leans on the fix from simplebus.c line 210.
Index: mainbus.c =================================================================== RCS file: /cvs/src/sys/arch/arm64/dev/mainbus.c,v retrieving revision 1.15 diff -u -p -u -r1.15 mainbus.c --- mainbus.c 23 Oct 2019 09:27:43 -0000 1.15 +++ mainbus.c 9 Apr 2020 07:02:13 -0000 @@ -220,7 +220,7 @@ mainbus_attach_node(struct device *self, len = OF_getproplen(node, "reg"); line = (sc->sc_acells + sc->sc_scells) * sizeof(uint32_t); - if (len > 0 && (len % line) == 0) { + if (len > 0 && line > 0 && (len % line) == 0) { reg = malloc(len, M_TEMP, M_WAITOK); OF_getpropintarray(node, "reg", reg, len); Basically it avoids a divide by zero if acells or scells happen to be 0. Probably not possible but this check is also in simplebus.c so thought I'd get it reported. Best Regards, -peter