From d71a00e9f5db2379d1f267a151b90f1c19dce24d Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Tue, 7 Mar 2023 00:15:32 -0600 Subject: [PATCH] arm64: ofw: respect the nonposted-mmio prop in OF_decode_addr() This is the only mapping remaining which needs to respect nonposted-mmio to avoid breaking the boot on Apple silicon. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D38920 --- sys/arm64/arm64/ofw_machdep.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/arm64/arm64/ofw_machdep.c b/sys/arm64/arm64/ofw_machdep.c index 3941c1d3561..61aa4c1a120 100644 --- a/sys/arm64/arm64/ofw_machdep.c +++ b/sys/arm64/arm64/ofw_machdep.c @@ -43,7 +43,8 @@ OF_decode_addr(phandle_t dev, int regno, bus_space_tag_t *tag, { bus_addr_t addr; bus_size_t size; - int err; + phandle_t parent; + int err, flags; err = ofw_reg_to_paddr(dev, regno, &addr, &size, NULL); if (err != 0) @@ -54,5 +55,10 @@ OF_decode_addr(phandle_t dev, int regno, bus_space_tag_t *tag, if (sz != NULL) *sz = size; - return (bus_space_map(*tag, addr, size, 0, handle)); + flags = 0; + parent = OF_parent(dev); + if (parent > 0 && OF_hasprop(parent, "nonposted-mmio")) + flags |= BUS_SPACE_MAP_NONPOSTED; + + return (bus_space_map(*tag, addr, size, flags, handle)); }