iPXE
Macros | Functions | Variables
b44.c File Reference
#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
 

Macro Definition Documentation

◆ VIRT_TO_B44

#define VIRT_TO_B44 (   addr)    ( virt_to_bus(addr) + SB_PCI_DMA )

Definition at line 79 of file b44.c.

◆ CTRL_MASK

#define CTRL_MASK   (DMARX_CTRL_ENABLE | (RX_PKT_OFFSET << DMARX_CTRL_ROSHIFT))

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER  )

◆ ring_next()

static int ring_next ( int  index)
inlinestatic

Definition at line 51 of file b44.c.

52 {
53  /* B44_RING_SIZE is a power of 2 :) */
54  return (index + 1) & (B44_RING_SIZE - 1);
55 }
long index
Definition: bigint.h:62
#define B44_RING_SIZE
Definition: b44.h:398

References B44_RING_SIZE, and index.

Referenced by b44_process_rx_packets(), b44_rx_refill(), b44_transmit(), and b44_tx_complete().

◆ br32()

static u32 br32 ( const struct b44_private bp,
u32  reg 
)
inlinestatic

Definition at line 60 of file b44.c.

61 {
62  return readl(bp->regs + reg);
63 }
static unsigned int unsigned int reg
Definition: myson.h:162
uint32_t readl(volatile uint32_t *io_addr)
Read 32-bit dword from memory-mapped device.
uint16_t bp
Definition: registers.h:23

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().

◆ bw32()

static void bw32 ( const struct b44_private bp,
u32  reg,
u32  val 
)
inlinestatic

Definition at line 66 of file b44.c.

67 {
68  writel(val, bp->regs + reg);
69 }
static unsigned int unsigned int reg
Definition: myson.h:162
void __asmcall int val
Definition: setjmp.h:12
uint16_t bp
Definition: registers.h:23
void writel(uint32_t data, volatile uint32_t *io_addr)
Write 32-bit dword to memory-mapped device.

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().

◆ bflush()

static void bflush ( const struct b44_private bp,
u32  reg,
u32  timeout 
)
inlinestatic

Definition at line 72 of file b44.c.

73 {
74  readl(bp->regs + reg);
75  udelay(timeout);
76 }
static unsigned int unsigned int reg
Definition: myson.h:162
uint32_t readl(volatile uint32_t *io_addr)
Read 32-bit dword from memory-mapped device.
uint16_t bp
Definition: registers.h:23
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition: timer.c:60
void timeout(int)

References bp, readl(), reg, timeout(), and udelay().

Referenced by b44_chip_reset(), b44_halt(), b44_poll(), ssb_core_disable(), and ssb_core_reset().

◆ b44_address_ok()

static int b44_address_ok ( void *  address)
inlinestatic

Check if card can access address.

Parameters
addressVirtual address
address_okCard can access address

Definition at line 89 of file b44.c.

89  {
90 
91  /* Card can address anything with a 30-bit address */
92  if ( ( virt_to_bus ( address ) & ~B44_30BIT_DMA_MASK ) == 0 )
93  return 1;
94 
95  return 0;
96 }
uint64_t address
Base address.
Definition: ena.h:24
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
Definition: io.h:183
#define B44_30BIT_DMA_MASK
Definition: b44.h:360

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().

◆ pending_tx_index()

static u32 pending_tx_index ( struct b44_private bp)
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.

103 {
106 
107  pending /= sizeof(struct dma_desc);
108  return pending & (B44_RING_SIZE - 1);
109 }
#define B44_DMATX_STAT
Definition: b44.h:111
#define DMATX_STAT_CDMASK
Definition: b44.h:112
uint16_t bp
Definition: registers.h:23
uint32_t pending
Pending events.
Definition: hyperv.h:12
static u32 br32(const struct b44_private *bp, u32 reg)
Definition: b44.c:60
#define B44_RING_SIZE
Definition: b44.h:398
uint32_t u32
Definition: stdint.h:23
Definition: b44.h:348

References B44_DMATX_STAT, B44_RING_SIZE, bp, br32(), DMATX_STAT_CDMASK, and pending.

Referenced by b44_tx_complete().

◆ pending_rx_index()

static u32 pending_rx_index ( struct b44_private bp)
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.

117 {
120 
121  pending /= sizeof(struct dma_desc);
122  return pending & (B44_RING_SIZE - 1);
123 }
uint16_t bp
Definition: registers.h:23
uint32_t pending
Pending events.
Definition: hyperv.h:12
#define DMARX_STAT_CDMASK
Definition: b44.h:133
static u32 br32(const struct b44_private *bp, u32 reg)
Definition: b44.c:60
#define B44_RING_SIZE
Definition: b44.h:398
#define B44_DMARX_STAT
Definition: b44.h:132
uint32_t u32
Definition: stdint.h:23
Definition: b44.h:348

References B44_DMARX_STAT, B44_RING_SIZE, bp, br32(), DMARX_STAT_CDMASK, and pending.

Referenced by b44_process_rx_packets().

◆ b44_wait_bit()

static int b44_wait_bit ( struct b44_private bp,
unsigned long  reg,
u32  bit,
unsigned long  timeout,
const int  clear 
)
static

Wait until the given bit is set/cleared.

Definition at line 129 of file b44.c.

131 {
132  unsigned long i;
133 
134  for (i = 0; i < timeout; i++) {
135  u32 val = br32(bp, reg);
136 
137  if (clear && !(val & bit))
138  break;
139 
140  if (!clear && (val & bit))
141  break;
142 
143  udelay(10);
144  }
145  if (i == timeout) {
146  return -ENODEV;
147  }
148  return 0;
149 }
static unsigned int unsigned int reg
Definition: myson.h:162
void __asmcall int val
Definition: setjmp.h:12
uint16_t bp
Definition: registers.h:23
static unsigned int unsigned int bit
Definition: bigint.h:391
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition: timer.c:60
static u32 br32(const struct b44_private *bp, u32 reg)
Definition: b44.c:60
#define ENODEV
No such device.
Definition: errno.h:509
struct option_descriptor clear[0]
Definition: nvo_cmd.c:113
void timeout(int)
uint32_t u32
Definition: stdint.h:23

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().

◆ ssb_get_core_rev()

static u32 ssb_get_core_rev ( struct b44_private bp)
inlinestatic

Definition at line 164 of file b44.c.

165 {
166  return (br32(bp, B44_SBIDHIGH) & SBIDHIGH_RC_MASK);
167 }
uint16_t bp
Definition: registers.h:23
static u32 br32(const struct b44_private *bp, u32 reg)
Definition: b44.c:60
#define SBIDHIGH_RC_MASK
Definition: b44.h:300
#define B44_SBIDHIGH
Definition: b44.h:299

References B44_SBIDHIGH, bp, br32(), and SBIDHIGH_RC_MASK.

Referenced by ssb_pci_setup().

◆ ssb_is_core_up()

static int ssb_is_core_up ( struct b44_private bp)
inlinestatic

Definition at line 170 of file b44.c.

171 {
173  == SBTMSLOW_CLOCK);
174 }
#define SBTMSLOW_CLOCK
Definition: b44.h:288
uint16_t bp
Definition: registers.h:23
#define SSB_CORE_DOWN
Definition: b44.h:413
static u32 br32(const struct b44_private *bp, u32 reg)
Definition: b44.c:60
#define B44_SBTMSLOW
Definition: b44.h:285

