iPXE
Defines | 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.

Defines

#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 []

Define Documentation

#define LAN595   0

Definition at line 53 of file eepro.c.

#define LAN595TX   1

Definition at line 54 of file eepro.c.

#define LAN595FX   2

Definition at line 55 of file eepro.c.

#define LAN595FX_10ISA   3

Definition at line 56 of file eepro.c.

Referenced by eepro_probe(), and read_eeprom().

#define SLOW_DOWN   inb(0x80);

Definition at line 58 of file eepro.c.

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

Definition at line 61 of file eepro.c.

#define SA_ADDR1   0xaa

Definition at line 62 of file eepro.c.

Referenced by eepro_probe().

#define SA_ADDR2   0x00

Definition at line 63 of file eepro.c.

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

Definition at line 65 of file eepro.c.

Referenced by eepro_probe().

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

Definition at line 68 of file eepro.c.

#define ee_Word1   1 /* Word 1? */

Definition at line 69 of file eepro.c.

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

Definition at line 70 of file eepro.c.

#define ee_FlashAddr   3 /* Flash Address */

Definition at line 71 of file eepro.c.

#define ee_FlashMask   0x7 /* Mask */

Definition at line 72 of file eepro.c.

#define ee_AutoIO   6 /* */

Definition at line 73 of file eepro.c.

#define ee_reserved0   7 /* =0! */

Definition at line 74 of file eepro.c.

#define ee_Flash   8 /* Flash there? */

Definition at line 75 of file eepro.c.

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

Definition at line 76 of file eepro.c.

#define ee_IO0   10 /* IO Address LSB */

Definition at line 77 of file eepro.c.

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

Definition at line 78 of file eepro.c.

#define ee_IO1   15 /* IO MSB */

Definition at line 79 of file eepro.c.

#define ee_IntSel   0 /* Interrupt */

Definition at line 82 of file eepro.c.

#define ee_IntMask   0x7

Definition at line 83 of file eepro.c.

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

Definition at line 84 of file eepro.c.

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

Definition at line 85 of file eepro.c.

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

Definition at line 86 of file eepro.c.

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

Definition at line 87 of file eepro.c.

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

Definition at line 88 of file eepro.c.

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

Definition at line 89 of file eepro.c.

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

Definition at line 90 of file eepro.c.

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

Definition at line 91 of file eepro.c.

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

Definition at line 92 of file eepro.c.

#define ee_reserved2   14 /* =0! */

Definition at line 93 of file eepro.c.

#define ee_Duplex   15

Definition at line 94 of file eepro.c.

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

Definition at line 97 of file eepro.c.

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

Definition at line 98 of file eepro.c.

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

Definition at line 99 of file eepro.c.

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

Definition at line 100 of file eepro.c.

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

Definition at line 101 of file eepro.c.

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

Definition at line 102 of file eepro.c.

#define ee_BNC_TPE   0 /* 0=TPE */

Definition at line 105 of file eepro.c.

Referenced by eepro_probe().

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

Definition at line 106 of file eepro.c.

#define ee_BootTypeMask   0x3

Definition at line 107 of file eepro.c.

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

Definition at line 108 of file eepro.c.

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

Definition at line 109 of file eepro.c.

#define ee_PortTPE   5

Definition at line 110 of file eepro.c.

#define ee_PortBNC   6

Definition at line 111 of file eepro.c.

#define ee_PortAUI   7

Definition at line 112 of file eepro.c.

#define ee_PowerMgt   10 /* 0= disabled */

Definition at line 113 of file eepro.c.

#define ee_CP   13 /* Concurrent Processing */

Definition at line 114 of file eepro.c.

#define ee_CPMask   0x7

Definition at line 115 of file eepro.c.

#define ee_Stepping   0 /* Stepping info */

Definition at line 118 of file eepro.c.

#define ee_StepMask   0x0F

Definition at line 119 of file eepro.c.

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

Definition at line 120 of file eepro.c.

#define ee_BoardMask   0x0FFF

Definition at line 121 of file eepro.c.

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

Definition at line 124 of file eepro.c.

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

Definition at line 125 of file eepro.c.

Referenced by eepro_probe().

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

Definition at line 128 of file eepro.c.

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

Definition at line 129 of file eepro.c.

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

Definition at line 133 of file eepro.c.

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

Definition at line 134 of file eepro.c.

#define ee_addr_SN   0x12 /* Serial Number */

