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

Go to the source code of this file.

Macros

#define ASIC_PIO   NE_DATA
 

Functions

 FILE_LICENCE (BSD2)
 
static void ne_reset (struct nic *nic, struct isa_device *isa)
 
static void eth_pio_read (unsigned int src, unsigned char *dst, unsigned int cnt)
 
static void eth_pio_write (const unsigned char *src, unsigned int dst, unsigned int cnt)
 
static void enable_multicast (unsigned short eth_nic_base)
 
static int ne_probe1 (isa_probe_addr_t ioaddr)
 
static int ne_probe (struct nic *nic, struct isa_device *isa)
 
static void ne_disable (struct nic *nic, struct isa_device *isa)
 
static void ne_reset (struct nic *nic, struct isa_device *isa __unused)
 
static int ne_poll (struct nic *nic __unused, int retrieve __unused)
 
static void ne_transmit (struct nic *nic, const char *d, unsigned int t, unsigned int s, const char *p)
 
 ISA_DRIVER (ne_driver, ne_probe_addrs, ne_probe1, GENERIC_ISAPNP_VENDOR, 0x0600)
 
 DRIVER ("ne", nic_driver, isapnp_driver, ne_driver, ne_probe, ne_disable)
 
 ISA_ROM ("ne","NE1000/2000 and clones")
 

Variables

static unsigned char eth_vendor
 
static unsigned char eth_flags
 
static unsigned short eth_nic_base
 
static unsigned short eth_asic_base
 
static unsigned char eth_memsize
 
static unsigned char eth_rx_start
 
static unsigned char eth_tx_start
 
static Address eth_bmem
 
static Address eth_rmem
 
static unsigned char eth_drain_receiver
 
static struct nic_operations ne_operations
 
static isa_probe_addr_t ne_probe_addrs [] = { 0x300, 0x280, 0x320, 0x340, 0x380, 0x220, }
 

Macro Definition Documentation

◆ ASIC_PIO

#define ASIC_PIO   NE_DATA

Definition at line 31 of file ne2k_isa.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( BSD2  )

◆ ne_reset() [1/2]

static void ne_reset ( struct nic nic,
struct isa_device isa 
)
static

Referenced by ne_disable(), and ne_probe().

◆ eth_pio_read()

static void eth_pio_read ( unsigned int  src,
unsigned char *  dst,
unsigned int  cnt 
)
static

Definition at line 47 of file ne2k_isa.c.

47  {
50  outb(cnt >> 8, eth_nic_base + D8390_P0_RBCR1);
54  if (eth_flags & FLAG_16BIT)
55  cnt = (cnt + 1) >> 1;
56 
57  while (cnt--) {
58  if (eth_flags & FLAG_16BIT) {
59  *((unsigned short *) dst) = inw(eth_asic_base + ASIC_PIO);
60  dst += 2;
61  } else
62  *(dst++) = inb(eth_asic_base + ASIC_PIO);
63  }
64 }
uint16_t inw(volatile uint16_t *io_addr)
Read 16-bit word from I/O-mapped device.
#define D8390_P0_RSAR1
Definition: ns8390.h:178
#define FLAG_16BIT
Definition: ns8390.h:17
#define D8390_COMMAND_RD0
Definition: ns8390.h:201
static __always_inline void off_t userptr_t src
Definition: efi_uaccess.h:66
#define ASIC_PIO
Definition: ne2k_isa.c:31
uint8_t inb(volatile uint8_t *io_addr)
Read byte from I/O-mapped device.
static unsigned short eth_asic_base
Definition: ne2k_isa.c:34
#define D8390_P0_RBCR0
Definition: ns8390.h:179
#define D8390_P0_COMMAND
Definition: ns8390.h:168
#define D8390_COMMAND_RD2
Definition: ns8390.h:199
#define outb(data, io_addr)
Definition: io.h:309
#define D8390_P0_RBCR1
Definition: ns8390.h:180
static unsigned short eth_nic_base
Definition: ne2k_isa.c:34
#define D8390_P0_RSAR0
Definition: ns8390.h:177
static unsigned char eth_flags
Definition: ne2k_isa.c:33
#define D8390_COMMAND_STA
Definition: ns8390.h:203

