Skip to content

Commit

Permalink
Finished by hand
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Brown committed Apr 13, 2005
1 parent f16ac2d commit f39cc6d
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 91 deletions.
19 changes: 11 additions & 8 deletions src/drivers/net/e1000.c
Expand Up @@ -85,6 +85,9 @@ typedef enum {
#include "e1000_hw.h"

/* NIC specific static variables go here */
static struct nic_operations e1000_operations;
static struct pci_driver e1000_driver;

static struct e1000_hw hw;
static char tx_pool[128 + 16];
static char rx_pool[128 + 16];
Expand Down Expand Up @@ -3580,15 +3583,14 @@ 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 e1000_probe ( struct dev *dev ) {

struct nic *nic = nic_device ( dev );

struct pci_device *p = pci_device ( dev );
unsigned long mmio_start, mmio_len;
int ret_val, i;

if (p == 0)
if ( ! find_pci_device ( p, &e1000_driver ) )
return 0;

/* Initialize hw with default values */
memset(&hw, 0, sizeof(hw));
hw.pdev = p;
Expand Down Expand Up @@ -3663,17 +3665,18 @@ static int e1000_probe ( struct dev *dev ) {
init_descriptor();

/* point to NIC specific routines */
static struct nic_operations e1000_operations;
nic->nic_op = &e1000_operations;

return 1;
}

static struct nic_operations e1000_operations = {
.connect = dummy_connect,
.poll = e1000_poll,
.transmit = e1000_transmit,
.irq = e1000_irq,
.disable = e1000_disable,
}; nic->nic_op = &e1000_operations;

return 1;
}
};

