iPXE
Macros | Functions | Variables
eepro.c File Reference
#include "etherboot.h"
#include <errno.h>
#include "nic.h"
#include <ipxe/isa.h>
#include <ipxe/ethernet.h>

Go to the source code of this file.

Macros

#define LAN595   0
 
#define LAN595TX   1
 
#define LAN595FX   2
 
#define LAN595FX_10ISA   3
 
#define SLOW_DOWN   inb(0x80);
 
#define SA_ADDR0   0x00 /* Etherexpress Pro/10 */
 
#define SA_ADDR1   0xaa
 
#define SA_ADDR2   0x00
 
#define GetBit(x, y)   ((x & (1<<y))>>y)
 
#define ee_PnP   0 /* Plug 'n Play enable bit */
 
#define ee_Word1   1 /* Word 1? */
 
#define ee_BusWidth   2 /* 8/16 bit */
 
#define ee_FlashAddr   3 /* Flash Address */
 
#define ee_FlashMask   0x7 /* Mask */
 
#define ee_AutoIO   6 /* */
 
#define ee_reserved0   7 /* =0! */
 
#define ee_Flash   8 /* Flash there? */
 
#define ee_AutoNeg   9 /* Auto Negotiation enabled? */
 
#define ee_IO0   10 /* IO Address LSB */
 
#define ee_IO0Mask   0x /*...*/
 
#define ee_IO1   15 /* IO MSB */
 
#define ee_IntSel   0 /* Interrupt */
 
#define ee_IntMask   0x7
 
#define ee_LI   3 /* Link Integrity 0= enabled */
 
#define ee_PC   4 /* Polarity Correction 0= enabled */
 
#define ee_TPE_AUI   5 /* PortSelection 1=TPE */
 
#define ee_Jabber   6 /* Jabber prevention 0= enabled */
 
#define ee_AutoPort   7 /* Auto Port Selection 1= Disabled */
 
#define ee_SMOUT   8 /* SMout Pin Control 0= Input */
 
#define ee_PROM   9 /* Flash EPROM / PROM 0=Flash */
 
#define ee_reserved1   10 /* .. 12 =0! */
 
#define ee_AltReady   13 /* Alternate Ready, 0=normal */
 
#define ee_reserved2   14 /* =0! */
 
#define ee_Duplex   15
 
#define ee_IA5   0 /*bit start for individual Addr Byte 5 */
 
#define ee_IA4   8 /*bit start for individual Addr Byte 5 */
 
#define ee_IA3   0 /*bit start for individual Addr Byte 5 */
 
#define ee_IA2   8 /*bit start for individual Addr Byte 5 */
 
#define ee_IA1   0 /*bit start for individual Addr Byte 5 */
 
#define ee_IA0   8 /*bit start for individual Addr Byte 5 */
 
#define ee_BNC_TPE   0 /* 0=TPE */
 
#define ee_BootType   1 /* 00=None, 01=IPX, 10=ODI, 11=NDIS */
 
#define ee_BootTypeMask   0x3
 
#define ee_NumConn   3 /* Number of Connections 0= One or Two */
 
#define ee_FlashSock   4 /* Presence of Flash Socket 0= Present */
 
#define ee_PortTPE   5
 
#define ee_PortBNC   6
 
#define ee_PortAUI   7
 
#define ee_PowerMgt   10 /* 0= disabled */
 
#define ee_CP   13 /* Concurrent Processing */
 
#define ee_CPMask   0x7
 
#define ee_Stepping   0 /* Stepping info */
 
#define ee_StepMask   0x0F
 
#define ee_BoardID   4 /* Manucaturer Board ID, reserved */
 
#define ee_BoardMask   0x0FFF
 
#define ee_INT_TO_IRQ   0 /* int to IRQ Mapping = 0x1EB8 for Pro/10+ */
 
#define ee_FX_INT2IRQ   0x1EB8 /* the _only_ mapping allowed for FX chips */
 
#define ee_SIZE   0x40 /* total EEprom Size */
 
#define ee_Checksum   0xBABA /* initial and final value for adding checksum */
 
#define ee_addr_vendor   0x10 /* Word offset for EISA Vendor ID */
 
#define ee_addr_id   0x11 /* Word offset for Card ID */
 
#define ee_addr_SN   0x12 /* Serial Number */
 
#define ee_addr_CRC_8   0x14 /* CRC over last thee Bytes */
 
#define ee_vendor_intel0   0x25 /* Vendor ID Intel */
 
#define ee_vendor_intel1   0xD4
 
#define ee_id_eepro10p0   0x10 /* ID for eepro/10+ */
 
#define ee_id_eepro10p1   0x31
 
#define RAM_SIZE   0x8000
 
#define RCV_HEADER   8
 
#define RCV_DEFAULT_RAM   0x6000
 
#define RCV_RAM   rcv_ram
 
#define XMT_HEADER   8
 
#define XMT_RAM   (RAM_SIZE - RCV_RAM)
 
#define XMT_START   ((rcv_start + RCV_RAM) % RAM_SIZE)
 
#define RCV_LOWER_LIMIT   (rcv_start >> 8)
 
#define RCV_UPPER_LIMIT   (((rcv_start + RCV_RAM) - 2) >> 8)
 
#define XMT_LOWER_LIMIT   (XMT_START >> 8)
 
#define XMT_UPPER_LIMIT   (((XMT_START + XMT_RAM) - 2) >> 8)
 
#define RCV_START_PRO   0x00
 
#define RCV_START_10   XMT_RAM
 
#define RCV_DONE   0x0008
 
#define RX_OK   0x2000
 
#define RX_ERROR   0x0d81
 
#define TX_DONE_BIT   0x0080
 
#define CHAIN_BIT   0x8000
 
#define XMT_STATUS   0x02
 
#define XMT_CHAIN   0x04
 
#define XMT_COUNT   0x06
 
#define BANK0_SELECT   0x00
 
#define BANK1_SELECT   0x40
 
#define BANK2_SELECT   0x80
 
#define COMMAND_REG   0x00 /* Register 0 */
 
#define MC_SETUP   0x03
 
#define XMT_CMD   0x04
 
#define DIAGNOSE_CMD   0x07
 
#define RCV_ENABLE_CMD   0x08
 
#define RCV_DISABLE_CMD   0x0a
 
#define STOP_RCV_CMD   0x0b
 
#define RESET_CMD   0x0e
 
#define POWER_DOWN_CMD   0x18
 
#define RESUME_XMT_CMD   0x1c
 
#define SEL_RESET_CMD   0x1e
 
#define STATUS_REG   0x01 /* Register 1 */
 
#define RX_INT   0x02
 
#define TX_INT   0x04
 
#define EXEC_STATUS   0x30
 
#define ID_REG   0x02 /* Register 2 */
 
#define R_ROBIN_BITS   0xc0 /* round robin counter */
 
#define ID_REG_MASK   0x2c
 
#define ID_REG_SIG   0x24
 
#define AUTO_ENABLE   0x10
 
#define INT_MASK_REG   0x03 /* Register 3 */
 
#define RX_STOP_MASK   0x01
 
#define RX_MASK   0x02
 
#define TX_MASK   0x04
 
#define EXEC_MASK   0x08
 
#define ALL_MASK   0x0f
 
#define IO_32_BIT   0x10
 
#define RCV_BAR   0x04 /* The following are word (16-bit) registers */
 
#define RCV_STOP   0x06
 
#define XMT_BAR_PRO   0x0a
 
#define XMT_BAR_10   0x0b
 
#define HOST_ADDRESS_REG   0x0c
 
#define IO_PORT   0x0e
 
#define IO_PORT_32_BIT   0x0c
 
#define REG1   0x01
 
#define WORD_WIDTH   0x02
 
#define INT_ENABLE   0x80
 
#define INT_NO_REG   0x02
 
#define RCV_LOWER_LIMIT_REG   0x08
 
#define RCV_UPPER_LIMIT_REG   0x09
 