References B44_SBTMSLOW, bp, br32(), SBTMSLOW_CLOCK, and SSB_CORE_DOWN.

Referenced by b44_chip_reset().

◆ ssb_pci_setup()

static u32 ssb_pci_setup ( struct b44_private bp,
u32  cores 
)
static

Definition at line 177 of file b44.c.

178 {
179  u32 bar_orig, pci_rev, val;
180 
181  pci_read_config_dword(bp->pci, SSB_BAR0_WIN, &bar_orig);
184  pci_rev = ssb_get_core_rev(bp);
185 
186  val = br32(bp, B44_SBINTVEC);
187  val |= cores;
188  bw32(bp, B44_SBINTVEC, val);
189 
193 
194  pci_write_config_dword(bp->pci, SSB_BAR0_WIN, bar_orig);
195 
196  return pci_rev;
197 }
#define SSB_PCI_TRANS_2
Definition: b44.h:324
#define SSB_BAR0_WIN
Definition: b44.h:309
static u32 ssb_get_core_rev(struct b44_private *bp)
Definition: b44.c:164
void __asmcall int val
Definition: setjmp.h:12
uint16_t bp
Definition: registers.h:23
static void bw32(const struct b44_private *bp, u32 reg, u32 val)
Definition: b44.c:66
int pci_read_config_dword(struct pci_device *pci, unsigned int where, uint32_t *value)
Read 32-bit dword from PCI configuration space.
#define SSB_PCI_PREF
Definition: b44.h:331
#define SSB_PCI_BURST
Definition: b44.h:332
static u32 br32(const struct b44_private *bp, u32 reg)
Definition: b44.c:60
#define BCM4400_PCI_CORE_ADDR
Definition: b44.h:392
int pci_write_config_dword(struct pci_device *pci, unsigned int where, uint32_t value)
Write 32-bit dword to PCI configuration space.
#define B44_SBINTVEC
Definition: b44.h:277
uint32_t u32
Definition: stdint.h:23

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().

◆ ssb_core_disable()

static void ssb_core_disable ( struct b44_private bp)
static

Definition at line 200 of file b44.c.

201 {
203  return;
204 
208 
210  SSB_CORE_DOWN));
211  bflush(bp, B44_SBTMSLOW, 1);
212 
214  bflush(bp, B44_SBTMSLOW, 1);
215 }
static void bflush(const struct b44_private *bp, u32 reg, u32 timeout)
Definition: b44.c:72
#define SBTMSLOW_CLOCK
Definition: b44.h:288
#define SBTMSLOW_REJECT
Definition: b44.h:287
uint16_t bp
Definition: registers.h:23
#define SBTMSLOW_FGC
Definition: b44.h:289
static void bw32(const struct b44_private *bp, u32 reg, u32 val)
Definition: b44.c:66
#define SSB_CORE_DOWN
Definition: b44.h:413
static u32 br32(const struct b44_private *bp, u32 reg)
Definition: b44.c:60
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.
Definition: b44.c:129
#define B44_SBTMSHIGH
Definition: b44.h:292
#define SBTMSHIGH_BUSY
Definition: b44.h:295
#define SBTMSLOW_RESET
Definition: b44.h:286
#define B44_SBTMSLOW
Definition: b44.h:285

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().

◆ ssb_core_reset()

static void ssb_core_reset ( struct b44_private bp)
static

Definition at line 218 of file b44.c.

219 {
220  u32 val;
221  const u32 mask = (SBTMSLOW_CLOCK | SBTMSLOW_FGC | SBTMSLOW_RESET);
222 
224 
225  bw32(bp, B44_SBTMSLOW, mask);
226  bflush(bp, B44_SBTMSLOW, 1);
227 
228  /* Clear SERR if set, this is a hw bug workaround. */
230  bw32(bp, B44_SBTMSHIGH, 0);
231 
232  val = br32(bp, B44_SBIMSTATE);
233  if (val & (SBIMSTATE_BAD)) {
235  }
236 
238  bflush(bp, B44_SBTMSLOW, 1);
239 
241  bflush(bp, B44_SBTMSLOW, 1);
242 }
#define SBTMSHIGH_SERR
Definition: b44.h:293
void __asmcall int val
Definition: setjmp.h:12
static void bflush(const struct b44_private *bp, u32 reg, u32 timeout)
Definition: b44.c:72
#define SBTMSLOW_CLOCK
Definition: b44.h:288
uint16_t bp
Definition: registers.h:23
#define SBTMSLOW_FGC
Definition: b44.h:289
static void bw32(const struct b44_private *bp, u32 reg, u32 val)
Definition: b44.c:66
static void ssb_core_disable(struct b44_private *bp)
Definition: b44.c:200
static u32 br32(const struct b44_private *bp, u32 reg)
Definition: b44.c:60
#define B44_SBTMSHIGH
Definition: b44.h:292
#define SBIMSTATE_BAD
Definition: b44.h:276
#define B44_SBIMSTATE
Definition: b44.h:267
#define SBTMSLOW_RESET
Definition: b44.h:286
#define B44_SBTMSLOW
Definition: b44.h:285
uint32_t u32
Definition: stdint.h:23

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().

◆ b44_chip_reset()

static void b44_chip_reset ( struct b44_private bp,
int  reset_kind 
)
static

Definition at line 258 of file b44.c.

259 {
260  if (ssb_is_core_up(bp)) {
261  bw32(bp, B44_RCV_LAZY, 0);
262 
264 
266 
267  bw32(bp, B44_DMATX_CTRL, 0);
268 
269  bp->tx_dirty = bp->tx_cur = 0;
270 
273  100, 0);
274 
275  bw32(bp, B44_DMARX_CTRL, 0);
276 
277  bp->rx_cur = 0;
278  } else {
280  }
281 
283 
284  /* Don't enable PHY if we are only doing a partial reset. */
285  if (reset_kind == B44_CHIP_RESET_PARTIAL)
286  return;
287 
288  /* Make PHY accessible. */
291  bflush(bp, B44_MDIO_CTRL, 1);
292 
293  /* Enable internal or external PHY */
294  if (!(br32(bp, B44_DEVCTRL) & DEVCTRL_IPP)) {
296  bflush(bp, B44_ENET_CTRL, 1);
297  } else {
298  u32 val = br32(bp, B44_DEVCTRL);
299  if (val & DEVCTRL_EPR) {
301  bflush(bp, B44_DEVCTRL, 100);
302  }
303  }
304 }
#define ENET_CTRL_EPSEL
Definition: b44.h:208
void __asmcall int val
Definition: setjmp.h:12
static void bflush(const struct b44_private *bp, u32 reg, u32 timeout)
Definition: b44.c:72
#define DMARX_STAT_EMASK
Definition: b44.h:139
#define MDIO_CTRL_PREAMBLE
Definition: b44.h:171
#define DMARX_STAT_SIDLE
Definition: b44.h:137
uint16_t bp
Definition: registers.h:23
#define B44_ENET_CTRL
Definition: b44.h:204
static void bw32(const struct b44_private *bp, u32 reg, u32 val)
Definition: b44.c:66
#define B44_RCV_LAZY
Definition: b44.h:99
static void ssb_core_reset(struct b44_private *bp)
Definition: b44.c:218
#define B44_DMARX_CTRL
Definition: b44.h:126
#define ENET_CTRL_DISABLE
Definition: b44.h:206
static u32 br32(const struct b44_private *bp, u32 reg)
Definition: b44.c:60
#define B44_MDIO_CTRL
Definition: b44.h:169
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.
Definition: b44.c:129
#define SBINTVEC_ENET0
Definition: b44.h:279
#define B44_DEVCTRL
Definition: b44.h:38
#define B44_DMARX_STAT
Definition: b44.h:132
#define MDIO_CTRL_MAXF_MASK
Definition: b44.h:170
#define DEVCTRL_EPR
Definition: b44.h:42
static u32 ssb_pci_setup(struct b44_private *bp, u32 cores)
Definition: b44.c:177
static int ssb_is_core_up(struct b44_private *bp)
Definition: b44.c:170
#define B44_DMATX_CTRL
Definition: b44.h:103
uint32_t u32
Definition: stdint.h:23
#define DEVCTRL_IPP
Definition: b44.h:41
#define B44_CHIP_RESET_PARTIAL
Definition: b44.h:411

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().

◆ b44_halt()

static void b44_halt ( struct b44_private bp)
static

called by b44_poll in the error path

Definition at line 310 of file b44.c.

311 {
312  /* disable ints */
313  bw32(bp, B44_IMASK, 0);
314  bflush(bp, B44_IMASK, 1);
315 
316  DBG("b44: powering down PHY\n");
318 
319  /*
320  * Now reset the chip, but without enabling
321  * the MAC&PHY part of it.
322  * This has to be done _after_ we shut down the PHY
323  */
325 }
static void b44_chip_reset(struct b44_private *bp, int reset_kind)
Definition: b44.c:258
static void bflush(const struct b44_private *bp, u32 reg, u32 timeout)
Definition: b44.c:72
uint16_t bp
Definition: registers.h:23
static void bw32(const struct b44_private *bp, u32 reg, u32 val)
Definition: b44.c:66
#define MAC_CTRL_PHY_PDOWN
Definition: b44.h:92
#define B44_MAC_CTRL
Definition: b44.h:90
#define B44_IMASK
Definition: b44.h:80
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
#define B44_CHIP_RESET_PARTIAL
Definition: b44.h:411

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().

◆ b44_init_hw()

static void b44_init_hw ( struct b44_private bp,
int  reset_kind 
)
static

Definition at line 335 of file b44.c.

336 {
337  u32 val;
338 #define CTRL_MASK (DMARX_CTRL_ENABLE | (RX_PKT_OFFSET << DMARX_CTRL_ROSHIFT))
339 
341  if (reset_kind == B44_FULL_RESET) {
342  b44_phy_reset(bp);
343  }
344 
345  /* Enable CRC32, set proper LED modes and power on PHY */
348 
349  /* This sets the MAC address too. */
350  b44_set_rx_mode(bp->netdev);
351 
352  /* MTU + eth header + possible VLAN tag + struct rx_header */
355 
357  if (reset_kind == B44_PARTIAL_RESET) {
359  } else {
362 
366 
368  }
369 
370  val = br32(bp, B44_ENET_CTRL);
372 #undef CTRL_MASK
373 }
#define B44_DMATX_ADDR
Definition: b44.h:109
static void b44_chip_reset(struct b44_private *bp, int reset_kind)
Definition: b44.c:258
void __asmcall int val
Definition: setjmp.h:12
#define B44_MIB_CTRL
Definition: b44.h:216
uint16_t bp
Definition: registers.h:23
#define B44_ENET_CTRL
Definition: b44.h:204
#define B44_RXMAXLEN
Definition: b44.h:167
static void bw32(const struct b44_private *bp, u32 reg, u32 val)
Definition: b44.c:66
#define VIRT_TO_B44(addr)
Definition: b44.c:79
#define B44_FULL_RESET
Definition: b44.h:407
#define B44_RCV_LAZY
Definition: b44.h:99
static void b44_set_rx_mode(struct net_device *netdev)
Definition: b44.c:624
#define ETH_HLEN
Definition: if_ether.h:9
#define MAC_CTRL_PHY_LEDCTRL
Definition: b44.h:94
#define B44_DMARX_CTRL
Definition: b44.h:126
#define B44_MAC_CTRL
Definition: b44.h:90
static int b44_phy_reset(struct b44_private *bp)
Definition: b44.c:536
static u32 br32(const struct b44_private *bp, u32 reg)
Definition: b44.c:60
#define B44_TXMAXLEN
Definition: b44.h:168
#define B44_DMARX_ADDR
Definition: b44.h:130
#define B44_PARTIAL_RESET
Definition: b44.h:409
#define RX_HEADER_LEN
Definition: b44.h:374
#define B44_CHIP_RESET_FULL
Definition: b44.h:410
#define B44_TX_HIWMARK
Definition: b44.h:214
#define TX_HIWMARK_DEFLT
Definition: b44.h:215
#define B44_DMARX_PTR
Definition: b44.h:131
#define B44_MAX_MTU
Definition: b44.h:396
#define ENET_CTRL_ENABLE
Definition: b44.h:205
#define B44_RX_RING_LEN_BYTES
Definition: b44.h:401
#define MAC_CTRL_CRC32_ENAB
Definition: b44.h:91
#define MIB_CTRL_CLR_ON_READ
Definition: b44.h:217
#define RCV_LAZY_FC_SHIFT
Definition: b44.h:102
#define CTRL_MASK
#define B44_DMATX_CTRL
Definition: b44.h:103
#define DMATX_CTRL_ENABLE
Definition: b44.h:104
uint32_t u32
Definition: stdint.h:23

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().

◆ b44_populate_rx_descriptor()

static void b44_populate_rx_descriptor ( struct b44_private bp,
u32  idx 
)
static

Definition at line 379 of file b44.c.

380 {
381  struct rx_header *rh;
382  u32 ctrl, addr;
383 
384  rh = bp->rx_iobuf[idx]->data;
385  rh->len = 0;
386  rh->flags = 0;
388  if (idx == B44_RING_LAST) {
389  ctrl |= DESC_CTRL_EOT;
390  }
391  addr = VIRT_TO_B44(bp->rx_iobuf[idx]->data);
392 
393  bp->rx[idx].ctrl = cpu_to_le32(ctrl);
394  bp->rx[idx].addr = cpu_to_le32(addr);
395  bw32(bp, B44_DMARX_PTR, idx * sizeof(struct dma_desc));
396 }
#define RX_PKT_OFFSET
Definition: b44.h:404
Definition: b44.h:369
uint16_t bp
Definition: registers.h:23
static void bw32(const struct b44_private *bp, u32 reg, u32 val)
Definition: b44.c:66
#define VIRT_TO_B44(addr)
Definition: b44.c:79
#define DESC_CTRL_LEN
Definition: b44.h:362
#define cpu_to_le32(value)
Definition: byteswap.h:107
uint32_t addr
Buffer address.
Definition: dwmac.h:20
u16 flags
Definition: b44.h:371
#define DESC_CTRL_EOT
Definition: b44.h:364
u16 len
Definition: b44.h:370
#define B44_DMARX_PTR
Definition: b44.h:131
uint8_t ctrl
Ring control.
Definition: dwmac.h:18
#define RX_PKT_BUF_SZ
Definition: b44.h:405
#define B44_RING_LAST
Definition: b44.h:399
uint32_t u32
Definition: stdint.h:23
Definition: b44.h:348

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().

◆ b44_rx_refill()

