[RFC][PATCH 3/4] PCI legacy I/O port free driver - Make Intel e1000 driver legacy I/O port free

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch makes e1000 driver pci legacy free.

Signed-off-by: Kenji Kaneshige <[email protected]>

 drivers/net/e1000/e1000_main.c |   34 ++++++++++++++++++++++++++++------
 1 files changed, 28 insertions(+), 6 deletions(-)

Index: linux-2.6.16-rc3/drivers/net/e1000/e1000_main.c
===================================================================
--- linux-2.6.16-rc3.orig/drivers/net/e1000/e1000_main.c	2006-02-14 12:25:08.000000000 +0900
+++ linux-2.6.16-rc3/drivers/net/e1000/e1000_main.c	2006-02-14 12:28:06.000000000 +0900
@@ -642,6 +642,18 @@
 	}
 }
 
+static inline int need_io_port(struct pci_dev *pdev)
+{
+	switch (pdev->device) {
+	case 0x1008: case 0x1009: case 0x100c: case 0x100d: case 0x100e:
+	case 0x1015: case 0x1016: case 0x1017: case 0x101e: case 0x100f:
+	case 0x1011: case 0x1010: case 0x1012: case 0x101d: case 0x1013:
+	case 0x1018: case 0x1078: case 0x1076: case 0x107c: case 0x1077:
+		return 1;
+	}
+	return 0;
+}
+
 /**
  * e1000_probe - Device Initialization Routine
  * @pdev: PCI device information struct
@@ -666,6 +678,11 @@
 	int i, err, pci_using_dac;
 	uint16_t eeprom_data;
 	uint16_t eeprom_apme_mask = E1000_EEPROM_APME;
+	int need_io = need_io_port(pdev);
+
+	if (!need_io)
+		pci_set_bar_mask_by_resource(pdev, IORESOURCE_MEM);
+
 	if ((err = pci_enable_device(pdev)))
 		return err;
 
@@ -709,12 +726,15 @@
 		goto err_ioremap;
 	}
 
-	for (i = BAR_1; i <= BAR_5; i++) {
-		if (pci_resource_len(pdev, i) == 0)
-			continue;
-		if (pci_resource_flags(pdev, i) & IORESOURCE_IO) {
-			adapter->hw.io_base = pci_resource_start(pdev, i);
-			break;
+	if (need_io) {
+		for (i = BAR_1; i <= BAR_5; i++) {
+			if (pci_resource_len(pdev, i) == 0)
+				continue;
+			if (pci_resource_flags(pdev, i) & IORESOURCE_IO) {
+				adapter->hw.io_base =
+					pci_resource_start(pdev, i);
+				break;
+			}
 		}
 	}
 
@@ -4683,6 +4703,8 @@
 	if (retval)
 		DPRINTK(PROBE, ERR, "Error in setting power state\n");
 	e1000_pci_restore_state(adapter);
+	if (!need_io_port(pdev))
+		pci_set_bar_mask_by_resource(pdev, IORESOURCE_MEM);
 	ret_val = pci_enable_device(pdev);
 	pci_set_master(pdev);
 


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux