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
This commit is contained in:
parent
3884d6f8bd
commit
45fd186285
@ -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, bus_space_tag_t *tag,
|
||||
*tag = fdtbus_bs_tag;
|
||||
flags = 0;
|
||||
#endif
|
||||
|
||||
if (sz != NULL)
|
||||
*sz = size;
|
||||
|
||||
return (bus_space_map(*tag, addr, size, flags, handle));
|
||||
}
|
||||
|
||||
|
@ -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, bus_space_tag_t *tag,
|
||||
return (err);
|
||||
|
||||
*tag = &memmap_bus;
|
||||
|
||||
if (sz != NULL)
|
||||
*sz = size;
|
||||
|
||||
return (bus_space_map(*tag, addr, size, 0, handle));
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ int OF_interpret(const char *cmd, int nreturns, ...);
|
||||
*/
|
||||
#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 */
|
||||
|
@ -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 */
|
||||
|
@ -212,5 +212,5 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
|
||||
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));
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
|
||||
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);
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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, bus_space_tag_t *tag,
|
||||
*tag = fdtbus_bs_tag;
|
||||
flags = 0;
|
||||
#endif
|
||||
|
||||
if (sz != NULL)
|
||||
*sz = size;
|
||||
|
||||
return (bus_space_map(*tag, addr, size, flags, handle));
|
||||
}
|
||||
|
@ -565,7 +565,7 @@ OF_getetheraddr(device_t dev, u_char *addr)
|
||||
*/
|
||||
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_tag_t *tag,
|
||||
BUS_SPACE_MAP_PREFETCHABLE: 0;
|
||||
}
|
||||
|
||||
if (sz != NULL)
|
||||
*sz = size;
|
||||
|
||||
return (bus_space_map(*tag, addr, size, flags, handle));
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user