From owner-svn-src-all@freebsd.org Wed Nov 1 00:46:49 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A7F23E48700; Wed, 1 Nov 2017 00:46:49 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 83E606B37D; Wed, 1 Nov 2017 00:46:49 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vA10kmMc005875; Wed, 1 Nov 2017 00:46:48 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA10kmGS005870; Wed, 1 Nov 2017 00:46:48 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201711010046.vA10kmGS005870@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 1 Nov 2017 00:46:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325255 - in head: share/man/man4/man4.powerpc sys/dev/dpaa X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head: share/man/man4/man4.powerpc sys/dev/dpaa X-SVN-Commit-Revision: 325255 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Nov 2017 00:46:49 -0000 Author: jhibbits Date: Wed Nov 1 00:46:48 2017 New Revision: 325255 URL: https://svnweb.freebsd.org/changeset/base/325255 Log: Remove a singleton in the DPAA driver, to allow multiple fman instances Some devices (P5040, P4080) have multiple frame managers in their DPAA subsystems. This was prevented by use of a softc singleton in the DPAA driver. Since if_dtsec(4) has moved to be a child of fman, it can access the fman device data via the parent object. Modified: head/share/man/man4/man4.powerpc/dtsec.4 head/sys/dev/dpaa/fman.c head/sys/dev/dpaa/fman.h head/sys/dev/dpaa/fman_mdio.c head/sys/dev/dpaa/if_dtsec.c Modified: head/share/man/man4/man4.powerpc/dtsec.4 ============================================================================== --- head/share/man/man4/man4.powerpc/dtsec.4 Wed Nov 1 00:33:54 2017 (r325254) +++ head/share/man/man4/man4.powerpc/dtsec.4 Wed Nov 1 00:46:48 2017 (r325255) @@ -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 Modified: head/sys/dev/dpaa/fman.c ============================================================================== --- head/sys/dev/dpaa/fman.c Wed Nov 1 00:33:54 2017 (r325254) +++ head/sys/dev/dpaa/fman.c Wed Nov 1 00:46:48 2017 (r325255) @@ -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,54 +385,36 @@ fman_error_callback(t_Handle app_handle, e_FmPortType */ 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 = sc->fm_handle; - *fmh = fm_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 = sc->muram_handle; - *muramh = fm_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(sc->mem_res); - *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; - - return (0); -} - -int fman_attach(device_t dev) { struct fman_softc *sc; @@ -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) { Modified: head/sys/dev/dpaa/fman.h ============================================================================== --- head/sys/dev/dpaa/fman.h Wed Nov 1 00:33:54 2017 (r325254) +++ head/sys/dev/dpaa/fman.h Wed Nov 1 00:46:48 2017 (r325255) @@ -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_ */ Modified: head/sys/dev/dpaa/fman_mdio.c ============================================================================== --- head/sys/dev/dpaa/fman_mdio.c Wed Nov 1 00:33:54 2017 (r325254) +++ head/sys/dev/dpaa/fman_mdio.c Wed Nov 1 00:46:48 2017 (r325255) @@ -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; Modified: head/sys/dev/dpaa/if_dtsec.c ============================================================================== --- head/sys/dev/dpaa/if_dtsec.c Wed Nov 1 00:33:54 2017 (r325254) +++ head/sys/dev/dpaa/if_dtsec.c Wed Nov 1 00:46:48 2017 (r325255) @@ -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 */