Definition at line 135 of file eepro.c.

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

Definition at line 136 of file eepro.c.

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

Definition at line 139 of file eepro.c.

#define ee_vendor_intel1   0xD4

Definition at line 140 of file eepro.c.

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

Definition at line 141 of file eepro.c.

#define ee_id_eepro10p1   0x31

Definition at line 142 of file eepro.c.

#define RAM_SIZE   0x8000

Definition at line 148 of file eepro.c.

#define RCV_HEADER   8

Definition at line 150 of file eepro.c.

Referenced by eepro_poll().

#define RCV_DEFAULT_RAM   0x6000

Definition at line 151 of file eepro.c.

#define RCV_RAM   rcv_ram

Definition at line 152 of file eepro.c.

#define XMT_HEADER   8

Definition at line 156 of file eepro.c.

Referenced by eepro_transmit().

#define XMT_RAM   (RAM_SIZE - RCV_RAM)

Definition at line 157 of file eepro.c.

Referenced by eepro_transmit().

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

Definition at line 159 of file eepro.c.

#define RCV_LOWER_LIMIT   (rcv_start >> 8)

Definition at line 161 of file eepro.c.

Referenced by eepro_probe(), and eepro_reset().

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

Definition at line 162 of file eepro.c.

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

#define XMT_LOWER_LIMIT   (XMT_START >> 8)

Definition at line 163 of file eepro.c.

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

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

Definition at line 164 of file eepro.c.

Referenced by eepro_reset(), and eepro_transmit().

#define RCV_START_PRO   0x00

Definition at line 166 of file eepro.c.

#define RCV_START_10   XMT_RAM

Definition at line 167 of file eepro.c.

Referenced by eepro_probe().

#define RCV_DONE   0x0008

Definition at line 171 of file eepro.c.

Referenced by eepro_poll().

#define RX_OK   0x2000

Definition at line 172 of file eepro.c.

Referenced by eepro_poll().

#define RX_ERROR   0x0d81

Definition at line 173 of file eepro.c.

Referenced by eepro_poll().

#define TX_DONE_BIT   0x0080

Definition at line 175 of file eepro.c.

Referenced by eepro_transmit().

#define CHAIN_BIT   0x8000

Definition at line 176 of file eepro.c.

#define XMT_STATUS   0x02

Definition at line 177 of file eepro.c.

#define XMT_CHAIN   0x04

Definition at line 178 of file eepro.c.

#define XMT_COUNT   0x06

Definition at line 179 of file eepro.c.

#define BANK0_SELECT   0x00

Definition at line 181 of file eepro.c.

#define BANK1_SELECT   0x40

Definition at line 182 of file eepro.c.

#define BANK2_SELECT   0x80

Definition at line 183 of file eepro.c.

#define COMMAND_REG   0x00 /* Register 0 */

Definition at line 186 of file eepro.c.

#define MC_SETUP   0x03

Definition at line 187 of file eepro.c.

#define XMT_CMD   0x04

Definition at line 188 of file eepro.c.

Referenced by eepro_transmit().

#define DIAGNOSE_CMD   0x07

Definition at line 189 of file eepro.c.

#define RCV_ENABLE_CMD   0x08

Definition at line 190 of file eepro.c.

#define RCV_DISABLE_CMD   0x0a

Definition at line 191 of file eepro.c.

#define STOP_RCV_CMD   0x0b

Definition at line 192 of file eepro.c.

Referenced by eepro_disable().

#define RESET_CMD   0x0e

Definition at line 193 of file eepro.c.

#define POWER_DOWN_CMD   0x18

Definition at line 194 of file eepro.c.

#define RESUME_XMT_CMD   0x1c

Definition at line 195 of file eepro.c.

#define SEL_RESET_CMD   0x1e

Definition at line 196 of file eepro.c.

#define STATUS_REG   0x01 /* Register 1 */

Definition at line 197 of file eepro.c.

Referenced by eepro_poll(), and read_eeprom().

#define RX_INT   0x02

Definition at line 198 of file eepro.c.

#define TX_INT   0x04

Definition at line 199 of file eepro.c.

#define EXEC_STATUS   0x30

Definition at line 200 of file eepro.c.

#define ID_REG   0x02 /* Register 2 */

Definition at line 201 of file eepro.c.

Referenced by eepro_probe1().

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

Definition at line 202 of file eepro.c.

Referenced by eepro_probe1().