References ASIC_PIO, D8390_COMMAND_RD0, D8390_COMMAND_RD2, D8390_COMMAND_STA, D8390_P0_COMMAND, D8390_P0_RBCR0, D8390_P0_RBCR1, D8390_P0_RSAR0, D8390_P0_RSAR1, eth_asic_base, eth_flags, eth_nic_base, FLAG_16BIT, inb(), inw(), outb, and src.

Referenced by ne_poll(), and ne_probe().

◆ eth_pio_write()

static void eth_pio_write ( const unsigned char *  src,
unsigned int  dst,
unsigned int  cnt 
)
static

Definition at line 69 of file ne2k_isa.c.

70  {
74  outb(cnt >> 8, eth_nic_base + D8390_P0_RBCR1);
76  outb(dst >> 8, eth_nic_base + D8390_P0_RSAR1);
78  if (eth_flags & FLAG_16BIT)
79  cnt = (cnt + 1) >> 1;
80 
81  while (cnt--) {
82 
83  if (eth_flags & FLAG_16BIT) {
84  outw(*((unsigned short *) src), eth_asic_base + ASIC_PIO);
85  src += 2;
86  } else
87  outb(*(src++), eth_asic_base + ASIC_PIO);
88  }
89 }
#define outw(data, io_addr)
Definition: io.h:319
#define D8390_P0_RSAR1
Definition: ns8390.h:178
#define FLAG_16BIT
Definition: ns8390.h:17
#define D8390_COMMAND_RD1
Definition: ns8390.h:200
static __always_inline void off_t userptr_t src
Definition: efi_uaccess.h:66
#define ASIC_PIO
Definition: ne2k_isa.c:31
#define D8390_ISR_RDC
Definition: ns8390.h:218
static unsigned short eth_asic_base
Definition: ne2k_isa.c:34
#define D8390_P0_RBCR0
Definition: ns8390.h:179
#define D8390_P0_COMMAND
Definition: ns8390.h:168
#define D8390_COMMAND_RD2
Definition: ns8390.h:199
#define outb(data, io_addr)
Definition: io.h:309
#define D8390_P0_RBCR1
Definition: ns8390.h:180
static unsigned short eth_nic_base
Definition: ne2k_isa.c:34
#define D8390_P0_ISR
Definition: ns8390.h:176
#define D8390_P0_RSAR0
Definition: ns8390.h:177
static unsigned char eth_flags
Definition: ne2k_isa.c:33
#define D8390_COMMAND_STA
Definition: ns8390.h:203

References ASIC_PIO, D8390_COMMAND_RD1, D8390_COMMAND_RD2, D8390_COMMAND_STA, D8390_ISR_RDC, D8390_P0_COMMAND, D8390_P0_ISR, D8390_P0_RBCR0, D8390_P0_RBCR1, D8390_P0_RSAR0, D8390_P0_RSAR1, eth_asic_base, eth_flags, eth_nic_base, FLAG_16BIT, outb, outw, and src.

Referenced by ne_probe(), and ne_transmit().

◆ enable_multicast()

static void enable_multicast ( unsigned short  eth_nic_base)
static

Definition at line 94 of file ne2k_isa.c.