#define XMT_LOWER_LIMIT_REG_PRO   0x0a
 
#define XMT_UPPER_LIMIT_REG_PRO   0x0b
 
#define XMT_LOWER_LIMIT_REG_10   0x0b
 
#define XMT_UPPER_LIMIT_REG_10   0x0a
 
#define XMT_Chain_Int   0x20 /* Interrupt at the end of the transmit chain */
 
#define XMT_Chain_ErrStop   0x40 /* Interrupt at the end of the chain even if there are errors */
 
#define RCV_Discard_BadFrame   0x80 /* Throw bad frames away, and continue to receive others */
 
#define REG2   0x02
 
#define PRMSC_Mode   0x01
 
#define Multi_IA   0x20
 
#define REG3   0x03
 
#define TPE_BIT   0x04
 
#define BNC_BIT   0x20
 
#define REG13   0x0d
 
#define FDX   0x00
 
#define A_N_ENABLE   0x02
 
#define I_ADD_REG0   0x04
 
#define I_ADD_REG1   0x05
 
#define I_ADD_REG2   0x06
 
#define I_ADD_REG3   0x07
 
#define I_ADD_REG4   0x08
 
#define I_ADD_REG5   0x09
 
#define EEPROM_REG_PRO   0x0a
 
#define EEPROM_REG_10   0x0b
 
#define EESK   0x01
 
#define EECS   0x02
 
#define EEDI   0x04
 
#define EEDO   0x08
 
#define eeprom_delay()   { udelay(40); }
 
#define EE_READ_CMD   (6 << 6)
 
#define eepro_full_reset(ioaddr)   outb(RESET_CMD, ioaddr); udelay(255);
 
#define eepro_sel_reset(ioaddr)
 
#define eepro_clear_int(ioaddr)   outb(ALL_MASK, ioaddr + STATUS_REG)
 
#define eepro_en_rx(ioaddr)   outb(RCV_ENABLE_CMD, ioaddr)
 
#define eepro_dis_rx(ioaddr)   outb(RCV_DISABLE_CMD, ioaddr)
 
#define eepro_sw2bank0(ioaddr)   outb(BANK0_SELECT, ioaddr)
 
#define eepro_sw2bank1(ioaddr)   outb(BANK1_SELECT, ioaddr)
 
#define eepro_sw2bank2(ioaddr)   outb(BANK2_SELECT, ioaddr)
 

Functions

 FILE_LICENCE (GPL2_OR_LATER)
 
static void eepro_reset (struct nic *nic)
 
static int eepro_poll (struct nic *nic, int retrieve)
 
static void eepro_transmit (struct nic *nic, const char *d, unsigned int t, unsigned int s, const char *p)
 
static void eepro_disable (struct nic *nic, struct isa_device *isa __unused)
 
static void eepro_irq (struct nic *nic __unused, irq_action_t action __unused)
 
static int read_eeprom (uint16_t ioaddr, int location)
 
static int eepro_probe1 (isa_probe_addr_t ioaddr)
 
static int eepro_probe (struct nic *nic, struct isa_device *isa)
 
 ISA_DRIVER (eepro_driver, eepro_probe_addrs, eepro_probe1, GENERIC_ISAPNP_VENDOR, 0x828a)
 
 DRIVER ("eepro", nic_driver, isa_driver, eepro_driver, eepro_probe, eepro_disable)
 
 ISA_ROM ("eepro", "Intel Etherexpress Pro/10")
 

Variables

static unsigned rcv_ram = RCV_DEFAULT_RAM
 
static unsigned rcv_start = RCV_START_PRO
 
static unsigned xmt_bar = XMT_BAR_PRO
 
static unsigned xmt_lower_limit_reg = XMT_LOWER_LIMIT_REG_PRO
 
static unsigned xmt_upper_limit_reg = XMT_UPPER_LIMIT_REG_PRO
 
static unsigned eeprom_reg = EEPROM_REG_PRO
 
static unsigned int rx_start
 
static unsigned int tx_start
 
static int tx_last
 
static unsigned int tx_end
 
static int eepro = 0
 
static unsigned int mem_start
 
static unsigned int mem_end = RCV_DEFAULT_RAM / 1024
 
static struct nic_operations eepro_operations
 
static isa_probe_addr_t eepro_probe_addrs []
 

Macro Definition Documentation

◆ LAN595

#define LAN595   0

Definition at line 53 of file eepro.c.

◆ LAN595TX

#define LAN595TX   1

Definition at line 54 of file eepro.c.

◆ LAN595FX

#define LAN595FX   2

Definition at line 55 of file eepro.c.

◆ LAN595FX_10ISA

#define LAN595FX_10ISA   3

Definition at line 56 of file eepro.c.

◆ SLOW_DOWN

#define SLOW_DOWN   inb(0x80);

Definition at line 58 of file eepro.c.

◆ SA_ADDR0

#define SA_ADDR0   0x00 /* Etherexpress Pro/10 */

Definition at line 61 of file eepro.c.

◆ SA_ADDR1

#define SA_ADDR1   0xaa

Definition at line 62 of file eepro.c.

◆ SA_ADDR2

#define SA_ADDR2   0x00

Definition at line 63 of file eepro.c.

◆ GetBit

#define GetBit (   x,
 
)    ((x & (1<<y))>>y)

Definition at line 65 of file eepro.c.

◆ ee_PnP

#define ee_PnP   0 /* Plug 'n Play enable bit */

Definition at line 68 of file eepro.c.

◆ ee_Word1

#define ee_Word1   1 /* Word 1? */

Definition at line 69 of file eepro.c.

◆ ee_BusWidth

#define ee_BusWidth   2 /* 8/16 bit */

Definition at line 70 of file eepro.c.

◆ ee_FlashAddr

#define ee_FlashAddr   3 /* Flash Address */

Definition at line 71 of file eepro.c.

◆ ee_FlashMask

#define ee_FlashMask   0x7 /* Mask */

Definition at line 72 of file eepro.c.

◆ ee_AutoIO

#define ee_AutoIO   6 /* */

Definition at line 73 of file eepro.c.

◆ ee_reserved0

#define ee_reserved0   7 /* =0! */

Definition at line 74 of file eepro.c.

◆ ee_Flash

#define ee_Flash   8 /* Flash there? */

Definition at line 75 of file eepro.c.

◆ ee_AutoNeg

#define ee_AutoNeg   9 /* Auto Negotiation enabled? */

Definition at line 76 of file eepro.c.

◆ ee_IO0

#define ee_IO0   10 /* IO Address LSB */

Definition at line 77 of file eepro.c.

◆ ee_IO0Mask

#define ee_IO0Mask   0x /*...*/

Definition at line 78 of file eepro.c.

◆ ee_IO1

#define ee_IO1   15 /* IO MSB */

Definition at line 79 of file eepro.c.

◆ ee_IntSel

#define ee_IntSel   0 /* Interrupt */

Definition at line 82 of file eepro.c.

◆ ee_IntMask

#define ee_IntMask   0x7

Definition at line 83 of file eepro.c.

◆ ee_LI

#define ee_LI   3 /* Link Integrity 0= enabled */

Definition at line 84 of file eepro.c.

◆ ee_PC

#define ee_PC   4 /* Polarity Correction 0= enabled */

Definition at line 85 of file eepro.c.

◆ ee_TPE_AUI

#define ee_TPE_AUI   5 /* PortSelection 1=TPE */

Definition at line 86 of file eepro.c.

◆ ee_Jabber

#define ee_Jabber   6 /* Jabber prevention 0= enabled */

Definition at line 87 of file eepro.c.

◆ ee_AutoPort

#define ee_AutoPort   7 /* Auto Port Selection 1= Disabled */

Definition at line 88 of file eepro.c.

◆ ee_SMOUT

#define ee_SMOUT   8 /* SMout Pin Control 0= Input */

Definition at line 89 of file eepro.c.

◆ ee_PROM

