Finished by hand

This commit is contained in:
Michael Brown
2005-04-13 01:01:33 +00:00
parent 3616de915e
commit 9848135950
9 changed files with 192 additions and 177 deletions

View File

@@ -181,6 +181,9 @@ enum desc_status_bits {
/* Globals */ /* Globals */
static struct nic_operations natsemi_operations;
static struct pci_driver natsemi_driver;
static int natsemi_debug = 1; /* 1 normal messages, 0 quiet .. 7 verbose. */ static int natsemi_debug = 1; /* 1 normal messages, 0 quiet .. 7 verbose. */
const char *nic_name; const char *nic_name;
@@ -249,30 +252,31 @@ natsemi_probe ( struct dev *dev ) {
int prev_eedata; int prev_eedata;
u32 tmp; u32 tmp;
if (pci->ioaddr == 0) if ( ! find_pci_device ( pci, &natsemi_driver ) )
return 0; return 0;
adjust_pci_device(pci); if (pci->ioaddr == 0)
return 0;
/* initialize some commonly used globals */ /* initialize some commonly used globals */
nic->irqno = 0; nic->irqno = 0;
nic->ioaddr = pci->ioaddr & ~3; nic->ioaddr = pci->ioaddr;
ioaddr = pci->ioaddr & ~3; ioaddr = pci->ioaddr;
vendor = pci->vendor; vendor = pci->vendor;
dev_id = pci->dev_id; dev_id = pci->dev_id;
nic_name = pci->name; nic_name = dev->name;
/* natsemi has a non-standard PM control register /* natsemi has a non-standard PM control register
* in PCI config space. Some boards apparently need * in PCI config space. Some boards apparently need
* to be brought to D0 in this manner. * to be brought to D0 in this manner.
*/ */
pcibios_read_config_dword(pci->bus, pci->devfn, PCIPM, &tmp); pci_read_config_dword(pci, PCIPM, &tmp);
if (tmp & (0x03|0x100)) { if (tmp & (0x03|0x100)) {
/* D0 state, disable PME assertion */ /* D0 state, disable PME assertion */
u32 newtmp = tmp & ~(0x03|0x100); u32 newtmp = tmp & ~(0x03|0x100);
pcibios_write_config_dword(pci->bus, pci->devfn, PCIPM, newtmp); pci_write_config_dword(pci, PCIPM, newtmp);
} }
/* get MAC address */ /* get MAC address */
@@ -316,14 +320,6 @@ natsemi_probe ( struct dev *dev ) {
/* initialize device */ /* initialize device */
natsemi_init(nic); natsemi_init(nic);
static struct nic_operations natsemi_operations;
static struct nic_operations natsemi_operations = {
.connect = dummy_connect,
.poll = natsemi_poll,
.transmit = natsemi_transmit,
.irq = natsemi_irq,
.disable = natsemi_disable,
};
nic->nic_op = &natsemi_operations; nic->nic_op = &natsemi_operations;
return 1; return 1;
@@ -770,6 +766,14 @@ natsemi_irq(struct nic *nic __unused, irq_action_t action __unused)
} }
} }
static struct nic_operations natsemi_operations = {
.connect = dummy_connect,
.poll = natsemi_poll,
.transmit = natsemi_transmit,
.irq = natsemi_irq,
.disable = natsemi_disable,
};
static struct pci_id natsemi_nics[] = { static struct pci_id natsemi_nics[] = {
PCI_ROM(0x100b, 0x0020, "dp83815", "DP83815"), PCI_ROM(0x100b, 0x0020, "dp83815", "DP83815"),
}; };

View File