94  {
95  unsigned char mcfilter[8];
96  int i;
97 
98  memset(mcfilter, 0xFF, 8);
101  for (i = 0; i < 8; i++) {
102  outb(mcfilter[i], eth_nic_base + 8 + i);
103  if (inb(eth_nic_base + 8 + i) != mcfilter[i])
104  DBG("Error SMC 83C690 Multicast filter read/write mishap %d\n",
105  i);
106  }
108  outb(4 | 0x08, eth_nic_base + D8390_P0_RCR);
109 }
#define D8390_P0_RCR
Definition: ns8390.h:182
#define D8390_COMMAND_PS1
Definition: ns8390.h:197
#define D8390_COMMAND_PS0
Definition: ns8390.h:196
uint8_t inb(volatile uint8_t *io_addr)
Read byte from I/O-mapped device.
#define D8390_P0_COMMAND
Definition: ns8390.h:168
#define D8390_COMMAND_RD2
Definition: ns8390.h:199
#define outb(data, io_addr)
Definition: io.h:309
static unsigned short eth_nic_base
Definition: ne2k_isa.c:34
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
void * memset(void *dest, int character, size_t len) __nonnull

References D8390_COMMAND_PS0, D8390_COMMAND_PS1, D8390_COMMAND_RD2, D8390_P0_COMMAND, D8390_P0_RCR, DBG, eth_nic_base, inb(), memset(), and outb.

Referenced by ne_reset().

◆ ne_probe1()

static int ne_probe1 ( isa_probe_addr_t  ioaddr)
static

Definition at line 114 of file ne2k_isa.c.

114  {
115  //From the eCos driver
116  unsigned int regd;
117  unsigned int state;
118 
119  state = inb(ioaddr);
121  regd = inb(ioaddr + D8390_P0_TCR);
122 
123  if (inb(ioaddr + D8390_P0_TCR)) {
124  outb(ioaddr, state);
125  outb(ioaddr + 0x0d, regd);
126  return 0;
127  }
128 
129  return 1;
130 }
uint8_t state
State.
Definition: eth_slow.h:47
#define D8390_COMMAND_PS1
Definition: ns8390.h:197
static unsigned long ioaddr
Definition: davicom.c:129
#define D8390_P0_TCR
Definition: ns8390.h:183
uint8_t inb(volatile uint8_t *io_addr)
Read byte from I/O-mapped device.
#define D8390_COMMAND_RD2
Definition: ns8390.h:199
#define outb(data, io_addr)
Definition: io.h:309
#define D8390_COMMAND_STP
Definition: ns8390.h:204

References D8390_COMMAND_PS1, D8390_COMMAND_RD2, D8390_COMMAND_STP, D8390_P0_TCR, inb(), ioaddr, outb, and state.

◆ ne_probe()

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

Definition at line 135 of file ne2k_isa.c.

