summaryrefslogtreecommitdiffstats
path: root/src/drivers/net/tg3.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/net/tg3.c')
-rw-r--r--src/drivers/net/tg3.c94
1 files changed, 46 insertions, 48 deletions
diff --git a/src/drivers/net/tg3.c b/src/drivers/net/tg3.c
index 77c4712a..716bc3e5 100644
--- a/src/drivers/net/tg3.c
+++ b/src/drivers/net/tg3.c
@@ -2875,7 +2875,7 @@ static int tg3_get_device_address(struct tg3 *tp)
struct nic *nic = tp->nic;
uint32_t hi, lo, mac_offset;
- if (PCI_FUNC(tp->pdev->devfn) == 0)
+ if (PCI_FUNC(tp->pdev->busdevfn) == 0)
mac_offset = 0x7c;
else
mac_offset = 0xcc;
@@ -3219,28 +3219,65 @@ static void tg3_irq(struct nic *nic __unused, irq_action_t action __unused)
}
}
+static struct nic_operations tg3_operations = {
+ .connect = dummy_connect,
+ .poll = tg3_poll,
+ .transmit = tg3_transmit,
+ .irq = tg3_irq,
+ .disable = tg3_disable,
+};
+
+
+static struct pci_id tg3_nics[] = {
+PCI_ROM(0x14e4, 0x1644, "tg3-5700", "Broadcom Tigon 3 5700"),
+PCI_ROM(0x14e4, 0x1645, "tg3-5701", "Broadcom Tigon 3 5701"),
+PCI_ROM(0x14e4, 0x1646, "tg3-5702", "Broadcom Tigon 3 5702"),
+PCI_ROM(0x14e4, 0x1647, "tg3-5703", "Broadcom Tigon 3 5703"),
+PCI_ROM(0x14e4, 0x1648, "tg3-5704", "Broadcom Tigon 3 5704"),
+PCI_ROM(0x14e4, 0x164d, "tg3-5702FE", "Broadcom Tigon 3 5702FE"),
+PCI_ROM(0x14e4, 0x1653, "tg3-5705", "Broadcom Tigon 3 5705"),
+PCI_ROM(0x14e4, 0x1654, "tg3-5705_2", "Broadcom Tigon 3 5705_2"),
+PCI_ROM(0x14e4, 0x165d, "tg3-5705M", "Broadcom Tigon 3 5705M"),
+PCI_ROM(0x14e4, 0x165e, "tg3-5705M_2", "Broadcom Tigon 3 5705M_2"),
+PCI_ROM(0x14e4, 0x1677, "tg3-5751", "Broadcom Tigon 3 5751"),
+PCI_ROM(0x14e4, 0x1696, "tg3-5782", "Broadcom Tigon 3 5782"),
+PCI_ROM(0x14e4, 0x169c, "tg3-5788", "Broadcom Tigon 3 5788"),
+PCI_ROM(0x14e4, 0x16a6, "tg3-5702X", "Broadcom Tigon 3 5702X"),
+PCI_ROM(0x14e4, 0x16a7, "tg3-5703X", "Broadcom Tigon 3 5703X"),
+PCI_ROM(0x14e4, 0x16a8, "tg3-5704S", "Broadcom Tigon 3 5704S"),
+PCI_ROM(0x14e4, 0x16c6, "tg3-5702A3", "Broadcom Tigon 3 5702A3"),
+PCI_ROM(0x14e4, 0x16c7, "tg3-5703A3", "Broadcom Tigon 3 5703A3"),
+PCI_ROM(0x14e4, 0x170d, "tg3-5901", "Broadcom Tigon 3 5901"),
+PCI_ROM(0x14e4, 0x170e, "tg3-5901_2", "Broadcom Tigon 3 5901_2"),
+PCI_ROM(0x1148, 0x4400, "tg3-9DXX", "Syskonnect 9DXX"),
+PCI_ROM(0x1148, 0x4500, "tg3-9MXX", "Syskonnect 9MXX"),
+PCI_ROM(0x173b, 0x03e8, "tg3-ac1000", "Altima AC1000"),
+PCI_ROM(0x173b, 0x03e9, "tg3-ac1001", "Altima AC1001"),
+PCI_ROM(0x173b, 0x03ea, "tg3-ac9100", "Altima AC9100"),
+PCI_ROM(0x173b, 0x03eb, "tg3-ac1003", "Altima AC1003"),
+};
+
+static struct pci_driver tg3_driver =
+ PCI_DRIVER ( "TG3", tg3_nics, PCI_NO_CLASS );
+
/**************************************************************************
PROBE - Look for an adapter, this routine's visible to the outside
You should omit the last argument struct pci_device * for a non-PCI NIC
***************************************************************************/
static int tg3_probe ( struct dev *dev ) {
-
struct nic *nic = nic_device ( dev );
-
struct pci_device *pdev = pci_device ( dev );
struct tg3 *tp = &tg3;
unsigned long tg3reg_base, tg3reg_len;
int i, err, pm_cap;
- if (pdev == 0)
+ if ( ! find_pci_device ( pdev, &tg3_driver ) )
return 0;
memset(tp, 0, sizeof(*tp));
- adjust_pci_device(pdev);
-
nic->irqno = 0;
- nic->ioaddr = pdev->ioaddr & ~3;
+ nic->ioaddr = pdev->ioaddr;
/* Find power-management capability. */
pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM);
@@ -3340,14 +3377,7 @@ static int tg3_probe ( struct dev *dev ) {
printf("Valid link not established\n");
goto err_out_disable;
}
-static struct nic_operations tg3_operations;
-static struct nic_operations tg3_operations = {
- .connect = dummy_connect,
- .poll = tg3_poll,
- .transmit = tg3_transmit,
- .irq = tg3_irq,
- .disable = tg3_disable,
-};
+
nic->nic_op = &tg3_operations;
return 1;
@@ -3356,40 +3386,8 @@ static struct nic_operations tg3_operations = {
iounmap((void *)tp->regs);
return 0;
err_out_disable:
- tg3_disable(dev);
+ tg3_disable(nic);
return 0;
}
-static struct pci_id tg3_nics[] = {
-PCI_ROM(0x14e4, 0x1644, "tg3-5700", "Broadcom Tigon 3 5700"),
-PCI_ROM(0x14e4, 0x1645, "tg3-5701", "Broadcom Tigon 3 5701"),
-PCI_ROM(0x14e4, 0x1646, "tg3-5702", "Broadcom Tigon 3 5702"),
-PCI_ROM(0x14e4, 0x1647, "tg3-5703", "Broadcom Tigon 3 5703"),
-PCI_ROM(0x14e4, 0x1648, "tg3-5704", "Broadcom Tigon 3 5704"),
-PCI_ROM(0x14e4, 0x164d, "tg3-5702FE", "Broadcom Tigon 3 5702FE"),
-PCI_ROM(0x14e4, 0x1653, "tg3-5705", "Broadcom Tigon 3 5705"),
-PCI_ROM(0x14e4, 0x1654, "tg3-5705_2", "Broadcom Tigon 3 5705_2"),
-PCI_ROM(0x14e4, 0x165d, "tg3-5705M", "Broadcom Tigon 3 5705M"),
-PCI_ROM(0x14e4, 0x165e, "tg3-5705M_2", "Broadcom Tigon 3 5705M_2"),
-PCI_ROM(0x14e4, 0x1677, "tg3-5751", "Broadcom Tigon 3 5751"),
-PCI_ROM(0x14e4, 0x1696, "tg3-5782", "Broadcom Tigon 3 5782"),
-PCI_ROM(0x14e4, 0x169c, "tg3-5788", "Broadcom Tigon 3 5788"),
-PCI_ROM(0x14e4, 0x16a6, "tg3-5702X", "Broadcom Tigon 3 5702X"),
-PCI_ROM(0x14e4, 0x16a7, "tg3-5703X", "Broadcom Tigon 3 5703X"),
-PCI_ROM(0x14e4, 0x16a8, "tg3-5704S", "Broadcom Tigon 3 5704S"),
-PCI_ROM(0x14e4, 0x16c6, "tg3-5702A3", "Broadcom Tigon 3 5702A3"),
-PCI_ROM(0x14e4, 0x16c7, "tg3-5703A3", "Broadcom Tigon 3 5703A3"),
-PCI_ROM(0x14e4, 0x170d, "tg3-5901", "Broadcom Tigon 3 5901"),
-PCI_ROM(0x14e4, 0x170e, "tg3-5901_2", "Broadcom Tigon 3 5901_2"),
-PCI_ROM(0x1148, 0x4400, "tg3-9DXX", "Syskonnect 9DXX"),
-PCI_ROM(0x1148, 0x4500, "tg3-9MXX", "Syskonnect 9MXX"),
-PCI_ROM(0x173b, 0x03e8, "tg3-ac1000", "Altima AC1000"),
-PCI_ROM(0x173b, 0x03e9, "tg3-ac1001", "Altima AC1001"),
-PCI_ROM(0x173b, 0x03ea, "tg3-ac9100", "Altima AC9100"),
-PCI_ROM(0x173b, 0x03eb, "tg3-ac1003", "Altima AC1003"),
-};
-
-static struct pci_driver tg3_driver =
- PCI_DRIVER ( "TG3", tg3_nics, PCI_NO_CLASS );
-
BOOT_DRIVER ( "TG3", tg3_probe );