iPXE
|
Marvell AQtion family network card driver. More...
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <byteswap.h>
#include <ipxe/netdevice.h>
#include <ipxe/ethernet.h>
#include <ipxe/if_ether.h>
#include <ipxe/iobuf.h>
#include <ipxe/malloc.h>
#include <ipxe/pci.h>
#include <ipxe/profile.h>
#include "aqc1xx.h"
Go to the source code of this file.
Functions | |
FILE_LICENCE (BSD2) | |
static int | atl_ring_alloc (const struct atl_nic *nic, struct atl_ring *ring, uint32_t desc_size, uint32_t reg_base) |
static void | atl_ring_free (struct atl_ring *ring) |
static void | atl_ring_next_dx (unsigned int *val) |
int | atl_ring_full (const struct atl_ring *ring) |
void | atl_rx_ring_fill (struct atl_nic *nic) |
static int | atl_open (struct net_device *netdev) |
Open network device. More... | |
static void | atl_close (struct net_device *netdev) |
Close network device. More... | |
int | atl_transmit (struct net_device *netdev, struct io_buffer *iobuf) |
Transmit packet. More... | |
void | atl_check_link (struct net_device *netdev) |
void | atl_poll_tx (struct net_device *netdev) |
Poll for completed packets. More... | |
void | atl_poll_rx (struct net_device *netdev) |
Poll for received packets. More... | |
static void | atl_poll (struct net_device *netdev) |
Poll for completed and received packets. More... | |
static void | atl_irq (struct net_device *netdev, int enable) |
Enable or disable interrupts. More... | |
static int | atl_probe (struct pci_device *pci) |
Probe PCI device. More... | |
static void | atl_remove (struct pci_device *pci) |
Remove PCI device. More... | |
Variables | |
struct atl_hw_ops | atl_hw |
struct atl_hw_ops | atl2_hw |
static struct net_device_operations | atl_operations |
Marvell network device operations. More... | |
static struct pci_device_id | atl_nics [] |
Marvell PCI device IDs. More... | |
struct pci_driver atl_driver | __pci_driver |
Marvell PCI driver. More... | |
Marvell AQtion family network card driver.
Marvell AQC network card driver.
Copyright(C) 2017-2024 Marvell
SPDX-License-Identifier: BSD-2-Clause
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Definition in file aqc1xx.c.
FILE_LICENCE | ( | BSD2 | ) |
|
static |
Definition at line 58 of file aqc1xx.c.
References ATL_RING_SIZE, ATL_WRITE_REG, DBGC, dma(), dma_alloc(), ENOMEM, atl_ring::length, atl_ring::map, memset(), atl_ring::ring, atl_ring::sw_head, and atl_ring::sw_tail.
Referenced by atl_open().
|
static |
Definition at line 92 of file aqc1xx.c.
References dma_free(), atl_ring::length, atl_ring::map, NULL, and atl_ring::ring.
Referenced by atl_close(), and atl_open().
|
static |
Definition at line 98 of file aqc1xx.c.
References ATL_RING_SIZE, and val.
Referenced by atl_poll_rx(), atl_poll_tx(), atl_ring_full(), atl_rx_ring_fill(), and atl_transmit().
int atl_ring_full | ( | const struct atl_ring * | ring | ) |
Definition at line 104 of file aqc1xx.c.
References atl_ring_next_dx(), atl_ring::sw_head, and atl_ring::sw_tail.
Referenced by atl_rx_ring_fill(), and atl_transmit().
void atl_rx_ring_fill | ( | struct atl_nic * | nic | ) |
Definition at line 110 of file aqc1xx.c.
References address, alloc_rx_iob(), assert(), atl_ring_full(), atl_ring_next_dx(), ATL_RING_TAIL_PTR, ATL_RX_MAX_LEN, ATL_WRITE_REG, DBGC, iob_dma(), NULL, rx, and wmb().
Referenced by atl_open(), and atl_poll().
|
static |
Open network device.
netdev | Network device |
rc | Return status code |
Definition at line 161 of file aqc1xx.c.
References ATL2_RPF_NEW_EN_ADR, ATL2_RPF_NEW_EN_ADR_EN, ATL_FLAG_A2, ATL_IRQ_CTRL, ATL_IRQ_CTRL_COR_EN, ATL_IRQ_CTRL_REG_RST_DIS, ATL_IRQ_MAP_REG1, ATL_IRQ_MAP_REG1_RX0, ATL_IRQ_MAP_REG1_RX0_EN, ATL_IRQ_MAP_REG1_TX0, ATL_IRQ_MAP_REG1_TX0_EN, ATL_IRQ_RX, ATL_IRQ_TX, ATL_ITR_MSKS, ATL_READ_REG, atl_ring_alloc(), atl_ring_free(), ATL_RING_RX_CTRL, ATL_RING_RX_CTRL_EN, ATL_RING_TX_CTRL, ATL_RING_TX_CTRL_EN, ATL_RPB0_CTRL1, ATL_RPB0_CTRL1_SIZE, ATL_RPB0_CTRL2, ATL_RPB0_CTRL2_FC_EN, ATL_RPB0_CTRL2_HIGH_TSH, ATL_RPB0_CTRL2_LOW_TSH, ATL_RPB_CTRL, ATL_RPB_CTRL_EN, ATL_RPB_CTRL_FC, ATL_RPF2_CTRL, ATL_RPF2_CTRL_EN, ATL_RPF_CTRL1, ATL_RPF_CTRL1_ACTION, ATL_RPF_CTRL1_BRC_EN, ATL_RPF_CTRL1_BRC_TSH, ATL_RPF_CTRL1_L2_PROMISC, ATL_RPF_CTRL2, ATL_RPF_CTRL2_VLAN_PROMISC, ATL_RX_DMA_DESC_ADDR, ATL_RX_DMA_DESC_BUF_SIZE, ATL_RX_IRQ_CTRL, ATL_RX_IRQ_CTRL_WB_EN, ATL_RX_MAX_LEN, atl_rx_ring_fill(), ATL_TPB0_CTRL1, ATL_TPB0_CTRL1_SIZE, ATL_TPB0_CTRL2, ATL_TPB0_CTRL2_HIGH_TSH, ATL_TPB0_CTRL2_LOW_TSH, ATL_TPB_CTRL, ATL_TPB_CTRL_EN, ATL_TPB_CTRL_PAD_EN, ATL_TPO2_CTRL, ATL_TPO2_EN, ATL_TX_DMA_DESC_ADDR, ATL_TX_IRQ_CTRL, ATL_TX_IRQ_CTRL_WB_EN, ATL_WRITE_REG, ctrl, ENOMEM, nic::flags, netdev, and net_device::priv.
|
static |
Close network device.
netdev | Network device |
Definition at line 263 of file aqc1xx.c.
References ATL_ITR_MSKS, ATL_ITR_MSKS_DIS, ATL_READ_REG, atl_ring_free(), ATL_RING_RX_CTRL, ATL_RING_RX_CTRL_EN, ATL_RING_TX_CTRL, ATL_RING_TX_CTRL_EN, ATL_RPB_CTRL, ATL_RPB_CTRL_DIS, ATL_TPB_CTRL, ATL_TPB_CTRL_DIS, ATL_WRITE_REG, netdev, and net_device::priv.
int atl_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 294 of file aqc1xx.c.
References address, ATL_DESC_TX_BUF_LEN_MASK, ATL_DESC_TX_BUF_LEN_OFFSET, ATL_DESC_TX_CMD_MASK, ATL_DESC_TX_CMD_OFFSET, ATL_DESC_TX_CMD_VALUE, ATL_DESC_TX_DX_EOP_VALUE, ATL_DESC_TX_EOP_MASK, ATL_DESC_TX_EOP_OFFSET, ATL_DESC_TX_PAY_LEN_MASK, ATL_DESC_TX_PAY_LEN_OFFSET, atl_ring_full(), atl_ring_next_dx(), ATL_RING_TAIL, ATL_WRITE_REG, DBGC, DBGC2, ENOBUFS, iob_dma(), iob_len(), len, memset(), netdev, net_device::priv, tx, and wmb().
void atl_check_link | ( | struct net_device * | netdev | ) |
Definition at line 340 of file aqc1xx.c.
References DBGC, atl_nic::link_state, netdev, netdev_link_down(), netdev_link_up(), and net_device::priv.
Referenced by atl_poll().
void atl_poll_tx | ( | struct net_device * | netdev | ) |
Poll for completed packets.
netdev | Network device |
Definition at line 366 of file aqc1xx.c.
References atl_ring_next_dx(), ATL_TX_DESC_STATUS_DD, cpu_to_le32, DBGC2, if(), netdev, netdev_tx_complete_next(), net_device::priv, and tx.
Referenced by atl_poll().
void atl_poll_rx | ( | struct net_device * | netdev | ) |
Poll for received packets.
netdev | Network device |
Definition at line 395 of file aqc1xx.c.
References atl_ring_next_dx(), ATL_RX_DESC_STATUS_DD, cpu_to_le16, DBGC, if(), iob_put, le16_to_cpu, len, netdev, netdev_rx(), NULL, net_device::priv, and rx.
Referenced by atl_poll().
|
static |
Poll for completed and received packets.
netdev | Network device |
Definition at line 433 of file aqc1xx.c.
References atl_check_link(), atl_poll_rx(), atl_poll_tx(), atl_rx_ring_fill(), netdev, and net_device::priv.
|
static |
Enable or disable interrupts.
netdev | Network device |
enable | Interrupts should be enabled |
Definition at line 455 of file aqc1xx.c.
References ATL_IRQ_RX, ATL_IRQ_TX, ATL_ITR_MSKC, ATL_ITR_MSKS, ATL_WRITE_REG, netdev, and net_device::priv.
|
static |
Probe PCI device.
pci | PCI device |
rc | Return status code |
Definition at line 488 of file aqc1xx.c.
References adjust_pci_device(), alloc_etherdev(), ATL2_BAR_SIZE, atl2_hw, ATL_BAR_SIZE, ATL_FLAG_A1, ATL_FLAG_A2, atl_hw, atl_operations, pci_device::dev, net_device::dev, pci_device::dma, pci_device_id::driver_data, ENODEV, ENOERR, ENOMEM, nic::flags, net_device::hw_addr, pci_device::id, iounmap(), pci_device::membase, memset(), netdev, netdev_init(), netdev_link_down(), netdev_nullify(), netdev_put(), nic, pci_ioremap(), pci_set_drvdata(), net_device::priv, rc, and register_netdev().
|
static |
Remove PCI device.
pci | PCI device |
Definition at line 569 of file aqc1xx.c.
References iounmap(), netdev, netdev_nullify(), netdev_put(), pci_get_drvdata(), net_device::priv, and unregister_netdev().
struct atl_hw_ops atl_hw |
Definition at line 307 of file atl_hw.c.
Referenced by atl_probe().
struct atl_hw_ops atl2_hw |
Definition at line 219 of file atl2_hw.c.
Referenced by atl_probe().
|
static |
Marvell network device operations.
Definition at line 467 of file aqc1xx.c.
Referenced by atl_probe().
|
static |
struct pci_driver atl_driver __pci_driver |
Marvell PCI driver.