#define ee_PROM   9 /* Flash EPROM / PROM 0=Flash */

Definition at line 90 of file eepro.c.

◆ ee_reserved1

#define ee_reserved1   10 /* .. 12 =0! */

Definition at line 91 of file eepro.c.

◆ ee_AltReady

#define ee_AltReady   13 /* Alternate Ready, 0=normal */

Definition at line 92 of file eepro.c.

◆ ee_reserved2

#define ee_reserved2   14 /* =0! */

Definition at line 93 of file eepro.c.

◆ ee_Duplex

#define ee_Duplex   15

Definition at line 94 of file eepro.c.

◆ ee_IA5

#define ee_IA5   0 /*bit start for individual Addr Byte 5 */

Definition at line 97 of file eepro.c.

◆ ee_IA4

#define ee_IA4   8 /*bit start for individual Addr Byte 5 */

Definition at line 98 of file eepro.c.

◆ ee_IA3

#define ee_IA3   0 /*bit start for individual Addr Byte 5 */

Definition at line 99 of file eepro.c.

◆ ee_IA2

#define ee_IA2   8 /*bit start for individual Addr Byte 5 */

Definition at line 100 of file eepro.c.

◆ ee_IA1

#define ee_IA1   0 /*bit start for individual Addr Byte 5 */

Definition at line 101 of file eepro.c.

◆ ee_IA0

#define ee_IA0   8 /*bit start for individual Addr Byte 5 */

Definition at line 102 of file eepro.c.

◆ ee_BNC_TPE

#define ee_BNC_TPE   0 /* 0=TPE */

Definition at line 105 of file eepro.c.

◆ ee_BootType

#define ee_BootType   1 /* 00=None, 01=IPX, 10=ODI, 11=NDIS */

Definition at line 106 of file eepro.c.

◆ ee_BootTypeMask

#define ee_BootTypeMask   0x3

Definition at line 107 of file eepro.c.

◆ ee_NumConn

#define ee_NumConn   3 /* Number of Connections 0= One or Two */

Definition at line 108 of file eepro.c.

◆ ee_FlashSock

#define ee_FlashSock   4 /* Presence of Flash Socket 0= Present */

Definition at line 109 of file eepro.c.

◆ ee_PortTPE

#define ee_PortTPE   5

Definition at line 110 of file eepro.c.

◆ ee_PortBNC

#define ee_PortBNC   6

Definition at line 111 of file eepro.c.

◆ ee_PortAUI

#define ee_PortAUI   7

Definition at line 112 of file eepro.c.

◆ ee_PowerMgt

#define ee_PowerMgt   10 /* 0= disabled */

Definition at line 113 of file eepro.c.

◆ ee_CP

#define ee_CP   13 /* Concurrent Processing */

Definition at line 114 of file eepro.c.

◆ ee_CPMask

#define ee_CPMask   0x7

Definition at line 115 of file eepro.c.

◆ ee_Stepping

#define ee_Stepping   0 /* Stepping info */

Definition at line 118 of file eepro.c.

◆ ee_StepMask

#define ee_StepMask   0x0F

Definition at line 119 of file eepro.c.

◆ ee_BoardID

#define ee_BoardID   4 /* Manucaturer Board ID, reserved */

Definition at line 120 of file eepro.c.

◆ ee_BoardMask

#define ee_BoardMask   0x0FFF

Definition at line 121 of file eepro.c.

◆ ee_INT_TO_IRQ

#define ee_INT_TO_IRQ   0 /* int to IRQ Mapping = 0x1EB8 for Pro/10+ */

Definition at line 124 of file eepro.c.

◆ ee_FX_INT2IRQ

#define ee_FX_INT2IRQ   0x1EB8 /* the _only_ mapping allowed for FX chips */

Definition at line 125 of file eepro.c.

◆ ee_SIZE

#define ee_SIZE   0x40 /* total EEprom Size */

Definition at line 128 of file eepro.c.

◆ ee_Checksum

#define ee_Checksum   0xBABA /* initial and final value for adding checksum */

Definition at line 129 of file eepro.c.

◆ ee_addr_vendor

#define ee_addr_vendor   0x10 /* Word offset for EISA Vendor ID */

Definition at line 133 of file eepro.c.

◆ ee_addr_id

#define ee_addr_id   0x11 /* Word offset for Card ID */

Definition at line 134 of file eepro.c.

◆ ee_addr_SN

#define ee_addr_SN   0x12 /* Serial Number */

Definition at line 135 of file eepro.c.

◆ ee_addr_CRC_8

#define ee_addr_CRC_8   0x14 /* CRC over last thee Bytes */

Definition at line 136 of file eepro.c.

◆ ee_vendor_intel0

#define ee_vendor_intel0   0x25 /* Vendor ID Intel */

Definition at line 139 of file eepro.c.

◆ ee_vendor_intel1

#define ee_vendor_intel1   0xD4

Definition at line 140 of file eepro.c.

◆ ee_id_eepro10p0

#define ee_id_eepro10p0   0x10 /* ID for eepro/10+ */

Definition at line 141 of file eepro.c.

◆ ee_id_eepro10p1

#define ee_id_eepro10p1   0x31

Definition at line 142 of file eepro.c.

◆ RAM_SIZE

#define RAM_SIZE   0x8000

Definition at line 148 of file eepro.c.

◆ RCV_HEADER

#define RCV_HEADER   8

Definition at line 150 of file eepro.c.

◆ RCV_DEFAULT_RAM

#define RCV_DEFAULT_RAM   0x6000

Definition at line 151 of file eepro.c.

◆ RCV_RAM

#define RCV_RAM   rcv_ram

Definition at line 152 of file eepro.c.

◆ XMT_HEADER

#define XMT_HEADER   8

Definition at line 156 of file eepro.c.

◆ XMT_RAM

#define XMT_RAM   (RAM_SIZE - RCV_RAM)

Definition at line 157 of file eepro.c.

◆ XMT_START

#define XMT_START   ((rcv_start + RCV_RAM) % RAM_SIZE)

Definition at line 159 of file eepro.c.

◆ RCV_LOWER_LIMIT

#define RCV_LOWER_LIMIT   (rcv_start >> 8)

Definition at line 161 of file eepro.c.

◆ RCV_UPPER_LIMIT

#define RCV_UPPER_LIMIT   (((rcv_start + RCV_RAM) - 2) >> 8)

Definition at line 162 of file eepro.c.

◆ XMT_LOWER_LIMIT

#define XMT_LOWER_LIMIT   (XMT_START >> 8)

Definition at line 163 of file eepro.c.

◆ XMT_UPPER_LIMIT

#define XMT_UPPER_LIMIT   (((XMT_START + XMT_RAM) - 2) >> 8)

Definition at line 164 of file eepro.c.

◆ RCV_START_PRO

#define RCV_START_PRO   0x00

Definition at line 166 of file eepro.c.

◆ RCV_START_10

#define RCV_START_10   XMT_RAM

Definition at line 167 of file eepro.c.

◆ RCV_DONE

#define RCV_DONE   0x0008

Definition at line 171 of file eepro.c.

◆ RX_OK

#define RX_OK   0x2000

Definition at line 172 of file eepro.c.

◆ RX_ERROR

#define RX_ERROR   0x0d81

Definition at line 173 of file eepro.c.

◆ TX_DONE_BIT

#define TX_DONE_BIT   0x0080

Definition at line 175 of file eepro.c.

◆ CHAIN_BIT

#define CHAIN_BIT   0x8000

Definition at line 176 of file eepro.c.

◆ XMT_STATUS

#define XMT_STATUS   0x02

Definition at line 177 of file eepro.c.

◆ XMT_CHAIN

#define XMT_CHAIN   0x04

Definition at line 178 of file eepro.c.

◆ XMT_COUNT

#define XMT_COUNT   0x06

Definition at line 179 of file eepro.c.

◆ BANK0_SELECT

#define BANK0_SELECT   0x00

Definition at line 181 of file eepro.c.