static struct pci_id e1000_nics[] = {
PCI_ROM(0x8086, 0x1000, "e1000-82542", "Intel EtherExpressPro1000"),
Expand Down
30 changes: 16 additions & 14 deletions src/drivers/net/eepro100.c
Expand Up @@ -258,6 +258,9 @@ struct RxFD { /* Receive frame descriptor. */
char packet[1518];
};

static struct nic_operations eepro100_operations;
static struct pci_driver eepro100_driver;

#define RXFD_COUNT 4
static struct RxFD rxfds[RXFD_COUNT];
static unsigned int rxfd = 0;
Expand Down Expand Up @@ -601,9 +604,7 @@ static void eepro100_disable ( struct nic *nic __unused ) {
*/

static int eepro100_probe ( struct dev *dev ) {

struct nic *nic = nic_device ( dev );

struct pci_device *p = pci_device ( dev );
unsigned short sum = 0;
int i;
Expand All @@ -615,13 +616,14 @@ static int eepro100_probe ( struct dev *dev ) {
be careful not to access beyond this array */
unsigned short eeprom[16];

if ( ! find_pci_device ( p, &eepro100_driver ) )
return 0;

if (p->ioaddr == 0)
return 0;
ioaddr = p->ioaddr & ~3; /* Mask the bit that says "this is an io addr" */
ioaddr = p->ioaddr;
nic->ioaddr = ioaddr;

adjust_pci_device(p);

/* Copy IRQ from PCI information */
nic->irqno = p->irq;

Expand Down Expand Up @@ -764,17 +766,9 @@ static int eepro100_probe ( struct dev *dev ) {
*/
if (!(mdio_read(eeprom[6] & 0x1f, 1) & (1 << 2))) {
printf("Valid link not established\n");
eepro100_disable(dev);
eepro100_disable(nic);
return 0;
}
static struct nic_operations eepro100_operations;
static struct nic_operations eepro100_operations = {
.connect = dummy_connect,
.poll = eepro100_poll,
.transmit = eepro100_transmit,
.irq = eepro100_irq,
.disable = eepro100_disable,
};
nic->nic_op = &eepro100_operations;
return 1;
}
Expand All @@ -799,6 +793,14 @@ void hd (void *where, int n)
}
#endif

static struct nic_operations eepro100_operations = {
.connect = dummy_connect,
.poll = eepro100_poll,
.transmit = eepro100_transmit,
.irq = eepro100_irq,
.disable = eepro100_disable,
};

static struct pci_id eepro100_nics[] = {
PCI_ROM(0x8086, 0x1029, "id1029", "Intel EtherExpressPro100 ID1029"),
PCI_ROM(0x8086, 0x1030, "id1030", "Intel EtherExpressPro100 ID1030"),
Expand Down
26 changes: 15 additions & 11 deletions src/drivers/net/epic100.c
Expand Up @@ -8,6 +8,7 @@
#include "pci.h"
#include "nic.h"
#include "timer.h"
#include "console.h"
#include "epic100.h"

/* Condensed operations for readability */
Expand Down Expand Up @@ -59,6 +60,9 @@ static int read_eeprom(int location);
static int mii_read(int phy_id, int location);
static void epic100_irq(struct nic *nic, irq_action_t action);

static struct nic_operations epic100_operations;
static struct pci_driver epic100_driver;

static int ioaddr;

static int command;
Expand Down Expand Up @@ -94,16 +98,17 @@ static unsigned char tx_packet[PKT_BUF_SZ * TX_RING_SIZE];
/***********************************************************************/


static int
static int
epic100_probe ( struct dev *dev ) {

struct nic *nic = nic_device ( dev );

struct pci_device *pci = pci_device ( dev );
int i;
unsigned short* ap;
unsigned int phy, phy_idx;

if ( ! find_pci_device ( pci, &epic100_driver ) )
return 0;

if (pci->ioaddr == 0)
return 0;

Expand Down Expand Up @@ -202,14 +207,6 @@ epic100_probe ( struct dev *dev ) {
}

epic100_open();
static struct nic_operations epic100_operations;
static struct nic_operations epic100_operations = {
.connect = dummy_connect,
.poll = epic100_poll,
.transmit = epic100_transmit,
.irq = epic100_irq,
.disable = epic100_disable,
};
nic->nic_op = &epic100_operations;

return 1;
Expand Down Expand Up @@ -509,6 +506,13 @@ mii_read(int phy_id, int location)
return inw(mmdata);
}

static struct nic_operations epic100_operations = {
.connect = dummy_connect,
.poll = epic100_poll,
.transmit = epic100_transmit,
.irq = epic100_irq,
.disable = epic100_disable,
};

static struct pci_id epic100_nics[] = {
PCI_ROM(0x10b8, 0x0005, "epic100", "SMC EtherPowerII"), /* SMC 83c170 EPIC/100 */
Expand Down
46 changes: 24 additions & 22 deletions src/drivers/net/forcedeth.c
Expand Up @@ -918,29 +918,47 @@ static void forcedeth_irq(struct nic *nic __unused, irq_action_t action __unused
}
}

static struct nic_operations forcedeth_operations = {
.connect = dummy_connect,
.poll = forcedeth_poll,
.transmit = forcedeth_transmit,
.irq = forcedeth_irq,
.disable = forcedeth_disable,
};

static struct pci_id forcedeth_nics[] = {
PCI_ROM(0x10de, 0x01C3, "nforce", "nForce Ethernet Controller"),
PCI_ROM(0x10de, 0x0066, "nforce2", "nForce2 Ethernet Controller"),
PCI_ROM(0x10de, 0x00D6, "nforce3", "nForce3 Ethernet Controller"),
};

static struct pci_driver forcedeth_driver =
PCI_DRIVER ( "forcedeth", forcedeth_nics, PCI_NO_CLASS );

/**************************************************************************
PROBE - Look for an adapter, this routine's visible to the outside
***************************************************************************/
#define IORESOURCE_MEM 0x00000200
#define board_found 1
#define valid_link 0
static int forcedeth_probe ( struct dev *dev ) {

struct nic *nic = nic_device ( dev );

struct pci_device *pci = pci_device ( dev );
unsigned long addr;
int sz;
u8 *base;

if ( ! find_pci_device ( pci, &forcedeth_driver ) )
return 0;

if (pci->ioaddr == 0)
return 0;

printf("forcedeth.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->ioaddr = pci->ioaddr & ~3;
nic->ioaddr = pci->ioaddr;

/* point to private storage */
np = &npx;
Expand Down Expand Up @@ -988,7 +1006,7 @@ static int forcedeth_probe ( struct dev *dev ) {
get_random_bytes(&dev->dev_addr[3], 3);
}
#endif
printf("%s: MAC Address %!, ", pci->name, nic->node_addr);
printf("%s: MAC Address %!, ", dev->name, nic->node_addr);

np->tx_flags =
cpu_to_le16(NV_TX_LASTPACKET | NV_TX_LASTPACKET1 |
Expand All @@ -1015,26 +1033,10 @@ static int forcedeth_probe ( struct dev *dev ) {
forcedeth_reset(nic);
// if (board_found && valid_link)
/* point to NIC specific routines */
static struct nic_operations forcedeth_operations;
static struct nic_operations forcedeth_operations = {
.connect = dummy_connect,
.poll = forcedeth_poll,
.transmit = forcedeth_transmit,
.irq = forcedeth_irq,
.disable = forcedeth_disable,
}; nic->nic_op = &forcedeth_operations;
nic->nic_op = &forcedeth_operations;
return 1;
// }
/* else */
}

static struct pci_id forcedeth_nics[] = {
PCI_ROM(0x10de, 0x01C3, "nforce", "nForce Ethernet Controller"),
PCI_ROM(0x10de, 0x0066, "nforce2", "nForce2 Ethernet Controller"),
PCI_ROM(0x10de, 0x00D6, "nforce3", "nForce3 Ethernet Controller"),
};

static struct pci_driver forcedeth_driver =
PCI_DRIVER ( "forcedeth", forcedeth_nics, PCI_NO_CLASS );

BOOT_DRIVER ( "forcedeth", forcedeth_probe );

0 comments on commit f39cc6d

Please sign in to comment.