135  {
136  int i;
137  unsigned char c;
138  unsigned char romdata[16];
139  unsigned char testbuf[32];
140 
142  eth_drain_receiver = 0;
143 
144  nic->irqno = 0;
145  nic->ioaddr = isa->ioaddr;
146  eth_nic_base = isa->ioaddr;
147 
148  /******************************************************************
149  Search for NE1000/2000 if no WD/SMC or 3com cards
150  ******************************************************************/
151  if (eth_vendor == VENDOR_NONE) {
152 
153  static unsigned char test[] = "NE*000 memory";
154 
155  eth_bmem = 0; /* No shared memory */
156 
160  eth_tx_start = 32;
164  (void) inb(0x84);
166  + D8390_P0_COMMAND);
171  eth_pio_write((unsigned char *) test, 8192, sizeof(test));
172  eth_pio_read(8192, testbuf, sizeof(test));
173  if (!memcmp(test, testbuf, sizeof(test)))
174  goto out;
177  eth_tx_start = 64;
180  + D8390_P0_DCR);
183  eth_pio_write((unsigned char *) test, 16384, sizeof(test));
184  eth_pio_read(16384, testbuf, sizeof(test));
185  if (!memcmp(testbuf, test, sizeof(test)))
186  goto out;
187 
188 
189 out:
190  if (eth_nic_base == 0)
191  return (0);
192  if (eth_nic_base > ISA_MAX_ADDR) /* PCI probably */
195  eth_pio_read(0, romdata, sizeof(romdata));
196  for (i = 0; i < ETH_ALEN; i++) {
197  nic->node_addr[i] = romdata[i + ((eth_flags & FLAG_16BIT) ? i : 0)];
198  }
200  DBG("\nNE%c000 base %4.4x, MAC Addr %s\n",
201  (eth_flags & FLAG_16BIT) ? '2' : '1', eth_nic_base, eth_ntoa(
202  nic->node_addr));
203  }
204 
205  if (eth_vendor == VENDOR_NONE)
206  return (0);
207 
208  if (eth_vendor != VENDOR_3COM)
209  eth_rmem = eth_bmem;
210 
211  ne_reset(nic, isa);
213  return 1;
214 }
#define D8390_P0_RCR
Definition: ns8390.h:182
unsigned char irqno
Definition: nic.h:56
#define VENDOR_3COM
Definition: ns8390.h:14
uint32_t c
Definition: md4.c:30
static unsigned char eth_vendor
Definition: ne2k_isa.c:33
uint16_t ioaddr
I/O address.
Definition: isa.h:16
#define VENDOR_NOVELL
Definition: ns8390.h:13
#define D8390_DCR_FT1
Definition: ns8390.h:208
#define FLAG_PIO
Definition: ns8390.h:16
#define MEM_16384
Definition: ns8390.h:21
static unsigned char eth_rx_start
Definition: ne2k_isa.c:35
static Address eth_rmem
Definition: ne2k_isa.c:36
static void eth_pio_write(const unsigned char *src, unsigned int dst, unsigned int cnt)
Definition: ne2k_isa.c:69
#define NE_RESET
Definition: ns8390.h:160
#define MEM_8192
Definition: ns8390.h:20
#define D8390_RCR_MON
Definition: ns8390.h:206
#define D8390_P0_DCR
Definition: ns8390.h:184
#define FLAG_16BIT
Definition: ns8390.h:17
unsigned int ioaddr
Definition: nic.h:55
static void ne_reset(struct nic *nic, struct isa_device *isa)
#define NE_ASIC_OFFSET
Definition: ns8390.h:159
__be32 out[4]
Definition: CIB_PRM.h:36
#define D8390_DCR_LS
Definition: ns8390.h:209
static unsigned char eth_drain_receiver
Definition: ne2k_isa.c:37
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
Definition: ethernet.c:175
uint8_t inb(volatile uint8_t *io_addr)
Read byte from I/O-mapped device.
static unsigned short eth_asic_base
Definition: ne2k_isa.c:34
#define ETH_ALEN
Definition: if_ether.h:8
Definition: nic.h:49
#define D8390_P0_COMMAND
Definition: ns8390.h:168
#define D8390_COMMAND_RD2
Definition: ns8390.h:199
#define VENDOR_NONE
Definition: ns8390.h:11
unsigned char * node_addr
Definition: nic.h:52
#define outb(data, io_addr)
Definition: io.h:309
#define D8390_P0_PSTOP
Definition: ns8390.h:170
#define ISA_MAX_ADDR
Definition: ns8390.h:24
static unsigned char eth_memsize
Definition: ne2k_isa.c:35
#define D8390_COMMAND_STP
Definition: ns8390.h:204
static unsigned short eth_nic_base
Definition: ne2k_isa.c:34
#define MEM_32768
Definition: ns8390.h:22
static void eth_pio_read(unsigned int src, unsigned char *dst, unsigned int cnt)
Definition: ne2k_isa.c:47
#define D8390_TXBUF_SIZE
Definition: ns8390.h:226
static unsigned char eth_tx_start
Definition: ne2k_isa.c:35
static Address eth_bmem
Definition: ne2k_isa.c:36
#define D8390_P0_PSTART
Definition: ns8390.h:169
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
struct nic_operations * nic_op
Definition: nic.h:50
int memcmp(const void *first, const void *second, size_t len)
Compare memory regions.
Definition: string.c:113
static int test
Definition: epic100.c:73
static unsigned char eth_flags
Definition: ne2k_isa.c:33
#define D8390_DCR_WTS
Definition: ns8390.h:210
static struct nic_operations ne_operations
Definition: ne2k_isa.c:39

