summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorjfv <jfv@FreeBSD.org>2007-05-17 00:14:03 +0000
committerjfv <jfv@FreeBSD.org>2007-05-17 00:14:03 +0000
commit705e551878305c4f68f6a632abb54055c59c3092 (patch)
tree04fef7f9890c7e4d536dc35970cf3cdcaf195e0d /sys/dev
parent4f0511a3a8df91a1dc33c52885a674b69aafbe50 (diff)
downloadFreeBSD-src-705e551878305c4f68f6a632abb54055c59c3092.zip
FreeBSD-src-705e551878305c4f68f6a632abb54055c59c3092.tar.gz
Couple of changes, back down on last TSO change, instead make old
adapter list still capable, but only PCI-E adapters are now enabled. The user can enable older PCI-X or PCI adapters using ifconfig. Secondly, Arthur Hartwig pointed out my MSI change was not working correctly, changed to something that now does. Thanks Arthur. There was also a fundamental bug in the 82575 MSIX code, the MSIX registers had to be mapped, opps :) Rubber-stamped by: Pdeuskar
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/em/if_em.c37
-rw-r--r--sys/dev/em/if_em.h2
2 files changed, 31 insertions, 8 deletions
diff --git a/sys/dev/em/if_em.c b/sys/dev/em/if_em.c
index e2ac3b3..8447b76 100644
--- a/sys/dev/em/if_em.c
+++ b/sys/dev/em/if_em.c
@@ -447,7 +447,7 @@ em_attach(device_t dev)
callout_init_mtx(&adapter->timer, &adapter->mtx, 0);
callout_init_mtx(&adapter->tx_fifo_timer, &adapter->mtx, 0);
- /* Determine hardware revision */
+ /* Determine hardware and mac info */
em_identify_hardware(adapter);
/* Setup PCI resources */
@@ -2542,16 +2542,28 @@ em_allocate_pci_resources(struct adapter *adapter)
rid = 0x0;
if (adapter->hw.mac.type >= e1000_82575) {
/*
- * Eventually this will be used
+ * Setup MSI/X
+ */
+ rid = PCIR_BAR(EM_MSIX_BAR);
+ adapter->msix_mem = bus_alloc_resource_any(dev,
+ SYS_RES_MEMORY, &rid, RF_ACTIVE);
+ if (!adapter->msix_mem) {
+ device_printf(dev,"Unable to map MSIX table \n");
+ return (ENXIO);
+ }
+ /*
+ * Eventually this may be used
* for Multiqueue, for now we will
* just use one vector.
+ *
+ * val = pci_msix_count(dev);
*/
- val = pci_msix_count(dev);
+ val = 1;
if ((val) && pci_alloc_msix(dev, &val) == 0) {
rid = 1;
adapter->msi = 1;
}
- } else if (adapter->hw.bus.type == e1000_bus_type_pci_express) {
+ } else if (adapter->hw.mac.type > e1000_82571) {
val = pci_msi_count(dev);
if (val == 1 && pci_alloc_msi(dev, &val) == 0) {
rid = 1;
@@ -2646,7 +2658,11 @@ em_free_pci_resources(struct adapter *adapter)
if (adapter->res_interrupt != NULL)
bus_release_resource(dev, SYS_RES_IRQ,
- 0, adapter->res_interrupt);
+ adapter->msi ? 1 : 0, adapter->res_interrupt);
+
+ if (adapter->msix_mem != NULL)
+ bus_release_resource(dev, SYS_RES_MEMORY,
+ PCIR_BAR(EM_MSIX_BAR), adapter->msix_mem);
if (adapter->msi)
pci_release_msi(dev);
@@ -2769,11 +2785,16 @@ em_setup_interface(device_t dev, struct adapter *adapter)
ifp->if_capenable |= IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM;
}
- /* Enable TSO for PCI Express adapters */
- if (adapter->hw.bus.type == e1000_bus_type_pci_express) {
+ /* Identify TSO capable adapters */
+ if ((adapter->hw.mac.type > e1000_82544) &&
+ (adapter->hw.mac.type != e1000_82547))
ifp->if_capabilities |= IFCAP_TSO4;
+ /*
+ * By default only enable on PCI-E, this
+ * can be overriden by ifconfig.
+ */
+ if (adapter->hw.mac.type >= e1000_82571)
ifp->if_capenable |= IFCAP_TSO4;
- }
/*
* Tell the upper layer(s) we support long frames.
diff --git a/sys/dev/em/if_em.h b/sys/dev/em/if_em.h
index 5ec21a0..327fa4b 100644
--- a/sys/dev/em/if_em.h
+++ b/sys/dev/em/if_em.h
@@ -209,6 +209,7 @@ POSSIBILITY OF SUCH DAMAGE.
#define EM_BAR_MEM_TYPE_MASK 0x00000006
#define EM_BAR_MEM_TYPE_32BIT 0x00000000
#define EM_BAR_MEM_TYPE_64BIT 0x00000004
+#define EM_MSIX_BAR 3 /* On 82575 */
/* Defines for printing debug information */
#define DEBUG_INIT 0
@@ -263,6 +264,7 @@ struct adapter {
struct device *dev;
struct resource *res_memory;
struct resource *flash_mem;
+ struct resource *msix_mem;
struct resource *res_ioport;
struct resource *res_interrupt;
void *int_handler_tag;
OpenPOWER on IntegriCloud