iPXE
Data Structures | Defines | Typedefs | Enumerations | Functions | Variables
efx_common.h File Reference
#include <stdbool.h>
#include <ipxe/io.h>
#include <ipxe/netdevice.h>
#include "efx_bitfield.h"
#include "mcdi.h"

Go to the source code of this file.

Data Structures

struct  efx_special_buffer
 A buffer table allocation backing a tx dma, rx dma or eventq. More...
struct  efx_tx_queue
 A transmit queue. More...
struct  efx_rx_queue
 A receive queue. More...
struct  efx_ev_queue
 An event queue. More...
struct  efx_nic
 Hardware access. More...
struct  efx_nic_type
 Efx device type definition. More...

Defines

#define __packed   __attribute__((__packed__))
#define __force   /*nothing*/
#define BUILD_BUG_ON_ZERO(e)   (sizeof(struct{int: -!!(e); }))
#define BUILD_BUG_ON(e)   ((void)BUILD_BUG_ON_ZERO(e))
#define EFX_BUF_ALIGN   4096
#define EFX_RXD_SIZE   512
#define EFX_RXD_MASK   (EFX_RXD_SIZE - 1)
#define EFX_TXD_SIZE   512
#define EFX_TXD_MASK   (EFX_TXD_SIZE - 1)
#define EFX_EVQ_SIZE   512
#define EFX_EVQ_MASK   (EFX_EVQ_SIZE - 1)
#define EFX_NUM_RX_DESC   64
#define EFX_NUM_RX_DESC_MASK   (EFX_NUM_RX_DESC - 1)
#define EFX_RX_BUF_SIZE   1600
#define EFX_STATE_POLLING   1
#define EFX_MAC_FRAME_LEN(_mtu)
#define efx_writel_table(efx, value, index, reg)   efx_writel(efx, value, (reg) + ((index) * reg##_STEP))
#define efx_writel_page(efx, value, index, reg)   efx_writel(efx, value, (reg) + ((index) * 0x2000))

Typedefs

typedef uint16_t __le16
typedef uint32_t __le32
typedef uint64_t __le64
typedef efx_qword_t efx_rx_desc_t
typedef efx_qword_t efx_tx_desc_t
typedef efx_qword_t efx_event_t
typedef unsigned long long dma_addr_t

Enumerations

enum  efx_revision { EFX_HUNTINGTON }

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
static void _efx_writel (struct efx_nic *efx, uint32_t value, unsigned int reg)
static uint32_t _efx_readl (struct efx_nic *efx, unsigned int reg)
void efx_writel (struct efx_nic *efx, efx_dword_t *value, unsigned int reg)
void efx_readl (struct efx_nic *efx, efx_dword_t *value, unsigned int reg)
void efx_probe (struct net_device *netdev, enum efx_revision rev)
void efx_remove (struct net_device *netdev)

Variables

struct efx_nic_type hunt_nic_type

Define Documentation

#define __packed   __attribute__((__packed__))

Definition at line 26 of file efx_common.h.

#define __force   /*nothing*/

Definition at line 27 of file efx_common.h.

#define BUILD_BUG_ON_ZERO (   e)    (sizeof(struct{int: -!!(e); }))

Definition at line 33 of file efx_common.h.

#define BUILD_BUG_ON (   e)    ((void)BUILD_BUG_ON_ZERO(e))

Definition at line 34 of file efx_common.h.

#define EFX_BUF_ALIGN   4096

Definition at line 55 of file efx_common.h.

Referenced by efx_hunt_alloc_special_buffer().

#define EFX_RXD_SIZE   512

Definition at line 56 of file efx_common.h.

Referenced by efx_hunt_rx_init(), hunt_rx_fini(), and hunt_rx_init().

#define EFX_RXD_MASK   (EFX_RXD_SIZE - 1)

Definition at line 57 of file efx_common.h.

Referenced by efx_hunt_notify_rx_desc(), efx_hunt_receive(), and efx_hunt_rxq_fill().

#define EFX_TXD_SIZE   512
#define EFX_TXD_MASK   (EFX_TXD_SIZE - 1)

Definition at line 59 of file efx_common.h.

Referenced by efx_hunt_notify_tx_desc(), efx_hunt_transmit(), and efx_hunt_transmit_done().

#define EFX_EVQ_SIZE   512

Definition at line 60 of file efx_common.h.

Referenced by efx_hunt_ev_init(), hunt_ev_fini(), and hunt_ev_init().

#define EFX_EVQ_MASK   (EFX_EVQ_SIZE - 1)

Definition at line 61 of file efx_common.h.

Referenced by efx_hunt_poll().

#define EFX_NUM_RX_DESC   64

Definition at line 68 of file efx_common.h.

Referenced by efx_hunt_close(), and efx_hunt_rxq_fill().

Definition at line 69 of file efx_common.h.

Referenced by efx_hunt_receive().

#define EFX_RX_BUF_SIZE   1600

Definition at line 74 of file efx_common.h.

Referenced by efx_hunt_build_rx_desc(), and efx_hunt_rxq_fill().

#define EFX_STATE_POLLING   1

Definition at line 78 of file efx_common.h.

Referenced by hunt_poll().

