iPXE
|
RDC R6040 network driver. More...
#include <stdint.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 "rdc.h"
Go to the source code of this file.
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static int | rdc_reset (struct rdc_nic *rdc) |
Reset hardware. More... | |
static int | rdc_mii_read (struct mii_interface *mdio, unsigned int phy, unsigned int reg) |
Read from MII register. More... | |
static int | rdc_mii_write (struct mii_interface *mdio, unsigned int phy, unsigned int reg, unsigned int data) |
Write to MII register. More... | |
static int | rdc_init_phy (struct rdc_nic *rdc) |
Initialise PHY. More... | |
static int | rdc_check_link (struct net_device *netdev) |
Check link state. More... | |
static int | rdc_create_ring (struct rdc_nic *rdc, struct rdc_ring *ring) |
Create descriptor ring. More... | |
static void | rdc_destroy_ring (struct rdc_nic *rdc, struct rdc_ring *ring) |
Destroy descriptor ring. More... | |
static void | rdc_refill_rx (struct rdc_nic *rdc) |
Refill receive descriptor ring. More... | |
static int | rdc_open (struct net_device *netdev) |
Open network device. More... | |
static void | rdc_close (struct net_device *netdev) |
Close network device. More... | |
static int | rdc_transmit (struct net_device *netdev, struct io_buffer *iobuf) |
Transmit packet. More... | |
static void | rdc_poll_tx (struct net_device *netdev) |
Poll for completed packets. More... | |
static void | rdc_poll_rx (struct net_device *netdev) |
Poll for received packets. More... | |
static void | rdc_poll (struct net_device *netdev) |
Poll for completed and received packets. More... | |
static void | rdc_irq (struct net_device *netdev, int enable) |
Enable or disable interrupts. More... | |
static int | rdc_probe (struct pci_device *pci) |
Probe PCI device. More... | |
static void | rdc_remove (struct pci_device *pci) |
Remove PCI device. More... | |
Variables | |
static struct mii_operations | rdc_mii_operations |
RDC MII operations. More... | |
static struct net_device_operations | rdc_operations |
RDC network device operations. More... | |
static struct pci_device_id | rdc_nics [] |
RDC PCI device IDs. More... | |
struct pci_driver rdc_driver | __pci_driver |
RDC PCI driver. More... | |
RDC R6040 network driver.
Definition in file rdc.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
Reset hardware.
rdc | RDC device |
rc | Return status code |
Definition at line 58 of file rdc.c.
References DBGC, ETIMEDOUT, mdelay(), RDC_MACSM, RDC_MACSM_RESET_DELAY_MS, RDC_MACSM_RST, RDC_MCR1, RDC_MCR1_RST, RDC_RESET_MAX_WAIT_MS, readw(), rdc_nic::regs, and writew.
Referenced by rdc_probe(), and rdc_remove().
|
static |
Read from MII register.
mdio | MII interface |
phy | PHY address |
reg | Register address |
value | Data read, or negative error |
Definition at line 100 of file rdc.c.
References container_of, DBGC, ETIMEDOUT, rdc_nic::mdio, RDC_MII_MAX_WAIT_US, RDC_MMDIO, RDC_MMDIO_MIIRD, RDC_MMDIO_PHYAD, RDC_MMDIO_REGAD, RDC_MMRD, readw(), reg, rdc_nic::regs, udelay(), and writew.
|
static |
Write to MII register.
mdio | MII interface |
phy | PHY address |
reg | Register address |
data | Data to write |
rc | Return status code |
Definition at line 137 of file rdc.c.
References container_of, data, DBGC, ETIMEDOUT, rdc_nic::mdio, RDC_MII_MAX_WAIT_US, RDC_MMDIO, RDC_MMDIO_MIIWR, RDC_MMDIO_PHYAD, RDC_MMDIO_REGAD, RDC_MMWD, readw(), reg, rdc_nic::regs, udelay(), and writew.
|
static |
Initialise PHY.
rdc | RDC device |
rc | Return status code |
Definition at line 184 of file rdc.c.
References DBGC, rdc_nic::mii, mii_find(), mii_reset(), rc, and strerror().
Referenced by rdc_probe().
|
static |
Check link state.
netdev | Network device |
rc | Return status code |
Definition at line 210 of file rdc.c.
References DBGC, rdc_nic::mii, mii_check_link(), netdev, net_device::priv, rc, and strerror().
Referenced by rdc_open(), rdc_poll(), and rdc_probe().
Create descriptor ring.
rdc | RDC device |
ring | Descriptor ring |
rc | Return status code |
Definition at line 238 of file rdc.c.
References rdc_ring::count, cpu_to_le32, DBGC, desc, rdc_ring::desc, rdc_nic::dma, dma(), dma_alloc(), ENOMEM, len, rdc_ring::map, memset(), next, RDC_MxDSA_HI, RDC_MxDSA_LO, rdc_ring::reg, rdc_nic::regs, start, virt_to_phys(), and writew.
Referenced by rdc_open().
Destroy descriptor ring.
rdc | RDC device |
ring | Descriptor ring |
Definition at line 275 of file rdc.c.
References rdc_ring::cons, rdc_ring::count, rdc_ring::desc, dma_free(), len, rdc_ring::map, NULL, rdc_ring::prod, RDC_MxDSA_HI, RDC_MxDSA_LO, rdc_ring::reg, rdc_nic::regs, and writew.
Referenced by rdc_close(), and rdc_open().
|
static |
Refill receive descriptor ring.
rdc | RDC device |
Definition at line 296 of file rdc.c.
References alloc_rx_iob(), assert(), rdc_ring::cons, cpu_to_le16, cpu_to_le32, io_buffer::data, DBGC2, rdc_ring::desc, rdc_nic::dma, iob_dma(), NULL, rdc_ring::prod, RDC_FL_OWNED, RDC_NUM_RX_DESC, RDC_RX_MAX_LEN, rdc_nic::rx, rx, rdc_nic::rx_iobuf, virt_to_phys(), and wmb().
Referenced by rdc_open(), and rdc_poll().
|
static |
Open network device.
netdev | Network device |
rc | Return status code |
Definition at line 337 of file rdc.c.
References mii_device::address, rdc_nic::mii, netdev, net_device::priv, rc, rdc_check_link(), rdc_create_ring(), rdc_destroy_ring(), RDC_MCR0, RDC_MCR0_FD, RDC_MCR0_PROMISC, RDC_MCR0_RXEN, RDC_MCR0_TXEN, RDC_MPSCCR, RDC_MPSCCR_EN, RDC_MPSCCR_PHYAD, RDC_MPSCCR_SLOW, RDC_MRBSR, rdc_refill_rx(), RDC_RX_MAX_LEN, rdc_nic::regs, rdc_nic::rx, rdc_nic::tx, and writew.
|
static |
Close network device.
netdev | Network device |
Definition at line 382 of file rdc.c.
References free_rx_iob(), netdev, NULL, net_device::priv, rdc_destroy_ring(), RDC_MCR0, RDC_NUM_RX_DESC, rdc_nic::regs, rdc_nic::rx, rdc_nic::rx_iobuf, rdc_nic::tx, and writew.
|
static |
Transmit packet.
netdev | Network device |
iobuf | I/O buffer |
rc | Return status code |
Definition at line 410 of file rdc.c.
References rdc_ring::cons, cpu_to_le16, cpu_to_le32, DBGC, rdc_ring::desc, rdc_nic::dma, ENOBUFS, ETH_ZLEN, iob_dma(), iob_len(), iob_map_tx(), iob_pad(), netdev, net_device::priv, rdc_ring::prod, rc, RDC_FL_OWNED, RDC_MTPR, RDC_MTPR_TM2TX, RDC_NUM_TX_DESC, rdc_nic::regs, rdc_nic::tx, tx, wmb(), and writew.
|
static |
Poll for completed packets.
netdev | Network device |
Definition at line 452 of file rdc.c.
References rdc_ring::cons, cpu_to_le16, DBGC2, rdc_ring::desc, netdev, netdev_tx_complete_next(), net_device::priv, rdc_ring::prod, RDC_FL_OWNED, RDC_NUM_TX_DESC, rdc_nic::tx, and tx.
Referenced by rdc_poll().
|
static |
Poll for received packets.
netdev | Network device |
Definition at line 480 of file rdc.c.
References rdc_ring::cons, cpu_to_le16, DBGC2, rdc_ring::desc, EIO, iob_put, iob_unput, le16_to_cpu, len, netdev, netdev_rx(), netdev_rx_err(), NULL, net_device::priv, rdc_ring::prod, RDC_FL_OK, RDC_FL_OWNED, RDC_NUM_RX_DESC, rdc_nic::rx, rx, and rdc_nic::rx_iobuf.
Referenced by rdc_poll().
|
static |
Poll for completed and received packets.
netdev | Network device |
Definition at line 525 of file rdc.c.
References DBGC, ENOTSUP, netdev, netdev_tx_err(), NULL, net_device::priv, rdc_check_link(), RDC_MIRQ_LINK, RDC_MIRQ_RX, RDC_MIRQ_RX_EARLY, RDC_MIRQ_RX_EMPTY, RDC_MIRQ_TX, RDC_MISR, rdc_poll_rx(), rdc_poll_tx(), rdc_refill_rx(), readw(), and rdc_nic::regs.
|
static |
Enable or disable interrupts.
netdev | Network device |
enable | Interrupts should be enabled |
Definition at line 562 of file rdc.c.
References netdev, net_device::priv, RDC_MIER, RDC_MIRQ_LINK, RDC_MIRQ_RX, RDC_MIRQ_TX, rdc_nic::regs, and writew.
|
static |
Probe PCI device.
pci | PCI device |
rc | Return status code |
Definition at line 593 of file rdc.c.
References adjust_pci_device(), alloc_etherdev(), cpu_to_le16, pci_device::dev, net_device::dev, rdc_nic::dma, pci_device::dma, ENODEV, ENOMEM, ETH_ALEN, net_device::hw_addr, iounmap(), mac, rdc_nic::mdio, mdio_init(), pci_device::membase, memcpy(), memset(), rdc_nic::mii, mii_init(), netdev, netdev_init(), netdev_nullify(), netdev_put(), pci_ioremap(), pci_set_drvdata(), net_device::priv, rc, RDC_BAR_SIZE, rdc_check_link(), rdc_init_phy(), rdc_init_ring(), RDC_MID0, RDC_MID1, RDC_MID2, rdc_mii_operations, RDC_MRDSA, RDC_MTDSA, RDC_NUM_RX_DESC, RDC_NUM_TX_DESC, rdc_operations, rdc_reset(), readw(), register_netdev(), rdc_nic::regs, rdc_nic::rx, rdc_nic::tx, and unregister_netdev().
|
static |
Remove PCI device.
pci | PCI device |
Definition at line 667 of file rdc.c.
References iounmap(), netdev, netdev_nullify(), netdev_put(), pci_get_drvdata(), net_device::priv, rdc_reset(), rdc_nic::regs, and unregister_netdev().
|
static |
RDC MII operations.
Definition at line 166 of file rdc.c.
Referenced by rdc_probe().
|
static |
RDC network device operations.
Definition at line 572 of file rdc.c.
Referenced by rdc_probe().
|
static |
struct pci_driver rdc_driver __pci_driver |
RDC PCI driver.