iPXE
|
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <assert.h>
#include <byteswap.h>
#include <ipxe/io.h>
#include <ipxe/pci.h>
#include <ipxe/malloc.h>
#include <ipxe/iobuf.h>
#include <ipxe/netdevice.h>
#include "efx_hunt.h"
#include "efx_bitfield.h"
#include "ef10_regs.h"
Go to the source code of this file.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
void efx_hunt_free_special_buffer | ( | void * | buf, |
int | bytes | ||
) |
Definition at line 39 of file efx_hunt.c.
References bytes, and free_phys().
Referenced by hunt_ev_fini(), hunt_rx_fini(), and hunt_tx_fini().
|
static |
Definition at line 44 of file efx_hunt.c.
References assert(), buffer, bytes, DBGP, efx_special_buffer::dma_addr, EFX_BUF_ALIGN, efx_special_buffer::id, malloc_phys(), NULL, and virt_to_bus().
Referenced by efx_hunt_ev_init(), efx_hunt_rx_init(), and efx_hunt_tx_init().
|
static |
Definition at line 76 of file efx_hunt.c.
References io_buffer::data, EFX_POPULATE_QWORD_4, iob_len(), txd, and virt_to_bus().
Referenced by efx_hunt_transmit().
|
static |
Definition at line 90 of file efx_hunt.c.
References EFX_POPULATE_DWORD_1, EFX_TXD_MASK, efx_writel_page, ER_DZ_TX_DESC_UPD_DWORD, reg, efx_nic::txq, and efx_tx_queue::write_ptr.
Referenced by efx_hunt_transmit().
int efx_hunt_transmit | ( | struct net_device * | netdev, |
struct io_buffer * | iob | ||
) |
Definition at line 101 of file efx_hunt.c.
References assert(), efx_tx_queue::buf, io_buffer::data, DBGCIO, efx_hunt_build_tx_desc(), efx_hunt_notify_tx_desc(), EFX_TXD_MASK, EFX_TXD_SIZE, ENOBUFS, iob_len(), netdev, NULL, net_device::priv, efx_tx_queue::read_ptr, efx_tx_queue::ring, txd, efx_nic::txq, and efx_tx_queue::write_ptr.
|
static |
Definition at line 132 of file efx_hunt.c.
References assert(), efx_tx_queue::buf, DBGCIO, EFX_TXD_MASK, efx_nic::netdev, netdev_tx_complete(), NULL, efx_tx_queue::read_ptr, and efx_nic::txq.
Referenced by efx_hunt_handle_event().
int efx_hunt_tx_init | ( | struct net_device * | netdev, |
dma_addr_t * | dma_addr | ||
) |
Definition at line 156 of file efx_hunt.c.
References bytes, efx_special_buffer::dma_addr, efx_hunt_alloc_special_buffer(), EFX_TXD_SIZE, ENOMEM, efx_tx_queue::entry, netdev, net_device::priv, efx_tx_queue::read_ptr, efx_tx_queue::ring, efx_nic::txq, and efx_tx_queue::write_ptr.
Referenced by hunt_tx_init().
|
static |
Definition at line 181 of file efx_hunt.c.
References io_buffer::data, EFX_POPULATE_QWORD_2, EFX_RX_BUF_SIZE, rxd, and virt_to_bus().
Referenced by efx_hunt_rxq_fill().
|
static |
Definition at line 191 of file efx_hunt.c.
References EFX_POPULATE_DWORD_1, EFX_RXD_MASK, efx_writel_page, ER_DZ_RX_DESC_UPD, reg, efx_nic::rxq, and efx_rx_queue::write_ptr.
Referenced by efx_hunt_rxq_fill().
|
static |
Definition at line 202 of file efx_hunt.c.
References alloc_iob(), assert(), efx_rx_queue::buf, io_buffer::data, DBGCP, efx_hunt_build_rx_desc(), efx_hunt_notify_rx_desc(), EFX_NUM_RX_DESC, EFX_RX_BUF_SIZE, EFX_RXD_MASK, NULL, efx_rx_queue::read_ptr, efx_rx_queue::ring, rxd, efx_nic::rxq, and efx_rx_queue::write_ptr.
Referenced by efx_hunt_open(), and efx_hunt_poll().
|
static |
Definition at line 241 of file efx_hunt.c.
References assert(), efx_rx_queue::buf, io_buffer::data, DBGCIO, EBADMSG, EFX_NUM_RX_DESC_MASK, EFX_RXD_MASK, iob_pull, iob_put, len, efx_nic::netdev, netdev_rx(), netdev_rx_err(), NULL, efx_rx_queue::read_ptr, efx_nic::rx_prefix_size, and efx_nic::rxq.
Referenced by efx_hunt_handle_event().
int efx_hunt_rx_init | ( | struct net_device * | netdev, |
dma_addr_t * | dma_addr | ||
) |
Definition at line 271 of file efx_hunt.c.
References bytes, efx_special_buffer::dma_addr, efx_hunt_alloc_special_buffer(), EFX_RXD_SIZE, ENOMEM, efx_rx_queue::entry, netdev, NULL, net_device::priv, efx_rx_queue::read_ptr, efx_rx_queue::ring, efx_nic::rxq, and efx_rx_queue::write_ptr.
Referenced by hunt_rx_init().
int efx_hunt_ev_init | ( | struct net_device * | netdev, |
dma_addr_t * | dma_addr | ||
) |
Definition at line 295 of file efx_hunt.c.
References bytes, efx_special_buffer::dma_addr, EFX_EVQ_SIZE, efx_hunt_alloc_special_buffer(), ENOMEM, efx_ev_queue::entry, efx_nic::evq, memset(), netdev, NULL, net_device::priv, efx_ev_queue::read_ptr, and efx_ev_queue::ring.
Referenced by hunt_ev_init().
|
static |
Definition at line 314 of file efx_hunt.c.
References efx_readl(), ER_DZ_BIU_INT_ISR, and reg.
Referenced by efx_hunt_close(), efx_hunt_irq(), and efx_hunt_poll().
|
inlinestatic |
See if an event is present.
event | EFX event structure |
True | An event is pending |
False | No event is pending |
We check both the high and low dword of the event for all ones. We wrote all ones when we cleared the event, and no valid event can have all ones in either its high or low dwords. This approach is robust against reordering.
Note that using a single 64-bit comparison is incorrect; even though the CPU read will be atomic, the DMA write may not be.
Definition at line 337 of file efx_hunt.c.
References efx_qword::dword, and EFX_DWORD_IS_ALL_ONES.
Referenced by efx_hunt_poll().
|
static |
Definition at line 344 of file efx_hunt.c.
References EFE_DD_EVQ_IND_RPTR_FLAGS_HIGH, EFE_DD_EVQ_IND_RPTR_FLAGS_LOW, EFX_POPULATE_DWORD_1, EFX_POPULATE_DWORD_2, efx_writel_page, efx_writel_table, ER_DD_EVQ_INDIRECT, ER_DZ_EVQ_RPTR, ERF_DD_EVQ_IND_RPTR_WIDTH, efx_nic::evq, efx_ev_queue::read_ptr, reg, and efx_nic::workaround_35388.
Referenced by efx_hunt_irq(), efx_hunt_open(), and efx_hunt_poll().
|
static |
Definition at line 367 of file efx_hunt.c.
References DBGCP, efx_hunt_receive(), efx_hunt_transmit_done(), EFX_QWORD_FIELD, ESE_DZ_EV_CODE_RX_EV, ESE_DZ_EV_CODE_TX_EV, len, efx_rx_queue::rx_cont_prev, and efx_nic::rxq.
Referenced by efx_hunt_poll().
void efx_hunt_poll | ( | struct net_device * | netdev | ) |
Definition at line 405 of file efx_hunt.c.
References DBGCP, EFX_EVQ_MASK, efx_hunt_clear_interrupts(), efx_hunt_event_present(), efx_hunt_evq_read_ack(), efx_hunt_handle_event(), efx_hunt_rxq_fill(), EFX_QWORD_FMT, EFX_QWORD_VAL, EFX_SET_QWORD, efx_nic::evq, efx_nic::int_en, netdev, net_device::priv, efx_ev_queue::read_ptr, and efx_ev_queue::ring.
Referenced by hunt_poll().
void efx_hunt_irq | ( | struct net_device * | netdev, |
int | enable | ||
) |
Definition at line 444 of file efx_hunt.c.
References efx_hunt_clear_interrupts(), efx_hunt_evq_read_ack(), efx_nic::int_en, netdev, efx_nic::netdev, NETDEV_OPEN, net_device::priv, and net_device::state.
int efx_hunt_open | ( | struct net_device * | netdev | ) |
Definition at line 466 of file efx_hunt.c.
References cmd, efx_hunt_evq_read_ack(), efx_hunt_rxq_fill(), EFX_POPULATE_DWORD_2, efx_writel_page, ER_DZ_EVQ_TMR, efx_nic::int_en, netdev, and net_device::priv.
Referenced by hunt_open().
void efx_hunt_close | ( | struct net_device * | netdev | ) |
Definition at line 487 of file efx_hunt.c.
References efx_tx_queue::buf, efx_rx_queue::buf, efx_hunt_clear_interrupts(), EFX_NUM_RX_DESC, EFX_TXD_SIZE, free_iob(), netdev, efx_nic::netdev, netdev_tx_complete(), NULL, net_device::priv, efx_nic::rxq, and efx_nic::txq.
Referenced by hunt_close(), and hunt_open().