static void b44_rx_refill ( struct b44_private bp,
u32  pending 
)
static

Definition at line 404 of file b44.c.

405 {
406  struct io_buffer *iobuf;
407  u32 i;
408 
409  // skip pending
410  for (i = pending + 1; i != bp->rx_cur; i = ring_next(i)) {
411  if (bp->rx_iobuf[i] != NULL)
412  continue;
413 
414  iobuf = alloc_iob(RX_PKT_BUF_SZ);
415  if (!iobuf) {
416  DBG("Refill rx ring failed!!\n");
417  break;
418  }
419  if (!b44_address_ok(iobuf->data)) {
420  DBG("Refill rx ring bad address!!\n");
421  free_iob(iobuf);
422  break;
423  }
424  bp->rx_iobuf[i] = iobuf;
425 
427  }
428 }
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition: iobuf.c:152
uint16_t bp
Definition: registers.h:23
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
Definition: iobuf.c:130
static int ring_next(int index)
Definition: b44.c:51
uint32_t pending
Pending events.
Definition: hyperv.h:12
void * data
Start of data.
Definition: iobuf.h:52
static int b44_address_ok(void *address)
Check if card can access address.
Definition: b44.c:89
static void b44_populate_rx_descriptor(struct b44_private *bp, u32 idx)
Definition: b44.c:379
#define RX_PKT_BUF_SZ
Definition: b44.h:405
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
uint32_t u32
Definition: stdint.h:23
A persistent I/O buffer.
Definition: iobuf.h:37

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().

◆ b44_free_rx_ring()

static void b44_free_rx_ring ( struct b44_private bp)
static

Definition at line 431 of file b44.c.

432 {
433  u32 i;
434 
435  if (bp->rx) {
436  for (i = 0; i < B44_RING_SIZE; i++) {
437  free_iob(bp->rx_iobuf[i]);
438  bp->rx_iobuf[i] = NULL;
439  }
441  bp->rx = NULL;
442  }
443 }
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition: iobuf.c:152
uint16_t bp
Definition: registers.h:23
#define B44_RING_SIZE
Definition: b44.h:398
void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
Definition: malloc.c:722
#define B44_RX_RING_LEN_BYTES
Definition: b44.h:401
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
uint32_t u32
Definition: stdint.h:23

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().

◆ b44_init_rx_ring()

static int b44_init_rx_ring ( struct b44_private bp)
static

Definition at line 446 of file b44.c.

447 {
449 
451  if (!bp->rx)
452  return -ENOMEM;
453  if (!b44_address_ok(bp->rx)) {
455  return -ENOTSUP;
456  }
457 
458  memset(bp->rx_iobuf, 0, sizeof(bp->rx_iobuf));
459 
460  bp->rx_iobuf[0] = alloc_iob(RX_PKT_BUF_SZ);
462  b44_rx_refill(bp, 0);
463 
464  DBG("Init RX rings: rx=0x%08lx\n", VIRT_TO_B44(bp->rx));
465  return 0;
466 }
uint16_t bp
Definition: registers.h:23
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
Definition: iobuf.c:130
#define VIRT_TO_B44(addr)
Definition: b44.c:79
#define ENOTSUP
Operation not supported.
Definition: errno.h:589
#define ENOMEM
Not enough space.
Definition: errno.h:534
static void b44_free_rx_ring(struct b44_private *bp)
Definition: b44.c:431
static void b44_rx_refill(struct b44_private *bp, u32 pending)
Definition: b44.c:404
#define B44_DMA_ALIGNMENT
Definition: b44.h:356
void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
Definition: malloc.c:722
static int b44_address_ok(void *address)
Check if card can access address.
Definition: b44.c:89
static void b44_populate_rx_descriptor(struct b44_private *bp, u32 idx)
Definition: b44.c:379
#define RX_PKT_BUF_SZ
Definition: b44.h:405
#define B44_RX_RING_LEN_BYTES
Definition: b44.h:401
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
void * malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
Definition: malloc.c:706
void * memset(void *dest, int character, size_t len) __nonnull

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().

◆ b44_free_tx_ring()

static void b44_free_tx_ring ( struct b44_private bp)
static

Definition at line 469 of file b44.c.

470 {
471  if (bp->tx) {
473  bp->tx = NULL;
474  }
475 }
uint16_t bp
Definition: registers.h:23
#define B44_TX_RING_LEN_BYTES
Definition: b44.h:402
void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
Definition: malloc.c:722
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321

References B44_TX_RING_LEN_BYTES, bp, free_phys(), and NULL.

Referenced by b44_close(), and b44_init_tx_ring().

◆ b44_init_tx_ring()

static int b44_init_tx_ring ( struct b44_private bp)
static

Definition at line 478 of file b44.c.

479 {
481 
483  if (!bp->tx)
484  return -ENOMEM;
485  if (!b44_address_ok(bp->tx)) {
487  return -ENOTSUP;
488  }
489 
491  memset(bp->tx_iobuf, 0, sizeof(bp->tx_iobuf));
492 
493  DBG("Init TX rings: tx=0x%08lx\n", VIRT_TO_B44(bp->tx));
494  return 0;
495 }
uint16_t bp
Definition: registers.h:23
#define VIRT_TO_B44(addr)
Definition: b44.c:79
#define ENOTSUP
Operation not supported.
Definition: errno.h:589
#define ENOMEM
Not enough space.
Definition: errno.h:534
#define B44_TX_RING_LEN_BYTES
Definition: b44.h:402
#define B44_DMA_ALIGNMENT
Definition: b44.h:356
static void b44_free_tx_ring(struct b44_private *bp)
Definition: b44.c:469
void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
Definition: malloc.c:722
static int b44_address_ok(void *address)
Check if card can access address.
Definition: b44.c:89
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
void * malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
Definition: malloc.c:706
void * memset(void *dest, int character, size_t len) __nonnull

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().

◆ b44_phy_read()

static int b44_phy_read ( struct b44_private bp,
int  reg,
u32 val 
)
static

Definition at line 501 of file b44.c.

502 {
503  int err;
504 
506  u32 arg2 = (bp->phy_addr << MDIO_DATA_PMD_SHIFT);
509  u32 argv = arg1 | arg2 | arg3 | arg4;
510 
513  err = b44_wait_bit(bp, B44_EMAC_ISTAT, EMAC_INT_MII, 100, 0);
515 
516  return err;
517 }
static unsigned int unsigned int reg
Definition: myson.h:162
static unsigned int unsigned long unsigned long unsigned long unsigned long arg4
Definition: xen.h:118
#define MDIO_DATA_OP_SHIFT
Definition: b44.h:182
void __asmcall int val
Definition: setjmp.h:12
#define B44_EMAC_ISTAT
Definition: b44.h:189
#define MDIO_DATA_RA_SHIFT
Definition: b44.h:178
uint16_t bp
Definition: registers.h:23
static void bw32(const struct b44_private *bp, u32 reg, u32 val)
Definition: b44.c:66
static unsigned int unsigned long arg1
Definition: xen.h:43
#define MDIO_TA_VALID
Definition: b44.h:176
#define MDIO_DATA_DATA
Definition: b44.h:173
#define B44_MDIO_DATA
Definition: b44.h:172
static u32 br32(const struct b44_private *bp, u32 reg)
Definition: b44.c:60
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.
Definition: b44.c:129
#define MDIO_DATA_SB_START
Definition: b44.h:187
#define EMAC_INT_MII
Definition: b44.h:190
#define MDIO_DATA_PMD_SHIFT
Definition: b44.h:180
static unsigned int unsigned long unsigned long arg2
Definition: xen.h:66
static unsigned int unsigned long unsigned long unsigned long arg3
Definition: xen.h:90
#define MDIO_OP_READ
Definition: b44.h:184
uint32_t u32
Definition: stdint.h:23
#define MDIO_DATA_TA_SHIFT
Definition: b44.h:175

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().