@@ -774,7 +774,7 @@ static void ns83820_disable ( struct nic *nic ) {
ns->up = 0; ns->up = 0;
ns83820_do_reset((struct nic *) dev, CR_RST); ns83820_do_reset(nic, CR_RST);
ns->IMR_cache &= ns->IMR_cache &=
~(ISR_RXOK | ISR_RXDESC | ISR_RXERR | ISR_RXEARLY | ~(ISR_RXOK | ISR_RXDESC | ISR_RXERR | ISR_RXEARLY |
@@ -804,6 +804,21 @@ static void ns83820_irq(struct nic *nic __unused, irq_action_t action __unused)
} }
} }
static struct nic_operations ns83820_operations = {
.connect = dummy_connect,
.poll = ns83820_poll,
.transmit = ns83820_transmit,
.irq = ns83820_irq,
.disable = ns83820_disable,
};
static struct pci_id ns83820_nics[] = {
PCI_ROM(0x100b, 0x0022, "ns83820", "National Semiconductor 83820"),
};
static struct pci_driver ns83820_driver =
PCI_DRIVER ( "NS83820/PCI", ns83820_nics, PCI_NO_CLASS );
/************************************************************************** /**************************************************************************
PROBE - Look for an adapter, this routine's visible to the outside PROBE - Look for an adapter, this routine's visible to the outside
***************************************************************************/ ***************************************************************************/
@@ -811,19 +826,20 @@ PROBE - Look for an adapter, this routine's visible to the outside
#define board_found 1 #define board_found 1
#define valid_link 0 #define valid_link 0
static int ns83820_probe ( struct dev *dev ) { static int ns83820_probe ( struct dev *dev ) {
struct nic *nic = nic_device ( dev ); struct nic *nic = nic_device ( dev );
struct pci_device *pci = pci_device ( dev ); struct pci_device *pci = pci_device ( dev );
int sz; int sz;
long addr; long addr;
int using_dac = 0; int using_dac = 0;
if ( ! find_pci_device ( pci, &ns83820_driver ) )
return 0;
if (pci->ioaddr == 0) if (pci->ioaddr == 0)
return 0; return 0;
printf("ns83820.c: Found %s, vendor=0x%hX, device=0x%hX\n", printf("ns83820.c: Found %s, vendor=0x%hX, device=0x%hX\n",
pci->name, pci->vendor, pci->dev_id); dev->name, pci->vendor, pci->dev_id);
/* point to private storage */ /* point to private storage */
ns = &nsx; ns = &nsx;
@@ -863,12 +879,12 @@ static int ns83820_probe ( struct dev *dev ) {
ns->CFG_cache = readl(ns->base + CFG); ns->CFG_cache = readl(ns->base + CFG);
if ((ns->CFG_cache & CFG_PCI64_DET)) { if ((ns->CFG_cache & CFG_PCI64_DET)) {
printf("%s: detected 64 bit PCI data bus.\n", pci->name); printf("%s: detected 64 bit PCI data bus.\n", dev->name);
/*dev->CFG_cache |= CFG_DATA64_EN; */ /*dev->CFG_cache |= CFG_DATA64_EN; */
if (!(ns->CFG_cache & CFG_DATA64_EN)) if (!(ns->CFG_cache & CFG_DATA64_EN))
printf printf
("%s: EEPROM did not enable 64 bit bus. Disabled.\n", ("%s: EEPROM did not enable 64 bit bus. Disabled.\n",
pci->name); dev->name);
} else } else
ns->CFG_cache &= ~(CFG_DATA64_EN); ns->CFG_cache &= ~(CFG_DATA64_EN);
@@ -1000,22 +1016,8 @@ static int ns83820_probe ( struct dev *dev ) {
ns83820_reset(nic); ns83820_reset(nic);
/* point to NIC specific routines */ /* point to NIC specific routines */
static struct nic_operations ns83820_operations; nic->nic_op = &ns83820_operations;
static struct nic_operations ns83820_operations = {
.connect = dummy_connect,
.poll = ns83820_poll,
.transmit = ns83820_transmit,
.irq = ns83820_irq,
.disable = ns83820_disable,
}; nic->nic_op = &ns83820_operations;
return 1; return 1;
} }
static struct pci_id ns83820_nics[] = {
PCI_ROM(0x100b, 0x0022, "ns83820", "National Semiconductor 83820"),
};
static struct pci_driver ns83820_driver =
PCI_DRIVER ( "NS83820/PCI", ns83820_nics, PCI_NO_CLASS );
BOOT_DRIVER ( "NS83820/PCI", ns83820_probe ); BOOT_DRIVER ( "NS83820/PCI", ns83820_probe );

View File

@@ -62,6 +62,8 @@ typedef unsigned int u32;
typedef signed int s32; typedef signed int s32;
static u32 ioaddr; /* Globally used for the card's io address */ static u32 ioaddr; /* Globally used for the card's io address */
static struct nic_operations pcnet32_operations;
static struct pci_driver pcnet32_driver;
#ifdef EDEBUG #ifdef EDEBUG
#define dprintf(x) printf x #define dprintf(x) printf x
@@ -665,9 +667,7 @@ 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 You should omit the last argument struct pci_device * for a non-PCI NIC
***************************************************************************/ ***************************************************************************/
static int pcnet32_probe ( struct dev *dev ) { static int pcnet32_probe ( struct dev *dev ) {
struct nic *nic = nic_device ( dev ); struct nic *nic = nic_device ( dev );
struct pci_device *pci = pci_device ( dev ); struct pci_device *pci = pci_device ( dev );
int i, media; int i, media;
int fdx, mii, fset, dxsuflo, ltint; int fdx, mii, fset, dxsuflo, ltint;
@@ -675,15 +675,18 @@ static int pcnet32_probe ( struct dev *dev ) {
char *chipname; char *chipname;
struct pcnet32_access *a = NULL; struct pcnet32_access *a = NULL;
u8 promaddr[6]; u8 promaddr[6];
int shared = 1; int shared = 1;
if ( ! find_pci_device ( pci, &pcnet32_driver ) )
return 0;
if (pci->ioaddr == 0) if (pci->ioaddr == 0)
return 0; return 0;
/* BASE is used throughout to address the card */ /* BASE is used throughout to address the card */
ioaddr = pci->ioaddr; ioaddr = pci->ioaddr;
printf("pcnet32.c: Found %s, Vendor=0x%hX Device=0x%hX\n", printf("pcnet32.c: Found %s, Vendor=0x%hX Device=0x%hX\n",
pci->name, pci->vendor, pci->dev_id); dev->name, pci->vendor, pci->dev_id);
nic->irqno = 0; nic->irqno = 0;
nic->ioaddr = pci->ioaddr & ~3; nic->ioaddr = pci->ioaddr & ~3;
@@ -801,7 +804,7 @@ static int pcnet32_probe ( struct dev *dev ) {
nic->node_addr[i] = promaddr[i]; nic->node_addr[i] = promaddr[i];
} }
/* Print out some hardware info */ /* Print out some hardware info */
printf("%s: %! at ioaddr %hX, ", pci->name, nic->node_addr, printf("%s: %! at ioaddr %hX, ", dev->name, nic->node_addr,
ioaddr); ioaddr);
/* Set to pci bus master */ /* Set to pci bus master */
@@ -945,14 +948,7 @@ static int pcnet32_probe ( struct dev *dev ) {
else else
printf("\n"); printf("\n");
} }
static struct nic_operations pcnet32_operations;
static struct nic_operations pcnet32_operations = {
.connect = dummy_connect,
.poll = pcnet32_poll,
.transmit = pcnet32_transmit,
.irq = pcnet32_irq,
.disable = pcnet32_disable,
};
nic->nic_op = &pcnet32_operations; nic->nic_op = &pcnet32_operations;
return 1; return 1;
@@ -993,6 +989,14 @@ static void mdio_write(struct nic *nic __unused, int phy_id, int reg_num,
} }
#endif #endif
static struct nic_operations pcnet32_operations = {
.connect = dummy_connect,
.poll = pcnet32_poll,
.transmit = pcnet32_transmit,
.irq = pcnet32_irq,
.disable = pcnet32_disable,
};
static struct pci_id pcnet32_nics[] = { static struct pci_id pcnet32_nics[] = {
PCI_ROM(0x1022, 0x2000, "lancepci", "AMD Lance/PCI"), PCI_ROM(0x1022, 0x2000, "lancepci", "AMD Lance/PCI"),
PCI_ROM(0x1022, 0x2625, "pcnetfastiii", "AMD Lance/PCI PCNet/32"), PCI_ROM(0x1022, 0x2625, "pcnetfastiii", "AMD Lance/PCI PCNet/32"),

View File

@@ -702,6 +702,21 @@ static void r8169_disable ( struct nic *nic __unused ) {
} }
} }
static struct nic_operations r8169_operations = {
.connect = dummy_connect,
.poll = r8169_poll,
.transmit = r8169_transmit,
.irq = r8169_irq,
.disable = r8169_disable,
};
static struct pci_id r8169_nics[] = {
PCI_ROM(0x10ec, 0x8169, "r8169", "RealTek RTL8169 Gigabit Ethernet"),
};
static struct pci_driver r8169_driver =
PCI_DRIVER ( "r8169/PCI", r8169_nics, PCI_NO_CLASS );
/************************************************************************** /**************************************************************************
PROBE - Look for an adapter, this routine's visible to the outside PROBE - Look for an adapter, this routine's visible to the outside
***************************************************************************/ ***************************************************************************/
@@ -709,17 +724,18 @@ PROBE - Look for an adapter, this routine's visible to the outside
#define board_found 1 #define board_found 1
#define valid_link 0 #define valid_link 0
static int r8169_probe ( struct dev *dev ) { static int r8169_probe ( struct dev *dev ) {
struct nic *nic = nic_device ( dev ); struct nic *nic = nic_device ( dev );
struct pci_device *pci = pci_device ( dev ); struct pci_device *pci = pci_device ( dev );
static int board_idx = -1; static int board_idx = -1;
static int printed_version = 0; static int printed_version = 0;
int i, rc; int i, rc;
int option = -1, Cap10_100 = 0, Cap1000 = 0; int option = -1, Cap10_100 = 0, Cap1000 = 0;
if ( ! find_pci_device ( pci, &r8169_driver ) )
return 0;
printf("r8169.c: Found %s, Vendor=%hX Device=%hX\n", printf("r8169.c: Found %s, Vendor=%hX Device=%hX\n",
pci->name, pci->vendor, pci->dev_id); dev->name, pci->vendor, pci->dev_id);
board_idx++; board_idx++;
@@ -737,7 +753,7 @@ static int r8169_probe ( struct dev *dev ) {
dprintf(("%s: Identified chip type is '%s'.\n", pci->name, dprintf(("%s: Identified chip type is '%s'.\n", pci->name,
rtl_chip_info[tpc->chipset].name)); rtl_chip_info[tpc->chipset].name));
/* Print out some hardware info */ /* Print out some hardware info */
printf("%s: %! at ioaddr %hX, ", pci->name, nic->node_addr, printf("%s: %! at ioaddr %hX, ", dev->name, nic->node_addr,
ioaddr); ioaddr);
/* if TBI is not endbled */ /* if TBI is not endbled */
@@ -824,32 +840,18 @@ static int r8169_probe ( struct dev *dev ) {
udelay(100); udelay(100);
printf printf
("%s: 1000Mbps Full-duplex operation, TBI Link %s!\n", ("%s: 1000Mbps Full-duplex operation, TBI Link %s!\n",
pci->name, dev->name,
(RTL_R32(TBICSR) & TBILinkOK) ? "OK" : "Failed"); (RTL_R32(TBICSR) & TBILinkOK) ? "OK" : "Failed");
} }
r8169_reset(nic); r8169_reset(nic);
/* point to NIC specific routines */ /* point to NIC specific routines */
static struct nic_operations r8169_operations; nic->nic_op = &r8169_operations;
static struct nic_operations r8169_operations = {
.connect = dummy_connect,
.poll = r8169_poll,
.transmit = r8169_transmit,
.irq = r8169_irq,
.disable = r8169_disable,
}; nic->nic_op = &r8169_operations;
nic->irqno = pci->irq; nic->irqno = pci->irq;
nic->ioaddr = ioaddr; nic->ioaddr = ioaddr;
return 1; return 1;
} }
static struct pci_id r8169_nics[] = {
PCI_ROM(0x10ec, 0x8169, "r8169", "RealTek RTL8169 Gigabit Ethernet"),
};
static struct pci_driver r8169_driver =
PCI_DRIVER ( "r8169/PCI", r8169_nics, PCI_NO_CLASS );
BOOT_DRIVER ( "r8169/PCI", r8169_probe ); BOOT_DRIVER ( "r8169/PCI", r8169_probe );

View File

@@ -52,6 +52,9 @@
/* Globals */ /* Globals */
static struct nic_operations sis900_operations;
static struct pci_driver sis900_driver;
static int sis900_debug = 0; static int sis900_debug = 0;
static unsigned short vendor, dev_id; static unsigned short vendor, dev_id;
@@ -308,9 +311,7 @@ static int sis635_get_mac_addr(struct pci_device * pci_dev __unused, struct nic
*/ */
static int sis900_probe ( struct dev *dev ) { static int sis900_probe ( struct dev *dev ) {
struct nic *nic = nic_device ( dev ); struct nic *nic = nic_device ( dev );
struct pci_device *pci = pci_device ( dev ); struct pci_device *pci = pci_device ( dev );
int i; int i;
int found=0; int found=0;
@@ -318,12 +319,15 @@ static int sis900_probe ( struct dev *dev ) {
u8 revision; u8 revision;
int ret; int ret;
if ( ! find_pci_device ( pci, &sis900_driver ) )
return 0;
if (pci->ioaddr == 0) if (pci->ioaddr == 0)
return 0; return 0;
nic->irqno = 0; nic->irqno = 0;
nic->ioaddr = pci->ioaddr & ~3; nic->ioaddr = pci->ioaddr;
ioaddr = pci->ioaddr & ~3; ioaddr = pci->ioaddr;
vendor = pci->vendor; vendor = pci->vendor;
dev_id = pci->dev_id; dev_id = pci->dev_id;
@@ -409,14 +413,6 @@ static int sis900_probe ( struct dev *dev ) {
/* initialize device */ /* initialize device */
sis900_init(nic); sis900_init(nic);
static struct nic_operations sis900_operations;
static struct nic_operations sis900_operations = {
.connect = dummy_connect,
.poll = sis900_poll,
.transmit = sis900_transmit,
.irq = sis900_irq,
.disable = sis900_disable,
};
nic->nic_op = &sis900_operations; nic->nic_op = &sis900_operations;
return 1; return 1;
@@ -1253,6 +1249,14 @@ sis900_irq(struct nic *nic __unused, irq_action_t action __unused)
} }
} }
static struct nic_operations sis900_operations = {
.connect = dummy_connect,
.poll = sis900_poll,
.transmit = sis900_transmit,
.irq = sis900_irq,
.disable = sis900_disable,
};
static struct pci_id sis900_nics[] = { static struct pci_id sis900_nics[] = {
PCI_ROM(0x1039, 0x0900, "sis900", "SIS900"), PCI_ROM(0x1039, 0x0900, "sis900", "SIS900"),
PCI_ROM(0x1039, 0x7016, "sis7016", "SIS7016"), PCI_ROM(0x1039, 0x7016, "sis7016", "SIS7016"),

View File

@@ -571,28 +571,36 @@ static void sundance_disable ( struct nic *nic __unused ) {
outw(TxDisable | RxDisable | StatsDisable, BASE + MACCtrl1); outw(TxDisable | RxDisable | StatsDisable, BASE + MACCtrl1);
} }
static struct nic_operations sundance_operations = {
.connect = dummy_connect,
.poll = sundance_poll,
.transmit = sundance_transmit,
.irq = sundance_irq,
.disable = sundance_disable,
};
static struct pci_driver sundance_driver;
/************************************************************************** /**************************************************************************
PROBE - Look for an adapter, this routine's visible to the outside PROBE - Look for an adapter, this routine's visible to the outside
***************************************************************************/ ***************************************************************************/
static int sundance_probe ( struct dev *dev ) { static int sundance_probe ( struct dev *dev ) {
struct nic *nic = nic_device ( dev ); struct nic *nic = nic_device ( dev );
struct pci_device *pci = pci_device ( dev ); struct pci_device *pci = pci_device ( dev );
u8 ee_data[EEPROM_SIZE]; u8 ee_data[EEPROM_SIZE];
u16 mii_ctl; u16 mii_ctl;
int i; int i;
int speed; int speed;
if ( ! find_pci_device ( pci, &sundance_driver ) )
return 0;
if (pci->ioaddr == 0) if (pci->ioaddr == 0)
return 0; return 0;
/* BASE is used throughout to address the card */ /* BASE is used throughout to address the card */
BASE = pci->ioaddr; BASE = pci->ioaddr;
printf(" sundance.c: Found %s Vendor=0x%hX Device=0x%hX\n", printf(" sundance.c: Found %s Vendor=0x%hX Device=0x%hX\n",
pci->name, pci->vendor, pci->dev_id); dev->name, pci->vendor, pci->dev_id);
/* Get the MAC Address by reading the EEPROM */ /* Get the MAC Address by reading the EEPROM */
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
@@ -614,13 +622,13 @@ static int sundance_probe ( struct dev *dev ) {
/* point to private storage */ /* point to private storage */
sdc = &sdx; sdc = &sdx;
sdc->nic_name = pci->name; sdc->nic_name = dev->name;
sdc->mtu = mtu; sdc->mtu = mtu;
pci_read_config_byte(pci, PCI_REVISION_ID, &sdc->pci_rev_id); pci_read_config_byte(pci, PCI_REVISION_ID, &sdc->pci_rev_id);
dprintf(("Device revision id: %hx\n", sdc->pci_rev_id)); dprintf(("Device revision id: %hx\n", sdc->pci_rev_id));
/* Print out some hardware info */ /* Print out some hardware info */
printf("%s: %! at ioaddr %hX, ", pci->name, nic->node_addr, BASE); printf("%s: %! at ioaddr %hX, ", dev->name, nic->node_addr, BASE);
sdc->mii_preamble_required = 0; sdc->mii_preamble_required = 0;
if (1) { if (1) {
int phy, phy_idx = 0; int phy, phy_idx = 0;
@@ -735,14 +743,7 @@ static int sundance_probe ( struct dev *dev ) {
sdc->mii_if.full_duplex ? "Full" : "Half"); sdc->mii_if.full_duplex ? "Full" : "Half");
/* point to NIC specific routines */ /* point to NIC specific routines */
static struct nic_operations sundance_operations; nic->nic_op = &sundance_operations;
static struct nic_operations sundance_operations = {
.connect = dummy_connect,
.poll = sundance_poll,
.transmit = sundance_transmit,
.irq = sundance_irq,
.disable = sundance_disable,
}; nic->nic_op = &sundance_operations;
nic->irqno = pci->irq; nic->irqno = pci->irq;
nic->ioaddr = BASE; nic->ioaddr = BASE;

View File

@@ -2875,7 +2875,7 @@ static int tg3_get_device_address(struct tg3 *tp)
struct nic *nic = tp->nic; struct nic *nic = tp->nic;
uint32_t hi, lo, mac_offset; uint32_t hi, lo, mac_offset;
if (PCI_FUNC(tp->pdev->devfn) == 0) if (PCI_FUNC(tp->pdev->busdevfn) == 0)
mac_offset = 0x7c; mac_offset = 0x7c;
else else
mac_offset = 0xcc; 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 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 You should omit the last argument struct pci_device * for a non-PCI NIC
***************************************************************************/ ***************************************************************************/
static int tg3_probe ( struct dev *dev ) { static int tg3_probe ( struct dev *dev ) {
struct nic *nic = nic_device ( dev ); struct nic *nic = nic_device ( dev );
struct pci_device *pdev = pci_device ( dev ); struct pci_device *pdev = pci_device ( dev );
struct tg3 *tp = &tg3; struct tg3 *tp = &tg3;
unsigned long tg3reg_base, tg3reg_len; unsigned long tg3reg_base, tg3reg_len;
int i, err, pm_cap; int i, err, pm_cap;
if (pdev == 0) if ( ! find_pci_device ( pdev, &tg3_driver ) )
return 0; return 0;
memset(tp, 0, sizeof(*tp)); memset(tp, 0, sizeof(*tp));
adjust_pci_device(pdev);
nic->irqno = 0; nic->irqno = 0;
nic->ioaddr = pdev->ioaddr & ~3; nic->ioaddr = pdev->ioaddr;
/* Find power-management capability. */ /* Find power-management capability. */
pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM); 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"); printf("Valid link not established\n");
goto err_out_disable; 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; nic->nic_op = &tg3_operations;
return 1; return 1;
@@ -3356,40 +3386,8 @@ static struct nic_operations tg3_operations = {
iounmap((void *)tp->regs); iounmap((void *)tp->regs);
return 0; return 0;
err_out_disable: err_out_disable:
tg3_disable(dev); tg3_disable(nic);
return 0; 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 ); BOOT_DRIVER ( "TG3", tg3_probe );

View File

@@ -65,6 +65,8 @@
#define dprintf(x) #define dprintf(x)
#endif #endif
static struct pci_driver tlan_driver;
static void TLan_ResetLists(struct nic *nic __unused); static void TLan_ResetLists(struct nic *nic __unused);
static void TLan_ResetAdapter(struct nic *nic __unused); static void TLan_ResetAdapter(struct nic *nic __unused);
static void TLan_FinishReset(struct nic *nic __unused); static void TLan_FinishReset(struct nic *nic __unused);
@@ -438,8 +440,9 @@ void TLan_FinishReset(struct nic *nic)
"Full" : "Half")); "Full" : "Half"));
dprintf(("TLAN: Partner capability: ")); dprintf(("TLAN: Partner capability: "));
for (i = 5; i <= 10; i++) for (i = 5; i <= 10; i++)
if (partner & (1 << i)) if (partner & (1 << i)) {
dprintf(("%s", media[i - 5])); dprintf(("%s", media[i - 5]));
}
dprintf(("\n")); dprintf(("\n"));
} }
@@ -748,6 +751,14 @@ static void tlan_irq(struct nic *nic __unused, irq_action_t action __unused)
} }
} }
static struct nic_operations tlan_operations = {
.connect = dummy_connect,
.poll = tlan_poll,
.transmit = tlan_transmit,
.irq = tlan_irq,
.disable = tlan_disable,
};
static void TLan_SetMulticastList(struct nic *nic) { static void TLan_SetMulticastList(struct nic *nic) {
int i; int i;
u8 tmp; u8 tmp;
@@ -771,28 +782,23 @@ PROBE - Look for an adapter, this routine's visible to the outside
#define board_found 1 #define board_found 1
#define valid_link 0 #define valid_link 0
static int tlan_probe ( struct dev *dev ) { static int tlan_probe ( struct dev *dev ) {
struct nic *nic = nic_device ( dev ); struct nic *nic = nic_device ( dev );
struct pci_device *pci = pci_device ( dev ); struct pci_device *pci = pci_device ( dev );
u16 data = 0; u16 data = 0;
int err; int err;
int i; int i;
if ( ! find_pci_device ( pci, &tlan_driver ) )
return 0;
if (pci->ioaddr == 0) if (pci->ioaddr == 0)
return 0; return 0;
nic->irqno = 0; nic->irqno = 0;
nic->ioaddr = pci->ioaddr & ~3; nic->ioaddr = pci->ioaddr;
BASE = pci->ioaddr; BASE = pci->ioaddr;
printf("tlan.c: Found %s, Vendor 0x%hX, Device 0x%hX\n",
pci->name, pci->vendor, pci->dev_id);
/* Set nic as PCI bus master */
adjust_pci_device(pci);
/* Point to private storage */ /* Point to private storage */
priv = &TLanPrivateInfo; priv = &TLanPrivateInfo;
@@ -810,7 +816,7 @@ static int tlan_probe ( struct dev *dev ) {
priv->vendor_id = pci->vendor; priv->vendor_id = pci->vendor;
priv->dev_id = pci->dev_id; priv->dev_id = pci->dev_id;
priv->nic_name = pci->name; priv->nic_name = dev->name;
priv->eoc = 0; priv->eoc = 0;
err = 0; err = 0;
@@ -821,11 +827,11 @@ static int tlan_probe ( struct dev *dev ) {
(u8 *) & nic->node_addr[i]); (u8 *) & nic->node_addr[i]);
if (err) { if (err) {
printf("TLAN: %s: Error reading MAC from eeprom: %d\n", printf("TLAN: %s: Error reading MAC from eeprom: %d\n",
pci->name, err); dev->name, err);
} else } else
/* Print out some hardware info */ /* Print out some hardware info */
printf("%s: %! at ioaddr %hX, ", printf("%s: %! at ioaddr %hX, ",
pci->name, nic->node_addr, pci->ioaddr); dev->name, nic->node_addr, pci->ioaddr);
priv->tlanRev = TLan_DioRead8(BASE, TLAN_DEF_REVISION); priv->tlanRev = TLan_DioRead8(BASE, TLAN_DEF_REVISION);
printf("revision: 0x%hX\n", priv->tlanRev); printf("revision: 0x%hX\n", priv->tlanRev);
@@ -844,14 +850,6 @@ static int tlan_probe ( struct dev *dev ) {
/* if (board_found && valid_link) /* if (board_found && valid_link)
{*/ {*/
/* point to NIC specific routines */ /* point to NIC specific routines */
static struct nic_operations tlan_operations;
static struct nic_operations tlan_operations = {
.connect = dummy_connect,
.poll = tlan_poll,
.transmit = tlan_transmit,
.irq = tlan_irq,
.disable = tlan_disable,
};
nic->nic_op = &tlan_operations; nic->nic_op = &tlan_operations;
return 1; return 1;
} }

View File

@@ -1213,13 +1213,20 @@ static void tulip_irq(struct nic *nic __unused, irq_action_t action __unused)
} }
} }
static struct nic_operations tulip_operations = {
.connect = dummy_connect,
.poll = tulip_poll,
.transmit = tulip_transmit,
.irq = tulip_irq,
.disable = tulip_disable,
};
static struct pci_driver tulip_driver;
/*********************************************************************/ /*********************************************************************/
/* eth_probe - Look for an adapter */ /* eth_probe - Look for an adapter */
/*********************************************************************/ /*********************************************************************/
static int tulip_probe ( struct dev *dev ) { static int tulip_probe ( struct dev *dev ) {
struct nic *nic = nic_device ( dev ); struct nic *nic = nic_device ( dev );
struct pci_device *pci = pci_device ( dev ); struct pci_device *pci = pci_device ( dev );
u32 i; u32 i;
u8 chip_rev; u8 chip_rev;
@@ -1228,6 +1235,9 @@ static int tulip_probe ( struct dev *dev ) {
int chip_idx; int chip_idx;
static unsigned char last_phys_addr[ETH_ALEN] = {0x00, 'L', 'i', 'n', 'u', 'x'}; static unsigned char last_phys_addr[ETH_ALEN] = {0x00, 'L', 'i', 'n', 'u', 'x'};
if ( ! find_pci_device ( pci, &tulip_driver ) )
return 0;
if (pci->ioaddr == 0) if (pci->ioaddr == 0)
return 0; return 0;
@@ -1240,7 +1250,7 @@ static int tulip_probe ( struct dev *dev ) {
tp->vendor_id = pci->vendor; tp->vendor_id = pci->vendor;
tp->dev_id = pci->dev_id; tp->dev_id = pci->dev_id;
tp->nic_name = pci->name; tp->nic_name = dev->name;
tp->if_port = 0; tp->if_port = 0;
tp->default_port = 0; tp->default_port = 0;
@@ -1301,7 +1311,7 @@ static int tulip_probe ( struct dev *dev ) {
/* Bring the 21041/21143 out of sleep mode. /* Bring the 21041/21143 out of sleep mode.
Caution: Snooze mode does not work with some boards! */ Caution: Snooze mode does not work with some boards! */
if (tp->flags & HAS_PWRDWN) if (tp->flags & HAS_PWRDWN)
pcibios_write_config_dword(pci->bus, pci->devfn, 0x40, 0x00000000); pci_write_config_dword(pci, 0x40, 0x00000000);
if (inl(ioaddr + CSR5) == 0xFFFFFFFF) { if (inl(ioaddr + CSR5) == 0xFFFFFFFF) {
printf("%s: The Tulip chip at %X is not functioning.\n", printf("%s: The Tulip chip at %X is not functioning.\n",
@@ -1309,7 +1319,7 @@ static int tulip_probe ( struct dev *dev ) {
return 0; return 0;
} }
pcibios_read_config_byte(pci->bus, pci->devfn, PCI_REVISION, &chip_rev); pci_read_config_byte(pci, PCI_REVISION, &chip_rev);
printf("%s: [chip: %s] rev %d at %hX\n", tp->nic_name, printf("%s: [chip: %s] rev %d at %hX\n", tp->nic_name,
tulip_tbl[chip_idx].chip_name, chip_rev, ioaddr); tulip_tbl[chip_idx].chip_name, chip_rev, ioaddr);
@@ -1422,14 +1432,6 @@ static int tulip_probe ( struct dev *dev ) {
/* reset the device and make ready for tx and rx of packets */ /* reset the device and make ready for tx and rx of packets */
tulip_reset(nic); tulip_reset(nic);
static struct nic_operations tulip_operations;
static struct nic_operations tulip_operations = {
.connect = dummy_connect,
.poll = tulip_poll,
.transmit = tulip_transmit,
.irq = tulip_irq,
.disable = tulip_disable,
};
nic->nic_op = &tulip_operations; nic->nic_op = &tulip_operations;
/* give the board a chance to reset before returning */ /* give the board a chance to reset before returning */