◆ BANK1_SELECT

#define BANK1_SELECT   0x40

Definition at line 182 of file eepro.c.

◆ BANK2_SELECT

#define BANK2_SELECT   0x80

Definition at line 183 of file eepro.c.

◆ COMMAND_REG

#define COMMAND_REG   0x00 /* Register 0 */

Definition at line 186 of file eepro.c.

◆ MC_SETUP

#define MC_SETUP   0x03

Definition at line 187 of file eepro.c.

◆ XMT_CMD

#define XMT_CMD   0x04

Definition at line 188 of file eepro.c.

◆ DIAGNOSE_CMD

#define DIAGNOSE_CMD   0x07

Definition at line 189 of file eepro.c.

◆ RCV_ENABLE_CMD

#define RCV_ENABLE_CMD   0x08

Definition at line 190 of file eepro.c.

◆ RCV_DISABLE_CMD

#define RCV_DISABLE_CMD   0x0a

Definition at line 191 of file eepro.c.

◆ STOP_RCV_CMD

#define STOP_RCV_CMD   0x0b

Definition at line 192 of file eepro.c.

◆ RESET_CMD

#define RESET_CMD   0x0e

Definition at line 193 of file eepro.c.

◆ POWER_DOWN_CMD

#define POWER_DOWN_CMD   0x18

Definition at line 194 of file eepro.c.

◆ RESUME_XMT_CMD

#define RESUME_XMT_CMD   0x1c

Definition at line 195 of file eepro.c.

◆ SEL_RESET_CMD

#define SEL_RESET_CMD   0x1e

Definition at line 196 of file eepro.c.

◆ STATUS_REG

#define STATUS_REG   0x01 /* Register 1 */

Definition at line 197 of file eepro.c.

◆ RX_INT

#define RX_INT   0x02

Definition at line 198 of file eepro.c.

◆ TX_INT

#define TX_INT   0x04

Definition at line 199 of file eepro.c.

◆ EXEC_STATUS

#define EXEC_STATUS   0x30

Definition at line 200 of file eepro.c.

◆ ID_REG

#define ID_REG   0x02 /* Register 2 */

Definition at line 201 of file eepro.c.

◆ R_ROBIN_BITS

#define R_ROBIN_BITS   0xc0 /* round robin counter */

Definition at line 202 of file eepro.c.

◆ ID_REG_MASK

#define ID_REG_MASK   0x2c

Definition at line 203 of file eepro.c.

◆ ID_REG_SIG

#define ID_REG_SIG   0x24

Definition at line 204 of file eepro.c.

◆ AUTO_ENABLE

#define AUTO_ENABLE   0x10

Definition at line 205 of file eepro.c.

◆ INT_MASK_REG

#define INT_MASK_REG   0x03 /* Register 3 */

Definition at line 206 of file eepro.c.

◆ RX_STOP_MASK

#define RX_STOP_MASK   0x01

Definition at line 207 of file eepro.c.

◆ RX_MASK

#define RX_MASK   0x02

Definition at line 208 of file eepro.c.

◆ TX_MASK

#define TX_MASK   0x04

Definition at line 209 of file eepro.c.

◆ EXEC_MASK

#define EXEC_MASK   0x08

Definition at line 210 of file eepro.c.

◆ ALL_MASK

#define ALL_MASK   0x0f

Definition at line 211 of file eepro.c.

◆ IO_32_BIT

#define IO_32_BIT   0x10

Definition at line 212 of file eepro.c.

◆ RCV_BAR

#define RCV_BAR   0x04 /* The following are word (16-bit) registers */

Definition at line 213 of file eepro.c.

◆ RCV_STOP

#define RCV_STOP   0x06

Definition at line 214 of file eepro.c.

◆ XMT_BAR_PRO

#define XMT_BAR_PRO   0x0a

Definition at line 216 of file eepro.c.

◆ XMT_BAR_10

#define XMT_BAR_10   0x0b

Definition at line 217 of file eepro.c.

◆ HOST_ADDRESS_REG

#define HOST_ADDRESS_REG   0x0c

Definition at line 220 of file eepro.c.

◆ IO_PORT

#define IO_PORT   0x0e

Definition at line 221 of file eepro.c.

◆ IO_PORT_32_BIT

#define IO_PORT_32_BIT   0x0c

Definition at line 222 of file eepro.c.

◆ REG1

#define REG1   0x01

Definition at line 225 of file eepro.c.

◆ WORD_WIDTH

#define WORD_WIDTH   0x02

Definition at line 226 of file eepro.c.

◆ INT_ENABLE

#define INT_ENABLE   0x80

Definition at line 227 of file eepro.c.

◆ INT_NO_REG

#define INT_NO_REG   0x02

Definition at line 228 of file eepro.c.

◆ RCV_LOWER_LIMIT_REG

#define RCV_LOWER_LIMIT_REG   0x08

Definition at line 229 of file eepro.c.

◆ RCV_UPPER_LIMIT_REG

#define RCV_UPPER_LIMIT_REG   0x09

Definition at line 230 of file eepro.c.

◆ XMT_LOWER_LIMIT_REG_PRO

#define XMT_LOWER_LIMIT_REG_PRO   0x0a

Definition at line 232 of file eepro.c.

◆ XMT_UPPER_LIMIT_REG_PRO

#define XMT_UPPER_LIMIT_REG_PRO   0x0b

Definition at line 233 of file eepro.c.

◆ XMT_LOWER_LIMIT_REG_10

#define XMT_LOWER_LIMIT_REG_10   0x0b

Definition at line 234 of file eepro.c.

◆ XMT_UPPER_LIMIT_REG_10

#define XMT_UPPER_LIMIT_REG_10   0x0a

Definition at line 235 of file eepro.c.

◆ XMT_Chain_Int

#define XMT_Chain_Int   0x20 /* Interrupt at the end of the transmit chain */

Definition at line 240 of file eepro.c.

◆ XMT_Chain_ErrStop

#define XMT_Chain_ErrStop   0x40 /* Interrupt at the end of the chain even if there are errors */

Definition at line 241 of file eepro.c.

◆ RCV_Discard_BadFrame

#define RCV_Discard_BadFrame   0x80 /* Throw bad frames away, and continue to receive others */

Definition at line 242 of file eepro.c.

◆ REG2

#define REG2   0x02

Definition at line 243 of file eepro.c.

◆ PRMSC_Mode

#define PRMSC_Mode   0x01

Definition at line 244 of file eepro.c.

◆ Multi_IA

#define Multi_IA   0x20

Definition at line 245 of file eepro.c.

◆ REG3

#define REG3   0x03

Definition at line 246 of file eepro.c.

◆ TPE_BIT

#define TPE_BIT   0x04

Definition at line 247 of file eepro.c.

◆ BNC_BIT

#define BNC_BIT   0x20

Definition at line 248 of file eepro.c.

◆ REG13

#define REG13   0x0d

Definition at line 249 of file eepro.c.

◆ FDX

#define FDX   0x00

Definition at line 250 of file eepro.c.

◆ A_N_ENABLE

#define A_N_ENABLE   0x02

Definition at line 251 of file eepro.c.

◆ I_ADD_REG0

#define I_ADD_REG0   0x04

Definition at line 253 of file eepro.c.

◆ I_ADD_REG1

#define I_ADD_REG1   0x05

Definition at line 254 of file eepro.c.

◆ I_ADD_REG2

#define I_ADD_REG2   0x06

Definition at line 255 of file eepro.c.

◆ I_ADD_REG3

#define I_ADD_REG3   0x07

Definition at line 256 of file eepro.c.

◆ I_ADD_REG4

#define I_ADD_REG4   0x08

Definition at line 257 of file eepro.c.

◆ I_ADD_REG5

#define I_ADD_REG5   0x09

Definition at line 258 of file eepro.c.

◆ EEPROM_REG_PRO

#define EEPROM_REG_PRO   0x0a

Definition at line 260 of file eepro.c.

