|
| FILE_LICENCE (GPL2_OR_LATER) |
|
static u16 | pcnet32_wio_read_csr (unsigned long addr, int index) |
|
static void | pcnet32_wio_write_csr (unsigned long addr, int index, u16 val) |
|
static u16 | pcnet32_wio_read_bcr (unsigned long addr, int index) |
|
static void | pcnet32_wio_write_bcr (unsigned long addr, int index, u16 val) |
|
static u16 | pcnet32_wio_read_rap (unsigned long addr) |
|
static void | pcnet32_wio_write_rap (unsigned long addr, u16 val) |
|
static void | pcnet32_wio_reset (unsigned long addr) |
|
static int | pcnet32_wio_check (unsigned long addr) |
|
static u16 | pcnet32_dwio_read_csr (unsigned long addr, int index) |
|
static void | pcnet32_dwio_write_csr (unsigned long addr, int index, u16 val) |
|
static u16 | pcnet32_dwio_read_bcr (unsigned long addr, int index) |
|
static void | pcnet32_dwio_write_bcr (unsigned long addr, int index, u16 val) |
|
static u16 | pcnet32_dwio_read_rap (unsigned long addr) |
|
static void | pcnet32_dwio_write_rap (unsigned long addr, u16 val) |
|
static void | pcnet32_dwio_reset (unsigned long addr) |
|
static int | pcnet32_dwio_check (unsigned long addr) |
|
static int | pcnet32_mdio_read (struct net_device *netdev, int phy, int reg) |
|
static void __unused | pcnet32_mdio_write (struct net_device *netdev, int phy, int reg, int val) |
|
static void | pcnet32_refill_rx_ring (struct pcnet32_private *priv) |
| pcnet32_refill_rx_ring - Allocates iobufs for every Rx descriptor that doesn't have one and isn't in use by the hardware More...
|
|
static int | pcnet32_setup_rx_resources (struct pcnet32_private *priv) |
| pcnet32_setup_rx_resources - allocate Rx resources (Descriptors) More...
|
|
static void | pcnet32_free_rx_resources (struct pcnet32_private *priv) |
|
static int | pcnet32_setup_tx_resources (struct pcnet32_private *priv) |
| pcnet32_setup_tx_resources - allocate Tx resources (Descriptors) More...
|
|
static void | pcnet32_free_tx_resources (struct pcnet32_private *priv) |
|
static int | pcnet32_chip_detect (struct pcnet32_private *priv) |
|
static int | pcnet32_set_ops (struct pcnet32_private *priv) |
| pcnet32_set_ops - Determines the ops used to access the registers More...
|
|
static void | pcnet32_setup_init_block (struct pcnet32_private *priv) |
| pcnet32_setup_init_block - setup the NICs initialization block More...
|
|
static void | pcnet32_setup_probe_phy (struct pcnet32_private *priv) |
| pcnet32_setup_probe_phy - go through all PHYs and see which one is present More...
|
|
static int | pcnet32_setup_mac_addr (struct pcnet32_private *priv) |
| pcnet32_setup_mac_addr - check for inconsistency between CSR12-14 and PROM addresses More...
|
|
static void | pcnet32_setup_if_duplex (struct pcnet32_private *priv) |
| pcnet32_setup_if_duplex - Sets the NICs used interface and duplex mode More...
|
|
static void | pcnet32_hw_start (struct pcnet32_private *priv) |
| pcnet32_hw_start - Starts up the NIC More...
|
|
static int | pcnet32_open (struct net_device *netdev) |
| open - Called when a network interface is made active More...
|
|
static int | pcnet32_transmit (struct net_device *netdev, struct io_buffer *iobuf) |
| transmit - Transmit a packet More...
|
|
static void | pcnet32_process_tx_packets (struct net_device *netdev) |
| pcnet32_process_tx_packets - Checks for successfully sent packets, reports them to iPXE with netdev_tx_complete() More...
|
|
static void | pcnet32_process_rx_packets (struct net_device *netdev) |
| pcnet32_process_rx_packets - Checks for received packets, reports them to iPXE with netdev_rx() or netdev_rx_err() if there was an error receiving the packet More...
|
|
static void | pcnet32_poll (struct net_device *netdev) |
| poll - Poll for received packets More...
|
|
static void | pcnet32_close (struct net_device *netdev) |
| close - Disable network interface More...
|
|
static void | pcnet32_irq_enable (struct pcnet32_private *priv) |
|
static void | pcnet32_irq_disable (struct pcnet32_private *priv) |
|
static void | pcnet32_irq (struct net_device *netdev, int action) |
| irq - enable or disable interrupts More...
|
|
static int | pcnet32_probe (struct pci_device *pdev) |
| probe - Initial configuration of NIC More...
|
|
static void | pcnet32_remove (struct pci_device *pdev) |
| remove - Device Removal Routine More...
|
|
pcnet32_refill_rx_ring - Allocates iobufs for every Rx descriptor that doesn't have one and isn't in use by the hardware
- Parameters
-
priv | Driver private structure |
Definition at line 198 of file pcnet32.c.
204 DBGP (
"pcnet32_refill_rx_ring\n" );
207 rx_curr_desc =
priv->rx_base + i;
221 DBG (
"Refill rx ring failed\n" );
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
#define cpu_to_le32(value)
#define le16_to_cpu(value)
static struct tlan_private * priv
#define cpu_to_le16(value)
#define DBG(...)
Print a debugging message.
#define NULL
NULL pointer (VOID *)
References alloc_iob(), pcnet32_rx_desc::base, pcnet32_rx_desc::buf_length, cpu_to_le16, cpu_to_le32, DBG, DBGP, DescOwn, le16_to_cpu, pcnet32_rx_desc::msg_length, NULL, PKT_BUF_SIZE, priv, pcnet32_rx_desc::reserved, RX_RING_SIZE, status, pcnet32_rx_desc::status, virt_to_bus(), and wmb().
Referenced by pcnet32_process_rx_packets(), and pcnet32_setup_rx_resources().
pcnet32_setup_rx_resources - allocate Rx resources (Descriptors)
- Parameters
-
priv | Driver private structure |
- Return values
-
rc | Returns 0 on success, negative on failure |
Definition at line 245 of file pcnet32.c.
247 DBGP (
"pcnet32_setup_rx_resources\n" );
253 if ( !
priv->rx_base ) {
static void *__malloc malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
#define ENOMEM
Not enough space.
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
static void pcnet32_refill_rx_ring(struct pcnet32_private *priv)
pcnet32_refill_rx_ring - Allocates iobufs for every Rx descriptor that doesn't have one and isn't in ...
static struct tlan_private * priv
#define DBG(...)
Print a debugging message.
void * memset(void *dest, int character, size_t len) __nonnull
References DBG, DBGP, ENOMEM, malloc_phys(), memset(), pcnet32_refill_rx_ring(), priv, RX_RING_ALIGN, RX_RING_BYTES, and virt_to_bus().
Referenced by pcnet32_open().
pcnet32_setup_tx_resources - allocate Tx resources (Descriptors)
- Parameters
-
priv | Driver private structure |
- Return values
-
rc | Returns 0 on success, negative on failure |
Definition at line 289 of file pcnet32.c.
291 DBGP (
"pcnet32_setup_tx_resources\n" );
295 if ( !
priv->tx_base ) {
304 priv->tx_fill_ctr = 0;
static void *__malloc malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
#define ENOMEM
Not enough space.
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
static struct tlan_private * priv
#define DBG(...)
Print a debugging message.
void * memset(void *dest, int character, size_t len) __nonnull
References DBG, DBGP, ENOMEM, malloc_phys(), memset(), priv, TX_RING_ALIGN, TX_RING_BYTES, and virt_to_bus().
Referenced by pcnet32_open().
pcnet32_setup_mac_addr - check for inconsistency between CSR12-14 and PROM addresses
- Parameters
-
priv | Driver private structure |
Definition at line 549 of file pcnet32.c.
562 for ( i = 0; i < 3; i++ ) {
566 priv->netdev->hw_addr[2 * i] =
val & 0x0ff;
567 priv->netdev->hw_addr[2 * i + 1] = (
val >> 8 ) & 0x0ff;
576 DBG (
"CSR address is invalid, using PROM addr\n" );
static unsigned long ioaddr
void * memcpy(void *dest, const void *src, size_t len) __nonnull
uint8_t inb(volatile uint8_t *io_addr)
Read byte from I/O-mapped device.
static int is_valid_ether_addr(const void *addr)
Check if Ethernet address is valid.
#define EADDRNOTAVAIL
Address not available.
static struct tlan_private * priv
#define DBG(...)
Print a debugging message.
int memcmp(const void *first, const void *second, size_t len)
Compare memory regions.
References DBG, EADDRNOTAVAIL, ETH_ALEN, inb(), ioaddr, is_valid_ether_addr(), memcmp(), memcpy(), priv, and val.
Referenced by pcnet32_probe().
pcnet32_setup_if_duplex - Sets the NICs used interface and duplex mode
- Parameters
-
priv | Driver private structure |
Definition at line 594 of file pcnet32.c.
606 if (
priv->full_duplex ) {
614 if (
priv->chip_version == 0x2627 )
627 u16 subsys_vend_id, subsys_dev_id;
650 if ( (
priv->chip_version != 0x2420 ) &&
651 (
priv->chip_version != 0x2621 ) ) {
#define PCI_SUBDEVICE_ID_AT_2701FX
int pci_read_config_word(struct pci_device *pci, unsigned int where, uint16_t *value)
Read 16-bit word from PCI configuration space.
#define PCI_SUBSYSTEM_ID
PCI subsystem ID.
static unsigned long ioaddr
#define PCNET32_PORT_ASEL
#define PCNET32_PORT_PORTSEL
static struct tlan_private * priv
#define PCI_SUBDEVICE_ID_AT_2700FX
#define PCI_SUBSYSTEM_VENDOR_ID
PCI subsystem vendor ID.
#define PCNET32_PORT_GPSI
References ioaddr, pci_read_config_word(), PCI_SUBDEVICE_ID_AT_2700FX, PCI_SUBDEVICE_ID_AT_2701FX, PCI_SUBSYSTEM_ID, PCI_SUBSYSTEM_VENDOR_ID, PCI_VENDOR_ID_AT, PCNET32_PORT_100, PCNET32_PORT_ASEL, PCNET32_PORT_AUI, PCNET32_PORT_FD, PCNET32_PORT_GPSI, PCNET32_PORT_PORTSEL, priv, and val.
Referenced by pcnet32_open().
static int pcnet32_open |
( |
struct net_device * |
netdev | ) |
|
|
static |
open - Called when a network interface is made active
- Parameters
-
- Return values
-
rc | Return status code, 0 on success, negative value on failure |
Definition at line 691 of file pcnet32.c.
700 DBG (
"Error setting up TX resources\n" );
705 DBG (
"Error setting up RX resources\n" );
742 priv->a->reset(
priv->pci_dev->ioaddr );
struct arbelprm_rc_send_wqe rc
static int pcnet32_setup_rx_resources(struct pcnet32_private *priv)
pcnet32_setup_rx_resources - allocate Rx resources (Descriptors)
static unsigned long ioaddr
static void pcnet32_free_tx_resources(struct pcnet32_private *priv)
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
void * priv
Driver private data.
static struct net_device * netdev
static int pcnet32_setup_tx_resources(struct pcnet32_private *priv)
pcnet32_setup_tx_resources - allocate Tx resources (Descriptors)
static void pcnet32_hw_start(struct pcnet32_private *priv)
pcnet32_hw_start - Starts up the NIC
static void pcnet32_setup_if_duplex(struct pcnet32_private *priv)
pcnet32_setup_if_duplex - Sets the NICs used interface and duplex mode
static struct tlan_private * priv
static void pcnet32_setup_init_block(struct pcnet32_private *priv)
pcnet32_setup_init_block - setup the NICs initialization block
#define DBG(...)
Print a debugging message.
#define PCNET32_SWSTYLE_PCNET32
References BablMask, DBG, InitDoneMask, ioaddr, MissFrameMask, netdev, pcnet32_free_tx_resources(), pcnet32_hw_start(), pcnet32_setup_if_duplex(), pcnet32_setup_init_block(), pcnet32_setup_rx_resources(), pcnet32_setup_tx_resources(), PCNET32_SWSTYLE_PCNET32, priv, net_device::priv, rc, RxIntMask, TxIntMask, val, and virt_to_bus().
transmit - Transmit a packet
- Parameters
-
netdev | Network device |
iobuf | I/O buffer |
- Return values
-
rc | Returns 0 on success, negative on failure |
Definition at line 755 of file pcnet32.c.
762 DBGP (
"pcnet32_transmit\n" );
765 DBG (
"Tx overflow\n" );
769 priv->tx_iobuf[
priv->tx_curr] = iobuf;
771 tx_curr_desc =
priv->tx_base +
priv->tx_curr;
775 tx_curr_desc->
misc = 0x00000000;
#define ENOTSUP
Operation not supported.
static unsigned long ioaddr
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
void * priv
Driver private data.
static struct net_device * netdev
#define cpu_to_le32(value)
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
static struct tlan_private * priv
void * data
Start of data.
#define cpu_to_le16(value)
#define DBG(...)
Print a debugging message.
References pcnet32_tx_desc::base, cpu_to_le16, cpu_to_le32, io_buffer::data, DBG, DBGP, DescOwn, EndOfPacket, ENOTSUP, IntEnable, ioaddr, iob_len(), pcnet32_tx_desc::length, pcnet32_tx_desc::misc, netdev, priv, net_device::priv, StartOfPacket, pcnet32_tx_desc::status, TX_RING_SIZE, TxDemand, virt_to_bus(), and wmb().
static void pcnet32_process_tx_packets |
( |
struct net_device * |
netdev | ) |
|
|
static |
pcnet32_process_tx_packets - Checks for successfully sent packets, reports them to iPXE with netdev_tx_complete()
- Parameters
-
Definition at line 803 of file pcnet32.c.
808 DBGP (
"pcnet32_process_tx_packets\n" );
810 while (
priv->tx_tail !=
priv->tx_curr ) {
811 tx_curr_desc =
priv->tx_base +
priv->tx_tail;
815 DBG (
"Before OWN bit check, status: %#08x\n",
status );
821 DBG (
"Transmitted packet.\n" );
822 DBG (
"priv->tx_fill_ctr= %d\n",
priv->tx_fill_ctr );
823 DBG (
"priv->tx_tail = %d\n",
priv->tx_tail );
824 DBG (
"priv->tx_curr = %d\n",
priv->tx_curr );
831 memset ( tx_curr_desc, 0,
sizeof(*tx_curr_desc) );
static void netdev_tx_complete(struct net_device *netdev, struct io_buffer *iobuf)
Complete network transmission.
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
void * priv
Driver private data.
static struct net_device * netdev
#define le16_to_cpu(value)
static struct tlan_private * priv
#define DBG(...)
Print a debugging message.
void * memset(void *dest, int character, size_t len) __nonnull
References DBG, DBGP, DescOwn, le16_to_cpu, memset(), netdev, netdev_tx_complete(), priv, net_device::priv, status, pcnet32_tx_desc::status, TX_RING_SIZE, and virt_to_bus().
Referenced by pcnet32_poll().
static void pcnet32_process_rx_packets |
( |
struct net_device * |
netdev | ) |
|
|
static |
pcnet32_process_rx_packets - Checks for received packets, reports them to iPXE with netdev_rx() or netdev_rx_err() if there was an error receiving the packet
- Parameters
-
Definition at line 849 of file pcnet32.c.
857 DBGP (
"pcnet32_process_rx_packets\n" );
860 rx_curr_desc =
priv->rx_base +
priv->rx_curr;
865 DBG (
"Before OWN bit check, status: %#08x\n",
status );
875 DBG (
"Received packet.\n" );
876 DBG (
"priv->rx_curr = %d\n",
priv->rx_curr );
877 DBG (
"rx_len = %d\n",
879 DBG (
"rx_curr_desc = %#08lx\n",
886 DBG (
"Corrupted packet received!\n");
898 memset ( rx_curr_desc, 0,
sizeof(*rx_curr_desc) );
#define EINVAL
Invalid argument.
#define iob_put(iobuf, len)
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
#define le32_to_cpu(value)
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
void * priv
Driver private data.
static struct net_device * netdev
#define le16_to_cpu(value)
void netdev_rx(struct net_device *netdev, struct io_buffer *iobuf)
Add packet to receive queue.
static void pcnet32_refill_rx_ring(struct pcnet32_private *priv)
pcnet32_refill_rx_ring - Allocates iobufs for every Rx descriptor that doesn't have one and isn't in ...
static struct tlan_private * priv
#define DBG(...)
Print a debugging message.
#define NULL
NULL pointer (VOID *)
void * memset(void *dest, int character, size_t len) __nonnull
References DBG, DBGP, DescOwn, EINVAL, iob_put, le16_to_cpu, le32_to_cpu, len, memset(), pcnet32_rx_desc::msg_length, netdev, netdev_rx(), netdev_rx_err(), NULL, pcnet32_refill_rx_ring(), priv, net_device::priv, rmb, RX_RING_SIZE, status, pcnet32_rx_desc::status, and virt_to_bus().
Referenced by pcnet32_poll().
static int pcnet32_probe |
( |
struct pci_device * |
pdev | ) |
|
|
static |
probe - Initial configuration of NIC
- Parameters
-
pdev | PCI device |
ent | PCI IDs |
- Return values
-
Definition at line 1037 of file pcnet32.c.
1044 DBGP (
"pcnet32_probe\n" );
1046 DBG (
"Found %s, vendor = %#04x, device = %#04x\n",
1053 goto err_alloc_etherdev;
1067 priv->pci_dev = pdev;
1073 priv->irq_enabled = 0;
1079 DBG (
"Setting driver operations failed\n");
1084 DBG (
"pcnet32_chip_detect failed\n" );
1085 goto err_chip_detect;
1093 DBG (
"Setting MAC address failed\n" );
1097 DBG (
"IO Addr 0x%lX, MAC Addr %s\n",
ioaddr,
1112 DBG (
"Error registering netdev\n" );
struct arbelprm_rc_send_wqe rc
static void pcnet32_wio_reset(unsigned long addr)
static int pcnet32_setup_mac_addr(struct pcnet32_private *priv)
pcnet32_setup_mac_addr - check for inconsistency between CSR12-14 and PROM addresses
unsigned long ioaddr
I/O address.
static int pcnet32_set_ops(struct pcnet32_private *priv)
pcnet32_set_ops - Determines the ops used to access the registers
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
struct device dev
Generic device.
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
#define ENOMEM
Not enough space.
static unsigned long ioaddr
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
void * priv
Driver private data.
static void netdev_link_up(struct net_device *netdev)
Mark network device as having link up.
static struct net_device * netdev
static int pcnet32_chip_detect(struct pcnet32_private *priv)
#define PCNET32_PORT_ASEL
int register_netdev(struct net_device *netdev)
Register network device.
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
struct device * dev
Underlying hardware device.
uint16_t vendor
PCI vendor ID.
uint16_t device
PCI device ID.
static struct tlan_private * priv
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
struct pci_device_id * id
Driver device ID.
#define PCNET32_PORT_GPSI
#define DBG(...)
Print a debugging message.
static void pcnet32_setup_probe_phy(struct pcnet32_private *priv)
pcnet32_setup_probe_phy - go through all PHYs and see which one is present
uint8_t hw_addr[MAX_HW_ADDR_LEN]
Hardware address.
static struct net_device_operations pcnet32_operations
References adjust_pci_device(), alloc_etherdev(), DBG, DBGP, pci_device::dev, net_device::dev, pci_device_id::device, ENOMEM, eth_ntoa(), net_device::hw_addr, pci_device::id, ioaddr, pci_device::ioaddr, pci_device_id::name, netdev, netdev_init(), netdev_link_up(), netdev_put(), pci_set_drvdata(), pcnet32_chip_detect(), pcnet32_operations, PCNET32_PORT_ASEL, PCNET32_PORT_FD, PCNET32_PORT_GPSI, pcnet32_set_ops(), pcnet32_setup_mac_addr(), pcnet32_setup_probe_phy(), pcnet32_wio_reset(), priv, net_device::priv, rc, register_netdev(), and pci_device_id::vendor.