63 DBGC2 ( rhn,
"RHINE %p MII read reg %d\n", rhn,
reg );
78 DBGC ( rhn,
"RHINE %p MII read timeout\n", rhn );
98 DBGC2 ( rhn,
"RHINE %p MII write reg %d data 0x%04x\n",
115 DBGC ( rhn,
"RHINE %p MII write timeout\n", rhn );
154 DBGC ( rhn,
"RHINE %p MII auto-poll timeout\n", rhn );
177 DBGC ( rhn,
"RHINE %p reset\n", rhn );
190 DBGC ( rhn,
"RHINE %p reset timeout\n", rhn );
239 DBGC ( rhn,
"RHINE %p EEPROM reload timeout\n", rhn );
261 DBGC ( rhn,
"RHINE %p link status %02x\n", rhn, mii_sr );
289 size_t len = ( ring->
count *
sizeof ( ring->
desc[0] ) );
301 for ( i = 0 ; i < ring->
count ; i++ ) {
310 DBGC ( rhn,
"RHINE %p ring %02x is at [%08llx,%08llx)\n",
311 rhn, ring->
reg, ( (
unsigned long long )
address ),
325 size_t len = ( ring->
count *
sizeof ( ring->
desc[0] ) );
371 DBGC2 ( rhn,
"RHINE %p RX %d is [%llx,%llx)\n", rhn, rx_idx,
372 ( (
unsigned long long )
address ),
401 goto err_mii_autopoll;
496 DBGC2 ( rhn,
"RHINE %p TX %d is [%llx,%llx)\n", rhn, tx_idx,
497 ( (
unsigned long long )
address ),
528 DBGC ( rhn,
"RHINE %p TX %d error (DES0 %08x)\n",
532 DBGC2 ( rhn,
"RHINE %p TX %d complete\n", rhn, tx_idx );
572 DBGC2 ( rhn,
"RHINE %p RX %d complete (length %zd)\n",
576 DBGC ( rhn,
"RHINE %p RX %d error (length %zd, DES0 " 577 "%08x)\n", rhn, rx_idx,
len,
des0 );
608 DBGC ( rhn,
"RHINE %p unexpected ISR0 %02x ISR1 %02x\n",
695 memset ( rhn, 0,
sizeof ( *rhn ) );
705 DBGC ( rhn,
"RHINE %p regs at %08lx, I/O at %04lx\n", rhn,
714 goto err_reload_eeprom;
718 DBGC ( rhn,
"RHINE %p revision %#02x detected\n", rhn,
revision );
729 DBGC ( rhn,
"RHINE %p could not reset MII: %s\n",
733 DBGC ( rhn,
"RHINE PHY vendor %04x device %04x\n",
738 goto err_register_netdev;
778 PCI_ROM ( 0x1106, 0x3043,
"dlink-530tx-old",
"VIA VT3043", 0 ),
779 PCI_ROM ( 0x1106, 0x3053,
"vt6105m",
"VIA VT6105M", 0 ),
780 PCI_ROM ( 0x1106, 0x3065,
"dlink-530tx",
"VIA VT6102", 0 ),
781 PCI_ROM ( 0x1106, 0x3106,
"vt6105",
"VIA VT6105", 0 ),
782 PCI_ROM ( 0x1106, 0x6100,
"via-rhine-old",
"VIA 86C100A", 0 )
static void rhine_poll_tx(struct net_device *netdev)
Poll for completed packets.
unsigned long membase
Memory base.
struct arbelprm_rc_send_wqe rc
#define RHINE_ISR1
Interrupt service 1.
uint8_t readb(volatile uint8_t *io_addr)
Read byte from memory-mapped device.
#define iob_put(iobuf, len)
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
#define RHINE_ISR0_MIBOVFL
static void rhine_destroy_ring(struct rhine_nic *rhn, struct rhine_ring *ring)
Destroy descriptor ring.
static unsigned int unsigned int reg
static void rhine_enable_mmio(struct rhine_nic *rhn, int revision)
Enable MMIO register access.
#define le32_to_cpu(value)
int(* open)(struct net_device *netdev)
Open network device.
unsigned long ioaddr
I/O address (some PIO access is always required)
uint32_t next
Next descriptor address.
void netdev_tx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard transmitted packet.
unsigned long ioaddr
I/O address.
unsigned int cons
Consumer index.
#define RHINE_ISR0_TXRINGERR
uint16_t readw(volatile uint16_t *io_addr)
Read 16-bit word from memory-mapped device.
static void netdev_tx_complete_next(struct net_device *netdev)
Complete network transmission.
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
struct pci_device_id * ids
PCI ID table.
uint64_t address
Base address.
int(* read)(struct mii_interface *mdio, unsigned int phy, unsigned int reg)
Read from MII register.
static int rhine_transmit(struct net_device *netdev, struct io_buffer *iobuf)
Transmit packet.
#define RHINE_CR0_STOPNIC
#define RHINE_ISR0_RXRINGERR
#define RHINE_CR0
Command 0 register.
uint64_t desc
Microcode descriptor list physical address.
static void *__malloc malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
void netdev_tx_complete_next_err(struct net_device *netdev, int rc)
Complete network transmission.
void netdev_link_down(struct net_device *netdev)
Mark network device as having link down.
unsigned int reg
Register address.
FILE_LICENCE(GPL2_OR_LATER)
#define RHINE_CHIPCFG_D
Chip configuration D.
#define RHINE_MII_CR_AUTOPOLL
static struct pci_device_id rhine_nics[]
Rhine PCI device IDs.
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
#define RHINE_ISR1_RXFIFOOVFL
struct device dev
Generic device.
#define RHINE_RCR
Receive control register.
void writeb(uint8_t data, volatile uint8_t *io_addr)
Write byte to memory-mapped device.
static void mdio_init(struct mii_interface *mdio, struct mii_operations *op)
Initialise MII interface.
Dynamic memory allocation.
A VIA Rhine descriptor ring.
static void rhine_remove(struct pci_device *pci)
Remove PCI device.
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
static void rhine_check_link(struct net_device *netdev)
Check link state.
#define RHINE_ISR1_TXABORT
#define RHINE_TIMEOUT_US
Default timeout.
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
#define ENOMEM
Not enough space.
#define RHINE_RXDESC_NUM
Rhine descriptor rings sizes.
#define RHINE_IMR1
Interrupt enable mask register 1.
#define RHINE_MII_SR_PHYERR
struct mii_interface mdio
MII interface.
#define RHINE_ISR1_PORTSTATE
#define __unused
Declare a variable or data structure as unused.
#define RHINE_CR0_STARTNIC
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
static int rhine_create_ring(struct rhine_nic *rhn, struct rhine_ring *ring)
Create descriptor ring.
A VIA Rhine network card.
#define RHINE_ISR1_RXNOBUF
#define RHINE_ISR0_RXDONE
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
#define container_of(ptr, type, field)
Get containing structure.
struct mii_device mii
MII device.
#define RHINE_MII_ADDR_MSRCEN
void * priv
Driver private data.
static void netdev_link_up(struct net_device *netdev)
Mark network device as having link up.
void writel(uint32_t data, volatile uint32_t *io_addr)
Write 32-bit dword to memory-mapped device.
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
static struct net_device * netdev
struct pci_driver rhine_driver __pci_driver
Rhine PCI driver.
struct io_buffer * rx_iobuf[RHINE_RXDESC_NUM]
Receive I/O buffers.
#define RHINE_MII_ADDR_MDONE
void unregister_netdev(struct net_device *netdev)
Unregister network device.
#define RHINE_MII_CR
MII control register.
#define cpu_to_le32(value)
uint32_t revision
Entry point revision.
#define RHINE_MII_SR
MII status register.
char * strerror(int errno)
Retrieve string representation of error number.
#define RHINE_EEPROM_CTRL
EERPOM control/status register.
static int rhine_open(struct net_device *netdev)
Open network device.
#define RHINE_EEPROM_CTRL_RELOAD
#define RHINE_DES0_GETSIZE(_x)
int register_netdev(struct net_device *netdev)
Register network device.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
#define RHINE_CHIPCFG_D_MMIO
#define RHINE_RCR_BCAST_ACCEPT
#define RHINE_BAR_SIZE
Rhine BAR size.
#define RHINE_MII_RDWR
MII read/write data.
void netdev_link_err(struct net_device *netdev, int rc)
Mark network device as having a specific link state.
Media Independent Interface.
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
static void rhine_irq(struct net_device *netdev, int enable)
Enable or disable interrupts.
static int rhine_mii_write(struct mii_interface *mdio, unsigned int phy __unused, unsigned int reg, unsigned int data)
Write to MII register.
int mii_reset(struct mii_device *mii)
Reset MII device.
#define RHINE_MAC
Rhine MAC address registers.
uint8_t inb(volatile uint8_t *io_addr)
Read byte from I/O-mapped device.
static int rhine_probe(struct pci_device *pci)
Probe PCI device.
A PCI device ID list entry.
struct rhine_ring rx
Receive descriptor ring.
static struct xen_remove_from_physmap * remove
#define RHINE_MII_CR_RDEN
static int rhine_mii_read(struct mii_interface *mdio, unsigned int phy __unused, unsigned int reg)
Read from MII register.
Network device operations.
void netdev_rx(struct net_device *netdev, struct io_buffer *iobuf)
Add packet to receive queue.
struct device * dev
Underlying hardware device.
static void mii_init(struct mii_device *mii, struct mii_interface *mdio, unsigned int address)
Initialise MII device.
static void rhine_poll_rx(struct net_device *netdev)
Poll for received packets.
Network device management.
MII interface operations.
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
static int rhine_reset(struct rhine_nic *rhn)
Reset hardware.
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
#define outb(data, io_addr)
static int rhine_reload_eeprom(struct rhine_nic *rhn)
Reload EEPROM contents.
#define RHINE_MII_SR_LINKPOLL
#define ENOBUFS
No buffer space available.
int(* probe)(struct pci_device *pci)
Probe device.
#define RHINE_ISR1_TXFIFOUNFL
#define RHINE_IMR0
Interrupt enable mask register 0.
unsigned int count
Number of descriptors.
#define RHINE_TXQUEUE_BASE
TX queue 0 descriptor base address.
#define RHINE_MII_ADDR
MII port address.
void * data
Start of data.
#define EIO
Input/output error.
#define RHINE_ISR1_RXFIFOUNFL
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
uint8_t data[48]
Additional event data.
#define PCI_REVISION
PCI revision.
#define RHINE_CHIPCFG_A_MMIO
static void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
static int mii_read(int phy_id, int location)
#define RHINE_REVISION_OLD
#define RHINE_ISR0
Interrupt service 0.
static void rhine_poll(struct net_device *netdev)
Poll for completed and received packets.
uint8_t cr1
Cached value of CR1 (to avoid read-modify-write on fast path)
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
#define RHINE_DES1_SIZE(_x)
#define RHINE_ISR0_TXDONE
static int rhine_mii_autopoll(struct rhine_nic *rhn)
Enable auto-polling.
struct rhine_descriptor * desc
Descriptors.
#define RHINE_RCR_PHYS_ACCEPT
static struct mii_operations rhine_mii_operations
Rhine MII operations.
static struct net_device_operations rhine_operations
Rhine network device operations.
unsigned int prod
Producer index.
static void rhine_refill_rx(struct rhine_nic *rhn)
Refill RX descriptor ring.
uint8_t hw_addr[MAX_HW_ADDR_LEN]
Hardware address.
#define NULL
NULL pointer (VOID *)
#define ETIMEDOUT
Connection timed out.
#define PCI_ROM(_vendor, _device, _name, _description, _data)
#define RHINE_CHIPCFG_A
Chip configuration A.
void iob_pad(struct io_buffer *iobuf, size_t min_len)
Pad I/O buffer.
VIA Rhine network driver.
struct rhine_ring tx
Transmit descriptor ring.
static void rhine_close(struct net_device *netdev)
Close network device.
#define RHINE_RXQUEUE_BASE
RX queue descriptor base address.
#define RHINE_MII_CR_WREN
#define RHINE_ISR0_PCIERR
#define RHINE_CR1
Command 1 register.
void * memset(void *dest, int character, size_t len) __nonnull
int pci_read_config_byte(struct pci_device *pci, unsigned int where, uint8_t *value)
Read byte from PCI configuration space.
#define RHINE_RCR_RUNT_ACCEPT