#define ID_REG_MASK   0x2c

Definition at line 203 of file eepro.c.

Referenced by eepro_probe1().

#define ID_REG_SIG   0x24

Definition at line 204 of file eepro.c.

Referenced by eepro_probe1().

#define AUTO_ENABLE   0x10

Definition at line 205 of file eepro.c.

#define INT_MASK_REG   0x03 /* Register 3 */

Definition at line 206 of file eepro.c.

#define RX_STOP_MASK   0x01

Definition at line 207 of file eepro.c.

#define RX_MASK   0x02

Definition at line 208 of file eepro.c.

#define TX_MASK   0x04

Definition at line 209 of file eepro.c.

#define EXEC_MASK   0x08

Definition at line 210 of file eepro.c.

#define ALL_MASK   0x0f

Definition at line 211 of file eepro.c.

#define IO_32_BIT   0x10

Definition at line 212 of file eepro.c.

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

Definition at line 213 of file eepro.c.

Referenced by eepro_reset().

#define RCV_STOP   0x06

Definition at line 214 of file eepro.c.

Referenced by eepro_poll(), and eepro_reset().

#define XMT_BAR_PRO   0x0a

Definition at line 216 of file eepro.c.

#define XMT_BAR_10   0x0b

Definition at line 217 of file eepro.c.

#define HOST_ADDRESS_REG   0x0c

Definition at line 220 of file eepro.c.

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

#define IO_PORT   0x0e

Definition at line 221 of file eepro.c.

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

#define IO_PORT_32_BIT   0x0c

Definition at line 222 of file eepro.c.

#define REG1   0x01

Definition at line 225 of file eepro.c.

Referenced by eepro_reset().

#define WORD_WIDTH   0x02

Definition at line 226 of file eepro.c.

#define INT_ENABLE   0x80

Definition at line 227 of file eepro.c.

#define INT_NO_REG   0x02

Definition at line 228 of file eepro.c.

#define RCV_LOWER_LIMIT_REG   0x08

Definition at line 229 of file eepro.c.

Referenced by eepro_reset().

#define RCV_UPPER_LIMIT_REG   0x09

Definition at line 230 of file eepro.c.

Referenced by eepro_reset().

#define XMT_LOWER_LIMIT_REG_PRO   0x0a

Definition at line 232 of file eepro.c.

#define XMT_UPPER_LIMIT_REG_PRO   0x0b

Definition at line 233 of file eepro.c.

#define XMT_LOWER_LIMIT_REG_10   0x0b

Definition at line 234 of file eepro.c.

Referenced by eepro_probe().

#define XMT_UPPER_LIMIT_REG_10   0x0a

Definition at line 235 of file eepro.c.

Referenced by eepro_probe().

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

Definition at line 240 of file eepro.c.

Referenced by eepro_reset().

#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.

Referenced by eepro_reset().

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

Definition at line 242 of file eepro.c.

Referenced by eepro_reset().

#define REG2   0x02

Definition at line 243 of file eepro.c.

Referenced by eepro_reset().

#define PRMSC_Mode   0x01

Definition at line 244 of file eepro.c.

#define Multi_IA   0x20

Definition at line 245 of file eepro.c.

#define REG3   0x03

Definition at line 246 of file eepro.c.

Referenced by eepro_reset().

#define TPE_BIT   0x04

Definition at line 247 of file eepro.c.

#define BNC_BIT   0x20

Definition at line 248 of file eepro.c.

#define REG13   0x0d

Definition at line 249 of file eepro.c.

#define FDX   0x00

Definition at line 250 of file eepro.c.

#define A_N_ENABLE   0x02

Definition at line 251 of file eepro.c.

#define I_ADD_REG0   0x04

Definition at line 253 of file eepro.c.

Referenced by eepro_reset().

#define I_ADD_REG1   0x05

Definition at line 254 of file eepro.c.

#define I_ADD_REG2   0x06

Definition at line 255 of file eepro.c.

#define I_ADD_REG3   0x07

Definition at line 256 of file eepro.c.

#define I_ADD_REG4   0x08

Definition at line 257 of file eepro.c.

#define I_ADD_REG5   0x09

Definition at line 258 of file eepro.c.

#define EEPROM_REG_PRO   0x0a

Definition at line 260 of file eepro.c.

#define EEPROM_REG_10   0x0b

Definition at line 261 of file eepro.c.

Referenced by eepro_probe().

#define EESK   0x01

