Index: head/sys/dev/sfxge/common/efx.h =================================================================== --- head/sys/dev/sfxge/common/efx.h +++ head/sys/dev/sfxge/common/efx.h @@ -76,7 +76,8 @@ 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 @@ #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 */ Index: head/sys/dev/sfxge/common/efx_nic.c =================================================================== --- head/sys/dev/sfxge/common/efx_nic.c +++ head/sys/dev/sfxge/common/efx_nic.c @@ -36,11 +36,13 @@ #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 @@ * 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 @@ * 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 @@ * 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 @@ * 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 @@ *efp = EFX_FAMILY_INVALID; return (ENOTSUP); } + #if EFSYS_OPT_SIENA Index: head/sys/dev/sfxge/sfxge.h =================================================================== --- head/sys/dev/sfxge/sfxge.h +++ head/sys/dev/sfxge/sfxge.h @@ -280,6 +280,8 @@ struct task task_reset; efx_family_t family; + unsigned int mem_bar; + caddr_t vpd_data; size_t vpd_size; efx_nic_t *enp; Index: head/sys/dev/sfxge/sfxge.c =================================================================== --- head/sys/dev/sfxge/sfxge.c +++ head/sys/dev/sfxge/sfxge.c @@ -651,11 +651,11 @@ { 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 @@ 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 @@ 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);