iPXE
Functions
efx_common.c File Reference
#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_common.h"
#include "efx_bitfield.h"
#include "mc_driver_pcol.h"

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
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 revision)
void efx_remove (struct net_device *netdev)

Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
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  revision 
)

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;
}