#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];
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;
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"),
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;
*/
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;
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;
*/
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;
}
}
#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"),
#include "pci.h"
#include "nic.h"
#include "timer.h"
+#include "console.h"
#include "epic100.h"
/* Condensed operations for readability */
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;
/***********************************************************************/
- 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;
}
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;
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 */
}
}
+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 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;
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 |
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 );
HAS_CHIP_XCVR,
};
+#if 0 /* not used */
static
struct chip_info
{
{0x0891, HAS_MII_XCVR}
};
static int chip_cnt = sizeof( mtd80x_chips ) / sizeof( struct chip_info );
+#endif
/* Offsets to the Command and Status Registers. */
enum mtd_offsets {
static struct mtd_private mtdx;
static int mdio_read(struct nic * , int phy_id, int location);
-static void mdio_write(struct nic * , int phy_id, int location, int value);
static void getlinktype(struct nic * );
static void getlinkstatus(struct nic * );
static void set_rx_mode(struct nic *);
/**************************************************************************
* init_ring - setup the tx and rx descriptors
*************************************************************************/
-static void init_ring(struct nic *nic)
+static void init_ring(struct nic *nic __unused)
{
int i;
/**************************************************************************
POLL - Wait for a frame
***************************************************************************/
-static int mtd_poll(struct nic *nic)
+static int mtd_poll(struct nic *nic, int retrieve)
{
s32 rx_status = mtdx.cur_rx->status;
int retval = 0;
/* Disable Tx Rx*/
outl( mtdx.crvalue & (~TxEnable) & (~RxEnable), mtdx.ioaddr + TCRRCR);
/* Reset the chip to erase previous misconfiguration. */
- mtd_reset((struct nic *) dev);
+ mtd_reset(nic);
DBGPRNT(("DISABLE\n"));
}
+static struct nic_operations mtd_operations = {
+ .connect = dummy_connect,
+ .poll = mtd_poll,
+ .transmit = mtd_transmit,
+ .irq = dummy_irq,
+ .disable = mtd_disable,
+};
+
+static struct pci_id mtd80x_nics[] = {
+ PCI_ROM(0x1516, 0x0800, "MTD800", "Myson MTD800"),
+ PCI_ROM(0x1516, 0x0803, "MTD803", "Surecom EP-320X"),
+ PCI_ROM(0x1516, 0x0891, "MTD891", "Myson MTD891"),
+};
+
+static struct pci_driver mtd80x_driver =
+ PCI_DRIVER ( "MTD80X", mtd80x_nics, PCI_NO_CLASS );
+
/**************************************************************************
PROBE - Look for an adapter, this routine's visible to the outside
***************************************************************************/
static int mtd_probe ( struct dev *dev ) {
-
struct nic *nic = nic_device ( dev );
-
struct pci_device *pci = pci_device ( dev );
int i;
- if (pci->ioaddr == 0)
- {
- return 0;
- }
+ if ( ! find_pci_device ( pci, &mtd80x_driver ) )
+ return 0;
- printf(" - ");
+ if (pci->ioaddr == 0)
+ return 0;
/* Mask the bit that says "this is an io addr" */
- mtdx.ioaddr = pci->ioaddr & ~3;
-
- adjust_pci_device(pci);
+ mtdx.ioaddr = pci->ioaddr;
- mtdx.nic_name = pci->name;
+ mtdx.nic_name = dev->name;
mtdx.dev_id = pci->dev_id;
/* read ethernet id */
mtd_reset( nic );
/* point to NIC specific routines */
-static struct nic_operations mtd_operations;
-static struct nic_operations mtd_operations = {
- .connect = dummy_connect,
- .poll = mtd_poll,
- .transmit = mtd_transmit,
- .irq = dummy_irq,
- .disable = mtd_disable,
-}; nic->nic_op = &mtd_operations;
+ nic->nic_op = &mtd_operations;
return 1;
}
-static struct pci_id mtd80x_nics[] =
- {
- PCI_ROM(0x1516, 0x0800, "MTD800", "Myson MTD800"),
- PCI_ROM(0x1516, 0x0803, "MTD803", "Surecom EP-320X"),
- PCI_ROM(0x1516, 0x0891, "MTD891", "Myson MTD891"),
- };
/**************************************************************************/
-static void set_rx_mode(struct nic *nic)
+static void set_rx_mode(struct nic *nic __unused)
{
u32 mc_filter[2]; /* Multicast hash filter */
u32 rx_mode;
return miir;
}
-static int mdio_read(struct nic *nic, int phyad, int regad)
+static int mdio_read(struct nic *nic __unused, int phyad, int regad)
{
long miiport = mtdx.ioaddr + MANAGEMENT;
u32 miir;
return data & 0xffff;
}
-static void mdio_write(struct nic *nic, int phyad, int regad, int data)
+#if 0 /* not used */
+static void mdio_write(struct nic *nic __unused, int phyad, int regad,
+ int data)
{
long miiport = mtdx.ioaddr + MANAGEMENT;
u32 miir;
return;
}
+#endif
static void getlinkstatus(struct nic *nic)
/* function: Routine will read MII Status Register to get link status. */
}
}
-
-static struct pci_driver mtd80x_driver =
- PCI_DRIVER ( "MTD80X", mtd80x_nics, PCI_NO_CLASS );
-
BOOT_DRIVER ( "MTD80X", mtd_probe );