aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000e
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-06-29 00:28:46 -0400
committerDavid S. Miller <davem@davemloft.net>2008-06-29 00:28:46 -0400
commit332e4af80d1214fbf0e263e1408fc7c5b64ecdd6 (patch)
tree7c8f8ada7ab8fc9cb2497d95e52dce4d2c4493a3 /drivers/net/e1000e
parent1b63ba8a86c85524a8d7e5953b314ce71ebcb9c9 (diff)
parentbe0976be9148f31ee0d1997354c3e30ff8d07587 (diff)
Merge branch 'davem-next' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
Diffstat (limited to 'drivers/net/e1000e')
-rw-r--r--drivers/net/e1000e/e1000.h4
-rw-r--r--drivers/net/e1000e/netdev.c48
2 files changed, 46 insertions, 6 deletions
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h
index d3bc6f8101fa..4a4f62e002b2 100644
--- a/drivers/net/e1000e/e1000.h
+++ b/drivers/net/e1000e/e1000.h
@@ -283,6 +283,10 @@ struct e1000_adapter {
283 unsigned long led_status; 283 unsigned long led_status;
284 284
285 unsigned int flags; 285 unsigned int flags;
286
287 /* for ioport free */
288 int bars;
289 int need_ioport;
286}; 290};
287 291
288struct e1000_info { 292struct e1000_info {
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 0320925a42a8..acdd616c96f6 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -4003,7 +4003,11 @@ static int e1000_resume(struct pci_dev *pdev)
4003 pci_set_power_state(pdev, PCI_D0); 4003 pci_set_power_state(pdev, PCI_D0);
4004 pci_restore_state(pdev); 4004 pci_restore_state(pdev);
4005 e1000e_disable_l1aspm(pdev); 4005 e1000e_disable_l1aspm(pdev);
4006 err = pci_enable_device(pdev); 4006
4007 if (adapter->need_ioport)
4008 err = pci_enable_device(pdev);
4009 else
4010 err = pci_enable_device_mem(pdev);
4007 if (err) { 4011 if (err) {
4008 dev_err(&pdev->dev, 4012 dev_err(&pdev->dev,
4009 "Cannot enable PCI device from suspend\n"); 4013 "Cannot enable PCI device from suspend\n");
@@ -4104,9 +4108,14 @@ static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev)
4104 struct net_device *netdev = pci_get_drvdata(pdev); 4108 struct net_device *netdev = pci_get_drvdata(pdev);
4105 struct e1000_adapter *adapter = netdev_priv(netdev); 4109 struct e1000_adapter *adapter = netdev_priv(netdev);
4106 struct e1000_hw *hw = &adapter->hw; 4110 struct e1000_hw *hw = &adapter->hw;
4111 int err;
4107 4112
4108 e1000e_disable_l1aspm(pdev); 4113 e1000e_disable_l1aspm(pdev);
4109 if (pci_enable_device(pdev)) { 4114 if (adapter->need_ioport)
4115 err = pci_enable_device(pdev);
4116 else
4117 err = pci_enable_device_mem(pdev);
4118 if (err) {
4110 dev_err(&pdev->dev, 4119 dev_err(&pdev->dev,
4111 "Cannot re-enable PCI device after reset.\n"); 4120 "Cannot re-enable PCI device after reset.\n");
4112 return PCI_ERS_RESULT_DISCONNECT; 4121 return PCI_ERS_RESULT_DISCONNECT;
@@ -4185,6 +4194,21 @@ static void e1000_print_device_info(struct e1000_adapter *adapter)
4185} 4194}
4186 4195
4187/** 4196/**
4197 * e1000e_is_need_ioport - determine if an adapter needs ioport resources or not
4198 * @pdev: PCI device information struct
4199 *
4200 * Returns true if an adapters needs ioport resources
4201 **/
4202static int e1000e_is_need_ioport(struct pci_dev *pdev)
4203{
4204 switch (pdev->device) {
4205 /* Currently there are no adapters that need ioport resources */
4206 default:
4207 return false;
4208 }
4209}
4210
4211/**
4188 * e1000_probe - Device Initialization Routine 4212 * e1000_probe - Device Initialization Routine
4189 * @pdev: PCI device information struct 4213 * @pdev: PCI device information struct
4190 * @ent: entry in e1000_pci_tbl 4214 * @ent: entry in e1000_pci_tbl
@@ -4209,9 +4233,19 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
4209 int i, err, pci_using_dac; 4233 int i, err, pci_using_dac;
4210 u16 eeprom_data = 0; 4234 u16 eeprom_data = 0;
4211 u16 eeprom_apme_mask = E1000_EEPROM_APME; 4235 u16 eeprom_apme_mask = E1000_EEPROM_APME;
4236 int bars, need_ioport;
4212 4237
4213 e1000e_disable_l1aspm(pdev); 4238 e1000e_disable_l1aspm(pdev);
4214 err = pci_enable_device(pdev); 4239
4240 /* do not allocate ioport bars when not needed */
4241 need_ioport = e1000e_is_need_ioport(pdev);
4242 if (need_ioport) {
4243 bars = pci_select_bars(pdev, IORESOURCE_MEM | IORESOURCE_IO);
4244 err = pci_enable_device(pdev);
4245 } else {
4246 bars = pci_select_bars(pdev, IORESOURCE_MEM);
4247 err = pci_enable_device_mem(pdev);
4248 }
4215 if (err) 4249 if (err)
4216 return err; 4250 return err;
4217 4251
@@ -4234,7 +4268,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
4234 } 4268 }
4235 } 4269 }
4236 4270
4237 err = pci_request_regions(pdev, e1000e_driver_name); 4271 err = pci_request_selected_regions(pdev, bars, e1000e_driver_name);
4238 if (err) 4272 if (err)
4239 goto err_pci_reg; 4273 goto err_pci_reg;
4240 4274
@@ -4259,6 +4293,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
4259 adapter->hw.adapter = adapter; 4293 adapter->hw.adapter = adapter;
4260 adapter->hw.mac.type = ei->mac; 4294 adapter->hw.mac.type = ei->mac;
4261 adapter->msg_enable = (1 << NETIF_MSG_DRV | NETIF_MSG_PROBE) - 1; 4295 adapter->msg_enable = (1 << NETIF_MSG_DRV | NETIF_MSG_PROBE) - 1;
4296 adapter->bars = bars;
4297 adapter->need_ioport = need_ioport;
4262 4298
4263 mmio_start = pci_resource_start(pdev, 0); 4299 mmio_start = pci_resource_start(pdev, 0);
4264 mmio_len = pci_resource_len(pdev, 0); 4300 mmio_len = pci_resource_len(pdev, 0);
@@ -4498,7 +4534,7 @@ err_sw_init:
4498err_ioremap: 4534err_ioremap:
4499 free_netdev(netdev); 4535 free_netdev(netdev);
4500err_alloc_etherdev: 4536err_alloc_etherdev:
4501 pci_release_regions(pdev); 4537 pci_release_selected_regions(pdev, bars);
4502err_pci_reg: 4538err_pci_reg:
4503err_dma: 4539err_dma:
4504 pci_disable_device(pdev); 4540 pci_disable_device(pdev);
@@ -4546,7 +4582,7 @@ static void __devexit e1000_remove(struct pci_dev *pdev)
4546 iounmap(adapter->hw.hw_addr); 4582 iounmap(adapter->hw.hw_addr);
4547 if (adapter->hw.flash_address) 4583 if (adapter->hw.flash_address)
4548 iounmap(adapter->hw.flash_address); 4584 iounmap(adapter->hw.flash_address);
4549 pci_release_regions(pdev); 4585 pci_release_selected_regions(pdev, adapter->bars);
4550 4586
4551 free_netdev(netdev); 4587 free_netdev(netdev);
4552 4588