Date: Tue, 16 Feb 2016 15:18:13 +0000 (UTC) From: Andrew Turner <andrew@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r295662 - in head/sys: arm/arm arm64/arm64 dev/ofw dev/tsec dev/uart dev/vt/hw/ofwfb mips/mips powerpc/ofw Message-ID: <201602161518.u1GFIDqn041039@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: andrew Date: Tue Feb 16 15:18:12 2016 New Revision: 295662 URL: https://svnweb.freebsd.org/changeset/base/295662 Log: Allow callers of OF_decode_addr to get the size of the found mapping. This will allow for code that uses the old fdt_get_range and fdt_regsize functions to find a range, map it, access, then unmap to replace this, up to and including the map, with a call to OF_decode_addr. As this function should only be used in the early boot code the unmap is mostly do document we no longer need the mapping as it's a no-op, at least on arm. Reviewed by: jhibbits Sponsored by: ABT Systems Ltd Differential Revision: https://reviews.freebsd.org/D5258 Modified: head/sys/arm/arm/ofw_machdep.c head/sys/arm64/arm64/ofw_machdep.c head/sys/dev/ofw/openfirm.h head/sys/dev/tsec/if_tsec_fdt.c head/sys/dev/uart/uart_cpu_fdt.c head/sys/dev/uart/uart_cpu_powerpc.c head/sys/dev/vt/hw/ofwfb/ofwfb.c head/sys/mips/mips/ofw_machdep.c head/sys/powerpc/ofw/ofw_machdep.c head/sys/powerpc/ofw/ofw_syscons.c Modified: head/sys/arm/arm/ofw_machdep.c ============================================================================== --- head/sys/arm/arm/ofw_machdep.c Tue Feb 16 14:03:25 2016 (r295661) +++ head/sys/arm/arm/ofw_machdep.c Tue Feb 16 15:18:12 2016 (r295662) @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); int OF_decode_addr(phandle_t dev, int regno, bus_space_tag_t *tag, - bus_space_handle_t *handle) + bus_space_handle_t *handle, bus_size_t *sz) { bus_addr_t addr; bus_size_t size; @@ -66,6 +66,10 @@ OF_decode_addr(phandle_t dev, int regno, *tag = fdtbus_bs_tag; flags = 0; #endif + + if (sz != NULL) + *sz = size; + return (bus_space_map(*tag, addr, size, flags, handle)); } Modified: head/sys/arm64/arm64/ofw_machdep.c ============================================================================== --- head/sys/arm64/arm64/ofw_machdep.c Tue Feb 16 14:03:25 2016 (r295661) +++ head/sys/arm64/arm64/ofw_machdep.c Tue Feb 16 15:18:12 2016 (r295662) @@ -39,7 +39,7 @@ extern struct bus_space memmap_bus; int OF_decode_addr(phandle_t dev, int regno, bus_space_tag_t *tag, - bus_space_handle_t *handle) + bus_space_handle_t *handle, bus_size_t *sz) { bus_addr_t addr; bus_size_t size; @@ -50,5 +50,9 @@ OF_decode_addr(phandle_t dev, int regno, return (err); *tag = &memmap_bus; + + if (sz != NULL) + *sz = size; + return (bus_space_map(*tag, addr, size, 0, handle)); } Modified: head/sys/dev/ofw/openfirm.h ============================================================================== --- head/sys/dev/ofw/openfirm.h Tue Feb 16 14:03:25 2016 (r295661) +++ head/sys/dev/ofw/openfirm.h Tue Feb 16 15:18:12 2016 (r295662) @@ -176,7 +176,7 @@ int OF_interpret(const char *cmd, int n */ #ifndef __sparc64__ int OF_decode_addr(phandle_t dev, int regno, bus_space_tag_t *ptag, - bus_space_handle_t *phandle); + bus_space_handle_t *phandle, bus_size_t *sz); #endif #endif /* _KERNEL */ Modified: head/sys/dev/tsec/if_tsec_fdt.c ============================================================================== --- head/sys/dev/tsec/if_tsec_fdt.c Tue Feb 16 14:03:25 2016 (r295661) +++ head/sys/dev/tsec/if_tsec_fdt.c Tue Feb 16 15:18:12 2016 (r295662) @@ -167,7 +167,7 @@ tsec_fdt_attach(device_t dev) } phy = OF_node_from_xref(phy); - OF_decode_addr(OF_parent(phy), 0, &sc->phy_bst, &sc->phy_bsh); + OF_decode_addr(OF_parent(phy), 0, &sc->phy_bst, &sc->phy_bsh, NULL); OF_getencprop(phy, "reg", &sc->phyaddr, sizeof(sc->phyaddr)); /* Init timer */ Modified: head/sys/dev/uart/uart_cpu_fdt.c ============================================================================== --- head/sys/dev/uart/uart_cpu_fdt.c Tue Feb 16 14:03:25 2016 (r295661) +++ head/sys/dev/uart/uart_cpu_fdt.c Tue Feb 16 15:18:12 2016 (r295662) @@ -212,5 +212,5 @@ uart_cpu_getdev(int devtype, struct uart di->stopbits = 1; di->parity = UART_PARITY_NONE; - return (OF_decode_addr(node, 0, &di->bas.bst, &di->bas.bsh)); + return (OF_decode_addr(node, 0, &di->bas.bst, &di->bas.bsh, NULL)); } Modified: head/sys/dev/uart/uart_cpu_powerpc.c ============================================================================== --- head/sys/dev/uart/uart_cpu_powerpc.c Tue Feb 16 14:03:25 2016 (r295661) +++ head/sys/dev/uart/uart_cpu_powerpc.c Tue Feb 16 15:18:12 2016 (r295662) @@ -180,7 +180,7 @@ uart_cpu_getdev(int devtype, struct uart if (class == NULL) return (ENXIO); - error = OF_decode_addr(input, 0, &di->bas.bst, &di->bas.bsh); + error = OF_decode_addr(input, 0, &di->bas.bst, &di->bas.bsh, NULL); if (error) return (error); Modified: head/sys/dev/vt/hw/ofwfb/ofwfb.c ============================================================================== --- head/sys/dev/vt/hw/ofwfb/ofwfb.c Tue Feb 16 14:03:25 2016 (r295661) +++ head/sys/dev/vt/hw/ofwfb/ofwfb.c Tue Feb 16 15:18:12 2016 (r295662) @@ -480,7 +480,8 @@ ofwfb_init(struct vt_device *vd) return (CN_DEAD); #if defined(__powerpc__) - OF_decode_addr(node, fb_phys, &sc->sc_memt, &sc->fb.fb_vbase); + OF_decode_addr(node, fb_phys, &sc->sc_memt, &sc->fb.fb_vbase, + NULL); sc->fb.fb_pbase = sc->fb.fb_vbase; /* 1:1 mapped */ #ifdef __powerpc64__ /* Real mode under a hypervisor probably doesn't cover FB */ Modified: head/sys/mips/mips/ofw_machdep.c ============================================================================== --- head/sys/mips/mips/ofw_machdep.c Tue Feb 16 14:03:25 2016 (r295661) +++ head/sys/mips/mips/ofw_machdep.c Tue Feb 16 15:18:12 2016 (r295662) @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); int OF_decode_addr(phandle_t dev, int regno, bus_space_tag_t *tag, - bus_space_handle_t *handle) + bus_space_handle_t *handle, bus_size_t *sz) { bus_addr_t addr; bus_size_t size; @@ -66,5 +66,9 @@ OF_decode_addr(phandle_t dev, int regno, *tag = fdtbus_bs_tag; flags = 0; #endif + + if (sz != NULL) + *sz = size; + return (bus_space_map(*tag, addr, size, flags, handle)); } Modified: head/sys/powerpc/ofw/ofw_machdep.c ============================================================================== --- head/sys/powerpc/ofw/ofw_machdep.c Tue Feb 16 14:03:25 2016 (r295661) +++ head/sys/powerpc/ofw/ofw_machdep.c Tue Feb 16 15:18:12 2016 (r295662) @@ -565,7 +565,7 @@ OF_getetheraddr(device_t dev, u_char *ad */ int OF_decode_addr(phandle_t dev, int regno, bus_space_tag_t *tag, - bus_space_handle_t *handle) + bus_space_handle_t *handle, bus_size_t *sz) { bus_addr_t addr; bus_size_t size; @@ -585,6 +585,9 @@ OF_decode_addr(phandle_t dev, int regno, BUS_SPACE_MAP_PREFETCHABLE: 0; } + if (sz != NULL) + *sz = size; + return (bus_space_map(*tag, addr, size, flags, handle)); } Modified: head/sys/powerpc/ofw/ofw_syscons.c ============================================================================== --- head/sys/powerpc/ofw/ofw_syscons.c Tue Feb 16 14:03:25 2016 (r295661) +++ head/sys/powerpc/ofw/ofw_syscons.c Tue Feb 16 15:18:12 2016 (r295662) @@ -342,7 +342,7 @@ ofwfb_configure(int flags) if (fb_phys == sc->sc_num_pciaddrs) return (0); - OF_decode_addr(node, fb_phys, &sc->sc_tag, &sc->sc_addr); + OF_decode_addr(node, fb_phys, &sc->sc_tag, &sc->sc_addr, NULL); } ofwfb_init(0, &sc->sc_va, 0);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201602161518.u1GFIDqn041039>