◆ b44_phy_write()

static int b44_phy_write ( struct b44_private bp,
int  reg,
u32  val 
)
static

Definition at line 520 of file b44.c.

521 {
523  u32 arg2 = (bp->phy_addr << MDIO_DATA_PMD_SHIFT);
526  u32 arg5 = (val & MDIO_DATA_DATA);
527  u32 argv = arg1 | arg2 | arg3 | arg4 | arg5;
528 
529 
532  return b44_wait_bit(bp, B44_EMAC_ISTAT, EMAC_INT_MII, 100, 0);
533 }
static unsigned int unsigned int reg
Definition: myson.h:162
static unsigned int unsigned long unsigned long unsigned long unsigned long arg4
Definition: xen.h:118
#define MDIO_DATA_OP_SHIFT
Definition: b44.h:182
void __asmcall int val
Definition: setjmp.h:12
#define B44_EMAC_ISTAT
Definition: b44.h:189
#define MDIO_DATA_RA_SHIFT
Definition: b44.h:178
uint16_t bp
Definition: registers.h:23
static void bw32(const struct b44_private *bp, u32 reg, u32 val)
Definition: b44.c:66
static unsigned int unsigned long arg1
Definition: xen.h:43
#define MDIO_TA_VALID
Definition: b44.h:176
#define MDIO_DATA_DATA
Definition: b44.h:173
#define B44_MDIO_DATA
Definition: b44.h:172
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.
Definition: b44.c:129
#define MDIO_OP_WRITE
Definition: b44.h:183
#define MDIO_DATA_SB_START
Definition: b44.h:187
static unsigned int unsigned long unsigned long unsigned long unsigned long unsigned long arg5
Definition: xen.h:148
#define EMAC_INT_MII
Definition: b44.h:190
#define MDIO_DATA_PMD_SHIFT
Definition: b44.h:180
static unsigned int unsigned long unsigned long arg2
Definition: xen.h:66
static unsigned int unsigned long unsigned long unsigned long arg3
Definition: xen.h:90
uint32_t u32
Definition: stdint.h:23
#define MDIO_DATA_TA_SHIFT
Definition: b44.h:175

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().

◆ b44_phy_reset()

static int b44_phy_reset ( struct b44_private bp)
static

Definition at line 536 of file b44.c.

537 {
538  u32 val;
539  int err;
540 
542  if (err)
543  return err;
544 
545  udelay(100);
546  err = b44_phy_read(bp, MII_BMCR, &val);
547  if (!err) {
548  if (val & BMCR_RESET) {
549  return -ENODEV;
550  }
551  }
552 
553  return 0;
554 }
void __asmcall int val
Definition: setjmp.h:12
uint16_t bp
Definition: registers.h:23
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition: timer.c:60
#define ENODEV
No such device.
Definition: errno.h:509
#define MII_BMCR
Definition: atl1e.h:871
static int b44_phy_read(struct b44_private *bp, int reg, u32 *val)
Definition: b44.c:501
#define BMCR_RESET
Definition: mii.h:52
static int b44_phy_write(struct b44_private *bp, int reg, u32 val)
Definition: b44.c:520
uint32_t u32
Definition: stdint.h:23

References b44_phy_read(), b44_phy_write(), BMCR_RESET, bp, ENODEV, MII_BMCR, udelay(), and val.

Referenced by b44_init_hw().

◆ b44_cam_write()

static void b44_cam_write ( struct b44_private bp,
unsigned char *  data,
int  index 
)
static

Definition at line 561 of file b44.c.

563 {
564  u32 val;
565 
566  val = ((u32) data[2]) << 24;
567  val |= ((u32) data[3]) << 16;
568  val |= ((u32) data[4]) << 8;
569  val |= ((u32) data[5]) << 0;
571 
572 
574  (((u32) data[0]) << 8) | (((u32) data[1]) << 0));
575 
577 
579  bw32(bp, B44_CAM_CTRL, val);
580 
582 }
#define B44_CAM_DATA_HI
Definition: b44.h:194
#define B44_CAM_CTRL
Definition: b44.h:196
void __asmcall int val
Definition: setjmp.h:12
#define CAM_CTRL_INDEX_SHIFT
Definition: b44.h:202
long index
Definition: bigint.h:62
uint16_t bp
Definition: registers.h:23
static void bw32(const struct b44_private *bp, u32 reg, u32 val)
Definition: b44.c:66
#define CAM_CTRL_WRITE
Definition: b44.h:200
#define u32
Definition: vga.h:21
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.
Definition: b44.c:129
#define CAM_DATA_HI_VALID
Definition: b44.h:195
uint8_t data[48]
Additional event data.
Definition: ena.h:22
#define CAM_CTRL_BUSY
Definition: b44.h:203
#define B44_CAM_DATA_LO
Definition: b44.h:193
uint32_t u32
Definition: stdint.h:23

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().

◆ b44_set_mac_addr()

static void b44_set_mac_addr ( struct b44_private bp)
static

Definition at line 585 of file b44.c.

586 {
587  u32 val;
588  bw32(bp, B44_CAM_CTRL, 0);
589  b44_cam_write(bp, bp->netdev->ll_addr, 0);
590  val = br32(bp, B44_CAM_CTRL);
592 }
#define B44_CAM_CTRL
Definition: b44.h:196
void __asmcall int val
Definition: setjmp.h:12
uint16_t bp
Definition: registers.h:23
static void bw32(const struct b44_private *bp, u32 reg, u32 val)
Definition: b44.c:66
static void b44_cam_write(struct b44_private *bp, unsigned char *data, int index)
Definition: b44.c:561
static u32 br32(const struct b44_private *bp, u32 reg)
Definition: b44.c:60
#define CAM_CTRL_ENABLE
Definition: b44.h:197
uint32_t u32
Definition: stdint.h:23

References B44_CAM_CTRL, b44_cam_write(), bp, br32(), bw32(), CAM_CTRL_ENABLE, and val.

Referenced by b44_set_rx_mode().

◆ b44_read_eeprom()

static void b44_read_eeprom ( struct b44_private bp,
u8 data 
)
static

Definition at line 596 of file b44.c.

597 {
598  long i;
599  u16 *ptr = (u16 *) data;
600 
601  for (i = 0; i < 128; i += 2)
602  ptr[i / 2] = cpu_to_le16(readw(bp->regs + 4096 + i));
603 }
uint16_t u16
Definition: stdint.h:21
uint16_t readw(volatile uint16_t *io_addr)
Read 16-bit word from memory-mapped device.
uint16_t bp
Definition: registers.h:23
#define cpu_to_le16(value)
Definition: byteswap.h:106
uint8_t data[48]
Additional event data.
Definition: ena.h:22

References bp, cpu_to_le16, data, and readw().

Referenced by b44_load_mac_and_phy_addr().

◆ b44_load_mac_and_phy_addr()

static void b44_load_mac_and_phy_addr ( struct b44_private bp)
static

