|
iPXE
|
#include <string.h>#include <errno.h>#include <assert.h>#include <stdio.h>#include <unistd.h>#include <byteswap.h>#include <ipxe/io.h>#include <mii.h>#include <ipxe/iobuf.h>#include <ipxe/malloc.h>#include <ipxe/pci.h>#include <ipxe/netdevice.h>#include <ipxe/ethernet.h>#include <ipxe/if_ether.h>#include "b44.h"Go to the source code of this file.
Macros | |
| #define | VIRT_TO_B44(addr) ( virt_to_bus(addr) + SB_PCI_DMA ) |
| #define | CTRL_MASK (DMARX_CTRL_ENABLE | (RX_PKT_OFFSET << DMARX_CTRL_ROSHIFT)) |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER) | |
| static int | ring_next (int index) |
| static u32 | br32 (const struct b44_private *bp, u32 reg) |
| static void | bw32 (const struct b44_private *bp, u32 reg, u32 val) |
| static void | bflush (const struct b44_private *bp, u32 reg, u32 timeout) |
| static int | b44_address_ok (void *address) |
| Check if card can access address. More... | |
| static u32 | pending_tx_index (struct b44_private *bp) |
| Ring cells waiting to be processed are between 'tx_cur' and 'pending' indexes in the ring. More... | |
| static u32 | pending_rx_index (struct b44_private *bp) |
| Ring cells waiting to be processed are between 'rx_cur' and 'pending' indexes in the ring. More... | |
| static int | b44_wait_bit (struct b44_private *bp, unsigned long reg, u32 bit, unsigned long timeout, const int clear) |
| Wait until the given bit is set/cleared. More... | |
| static u32 | ssb_get_core_rev (struct b44_private *bp) |
| static int | ssb_is_core_up (struct b44_private *bp) |
| static u32 | ssb_pci_setup (struct b44_private *bp, u32 cores) |
| static void | ssb_core_disable (struct b44_private *bp) |
| static void | ssb_core_reset (struct b44_private *bp) |
| static void | b44_chip_reset (struct b44_private *bp, int reset_kind) |
| static void | b44_halt (struct b44_private *bp) |
| called by b44_poll in the error path More... | |
| static void | b44_init_hw (struct b44_private *bp, int reset_kind) |
| static void | b44_populate_rx_descriptor (struct b44_private *bp, u32 idx) |
| static void | b44_rx_refill (struct b44_private *bp, u32 pending) |
| static void | b44_free_rx_ring (struct b44_private *bp) |
| static int | b44_init_rx_ring (struct b44_private *bp) |
| static void | b44_free_tx_ring (struct b44_private *bp) |
| static int | b44_init_tx_ring (struct b44_private *bp) |
| static int | b44_phy_read (struct b44_private *bp, int reg, u32 *val) |
| static int | b44_phy_write (struct b44_private *bp, int reg, u32 val) |
| static int | b44_phy_reset (struct b44_private *bp) |
| static void | b44_cam_write (struct b44_private *bp, unsigned char *data, int index) |
| static void | b44_set_mac_addr (struct b44_private *bp) |
| static void | b44_read_eeprom (struct b44_private *bp, u8 *data) |
| static void | b44_load_mac_and_phy_addr (struct b44_private *bp) |
| static void | b44_set_rx_mode (struct net_device *netdev) |
| static int | b44_probe (struct pci_device *pci) |
| Probe device. More... | |
| static void | b44_remove (struct pci_device *pci) |
| Remove device. More... | |
| static void | b44_irq (struct net_device *netdev, int enable) |
| Enable or disable interrupts. More... | |
| static int | b44_open (struct net_device *netdev) |
| Open network device. More... | |
| static void | b44_close (struct net_device *netdev) |
| Close network device. More... | |
| static int | b44_transmit (struct net_device *netdev, struct io_buffer *iobuf) |
| Transmit packet. More... | |
| static void | b44_tx_complete (struct b44_private *bp) |
| Recycles sent TX descriptors and notifies network stack. More... | |
| static void | b44_process_rx_packets (struct b44_private *bp) |
| static void | b44_poll (struct net_device *netdev) |
| Poll for completed and received packets. More... | |
Variables | |
| static struct net_device_operations | b44_operations |
| static struct pci_device_id | b44_nics [] |
| struct pci_driver b44_driver | __pci_driver |
| #define VIRT_TO_B44 | ( | addr | ) | ( virt_to_bus(addr) + SB_PCI_DMA ) |
| #define CTRL_MASK (DMARX_CTRL_ENABLE | (RX_PKT_OFFSET << DMARX_CTRL_ROSHIFT)) |
| FILE_LICENCE | ( | GPL2_OR_LATER | ) |
|
inlinestatic |
Definition at line 51 of file b44.c.
References B44_RING_SIZE, and index.
Referenced by b44_process_rx_packets(), b44_rx_refill(), b44_transmit(), and b44_tx_complete().
|
inlinestatic |
Definition at line 60 of file b44.c.
References bp, readl(), and reg.
Referenced by b44_chip_reset(), b44_init_hw(), b44_phy_read(), b44_poll(), b44_set_mac_addr(), b44_set_rx_mode(), b44_wait_bit(), pending_rx_index(), pending_tx_index(), ssb_core_disable(), ssb_core_reset(), ssb_get_core_rev(), ssb_is_core_up(), and ssb_pci_setup().
|
inlinestatic |
Definition at line 66 of file b44.c.
References bp, reg, val, and writel().
Referenced by b44_cam_write(), b44_chip_reset(), b44_halt(), b44_init_hw(), b44_irq(), b44_phy_read(), b44_phy_write(), b44_poll(), b44_populate_rx_descriptor(), b44_set_mac_addr(), b44_set_rx_mode(), b44_transmit(), ssb_core_disable(), ssb_core_reset(), and ssb_pci_setup().
|
inlinestatic |
Definition at line 72 of file b44.c.
References bp, readl(), reg, timeout(), and udelay().
Referenced by b44_chip_reset(), b44_halt(), b44_poll(), ssb_core_disable(), and ssb_core_reset().
|
inlinestatic |
Check if card can access address.
| address | Virtual address |
| address_ok | Card can access address |
Definition at line 89 of file b44.c.
References address, B44_30BIT_DMA_MASK, and virt_to_bus().
Referenced by b44_init_rx_ring(), b44_init_tx_ring(), b44_rx_refill(), and b44_transmit().
|
static |
Ring cells waiting to be processed are between 'tx_cur' and 'pending' indexes in the ring.
Definition at line 102 of file b44.c.
References B44_DMATX_STAT, B44_RING_SIZE, bp, br32(), DMATX_STAT_CDMASK, and pending.
Referenced by b44_tx_complete().
|
static |
Ring cells waiting to be processed are between 'rx_cur' and 'pending' indexes in the ring.
Definition at line 116 of file b44.c.
References B44_DMARX_STAT, B44_RING_SIZE, bp, br32(), DMARX_STAT_CDMASK, and pending.
Referenced by b44_process_rx_packets().
|
static |
Wait until the given bit is set/cleared.
Definition at line 129 of file b44.c.
References bit, bp, br32(), clear, ENODEV, reg, timeout(), udelay(), and val.
Referenced by b44_cam_write(), b44_chip_reset(), b44_phy_read(), b44_phy_write(), and ssb_core_disable().
|
inlinestatic |
Definition at line 164 of file b44.c.
References B44_SBIDHIGH, bp, br32(), and SBIDHIGH_RC_MASK.
Referenced by ssb_pci_setup().
|
inlinestatic |
Definition at line 170 of file b44.c.
References B44_SBTMSLOW, bp, br32(), SBTMSLOW_CLOCK, and SSB_CORE_DOWN.
Referenced by b44_chip_reset().
|
static |
Definition at line 177 of file b44.c.
References B44_SBINTVEC, BCM4400_PCI_CORE_ADDR, bp, br32(), bw32(), pci_read_config_dword(), pci_write_config_dword(), SSB_BAR0_WIN, ssb_get_core_rev(), SSB_PCI_BURST, SSB_PCI_PREF, SSB_PCI_TRANS_2, and val.
Referenced by b44_chip_reset().
|
static |
Definition at line 200 of file b44.c.
References B44_SBTMSHIGH, B44_SBTMSLOW, b44_wait_bit(), bflush(), bp, br32(), bw32(), SBTMSHIGH_BUSY, SBTMSLOW_CLOCK, SBTMSLOW_FGC, SBTMSLOW_REJECT, SBTMSLOW_RESET, and SSB_CORE_DOWN.
Referenced by b44_remove(), and ssb_core_reset().
|
static |
Definition at line 218 of file b44.c.
References B44_SBIMSTATE, B44_SBTMSHIGH, B44_SBTMSLOW, bflush(), bp, br32(), bw32(), SBIMSTATE_BAD, SBTMSHIGH_SERR, SBTMSLOW_CLOCK, SBTMSLOW_FGC, SBTMSLOW_RESET, ssb_core_disable(), and val.
Referenced by b44_chip_reset().
|
static |
Definition at line 258 of file b44.c.
References B44_CHIP_RESET_PARTIAL, B44_DEVCTRL, B44_DMARX_CTRL, B44_DMARX_STAT, B44_DMATX_CTRL, B44_ENET_CTRL, B44_MDIO_CTRL, B44_RCV_LAZY, b44_wait_bit(), bflush(), bp, br32(), bw32(), DEVCTRL_EPR, DEVCTRL_IPP, DMARX_STAT_EMASK, DMARX_STAT_SIDLE, ENET_CTRL_DISABLE, ENET_CTRL_EPSEL, MDIO_CTRL_MAXF_MASK, MDIO_CTRL_PREAMBLE, SBINTVEC_ENET0, ssb_core_reset(), ssb_is_core_up(), ssb_pci_setup(), and val.
Referenced by b44_close(), b44_halt(), b44_init_hw(), and b44_probe().
|
static |
called by b44_poll in the error path
Definition at line 310 of file b44.c.
References b44_chip_reset(), B44_CHIP_RESET_PARTIAL, B44_IMASK, B44_MAC_CTRL, bflush(), bp, bw32(), DBG, and MAC_CTRL_PHY_PDOWN.
Referenced by b44_poll().
|
static |
Definition at line 335 of file b44.c.
References b44_chip_reset(), B44_CHIP_RESET_FULL, B44_DMARX_ADDR, B44_DMARX_CTRL, B44_DMARX_PTR, B44_DMATX_ADDR, B44_DMATX_CTRL, B44_ENET_CTRL, B44_FULL_RESET, B44_MAC_CTRL, B44_MAX_MTU, B44_MIB_CTRL, B44_PARTIAL_RESET, b44_phy_reset(), B44_RCV_LAZY, B44_RX_RING_LEN_BYTES, B44_RXMAXLEN, b44_set_rx_mode(), B44_TX_HIWMARK, B44_TXMAXLEN, bp, br32(), bw32(), CTRL_MASK, DMATX_CTRL_ENABLE, ENET_CTRL_ENABLE, ETH_HLEN, MAC_CTRL_CRC32_ENAB, MAC_CTRL_PHY_LEDCTRL, MIB_CTRL_CLR_ON_READ, RCV_LAZY_FC_SHIFT, RX_HEADER_LEN, TX_HIWMARK_DEFLT, val, and VIRT_TO_B44.
Referenced by b44_open(), and b44_poll().
|
static |
Definition at line 379 of file b44.c.
References addr, B44_DMARX_PTR, B44_RING_LAST, bp, bw32(), cpu_to_le32, ctrl, DESC_CTRL_EOT, DESC_CTRL_LEN, rx_header::flags, rx_header::len, RX_PKT_BUF_SZ, RX_PKT_OFFSET, and VIRT_TO_B44.
Referenced by b44_init_rx_ring(), and b44_rx_refill().
|
static |
Definition at line 404 of file b44.c.
References alloc_iob(), b44_address_ok(), b44_populate_rx_descriptor(), bp, io_buffer::data, DBG, free_iob(), NULL, pending, ring_next(), and RX_PKT_BUF_SZ.
Referenced by b44_init_rx_ring(), and b44_process_rx_packets().
|
static |
Definition at line 431 of file b44.c.
References B44_RING_SIZE, B44_RX_RING_LEN_BYTES, bp, free_iob(), free_phys(), and NULL.
Referenced by b44_close(), and b44_init_rx_ring().
|
static |
Definition at line 446 of file b44.c.
References alloc_iob(), b44_address_ok(), B44_DMA_ALIGNMENT, b44_free_rx_ring(), b44_populate_rx_descriptor(), b44_rx_refill(), B44_RX_RING_LEN_BYTES, bp, DBG, ENOMEM, ENOTSUP, free_phys(), malloc_phys(), memset(), RX_PKT_BUF_SZ, and VIRT_TO_B44.
Referenced by b44_open(), and b44_poll().
|
static |
Definition at line 469 of file b44.c.
References B44_TX_RING_LEN_BYTES, bp, free_phys(), and NULL.
Referenced by b44_close(), and b44_init_tx_ring().
|
static |
Definition at line 478 of file b44.c.
References b44_address_ok(), B44_DMA_ALIGNMENT, b44_free_tx_ring(), B44_TX_RING_LEN_BYTES, bp, DBG, ENOMEM, ENOTSUP, free_phys(), malloc_phys(), memset(), and VIRT_TO_B44.
Referenced by b44_open(), and b44_poll().
|
static |
Definition at line 501 of file b44.c.
References arg1, arg2, arg3, arg4, B44_EMAC_ISTAT, B44_MDIO_DATA, b44_wait_bit(), bp, br32(), bw32(), EMAC_INT_MII, MDIO_DATA_DATA, MDIO_DATA_OP_SHIFT, MDIO_DATA_PMD_SHIFT, MDIO_DATA_RA_SHIFT, MDIO_DATA_SB_START, MDIO_DATA_TA_SHIFT, MDIO_OP_READ, MDIO_TA_VALID, reg, and val.
Referenced by b44_phy_reset().
|
static |
Definition at line 520 of file b44.c.
References arg1, arg2, arg3, arg4, arg5, B44_EMAC_ISTAT, B44_MDIO_DATA, b44_wait_bit(), bp, bw32(), EMAC_INT_MII, MDIO_DATA_DATA, MDIO_DATA_OP_SHIFT, MDIO_DATA_PMD_SHIFT, MDIO_DATA_RA_SHIFT, MDIO_DATA_SB_START, MDIO_DATA_TA_SHIFT, MDIO_OP_WRITE, MDIO_TA_VALID, reg, and val.
Referenced by b44_phy_reset().
|
static |
Definition at line 536 of file b44.c.
References b44_phy_read(), b44_phy_write(), BMCR_RESET, bp, ENODEV, MII_BMCR, udelay(), and val.
Referenced by b44_init_hw().
|
static |
Definition at line 561 of file b44.c.
References B44_CAM_CTRL, B44_CAM_DATA_HI, B44_CAM_DATA_LO, b44_wait_bit(), bp, bw32(), CAM_CTRL_BUSY, CAM_CTRL_INDEX_SHIFT, CAM_CTRL_WRITE, CAM_DATA_HI_VALID, data, index, u32, and val.
Referenced by b44_set_mac_addr(), and b44_set_rx_mode().
|
static |
Definition at line 585 of file b44.c.
References B44_CAM_CTRL, b44_cam_write(), bp, br32(), bw32(), CAM_CTRL_ENABLE, and val.
Referenced by b44_set_rx_mode().
|
static |
Definition at line 596 of file b44.c.
References bp, cpu_to_le16, data, and readw().
Referenced by b44_load_mac_and_phy_addr().
|
static |
Definition at line 606 of file b44.c.
References b44_read_eeprom(), and bp.
Referenced by b44_probe().
|
static |
Definition at line 624 of file b44.c.
References B44_CAM_CTRL, b44_cam_write(), B44_RXCONFIG, b44_set_mac_addr(), bp, br32(), bw32(), CAM_CTRL_ENABLE, netdev, net_device::priv, RXCONFIG_ALLMULTI, RXCONFIG_PROMISC, and val.
Referenced by b44_init_hw().
|
static |
Probe device.
| pci | PCI device |
| id | Matching entry in ID table |
| rc | Return status code |
Definition at line 655 of file b44.c.
References adjust_pci_device(), alloc_etherdev(), b44_chip_reset(), B44_CHIP_RESET_FULL, b44_load_mac_and_phy_addr(), b44_operations, B44_REGS_SIZE, bp, DBG, pci_device::dev, net_device::dev, pci_device_id::device, ENOMEM, eth_ntoa(), pci_device::id, iounmap(), net_device::ll_addr, pci_device::membase, memset(), pci_device_id::name, netdev, netdev_init(), netdev_link_up(), netdev_put(), b44_private::pci, pci_ioremap(), pci_set_drvdata(), net_device::priv, rc, register_netdev(), and pci_device_id::vendor.
|
static |
Remove device.
| pci | PCI device |
Definition at line 713 of file b44.c.
References bp, iounmap(), netdev, netdev_nullify(), netdev_put(), pci_get_drvdata(), net_device::priv, ssb_core_disable(), and unregister_netdev().
|
static |
Enable or disable interrupts.
| netdev | Network device |
| enable | Interrupts should be enabled |
Definition at line 731 of file b44.c.
References B44_IMASK, bp, bw32(), IMASK_DEF, IMASK_DISABLE, netdev, and net_device::priv.
Referenced by b44_open(), and b44_poll().
|
static |
Open network device.
| netdev | Network device |
| rc | Return status code |
Definition at line 745 of file b44.c.
References B44_FULL_RESET, b44_init_hw(), b44_init_rx_ring(), b44_init_tx_ring(), b44_irq(), bp, netdev, net_device::priv, and rc.
|
static |
Close network device.
| netdev | Network device |
Definition at line 771 of file b44.c.
References b44_chip_reset(), b44_free_rx_ring(), b44_free_tx_ring(), B44_FULL_RESET, bp, netdev, and net_device::priv.
|
static |
Transmit packet.
| netdev | Network device |
| iobuf | I/O buffer |
| rc | Return status code |
Definition at line 787 of file b44.c.
References b44_address_ok(), B44_DMATX_PTR, B44_RING_LAST, bp, bw32(), cpu_to_le32, ctrl, io_buffer::data, DBG, DESC_CTRL_EOF, DESC_CTRL_EOT, DESC_CTRL_IOC, DESC_CTRL_LEN, DESC_CTRL_SOF, ENOBUFS, ENOTSUP, iob_len(), netdev, net_device::priv, ring_next(), VIRT_TO_B44, and wmb().
|
static |
Recycles sent TX descriptors and notifies network stack.
| bp | Driver state |
Definition at line 831 of file b44.c.
References bp, netdev_tx_complete(), NULL, pending_tx_index(), and ring_next().
Referenced by b44_poll().
|
static |
Definition at line 850 of file b44.c.
References b44_rx_refill(), bp, cpu_to_le16, io_buffer::data, DBG, EINVAL, rx_header::flags, iob_put, iob_reserve, le16_to_cpu, len, rx_header::len, netdev_rx(), netdev_rx_err(), NULL, pending, pending_rx_index(), ring_next(), RX_FLAG_ERRORS, RX_PKT_BUF_SZ, and RX_PKT_OFFSET.
Referenced by b44_poll().
|
static |
Poll for completed and received packets.
| netdev | Network device |
Definition at line 907 of file b44.c.
References B44_FULL_RESET_SKIP_PHY, b44_halt(), b44_init_hw(), b44_init_rx_ring(), b44_init_tx_ring(), b44_irq(), B44_ISTAT, b44_process_rx_packets(), b44_tx_complete(), bflush(), bp, br32(), bw32(), DBG, IMASK_DEF, ISTAT_ERRORS, ISTAT_RX, ISTAT_TX, netdev, and net_device::priv.
|
static |
Definition at line 939 of file b44.c.
Referenced by b44_probe().
|
static |
| struct pci_driver b44_driver __pci_driver |
1.8.15