diff --git a/share/man/man4/man4.powerpc/dtsec.4 b/share/man/man4/man4.powerpc/dtsec.4 index 8b6999413d8..93d5b5759fc 100644 --- a/share/man/man4/man4.powerpc/dtsec.4 +++ b/share/man/man4/man4.powerpc/dtsec.4 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 16, 2017 +.Dd October 31, 2017 .Dt DTSEC 4 .Os .Sh NAME @@ -89,6 +89,14 @@ P2041, P3041 .It P5010, P5020 .El +.Pp +Additionally, the following devices are expected to work, but are untested: +.Bl -bullet -compact +.It +P4080, P4040 +.It +P5040 +.El .Sh SEE ALSO .Xr altq 4 , .Xr arp 4 , @@ -96,13 +104,6 @@ P5010, P5020 .Xr netintro 4 , .Xr ng_ether 4 , .Xr ifconfig 8 -.Sh BUGS -The -.Nm -driver assumes that there is only one Frame Manager, and that dtsec0 controls -the MDIO interface. Though this is the case for the supported devices, other -SoCs with the DPAA controller may not work correctly. Particularly, the P5040 -and P4080 SoCs have two frame managers, which breaks this assumption. .Sh HISTORY The .Nm diff --git a/sys/dev/dpaa/fman.c b/sys/dev/dpaa/fman.c index 838247774b1..fcb0ccfd2ea 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 9854f7a81f3..0d907095879 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 fad7fea5e8e..f6e9a4b7bfd 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 f2ec5e16f4f..6daa8b8fe8b 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 */