References c, D8390_COMMAND_RD2, D8390_COMMAND_STP, D8390_DCR_FT1, D8390_DCR_LS, D8390_DCR_WTS, D8390_P0_COMMAND, D8390_P0_DCR, D8390_P0_PSTART, D8390_P0_PSTOP, D8390_P0_RCR, D8390_RCR_MON, D8390_TXBUF_SIZE, DBG, ETH_ALEN, eth_asic_base, eth_bmem, eth_drain_receiver, eth_flags, eth_memsize, eth_nic_base, eth_ntoa(), eth_pio_read(), eth_pio_write(), eth_rmem, eth_rx_start, eth_tx_start, eth_vendor, FLAG_16BIT, FLAG_PIO, inb(), isa_device::ioaddr, nic::ioaddr, nic::irqno, ISA_MAX_ADDR, MEM_16384, MEM_32768, MEM_8192, memcmp(), NE_ASIC_OFFSET, ne_operations, ne_reset(), NE_RESET, nic::nic_op, nic::node_addr, out, outb, test, VENDOR_3COM, VENDOR_NONE, and VENDOR_NOVELL.

◆ ne_disable()

static void ne_disable ( struct nic nic,
struct isa_device isa 
)
static

Definition at line 220 of file ne2k_isa.c.

220  {
221  ne_reset(nic, isa);
222 }
static void ne_reset(struct nic *nic, struct isa_device *isa)
Definition: nic.h:49

References ne_reset().

◆ ne_reset() [2/2]

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

Definition at line 228 of file ne2k_isa.c.

229 {
230  int i;
231 
232  eth_drain_receiver = 0;
235  if (eth_flags & FLAG_16BIT)
237  else
241  outb(0x20, eth_nic_base+D8390_P0_RCR); /* monitor mode */
245 
252 
253  for (i=0; i<ETH_ALEN; i++)
255  for (i=0; i<ETH_ALEN; i++)
261  outb(0, eth_nic_base+D8390_P0_TCR); /* transmitter on */
262  outb(4, eth_nic_base+D8390_P0_RCR); /* allow rx broadcast frames */
263 
265 }
#define D8390_P0_RCR
Definition: ns8390.h:182
#define D8390_P0_IMR
Definition: ns8390.h:185
static unsigned char eth_rx_start
Definition: ne2k_isa.c:35
#define D8390_COMMAND_PS1
Definition: ns8390.h:197
#define D8390_P0_DCR
Definition: ns8390.h:184
#define FLAG_16BIT
Definition: ns8390.h:17
static unsigned char eth_drain_receiver
Definition: ne2k_isa.c:37
#define D8390_P0_TCR
Definition: ns8390.h:183
#define D8390_P1_CURR
Definition: ns8390.h:193
static void enable_multicast(unsigned short eth_nic_base)
Definition: ne2k_isa.c:94
#define D8390_COMMAND_PS0
Definition: ns8390.h:196
#define ETH_ALEN
Definition: if_ether.h:8
#define D8390_P0_RBCR0
Definition: ns8390.h:179
Definition: nic.h:49
#define D8390_P1_PAR0
Definition: ns8390.h:187
#define D8390_P0_COMMAND
Definition: ns8390.h:168
#define D8390_COMMAND_RD2
Definition: ns8390.h:199
unsigned char * node_addr
Definition: nic.h:52
#define outb(data, io_addr)
Definition: io.h:309
#define D8390_P0_PSTOP
Definition: ns8390.h:170
#define D8390_P0_RBCR1
Definition: ns8390.h:180
static unsigned char eth_memsize
Definition: ne2k_isa.c:35
#define D8390_P1_MAR0
Definition: ns8390.h:194
#define D8390_COMMAND_STP
Definition: ns8390.h:204
static unsigned short eth_nic_base
Definition: ne2k_isa.c:34
#define D8390_P0_ISR
Definition: ns8390.h:176
#define D8390_P0_TPSR
Definition: ns8390.h:173
#define D8390_P0_BOUND
Definition: ns8390.h:171
static unsigned char eth_tx_start
Definition: ne2k_isa.c:35
#define D8390_P0_PSTART
Definition: ns8390.h:169
static unsigned char eth_flags
Definition: ne2k_isa.c:33
#define D8390_COMMAND_STA
Definition: ns8390.h:203