Definition at line 606 of file b44.c.

607 {
608  u8 eeprom[128];
609 
610  /* Load MAC address, note byteswapping */
611  b44_read_eeprom(bp, &eeprom[0]);
612  bp->netdev->hw_addr[0] = eeprom[79];
613  bp->netdev->hw_addr[1] = eeprom[78];
614  bp->netdev->hw_addr[2] = eeprom[81];
615  bp->netdev->hw_addr[3] = eeprom[80];
616  bp->netdev->hw_addr[4] = eeprom[83];
617  bp->netdev->hw_addr[5] = eeprom[82];
618 
619  /* Load PHY address */
620  bp->phy_addr = eeprom[90] & 0x1f;
621 }
static void b44_read_eeprom(struct b44_private *bp, u8 *data)
Definition: b44.c:596
uint16_t bp
Definition: registers.h:23
eeprom
Definition: 3c90x.h:232
uint8_t u8
Definition: stdint.h:19

References b44_read_eeprom(), and bp.

Referenced by b44_probe().

◆ b44_set_rx_mode()

static void b44_set_rx_mode ( struct net_device netdev)
static

Definition at line 624 of file b44.c.

625 {
626  struct b44_private *bp = netdev->priv;
627  unsigned char zero[6] = { 0, 0, 0, 0, 0, 0 };
628  u32 val;
629  int i;
630 
631  val = br32(bp, B44_RXCONFIG);
632  val &= ~RXCONFIG_PROMISC;
634 
636 
637  for (i = 1; i < 64; i++)
638  b44_cam_write(bp, zero, i);
639 
640  bw32(bp, B44_RXCONFIG, val);
641  val = br32(bp, B44_CAM_CTRL);
643 }
#define RXCONFIG_PROMISC
Definition: b44.h:162
#define B44_RXCONFIG
Definition: b44.h:158
#define B44_CAM_CTRL
Definition: b44.h:196
void __asmcall int val
Definition: setjmp.h:12
static void b44_set_mac_addr(struct b44_private *bp)
Definition: b44.c:585
uint16_t bp
Definition: registers.h:23
static void bw32(const struct b44_private *bp, u32 reg, u32 val)
Definition: b44.c:66
void * priv
Driver private data.
Definition: netdevice.h:431
#define RXCONFIG_ALLMULTI
Definition: b44.h:160
static struct net_device * netdev
Definition: gdbudp.c:52
static void b44_cam_write(struct b44_private *bp, unsigned char *data, int index)
Definition: b44.c:561
static u32 br32(const struct b44_private *bp, u32 reg)
Definition: b44.c:60
Driver private state.
Definition: b44.h:418
#define CAM_CTRL_ENABLE
Definition: b44.h:197
uint32_t u32
Definition: stdint.h:23

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().

◆ b44_probe()

static int b44_probe ( struct pci_device pci)
static

Probe device.

Parameters
pciPCI device
idMatching entry in ID table
Return values
rcReturn status code

Definition at line 655 of file b44.c.

