32c32
< __FBSDID("$FreeBSD: head/sys/dev/ofw/ofw_cpu.c 277378 2015-01-19 11:06:56Z andrew $");
---
> __FBSDID("$FreeBSD: head/sys/dev/ofw/ofw_cpu.c 277491 2015-01-21 16:52:24Z andrew $");
53a54,57
> struct ofw_cpulist_softc {
> pcell_t sc_addr_cells;
> };
>
77c81
< 0
---
> sizeof(struct ofw_cpulist_softc)
102a107
> struct ofw_cpulist_softc *sc;
106a112
> sc = device_get_softc(dev);
108a115,118
> sc->sc_addr_cells = 1;
> OF_getencprop(root, "#address-cells", &sc->sc_addr_cells,
> sizeof(sc->sc_addr_cells));
>
143a154,155
> boolean_t sc_reg_valid;
> pcell_t sc_reg[2];
187a200
> struct ofw_cpulist_softc *psc;
190c203,204
< uint32_t cell;
---
> pcell_t cell;
> int rv;
193,196c207,212
< node = ofw_bus_get_node(dev);
< if (OF_getencprop(node, "reg", &cell, sizeof(cell)) < 0) {
< cell = device_get_unit(dev);
< device_printf(dev, "missing 'reg' property, using %u\n", cell);
---
> psc = device_get_softc(device_get_parent(dev));
>
> if (nitems(sc->sc_reg) < psc->sc_addr_cells) {
> if (bootverbose)
> device_printf(dev, "Too many address cells\n");
> return (EINVAL);
198c214,232
< sc->sc_cpu_pcpu = pcpu_find(cell);
---
>
> node = ofw_bus_get_node(dev);
>
> /* Read and validate the reg property for use later */
> sc->sc_reg_valid = false;
> rv = OF_getencprop(node, "reg", sc->sc_reg, sizeof(sc->sc_reg));
> if (rv < 0)
> device_printf(dev, "missing 'reg' property\n");
> else if ((rv % 4) != 0) {
> if (bootverbose)
> device_printf(dev, "Malformed reg property\n");
> } else if ((rv / 4) != psc->sc_addr_cells) {
> if (bootverbose)
> device_printf(dev, "Invalid reg size %u\n", rv);
> } else
> sc->sc_reg_valid = true;
>
> sc->sc_cpu_pcpu = pcpu_find(device_get_unit(dev));
>
< __FBSDID("$FreeBSD: head/sys/dev/ofw/ofw_cpu.c 277378 2015-01-19 11:06:56Z andrew $");
---
> __FBSDID("$FreeBSD: head/sys/dev/ofw/ofw_cpu.c 277491 2015-01-21 16:52:24Z andrew $");
53a54,57
> struct ofw_cpulist_softc {
> pcell_t sc_addr_cells;
> };
>
77c81
< 0
---
> sizeof(struct ofw_cpulist_softc)
102a107
> struct ofw_cpulist_softc *sc;
106a112
> sc = device_get_softc(dev);
108a115,118
> sc->sc_addr_cells = 1;
> OF_getencprop(root, "#address-cells", &sc->sc_addr_cells,
> sizeof(sc->sc_addr_cells));
>
143a154,155
> boolean_t sc_reg_valid;
> pcell_t sc_reg[2];
187a200
> struct ofw_cpulist_softc *psc;
190c203,204
< uint32_t cell;
---
> pcell_t cell;
> int rv;
193,196c207,212
< node = ofw_bus_get_node(dev);
< if (OF_getencprop(node, "reg", &cell, sizeof(cell)) < 0) {
< cell = device_get_unit(dev);
< device_printf(dev, "missing 'reg' property, using %u\n", cell);
---
> psc = device_get_softc(device_get_parent(dev));
>
> if (nitems(sc->sc_reg) < psc->sc_addr_cells) {
> if (bootverbose)
> device_printf(dev, "Too many address cells\n");
> return (EINVAL);
198c214,232
< sc->sc_cpu_pcpu = pcpu_find(cell);
---
>
> node = ofw_bus_get_node(dev);
>
> /* Read and validate the reg property for use later */
> sc->sc_reg_valid = false;
> rv = OF_getencprop(node, "reg", sc->sc_reg, sizeof(sc->sc_reg));
> if (rv < 0)
> device_printf(dev, "missing 'reg' property\n");
> else if ((rv % 4) != 0) {
> if (bootverbose)
> device_printf(dev, "Malformed reg property\n");
> } else if ((rv / 4) != psc->sc_addr_cells) {
> if (bootverbose)
> device_printf(dev, "Invalid reg size %u\n", rv);
> } else
> sc->sc_reg_valid = true;
>
> sc->sc_cpu_pcpu = pcpu_find(device_get_unit(dev));
>