References D8390_COMMAND_PS0, D8390_COMMAND_PS1, D8390_COMMAND_RD2, D8390_COMMAND_STA, D8390_COMMAND_STP, D8390_P0_BOUND, D8390_P0_COMMAND, D8390_P0_DCR, D8390_P0_IMR, D8390_P0_ISR, D8390_P0_PSTART, D8390_P0_PSTOP, D8390_P0_RBCR0, D8390_P0_RBCR1, D8390_P0_RCR, D8390_P0_TCR, D8390_P0_TPSR, D8390_P1_CURR, D8390_P1_MAR0, D8390_P1_PAR0, enable_multicast(), ETH_ALEN, eth_drain_receiver, eth_flags, eth_memsize, eth_nic_base, eth_rx_start, eth_tx_start, FLAG_16BIT, nic::node_addr, and outb.

◆ ne_poll()

static int ne_poll ( struct nic *nic  __unused,
int retrieve  __unused 
)
static

Definition at line 271 of file ne2k_isa.c.

272 {
273  int ret = 0;
274  unsigned char rstat, curr, next;
275  unsigned short len, frag;
276  unsigned short pktoff;
277  unsigned char *p;
278  struct ringbuffer pkthdr;
279 
280  rstat = inb(eth_nic_base+D8390_P0_RSR);
281  if (!(rstat & D8390_RSTAT_PRX)) return(0);
283  if (next >= eth_memsize) next = eth_rx_start;
287  if (curr >= eth_memsize) curr=eth_rx_start;
288  if (curr == next) return(0);
289 
290  if ( ! retrieve ) return 1;
291 
292  pktoff = next << 8;
293  if (eth_flags & FLAG_PIO)
294  eth_pio_read(pktoff, (unsigned char *)&pkthdr, 4);
295  else
296  memcpy(&pkthdr, bus_to_virt(eth_rmem + pktoff), 4);
297  pktoff += sizeof(pkthdr);
298  /* incoming length includes FCS so must sub 4 */
299  len = pkthdr.len - 4;
300  if ((pkthdr.status & D8390_RSTAT_PRX) == 0 || len < ETH_ZLEN
301  || len> ETH_FRAME_LEN) {
302  DBG("Bogus packet, ignoring\n");
303  return (0);
304  }
305  else {
306  p = nic->packet;
307  nic->packetlen = len; /* available to caller */
308  frag = (eth_memsize << 8) - pktoff;
309  if (len> frag) { /* We have a wrap-around */
310  /* read first part */
311  if (eth_flags & FLAG_PIO)
312  eth_pio_read(pktoff, p, frag);
313  else
314  memcpy(p, bus_to_virt(eth_rmem + pktoff), frag);
315  pktoff = eth_rx_start << 8;
316  p += frag;
317  len -= frag;
318  }
319  /* read second part */
320  if (eth_flags & FLAG_PIO)
321  eth_pio_read(pktoff, p, len);
322  else
323  memcpy(p, bus_to_virt(eth_rmem + pktoff), len);
324  ret = 1;
325  }
326  next = pkthdr.next; /* frame number of next packet */
327  if (next == eth_rx_start)
328  next = eth_memsize;
330  return(ret);
331 }
uint32_t next
Next descriptor address.
Definition: myson.h:18
#define FLAG_PIO
Definition: ns8390.h:16
static unsigned char eth_rx_start
Definition: ne2k_isa.c:35
static Address eth_rmem
Definition: ne2k_isa.c:36
#define D8390_COMMAND_PS1
Definition: ns8390.h:197
static __always_inline void * bus_to_virt(unsigned long bus_addr)
Convert bus address to a virtual address.
Definition: io.h:195
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define ETH_FRAME_LEN
Definition: if_ether.h:11
unsigned int packetlen
Definition: nic.h:54
#define D8390_P0_RSR
Definition: ns8390.h:181
#define D8390_P1_CURR
Definition: ns8390.h:193
#define D8390_COMMAND_PS0
Definition: ns8390.h:196
uint8_t inb(volatile uint8_t *io_addr)
Read byte from I/O-mapped device.
#define ETH_ZLEN
Definition: if_ether.h:10
Definition: nic.h:49
#define D8390_P0_COMMAND
Definition: ns8390.h:168
unsigned char * packet
Definition: nic.h:53
#define outb(data, io_addr)
Definition: io.h:309
uint32_t len
Length.
Definition: ena.h:14
static unsigned char eth_memsize
Definition: ne2k_isa.c:35
static unsigned short eth_nic_base
Definition: ne2k_isa.c:34
static void eth_pio_read(unsigned int src, unsigned char *dst, unsigned int cnt)
Definition: ne2k_isa.c:47
#define D8390_RSTAT_PRX
Definition: ns8390.h:221
#define D8390_P0_BOUND
Definition: ns8390.h:171
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
static unsigned char eth_flags
Definition: ne2k_isa.c:33