656 {
657  struct net_device *netdev;
658  struct b44_private *bp;
659  int rc;
660 
661  /* Set up netdev */
662  netdev = alloc_etherdev(sizeof(*bp));
663  if (!netdev)
664  return -ENOMEM;
665 
668  netdev->dev = &pci->dev;
669 
670  /* Set up private data */
671  bp = netdev->priv;
672  memset(bp, 0, sizeof(*bp));
673  bp->netdev = netdev;
674  bp->pci = pci;
675 
676  /* Map device registers */
678  if (!bp->regs) {
680  return -ENOMEM;
681  }
682 
683  /* Enable PCI bus mastering */
685 
687 
689  if (rc != 0) {
690  iounmap(bp->regs);
692  return rc;
693  }
694 
695  /* Link management currently not implemented */
697 
699 
700  DBG("b44 %s (%04x:%04x) regs=%p MAC=%s\n", pci->id->name,
701  pci->id->vendor, pci->id->device, bp->regs,
703 
704  return 0;
705 }
unsigned long membase
Memory base.
Definition: pci.h:219
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
static void b44_chip_reset(struct b44_private *bp, int reset_kind)
Definition: b44.c:258
#define B44_REGS_SIZE
Definition: b44.h:415
uint16_t bp
Definition: registers.h:23
static void b44_load_mac_and_phy_addr(struct b44_private *bp)
Definition: b44.c:606
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
Definition: pci.c:240
struct device dev
Generic device.
Definition: pci.h:212
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
Definition: netdevice.h:518
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
Definition: pci.h:365
#define ENOMEM
Not enough space.
Definition: errno.h:534
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
Definition: netdevice.h:575
void * priv
Driver private data.
Definition: netdevice.h:431
static void netdev_link_up(struct net_device *netdev)
Mark network device as having link up.
Definition: netdevice.h:788
static struct net_device * netdev
Definition: gdbudp.c:52
int register_netdev(struct net_device *netdev)
Register network device.
Definition: netdevice.c:759
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
Definition: ethernet.c:175
A network device.
Definition: netdevice.h:352
Driver private state.
Definition: b44.h:418
const char * name
Name.
Definition: pci.h:176
struct device * dev
Underlying hardware device.
Definition: netdevice.h:364
static struct net_device_operations b44_operations
Definition: b44.c:939
#define B44_CHIP_RESET_FULL
Definition: b44.h:410
uint16_t vendor
PCI vendor ID.
Definition: pci.h:178
uint16_t device
PCI device ID.
Definition: pci.h:180
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
Definition: ethernet.c:264
struct pci_device_id * id
Driver device ID.
Definition: pci.h:247
void iounmap(volatile const void *io_addr)
Unmap I/O address.
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
Definition: netdevice.h:387
struct pci_device * pci
Definition: b44.h:420
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
void * memset(void *dest, int character, size_t len) __nonnull

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.

◆ b44_remove()

static void b44_remove ( struct pci_device pci)
static

Remove device.

Parameters
pciPCI device

Definition at line 713 of file b44.c.

714 {
715  struct net_device *netdev = pci_get_drvdata(pci);
716  struct b44_private *bp = netdev->priv;
717 
720  iounmap(bp->regs);
723 }
uint16_t bp
Definition: registers.h:23
static void ssb_core_disable(struct b44_private *bp)
Definition: b44.c:200
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
Definition: netdevice.h:575
void * priv
Driver private data.
Definition: netdevice.h:431
static struct net_device * netdev
Definition: gdbudp.c:52
void unregister_netdev(struct net_device *netdev)
Unregister network device.
Definition: netdevice.c:941
A network device.
Definition: netdevice.h:352
Driver private state.
Definition: b44.h:418
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
Definition: netdevice.h:531
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
Definition: pci.h:375
void iounmap(volatile const void *io_addr)
Unmap I/O address.

References bp, iounmap(), netdev, netdev_nullify(), netdev_put(), pci_get_drvdata(), net_device::priv, ssb_core_disable(), and unregister_netdev().

◆ b44_irq()

static void b44_irq ( struct net_device netdev,
int  enable 
)
static

Enable or disable interrupts.

Parameters
netdevNetwork device
enableInterrupts should be enabled

Definition at line 731 of file b44.c.

732 {
733  struct b44_private *bp = netdev->priv;
734 
735  /* Interrupt mask specifies which events generate interrupts */
736  bw32(bp, B44_IMASK, enable ? IMASK_DEF : IMASK_DISABLE);
737 }
#define IMASK_DISABLE
Definition: b44.h:82
uint16_t bp
Definition: registers.h:23
static void bw32(const struct b44_private *bp, u32 reg, u32 val)
Definition: b44.c:66
void * priv
Driver private data.
Definition: netdevice.h:431
static struct net_device * netdev
Definition: gdbudp.c:52
Driver private state.
Definition: b44.h:418
#define IMASK_DEF
Definition: b44.h:81
#define B44_IMASK
Definition: b44.h:80

References B44_IMASK, bp, bw32(), IMASK_DEF, IMASK_DISABLE, netdev, and net_device::priv.

Referenced by b44_open(), and b44_poll().

◆ b44_open()

static int b44_open ( struct net_device netdev)
static

Open network device.

Parameters
netdevNetwork device
Return values
rcReturn status code

Definition at line 745 of file b44.c.

746 {
747  struct b44_private *bp = netdev->priv;
748  int rc;
749 
751  if (rc != 0)
752  return rc;
753 
755  if (rc != 0)
756  return rc;
757 
759 
760  /* Disable interrupts */
761  b44_irq(netdev, 0);
762 
763  return 0;
764 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
uint16_t bp
Definition: registers.h:23
static void b44_init_hw(struct b44_private *bp, int reset_kind)
Definition: b44.c:335
#define B44_FULL_RESET
Definition: b44.h:407
void * priv
Driver private data.
Definition: netdevice.h:431
static struct net_device * netdev
Definition: gdbudp.c:52
static int b44_init_tx_ring(struct b44_private *bp)
Definition: b44.c:478
Driver private state.
Definition: b44.h:418
static int b44_init_rx_ring(struct b44_private *bp)
Definition: b44.c:446
static void b44_irq(struct net_device *netdev, int enable)
Enable or disable interrupts.
Definition: b44.c:731

References B44_FULL_RESET, b44_init_hw(), b44_init_rx_ring(), b44_init_tx_ring(), b44_irq(), bp, netdev, net_device::priv, and rc.

◆ b44_close()

static void b44_close ( struct net_device netdev)
static

Close network device.

Parameters
netdevNetwork device

Definition at line 771 of file b44.c.

772 {
773  struct b44_private *bp = netdev->priv;
774 
778 }
static void b44_chip_reset(struct b44_private *bp, int reset_kind)
Definition: b44.c:258
uint16_t bp
Definition: registers.h:23
#define B44_FULL_RESET
Definition: b44.h:407
void * priv
Driver private data.
Definition: netdevice.h:431
static struct net_device * netdev
Definition: gdbudp.c:52
static void b44_free_rx_ring(struct b44_private *bp)
Definition: b44.c:431
Driver private state.
Definition: b44.h:418
static void b44_free_tx_ring(struct b44_private *bp)
Definition: b44.c:469

References b44_chip_reset(), b44_free_rx_ring(), b44_free_tx_ring(), B44_FULL_RESET, bp, netdev, and net_device::priv.

◆ b44_transmit()

static int b44_transmit ( struct net_device netdev,
struct io_buffer iobuf 
)
static

Transmit packet.

Parameters
netdevNetwork device
iobufI/O buffer
Return values
rcReturn status code

Definition at line 787 of file b44.c.

788 {
789  struct b44_private *bp = netdev->priv;
790  u32 cur = bp->tx_cur;
791  u32 ctrl;
792 
793  /* Check for TX ring overflow */
794  if (bp->tx[cur].ctrl) {
795  DBG("tx overflow\n");
796  return -ENOBUFS;
797  }
798 
799  /* Check for addressability */
800  if (!b44_address_ok(iobuf->data))
801  return -ENOTSUP;
802 
803  /* Will call netdev_tx_complete() on the iobuf later */
804  bp->tx_iobuf[cur] = iobuf;
805 
806  /* Set up TX descriptor */
807  ctrl = (iob_len(iobuf) & DESC_CTRL_LEN) |
809 
810  if (cur == B44_RING_LAST)
811  ctrl |= DESC_CTRL_EOT;
812 
813  bp->tx[cur].ctrl = cpu_to_le32(ctrl);
814  bp->tx[cur].addr = cpu_to_le32(VIRT_TO_B44(iobuf->data));
815 
816  /* Update next available descriptor index */
817  cur = ring_next(cur);
818  bp->tx_cur = cur;
819  wmb();
820 
821  /* Tell card that a new TX descriptor is ready */
822  bw32(bp, B44_DMATX_PTR, cur * sizeof(struct dma_desc));
823  return 0;
824 }
wmb()
#define B44_DMATX_PTR
Definition: b44.h:110
uint16_t bp
Definition: registers.h:23
static void bw32(const struct b44_private *bp, u32 reg, u32 val)
Definition: b44.c:66
#define VIRT_TO_B44(addr)
Definition: b44.c:79
#define ENOTSUP
Operation not supported.
Definition: errno.h:589
static int ring_next(int index)
Definition: b44.c:51
void * priv
Driver private data.
Definition: netdevice.h:431
#define DESC_CTRL_LEN
Definition: b44.h:362
static struct net_device * netdev
Definition: gdbudp.c:52
#define cpu_to_le32(value)
Definition: byteswap.h:107
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
Definition: iobuf.h:159
Driver private state.
Definition: b44.h:418
#define DESC_CTRL_SOF
Definition: b44.h:367
#define DESC_CTRL_EOT
Definition: b44.h:364
#define ENOBUFS
No buffer space available.
Definition: errno.h:498
void * data
Start of data.
Definition: iobuf.h:52
static int b44_address_ok(void *address)
Check if card can access address.
Definition: b44.c:89
uint8_t ctrl
Ring control.
Definition: dwmac.h:18
#define DESC_CTRL_IOC
Definition: b44.h:365
#define DESC_CTRL_EOF
Definition: b44.h:366
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
#define B44_RING_LAST
Definition: b44.h:399
uint32_t u32
Definition: stdint.h:23
Definition: b44.h:348

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().

◆ b44_tx_complete()

static void b44_tx_complete ( struct b44_private bp)
static

Recycles sent TX descriptors and notifies network stack.

Parameters
bpDriver state

Definition at line 831 of file b44.c.

832 {
833  u32 cur, i;
834 
835  cur = pending_tx_index(bp);
836 
837  for (i = bp->tx_dirty; i != cur; i = ring_next(i)) {
838  /* Free finished frame */
839  netdev_tx_complete(bp->netdev, bp->tx_iobuf[i]);
840  bp->tx_iobuf[i] = NULL;
841 
842  /* Clear TX descriptor */
843  bp->tx[i].ctrl = 0;
844  bp->tx[i].addr = 0;
845  }
846  bp->tx_dirty = cur;
847 }
static void netdev_tx_complete(struct net_device *netdev, struct io_buffer *iobuf)
Complete network transmission.
Definition: netdevice.h:766
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.
Definition: b44.c:102
uint16_t bp
Definition: registers.h:23
static int ring_next(int index)
Definition: b44.c:51
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
uint32_t u32
Definition: stdint.h:23

References bp, netdev_tx_complete(), NULL, pending_tx_index(), and ring_next().

Referenced by b44_poll().

◆ b44_process_rx_packets()

static void b44_process_rx_packets ( struct b44_private bp)
static

Definition at line 850 of file b44.c.

851 {
852  struct io_buffer *iob; /* received data */
853  struct rx_header *rh;
854  u32 pending, i;
855  u16 len;
856 
858 
859  for (i = bp->rx_cur; i != pending; i = ring_next(i)) {
860  iob = bp->rx_iobuf[i];
861  if (iob == NULL)
862  break;
863 
864  rh = iob->data;
865  len = le16_to_cpu(rh->len);
866 
867  /*
868  * Guard against incompletely written RX descriptors.
869  * Without this, things can get really slow!
870  */
871  if (len == 0)
872  break;
873 
874  /* Discard CRC that is generated by the card */
875  len -= 4;
876 
877  /* Check for invalid packets and errors */
878  if (len > RX_PKT_BUF_SZ - RX_PKT_OFFSET ||
879  (rh->flags & cpu_to_le16(RX_FLAG_ERRORS))) {
880  DBG("rx error len=%d flags=%04x\n", len,
881  cpu_to_le16(rh->flags));
882  rh->len = 0;
883  rh->flags = 0;
884  netdev_rx_err(bp->netdev, iob, -EINVAL);
885  continue;
886  }
887 
888  /* Clear RX descriptor */
889  rh->len = 0;
890  rh->flags = 0;
891  bp->rx_iobuf[i] = NULL;
892 
893  /* Hand off the IO buffer to the network stack */
895  iob_put(iob, len);
896  netdev_rx(bp->netdev, iob);
897  }
898  bp->rx_cur = i;
900 }
uint16_t u16
Definition: stdint.h:21
#define EINVAL
Invalid argument.
Definition: errno.h:428
#define iob_put(iobuf, len)
Definition: iobuf.h:124
#define RX_FLAG_ERRORS
Definition: b44.h:385
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
Definition: netdevice.c:586
#define RX_PKT_OFFSET
Definition: b44.h:404
Definition: b44.h:369
uint16_t bp
Definition: registers.h:23
static int ring_next(int index)
Definition: b44.c:51
uint32_t pending
Pending events.
Definition: hyperv.h:12
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.
Definition: b44.c:116
ring len
Length.
Definition: dwmac.h:231
static void b44_rx_refill(struct b44_private *bp, u32 pending)
Definition: b44.c:404
#define le16_to_cpu(value)
Definition: byteswap.h:112
void netdev_rx(struct net_device *netdev, struct io_buffer *iobuf)
Add packet to receive queue.
Definition: netdevice.c:548
u16 flags
Definition: b44.h:371
u16 len
Definition: b44.h:370
#define iob_reserve(iobuf, len)
Definition: iobuf.h:71
void * data
Start of data.
Definition: iobuf.h:52
#define cpu_to_le16(value)
Definition: byteswap.h:106
#define RX_PKT_BUF_SZ
Definition: b44.h:405
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
uint32_t u32
Definition: stdint.h:23
A persistent I/O buffer.
Definition: iobuf.h:37

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().

◆ b44_poll()

static void b44_poll ( struct net_device netdev)
static

Poll for completed and received packets.

Parameters
netdevNetwork device

Definition at line 907 of file b44.c.

908 {
909  struct b44_private *bp = netdev->priv;
910  u32 istat;
911 
912  /* Interrupt status */
913  istat = br32(bp, B44_ISTAT);
914  istat &= IMASK_DEF; /* only the events we care about */
915 
916  if (!istat)
917  return;
918  if (istat & ISTAT_TX)
920  if (istat & ISTAT_RX)
922  if (istat & ISTAT_ERRORS) {
923  DBG("b44 error istat=0x%08x\n", istat);
924 
925  /* Reset B44 core partially to avoid long waits */
926  b44_irq(bp->netdev, 0);
927  b44_halt(bp);
931  }
932 
933  /* Acknowledge interrupt */
934  bw32(bp, B44_ISTAT, 0);
935  bflush(bp, B44_ISTAT, 1);
936 }
static void bflush(const struct b44_private *bp, u32 reg, u32 timeout)
Definition: b44.c:72
#define ISTAT_TX
Definition: b44.h:74
uint16_t bp
Definition: registers.h:23
static void b44_init_hw(struct b44_private *bp, int reset_kind)
Definition: b44.c:335
static void bw32(const struct b44_private *bp, u32 reg, u32 val)
Definition: b44.c:66
static void b44_process_rx_packets(struct b44_private *bp)
Definition: b44.c:850
void * priv
Driver private data.
Definition: netdevice.h:431
static struct net_device * netdev
Definition: gdbudp.c:52
static int b44_init_tx_ring(struct b44_private *bp)
Definition: b44.c:478
static void b44_tx_complete(struct b44_private *bp)
Recycles sent TX descriptors and notifies network stack.
Definition: b44.c:831
static u32 br32(const struct b44_private *bp, u32 reg)
Definition: b44.c:60
Driver private state.
Definition: b44.h:418
#define IMASK_DEF
Definition: b44.h:81
static int b44_init_rx_ring(struct b44_private *bp)
Definition: b44.c:446
static void b44_halt(struct b44_private *bp)
called by b44_poll in the error path
Definition: b44.c:310
#define ISTAT_RX
Definition: b44.h:73
#define B44_ISTAT
Definition: b44.h:63
#define ISTAT_ERRORS
Definition: b44.h:78
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
static void b44_irq(struct net_device *netdev, int enable)
Enable or disable interrupts.
Definition: b44.c:731
#define B44_FULL_RESET_SKIP_PHY
Definition: b44.h:408
uint32_t u32
Definition: stdint.h:23

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.

Variable Documentation

◆ b44_operations

struct net_device_operations b44_operations
static
Initial value:
= {
.open = b44_open,
.close = b44_close,
.transmit = b44_transmit,
.poll = b44_poll,
.irq = b44_irq,
}
static void b44_poll(struct net_device *netdev)
Poll for completed and received packets.
Definition: b44.c:907
static int b44_transmit(struct net_device *netdev, struct io_buffer *iobuf)
Transmit packet.
Definition: b44.c:787
static void b44_close(struct net_device *netdev)
Close network device.
Definition: b44.c:771
static int b44_open(struct net_device *netdev)
Open network device.
Definition: b44.c:745
static void b44_irq(struct net_device *netdev, int enable)
Enable or disable interrupts.
Definition: b44.c:731

Definition at line 939 of file b44.c.

Referenced by b44_probe().

◆ b44_nics

struct pci_device_id b44_nics[]
static
Initial value:
= {
PCI_ROM(0x14e4, 0x170c, "BCM4401-B0", "BCM4401-B0", 0),
PCI_ROM(0x14e4, 0x4401, "BCM4401", "BCM4401", 0),
PCI_ROM(0x14e4, 0x4402, "BCM4401-B1", "BCM4401-B1", 0),
}
#define PCI_ROM(_vendor, _device, _name, _description, _data)
Definition: pci.h:307

Definition at line 948 of file b44.c.

◆ __pci_driver

struct pci_driver b44_driver __pci_driver
Initial value:
= {
.ids = b44_nics,
.id_count = sizeof b44_nics / sizeof b44_nics[0],
.probe = b44_probe,
.remove = b44_remove,
}
static struct pci_device_id b44_nics[]
Definition: b44.c:948
static void b44_remove(struct pci_device *pci)
Remove device.
Definition: b44.c:713
static int b44_probe(struct pci_device *pci)
Probe device.
Definition: b44.c:655

Definition at line 955 of file b44.c.