|
iPXE
|
Cadence Gigabit Ethernet MAC (GEM) network driver. More...
Go to the source code of this file.
Data Structures | |
| struct | cgem_descriptor |
| A Cadence GEM descriptor. More... | |
| union | cgem_mac |
| A Cadence GEM MAC address. More... | |
| struct | cgem_ring |
| A Cadence GEM descriptor ring. More... | |
| struct | cgem_nic |
| A Cadence GEM network card. More... | |
Macros | |
| #define | CGEM_REG_IDX 0 |
| I/O region index. | |
| #define | CGEM_REG_LEN 0x800 |
| I/O region length. | |
| #define | CGEM_NWCTRL 0x000 |
| Network control register. | |
| #define | CGEM_NWCTRL_STARTTX 0x00000200 |
| Start transmission. | |
| #define | CGEM_NWCTRL_STATCLR 0x00000020 |
| Clear statistics. | |
| #define | CGEM_NWCTRL_MDEN 0x00000010 |
| MII interface enable. | |
| #define | CGEM_NWCTRL_TXEN 0x00000008 |
| Transmit enable. | |
| #define | CGEM_NWCTRL_RXEN 0x00000004 |
| Receive enable. | |
| #define | CGEM_NWCTRL_NORMAL ( CGEM_NWCTRL_MDEN | CGEM_NWCTRL_TXEN | CGEM_NWCTRL_RXEN ) |
| Normal value for network control register while up and running. | |
| #define | CGEM_NWCFG 0x004 |
| Network configuration register. | |
| #define | CGEM_NWSR 0x008 |
| Network status register. | |
| #define | CGEM_NWSR_MII_IDLE 0x00000004 |
| MII interface is idle. | |
| #define | CGEM_DMACR 0x010 |
| DMA configuration register. | |
| #define | CGEM_DMACR_RXBUF(x) |
| RX buffer size. | |
| #define | CGEM_DMACR_TXSIZE(x) |
| TX memory size. | |
| #define | CGEM_DMACR_TXSIZE_MAX CGEM_DMACR_TXSIZE ( 0x1 ) |
| Max TX memory size. | |
| #define | CGEM_DMACR_RXSIZE(x) |
| RX memory size. | |
| #define | CGEM_DMACR_RXSIZE_MAX CGEM_DMACR_RXSIZE ( 0x3 ) |
| Max RX memory size. | |
| #define | CGEM_DMACR_BLENGTH(x) |
| DMA burst length. | |
| #define | CGEM_DMACR_BLENGTH_MAX CGEM_DMACR_BLENGTH ( 0x10 ) |
| Max DMA burst length. | |
| #define | CGEM_RXQBASE 0x018 |
| RX queue base address register. | |
| #define | CGEM_TXQBASE 0x01c |
| TX queue base address register. | |
| #define | CGEM_IDR 0x02c |
| Interrupt disable register. | |
| #define | CGEM_IDR_ALL 0xffffffff |
| Disable all interrupts. | |
| #define | CGEM_PHYMNTNC 0x034 |
| PHY maintenance register. | |
| #define | CGEM_PHYMNTNC_CLAUSE22 0x40000000 |
| Clause 22 operation. | |
| #define | CGEM_PHYMNTNC_OP_WRITE 0x10000000 |
| Write to PHY register. | |
| #define | CGEM_PHYMNTNC_OP_READ 0x20000000 |
| Read from PHY register. | |
| #define | CGEM_PHYMNTNC_ADDR(x) |
| PHY address. | |
| #define | CGEM_PHYMNTNC_REG(x) |
| Register address. | |
| #define | CGEM_PHYMNTNC_FIXED 0x00020000 |
| Fixed value to write. | |
| #define | CGEM_PHYMNTNC_DATA_MASK 0x0000ffff |
| Data mask. | |
| #define | CGEM_MII_MAX_WAIT_US 500 |
| Maximum time to wait for PHY access, in microseconds. | |
| #define | CGEM_LINK_INTERVAL ( 2 * TICKS_PER_SEC ) |
| Link state check interval. | |
| #define | CGEM_LADDRL 0x088 |
| Local MAC address (low half) register. | |
| #define | CGEM_LADDRH 0x08c |
| Local MAC address (high half) register. | |
| #define | CGEM_TX_FL_OWNED 0x80000000 |
| Transmit flags. | |
| #define | CGEM_TX_FL_WRAP 0x40000000 |
| End of descriptor ring. | |
| #define | CGEM_TX_FL_LAST 0x00008000 |
| Last buffer in frame. | |
| #define | CGEM_NUM_TX_DESC 8 |
| Transmit ring length. | |
| #define | CGEM_RX_ADDR_OWNED 0x00000001 |
| Receive flags (in buffer address) | |
| #define | CGEM_RX_ADDR_WRAP 0x00000002 |
| End of descriptor ring. | |
| #define | CGEM_RX_FL_LEN(x) |
| Receive flags. | |
| #define | CGEM_NUM_RX_DESC 8 |
| Receive ring length. | |
| #define | CGEM_RX_LEN 1536 |
| Length of receive buffers. | |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| static void | cgem_init_ring (struct cgem_ring *ring, unsigned int count, unsigned int qbase) |
| Initialise descriptor ring. | |
Cadence Gigabit Ethernet MAC (GEM) network driver.
Definition in file cgem.h.
| #define CGEM_REG_IDX 0 |
| #define CGEM_REG_LEN 0x800 |
| #define CGEM_NWCTRL 0x000 |
Network control register.
Definition at line 24 of file cgem.h.
Referenced by cgem_open(), cgem_reset(), and cgem_transmit().
| #define CGEM_NWCTRL_STARTTX 0x00000200 |
| #define CGEM_NWCTRL_STATCLR 0x00000020 |
| #define CGEM_NWCTRL_MDEN 0x00000010 |
| #define CGEM_NWCTRL_NORMAL ( CGEM_NWCTRL_MDEN | CGEM_NWCTRL_TXEN | CGEM_NWCTRL_RXEN ) |
Normal value for network control register while up and running.
Definition at line 32 of file cgem.h.
Referenced by cgem_open(), and cgem_transmit().
| #define CGEM_NWSR 0x008 |
| #define CGEM_NWSR_MII_IDLE 0x00000004 |
| #define CGEM_DMACR 0x010 |
| #define CGEM_DMACR_RXBUF | ( | x | ) |
RX buffer size.
Definition at line 44 of file cgem.h.
Referenced by cgem_reset().
| #define CGEM_DMACR_TXSIZE | ( | x | ) |
| #define CGEM_DMACR_TXSIZE_MAX CGEM_DMACR_TXSIZE ( 0x1 ) |
Max TX memory size.
Definition at line 46 of file cgem.h.
Referenced by cgem_reset().
| #define CGEM_DMACR_RXSIZE | ( | x | ) |
| #define CGEM_DMACR_RXSIZE_MAX CGEM_DMACR_RXSIZE ( 0x3 ) |
Max RX memory size.
Definition at line 49 of file cgem.h.
Referenced by cgem_reset().
| #define CGEM_DMACR_BLENGTH | ( | x | ) |
| #define CGEM_DMACR_BLENGTH_MAX CGEM_DMACR_BLENGTH ( 0x10 ) |
Max DMA burst length.
Definition at line 52 of file cgem.h.
Referenced by cgem_reset().
| #define CGEM_RXQBASE 0x018 |
RX queue base address register.
Definition at line 56 of file cgem.h.
Referenced by cgem_probe(), and cgem_reset().
| #define CGEM_TXQBASE 0x01c |
TX queue base address register.
Definition at line 59 of file cgem.h.
Referenced by cgem_probe(), and cgem_reset().
| #define CGEM_IDR 0x02c |
| #define CGEM_IDR_ALL 0xffffffff |
| #define CGEM_PHYMNTNC 0x034 |
PHY maintenance register.
Definition at line 66 of file cgem.h.
Referenced by cgem_mii_read(), and cgem_mii_write().
| #define CGEM_PHYMNTNC_CLAUSE22 0x40000000 |
Clause 22 operation.
Definition at line 67 of file cgem.h.
Referenced by cgem_mii_read(), and cgem_mii_write().
| #define CGEM_PHYMNTNC_OP_WRITE 0x10000000 |
| #define CGEM_PHYMNTNC_OP_READ 0x20000000 |
Read from PHY register.
Definition at line 69 of file cgem.h.
Referenced by cgem_mii_read(), and cgem_mii_write().
| #define CGEM_PHYMNTNC_ADDR | ( | x | ) |
PHY address.
Definition at line 70 of file cgem.h.
Referenced by cgem_mii_read(), and cgem_mii_write().
| #define CGEM_PHYMNTNC_REG | ( | x | ) |
Register address.
Definition at line 71 of file cgem.h.
Referenced by cgem_mii_read(), and cgem_mii_write().
| #define CGEM_PHYMNTNC_FIXED 0x00020000 |
Fixed value to write.
Definition at line 72 of file cgem.h.
Referenced by cgem_mii_read(), and cgem_mii_write().
| #define CGEM_PHYMNTNC_DATA_MASK 0x0000ffff |
| #define CGEM_MII_MAX_WAIT_US 500 |
Maximum time to wait for PHY access, in microseconds.
Definition at line 76 of file cgem.h.
Referenced by cgem_mii_wait().
| #define CGEM_LINK_INTERVAL ( 2 * TICKS_PER_SEC ) |
Link state check interval.
Definition at line 79 of file cgem.h.
Referenced by cgem_expired(), and cgem_open().
| #define CGEM_LADDRL 0x088 |
Local MAC address (low half) register.
Definition at line 82 of file cgem.h.
Referenced by cgem_open(), and cgem_probe().
| #define CGEM_LADDRH 0x08c |
Local MAC address (high half) register.
Definition at line 85 of file cgem.h.
Referenced by cgem_open(), and cgem_probe().
| #define CGEM_TX_FL_OWNED 0x80000000 |
Transmit flags.
Owned by software
Definition at line 96 of file cgem.h.
Referenced by cgem_create_ring(), and cgem_poll_tx().
| #define CGEM_TX_FL_WRAP 0x40000000 |
End of descriptor ring.
Definition at line 97 of file cgem.h.
Referenced by cgem_create_ring(), and cgem_transmit().
| #define CGEM_TX_FL_LAST 0x00008000 |
| #define CGEM_NUM_TX_DESC 8 |
Transmit ring length.
Definition at line 101 of file cgem.h.
Referenced by cgem_poll_tx(), cgem_probe(), and cgem_transmit().
| #define CGEM_RX_ADDR_OWNED 0x00000001 |
Receive flags (in buffer address)
Owned by software
Definition at line 104 of file cgem.h.
Referenced by cgem_create_ring(), and cgem_poll_rx().
| #define CGEM_RX_ADDR_WRAP 0x00000002 |
End of descriptor ring.
Definition at line 105 of file cgem.h.
Referenced by cgem_create_ring(), and cgem_refill_rx().
| #define CGEM_RX_FL_LEN | ( | x | ) |
Receive flags.
RX packet length
Definition at line 108 of file cgem.h.
Referenced by cgem_poll_rx().
| #define CGEM_NUM_RX_DESC 8 |
Receive ring length.
Definition at line 111 of file cgem.h.
Referenced by cgem_close(), cgem_poll_rx(), cgem_probe(), and cgem_refill_rx().
| #define CGEM_RX_LEN 1536 |
Length of receive buffers.
Must be a multiple of 64.
Definition at line 117 of file cgem.h.
Referenced by cgem_refill_rx(), and cgem_reset().
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
inlinestatic |
Initialise descriptor ring.
| ring | Descriptor ring |
| count | Number of descriptors |
| qbase | Queue base address register |
Definition at line 155 of file cgem.h.
References cgem_ring::count, count, cgem_ring::desc, cgem_ring::len, cgem_ring::qbase, and qbase.
Referenced by cgem_probe().