References bus_to_virt(), D8390_COMMAND_PS0, D8390_COMMAND_PS1, D8390_P0_BOUND, D8390_P0_COMMAND, D8390_P0_RSR, D8390_P1_CURR, D8390_RSTAT_PRX, DBG, eth_flags, ETH_FRAME_LEN, eth_memsize, eth_nic_base, eth_pio_read(), eth_rmem, eth_rx_start, ETH_ZLEN, FLAG_PIO, inb(), len, memcpy(), next, outb, nic::packet, and nic::packetlen.

◆ ne_transmit()

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

Definition at line 337 of file ne2k_isa.c.

340  { /* Packet */
341 
342  /* Programmed I/O */
343  unsigned short type;
344  type = (t >> 8) | (t << 8);
345  eth_pio_write((unsigned char *) d, eth_tx_start << 8, ETH_ALEN);
347  /* bcc generates worse code without (const+const) below */
348  eth_pio_write((unsigned char *) &type, (eth_tx_start << 8) + (ETH_ALEN
349  + ETH_ALEN), 2);
350  eth_pio_write((unsigned char *) p, (eth_tx_start << 8) + ETH_HLEN, s);
351  s += ETH_HLEN;
352  if (s < ETH_ZLEN)
353  s = ETH_ZLEN;
354 
359  outb(s >> 8, eth_nic_base + D8390_P0_TBCR1);
360 
363 }
uint8_t type
Type.
Definition: ena.h:16
static void eth_pio_write(const unsigned char *src, unsigned int dst, unsigned int cnt)
Definition: ne2k_isa.c:69
#define ETH_HLEN
Definition: if_ether.h:9
#define D8390_COMMAND_PS0
Definition: ns8390.h:196
#define ETH_ALEN
Definition: if_ether.h:8
#define ETH_ZLEN
Definition: if_ether.h:10
Definition: nic.h:49
#define D8390_P0_COMMAND
Definition: ns8390.h:168
#define D8390_COMMAND_RD2
Definition: ns8390.h:199
#define D8390_COMMAND_TXP
Definition: ns8390.h:202
unsigned char * node_addr
Definition: nic.h:52
#define outb(data, io_addr)
Definition: io.h:309
#define D8390_P0_TBCR0
Definition: ns8390.h:174
static unsigned short eth_nic_base
Definition: ne2k_isa.c:34
uint32_t d
Definition: md4.c:31
#define D8390_P0_TPSR
Definition: ns8390.h:173
static unsigned char eth_tx_start
Definition: ne2k_isa.c:35
#define D8390_P0_TBCR1
Definition: ns8390.h:175
#define D8390_COMMAND_STA
Definition: ns8390.h:203

