diff options
| author | Justin Hibbits <jhibbits@FreeBSD.org> | 2017-11-01 00:46:48 +0000 |
|---|---|---|
| committer | Justin Hibbits <jhibbits@FreeBSD.org> | 2017-11-01 00:46:48 +0000 |
| commit | 1c41f28f7ce9ced198c3d384f4c075f4445f3a1d (patch) | |
| tree | ae4017125467fa53924833435c8288eb73422cfd /sys/dev/dpaa | |
| parent | 9d98ae7d5fc0a6ad2bbc3e7c043a1a4d2d060160 (diff) | |
Notes
Diffstat (limited to 'sys/dev/dpaa')
| -rw-r--r-- | sys/dev/dpaa/fman.c | 38 | ||||
| -rw-r--r-- | sys/dev/dpaa/fman.h | 7 | ||||
| -rw-r--r-- | sys/dev/dpaa/fman_mdio.c | 2 | ||||
| -rw-r--r-- | sys/dev/dpaa/if_dtsec.c | 8 |
4 files changed, 18 insertions, 37 deletions
diff --git a/sys/dev/dpaa/fman.c b/sys/dev/dpaa/fman.c index 838247774b17..fcb0ccfd2ead 100644 --- a/sys/dev/dpaa/fman.c +++ b/sys/dev/dpaa/fman.c @@ -87,7 +87,6 @@ struct fman_config { */ const uint32_t fman_firmware[] = FMAN_UC_IMG; const uint32_t fman_firmware_size = sizeof(fman_firmware); -static struct fman_softc *fm_sc = NULL; int fman_activate_resource(device_t bus, device_t child, int type, int rid, @@ -386,49 +385,31 @@ fman_error_callback(t_Handle app_handle, e_FmPortType port_type, */ int -fman_get_handle(t_Handle *fmh) +fman_get_handle(device_t dev, t_Handle *fmh) { + struct fman_softc *sc = device_get_softc(dev); - if (fm_sc == NULL) - return (ENOMEM); - - *fmh = fm_sc->fm_handle; + *fmh = sc->fm_handle; return (0); } int -fman_get_muram_handle(t_Handle *muramh) +fman_get_muram_handle(device_t dev, t_Handle *muramh) { + struct fman_softc *sc = device_get_softc(dev); - if (fm_sc == NULL) - return (ENOMEM); - - *muramh = fm_sc->muram_handle; + *muramh = sc->muram_handle; return (0); } int -fman_get_bushandle(vm_offset_t *fm_base) +fman_get_bushandle(device_t dev, vm_offset_t *fm_base) { + struct fman_softc *sc = device_get_softc(dev); - if (fm_sc == NULL) - return (ENOMEM); - - *fm_base = rman_get_bushandle(fm_sc->mem_res); - - return (0); -} - -int -fman_get_dev(device_t *fm_dev) -{ - - if (fm_sc == NULL) - return (ENOMEM); - - *fm_dev = fm_sc->sc_base.dev; + *fm_base = rman_get_bushandle(sc->mem_res); return (0); } @@ -443,7 +424,6 @@ fman_attach(device_t dev) sc = device_get_softc(dev); sc->sc_base.dev = dev; - fm_sc = sc; /* Check if MallocSmart allocator is ready */ if (XX_MallocSmartInit() != E_OK) { diff --git a/sys/dev/dpaa/fman.h b/sys/dev/dpaa/fman.h index 9854f7a81f39..0d9070958796 100644 --- a/sys/dev/dpaa/fman.h +++ b/sys/dev/dpaa/fman.h @@ -72,9 +72,8 @@ int fman_qman_channel_id(device_t, int); /** @} */ uint32_t fman_get_clock(struct fman_softc *sc); -int fman_get_handle(t_Handle *fmh); -int fman_get_muram_handle(t_Handle *muramh); -int fman_get_bushandle(vm_offset_t *fm_base); -int fman_get_dev(device_t *fmd); +int fman_get_handle(device_t dev, t_Handle *fmh); +int fman_get_muram_handle(device_t dev, t_Handle *muramh); +int fman_get_bushandle(device_t dev, vm_offset_t *fm_base); #endif /* FMAN_H_ */ diff --git a/sys/dev/dpaa/fman_mdio.c b/sys/dev/dpaa/fman_mdio.c index fad7fea5e8ec..f6e9a4b7bfda 100644 --- a/sys/dev/dpaa/fman_mdio.c +++ b/sys/dev/dpaa/fman_mdio.c @@ -130,7 +130,7 @@ pqmdio_fdt_attach(device_t dev) sc = device_get_softc(dev); - fman_get_bushandle(&sc->sc_handle); + fman_get_bushandle(device_get_parent(dev), &sc->sc_handle); bus_get_resource(dev, SYS_RES_MEMORY, 0, &start, &count); sc->sc_offset = start; diff --git a/sys/dev/dpaa/if_dtsec.c b/sys/dev/dpaa/if_dtsec.c index f2ec5e16f4fb..6daa8b8fe8b9 100644 --- a/sys/dev/dpaa/if_dtsec.c +++ b/sys/dev/dpaa/if_dtsec.c @@ -569,11 +569,13 @@ int dtsec_attach(device_t dev) { struct dtsec_softc *sc; + device_t parent; int error; struct ifnet *ifp; sc = device_get_softc(dev); + parent = device_get_parent(dev); sc->sc_dev = dev; sc->sc_mac_mdio_irq = NO_IRQ; sc->sc_eth_id = device_get_unit(dev); @@ -594,13 +596,13 @@ dtsec_attach(device_t dev) callout_init(&sc->sc_tick_callout, CALLOUT_MPSAFE); /* Read configuraton */ - if ((error = fman_get_handle(&sc->sc_fmh)) != 0) + if ((error = fman_get_handle(parent, &sc->sc_fmh)) != 0) return (error); - if ((error = fman_get_muram_handle(&sc->sc_muramh)) != 0) + if ((error = fman_get_muram_handle(parent, &sc->sc_muramh)) != 0) return (error); - if ((error = fman_get_bushandle(&sc->sc_fm_base)) != 0) + if ((error = fman_get_bushandle(parent, &sc->sc_fm_base)) != 0) return (error); /* Configure working mode */ |