◆ EEPROM_REG_10

#define EEPROM_REG_10   0x0b

Definition at line 261 of file eepro.c.

◆ EESK

#define EESK   0x01

Definition at line 264 of file eepro.c.

◆ EECS

#define EECS   0x02

Definition at line 265 of file eepro.c.

◆ EEDI

#define EEDI   0x04

Definition at line 266 of file eepro.c.

◆ EEDO

#define EEDO   0x08

Definition at line 267 of file eepro.c.

◆ eeprom_delay

#define eeprom_delay ( )    { udelay(40); }

Definition at line 273 of file eepro.c.

◆ EE_READ_CMD

#define EE_READ_CMD   (6 << 6)

Definition at line 274 of file eepro.c.

◆ eepro_full_reset

#define eepro_full_reset (   ioaddr)    outb(RESET_CMD, ioaddr); udelay(255);

Definition at line 277 of file eepro.c.

◆ eepro_sel_reset

#define eepro_sel_reset (   ioaddr)
Value:
do { \
outb ( SEL_RESET_CMD, ioaddr ); \
(void) SLOW_DOWN; \
(void) SLOW_DOWN; \
} while (0)
static unsigned long ioaddr
Definition: davicom.c:129
#define SLOW_DOWN
Definition: eepro.c:58
#define SEL_RESET_CMD
Definition: eepro.c:196

Definition at line 280 of file eepro.c.

◆ eepro_clear_int

#define eepro_clear_int (   ioaddr)    outb(ALL_MASK, ioaddr + STATUS_REG)

Definition at line 288 of file eepro.c.

◆ eepro_en_rx

#define eepro_en_rx (   ioaddr)    outb(RCV_ENABLE_CMD, ioaddr)

Definition at line 291 of file eepro.c.

◆ eepro_dis_rx

#define eepro_dis_rx (   ioaddr)    outb(RCV_DISABLE_CMD, ioaddr)

Definition at line 294 of file eepro.c.

◆ eepro_sw2bank0

#define eepro_sw2bank0 (   ioaddr)    outb(BANK0_SELECT, ioaddr)

Definition at line 297 of file eepro.c.

◆ eepro_sw2bank1

#define eepro_sw2bank1 (   ioaddr)    outb(BANK1_SELECT, ioaddr)

Definition at line 298 of file eepro.c.

◆ eepro_sw2bank2

#define eepro_sw2bank2 (   ioaddr)    outb(BANK2_SELECT, ioaddr)

Definition at line 299 of file eepro.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER  )

◆ eepro_reset()

static void eepro_reset ( struct nic nic)
static

Definition at line 310 of file eepro.c.

311 {
312  int temp_reg, i;
313 
314  /* put the card in its initial state */
315  eepro_sw2bank2(nic->ioaddr); /* be careful, bank2 now */
316  temp_reg = inb(nic->ioaddr + eeprom_reg);
317  DBG("Stepping %d\n", temp_reg >> 5);
318  if (temp_reg & 0x10) /* check the TurnOff Enable bit */
319  outb(temp_reg & 0xEF, nic->ioaddr + eeprom_reg);
320  for (i = 0; i < ETH_ALEN; i++) /* fill the MAC address */
321  outb(nic->node_addr[i], nic->ioaddr + I_ADD_REG0 + i);
322  temp_reg = inb(nic->ioaddr + REG1);
323  /* setup Transmit Chaining and discard bad RCV frames */
326  temp_reg = inb(nic->ioaddr + REG2); /* match broadcast */
327  outb(temp_reg | 0x14, nic->ioaddr + REG2);
328  temp_reg = inb(nic->ioaddr + REG3);
329  outb(temp_reg & 0x3F, nic->ioaddr + REG3); /* clear test mode */
330  /* set the receiving mode */
331  eepro_sw2bank1(nic->ioaddr); /* be careful, bank1 now */
332  /* initialise the RCV and XMT upper and lower limits */
337  eepro_sw2bank0(nic->ioaddr); /* Switch back to bank 0 */
339  /* Initialise RCV */
341  outw(((RCV_UPPER_LIMIT << 8) | 0xFE), nic->ioaddr + RCV_STOP);
342  /* Make sure 1st poll won't find a valid packet header */
344  outw(0, nic->ioaddr + IO_PORT);
345  /* Intialise XMT */
346  outw((XMT_LOWER_LIMIT << 8), nic->ioaddr + xmt_bar);
348  tx_start = tx_end = (unsigned int) (XMT_LOWER_LIMIT << 8);
349  tx_last = 0;
351 }
#define eepro_sel_reset(ioaddr)
Definition: eepro.c:280
static unsigned int rx_start
Definition: eepro.c:301
#define outw(data, io_addr)
Definition: io.h:319
#define eepro_sw2bank2(ioaddr)
Definition: eepro.c:299
static int tx_last
Definition: eepro.c:302
static unsigned eeprom_reg
Definition: eepro.c:262
#define XMT_Chain_Int
Definition: eepro.c:240
#define I_ADD_REG0
Definition: eepro.c:253
static unsigned xmt_upper_limit_reg
Definition: eepro.c:237
unsigned int ioaddr
Definition: nic.h:55
#define REG1
Definition: eepro.c:225
#define XMT_Chain_ErrStop
Definition: eepro.c:241
#define REG2
Definition: eepro.c:243
static unsigned xmt_lower_limit_reg
Definition: eepro.c:236
#define eepro_sw2bank0(ioaddr)
Definition: eepro.c:297
#define RCV_LOWER_LIMIT
Definition: eepro.c:161
#define RCV_BAR
Definition: eepro.c:213
uint8_t inb(volatile uint8_t *io_addr)
Read byte from I/O-mapped device.
#define ETH_ALEN
Definition: if_ether.h:8
#define IO_PORT
Definition: eepro.c:221
#define eepro_sw2bank1(ioaddr)
Definition: eepro.c:298
static unsigned xmt_bar
Definition: eepro.c:218
Definition: nic.h:49
#define XMT_UPPER_LIMIT
Definition: eepro.c:164
unsigned char * node_addr
Definition: nic.h:52
#define outb(data, io_addr)
Definition: io.h:309
#define RCV_UPPER_LIMIT
Definition: eepro.c:162
#define RCV_Discard_BadFrame
Definition: eepro.c:242
static unsigned int tx_start
Definition: eepro.c:301
#define XMT_LOWER_LIMIT
Definition: eepro.c:163
static unsigned int tx_end
Definition: eepro.c:303
#define HOST_ADDRESS_REG
Definition: eepro.c:220
#define eepro_clear_int(ioaddr)
Definition: eepro.c:288
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
#define RCV_LOWER_LIMIT_REG
Definition: eepro.c:229
#define RCV_STOP
Definition: eepro.c:214
#define RCV_UPPER_LIMIT_REG
Definition: eepro.c:230
#define eepro_en_rx(ioaddr)
Definition: eepro.c:291
#define REG3
Definition: eepro.c:246

References DBG, eepro_clear_int, eepro_en_rx, eepro_sel_reset, eepro_sw2bank0, eepro_sw2bank1, eepro_sw2bank2, eeprom_reg, ETH_ALEN, HOST_ADDRESS_REG, I_ADD_REG0, inb(), IO_PORT, nic::ioaddr, nic::node_addr, outb, outw, RCV_BAR, RCV_Discard_BadFrame, RCV_LOWER_LIMIT, RCV_LOWER_LIMIT_REG, RCV_STOP, RCV_UPPER_LIMIT, RCV_UPPER_LIMIT_REG, REG1, REG2, REG3, rx_start, tx_end, tx_last, tx_start, xmt_bar, XMT_Chain_ErrStop, XMT_Chain_Int, XMT_LOWER_LIMIT, xmt_lower_limit_reg, XMT_UPPER_LIMIT, and xmt_upper_limit_reg.

Referenced by eepro_probe().

◆ eepro_poll()

static int eepro_poll ( struct nic nic,
int  retrieve 
)
static

