2
0
mirror of https://github.com/xcat2/xNBA.git synced 2024-12-14 07:11:32 +00:00

Finished by hand

This commit is contained in:
Michael Brown 2005-04-13 01:31:44 +00:00
parent f16ac2d87e
commit f39cc6d978
5 changed files with 101 additions and 91 deletions

View File

@ -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];
@ -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;
@ -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"),

View File

@ -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;
@ -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;
@ -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;
@ -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;
}
@ -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"),

View File

@ -8,6 +8,7 @@
#include "pci.h"
#include "nic.h"
#include "timer.h"
#include "console.h"
#include "epic100.h"
/* Condensed operations for readability */
@ -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;
@ -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;
@ -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;
@ -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 */

View File

@ -918,6 +918,23 @@ 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
***************************************************************************/
@ -925,22 +942,23 @@ 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;
@ -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 |
@ -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 );

View File

@ -153,6 +153,7 @@ enum chip_capability_flags {
HAS_CHIP_XCVR,
};
#if 0 /* not used */
static
struct chip_info
{
@ -165,6 +166,7 @@ mtd80x_chips[] = {
{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 {
@ -437,7 +439,6 @@ struct mtd_private
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 *);
@ -445,7 +446,7 @@ 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;
@ -534,7 +535,7 @@ static void mtd_reset(struct nic *nic)
/**************************************************************************
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;
@ -654,34 +655,46 @@ static void mtd_disable ( struct nic *nic ) {
/* 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;
mtdx.ioaddr = pci->ioaddr;
adjust_pci_device(pci);
mtdx.nic_name = pci->name;
mtdx.nic_name = dev->name;
mtdx.dev_id = pci->dev_id;
/* read ethernet id */
@ -763,26 +776,13 @@ static int mtd_probe ( struct dev *dev ) {
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;
@ -884,7 +884,7 @@ static u32 m80x_send_cmd_to_phy(long miiport, int opcode, int phyad, int regad)
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;
@ -922,7 +922,9 @@ static int mdio_read(struct nic *nic, int phyad, int regad)
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;
@ -954,6 +956,7 @@ static void mdio_write(struct nic *nic, int phyad, int regad, int data)
return;
}
#endif
static void getlinkstatus(struct nic *nic)
/* function: Routine will read MII Status Register to get link status. */
@ -1091,8 +1094,4 @@ static void getlinktype(struct nic *dev)
}
}
static struct pci_driver mtd80x_driver =
PCI_DRIVER ( "MTD80X", mtd80x_nics, PCI_NO_CLASS );
BOOT_DRIVER ( "MTD80X", mtd_probe );