Definition at line 264 of file eepro.c.

Referenced by read_eeprom().

#define EECS   0x02

Definition at line 265 of file eepro.c.

Referenced by read_eeprom(), and sis900_read_eeprom().

#define EEDI   0x04

Definition at line 266 of file eepro.c.

Referenced by read_eeprom(), and sis900_read_eeprom().

#define EEDO   0x08

Definition at line 267 of file eepro.c.

Referenced by read_eeprom(), and sis900_read_eeprom().

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

Definition at line 273 of file eepro.c.

Referenced by read_eeprom().

#define EE_READ_CMD   (6 << 6)

Definition at line 274 of file eepro.c.

Referenced by read_eeprom().

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

Definition at line 277 of file eepro.c.

Referenced by eepro_disable().

#define eepro_sel_reset (   ioaddr)
Value:
do {  \
    outb ( SEL_RESET_CMD, ioaddr ); \
    (void) SLOW_DOWN; \
    (void) SLOW_DOWN; \
  } while (0)

Definition at line 280 of file eepro.c.

Referenced by eepro_reset().

Definition at line 288 of file eepro.c.

Referenced by eepro_reset().

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

Definition at line 291 of file eepro.c.

Referenced by eepro_reset().

Definition at line 294 of file eepro.c.

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

Definition at line 297 of file eepro.c.

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

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

Definition at line 298 of file eepro.c.

Referenced by eepro_reset(), and read_eeprom().

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

Definition at line 299 of file eepro.c.

Referenced by eepro_reset(), and read_eeprom().


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER  )
static void eepro_reset ( struct nic nic) [static]

Definition at line 310 of file eepro.c.

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, 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().

{
        int             temp_reg, i;

        /* put the card in its initial state */
        eepro_sw2bank2(nic->ioaddr);    /* be careful, bank2 now */
        temp_reg = inb(nic->ioaddr + eeprom_reg);
        DBG("Stepping %d\n", temp_reg >> 5);
        if (temp_reg & 0x10)    /* check the TurnOff Enable bit */
                outb(temp_reg & 0xEF, nic->ioaddr + eeprom_reg);
        for (i = 0; i < ETH_ALEN; i++)  /* fill the MAC address */
                outb(nic->node_addr[i], nic->ioaddr + I_ADD_REG0 + i);
        temp_reg = inb(nic->ioaddr + REG1);
        /* setup Transmit Chaining and discard bad RCV frames */
        outb(temp_reg | XMT_Chain_Int | XMT_Chain_ErrStop
                | RCV_Discard_BadFrame, nic->ioaddr + REG1);
        temp_reg = inb(nic->ioaddr + REG2);             /* match broadcast */
        outb(temp_reg | 0x14, nic->ioaddr + REG2);
        temp_reg = inb(nic->ioaddr + REG3);
        outb(temp_reg & 0x3F, nic->ioaddr + REG3);      /* clear test mode */
        /* set the receiving mode */
        eepro_sw2bank1(nic->ioaddr);    /* be careful, bank1 now */
        /* initialise the RCV and XMT upper and lower limits */
        outb(RCV_LOWER_LIMIT, nic->ioaddr + RCV_LOWER_LIMIT_REG);
        outb(RCV_UPPER_LIMIT, nic->ioaddr + RCV_UPPER_LIMIT_REG);
        outb(XMT_LOWER_LIMIT, nic->ioaddr + xmt_lower_limit_reg);
        outb(XMT_UPPER_LIMIT, nic->ioaddr + xmt_upper_limit_reg);
        eepro_sw2bank0(nic->ioaddr);    /* Switch back to bank 0 */
        eepro_clear_int(nic->ioaddr);
        /* Initialise RCV */
        outw(rx_start = (RCV_LOWER_LIMIT << 8), nic->ioaddr + RCV_BAR);
        outw(((RCV_UPPER_LIMIT << 8) | 0xFE), nic->ioaddr + RCV_STOP);
        /* Make sure 1st poll won't find a valid packet header */
        outw((RCV_LOWER_LIMIT << 8), nic->ioaddr + HOST_ADDRESS_REG);
        outw(0,                      nic->ioaddr + IO_PORT);
        /* Intialise XMT */
        outw((XMT_LOWER_LIMIT << 8), nic->ioaddr + xmt_bar);
        eepro_sel_reset(nic->ioaddr);
        tx_start = tx_end = (unsigned int) (XMT_LOWER_LIMIT << 8);
        tx_last = 0;
        eepro_en_rx(nic->ioaddr);
}
static int eepro_poll ( struct nic nic,
int  retrieve 
) [static]

