summaryrefslogtreecommitdiffstats
path: root/sys/dev/fdt
diff options
context:
space:
mode:
authorian <ian@FreeBSD.org>2015-05-23 22:36:41 +0000
committerian <ian@FreeBSD.org>2015-05-23 22:36:41 +0000
commit011666b0a8c74e747a5483f15fb01e9ac7dac93c (patch)
treeadb6f1b04d7fdde4fd2c8ba9ed690bd314f62381 /sys/dev/fdt
parent132e8a35de4a2129b8843c01be9c949f9501e845 (diff)
downloadFreeBSD-src-011666b0a8c74e747a5483f15fb01e9ac7dac93c.zip
FreeBSD-src-011666b0a8c74e747a5483f15fb01e9ac7dac93c.tar.gz
MFC r277098, r279235:
Introduce ofw_bus_reg_to_rl() to replace part of common bus code Fix endianness on FDT read in ARM GIC
Diffstat (limited to 'sys/dev/fdt')
-rw-r--r--sys/dev/fdt/simplebus.c31
1 files changed, 1 insertions, 30 deletions
diff --git a/sys/dev/fdt/simplebus.c b/sys/dev/fdt/simplebus.c
index d432791..7c2f0c6 100644
--- a/sys/dev/fdt/simplebus.c
+++ b/sys/dev/fdt/simplebus.c
@@ -253,10 +253,6 @@ simplebus_setup_dinfo(device_t dev, phandle_t node)
{
struct simplebus_softc *sc;
struct simplebus_devinfo *ndi;
- uint32_t *reg;
- uint64_t phys, size;
- int i, j, k;
- int nreg;
sc = device_get_softc(dev);
@@ -267,32 +263,7 @@ simplebus_setup_dinfo(device_t dev, phandle_t node)
}
resource_list_init(&ndi->rl);
- nreg = OF_getencprop_alloc(node, "reg", sizeof(*reg), (void **)&reg);
- if (nreg == -1)
- nreg = 0;
- if (nreg % (sc->acells + sc->scells) != 0) {
- if (bootverbose)
- device_printf(dev, "Malformed reg property on <%s>\n",
- ndi->obdinfo.obd_name);
- nreg = 0;
- }
-
- for (i = 0, k = 0; i < nreg; i += sc->acells + sc->scells, k++) {
- phys = size = 0;
- for (j = 0; j < sc->acells; j++) {
- phys <<= 32;
- phys |= reg[i + j];
- }
- for (j = 0; j < sc->scells; j++) {
- size <<= 32;
- size |= reg[i + sc->acells + j];
- }
-
- resource_list_add(&ndi->rl, SYS_RES_MEMORY, k,
- phys, phys + size - 1, size);
- }
- free(reg, M_OFWPROP);
-
+ ofw_bus_reg_to_rl(dev, node, sc->acells, sc->scells, &ndi->rl);
ofw_bus_intr_to_rl(dev, node, &ndi->rl);
return (ndi);
OpenPOWER on IntegriCloud