Definition at line 356 of file eepro.c.

357 {
358  unsigned int rcv_car = rx_start;
359  unsigned int rcv_event, rcv_status, rcv_next_frame, rcv_size;
360 
361  /* return true if there's an ethernet packet ready to read */
362  /* nic->packet should contain data on return */
363  /* nic->packetlen should contain length of data */
364 #if 0
365  if ((inb(nic->ioaddr + STATUS_REG) & 0x40) == 0)
366  return (0);
367  outb(0x40, nic->ioaddr + STATUS_REG);
368 #endif
369  outw(rcv_car, nic->ioaddr + HOST_ADDRESS_REG);
370  rcv_event = inw(nic->ioaddr + IO_PORT);
371  if (rcv_event != RCV_DONE)
372  return (0);
373 
374  /* FIXME: I'm guessing this might not work with this card, since
375  it looks like once a rcv_event is started it must be completed.
376  maybe there's another way. */
377  if ( ! retrieve ) return 1;
378 
379  rcv_status = inw(nic->ioaddr + IO_PORT);
380  rcv_next_frame = inw(nic->ioaddr + IO_PORT);
381  rcv_size = inw(nic->ioaddr + IO_PORT);
382 #if 0
383  printf("%hX %hX %d %hhX\n", rcv_status, rcv_next_frame, rcv_size,
384  inb(nic->ioaddr + STATUS_REG));
385 #endif
386  if ((rcv_status & (RX_OK|RX_ERROR)) != RX_OK) {
387  printf("Receive error %hX\n", rcv_status);
388  return (0);
389  }
390  rcv_size &= 0x3FFF;
391  insw(nic->ioaddr + IO_PORT, nic->packet, ((rcv_size + 3) >> 1));
392 #if 0
393 {
394  int i;
395  for (i = 0; i < 48; i++) {
396  printf("%hhX", nic->packet[i]);
397  putchar(i % 16 == 15 ? '\n' : ' ');
398  }
399 }
400 #endif
401  nic->packetlen = rcv_size;
402  rcv_car = (rx_start + RCV_HEADER + rcv_size);
403  rx_start = rcv_next_frame;
404 /*
405  hex_dump(rcv_car, nic->packetlen);
406 */
407 
408  if (rcv_car == 0)
409  rcv_car = ((RCV_UPPER_LIMIT << 8) | 0xff);
410  outw(rcv_car - 1, nic->ioaddr + RCV_STOP);
411  return (1);
412 }
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
uint16_t inw(volatile uint16_t *io_addr)
Read 16-bit word from I/O-mapped device.
static unsigned int rx_start
Definition: eepro.c:301
#define outw(data, io_addr)
Definition: io.h:319
unsigned int ioaddr
Definition: nic.h:55
unsigned int packetlen
Definition: nic.h:54
#define RX_OK
Definition: eepro.c:172
void insw(volatile uint16_t *io_addr, uint16_t *data, unsigned int count)
Read 16-bit words from I/O-mapped device.
uint8_t inb(volatile uint8_t *io_addr)
Read byte from I/O-mapped device.
#define STATUS_REG
Definition: eepro.c:197
#define IO_PORT
Definition: eepro.c:221
Definition: nic.h:49
#define RCV_DONE
Definition: eepro.c:171
#define RX_ERROR
Definition: eepro.c:173
unsigned char * packet
Definition: nic.h:53
#define outb(data, io_addr)
Definition: io.h:309
#define RCV_UPPER_LIMIT
Definition: eepro.c:162
#define RCV_HEADER
Definition: eepro.c:150
#define HOST_ADDRESS_REG
Definition: eepro.c:220
#define RCV_STOP
Definition: eepro.c:214
int putchar(int character)
Write a single character to each console device.
Definition: console.c:28

References HOST_ADDRESS_REG, inb(), insw(), inw(), IO_PORT, nic::ioaddr, outb, outw, nic::packet, nic::packetlen, printf(), putchar(), RCV_DONE, RCV_HEADER, RCV_STOP, RCV_UPPER_LIMIT, RX_ERROR, RX_OK, rx_start, and STATUS_REG.

◆ eepro_transmit()

static void eepro_transmit ( struct nic nic,
const char *  d,
unsigned int  t,
unsigned int  s,
const char *  p 
)
static

Definition at line 417 of file eepro.c.

423 {
424  unsigned int status, tx_available, last, end, length;
425  unsigned short type;
426  int boguscount = 20;
427 
428  length = s + ETH_HLEN;
429  if (tx_end > tx_start)
430  tx_available = XMT_RAM - (tx_end - tx_start);
431  else if (tx_end < tx_start)
432  tx_available = tx_start - tx_end;
433  else
434  tx_available = XMT_RAM;
435  assert ( length <= tx_available );
436  last = tx_end;
437  end = last + (((length + 3) >> 1) << 1) + XMT_HEADER;
438  if (end >= (XMT_UPPER_LIMIT << 8)) {
439  last = (XMT_LOWER_LIMIT << 8);
440  end = last + (((length + 3) >> 1) << 1) + XMT_HEADER;
441  }
444  outw(0, nic->ioaddr + IO_PORT);
445  outw(end, nic->ioaddr + IO_PORT);
447  outsw(nic->ioaddr + IO_PORT, d, ETH_ALEN / 2);
449  type = htons(t);
450  outsw(nic->ioaddr + IO_PORT, &type, sizeof(type) / 2);
451  outsw(nic->ioaddr + IO_PORT, p, (s + 3) >> 1);
452  /* A dummy read to flush the DRAM write pipeline */
453  status = inw(nic->ioaddr + IO_PORT);
454  outw(last, nic->ioaddr + xmt_bar);
455  outb(XMT_CMD, nic->ioaddr);
456  tx_start = last;
457  tx_last = last;
458  tx_end = end;
459 #if 0
460  printf("%d %d\n", tx_start, tx_end);
461 #endif
462  while (boguscount > 0) {
463  if (((status = inw(nic->ioaddr + IO_PORT)) & TX_DONE_BIT) == 0) {
464  udelay(40);
465  boguscount--;
466  continue;
467  }
468  if ((status & 0x2000) == 0) {
469  DBG("Transmit status %hX\n", status);
470  }
471  }
472 }
u16 length
Definition: sky2.h:9
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
uint16_t inw(volatile uint16_t *io_addr)
Read 16-bit word from I/O-mapped device.
#define outw(data, io_addr)
Definition: io.h:319
void outsw(volatile uint16_t *io_addr, const uint16_t *data, unsigned int count)
Write 16-bit words to I/O-mapped device.
static int tx_last
Definition: eepro.c:302
#define XMT_CMD
Definition: eepro.c:188
uint8_t status
Status.
Definition: ena.h:16
unsigned int ioaddr
Definition: nic.h:55
#define ETH_HLEN
Definition: if_ether.h:9
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition: timer.c:60
#define XMT_HEADER
Definition: eepro.c:156
#define ETH_ALEN
Definition: if_ether.h:8
#define IO_PORT
Definition: eepro.c:221
uint32_t last
Length to read in last segment, or zero.
Definition: pccrc.h:30
static unsigned xmt_bar
Definition: eepro.c:218
Definition: nic.h:49
#define XMT_UPPER_LIMIT
Definition: eepro.c:164
unsigned char * node_addr
Definition: nic.h:52
#define outb(data, io_addr)
Definition: io.h:309
uint32_t type
Operating system type.
Definition: ena.h:12
uint32_t d
Definition: md4.c:31
uint32_t end
Ending offset.
Definition: netvsc.h:18
static unsigned int tx_start
Definition: eepro.c:301
#define XMT_LOWER_LIMIT
Definition: eepro.c:163
static unsigned int tx_end
Definition: eepro.c:303
#define HOST_ADDRESS_REG
Definition: eepro.c:220
#define XMT_RAM
Definition: eepro.c:157
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
#define htons(value)
Definition: byteswap.h:135
#define TX_DONE_BIT
Definition: eepro.c:175