Definition at line 356 of file eepro.c.

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

{
        unsigned int    rcv_car = rx_start;
        unsigned int    rcv_event, rcv_status, rcv_next_frame, rcv_size;

        /* return true if there's an ethernet packet ready to read */
        /* nic->packet should contain data on return */
        /* nic->packetlen should contain length of data */
#if     0
        if ((inb(nic->ioaddr + STATUS_REG) & 0x40) == 0)
                return (0);
        outb(0x40, nic->ioaddr + STATUS_REG);
#endif
        outw(rcv_car, nic->ioaddr + HOST_ADDRESS_REG);
        rcv_event = inw(nic->ioaddr + IO_PORT);
        if (rcv_event != RCV_DONE)
                return (0);

        /* FIXME: I'm guessing this might not work with this card, since
           it looks like once a rcv_event is started it must be completed.
           maybe there's another way. */
        if ( ! retrieve ) return 1;

        rcv_status = inw(nic->ioaddr + IO_PORT);
        rcv_next_frame = inw(nic->ioaddr + IO_PORT);
        rcv_size = inw(nic->ioaddr + IO_PORT);
#if     0
        printf("%hX %hX %d %hhX\n", rcv_status, rcv_next_frame, rcv_size,
                inb(nic->ioaddr + STATUS_REG));
#endif
        if ((rcv_status & (RX_OK|RX_ERROR)) != RX_OK) {
                printf("Receive error %hX\n", rcv_status);
                return (0);
        }
        rcv_size &= 0x3FFF;
        insw(nic->ioaddr + IO_PORT, nic->packet, ((rcv_size + 3) >> 1));
#if     0
{
        int i;
        for (i = 0; i < 48; i++) {
                printf("%hhX", nic->packet[i]);
                putchar(i % 16 == 15 ? '\n' : ' ');
        }
}
#endif
        nic->packetlen = rcv_size;
        rcv_car  = (rx_start + RCV_HEADER + rcv_size);
        rx_start = rcv_next_frame;
/* 
        hex_dump(rcv_car, nic->packetlen); 
*/

        if (rcv_car == 0)
                rcv_car = ((RCV_UPPER_LIMIT << 8) | 0xff);
        outw(rcv_car - 1, nic->ioaddr + RCV_STOP);
        return (1);
}
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.

References assert, DBG, end, ETH_ALEN, ETH_HLEN, HOST_ADDRESS_REG, htons, inw(), IO_PORT, last, length, 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.

{
        unsigned int    status, tx_available, last, end, length;
        unsigned short  type;
        int             boguscount = 20;

        length = s + ETH_HLEN;
        if (tx_end > tx_start)
                tx_available = XMT_RAM - (tx_end - tx_start);
        else if (tx_end < tx_start)
                tx_available = tx_start - tx_end;
        else
                tx_available = XMT_RAM;
        assert ( length <= tx_available );
        last = tx_end;
        end = last + (((length + 3) >> 1) << 1) + XMT_HEADER;
        if (end >= (XMT_UPPER_LIMIT << 8)) {
                last = (XMT_LOWER_LIMIT << 8);
                end = last + (((length + 3) >> 1) << 1) + XMT_HEADER;
        }
        outw(last, nic->ioaddr + HOST_ADDRESS_REG);
        outw(XMT_CMD, nic->ioaddr + IO_PORT);
        outw(0, nic->ioaddr + IO_PORT);
        outw(end, nic->ioaddr + IO_PORT);
        outw(length, nic->ioaddr + IO_PORT);
        outsw(nic->ioaddr + IO_PORT, d, ETH_ALEN / 2);
        outsw(nic->ioaddr + IO_PORT, nic->node_addr, ETH_ALEN / 2);
        type = htons(t);
        outsw(nic->ioaddr + IO_PORT, &type, sizeof(type) / 2);
        outsw(nic->ioaddr + IO_PORT, p, (s + 3) >> 1);
        /* A dummy read to flush the DRAM write pipeline */
        status = inw(nic->ioaddr + IO_PORT);
        outw(last, nic->ioaddr + xmt_bar);
        outb(XMT_CMD, nic->ioaddr);
        tx_start = last;
        tx_last = last;
        tx_end = end;
#if     0
        printf("%d %d\n", tx_start, tx_end);
#endif
        while (boguscount > 0) {
                if (((status = inw(nic->ioaddr + IO_PORT)) & TX_DONE_BIT) == 0) {
                        udelay(40);
                        boguscount--;
                        continue;
                }
                if ((status & 0x2000) == 0) {
                        DBG("Transmit status %hX\n", status);
                }
        }
}
static void eepro_disable ( struct nic nic,
struct isa_device *isa  __unused 
) [static]

