79 DBGC ( icp,
"ICPLUS %p timed out waiting for reset (asicctrl %#08x)\n",
133 DBGC ( icp,
"ICPLUS %p timed out waiting for EEPROM read\n", icp );
153 DBGC ( icp,
"ICPLUS %p EEPROM write not supported\n", icp );
195 unsigned int bit_id ) {
204 return (
reg & mask );
215 unsigned int bit_id,
unsigned long data ) {
255 DBGC ( icp,
"ICPLUS %p could not find PHY address: %s\n",
265 DBGC ( icp,
"ICPLUS %p could not advertise 1000Mbps: " 273 DBGC ( icp,
"ICPLUS %p could not reset PHY: %s\n",
292 DBGC ( icp,
"ICPLUS %p PHY control is %02x\n", icp, phyctrl );
347 if ( ! ring->
entry ) {
366 DBGC ( icp,
"ICP %p %s ring at [%#08lx,%#08lx)\n",
403 unsigned int refilled = 0;
430 DBGC2 ( icp,
"ICP %p RX %d is [%llx,%llx)\n", icp, rx_idx,
431 ( (
unsigned long long )
address ),
532 DBGC ( icp,
"ICP %p out of transmit descriptors\n", icp );
551 DBGC2 ( icp,
"ICP %p TX %d is [%llx,%llx)\n", icp, tx_idx,
552 ( (
unsigned long long )
address ),
580 DBGC2 ( icp,
"ICP %p TX %d complete\n", icp, tx_idx );
619 DBGC ( icp,
"ICP %p RX %d error (length %zd, " 620 "flags %02x)\n", icp, rx_idx,
len,
desc->flags );
623 DBGC2 ( icp,
"ICP %p RX %d complete (length " 624 "%zd)\n", icp, rx_idx,
len );
648 DBGC ( icp,
"ICP %p TX error: %08x\n", icp, txstatus );
677 DBGC ( icp,
"ICPLUS %p does not yet support interrupts\n", icp );
718 memset ( icp, 0,
sizeof ( *icp ) );
745 DBGC ( icp,
"ICPLUS %p could not read EEPROM MAC address: %s\n",
756 goto err_register_netdev;
800 PCI_ROM ( 0x13f0, 0x1023,
"ip1000a",
"IP1000A", 0 ),
#define ICP_ASICCTRL_PHYSPEED1000
PHY speed 1000.
#define ICP_ASICCTRL_AUTOINIT
Auto init.
#define ICP_EEPROM_WORD_LEN_LOG2
EEPROM word length.
#define ICP_TXSTATUS_ERROR
TX error.
#define ICP_EEPROM_MAC
Address of MAC address within EEPROM.
int(* write)(struct nvs_device *nvs, unsigned int address, const void *data, size_t len)
Write data to device.
#define ICP_MACCTRL
MAC control register (double word)
unsigned long membase
Memory base.
static void icplus_close(struct net_device *netdev)
Close network device.
struct arbelprm_rc_send_wqe rc
#define ICP_ASICCTRL_FIFO
FIFO.
unsigned int word_len_log2
Word length.
struct mii_interface mdio
MII interface.
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 ICP_RX_ERR_ALIGN
Receive alignment error.
#define ADVERTISE_1000FULL
#define ICP_EEPROM_MAX_WAIT_MS
Maximum time to wait for reading EEPROM.
static unsigned int unsigned int reg
#define ICP_TX_UNALIGN
Transmit alignment disabled.
static void icplus_check_link(struct net_device *netdev)
Check link state.
struct nvs_device eeprom
EEPROM.
static int icplus_reset(struct icplus_nic *icp)
Reset hardware.
int(* open)(struct net_device *netdev)
Open network device.
static void icplus_destroy_ring(struct icplus_nic *icp __unused, struct icplus_ring *ring)
Destroy descriptor ring.
#define ICP_TFDLISTPTR
List pointer transmit register.
uint32_t next
Next descriptor address.
struct icplus_ring tx
Transmit descriptor ring.
void init_mii_bit_basher(struct mii_bit_basher *miibit)
Initialise bit-bashing interface.
static struct bit_basher_operations icplus_basher_ops
MII bit-bashing interface.
unsigned int prod
Producer counter.
#define ICP_RX_MAX_LEN
Maximum receive packet length.
#define ICP_EEPROMCTRL_OPCODE_READ
Read register.
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.
A non-volatile storage device.
#define DBG_ENABLE(level)
struct pci_device_id * ids
PCI ID table.
uint64_t address
Base address.
#define ICP_RXMODE_ALLFRAMES
Receive all frames.
#define ICP_RESET_MAX_WAIT_MS
Maximum time to wait for reset.
#define ICP_RFDLISTPTR
List pointer receive register.
static int icplus_write_eeprom(struct nvs_device *nvs, unsigned int address __unused, const void *data __unused, size_t len __unused)
Write data to EEPROM.
#define ICP_DMACTRL
DMA control register (word/double word)
uint32_t readl(volatile uint32_t *io_addr)
Read 32-bit dword from memory-mapped device.
uint64_t desc
Microcode descriptor list physical address.
#define ICP_RX_ERR_OVERSIZED
Receive oversized frame error.
static void icplus_set_base(struct icplus_nic *icp, unsigned int offset, void *base)
Set descriptor ring base address.
#define ICP_INTSTATUS
Interupt status register (word)
static void icplus_mii_write_bit(struct bit_basher *basher, unsigned int bit_id, unsigned long data)
Set/clear output bit.
static const uint8_t icplus_mii_bits[]
Pin mapping for MII bit-bashing interface.
#define ICP_RXMODE_MULTICAST
Receice multicast.
#define ICP_MACCTRL_TXENABLE
TX enable.
unsigned long long uint64_t
#define DBG_DISABLE(level)
static void *__malloc malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
#define cpu_to_le64(value)
#define ICP_ASICCTRL_NETWORK
Network.
void netdev_link_down(struct net_device *netdev)
Mark network device as having link down.
struct icplus_descriptor * entry
Ring entries.
static void icplus_init_eeprom(struct icplus_nic *icp)
Initialise EEPROM.
#define ICP_DMACTRL_RXPOLLNOW
Receive poll now.
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
struct bit_basher_operations * op
Bit-bashing operations.
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
static __always_inline unsigned long virt_to_phys(volatile const void *addr)
Convert virtual address to a physical address.
#define ICP_RXMODE
Receive mode register (word)
struct device dev
Generic device.
static void icplus_poll_tx(struct net_device *netdev)
Poll for completed packets.
#define ICP_TX_INDICATE
Request transmit completion.
#define ICP_RX_ERR_RUNT
Receive runt frame error.
void writeb(uint8_t data, volatile uint8_t *io_addr)
Write byte to memory-mapped device.
#define ENOTSUP
Operation not supported.
Dynamic memory allocation.
#define ICP_BAR_SIZE
BAR size.
#define ICP_INTSTATUS_LINKEVENT
Link event.
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
#define ICP_MACCTRL_RXENABLE
RX enable.
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
#define ENOMEM
Not enough space.
#define ICP_EEPROMCTRL_BUSY
EEPROM busy.
#define ICP_ASICCTRL_HOST
Host.
static void icplus_poll_rx(struct net_device *netdev)
Poll for received packets.
static signed char phys[4]
#define ICP_RXMODE_UNICAST
Receive unicast.
static int icplus_transmit(struct net_device *netdev, struct io_buffer *iobuf)
Transmit packet.
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
unsigned int block_size
Data block size (in words)
#define ICP_BASE_HI
Base address high register offset.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
#define container_of(ptr, type, field)
Get containing structure.
#define ICP_MACCTRL_DUPLEX
Duplex select.
#define ICP_BASE_LO
Base address low register offset.
#define ICP_INTSTATUS_RXDMACOMPLETE
RX DMA complete.
void * priv
Driver private data.
static int icplus_read_eeprom(struct nvs_device *nvs, unsigned int address, void *data, size_t len)
Read data from EEPROM.
#define __unused
Declare a variable or data structure as unused.
static void netdev_link_up(struct net_device *netdev)
Mark network device as having link up.
#define ICP_EEPROM_MIN_SIZE_WORDS
Minimum EEPROM size, in words.
void writel(uint32_t data, volatile uint32_t *io_addr)
Write 32-bit dword to memory-mapped device.
static struct net_device * netdev
static void icplus_irq(struct net_device *netdev, int enable)
Enable or disable interrupts.
static void icplus_poll(struct net_device *netdev)
Poll for completed and received packets.
#define ICP_PHYCTRL_MGMTDIR
Management direction.
#define ICP_TXSTATUS
Transmit status register.
static int icplus_init_phy(struct icplus_nic *icp)
Configure PHY.
void unregister_netdev(struct net_device *netdev)
Unregister network device.
int(* read)(struct nvs_device *nvs, unsigned int address, void *data, size_t len)
Read data from device.
#define ICP_RXMODE_BROADCAST
Receive broadcast.
#define ICP_RX_ERR_FCS
Receive FCS error.
#define ICP_TX_SOLE_FRAG
Sole transmit fragment.
#define ICP_EEPROMCTRL
EEPROM control register (word)
int(* read)(struct bit_basher *basher, unsigned int bit_id)
Read input bit.
unsigned int cons
Consumer counter.
Transmit or receive descriptor.
char * strerror(int errno)
Retrieve string representation of error number.
#define ICP_EEPROMDATA
EEPROM data register (word)
#define ICP_ASICCTRL
ASIC control register (double word)
int register_netdev(struct net_device *netdev)
Register network device.
struct pci_driver icplus_driver __pci_driver
IC+ PCI driver.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
#define ICP_RX_ERR_OVERRUN
Recieve frame overrun error.
#define ENODEV
No such device.
#define ICP_EEPROMCTRL_ADDRESS(x)
Address.
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
static void icplus_remove(struct pci_device *pci)
Remove PCI device.
static int icplus_open(struct net_device *netdev)
Open network device.
static struct pci_device_id icplus_nics[]
IC+ PCI device IDs.
#define ICP_ASICCTRL_GLOBALRESET
Global reset.
int mii_reset(struct mii_device *mii)
Reset MII device.
A PCI device ID list entry.
#define le16_to_cpu(value)
void icplus_refill_rx(struct icplus_nic *icp)
Refill receive descriptor ring.
static struct xen_remove_from_physmap * remove
Network device operations.
static int icplus_probe(struct pci_device *pci)
Probe PCI device.
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.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
Network device management.
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
struct mii_bit_basher miibit
MII bit bashing interface.
int mii_find(struct mii_device *mii)
Find PHY address.
#define ICP_NUM_DESC
Number of descriptors.
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
#define ICP_DMACTRL_TXPOLLNOW
Transmit poll now.
struct mii_device mii
MII device.
#define ENOBUFS
No buffer space available.
static struct net_device_operations icplus_operations
IC+ network device operations.
int(* probe)(struct pci_device *pci)
Probe device.
static int icplus_mii_read_bit(struct bit_basher *basher, unsigned int bit_id)
Read input bit.
struct io_buffer * rx_iobuf[ICP_NUM_DESC]
Receive I/O buffers.
#define ICP_ASICCTRL_RESETBUSY
Reset busy.
struct bit_basher basher
Bit-bashing interface.
void * data
Start of data.
#define EIO
Input/output error.
#define ICP_ALIGN
Alignment requirement.
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
#define ICP_PHYCTRL
PHY control register (byte)
#define ICP_PHYCTRL_MGMTDATA
Management data.
#define cpu_to_le16(value)
void iounmap(volatile const void *io_addr)
Unmap I/O address.
uint8_t data[48]
Additional event data.
struct icplus_ring rx
Receive descriptor ring.
int nvs_read(struct nvs_device *nvs, unsigned int address, void *data, size_t len)
Read from non-volatile storage device.
static void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
#define ICP_RX_ERR_LEN
Recieve length error.
uint16_t offset
Offset to command line.
#define ICP_DONE
Descriptor complete.
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
static int icplus_create_ring(struct icplus_nic *icp, struct icplus_ring *ring)
Create descriptor ring.
static int mii_write(struct mii_device *mii, unsigned int reg, unsigned int data)
Write to MII register.
#define ICP_INTSTATUS_TXCOMPLETE
TX complete.
#define ICP_PHYCTRL_LINKSPEED
Link speed.
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)
unsigned int size
Device size (in words)
#define ICP_ASICCTRL_DMA
DMA.
#define ICP_PHYCTRL_MGMTCLK
Management clock.
void * memset(void *dest, int character, size_t len) __nonnull