References assert(), d, DBG, end, ETH_ALEN, ETH_HLEN, HOST_ADDRESS_REG, htons, inw(), IO_PORT, nic::ioaddr, last, length, nic::node_addr, outb, outsw(), outw, printf(), status, TX_DONE_BIT, tx_end, tx_last, tx_start, type, udelay(), xmt_bar, XMT_CMD, XMT_HEADER, XMT_LOWER_LIMIT, XMT_RAM, and XMT_UPPER_LIMIT.

◆ eepro_disable()

static void eepro_disable ( struct nic nic,
struct isa_device *isa  __unused 
)
static

Definition at line 477 of file eepro.c.

477  {
478  eepro_sw2bank0(nic->ioaddr); /* Switch to bank 0 */
479  /* Flush the Tx and disable Rx */
481  tx_start = tx_end = (XMT_LOWER_LIMIT << 8);
482  tx_last = 0;
483  /* Reset the 82595 */
485 }
static int tx_last
Definition: eepro.c:302
unsigned int ioaddr
Definition: nic.h:55
#define eepro_sw2bank0(ioaddr)
Definition: eepro.c:297
Definition: nic.h:49
#define STOP_RCV_CMD
Definition: eepro.c:192
#define outb(data, io_addr)
Definition: io.h:309
static unsigned int tx_start
Definition: eepro.c:301
#define XMT_LOWER_LIMIT
Definition: eepro.c:163
static unsigned int tx_end
Definition: eepro.c:303
#define eepro_full_reset(ioaddr)
Definition: eepro.c:277

References eepro_full_reset, eepro_sw2bank0, nic::ioaddr, outb, STOP_RCV_CMD, tx_end, tx_last, tx_start, and XMT_LOWER_LIMIT.

◆ eepro_irq()

static void eepro_irq ( struct nic *nic  __unused,
irq_action_t action  __unused 
)
static

Definition at line 490 of file eepro.c.

491 {
492  switch ( action ) {
493  case DISABLE :
494  break;
495  case ENABLE :
496  break;
497  case FORCE :
498  break;
499  }
500 }
Definition: nic.h:35
Definition: nic.h:37
Definition: nic.h:36

References DISABLE, ENABLE, and FORCE.

◆ read_eeprom()

static int read_eeprom ( uint16_t  ioaddr,
int  location 
)
static

Definition at line 502 of file eepro.c.

503 {
504  int i;
505  unsigned short retval = 0;
506  int ee_addr = ioaddr + eeprom_reg;
507  int read_cmd = location | EE_READ_CMD;
508  int ctrl_val = EECS;
509 
510  if (eepro == LAN595FX_10ISA) {
512  outb(0x00, ioaddr + STATUS_REG);
513  }
515  outb(ctrl_val, ee_addr);
516  /* shift the read command bits out */
517  for (i = 8; i >= 0; i--) {
518  short outval = (read_cmd & (1 << i)) ? ctrl_val | EEDI : ctrl_val;
519  outb(outval, ee_addr);
520  outb(outval | EESK, ee_addr); /* EEPROM clock tick */
521  eeprom_delay();
522  outb(outval, ee_addr); /* finish EEPROM clock tick */
523  eeprom_delay();
524  }
525  outb(ctrl_val, ee_addr);
526  for (i = 16; i > 0; i--) {
527  outb(ctrl_val | EESK, ee_addr);
528  eeprom_delay();
529  retval = (retval << 1) | ((inb(ee_addr) & EEDO) ? 1 : 0);
530  outb(ctrl_val, ee_addr);
531  eeprom_delay();
532  }
533  /* terminate the EEPROM access */
534  ctrl_val &= ~EECS;
535  outb(ctrl_val | EESK, ee_addr);
536  eeprom_delay();
537  outb(ctrl_val, ee_addr);
538  eeprom_delay();
540  return (retval);
541 }
#define eepro_sw2bank2(ioaddr)
Definition: eepro.c:299
static unsigned eeprom_reg
Definition: eepro.c:262
#define LAN595FX_10ISA
Definition: eepro.c:56
#define EEDO
Definition: eepro.c:267
static unsigned long ioaddr
Definition: davicom.c:129
#define EEDI
Definition: eepro.c:266
#define EECS
Definition: eepro.c:265
static int eepro
Definition: eepro.c:304
#define eepro_sw2bank0(ioaddr)
Definition: eepro.c:297
uint8_t inb(volatile uint8_t *io_addr)
Read byte from I/O-mapped device.
#define STATUS_REG
Definition: eepro.c:197
#define eepro_sw2bank1(ioaddr)
Definition: eepro.c:298
unsigned long retval
Definition: xen.h:45
#define outb(data, io_addr)
Definition: io.h:309
#define eeprom_delay()
Definition: eepro.c:273
#define EESK
Definition: eepro.c:264
#define EE_READ_CMD
Definition: eepro.c:274
static struct command_descriptor read_cmd
"read" command descriptor
Definition: nvo_cmd.c:134

References EE_READ_CMD, EECS, EEDI, EEDO, eepro, eepro_sw2bank0, eepro_sw2bank1, eepro_sw2bank2, eeprom_delay, eeprom_reg, EESK, inb(), ioaddr, LAN595FX_10ISA, outb, read_cmd, retval, and STATUS_REG.

Referenced by eepro_probe().

◆ eepro_probe1()

static int eepro_probe1 ( isa_probe_addr_t  ioaddr)
static

Definition at line 543 of file eepro.c.

543  {
544  int id, counter;
545 
546  id = inb(ioaddr + ID_REG);
547  if ((id & ID_REG_MASK) != ID_REG_SIG)
548  return (0);
549  counter = id & R_ROBIN_BITS;
550  if (((id = inb(ioaddr + ID_REG)) & R_ROBIN_BITS) != (counter + 0x40))
551  return (0);
552  /* yes the 82595 has been found */
553  return (1);
554 }
#define ID_REG
Definition: eepro.c:201
static unsigned long ioaddr
Definition: davicom.c:129
#define ID_REG_SIG
Definition: eepro.c:204
uint8_t id
Request identifier.
Definition: ena.h:12
#define R_ROBIN_BITS
Definition: eepro.c:202
uint8_t inb(volatile uint8_t *io_addr)
Read byte from I/O-mapped device.
#define ID_REG_MASK
Definition: eepro.c:203

References id, ID_REG, ID_REG_MASK, ID_REG_SIG, inb(), ioaddr, and R_ROBIN_BITS.

◆ eepro_probe()

static int eepro_probe ( struct nic nic,
struct isa_device isa 
)
static

Definition at line 567 of file eepro.c.