#define EFX_MAC_FRAME_LEN (   _mtu)
Value:
(((_mtu)                                                \
          + /* EtherII already included */                      \
          + 4 /* FCS */                                         \
          /* No VLAN supported */                               \
          + 16 /* bug16772 */                                   \
          + 7) & ~7)

Definition at line 190 of file efx_common.h.

Referenced by hunt_set_mac().

#define efx_writel_table (   efx,
  value,
  index,
  reg 
)    efx_writel(efx, value, (reg) + ((index) * reg##_STEP))

Definition at line 216 of file efx_common.h.

Referenced by efx_hunt_evq_read_ack().

#define efx_writel_page (   efx,
  value,
  index,
  reg 
)    efx_writel(efx, value, (reg) + ((index) * 0x2000))

Typedef Documentation

typedef uint16_t __le16

Definition at line 29 of file efx_common.h.

typedef uint32_t __le32

Definition at line 30 of file efx_common.h.

typedef uint64_t __le64

Definition at line 31 of file efx_common.h.

Definition at line 51 of file efx_common.h.

Definition at line 52 of file efx_common.h.

Definition at line 53 of file efx_common.h.

typedef unsigned long long dma_addr_t

Definition at line 80 of file efx_common.h.


Enumeration Type Documentation

Enumerator:
EFX_HUNTINGTON 

Definition at line 142 of file efx_common.h.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
static void _efx_writel ( struct efx_nic efx,
uint32_t  value,
unsigned int  reg 
) [inline, static]

Definition at line 205 of file efx_common.h.

References writel().

Referenced by efx_writel(), hunt_mcdi_copyin(), and hunt_probe().

{
        writel((value), (efx)->membase + (reg));
}
static uint32_t _efx_readl ( struct efx_nic efx,
unsigned int  reg 
) [inline, static]

Definition at line 211 of file efx_common.h.

References readl().

Referenced by efx_readl().

{
        return readl((efx)->membase + (reg));
}
void efx_writel ( struct efx_nic efx,
efx_dword_t value,
unsigned int  reg 
)

Definition at line 48 of file efx_common.c.

References _efx_writel(), DBGCIO, EFX_DWORD_FMT, EFX_DWORD_VAL, and efx_dword::u32.

{
        DBGCIO(efx, "Writing partial register %x with " EFX_DWORD_FMT "\n",
               reg, EFX_DWORD_VAL(*value));
        _efx_writel(efx, value->u32[0], reg);
}
void efx_readl ( struct efx_nic efx,
efx_dword_t value,
unsigned int  reg 
)

Definition at line 56 of file efx_common.c.

References _efx_readl(), DBGCIO, EFX_DWORD_FMT, EFX_DWORD_VAL, and efx_dword::u32.

Referenced by efx_hunt_clear_interrupts().

{
        value->u32[0] = _efx_readl(efx, reg);
        DBGCIO(efx, "Read from register %x, got " EFX_DWORD_FMT "\n",
               reg, EFX_DWORD_VAL(*value));
}
void efx_probe ( struct net_device netdev,
enum efx_revision  rev 
)

Definition at line 70 of file efx_common.c.

References adjust_pci_device(), container_of, DBGCP, pci_device::dev, net_device::dev, ioremap(), efx_nic::membase, efx_nic::mmio_len, efx_nic::mmio_start, netdev, efx_nic::netdev, netdev_priv(), pci_bar_size(), pci_bar_start(), PCI_BASE_ADDRESS_0, PCI_BASE_ADDRESS_2, PCI_BASE_ADDRESS_IO_MASK, PCI_BASE_ADDRESS_SPACE_IO, pci_read_config_dword(), reg, efx_nic::revision, and revision.

Referenced by hunt_probe().

{
        struct efx_nic *efx = netdev_priv(netdev);
        struct pci_device *pci = container_of(netdev->dev,
                                              struct pci_device, dev);
        unsigned int reg = PCI_BASE_ADDRESS_0;
        uint32_t bar_low;

        efx->netdev = netdev;
        efx->revision = revision;

        /* Find the memory bar to use */
        pci_read_config_dword(pci, reg, &bar_low);
        if ((bar_low & PCI_BASE_ADDRESS_IO_MASK) == PCI_BASE_ADDRESS_SPACE_IO)
                reg = PCI_BASE_ADDRESS_2;

        efx->mmio_start = pci_bar_start(pci, reg);
        efx->mmio_len = pci_bar_size(pci, reg);
        efx->membase = ioremap(efx->mmio_start, efx->mmio_len);

        DBGCP(efx, "BAR of %lx bytes at phys %lx mapped at %p\n",
              efx->mmio_len, efx->mmio_start, efx->membase);

        /* Enable PCI access */
        adjust_pci_device(pci);
}
void efx_remove ( struct net_device netdev)

Definition at line 97 of file efx_common.c.

References iounmap(), efx_nic::membase, netdev_priv(), and NULL.

Referenced by hunt_probe(), and hunt_remove().

{
        struct efx_nic *efx = netdev_priv(netdev);

        iounmap(efx->membase);
        efx->membase = NULL;
}

Variable Documentation

Definition at line 1312 of file sfc_hunt.c.

Referenced by hunt_probe().