References d, D8390_COMMAND_PS0, D8390_COMMAND_RD2, D8390_COMMAND_STA, D8390_COMMAND_TXP, D8390_P0_COMMAND, D8390_P0_TBCR0, D8390_P0_TBCR1, D8390_P0_TPSR, ETH_ALEN, ETH_HLEN, eth_nic_base, eth_pio_write(), eth_tx_start, ETH_ZLEN, nic::node_addr, outb, and type.

◆ ISA_DRIVER()

ISA_DRIVER ( ne_driver  ,
ne_probe_addrs  ,
ne_probe1  ,
GENERIC_ISAPNP_VENDOR  ,
0x0600   
)

◆ DRIVER()

DRIVER ( "ne"  ,
nic_driver  ,
isapnp_driver  ,
ne_driver  ,
ne_probe  ,
ne_disable   
)

◆ ISA_ROM()

ISA_ROM ( "ne"  ,
"NE1000/2000 and clones"   
)

Variable Documentation

◆ eth_vendor

unsigned char eth_vendor
static

Definition at line 33 of file ne2k_isa.c.

Referenced by ne_probe().

◆ eth_flags

unsigned char eth_flags
static

Definition at line 33 of file ne2k_isa.c.

Referenced by eth_pio_read(), eth_pio_write(), ne_poll(), ne_probe(), and ne_reset().

◆ eth_nic_base

unsigned short eth_nic_base
static

◆ eth_asic_base

unsigned short eth_asic_base
static

Definition at line 34 of file ne2k_isa.c.

Referenced by eth_pio_read(), eth_pio_write(), and ne_probe().

◆ eth_memsize

unsigned char eth_memsize
static

Definition at line 35 of file ne2k_isa.c.

Referenced by ne_poll(), ne_probe(), and ne_reset().

◆ eth_rx_start

unsigned char eth_rx_start
static

Definition at line 35 of file ne2k_isa.c.

Referenced by ne_poll(), ne_probe(), and ne_reset().

◆ eth_tx_start

unsigned char eth_tx_start
static

Definition at line 35 of file ne2k_isa.c.

Referenced by ne_probe(), ne_reset(), and ne_transmit().

◆ eth_bmem

Address eth_bmem
static

Definition at line 36 of file ne2k_isa.c.

Referenced by ne_probe().

◆ eth_rmem

Address eth_rmem
static

Definition at line 36 of file ne2k_isa.c.

Referenced by ne_poll(), and ne_probe().

◆ eth_drain_receiver

unsigned char eth_drain_receiver
static

Definition at line 37 of file ne2k_isa.c.

Referenced by ne_probe(), and ne_reset().

◆ ne_operations

static struct nic_operations ne_operations
static
Initial value:
= { .connect = dummy_connect,
.poll = ne_poll, .transmit = ne_transmit, .irq = dummy_irq,
}
int dummy_connect(struct nic *nic __unused)
Definition: legacy.c:151
static void ne_transmit(struct nic *nic, const char *d, unsigned int t, unsigned int s, const char *p)
Definition: ne2k_isa.c:337
void dummy_irq(struct nic *nic __unused, irq_action_t irq_action __unused)
Definition: legacy.c:155
static int ne_poll(struct nic *nic __unused, int retrieve __unused)
Definition: ne2k_isa.c:271

Definition at line 39 of file ne2k_isa.c.

Referenced by ne_probe().

◆ ne_probe_addrs

isa_probe_addr_t ne_probe_addrs[] = { 0x300, 0x280, 0x320, 0x340, 0x380, 0x220, }
static

Definition at line 42 of file ne2k_isa.c.