178 DBGP (
"ifec_pci_probe: " );
211 &
priv->mdio_register, 2 );
241 DBGP (
"ifec_pci_remove\n" );
262 unsigned short intr_status;
264 DBGP (
"ifec_net_close\n" );
281#define INTERRUPT_MASK ( SCBMaskEarlyRx | SCBMaskFlowCtl )
296 DBGP (
"ifec_net_irq\n" );
318 DBGP (
"ifec_net_open: " );
356 cfg->byte[19] = (
options & 0x10 ) ? 0xC0 : 0x80;
362 priv->configured = 1;
365 for ( i = 10; i && !
cfg->status; i-- )
367 if ( !
cfg->status ) {
368 DBG (
"Failed to initiate!\n" );
380 DBG2 (
"rx_start\n" );
404 unsigned short intr_status;
406 DBGP (
"ifec_net_poll\n" );
413 DBG2 (
"poll - status: 0x%04X\n", intr_status );
444 DBGP (
"ifec_net_transmit\n" );
448 DBG (
"TX overflow\n" );
452 DBG2 (
"transmitting packet (%zd bytes). status = %hX, cmd=%hX\n",
456 tcb->
count = 0x01208000;
464 priv->tcb_head = tcb;
487 unsigned int bit_id )
492 unsigned int ret = 0;
495 DBGP (
"ifec_spi_read_bit\n" );
500 return ( ret & mask ) ? 1 : 0;
521 DBGP (
"ifec_spi_write_bit\n" );
545 DBGP (
"ifec_init_eeprom\n" );
556 init_at93c46 ( &
priv->eeprom, 16 );
562 if (
priv->eeprom.address_len == 8 )
563 init_at93c66 ( &
priv->eeprom, 16 );
580 DBGP (
"ifec_mdio_read\n" );
582 outl ( 0x08000000 | ( location << 16 ) | ( phy_id << 21 ),
589 if ( --boguscnt < 0 ) {
590 DBG (
" ifec_mdio_read() time out with val = %X.\n",
594 }
while (! (
val & 0x10000000 ) );
609 DBGP (
"ifec_mdio_setup\n" );
614 & 0x1f, 23 ) | 0x0422;
617 DBG2 (
"DP83840 specific setup, setting register 23 to "
618 "%hX.\n", mdi_reg23 );
624 ( (
options & 0x20) ? 0x2000 : 0 ) |
625 ( (
options & 0x10) ? 0x0100 : 0 ) );
626 DBG2 (
"set mdio_register. " );
637 int phy_id,
int location,
int value )
644 DBGP (
"ifec_mdio_write\n" );
646 outl ( 0x04000000 | ( location << 16 ) | ( phy_id << 21 ) |
value,
652 if ( --boguscnt < 0 ) {
653 DBG (
" ifec_mdio_write() time out with val = %X.\n",
657 }
while (! (
val & 0x10000000 ) );
671 DBGP (
"ifec_reset\n" );
697 DBGP (
"ifec_free\n" );
721 DBGP (
"ifec_rfd_init\n" );
741 DBGP (
"ifec_reprime_ru\n" );
756 unsigned short intr_status )
760 DBGP (
"ifec_check_ru_status\n" );
766 switch ( ( intr_status >> 2 ) & 0xf ) {
775 DBG (
"ifec_net_poll: RU reprimed.\n" );
780 DBG (
"ifec_net_poll: RU state anomaly: %i\n",
786#define RFD_STATUS ( RFD_OK | RFDRxCol | RFDRxErr | RFDShort | \
787 RFDDMAOverrun | RFDNoBufs | RFDCRCError )
803 DBGP (
"ifec_rx_process\n" );
809 DBG2 (
"Got a packet: Len = %d, cur_rx = %d.\n", rx_len,
814 DBG (
"Corrupted packet received. "
815 "Status = %#08hx\n",
status );
820 DBG2 (
"Received packet: %p, len: %d\n", iob, rx_len );
854 DBGP (
"ifec_get_rx_desc\n" );
857 if ( !
priv->rx_iobs[cur] ) {
858 DBG (
"alloc_iob failed. desc. nr: %d\n", cur );
864 priv->rfds[cur] =
priv->rx_iobs[cur]->data;
880 unsigned short intr_status;
882 DBGP (
"ifec_refill_rx_ring\n" );
921 DBGP (
"ifec_rx_setup\n" );
949 DBGP (
"ifec_scb_cmd\n" );
968 unsigned long cmd_ioaddr =
priv->ioaddr +
SCBCmd;
971 DBGP (
"ifec_scb_cmd_wait\n" );
973 for ( ; wait && (
rc =
inb ( cmd_ioaddr ) ); wait-- )
977 DBG (
"ifec_scb_cmd_wait timeout!\n" );
992 DBGP (
"ifec_tx_process\n" );
998 DBG (
"ifec_tx_process : tx error!\n " );
1004 DBG2 (
"tx completion\n" );
1026 DBGP (
"ifec_tx_setup\n" );
1030 if ( !
priv->tcbs ) {
1031 DBG (
"TX-ring allocation failed\n" );
1039 for ( i = 0; i <
TCB_COUNT; i++, tcb++ ) {
1041 tcb->
count = 0x01208000;
1045 tcb->
next = tcb + 1;
1049 priv->tcb_head = --tcb;
1079 DBGP (
"ifec_tx_wake\n" );
1083 if (
priv->configured ) {
1084 priv->configured = 0;
1093 DBG2 (
"ifec_tx_wake: tx idle!\n" );
1114PCI_ROM(0x8086, 0x1029,
"id1029",
"Intel EtherExpressPro100 ID1029", 0),
1115PCI_ROM(0x8086, 0x1030,
"id1030",
"Intel EtherExpressPro100 ID1030", 0),
1116PCI_ROM(0x8086, 0x1031,
"82801cam",
"Intel 82801CAM (ICH3) Chipset Ethernet Controller", 0),
1117PCI_ROM(0x8086, 0x1032,
"eepro100-1032",
"Intel PRO/100 VE Network Connection", 0),
1118PCI_ROM(0x8086, 0x1033,
"eepro100-1033",
"Intel PRO/100 VM Network Connection", 0),
1119PCI_ROM(0x8086, 0x1034,
"eepro100-1034",
"Intel PRO/100 VM Network Connection", 0),
1120PCI_ROM(0x8086, 0x1035,
"eepro100-1035",
"Intel 82801CAM (ICH3) Chipset Ethernet Controller", 0),
1121PCI_ROM(0x8086, 0x1036,
"eepro100-1036",
"Intel 82801CAM (ICH3) Chipset Ethernet Controller", 0),
1122PCI_ROM(0x8086, 0x1037,
"eepro100-1037",
"Intel 82801CAM (ICH3) Chipset Ethernet Controller", 0),
1123PCI_ROM(0x8086, 0x1038,
"id1038",
"Intel PRO/100 VM Network Connection", 0),
1124PCI_ROM(0x8086, 0x1039,
"82562et",
"Intel PRO100 VE 82562ET", 0),
1125PCI_ROM(0x8086, 0x103a,
"id103a",
"Intel Corporation 82559 InBusiness 10/100", 0),
1126PCI_ROM(0x8086, 0x103b,
"82562etb",
"Intel PRO100 VE 82562ETB", 0),
1127PCI_ROM(0x8086, 0x103c,
"eepro100-103c",
"Intel PRO/100 VM Network Connection", 0),
1128PCI_ROM(0x8086, 0x103d,
"eepro100-103d",
"Intel PRO/100 VE Network Connection", 0),
1129PCI_ROM(0x8086, 0x103e,
"eepro100-103e",
"Intel PRO/100 VM Network Connection", 0),
1130PCI_ROM(0x8086, 0x1050,
"82562ez",
"Intel 82562EZ Network Connection", 0),
1131PCI_ROM(0x8086, 0x1051,
"prove",
"Intel PRO/100 VE Network Connection", 0),
1132PCI_ROM(0x8086, 0x1059,
"82551qm",
"Intel PRO/100 M Mobile Connection", 0),
1133PCI_ROM(0x8086, 0x1065,
"82562-3",
"Intel 82562 based Fast Ethernet Connection", 0),
1134PCI_ROM(0x8086, 0x1092,
"82562-3",
"Intel Pro/100 VE Network", 0),
1135PCI_ROM(0x8086, 0x10fe,
"82552",
"Intel 82552 10/100 Network Connection", 0),
1136PCI_ROM(0x8086, 0x1209,
"82559er",
"Intel EtherExpressPro100 82559ER", 0),
1137PCI_ROM(0x8086, 0x1227,
"82865",
"Intel 82865 EtherExpress PRO/100A", 0),
1138PCI_ROM(0x8086, 0x1228,
"82556",
"Intel 82556 EtherExpress PRO/100 Smart", 0),
1139PCI_ROM(0x8086, 0x1229,
"eepro100",
"Intel EtherExpressPro100", 0),
1140PCI_ROM(0x8086, 0x2449,
"82562em",
"Intel EtherExpressPro100 82562EM", 0),
1141PCI_ROM(0x8086, 0x2459,
"82562-1",
"Intel 82562 based Fast Ethernet Connection", 0),
1142PCI_ROM(0x8086, 0x245d,
"82562-2",
"Intel 82562 based Fast Ethernet Connection", 0),
1143PCI_ROM(0x8086, 0x27dc,
"eepro100-27dc",
"Intel 82801G (ICH7) Chipset Ethernet Controller", 0),
1144PCI_ROM(0x8086, 0x5200,
"eepro100-5200",
"Intel EtherExpress PRO/100 Intelligent Server", 0),
1145PCI_ROM(0x8086, 0x5201,
"eepro100-5201",
"Intel EtherExpress PRO/100 Intelligent Server", 0),
#define NULL
NULL pointer (VOID *)
u32 link
Link to next descriptor.
struct arbelprm_rc_send_wqe rc
pseudo_bit_t value[0x00020]
struct arbelprm_completion_with_error error
static unsigned long ioaddr
static int ifec_net_open(struct net_device *netdev)
static void ifec_reset(struct net_device *netdev)
static void ifec_free(struct net_device *netdev)
static struct pci_device_id ifec_nics[]
static void ifec_reprime_ru(struct net_device *netdev)
static struct bit_basher_operations ifec_basher_ops
static void ifec_mdio_setup(struct net_device *netdev, int options)
static void ifec_spi_write_bit(struct bit_basher *basher, unsigned int bit_id, unsigned long data)
static int ifec_scb_cmd_wait(struct net_device *netdev)
static void ifec_net_close(struct net_device *netdev)
static void ifec_rx_process(struct net_device *netdev)
static void ifec_rfd_init(struct ifec_rfd *rfd, s16 command, u32 link)
static int ifec_net_transmit(struct net_device *netdev, struct io_buffer *iobuf)
void ifec_tx_wake(struct net_device *netdev)
static void ifec_init_eeprom(struct net_device *netdev)
static struct net_device_operations ifec_operations
static void ifec_refill_rx_ring(struct net_device *netdev)
static int ifec_pci_probe(struct pci_device *pci)
static int ifec_spi_read_bit(struct bit_basher *basher, unsigned int bit_id)
static int ifec_scb_cmd(struct net_device *netdev, u32 ptr, u8 cmd)
static void ifec_net_irq(struct net_device *netdev, int enable)
static int ifec_rx_setup(struct net_device *netdev)
static void ifec_tx_process(struct net_device *netdev)
static const uint16_t ifec_ee_bits[]
static int ifec_get_rx_desc(struct net_device *netdev, int cur, int cmd, int link)
static int ifec_tx_setup(struct net_device *netdev)
static int ifec_mdio_write(struct net_device *netdev, int phy_id, int location, int value)
static void ifec_pci_remove(struct pci_device *pci)
static void ifec_check_ru_status(struct net_device *netdev, unsigned short intr_status)
static void ifec_net_poll(struct net_device *netdev)
static int ifec_mdio_read(struct net_device *netdev, int phy_id, int location)
#define EEPROM_ADDR_MDIO_REGISTER
#define EEPROM_ADDR_MAC_0
uint8_t data[48]
Additional event data.
static unsigned int cur_rx
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
static struct net_device * netdev
#define DBG(...)
Print a debugging message.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
#define EINVAL
Invalid argument.
#define ENOMEM
Not enough space.
#define ENOBUFS
No buffer space available.
#define outb(data, io_addr)
#define outw(data, io_addr)
#define outl(data, io_addr)
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
void * memset(void *dest, int character, size_t len) __nonnull
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
#define iob_put(iobuf, len)
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
#define iob_reserve(iobuf, len)
void * malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
Dynamic memory allocation.
void netdev_rx(struct net_device *netdev, struct io_buffer *iobuf)
Add packet to receive queue.
void unregister_netdev(struct net_device *netdev)
Unregister network device.
void netdev_tx_complete_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Complete network transmission.
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
int register_netdev(struct net_device *netdev)
Register network device.
Network device management.
static void netdev_link_up(struct net_device *netdev)
Mark network device as having link up.
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
static void netdev_tx_complete(struct net_device *netdev, struct io_buffer *iobuf)
Complete network transmission.
int nvs_read(struct nvs_device *nvs, unsigned int address, void *data, size_t len)
Read from non-volatile storage device.
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
#define __pci_driver
Declare a PCI driver.
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
#define PCI_ROM(_vendor, _device, _name, _description, _data)
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
#define SPI_MODE_THREEWIRE
Threewire-compatible mode.
void init_spi_bit_basher(struct spi_bit_basher *spibit)
Initialise SPI bit-bashing interface.
SPI bit-bashing interface.
@ SPI_BIT_MOSI
Master Out Slave In.
@ SPI_BIT_MISO
Master In Slave Out.
@ SPI_BIT_SCLK
Serial clock.
#define SPI_BIT_SS(slave)
Determine bit index for a particular slave.
#define container_of(ptr, type, field)
Get containing structure.
unsigned short mdio_register
struct spi_bit_basher spi
char packet[RFD_PACKET_LEN]
void * data
Start of data.
Network device operations.
A PCI device ID list entry.
unsigned long ioaddr
I/O address.
struct device dev
Generic device.
int(* probe)(struct pci_device *pci)
Probe device.
struct bit_basher basher
Bit-bashing interface.
int threewire_detect_address_len(struct spi_device *device)
Autodetect device address length.
Three-wire serial interface.
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
static struct tlan_private * priv
static struct xen_remove_from_physmap * remove