Definition at line 477 of file eepro.c.

References eepro_full_reset, eepro_sw2bank0, outb(), STOP_RCV_CMD, tx_end, tx_last, tx_start, and XMT_LOWER_LIMIT.

                                                                               {
        eepro_sw2bank0(nic->ioaddr);    /* Switch to bank 0 */
        /* Flush the Tx and disable Rx */
        outb(STOP_RCV_CMD, nic->ioaddr);
        tx_start = tx_end = (XMT_LOWER_LIMIT << 8);
        tx_last = 0;
        /* Reset the 82595 */
        eepro_full_reset(nic->ioaddr);
}
static void eepro_irq ( struct nic *nic  __unused,
irq_action_t action  __unused 
) [static]

Definition at line 490 of file eepro.c.

{
  switch ( action ) {
  case DISABLE :
    break;
  case ENABLE :
    break;
  case FORCE :
    break;
  }
}
static int read_eeprom ( uint16_t  ioaddr,
int  location 
) [static]

Definition at line 502 of file eepro.c.

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

Referenced by eepro_probe().

{
        int             i;
        unsigned short  retval = 0;
        int             ee_addr = ioaddr + eeprom_reg;
        int             read_cmd = location | EE_READ_CMD;
        int             ctrl_val = EECS;

        if (eepro == LAN595FX_10ISA) {
                eepro_sw2bank1(ioaddr);
                outb(0x00, ioaddr + STATUS_REG);
        }
        eepro_sw2bank2(ioaddr);
        outb(ctrl_val, ee_addr);
        /* shift the read command bits out */
        for (i = 8; i >= 0; i--) {
                short outval = (read_cmd & (1 << i)) ? ctrl_val | EEDI : ctrl_val;
                outb(outval, ee_addr);
                outb(outval | EESK, ee_addr);   /* EEPROM clock tick */
                eeprom_delay();
                outb(outval, ee_addr);          /* finish EEPROM clock tick */
                eeprom_delay();
        }
        outb(ctrl_val, ee_addr);
        for (i = 16; i > 0; i--) {
                outb(ctrl_val | EESK, ee_addr);
                eeprom_delay();
                retval = (retval << 1) | ((inb(ee_addr) & EEDO) ? 1 : 0);
                outb(ctrl_val, ee_addr);
                eeprom_delay();
        }
        /* terminate the EEPROM access */
        ctrl_val &= ~EECS;
        outb(ctrl_val | EESK, ee_addr);
        eeprom_delay();
        outb(ctrl_val, ee_addr);
        eeprom_delay();
        eepro_sw2bank0(ioaddr);
        return (retval);
}
static int eepro_probe1 ( isa_probe_addr_t  ioaddr) [static]

Definition at line 543 of file eepro.c.

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

                                                    {
        int             id, counter;

        id = inb(ioaddr + ID_REG);
        if ((id & ID_REG_MASK) != ID_REG_SIG)
                return (0);
        counter = id & R_ROBIN_BITS;
        if (((id = inb(ioaddr + ID_REG)) & R_ROBIN_BITS) != (counter + 0x40))
                return (0);
        /* yes the 82595 has been found */
        return (1);
}
static int eepro_probe ( struct nic nic,
struct isa_device isa 
) [static]

