* Indented with unix 'indent' command: * a3c90x_internal_IssueCommand: sends a command to the 3c90x card * and waits for it's completion * @v ioaddr IOAddress of the NIC * @v cmd Command to be issued * @v param Command parameter DBGP(
"a3c90x_internal_IssueCommand\n");
/* Send the cmd to the cmd register */ /* Wait for the cmd to complete */ DBG2(
"Command 0x%04X finished in time. cnt = %d.\n",
cmd,
cnt);
DBG(
"Command 0x%04X DID NOT finish in time. cnt = %d.\n",
cmd,
cnt);
* a3c90x_internal_SetWindow: selects a register window set. * @v inf_3c90x private NIC data * @v window window to be selected DBGP(
"a3c90x_internal_SetWindow\n");
/* Window already as set? */ /* Issue the window command. */ DBGP(
"a3c90x_internal_WaitForEeprom\n");
DBG(
"Read from eeprom failed: timeout\n");
* a3c90x_internal_ReadEeprom - nvs routine to read eeprom data * We only support reading one word(2 byte). The nvs subsystem will make sure * that the routine will never be called with len != 2. * @v address eeprom address to read data from. * @v data data is put here. * @v len number of bytes to read. unsigned short *
dest = (
unsigned short *)
data;
DBGP(
"a3c90x_internal_ReadEeprom\n");
/* we support reading 2 bytes only */ /* Select correct window */ /* set eepromRead bits in command sent to NIC */ /* send address to NIC */ * a3c90x_internal_WriteEeprom - nvs routine to write eeprom data * currently not implemented * @v address eeprom address to read data from. * @v data data is put here. * @v len number of bytes to read. DBGP(
"a3c90x_internal_ReadEepromContents\n");
* a3c90x_reset: exported function that resets the card to its default * state. This is so the Linux driver can re-set the card up the way * it wants to. If CFG_3C90X_PRESERVE_XCVR is defined, then the reset will * not alter the selected transceiver that we used to download the boot * @v inf_3c90x Private NIC data /* Send the reset command to the card */ DBG2(
"3c90x: Issuing RESET\n");
/* reset of the receiver on B-revision cards re-negotiates the link * takes several seconds (a computer eternity), so we don't reset /* global reset command resets station mask, non-B revision cards * require explicit reset of values /* enable rxComplete and txComplete indications */ /* acknowledge any pending status flags */ * a3c90x_setup_tx_ring - Allocates TX ring, initialize tx_desc values * @ret Returns 0 on success, negative on failure DBGP(
"a3c90x_setup_tx_ring\n");
DBG(
"Could not allocate TX-ring\n");
* a3c90x_process_tx_packets - Checks for successfully sent packets, * reports them to iPXE with netdev_tx_complete(); * @v netdev Network device info DBGP(
"a3c90x_process_tx_packets\n");
/* NIC is currently working on this tx desc */ DBG2(
"transmitted packet\n");
DBGP(
"a3c90x_free_tx_ring\n");
/* io_buffers are free()ed by netdev_tx_complete[,_err]() */ * a3c90x_transmit - Transmits a packet. * @v netdev Network device info * @v iob io_buffer containing the data to be send * @ret Returns 0 on success, negative on failure DBGP(
"a3c90x_transmit\n");
DBG(
"TX-Ring overflow\n");
/* Setup the DPD (download descriptor) */ /* FrameStartHeader differs in 90x and >= 90xB * It contains length in 90x and a round up boundary and packet ID for * 90xB and 90xC. We can leave this to 0 for 90xB and 90xC. /* We have to stall the download engine, so the NIC won't access the * tx descriptor while we modify it. There is a way around this * from revision B and upwards. To stay compatible with older revisions /* currently no DownList, sending a new one */ * a3c90x_prepare_rx_desc - fills the rx desc with initial data * @v index Index for rx_iobuf and rx_ring array DBGP(
"a3c90x_prepare_rx_desc\n");
/* We have to stall the upload engine, so the NIC won't access the * rx descriptor while we modify it. There is a way around this * from revision B and upwards. To stay compatible with older revisions /* unstall upload engine */ * a3c90x_refill_rx_ring -checks every entry in the rx ring and reallocates * them as necessary. Then it calls a3c90x_prepare_rx_desc to fill the rx desc DBGP(
"a3c90x_refill_rx_ring\n");
/* only refill used descriptor */ /* we still need to process this descriptor */ DBG(
"alloc_iob() failed\n");
* a3c90x_setup_rx_ring - Allocates RX ring, initialize rx_desc values * @ret Returns 0 on success, negative on failure DBGP(
"a3c90x_setup_rx_ring\n");
DBG(
"Could not allocate RX-ring\n");
/* these are needed so refill_rx_ring initializes the ring */ DBGP(
"a3c90x_free_rx_ring\n");
DBGP(
"a3c90x_free_rx_iobuf\n");
* a3c90x_process_rx_packets - Checks for received packets, * reports them to iPXE with netdev_rx() or netdev_rx_err() if there was an * error while receiving the packet * @v netdev Network device info DBGP(
"a3c90x_process_rx_packets\n");
/* if we're here, we've got good packet */ DBG2(
"received packet\n");
* a3c90x_poll - Routine that gets called periodically. * Here we hanle transmitted and received packets. * We could also check the link status from time to time, which we * @v netdev Network device info DBGP(
"a3c90x_free_resources\n");
* a3c90x_remove - Routine to remove the card. Unregisters * the NIC from iPXE, disables RX/TX and resets the card. /* Disable the receiver and transmitter. */ * a3c90x_hw_start - Initialize hardware, copy MAC address * to NIC registers, set default receiver DBGP(
"a3c90x_hw_start\n");
/* 3C556: Invert MII power */ /* Copy MAC address into the NIC registers */ /* Read the media options register, print a message and set default * Uses Media Option command on B revision, Reset Option on non-B * revision cards -- same register address /* mask out VCO bit that is defined as 10baseFL bit on B-rev cards */ DBG2(
"Connectors present: ");
DBG2(
"%s100Base-T4", (c++) ?
", " :
"");
DBG2(
"%s100Base-FX", (c++) ?
", " :
"");
DBG2(
"%s10Base-2", (c++) ?
", " :
"");
DBG2(
"%sAUI", (c++) ?
", " :
"");
DBG2(
"%sMII", (c++) ?
", " :
"");
if ((
mopt &
0xA) ==
0xA) {
DBG2(
"%s10Base-T / 100Base-TX", (c++) ?
", " :
"");
}
else if ((
mopt &
0xA) ==
0x2) {
DBG2(
"%s100Base-TX", (c++) ?
", " :
"");
}
else if ((
mopt &
0xA) ==
0x8) {
DBG2(
"%s10Base-T", (c++) ?
", " :
"");
/* Determine transceiver type to use, depending on value stored in /* I don't know what MII MAC only mode is!!! */ DBG(
"WARNING: MII External MAC Mode only supported on B-revision " "cards!!!!\nFalling Back to MII Mode\n");
/* enable DC converter for 10-Base-T */ /* Set the link to the type we just determined. */ DBG2(
"Setting internal cfg register: 0x%08X (linktype: 0x%02X)\n",
/* Now that we set the xcvr type, reset the Tx and Rx */ /* Set the RX filter = receive only individual pkts & multicast & bcast. */ * set Indication and Interrupt flags , acknowledge any IRQ's * a3c90x_open - Routine to initialize the card. Initialize hardware, * allocate TX and RX ring, send RX ring address to the NIC. * @v netdev Network device info * @ret Returns 0 on success, negative on failure DBG(
"Error setting up TX Ring\n");
DBG(
"Error setting up RX Ring\n");
/* send rx_ring address to NIC */ /* enable packet transmission and reception */ * a3c90x_close - free()s TX and RX ring, disablex RX/TX, resets NIC * @v netdev Network device info * a3c90x_probe: exported routine to probe for the 3c905 card. * If this routine is called, the pci functions did find the * card. We read the eeprom here and get the MAC address. * Initialization is done in a3c90x_open(). * @ pci_id PCI device IDs * @ret rc Returns 0 on success, negative on failure case 0x9000:
/* 10 Base TPO */ case 0x9001:
/* 10/100 T4 */ case 0x9050:
/* 10/100 TPO */ case 0x9051:
/* 10 Base Combo */ DBG2(
"[3c90x]: found NIC(0x%04X, 0x%04X), isBrev=%d, is3c556=%d\n",
/* initialize nvs device */ /* reset NIC before accessing any data from it */ /* load eeprom contents to inf_3c90x->eeprom */ /* Retrieve the Hardware address */ DBG(
"3c90x: register_netdev() failed\n");
/* we don't handle linkstates yet, so we're always up */ /* Original 90x revisions: */ PCI_ROM(
0x10b7,
0x6055,
"3c556",
"3C556", 0),
/* Huricane */ PCI_ROM(
0x10b7,
0x9000,
"3c905-tpo",
"3Com900-TPO", 0),
/* 10 Base TPO */ PCI_ROM(
0x10b7,
0x9001,
"3c905-t4",
"3Com900-Combo", 0),
/* 10/100 T4 */ PCI_ROM(
0x10b7,
0x9050,
"3c905-tpo100",
"3Com905-TX", 0),
/* 100 Base TX / 10/100 TPO */ PCI_ROM(
0x10b7,
0x9051,
"3c905-combo",
"3Com905-T4", 0),
/* 100 Base T4 / 10 Base Combo */ /* Newer 90xB revisions: */ PCI_ROM(
0x10b7,
0x9004,
"3c905b-tpo",
"3Com900B-TPO", 0),
/* 10 Base TPO */ PCI_ROM(
0x10b7,
0x9005,
"3c905b-combo",
"3Com900B-Combo", 0),
/* 10 Base Combo */ PCI_ROM(
0x10b7,
0x9006,
"3c905b-tpb2",
"3Com900B-2/T", 0),
/* 10 Base TP and Base2 */ PCI_ROM(
0x10b7,
0x900a,
"3c905b-fl",
"3Com900B-FL", 0),
/* 10 Base FL */ PCI_ROM(
0x10b7,
0x9055,
"3c905b-tpo100",
"3Com905B-TX", 0),
/* 10/100 TPO */ PCI_ROM(
0x10b7,
0x9056,
"3c905b-t4",
"3Com905B-T4", 0),
/* 10/100 T4 */ PCI_ROM(
0x10b7,
0x9058,
"3c905b-9058",
"3Com905B-9058", 0),
/* Cyclone 10/100/BNC */ PCI_ROM(
0x10b7,
0x905a,
"3c905b-fx",
"3Com905B-FL", 0),
/* 100 Base FX / 10 Base FX */ /* Newer 90xC revision: */ PCI_ROM(
0x10b7,
0x9200,
"3c905c-tpo",
"3Com905C-TXM", 0),
/* 10/100 TPO (3C905C-TXM) */ PCI_ROM(
0x10b7,
0x9202,
"3c920b-emb-ati",
"3c920B-EMB-WNM (ATI Radeon 9100 IGP)", 0),
/* 3c920B-EMB-WNM (ATI Radeon 9100 IGP) */ PCI_ROM(
0x10b7,
0x9210,
"3c920b-emb-wnm",
"3Com20B-EMB WNM", 0),
PCI_ROM(
0x10b7,
0x9800,
"3c980",
"3Com980-Cyclone", 0),
/* Cyclone */ PCI_ROM(
0x10b7,
0x9805,
"3c9805",
"3Com9805", 0),
/* Dual Port Server Cyclone */ PCI_ROM(
0x10b7,
0x7646,
"3csoho100-tx",
"3CSOHO100-TX", 0),
/* Hurricane */ PCI_ROM(
0x10b7,
0x4500,
"3c450",
"3Com450 HomePNA Tornado", 0),
PCI_ROM(
0x10b7,
0x1201,
"3c982a",
"3Com982A", 0),
PCI_ROM(
0x10b7,
0x1202,
"3c982b",
"3Com982B", 0),