Deleted Added
full compact
3a4
> * Copyright (c) 2009 The FreeBSD Foundation
5a7,9
> * Portions of this software were developed by Semihalf
> * under sponsorship from the FreeBSD Foundation.
> *
31c35
< __FBSDID("$FreeBSD: head/sys/powerpc/mpc85xx/lbc.c 186288 2008-12-18 18:27:12Z raj $");
---
> __FBSDID("$FreeBSD: head/sys/powerpc/mpc85xx/lbc.c 209908 2010-07-11 21:08:29Z raj $");
42d45
< #include <machine/ocpbus.h>
47c50,53
< #include <powerpc/mpc85xx/lbc.h>
---
> #include <dev/fdt/fdt_common.h>
> #include <dev/ofw/ofw_bus.h>
> #include <dev/ofw/ofw_bus_subr.h>
>
49d54
< #include <powerpc/mpc85xx/ocpbus.h>
51,52c56,57
< struct lbc_softc {
< device_t sc_dev;
---
> #include "ofw_bus_if.h"
> #include "lbc.h"
54,57c59,60
< struct resource *sc_res;
< bus_space_handle_t sc_bsh;
< bus_space_tag_t sc_bst;
< int sc_rid;
---
> #define DEBUG
> #undef DEBUG
59,61c62,67
< struct rman sc_rman;
< vm_offset_t sc_kva[LBC_DEV_MAX];
< };
---
> #ifdef DEBUG
> #define debugf(fmt, args...) do { printf("%s(): ", __func__); \
> printf(fmt,##args); } while (0)
> #else
> #define debugf(fmt, args...)
> #endif
63,67c69,71
< struct lbc_devinfo {
< int lbc_devtype;
< /* LBC child unit. It also represents resource table entry number */
< int lbc_unit;
< };
---
> static __inline void
> lbc_write_reg(struct lbc_softc *sc, bus_size_t off, uint32_t val)
> {
69,76c73,74
< /* Resources for MPC8555CDS system */
< const struct lbc_resource mpc85xx_lbc_resources[] = {
< /* Boot flash bank */
< {
< LBC_DEVTYPE_CFI, 0, 0xff800000, 0x00800000, 16,
< LBCRES_MSEL_GPCM, LBCRES_DECC_DISABLED,
< LBCRES_ATOM_DISABLED, 0
< },
---
> bus_space_write_4(sc->sc_bst, sc->sc_bsh, off, val);
> }
78,83c76,78
< /* Second flash bank */
< {
< LBC_DEVTYPE_CFI, 1, 0xff000000, 0x00800000, 16,
< LBCRES_MSEL_GPCM, LBCRES_DECC_DISABLED,
< LBCRES_ATOM_DISABLED, 0
< },
---
> static __inline uint32_t
> lbc_read_reg(struct lbc_softc *sc, bus_size_t off)
> {
85,90c80,81
< /* DS1553 RTC/NVRAM */
< {
< LBC_DEVTYPE_RTC, 2, 0xf8000000, 0x8000, 8,
< LBCRES_MSEL_GPCM, LBCRES_DECC_DISABLED,
< LBCRES_ATOM_DISABLED, 0
< },
---
> return (bus_space_read_4(sc->sc_bst, sc->sc_bsh, off));
> }
92,93c83
< {0}
< };
---
> static MALLOC_DEFINE(M_LBC, "localbus", "localbus devices information");
98,99d87
< static int lbc_get_resource(device_t, device_t, int, int, u_long *,
< u_long *);
105c93
< static int lbc_read_ivar(device_t, device_t, int, uintptr_t *);
---
> static const struct ofw_bus_devinfo *lbc_get_devinfo(device_t, device_t);
118d105
< DEVMETHOD(bus_read_ivar, lbc_read_ivar),
122d108
< DEVMETHOD(bus_get_resource, NULL),
127a114,121
> /* OFW bus interface */
> DEVMETHOD(ofw_bus_get_devinfo, lbc_get_devinfo),
> DEVMETHOD(ofw_bus_get_compat, ofw_bus_gen_get_compat),
> DEVMETHOD(ofw_bus_get_model, ofw_bus_gen_get_model),
> DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name),
> DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node),
> DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type),
>
135a130
>
137d131
< DRIVER_MODULE(lbc, ocpbus, lbc_driver, lbc_devclass, 0, 0);
139,141c133
< static __inline void
< lbc_write_reg(struct lbc_softc *sc, bus_size_t off, uint32_t val)
< {
---
> DRIVER_MODULE(lbc, fdtbus, lbc_driver, lbc_devclass, 0, 0);
143,152d134
< bus_space_write_4(sc->sc_bst, sc->sc_bsh, off, val);
< }
<
< static __inline uint32_t
< lbc_read_reg(struct lbc_softc *sc, bus_size_t off)
< {
<
< return (bus_space_read_4(sc->sc_bst, sc->sc_bsh, off));
< }
<
179,180c161,162
< static device_t
< lbc_mk_child(device_t dev, const struct lbc_resource *lbcres)
---
> static void
> lbc_banks_unmap(struct lbc_softc *sc)
182,183c164
< struct lbc_devinfo *dinfo;
< device_t child;
---
> int i;
185,186c166,168
< if (lbcres->lbr_unit > LBC_DEV_MAX - 1)
< return (NULL);
---
> for (i = 0; i < LBC_DEV_MAX; i++) {
> if (sc->sc_banks[i].size == 0)
> continue;
188,191c170,172
< child = device_add_child(dev, NULL, -1);
< if (child == NULL) {
< device_printf(dev, "could not add LBC child device\n");
< return (NULL);
---
> law_disable(OCP85XX_TGTIF_LBC, sc->sc_banks[i].pa,
> sc->sc_banks[i].size);
> pmap_unmapdev(sc->sc_banks[i].va, sc->sc_banks[i].size);
193,197d173
< dinfo = malloc(sizeof(struct lbc_devinfo), M_DEVBUF, M_WAITOK | M_ZERO);
< dinfo->lbc_devtype = lbcres->lbr_devtype;
< dinfo->lbc_unit = lbcres->lbr_unit;
< device_set_ivars(child, dinfo);
< return (child);
201c177
< lbc_init_child(device_t dev, device_t child)
---
> lbc_banks_map(struct lbc_softc *sc)
203,205d178
< struct lbc_softc *sc;
< struct lbc_devinfo *dinfo;
< const struct lbc_resource *res;
207,208c180
< uint32_t regbuff;
< int error, unit;
---
> int error, i;
210,218c182,183
< sc = device_get_softc(dev);
< dinfo = device_get_ivars(child);
<
< res = mpc85xx_lbc_resources;
<
< regbuff = 0;
< unit = -1;
< for (; res->lbr_devtype; res++) {
< if (res->lbr_unit != dinfo->lbc_unit)
---
> for (i = 0; i < LBC_DEV_MAX; i++) {
> if (sc->sc_banks[i].size == 0)
221,223c186,188
< start = res->lbr_base_addr;
< size = res->lbr_size;
< unit = res->lbr_unit;
---
> /* Physical address start/size. */
> start = sc->sc_banks[i].pa;
> size = sc->sc_banks[i].size;
226,227c191,192
< * Configure LAW for this LBC device and map its physical
< * memory region into KVA
---
> * Configure LAW for this LBC bank (CS) and map its physical
> * memory region into KVA.
233,235c198,200
< sc->sc_kva[unit] = (vm_offset_t)pmap_mapdev(start, size);
< if (sc->sc_kva[unit] == 0) {
< law_disable(OCP85XX_TGTIF_LBC, start, size);
---
> sc->sc_banks[i].va = (vm_offset_t)pmap_mapdev(start, size);
> if (sc->sc_banks[i].va == 0) {
> lbc_banks_unmap(sc);
237a203,205
> }
> return (0);
> }
238a207,217
> static int
> lbc_banks_enable(struct lbc_softc *sc)
> {
> u_long size;
> uint32_t regval;
> int error, i;
>
> for (i = 0; i < LBC_DEV_MAX; i++) {
> size = sc->sc_banks[i].size;
> if (size == 0)
> continue;
240c219
< * Compute and program BR value
---
> * Compute and program BR value.
242c221,222
< regbuff |= start;
---
> regval = 0;
> regval |= sc->sc_banks[i].pa;
244c224
< switch (res->lbr_port_size) {
---
> switch (sc->sc_banks[i].width) {
246c226
< regbuff |= (1 << 11);
---
> regval |= (1 << 11);
249c229
< regbuff |= (2 << 11);
---
> regval |= (2 << 11);
252c232
< regbuff |= (3 << 11);
---
> regval |= (3 << 11);
258,262c238,242
< regbuff |= (res->lbr_decc << 9);
< regbuff |= (res->lbr_wp << 8);
< regbuff |= (res->lbr_msel << 5);
< regbuff |= (res->lbr_atom << 2);
< regbuff |= 1;
---
> regval |= (sc->sc_banks[i].decc << 9);
> regval |= (sc->sc_banks[i].wp << 8);
> regval |= (sc->sc_banks[i].msel << 5);
> regval |= (sc->sc_banks[i].atom << 2);
> regval |= 1;
264c244
< lbc_write_reg(sc, LBC85XX_BR(unit), regbuff);
---
> lbc_write_reg(sc, LBC85XX_BR(i), regval);
267c247
< * Compute and program OR value
---
> * Compute and program OR value.
269,270c249,250
< regbuff = 0;
< regbuff |= lbc_address_mask(size);
---
> regval = 0;
> regval |= lbc_address_mask(size);
272c252
< switch (res->lbr_msel) {
---
> switch (sc->sc_banks[i].msel) {
275c255
< regbuff |= 0x00000ff7;
---
> regval |= 0x00000ff7;
287a268,269
> lbc_write_reg(sc, LBC85XX_OR(i), regval);
> }
289c271,279
< lbc_write_reg(sc, LBC85XX_OR(unit), regbuff);
---
> /*
> * Initialize configuration register:
> * - enable Local Bus
> * - set data buffer control signal function
> * - disable parity byte select
> * - set ECC parity type
> * - set bus monitor timing and timer prescale
> */
> lbc_write_reg(sc, LBC85XX_LBCR, 0);
290a281,331
> /*
> * Initialize clock ratio register:
> * - disable PLL bypass mode
> * - configure LCLK delay cycles for the assertion of LALE
> * - set system clock divider
> */
> lbc_write_reg(sc, LBC85XX_LCRR, 0x00030008);
>
> return (0);
>
> fail:
> lbc_banks_unmap(sc);
> return (error);
> }
>
> static void
> fdt_lbc_fixup(phandle_t node, struct lbc_softc *sc, struct lbc_devinfo *di)
> {
> pcell_t width;
> int bank;
>
> if (OF_getprop(node, "bank-width", (void *)&width, sizeof(width)) <= 0)
> return;
>
> bank = di->di_bank;
> if (sc->sc_banks[bank].size == 0)
> return;
>
> /* Express width in bits. */
> sc->sc_banks[bank].width = width * 8;
> }
>
> static int
> fdt_lbc_reg_decode(phandle_t node, struct lbc_softc *sc,
> struct lbc_devinfo *di)
> {
> u_long start, end, count;
> pcell_t *reg, *regptr;
> pcell_t addr_cells, size_cells;
> int tuple_size, tuples;
> int i, rv, bank;
>
> if (fdt_addrsize_cells(OF_parent(node), &addr_cells, &size_cells) != 0)
> return (ENXIO);
>
> tuple_size = sizeof(pcell_t) * (addr_cells + size_cells);
> tuples = OF_getprop_alloc(node, "reg", tuple_size, (void **)&reg);
> debugf("addr_cells = %d, size_cells = %d\n", addr_cells, size_cells);
> debugf("tuples = %d, tuple size = %d\n", tuples, tuple_size);
> if (tuples <= 0)
> /* No 'reg' property in this node. */
291a333,359
>
> regptr = reg;
> for (i = 0; i < tuples; i++) {
>
> bank = fdt_data_get((void *)reg, 1);
> di->di_bank = bank;
> reg += 1;
>
> /* Get address/size. */
> rv = fdt_data_to_res(reg, addr_cells - 1, size_cells, &start,
> &count);
> if (rv != 0) {
> resource_list_free(&di->di_res);
> goto out;
> }
> reg += addr_cells - 1 + size_cells;
>
> /* Calculate address range relative to VA base. */
> start = sc->sc_banks[bank].va + start;
> end = start + count - 1;
>
> debugf("reg addr bank = %d, start = %lx, end = %lx, "
> "count = %lx\n", bank, start, end, count);
>
> /* Use bank (CS) cell as rid. */
> resource_list_add(&di->di_res, SYS_RES_MEMORY, bank, start,
> end, count);
293,299c361,364
< fail:
< if (unit != -1) {
< law_disable(OCP85XX_TGTIF_LBC, start, size);
< pmap_unmapdev(sc->sc_kva[unit], size);
< return (error);
< } else
< return (ENOENT);
---
> rv = 0;
> out:
> free(regptr, M_OFWPROP);
> return (rv);
305,307d369
< device_t parent;
< uintptr_t devtype;
< int error;
309,313c371,372
< parent = device_get_parent(dev);
< error = BUS_READ_IVAR(parent, dev, OCPBUS_IVAR_DEVTYPE, &devtype);
< if (error)
< return (error);
< if (devtype != OCPBUS_DEVTYPE_LBC)
---
> if (!(ofw_bus_is_compatible(dev, "fsl,lbc") ||
> ofw_bus_is_compatible(dev, "fsl,elbc")))
316c375
< device_set_desc(dev, "Freescale MPC85xx Local Bus Controller");
---
> device_set_desc(dev, "Freescale Local Bus Controller");
323a383
> struct lbc_devinfo *di;
325,326c385,391
< const struct lbc_resource *lbcres;
< int error;
---
> u_long offset, start, size;
> device_t cdev;
> phandle_t node, child;
> pcell_t *ranges, *rangesptr;
> int tuple_size, tuples;
> int par_addr_cells;
> int bank, error, i;
338a404
> rangesptr = NULL;
342c408
< rm->rm_descr = "MPC85XX Local Bus Space";
---
> rm->rm_descr = "Local Bus Space";
356,361c422
< * Initialize configuration register:
< * - enable Local Bus
< * - set data buffer control signal function
< * - disable parity byte select
< * - set ECC parity type
< * - set bus monitor timing and timer prescale
---
> * Process 'ranges' property.
363c424,429
< lbc_write_reg(sc, LBC85XX_LBCR, 0x00000000);
---
> node = ofw_bus_get_node(dev);
> if ((fdt_addrsize_cells(node, &sc->sc_addr_cells,
> &sc->sc_size_cells)) != 0) {
> error = ENXIO;
> goto fail;
> }
364a431,497
> par_addr_cells = fdt_parent_addr_cells(node);
> if (par_addr_cells > 2) {
> device_printf(dev, "unsupported parent #addr-cells\n");
> error = ERANGE;
> goto fail;
> }
> tuple_size = sizeof(pcell_t) * (sc->sc_addr_cells + par_addr_cells +
> sc->sc_size_cells);
>
> tuples = OF_getprop_alloc(node, "ranges", tuple_size,
> (void **)&ranges);
> if (tuples < 0) {
> device_printf(dev, "could not retrieve 'ranges' property\n");
> error = ENXIO;
> goto fail;
> }
> rangesptr = ranges;
>
> debugf("par addr_cells = %d, addr_cells = %d, size_cells = %d, "
> "tuple_size = %d, tuples = %d\n", par_addr_cells,
> sc->sc_addr_cells, sc->sc_size_cells, tuple_size, tuples);
>
> start = 0;
> size = 0;
> for (i = 0; i < tuples; i++) {
>
> /* The first cell is the bank (chip select) number. */
> bank = fdt_data_get((void *)ranges, 1);
> if (bank < 0 || bank > LBC_DEV_MAX) {
> device_printf(dev, "bank out of range: %d\n", bank);
> error = ERANGE;
> goto fail;
> }
> ranges += 1;
>
> /*
> * Remaining cells of the child address define offset into
> * this CS.
> */
> offset = fdt_data_get((void *)ranges, sc->sc_addr_cells - 1);
> ranges += sc->sc_addr_cells - 1;
>
> /* Parent bus start address of this bank. */
> start = fdt_data_get((void *)ranges, par_addr_cells);
> ranges += par_addr_cells;
>
> size = fdt_data_get((void *)ranges, sc->sc_size_cells);
> ranges += sc->sc_size_cells;
> debugf("bank = %d, start = %lx, size = %lx\n", bank,
> start, size);
>
> sc->sc_banks[bank].pa = start + offset;
> sc->sc_banks[bank].size = size;
>
> /*
> * Attributes for the bank.
> *
> * XXX Note there are no DT bindings defined for them at the
> * moment, so we need to provide some defaults.
> */
> sc->sc_banks[bank].width = 16;
> sc->sc_banks[bank].msel = LBCRES_MSEL_GPCM;
> sc->sc_banks[bank].decc = LBCRES_DECC_DISABLED;
> sc->sc_banks[bank].atom = LBCRES_ATOM_DISABLED;
> sc->sc_banks[bank].wp = 0;
> }
>
366,369c499
< * Initialize clock ratio register:
< * - disable PLL bypass mode
< * - configure LCLK delay cycles for the assertion of LALE
< * - set system clock divider
---
> * Initialize mem-mappings for the LBC banks (i.e. chip selects).
371c501,503
< lbc_write_reg(sc, LBC85XX_LCRR, 0x00030008);
---
> error = lbc_banks_map(sc);
> if (error)
> goto fail;
373c505,508
< lbcres = mpc85xx_lbc_resources;
---
> /*
> * Walk the localbus and add direct subordinates as our children.
> */
> for (child = OF_child(node); child != 0; child = OF_peer(child)) {
375,378c510,515
< for (; lbcres->lbr_devtype; lbcres++)
< if (!lbc_mk_child(dev, lbcres)) {
< error = ENXIO;
< goto fail;
---
> di = malloc(sizeof(*di), M_LBC, M_WAITOK | M_ZERO);
>
> if (ofw_bus_gen_setup_devinfo(&di->di_ofw, child) != 0) {
> free(di, M_LBC);
> device_printf(dev, "could not set up devinfo\n");
> continue;
380a518,550
> resource_list_init(&di->di_res);
>
> if (fdt_lbc_reg_decode(child, sc, di)) {
> device_printf(dev, "could not process 'reg' "
> "property\n");
> ofw_bus_gen_destroy_devinfo(&di->di_ofw);
> free(di, M_LBC);
> continue;
> }
>
> fdt_lbc_fixup(child, sc, di);
>
> /* Add newbus device for this FDT node */
> cdev = device_add_child(dev, NULL, -1);
> if (cdev == NULL) {
> device_printf(dev, "could not add child: %s\n",
> di->di_ofw.obd_name);
> resource_list_free(&di->di_res);
> ofw_bus_gen_destroy_devinfo(&di->di_ofw);
> free(di, M_LBC);
> continue;
> }
> debugf("added child name='%s', node=%p\n", di->di_ofw.obd_name,
> (void *)child);
> device_set_ivars(cdev, di);
> }
>
> /*
> * Enable the LBC.
> */
> lbc_banks_enable(sc);
>
> free(rangesptr, M_OFWPROP);
383a554
> free(rangesptr, M_OFWPROP);
397c568
< lbc_alloc_resource(device_t dev, device_t child, int type, int *rid,
---
> lbc_alloc_resource(device_t bus, device_t child, int type, int *rid,
401,402c572,574
< struct lbc_devinfo *dinfo;
< struct resource *rv;
---
> struct lbc_devinfo *di;
> struct resource_list_entry *rle;
> struct resource *res;
404c576
< int error;
---
> int needactivate;
406,411d577
< sc = device_get_softc(dev);
< dinfo = device_get_ivars(child);
<
< if (type != SYS_RES_MEMORY && type != SYS_RES_IRQ)
< return (NULL);
<
415a582
> sc = device_get_softc(bus);
417c584
< return (bus_alloc_resource(dev, type, rid, start, end, count,
---
> return (bus_alloc_resource(bus, type, rid, start, end, count,
420,427c587,591
< if (!sc->sc_kva[dinfo->lbc_unit]) {
< error = lbc_init_child(dev, child);
< if (error)
< return (NULL);
< }
<
< error = lbc_get_resource(dev, child, type, *rid, &start, &count);
< if (error)
---
> /*
> * Request for the default allocation with a given rid: use resource
> * list stored in the local device info.
> */
> if ((di = device_get_ivars(child)) == NULL)
430,435c594,603
< rm = &sc->sc_rman;
< end = start + count - 1;
< rv = rman_reserve_resource(rm, start, end, count, flags, child);
< if (rv != NULL) {
< rman_set_bustag(rv, &bs_be_tag);
< rman_set_bushandle(rv, rman_get_start(rv));
---
> if (type == SYS_RES_IOPORT)
> type = SYS_RES_MEMORY;
>
> rid = &di->di_bank;
>
> rle = resource_list_find(&di->di_res, type, *rid);
> if (rle == NULL) {
> device_printf(bus, "no default resources for "
> "rid = %d, type = %d\n", *rid, type);
> return (NULL);
437,438c605,607
< return (rv);
< }
---
> start = rle->start;
> count = rle->count;
> end = start + count - 1;
440,444c609
< static int
< lbc_print_child(device_t dev, device_t child)
< {
< u_long size, start;
< int error, retval, rid;
---
> sc = device_get_softc(bus);
446c611,612
< retval = bus_print_child_header(dev, child);
---
> needactivate = flags & RF_ACTIVE;
> flags &= ~RF_ACTIVE;
448,458c614,620
< rid = 0;
< while (1) {
< error = lbc_get_resource(dev, child, SYS_RES_MEMORY, rid,
< &start, &size);
< if (error)
< break;
< retval += (rid == 0) ? printf(" iomem ") : printf(",");
< retval += printf("%#lx", start);
< if (size > 1)
< retval += printf("-%#lx", start + size - 1);
< rid++;
---
> rm = &sc->sc_rman;
>
> res = rman_reserve_resource(rm, start, end, count, flags, child);
> if (res == NULL) {
> device_printf(bus, "failed to reserve resource %#lx - %#lx "
> "(%#lx)\n", start, end, count);
> return (NULL);
461,462c623,634
< retval += bus_print_child_footer(dev, child);
< return (retval);
---
> rman_set_rid(res, *rid);
> rman_set_bustag(res, &bs_be_tag);
> rman_set_bushandle(res, rman_get_start(res));
>
> if (needactivate)
> if (bus_activate_resource(child, type, *rid, res)) {
> device_printf(child, "resource activation failed\n");
> rman_release_resource(res);
> return (NULL);
> }
>
> return (res);
466c638
< lbc_read_ivar(device_t dev, device_t child, int index, uintptr_t *result)
---
> lbc_print_child(device_t dev, device_t child)
468c640,642
< struct lbc_devinfo *dinfo;
---
> struct lbc_devinfo *di;
> struct resource_list *rl;
> int rv;
470,471c644,645
< if (device_get_parent(child) != dev)
< return (EINVAL);
---
> di = device_get_ivars(child);
> rl = &di->di_res;
473c647,651
< dinfo = device_get_ivars(child);
---
> rv = 0;
> rv += bus_print_child_header(dev, child);
> rv += resource_list_print_type(rl, "mem", SYS_RES_MEMORY, "%#lx");
> rv += resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%ld");
> rv += bus_print_child_footer(dev, child);
475,482c653
< switch (index) {
< case LBC_IVAR_DEVTYPE:
< *result = dinfo->lbc_devtype;
< return (0);
< default:
< break;
< }
< return (EINVAL);
---
> return (rv);
488a660
> int err;
489a662,667
> if (rman_get_flags(res) & RF_ACTIVE) {
> err = bus_deactivate_resource(child, type, rid, res);
> if (err)
> return (err);
> }
>
493,495c671,672
< static int
< lbc_get_resource(device_t dev, device_t child, int type, int rid,
< u_long *startp, u_long *countp)
---
> static const struct ofw_bus_devinfo *
> lbc_get_devinfo(device_t bus, device_t child)
497,499c674
< struct lbc_softc *sc;
< struct lbc_devinfo *dinfo;
< const struct lbc_resource *lbcres;
---
> struct lbc_devinfo *di;
501,529c676,677
< if (type != SYS_RES_MEMORY)
< return (ENOENT);
<
< /* Currently all LBC devices have a single RID per type. */
< if (rid != 0)
< return (ENOENT);
<
< sc = device_get_softc(dev);
< dinfo = device_get_ivars(child);
<
< if ((dinfo->lbc_unit < 0) || (dinfo->lbc_unit > (LBC_DEV_MAX - 1)))
< return (EINVAL);
<
< lbcres = mpc85xx_lbc_resources;
<
< switch (dinfo->lbc_devtype) {
< case LBC_DEVTYPE_CFI:
< case LBC_DEVTYPE_RTC:
< for (; lbcres->lbr_devtype; lbcres++) {
< if (dinfo->lbc_unit == lbcres->lbr_unit) {
< *startp = sc->sc_kva[lbcres->lbr_unit];
< *countp = lbcres->lbr_size;
< return (0);
< }
< }
< default:
< return (EDOOFUS);
< }
< return (0);
---
> di = device_get_ivars(child);
> return (&di->di_ofw);