Definition at line 567 of file eepro.c.

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, LAN595FX_10ISA, mem_end, mem_start, name, 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.

                                                                   {

        int             i, l_eepro = 0;
        union {
                unsigned char   caddr[ETH_ALEN];
                unsigned short  saddr[ETH_ALEN/2];
        } station_addr;
        const char *name;

        nic->irqno  = 0;
        nic->ioaddr = isa->ioaddr;

        station_addr.saddr[2] = read_eeprom(nic->ioaddr,2);
        if ( ( station_addr.saddr[2] == 0x0000 ) ||
             ( station_addr.saddr[2] == 0xFFFF ) ) {
                l_eepro = 3;
                eepro = LAN595FX_10ISA;
                eeprom_reg= EEPROM_REG_10;
                rcv_start = RCV_START_10;
                xmt_lower_limit_reg = XMT_LOWER_LIMIT_REG_10;
                xmt_upper_limit_reg = XMT_UPPER_LIMIT_REG_10;
                station_addr.saddr[2] = read_eeprom(nic->ioaddr,2);
        }
        station_addr.saddr[1] = read_eeprom(nic->ioaddr,3);
        station_addr.saddr[0] = read_eeprom(nic->ioaddr,4);
        if (l_eepro)
                name = "Intel EtherExpress 10 ISA";
        else if (read_eeprom(nic->ioaddr,7) == ee_FX_INT2IRQ) {
                name = "Intel EtherExpress Pro/10+ ISA";
                l_eepro = 2;
        } else if (station_addr.saddr[0] == SA_ADDR1) {
                name = "Intel EtherExpress Pro/10 ISA";
                l_eepro = 1;
        } else {
                l_eepro = 0;
                name = "Intel 82595-based LAN card";
        }
        station_addr.saddr[0] = bswap_16(station_addr.saddr[0]);
        station_addr.saddr[1] = bswap_16(station_addr.saddr[1]);
        station_addr.saddr[2] = bswap_16(station_addr.saddr[2]);
        for (i = 0; i < ETH_ALEN; i++) {
                nic->node_addr[i] = station_addr.caddr[i];
        }

        DBG ( "%s ioaddr %#hX, addr %s", name, nic->ioaddr, eth_ntoa ( nic->node_addr ) );

        mem_start = RCV_LOWER_LIMIT << 8;
        if ((mem_end & 0x3F) < 3 || (mem_end & 0x3F) > 29)
                mem_end = RCV_UPPER_LIMIT << 8;
        else {
                mem_end = mem_end * 1024 + (RCV_LOWER_LIMIT << 8);
                rcv_ram = mem_end - (RCV_LOWER_LIMIT << 8);
        }
        printf(", Rx mem %dK, if %s\n", (mem_end - mem_start) >> 10,
                GetBit(read_eeprom(nic->ioaddr,5), ee_BNC_TPE) ? "BNC" : "TP");

        eepro_reset(nic);

        /* point to NIC specific routines */
        nic->nic_op     = &eepro_operations;
        return 1;
}
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"   
)

Variable Documentation

unsigned rcv_ram = RCV_DEFAULT_RAM [static]

Definition at line 154 of file eepro.c.

Referenced by eepro_probe().

unsigned rcv_start = RCV_START_PRO [static]

Definition at line 169 of file eepro.c.

Referenced by eepro_probe().

unsigned xmt_bar = XMT_BAR_PRO [static]

Definition at line 218 of file eepro.c.

Referenced by eepro_reset(), and eepro_transmit().

Definition at line 236 of file eepro.c.

Referenced by eepro_probe(), and eepro_reset().

Definition at line 237 of file eepro.c.

Referenced by eepro_probe(), and eepro_reset().

unsigned eeprom_reg = EEPROM_REG_PRO [static]

Definition at line 262 of file eepro.c.

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

unsigned int rx_start [static]

Definition at line 301 of file eepro.c.

Referenced by eepro_poll(), and eepro_reset().

unsigned int tx_start [static]

Definition at line 301 of file eepro.c.

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

int tx_last [static]

Definition at line 302 of file eepro.c.

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

unsigned int tx_end [static]

Definition at line 303 of file eepro.c.

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

int eepro = 0 [static]

Definition at line 304 of file eepro.c.

Referenced by eepro_probe(), and read_eeprom().

unsigned int mem_start [static]

Definition at line 305 of file eepro.c.

Referenced by eepro_probe().

unsigned int mem_end = RCV_DEFAULT_RAM / 1024 [static]

Definition at line 305 of file eepro.c.

Referenced by eepro_probe().

struct nic_operations eepro_operations [static]
Initial value:
 {
        .connect        = dummy_connect,
        .poll           = eepro_poll,
        .transmit       = eepro_transmit,
        .irq            = eepro_irq,

}

Definition at line 556 of file eepro.c.

Referenced by eepro_probe().

Initial value:
 {
        0x300, 0x210, 0x240, 0x280, 0x2C0, 0x200, 0x320, 0x340, 0x360,
}

Definition at line 630 of file eepro.c.