iPXE
|
Intel 10/100/1000 network card driver. More...
Go to the source code of this file.
Data Structures | |
struct | intel_descriptor |
A packet descriptor. More... | |
union | intel_receive_address |
Receive address. More... | |
struct | intel_ring |
An Intel descriptor ring. More... | |
struct | intel_mailbox |
An Intel virtual function mailbox. More... | |
struct | intel_nic |
An Intel network card. More... | |
Macros | |
#define | INTEL_BAR_SIZE ( 128 * 1024 ) |
Intel BAR size. More... | |
#define | INTEL_DESC_FL_DTYP(dtyp) ( (dtyp) << 4 ) |
Descriptor type. More... | |
#define | INTEL_DESC_FL_DTYP_DATA INTEL_DESC_FL_DTYP ( 0x03 ) |
#define | INTEL_DESC_CMD_DEXT 0x20 |
Descriptor extension. More... | |
#define | INTEL_DESC_CMD_RS 0x08 |
Report status. More... | |
#define | INTEL_DESC_CMD_IFCS 0x02 |
Insert frame checksum (CRC) More... | |
#define | INTEL_DESC_CMD_EOP 0x01 |
End of packet. More... | |
#define | INTEL_DESC_STATUS_DD 0x00000001UL |
Descriptor done. More... | |
#define | INTEL_DESC_STATUS_RXE 0x00000100UL |
Receive error. More... | |
#define | INTEL_DESC_STATUS_PAYLEN(len) ( (len) << 14 ) |
Payload length. More... | |
#define | INTEL_CTRL 0x00000UL |
Device Control Register. More... | |
#define | INTEL_CTRL_LRST 0x00000008UL |
Link reset. More... | |
#define | INTEL_CTRL_ASDE 0x00000020UL |
Auto-speed detection. More... | |
#define | INTEL_CTRL_SLU 0x00000040UL |
Set link up. More... | |
#define | INTEL_CTRL_FRCSPD 0x00000800UL |
Force speed. More... | |
#define | INTEL_CTRL_FRCDPLX 0x00001000UL |
Force duplex. More... | |
#define | INTEL_CTRL_RST 0x04000000UL |
Device reset. More... | |
#define | INTEL_CTRL_PHY_RST 0x80000000UL |
PHY reset. More... | |
#define | INTEL_RESET_DELAY_MS 20 |
Time to delay for device reset, in milliseconds. More... | |
#define | INTEL_STATUS 0x00008UL |
Device Status Register. More... | |
#define | INTEL_STATUS_LU 0x00000002UL |
Link up. More... | |
#define | INTEL_EERD 0x00014UL |
EEPROM Read Register. More... | |
#define | INTEL_EERD_START 0x00000001UL |
Start read. More... | |
#define | INTEL_EERD_DONE_SMALL 0x00000010UL |
Read done (small EERD) More... | |
#define | INTEL_EERD_DONE_LARGE 0x00000002UL |
Read done (large EERD) More... | |
#define | INTEL_EERD_ADDR_SHIFT_SMALL 8 |
Address shift (small) More... | |
#define | INTEL_EERD_ADDR_SHIFT_LARGE 2 |
Address shift (large) More... | |
#define | INTEL_EERD_DATA(value) ( (value) >> 16 ) |
Read data. More... | |
#define | INTEL_EEPROM_MAX_WAIT_MS 100 |
Maximum time to wait for EEPROM read, in milliseconds. More... | |
#define | INTEL_EEPROM_WORD_LEN_LOG2 1 |
EEPROM word length. More... | |
#define | INTEL_EEPROM_MIN_SIZE_WORDS 64 |
Minimum EEPROM size, in words. More... | |
#define | INTEL_EEPROM_MAC 0x00 |
Offset of MAC address within EEPROM. More... | |
#define | INTEL_ICR 0x000c0UL |
Interrupt Cause Read Register. More... | |
#define | INTEL_IRQ_TXDW 0x00000001UL |
Transmit descriptor done. More... | |
#define | INTEL_IRQ_TXQE 0x00000002UL |
Transmit queue empty. More... | |
#define | INTEL_IRQ_LSC 0x00000004UL |
Link status change. More... | |
#define | INTEL_IRQ_RXDMT0 0x00000010UL |
Receive queue low. More... | |
#define | INTEL_IRQ_RXO 0x00000040UL |
Receive overrun. More... | |
#define | INTEL_IRQ_RXT0 0x00000080UL |
Receive timer. More... | |
#define | INTEL_IMS 0x000d0UL |
Interrupt Mask Set/Read Register. More... | |
#define | INTEL_IMC 0x000d8UL |
Interrupt Mask Clear Register. More... | |
#define | INTEL_RCTL 0x00100UL |
Receive Control Register. More... | |
#define | INTEL_RCTL_EN 0x00000002UL |
Receive enable. More... | |
#define | INTEL_RCTL_UPE 0x00000008UL |
Unicast promiscuous mode. More... | |
#define | INTEL_RCTL_MPE 0x00000010UL |
Multicast promiscuous. More... | |
#define | INTEL_RCTL_BAM 0x00008000UL |
Broadcast accept mode. More... | |
#define | INTEL_RCTL_BSIZE_BSEX(bsex, bsize) ( ( (bsize) << 16 ) | ( (bsex) << 25 ) ) |
Buffer size. More... | |
#define | INTEL_RCTL_BSIZE_2048 INTEL_RCTL_BSIZE_BSEX ( 0, 0 ) |
#define | INTEL_RCTL_BSIZE_BSEX_MASK INTEL_RCTL_BSIZE_BSEX ( 1, 3 ) |
#define | INTEL_RCTL_SECRC 0x04000000UL |
Strip CRC. More... | |
#define | INTEL_TCTL 0x00400UL |
Transmit Control Register. More... | |
#define | INTEL_TCTL_EN 0x00000002UL |
Transmit enable. More... | |
#define | INTEL_TCTL_PSP 0x00000008UL |
Pad short packets. More... | |
#define | INTEL_TCTL_CT(x) ( (x) << 4 ) |
Collision threshold. More... | |
#define | INTEL_TCTL_CT_DEFAULT INTEL_TCTL_CT ( 0x0f ) |
#define | INTEL_TCTL_CT_MASK INTEL_TCTL_CT ( 0xff ) |
#define | INTEL_TCTL_COLD(x) ( (x) << 12 ) |
Collision distance. More... | |
#define | INTEL_TCTL_COLD_DEFAULT INTEL_TCTL_COLD ( 0x040 ) |
#define | INTEL_TCTL_COLD_MASK INTEL_TCTL_COLD ( 0x3ff ) |
#define | INTEL_PBA 0x01000UL |
Packet Buffer Allocation. More... | |
#define | INTEL_PBS 0x01008UL |
Packet Buffer Size. More... | |
#define | INTEL_RXPBS 0x02404UL |
Receive packet buffer size. More... | |
#define | INTEL_RXPBS_I210 0x000000a2UL |
I210 power-up default. More... | |
#define | INTEL_RD 0x02800UL |
Receive Descriptor register block. More... | |
#define | INTEL_NUM_RX_DESC 16 |
Number of receive descriptors. More... | |
#define | INTEL_RX_FILL 8 |
Receive descriptor ring fill level. More... | |
#define | INTEL_RX_MAX_LEN 2048 |
Receive buffer length. More... | |
#define | INTEL_TXPBS 0x03404UL |
Transmit packet buffer size. More... | |
#define | INTEL_TXPBS_I210 0x04000014UL |
I210 power-up default. More... | |
#define | INTEL_TD 0x03800UL |
Transmit Descriptor register block. More... | |
#define | INTEL_NUM_TX_DESC 16 |
Number of transmit descriptors. More... | |
#define | INTEL_TX_FILL ( INTEL_NUM_TX_DESC - 1 ) |
Transmit descriptor ring maximum fill level. More... | |
#define | INTEL_xDBAL 0x00 |
Receive/Transmit Descriptor Base Address Low (offset) More... | |
#define | INTEL_xDBAH 0x04 |
Receive/Transmit Descriptor Base Address High (offset) More... | |
#define | INTEL_xDLEN 0x08 |
Receive/Transmit Descriptor Length (offset) More... | |
#define | INTEL_xDH 0x10 |
Receive/Transmit Descriptor Head (offset) More... | |
#define | INTEL_xDT 0x18 |
Receive/Transmit Descriptor Tail (offset) More... | |
#define | INTEL_xDCTL 0x28 |
Receive/Transmit Descriptor Control (offset) More... | |
#define | INTEL_xDCTL_ENABLE 0x02000000UL |
Queue enable. More... | |
#define | INTEL_DISABLE_MAX_WAIT_MS 100 |
Maximum time to wait for queue disable, in milliseconds. More... | |
#define | INTEL_RAL0 0x05400UL |
Receive Address Low. More... | |
#define | INTEL_RAH0 0x05404UL |
Receive Address High. More... | |
#define | INTEL_RAH0_AV 0x80000000UL |
Address valid. More... | |
#define | INTEL_FEXTNVM11 0x05bbcUL |
Future Extended NVM register 11. More... | |
#define | INTEL_FEXTNVM11_WTF 0x00002000UL |
Don't ask. More... | |
#define | INTEL_I219 ( INTEL_NO_PHY_RST | INTEL_RST_HANG ) |
The i219 has a seriously broken reset mechanism. More... | |
Enumerations | |
enum | intel_flags { INTEL_PBS_ERRATA = 0x0001, INTEL_VMWARE = 0x0002, INTEL_NO_PHY_RST = 0x0004, INTEL_NO_ASDE = 0x0008, INTEL_RST_HANG = 0x0010, INTEL_PBSIZE_RST = 0x0020 } |
Driver flags. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static void | intel_init_ring (struct intel_ring *ring, unsigned int count, unsigned int reg, void(*describe)(struct intel_descriptor *desc, physaddr_t addr, size_t len)) |
Initialise descriptor ring. More... | |
static void | intel_init_mbox (struct intel_mailbox *mbox, unsigned int ctrl, unsigned int mem) |
Initialise mailbox. More... | |
static void | intel_diag (struct intel_nic *intel) |
Dump diagnostic information. More... | |
void | intel_describe_tx (struct intel_descriptor *tx, physaddr_t addr, size_t len) |
Populate transmit descriptor. More... | |
void | intel_describe_tx_adv (struct intel_descriptor *tx, physaddr_t addr, size_t len) |
Populate advanced transmit descriptor. More... | |
void | intel_describe_rx (struct intel_descriptor *rx, physaddr_t addr, size_t len) |
Populate receive descriptor. More... | |
void | intel_reset_ring (struct intel_nic *intel, unsigned int reg) |
Reset descriptor ring. More... | |
int | intel_create_ring (struct intel_nic *intel, struct intel_ring *ring) |
Create descriptor ring. More... | |
void | intel_destroy_ring (struct intel_nic *intel, struct intel_ring *ring) |
Destroy descriptor ring. More... | |
void | intel_refill_rx (struct intel_nic *intel) |
Refill receive descriptor ring. More... | |
void | intel_empty_rx (struct intel_nic *intel) |
Discard unused receive I/O buffers. More... | |
int | intel_transmit (struct net_device *netdev, struct io_buffer *iobuf) |
Transmit packet. More... | |
void | intel_poll_tx (struct net_device *netdev) |
Poll for completed packets. More... | |
void | intel_poll_rx (struct net_device *netdev) |
Poll for received packets. More... | |
Intel 10/100/1000 network card driver.
Definition in file intel.h.
#define INTEL_DESC_FL_DTYP | ( | dtyp | ) | ( (dtyp) << 4 ) |
#define INTEL_DESC_FL_DTYP_DATA INTEL_DESC_FL_DTYP ( 0x03 ) |
#define INTEL_RESET_DELAY_MS 20 |
#define INTEL_EERD_DONE_SMALL 0x00000010UL |
#define INTEL_EERD_DONE_LARGE 0x00000002UL |
#define INTEL_EEPROM_MAX_WAIT_MS 100 |
#define INTEL_EEPROM_MIN_SIZE_WORDS 64 |
#define INTEL_EEPROM_MAC 0x00 |
#define INTEL_IRQ_TXDW 0x00000001UL |
#define INTEL_IMS 0x000d0UL |
#define INTEL_RCTL_UPE 0x00000008UL |
#define INTEL_RCTL_BSIZE_BSEX | ( | bsex, | |
bsize | |||
) | ( ( (bsize) << 16 ) | ( (bsex) << 25 ) ) |
#define INTEL_RCTL_BSIZE_2048 INTEL_RCTL_BSIZE_BSEX ( 0, 0 ) |
#define INTEL_RCTL_BSIZE_BSEX_MASK INTEL_RCTL_BSIZE_BSEX ( 1, 3 ) |
#define INTEL_TCTL_CT | ( | x | ) | ( (x) << 4 ) |
#define INTEL_TCTL_CT_DEFAULT INTEL_TCTL_CT ( 0x0f ) |
#define INTEL_TCTL_CT_MASK INTEL_TCTL_CT ( 0xff ) |
#define INTEL_TCTL_COLD | ( | x | ) | ( (x) << 12 ) |
#define INTEL_TCTL_COLD_DEFAULT INTEL_TCTL_COLD ( 0x040 ) |
#define INTEL_TCTL_COLD_MASK INTEL_TCTL_COLD ( 0x3ff ) |
#define INTEL_RXPBS_I210 0x000000a2UL |
#define INTEL_RD 0x02800UL |
#define INTEL_NUM_RX_DESC 16 |
#define INTEL_TXPBS_I210 0x04000014UL |
#define INTEL_TD 0x03800UL |
#define INTEL_NUM_TX_DESC 16 |
#define INTEL_TX_FILL ( INTEL_NUM_TX_DESC - 1 ) |
#define INTEL_xDBAL 0x00 |
#define INTEL_xDBAH 0x04 |
#define INTEL_xDLEN 0x08 |
#define INTEL_xDH 0x10 |
#define INTEL_xDT 0x18 |
#define INTEL_xDCTL 0x28 |
#define INTEL_DISABLE_MAX_WAIT_MS 100 |
#define INTEL_FEXTNVM11 0x05bbcUL |
#define INTEL_I219 ( INTEL_NO_PHY_RST | INTEL_RST_HANG ) |
enum intel_flags |
Driver flags.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
inlinestatic |
Initialise descriptor ring.
ring | Descriptor ring |
count | Number of descriptors |
reg | Descriptor register block |
describe | Method to populate descriptor |
Definition at line 256 of file intel.h.
References count, intel_ring::desc, intel_ring::describe, intel_ring::len, reg, and intel_ring::reg.
Referenced by intel_probe(), intelx_probe(), and intelxvf_probe().
|
inlinestatic |
Initialise mailbox.
mbox | Mailbox |
ctrl | Mailbox control register |
mem | Mailbox memory register base |
Definition at line 281 of file intel.h.
References ctrl.
Referenced by intelxvf_probe().
|
inlinestatic |
void intel_describe_tx | ( | struct intel_descriptor * | tx, |
physaddr_t | addr, | ||
size_t | len | ||
) |
Populate transmit descriptor.
tx | Transmit descriptor |
addr | Data buffer address |
len | Length of data |
Definition at line 395 of file intel.c.
References addr, cpu_to_le16, cpu_to_le64, INTEL_DESC_CMD_EOP, INTEL_DESC_CMD_IFCS, INTEL_DESC_CMD_RS, len, and tx.
Referenced by intel_probe(), and intelx_probe().
void intel_describe_tx_adv | ( | struct intel_descriptor * | tx, |
physaddr_t | addr, | ||
size_t | len | ||
) |
Populate advanced transmit descriptor.
tx | Transmit descriptor |
addr | Data buffer address |
len | Length of data |
Definition at line 414 of file intel.c.
References addr, cpu_to_le16, cpu_to_le32, cpu_to_le64, INTEL_DESC_CMD_DEXT, INTEL_DESC_CMD_EOP, INTEL_DESC_CMD_IFCS, INTEL_DESC_CMD_RS, INTEL_DESC_FL_DTYP_DATA, INTEL_DESC_STATUS_PAYLEN, len, and tx.
Referenced by intelxvf_probe().
void intel_describe_rx | ( | struct intel_descriptor * | rx, |
physaddr_t | addr, | ||
size_t len | __unused | ||
) |
Populate receive descriptor.
rx | Receive descriptor |
addr | Data buffer address |
len | Length of data |
Definition at line 433 of file intel.c.
References addr, cpu_to_le64, and rx.
Referenced by intel_probe(), intelx_probe(), and intelxvf_probe().
void intel_reset_ring | ( | struct intel_nic * | intel, |
unsigned int | reg | ||
) |
Reset descriptor ring.
intel | Intel device |
reg | Register block |
rc | Return status code |
Definition at line 487 of file intel.c.
References intel_disable_ring(), INTEL_xDBAH, INTEL_xDBAL, INTEL_xDH, INTEL_xDLEN, INTEL_xDT, reg, intel_nic::regs, and writel().
Referenced by intel_destroy_ring(), and intelxvf_open().
int intel_create_ring | ( | struct intel_nic * | intel, |
struct intel_ring * | ring | ||
) |
Create descriptor ring.
intel | Intel device |
ring | Descriptor ring |
rc | Return status code |
Definition at line 511 of file intel.c.
References address, DBGC, intel_ring::desc, intel_nic::dma, dma(), dma_alloc(), ENOMEM, INTEL_xDBAH, INTEL_xDBAL, INTEL_xDCTL, INTEL_xDCTL_ENABLE, INTEL_xDH, INTEL_xDLEN, INTEL_xDT, intel_ring::len, intel_ring::map, memset(), readl(), intel_ring::reg, intel_nic::regs, virt_to_phys(), and writel().
Referenced by intel_open(), intelx_open(), and intelxvf_open().
void intel_destroy_ring | ( | struct intel_nic * | intel, |
struct intel_ring * | ring | ||
) |
Destroy descriptor ring.
intel | Intel device |
ring | Descriptor ring |
Definition at line 563 of file intel.c.
References intel_ring::cons, intel_ring::desc, dma_free(), intel_reset_ring(), intel_ring::len, intel_ring::map, NULL, intel_ring::prod, and intel_ring::reg.
Referenced by intel_close(), intel_open(), intelx_close(), intelx_open(), intelxvf_close(), and intelxvf_open().
void intel_refill_rx | ( | struct intel_nic * | intel | ) |
Refill receive descriptor ring.
intel | Intel device |
Definition at line 580 of file intel.c.
References alloc_rx_iob(), assert(), intel_ring::cons, io_buffer::data, DBGC2, intel_ring::desc, intel_ring::describe, intel_nic::dma, INTEL_NUM_RX_DESC, INTEL_RX_FILL, INTEL_RX_MAX_LEN, INTEL_xDT, iob_dma(), NULL, intel_ring::prod, profile_exclude(), profile_start(), profile_stop(), intel_ring::reg, intel_nic::regs, rx, intel_nic::rx, intel_nic::rx_iobuf, virt_to_phys(), wmb(), and writel().
Referenced by intel_open(), intel_poll(), intelx_open(), intelx_poll(), intelxvf_open(), and intelxvf_poll().
void intel_empty_rx | ( | struct intel_nic * | intel | ) |
Discard unused receive I/O buffers.
intel | Intel device |
Definition at line 630 of file intel.c.
References free_rx_iob(), INTEL_NUM_RX_DESC, NULL, and intel_nic::rx_iobuf.
Referenced by intel_close(), intelx_close(), and intelxvf_close().
int intel_transmit | ( | struct net_device * | netdev, |
struct io_buffer * | iobuf | ||
) |
Transmit packet.
netdev | Network device |
iobuf | I/O buffer |
rc | Return status code |
Definition at line 752 of file intel.c.
References intel_ring::cons, io_buffer::data, DBGC, DBGC2, intel_ring::desc, intel_ring::describe, ENOBUFS, INTEL_NUM_TX_DESC, INTEL_TX_FILL, INTEL_xDT, iob_dma(), iob_len(), len, netdev, net_device::priv, intel_ring::prod, profile_exclude(), profile_start(), profile_stop(), intel_ring::reg, intel_nic::regs, tx, intel_nic::tx, virt_to_phys(), wmb(), and writel().
void intel_poll_tx | ( | struct net_device * | netdev | ) |
Poll for completed packets.
netdev | Network device |
Definition at line 791 of file intel.c.
References intel_ring::cons, cpu_to_le32, DBGC2, intel_ring::desc, INTEL_DESC_STATUS_DD, INTEL_NUM_TX_DESC, netdev, netdev_tx_complete_next(), net_device::priv, intel_ring::prod, tx, and intel_nic::tx.
Referenced by intel_poll(), intelx_poll(), and intelxvf_poll().
void intel_poll_rx | ( | struct net_device * | netdev | ) |
Poll for received packets.
netdev | Network device |
Definition at line 820 of file intel.c.
References intel_ring::cons, cpu_to_le32, DBGC, DBGC2, intel_ring::desc, EIO, INTEL_DESC_STATUS_DD, INTEL_DESC_STATUS_RXE, INTEL_NUM_RX_DESC, iob_put, le16_to_cpu, le32_to_cpu, len, netdev, netdev_rx(), netdev_rx_err(), NULL, net_device::priv, intel_ring::prod, rx, intel_nic::rx, and intel_nic::rx_iobuf.
Referenced by intel_poll(), intelx_poll(), and intelxvf_poll().