567  {
568 
569  int i, l_eepro = 0;
570  union {
571  unsigned char caddr[ETH_ALEN];
572  unsigned short saddr[ETH_ALEN/2];
573  } station_addr;
574  const char *name;
575 
576  nic->irqno = 0;
577  nic->ioaddr = isa->ioaddr;
578 
579  station_addr.saddr[2] = read_eeprom(nic->ioaddr,2);
580  if ( ( station_addr.saddr[2] == 0x0000 ) ||
581  ( station_addr.saddr[2] == 0xFFFF ) ) {
582  l_eepro = 3;
588  station_addr.saddr[2] = read_eeprom(nic->ioaddr,2);
589  }
590  station_addr.saddr[1] = read_eeprom(nic->ioaddr,3);
591  station_addr.saddr[0] = read_eeprom(nic->ioaddr,4);
592  if (l_eepro)
593  name = "Intel EtherExpress 10 ISA";
594  else if (read_eeprom(nic->ioaddr,7) == ee_FX_INT2IRQ) {
595  name = "Intel EtherExpress Pro/10+ ISA";
596  l_eepro = 2;
597  } else if (station_addr.saddr[0] == SA_ADDR1) {
598  name = "Intel EtherExpress Pro/10 ISA";
599  l_eepro = 1;
600  } else {
601  l_eepro = 0;
602  name = "Intel 82595-based LAN card";
603  }
604  station_addr.saddr[0] = bswap_16(station_addr.saddr[0]);
605  station_addr.saddr[1] = bswap_16(station_addr.saddr[1]);
606  station_addr.saddr[2] = bswap_16(station_addr.saddr[2]);
607  for (i = 0; i < ETH_ALEN; i++) {
608  nic->node_addr[i] = station_addr.caddr[i];
609  }
610 
611  DBG ( "%s ioaddr %#hX, addr %s", name, nic->ioaddr, eth_ntoa ( nic->node_addr ) );
612 
613  mem_start = RCV_LOWER_LIMIT << 8;
614  if ((mem_end & 0x3F) < 3 || (mem_end & 0x3F) > 29)
615  mem_end = RCV_UPPER_LIMIT << 8;
616  else {
617  mem_end = mem_end * 1024 + (RCV_LOWER_LIMIT << 8);
618  rcv_ram = mem_end - (RCV_LOWER_LIMIT << 8);
619  }
620  printf(", Rx mem %dK, if %s\n", (mem_end - mem_start) >> 10,
621  GetBit(read_eeprom(nic->ioaddr,5), ee_BNC_TPE) ? "BNC" : "TP");
622 
623  eepro_reset(nic);
624 
625  /* point to NIC specific routines */
627  return 1;
628 }
unsigned char irqno
Definition: nic.h:56
#define XMT_LOWER_LIMIT_REG_10
Definition: eepro.c:234
#define ee_BNC_TPE
Definition: eepro.c:105
const char * name
Definition: ath9k_hw.c:1984
uint16_t ioaddr
I/O address.
Definition: isa.h:16
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
static int read_eeprom(uint16_t ioaddr, int location)
Definition: eepro.c:502
static unsigned eeprom_reg
Definition: eepro.c:262
#define ee_FX_INT2IRQ
Definition: eepro.c:125
static struct nic_operations eepro_operations
Definition: eepro.c:556
#define LAN595FX_10ISA
Definition: eepro.c:56
#define RCV_START_10
Definition: eepro.c:167
#define SA_ADDR1
Definition: eepro.c:62
static unsigned int mem_start
Definition: eepro.c:305
static unsigned xmt_upper_limit_reg
Definition: eepro.c:237
unsigned int ioaddr
Definition: nic.h:55
static unsigned rcv_start
Definition: eepro.c:169
#define GetBit(x, y)
Definition: eepro.c:65
#define bswap_16(value)
Definition: byteswap.h:58
static unsigned int mem_end
Definition: eepro.c:305
static int eepro
Definition: eepro.c:304
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
Definition: ethernet.c:175
static unsigned xmt_lower_limit_reg
Definition: eepro.c:236
#define RCV_LOWER_LIMIT
Definition: eepro.c:161
static void eepro_reset(struct nic *nic)
Definition: eepro.c:310
#define ETH_ALEN
Definition: if_ether.h:8
Definition: nic.h:49
#define XMT_UPPER_LIMIT_REG_10
Definition: eepro.c:235
unsigned char * node_addr
Definition: nic.h:52
static unsigned rcv_ram
Definition: eepro.c:154
#define RCV_UPPER_LIMIT
Definition: eepro.c:162
#define EEPROM_REG_10
Definition: eepro.c:261
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
struct nic_operations * nic_op
Definition: nic.h:50

References bswap_16, DBG, ee_BNC_TPE, ee_FX_INT2IRQ, eepro, eepro_operations, eepro_reset(), eeprom_reg, EEPROM_REG_10, ETH_ALEN, eth_ntoa(), GetBit, isa_device::ioaddr, nic::ioaddr, nic::irqno, LAN595FX_10ISA, mem_end, mem_start, name, nic::nic_op, nic::node_addr, printf(), RCV_LOWER_LIMIT, rcv_ram, rcv_start, RCV_START_10, RCV_UPPER_LIMIT, read_eeprom(), SA_ADDR1, xmt_lower_limit_reg, XMT_LOWER_LIMIT_REG_10, xmt_upper_limit_reg, and XMT_UPPER_LIMIT_REG_10.

◆ ISA_DRIVER()

ISA_DRIVER ( eepro_driver  ,
eepro_probe_addrs  ,
eepro_probe1  ,
GENERIC_ISAPNP_VENDOR  ,
0x828a   
)

◆ DRIVER()

DRIVER ( "eepro"  ,
nic_driver  ,
isa_driver  ,
eepro_driver  ,
eepro_probe  ,
eepro_disable   
)

◆ ISA_ROM()

ISA_ROM ( "eepro"  ,
"Intel Etherexpress Pro/10"   
)

Variable Documentation

◆ rcv_ram

unsigned rcv_ram = RCV_DEFAULT_RAM
static

Definition at line 154 of file eepro.c.

Referenced by eepro_probe().

◆ rcv_start

unsigned rcv_start = RCV_START_PRO
static

Definition at line 169 of file eepro.c.

Referenced by eepro_probe().

◆ xmt_bar

unsigned xmt_bar = XMT_BAR_PRO
static

Definition at line 218 of file eepro.c.

Referenced by eepro_reset(), and eepro_transmit().

◆ xmt_lower_limit_reg

unsigned xmt_lower_limit_reg = XMT_LOWER_LIMIT_REG_PRO
static

Definition at line 236 of file eepro.c.

Referenced by eepro_probe(), and eepro_reset().

◆ xmt_upper_limit_reg

unsigned xmt_upper_limit_reg = XMT_UPPER_LIMIT_REG_PRO
static

Definition at line 237 of file eepro.c.

Referenced by eepro_probe(), and eepro_reset().

◆ eeprom_reg

unsigned eeprom_reg = EEPROM_REG_PRO
static

Definition at line 262 of file eepro.c.

Referenced by eepro_probe(), eepro_reset(), and read_eeprom().

◆ rx_start

unsigned int rx_start
static

Definition at line 301 of file eepro.c.

Referenced by eepro_poll(), and eepro_reset().

◆ tx_start

unsigned int tx_start
static

Definition at line 301 of file eepro.c.

Referenced by eepro_disable(), eepro_reset(), and eepro_transmit().

◆ tx_last

int tx_last
static

Definition at line 302 of file eepro.c.

Referenced by eepro_disable(), eepro_reset(), and eepro_transmit().

◆ tx_end

unsigned int tx_end
static

Definition at line 303 of file eepro.c.

Referenced by eepro_disable(), eepro_reset(), and eepro_transmit().

◆ eepro

int eepro = 0
static

Definition at line 304 of file eepro.c.

Referenced by eepro_probe(), and read_eeprom().

◆ mem_start

unsigned int mem_start
static

Definition at line 305 of file eepro.c.

Referenced by eepro_probe().

◆ mem_end

unsigned int mem_end = RCV_DEFAULT_RAM / 1024
static

Definition at line 305 of file eepro.c.

Referenced by eepro_probe().

◆ eepro_operations

struct nic_operations eepro_operations
static
Initial value:
= {
.connect = dummy_connect,
.poll = eepro_poll,
.transmit = eepro_transmit,
.irq = eepro_irq,
}
static void eepro_irq(struct nic *nic __unused, irq_action_t action __unused)
Definition: eepro.c:490
int dummy_connect(struct nic *nic __unused)
Definition: legacy.c:151
static void eepro_transmit(struct nic *nic, const char *d, unsigned int t, unsigned int s, const char *p)
Definition: eepro.c:417
static int eepro_poll(struct nic *nic, int retrieve)
Definition: eepro.c:356

Definition at line 556 of file eepro.c.

Referenced by eepro_probe().

◆ eepro_probe_addrs

isa_probe_addr_t eepro_probe_addrs[]
static
Initial value:
= {
0x300, 0x210, 0x240, 0x280, 0x2C0, 0x200, 0x320, 0x340, 0x360,
}

Definition at line 630 of file eepro.c.