From owner-svn-src-all@freebsd.org Tue Nov 27 12:59:49 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C3174114ABF2; Tue, 27 Nov 2018 12:59:49 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 90C7B785FA; Tue, 27 Nov 2018 12:59:48 +0000 (UTC) (envelope-from arybchik@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ECD701B882; Tue, 27 Nov 2018 12:59:44 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wARCxiQb019369; Tue, 27 Nov 2018 12:59:44 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wARCxipb019366; Tue, 27 Nov 2018 12:59:44 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201811271259.wARCxipb019366@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Tue, 27 Nov 2018 12:59:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341046 - in head/sys/dev/sfxge: . common X-SVN-Group: head X-SVN-Commit-Author: arybchik X-SVN-Commit-Paths: in head/sys/dev/sfxge: . common X-SVN-Commit-Revision: 341046 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 90C7B785FA X-Spamd-Result: default: False [1.69 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_SPAM_LONG(0.51)[0.511,0]; NEURAL_SPAM_MEDIUM(0.69)[0.687,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.49)[0.488,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 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: Tue, 27 Nov 2018 12:59:50 -0000 Author: arybchik Date: Tue Nov 27 12:59:43 2018 New Revision: 341046 URL: https://svnweb.freebsd.org/changeset/base/341046 Log: sfxge(4): report memory BAR number Remove EFX_MEM_BAR define as it it is not correct on all platforms. Submitted by: Andy Moreton Sponsored by: Solarflare Communications, Inc. Differential Revision: https://reviews.freebsd.org/D18165 Modified: head/sys/dev/sfxge/common/efx.h head/sys/dev/sfxge/common/efx_nic.c head/sys/dev/sfxge/sfxge.c head/sys/dev/sfxge/sfxge.h Modified: head/sys/dev/sfxge/common/efx.h ============================================================================== --- head/sys/dev/sfxge/common/efx.h Tue Nov 27 12:59:32 2018 (r341045) +++ head/sys/dev/sfxge/common/efx.h Tue Nov 27 12:59:43 2018 (r341046) @@ -76,7 +76,8 @@ extern __checkReturn efx_rc_t efx_family( __in uint16_t venid, __in uint16_t devid, - __out efx_family_t *efp); + __out efx_family_t *efp, + __out unsigned int *membarp); #define EFX_PCI_VENID_SFC 0x1924 @@ -102,7 +103,17 @@ efx_family( #define EFX_PCI_DEVID_MEDFORD2 0x0B03 /* SFC9250 PF */ #define EFX_PCI_DEVID_MEDFORD2_VF 0x1B03 /* SFC9250 VF */ -#define EFX_MEM_BAR 2 + +#define EFX_MEM_BAR_SIENA 2 + +#define EFX_MEM_BAR_HUNTINGTON_PF 2 +#define EFX_MEM_BAR_HUNTINGTON_VF 0 + +#define EFX_MEM_BAR_MEDFORD_PF 2 +#define EFX_MEM_BAR_MEDFORD_VF 0 + +#define EFX_MEM_BAR_MEDFORD2 0 + /* Error codes */ Modified: head/sys/dev/sfxge/common/efx_nic.c ============================================================================== --- head/sys/dev/sfxge/common/efx_nic.c Tue Nov 27 12:59:32 2018 (r341045) +++ head/sys/dev/sfxge/common/efx_nic.c Tue Nov 27 12:59:43 2018 (r341046) @@ -36,11 +36,13 @@ __FBSDID("$FreeBSD$"); #include "efx.h" #include "efx_impl.h" + __checkReturn efx_rc_t efx_family( __in uint16_t venid, __in uint16_t devid, - __out efx_family_t *efp) + __out efx_family_t *efp, + __out unsigned int *membarp) { if (venid == EFX_PCI_VENID_SFC) { switch (devid) { @@ -50,12 +52,10 @@ efx_family( * Hardware default for PF0 of uninitialised Siena. * manftest must be able to cope with this device id. */ - *efp = EFX_FAMILY_SIENA; - return (0); - case EFX_PCI_DEVID_BETHPAGE: case EFX_PCI_DEVID_SIENA: *efp = EFX_FAMILY_SIENA; + *membarp = EFX_MEM_BAR_SIENA; return (0); #endif /* EFSYS_OPT_SIENA */ @@ -65,17 +65,16 @@ efx_family( * Hardware default for PF0 of uninitialised Huntington. * manftest must be able to cope with this device id. */ - *efp = EFX_FAMILY_HUNTINGTON; - return (0); - case EFX_PCI_DEVID_FARMINGDALE: case EFX_PCI_DEVID_GREENPORT: *efp = EFX_FAMILY_HUNTINGTON; + *membarp = EFX_MEM_BAR_HUNTINGTON_PF; return (0); case EFX_PCI_DEVID_FARMINGDALE_VF: case EFX_PCI_DEVID_GREENPORT_VF: *efp = EFX_FAMILY_HUNTINGTON; + *membarp = EFX_MEM_BAR_HUNTINGTON_VF; return (0); #endif /* EFSYS_OPT_HUNTINGTON */ @@ -85,15 +84,14 @@ efx_family( * Hardware default for PF0 of uninitialised Medford. * manftest must be able to cope with this device id. */ - *efp = EFX_FAMILY_MEDFORD; - return (0); - case EFX_PCI_DEVID_MEDFORD: *efp = EFX_FAMILY_MEDFORD; + *membarp = EFX_MEM_BAR_MEDFORD_PF; return (0); case EFX_PCI_DEVID_MEDFORD_VF: *efp = EFX_FAMILY_MEDFORD; + *membarp = EFX_MEM_BAR_MEDFORD_VF; return (0); #endif /* EFSYS_OPT_MEDFORD */ @@ -103,15 +101,10 @@ efx_family( * Hardware default for PF0 of uninitialised Medford2. * manftest must be able to cope with this device id. */ - *efp = EFX_FAMILY_MEDFORD2; - return (0); - case EFX_PCI_DEVID_MEDFORD2: - *efp = EFX_FAMILY_MEDFORD2; - return (0); - case EFX_PCI_DEVID_MEDFORD2_VF: *efp = EFX_FAMILY_MEDFORD2; + *membarp = EFX_MEM_BAR_MEDFORD2; return (0); #endif /* EFSYS_OPT_MEDFORD2 */ @@ -124,6 +117,7 @@ efx_family( *efp = EFX_FAMILY_INVALID; return (ENOTSUP); } + #if EFSYS_OPT_SIENA Modified: head/sys/dev/sfxge/sfxge.c ============================================================================== --- head/sys/dev/sfxge/sfxge.c Tue Nov 27 12:59:32 2018 (r341045) +++ head/sys/dev/sfxge/sfxge.c Tue Nov 27 12:59:43 2018 (r341046) @@ -651,11 +651,11 @@ sfxge_bar_init(struct sfxge_softc *sc) { efsys_bar_t *esbp = &sc->bar; - esbp->esb_rid = PCIR_BAR(EFX_MEM_BAR); + esbp->esb_rid = PCIR_BAR(sc->mem_bar); if ((esbp->esb_res = bus_alloc_resource_any(sc->dev, SYS_RES_MEMORY, &esbp->esb_rid, RF_ACTIVE)) == NULL) { device_printf(sc->dev, "Cannot allocate BAR region %d\n", - EFX_MEM_BAR); + sc->mem_bar); return (ENXIO); } esbp->esb_tag = rman_get_bustag(esbp->esb_res); @@ -722,15 +722,15 @@ sfxge_create(struct sfxge_softc *sc) if ((error = sfxge_dma_init(sc)) != 0) goto fail; + error = efx_family(pci_get_vendor(dev), pci_get_device(dev), + &sc->family, &sc->mem_bar); + KASSERT(error == 0, ("Family should be filtered by sfxge_probe()")); + /* Map the device registers. */ DBGPRINT(sc->dev, "bar_init..."); if ((error = sfxge_bar_init(sc)) != 0) goto fail; - error = efx_family(pci_get_vendor(dev), pci_get_device(dev), - &sc->family); - KASSERT(error == 0, ("Family should be filtered by sfxge_probe()")); - DBGPRINT(sc->dev, "nic_create..."); /* Create the common code nic object. */ @@ -1154,13 +1154,14 @@ sfxge_probe(device_t dev) uint16_t pci_vendor_id; uint16_t pci_device_id; efx_family_t family; + unsigned int mem_bar; int rc; pci_vendor_id = pci_get_vendor(dev); pci_device_id = pci_get_device(dev); DBGPRINT(dev, "PCI ID %04x:%04x", pci_vendor_id, pci_device_id); - rc = efx_family(pci_vendor_id, pci_device_id, &family); + rc = efx_family(pci_vendor_id, pci_device_id, &family, &mem_bar); if (rc != 0) { DBGPRINT(dev, "efx_family fail %d", rc); return (ENXIO); Modified: head/sys/dev/sfxge/sfxge.h ============================================================================== --- head/sys/dev/sfxge/sfxge.h Tue Nov 27 12:59:32 2018 (r341045) +++ head/sys/dev/sfxge/sfxge.h Tue Nov 27 12:59:43 2018 (r341046) @@ -280,6 +280,8 @@ struct sfxge_softc { struct task task_reset; efx_family_t family; + unsigned int mem_bar; + caddr_t vpd_data; size_t vpd_size; efx_nic_t *enp;