iPXE
Data Structures | Macros | Functions | Variables
3c595.c File Reference
#include "etherboot.h"
#include "nic.h"
#include <ipxe/pci.h>
#include <ipxe/ethernet.h>
#include "3c595.h"

Go to the source code of this file.

Data Structures

struct  connector_entry
 

Macros

#define CONNECTOR_UTP   0
 
#define CONNECTOR_AUI   1
 
#define CONNECTOR_BNC   3
 
#define CONNECTOR_TX   4
 
#define CONNECTOR_FX   5
 
#define CONNECTOR_MII   6
 

Functions

 FILE_LICENCE (BSD2)
 
static void vxgetlink (void)
 
static void vxsetlink (void)
 
static void t595_reset (struct nic *nic)
 
static void t595_transmit (struct nic *nic, const char *d, unsigned int t, unsigned int s, const char *p)
 
static int t595_poll (struct nic *nic, int retrieve)
 
static int eeprom_rdy ()
 
static int get_e (int offset)
 
static void t595_disable (struct nic *nic)
 
static void t595_irq (struct nic *nic __unused, irq_action_t action __unused)
 
static int t595_probe (struct nic *nic, struct pci_device *pci)
 
 PCI_DRIVER (t595_driver, t595_nics, PCI_NO_CLASS)
 
 DRIVER ("3C595", nic_driver, pci_driver, t595_driver, t595_probe, t595_disable)
 

Variables

static struct nic_operations t595_operations
 
static unsigned short eth_nic_base
 
static unsigned short vx_connector
 
static unsigned short vx_connectors
 
static struct connector_entry conn_tab [VX_CONNECTORS]
 
static char padmap []
 
static struct pci_device_id t595_nics []
 

Macro Definition Documentation

◆ CONNECTOR_UTP

#define CONNECTOR_UTP   0

◆ CONNECTOR_AUI

#define CONNECTOR_AUI   1

◆ CONNECTOR_BNC

#define CONNECTOR_BNC   3

◆ CONNECTOR_TX

#define CONNECTOR_TX   4

◆ CONNECTOR_FX

#define CONNECTOR_FX   5

◆ CONNECTOR_MII

#define CONNECTOR_MII   6

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( BSD2  )

◆ vxgetlink()

static void vxgetlink ( void  )
static

Definition at line 357 of file 3c595.c.

358 {
359  int n, k;
360 
361  GO_WINDOW(3);
363  for (n = 0, k = 0; k < VX_CONNECTORS; k++) {
364  if (vx_connectors & conn_tab[k].bit) {
365  if (n > 0) {
366  printf("/");
367  }
368  printf("%s", conn_tab[k].name );
369  n++;
370  }
371  }
372  if (vx_connectors == 0) {
373  printf("no connectors!");
374  return;
375  }
376  GO_WINDOW(3);
380  if (vx_connector & 0x10) {
381  vx_connector &= 0x0f;
382  printf("[*%s*]", conn_tab[vx_connector].name);
383  printf(": disable 'auto select' with DOS util!");
384  } else {
385  printf("[*%s*]", conn_tab[vx_connector].name);
386  }
387 }
const char * name
Definition: ath9k_hw.c:1984
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 unsigned int bit
Definition: bigint.h:208
#define INTERNAL_CONNECTOR_MASK
Definition: 3c595.h:310
#define INTERNAL_CONNECTOR_BITS
Definition: 3c595.h:309
#define VX_W3_RESET_OPT
Definition: 3c595.h:169
#define VX_W3_INTERNAL_CFG
Definition: 3c595.h:168
static unsigned short vx_connector
Definition: 3c595.c:39
static unsigned short vx_connectors
Definition: 3c595.c:39
static const uint32_t k[64]
MD5 constants.
Definition: md5.c:53
#define GO_WINDOW(b, x)
Definition: 3c509.h:75
uint32_t inl(volatile uint32_t *io_addr)
Read 32-bit dword from I/O-mapped device.
#define BASE
Definition: 3c595.h:69
static struct connector_entry conn_tab[VX_CONNECTORS]
#define VX_CONNECTORS
Definition: 3c595.h:431

References BASE, bit, conn_tab, GO_WINDOW, inl(), INTERNAL_CONNECTOR_BITS, INTERNAL_CONNECTOR_MASK, inw(), k, name, printf(), vx_connector, vx_connectors, VX_CONNECTORS, VX_W3_INTERNAL_CFG, and VX_W3_RESET_OPT.

Referenced by t595_probe().

◆ vxsetlink()

static void vxsetlink ( void  )
static

Definition at line 390 of file 3c595.c.

391 {
392  int i, j;
393  char *reason, *warning;
394  static signed char prev_conn = -1;
395 
396  if (prev_conn == -1) {
397  prev_conn = vx_connector;
398  }
399 
400  i = vx_connector; /* default in EEPROM */
401  reason = "default";
402  warning = NULL;
403 
404  if ((vx_connectors & conn_tab[vx_connector].bit) == 0) {
405  warning = "strange connector type in EEPROM.";
406  reason = "forced";
407  i = CONNECTOR_UTP;
408  }
409 
410  if (warning) {
411  printf("warning: %s\n", warning);
412  }
413  printf("selected %s. (%s)\n", conn_tab[i].name, reason);
414 
415  /* Set the selected connector. */
416  GO_WINDOW(3);
419 
420  /* First, disable all. */
422  udelay(8000);
423  GO_WINDOW(4);
424  outw(0, BASE + VX_W4_MEDIA_TYPE);
425 
426  /* Second, enable the selected one. */
427  switch(i) {
428  case CONNECTOR_UTP:
429  GO_WINDOW(4);
431  break;
432  case CONNECTOR_BNC:
434  udelay(8000);
435  break;
436  case CONNECTOR_TX:
437  case CONNECTOR_FX:
438  GO_WINDOW(4);
440  break;
441  default: /* AUI and MII fall here */
442  break;
443  }
444  GO_WINDOW(1);
445 }
const char * name
Definition: ath9k_hw.c:1984
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
#define ENABLE_UTP
Definition: 3c509.h:354
static unsigned int unsigned int bit
Definition: bigint.h:208
#define LINKBEAT_ENABLE
Definition: 3c595.h:420
#define outw(data, io_addr)
Definition: io.h:319
#define INTERNAL_CONNECTOR_MASK
Definition: 3c595.h:310
#define INTERNAL_CONNECTOR_BITS
Definition: 3c595.h:309
#define CONNECTOR_UTP
#define VX_W4_MEDIA_TYPE
Definition: 3c595.h:177
#define VX_W3_INTERNAL_CFG
Definition: 3c595.h:168
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition: timer.c:60
#define CONNECTOR_TX
#define START_TRANSCEIVER
Definition: 3c509.h:215
#define outl(data, io_addr)
Definition: io.h:329
int i
Definition: 3c515.c:164
static unsigned short vx_connector
Definition: 3c595.c:39
static unsigned short vx_connectors
Definition: 3c595.c:39
#define VX_COMMAND
Definition: 3c595.h:119
#define GO_WINDOW(b, x)
Definition: 3c509.h:75
#define CONNECTOR_BNC
uint32_t inl(volatile uint32_t *io_addr)
Read 32-bit dword from I/O-mapped device.
#define CONNECTOR_FX
uint16_t reason
Rejection reason.
Definition: ib_mad.h:20
#define BASE
Definition: 3c595.h:69
static struct connector_entry conn_tab[VX_CONNECTORS]
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
#define STOP_TRANSCEIVER
Definition: 3c509.h:242

References BASE, bit, conn_tab, CONNECTOR_BNC, CONNECTOR_FX, CONNECTOR_TX, CONNECTOR_UTP, ENABLE_UTP, GO_WINDOW, inl(), INTERNAL_CONNECTOR_BITS, INTERNAL_CONNECTOR_MASK, LINKBEAT_ENABLE, name, NULL, outl, outw, printf(), reason, START_TRANSCEIVER, STOP_TRANSCEIVER, udelay(), VX_COMMAND, vx_connector, vx_connectors, VX_W3_INTERNAL_CFG, and VX_W4_MEDIA_TYPE.

Referenced by t595_reset().

◆ t595_reset()

static void t595_reset ( struct nic nic)
static

Definition at line 68 of file 3c595.c.

69 {
70  int i;
71 
72  /***********************************************************
73  Reset 3Com 595 card
74  *************************************************************/
75 
76  /* stop card */
82  udelay(8000);
91 
92  /*
93  * initialize card
94  */
96 
97  GO_WINDOW(0);
98 
99  /* Disable the card */
100 /* outw(0, BASE + VX_W0_CONFIG_CTRL); */
101 
102  /* Configure IRQ to none */
103 /* outw(SET_IRQ(0), BASE + VX_W0_RESOURCE_CFG); */
104 
105  /* Enable the card */
106 /* outw(ENABLE_DRQ_IRQ, BASE + VX_W0_CONFIG_CTRL); */
107 
108  GO_WINDOW(2);
109 
110  /* Reload the ether_addr. */
111  for (i = 0; i < ETH_ALEN; i++)
113 
115  VX_BUSY_WAIT;
117  VX_BUSY_WAIT;
118 
119  /* Window 1 is operating window */
120  GO_WINDOW(1);
121  for (i = 0; i < 31; i++)
123 
128 
129 /*
130  * Attempt to get rid of any stray interrupts that occurred during
131  * configuration. On the i386 this isn't possible because one may
132  * already be queued. However, a single stray interrupt is
133  * unimportant.
134  */
135 
136  outw(ACK_INTR | 0xff, BASE + VX_COMMAND);
137 
140 
141  vxsetlink();
142 /*{
143  int i,j;
144  i = CONNECTOR_TX;
145  GO_WINDOW(3);
146  j = inl(BASE + VX_W3_INTERNAL_CFG) & ~INTERNAL_CONNECTOR_MASK;
147  outl(BASE + VX_W3_INTERNAL_CFG, j | (i <<INTERNAL_CONNECTOR_BITS));
148  GO_WINDOW(4);
149  outw(LINKBEAT_ENABLE, BASE + VX_W4_MEDIA_TYPE);
150  GO_WINDOW(1);
151 }*/
152 
153  /* start tranciever and receiver */
156 
157 }
#define RX_DISCARD_TOP_PACK
Definition: 3c509.h:225
#define S_TX_AVAIL
Definition: 3c509.h:278
static void vxsetlink(void)
Definition: 3c595.c:390
#define RX_DISABLE
Definition: 3c509.h:221
#define outw(data, io_addr)
Definition: io.h:319
#define RX_RESET
Definition: 3c509.h:224
#define FIL_MULTICAST
Definition: 3c595.h:260
#define TX_RESET
Definition: 3c509.h:228
#define S_RX_COMPLETE
Definition: 3c509.h:279
#define ACK_INTR
Definition: 3c509.h:247
#define VX_W2_ADDR_0
Definition: 3c595.h:162
#define TX_DISABLE
Definition: 3c509.h:227
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition: timer.c:60
#define VX_BUSY_WAIT
Definition: 3c595.h:298
#define SET_RD_0_MASK
Definition: 3c509.h:231
#define S_TX_COMPLETE
Definition: 3c509.h:277
#define SET_RX_FILTER
Definition: 3c509.h:232
#define SET_INTR_MASK
Definition: 3c509.h:230
#define C_INTR_LATCH
Definition: 3c509.h:248
int i
Definition: 3c515.c:164
#define VX_COMMAND
Definition: 3c595.h:119
uint8_t inb(volatile uint8_t *io_addr)
Read byte from I/O-mapped device.
#define ETH_ALEN
Definition: if_ether.h:8
Definition: nic.h:49
#define TX_ENABLE
Definition: 3c509.h:226
unsigned char * node_addr
Definition: nic.h:52
#define FIL_INDIVIDUAL
Definition: 3c509.h:233
#define outb(data, io_addr)
Definition: io.h:309
#define RX_ENABLE
Definition: 3c509.h:223
#define GO_WINDOW(b, x)
Definition: 3c509.h:75
#define BASE
Definition: 3c595.h:69
#define FIL_BRDCST
Definition: 3c509.h:235
#define S_CARD_FAILURE
Definition: 3c509.h:276
#define VX_W1_TX_STATUS
Definition: 3c595.h:147
#define STOP_TRANSCEIVER
Definition: 3c509.h:242

References ACK_INTR, BASE, C_INTR_LATCH, ETH_ALEN, FIL_BRDCST, FIL_INDIVIDUAL, FIL_MULTICAST, GO_WINDOW, inb(), nic::node_addr, outb, outw, RX_DISABLE, RX_DISCARD_TOP_PACK, RX_ENABLE, RX_RESET, S_CARD_FAILURE, S_RX_COMPLETE, S_TX_AVAIL, S_TX_COMPLETE, SET_INTR_MASK, SET_RD_0_MASK, SET_RX_FILTER, STOP_TRANSCEIVER, TX_DISABLE, TX_ENABLE, TX_RESET, udelay(), VX_BUSY_WAIT, VX_COMMAND, VX_W1_TX_STATUS, VX_W2_ADDR_0, and vxsetlink().

Referenced by t595_disable(), and t595_probe().

◆ t595_transmit()

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

Definition at line 165 of file 3c595.c.

171 {
172  register int len;
173  int pad;
174  int status;
175 
176 #ifdef EDEBUG
177  printf("{l=%d,t=%hX}",s+ETH_HLEN,t);
178 #endif
179 
180  /* swap bytes of type */
181  t= htons(t);
182 
183  len=s+ETH_HLEN; /* actual length of packet */
184  pad = padmap[len & 3];
185 
186  /*
187  * The 3c595 automatically pads short packets to minimum ethernet length,
188  * but we drop packets that are too large. Perhaps we should truncate
189  * them instead?
190  */
191  if (len + pad > ETH_FRAME_LEN) {
192  return;
193  }
194 
195  /* drop acknowledgements */
196  while(( status=inb(BASE + VX_W1_TX_STATUS) )& TXS_COMPLETE ) {
200  }
201 
202  outb(0x0, BASE + VX_W1_TX_STATUS);
203  }
204 
205  while (inw(BASE + VX_W1_FREE_TX) < len + pad + 4) {
206  /* no room in FIFO */
207  }
208 
210  outw(0x0, BASE + VX_W1_TX_PIO_WR_1); /* Second dword meaningless */
211 
212  /* write packet */
216  outsw(BASE + VX_W1_TX_PIO_WR_1, p, s / 2);
217  if (s & 1)
218  outb(*(p+s - 1), BASE + VX_W1_TX_PIO_WR_1);
219 
220  while (pad--)
221  outb(0, BASE + VX_W1_TX_PIO_WR_1); /* Padding */
222 
223  /* wait for Tx complete */
224  while((inw(BASE + VX_STATUS) & S_COMMAND_IN_PROGRESS) != 0)
225  ;
226 }
#define TXS_UNDERRUN
Definition: 3c509.h:334
#define VX_STATUS
Definition: 3c595.h:121
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.
#define S_COMMAND_IN_PROGRESS
Definition: 3c509.h:285
#define TX_RESET
Definition: 3c509.h:228
u32 pad[9]
Padding.
Definition: ar9003_mac.h:90
#define TXS_STATUS_OVERFLOW
Definition: 3c509.h:336
uint8_t status
Status.
Definition: ena.h:16
#define TXS_MAX_COLLISION
Definition: 3c509.h:335
#define TXS_COMPLETE
Definition: 3c509.h:331
#define VX_W1_TX_PIO_WR_1
Definition: 3c595.h:144
#define ETH_HLEN
Definition: if_ether.h:9
#define ETH_FRAME_LEN
Definition: if_ether.h:11
static char padmap[]
Definition: 3c595.c:162
#define VX_COMMAND
Definition: 3c595.h:119
uint8_t inb(volatile uint8_t *io_addr)
Read byte from I/O-mapped device.
#define ETH_ALEN
Definition: if_ether.h:8
Definition: nic.h:49
#define TX_ENABLE
Definition: 3c509.h:226
#define VX_W1_FREE_TX
Definition: 3c595.h:146
unsigned char * node_addr
Definition: nic.h:52
#define outb(data, io_addr)
Definition: io.h:309
uint32_t len
Length.
Definition: ena.h:14
uint32_t d
Definition: md4.c:31
#define BASE
Definition: 3c595.h:69
#define VX_W1_TX_STATUS
Definition: 3c595.h:147
#define htons(value)
Definition: byteswap.h:135

References BASE, d, ETH_ALEN, ETH_FRAME_LEN, ETH_HLEN, htons, inb(), inw(), len, nic::node_addr, outb, outsw(), outw, pad, padmap, printf(), S_COMMAND_IN_PROGRESS, status, TX_ENABLE, TX_RESET, TXS_COMPLETE, TXS_MAX_COLLISION, TXS_STATUS_OVERFLOW, TXS_UNDERRUN, VX_COMMAND, VX_STATUS, VX_W1_FREE_TX, VX_W1_TX_PIO_WR_1, and VX_W1_TX_STATUS.

◆ t595_poll()

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

Definition at line 231 of file 3c595.c.

232 {
233  /* common variables */
234  /* variables for 3C595 */
235  short status, cst;
236  register short rx_fifo;
237 
238  cst=inw(BASE + VX_STATUS);
239 
240 #ifdef EDEBUG
241  if(cst & 0x1FFF)
242  printf("-%hX-",cst);
243 #endif
244 
245  if( (cst & S_RX_COMPLETE)==0 ) {
246  /* acknowledge everything */
247  outw(ACK_INTR | cst, BASE + VX_COMMAND);
249 
250  return 0;
251  }
252 
254 #ifdef EDEBUG
255  printf("*%hX*",status);
256 #endif
257 
258  if (status & ERR_RX) {
260  return 0;
261  }
262 
263  rx_fifo = status & RX_BYTES_MASK;
264  if (rx_fifo==0)
265  return 0;
266 
267  if ( ! retrieve ) return 1;
268 
269  /* read packet */
270 #ifdef EDEBUG
271  printf("[l=%d",rx_fifo);
272 #endif
273  insw(BASE + VX_W1_RX_PIO_RD_1, nic->packet, rx_fifo / 2);
274  if(rx_fifo & 1)
275  nic->packet[rx_fifo-1]=inb(BASE + VX_W1_RX_PIO_RD_1);
276  nic->packetlen=rx_fifo;
277 
278  while(1) {
280 #ifdef EDEBUG
281  printf("*%hX*",status);
282 #endif
283  rx_fifo = status & RX_BYTES_MASK;
284 
285  if(rx_fifo>0) {
286  insw(BASE + VX_W1_RX_PIO_RD_1, nic->packet+nic->packetlen, rx_fifo / 2);
287  if(rx_fifo & 1)
288  nic->packet[nic->packetlen+rx_fifo-1]=inb(BASE + VX_W1_RX_PIO_RD_1);
289  nic->packetlen+=rx_fifo;
290 #ifdef EDEBUG
291  printf("+%d",rx_fifo);
292 #endif
293  }
294  if(( status & RX_INCOMPLETE )==0) {
295 #ifdef EDEBUG
296  printf("=%d",nic->packetlen);
297 #endif
298  break;
299  }
300  udelay(1000);
301  }
302 
303  /* acknowledge reception of packet */
306 #ifdef EDEBUG
307 {
308  unsigned short type = 0; /* used by EDEBUG */
309  type = (nic->packet[12]<<8) | nic->packet[13];
310  if(nic->packet[0]+nic->packet[1]+nic->packet[2]+nic->packet[3]+nic->packet[4]+
311  nic->packet[5] == 0xFF*ETH_ALEN)
312  printf(",t=%hX,b]",type);
313  else
314  printf(",t=%hX]",type);
315 }
316 #endif
317  return 1;
318 }
#define VX_STATUS
Definition: 3c595.h:121
#define VX_W1_RX_PIO_RD_1
Definition: 3c595.h:151
#define RX_DISCARD_TOP_PACK
Definition: 3c509.h:225
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
#define RX_BYTES_MASK
Definition: 3c509.h:381
#define S_COMMAND_IN_PROGRESS
Definition: 3c509.h:285
#define ERR_RX
Definition: 3c509.h:305
#define S_RX_COMPLETE
Definition: 3c509.h:279
uint8_t status
Status.
Definition: ena.h:16
#define ACK_INTR
Definition: 3c509.h:247
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition: timer.c:60
unsigned int packetlen
Definition: nic.h:54
#define C_INTR_LATCH
Definition: 3c509.h:248
void insw(volatile uint16_t *io_addr, uint16_t *data, unsigned int count)
Read 16-bit words from I/O-mapped device.
#define VX_COMMAND
Definition: 3c595.h:119
uint8_t inb(volatile uint8_t *io_addr)
Read byte from I/O-mapped device.
#define ETH_ALEN
Definition: if_ether.h:8
Definition: nic.h:49
unsigned char * packet
Definition: nic.h:53
uint32_t type
Operating system type.
Definition: ena.h:12
#define BASE
Definition: 3c595.h:69
#define VX_W1_RX_STATUS
Definition: 3c595.h:149
#define RX_INCOMPLETE
Definition: 3c509.h:369

References ACK_INTR, BASE, C_INTR_LATCH, ERR_RX, ETH_ALEN, inb(), insw(), inw(), outw, nic::packet, nic::packetlen, printf(), RX_BYTES_MASK, RX_DISCARD_TOP_PACK, RX_INCOMPLETE, S_COMMAND_IN_PROGRESS, S_RX_COMPLETE, status, type, udelay(), VX_COMMAND, VX_STATUS, VX_W1_RX_PIO_RD_1, and VX_W1_RX_STATUS.

◆ eeprom_rdy()

static int eeprom_rdy ( )
static

Definition at line 326 of file 3c595.c.

327 {
328  int i;
329 
330  for (i = 0; is_eeprom_busy(BASE) && i < MAX_EEPROMBUSY; i++)
331  udelay(1000);
332  if (i >= MAX_EEPROMBUSY) {
333  /* printf("3c595: eeprom failed to come ready.\n"); */
334  printf("3c595: eeprom is busy.\n"); /* memory in EPROM is tight */
335  return (0);
336  }
337  return (1);
338 }
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
#define is_eeprom_busy(b)
Definition: 3c509.h:74
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition: timer.c:60
int i
Definition: 3c515.c:164
#define MAX_EEPROMBUSY
Definition: 3c509.h:53
#define BASE
Definition: 3c595.h:69

References BASE, is_eeprom_busy, MAX_EEPROMBUSY, printf(), and udelay().

Referenced by get_e().

◆ get_e()

static int get_e ( int  offset)
static

Definition at line 345 of file 3c595.c.

347 {
348  if (!eeprom_rdy())
349  return (0xffff);
351  if (!eeprom_rdy())
352  return (0xffff);
353  return (inw(BASE + VX_W0_EEPROM_DATA));
354 }
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
#define VX_W0_EEPROM_COMMAND
Definition: 3c595.h:130
static userptr_t size_t offset
Offset of the first segment within the content.
Definition: deflate.h:259
#define VX_W0_EEPROM_DATA
Definition: 3c595.h:129
#define EEPROM_CMD_RD
Definition: 3c509.h:63
#define BASE
Definition: 3c595.h:69
static int eeprom_rdy()
Definition: 3c595.c:326

References BASE, EEPROM_CMD_RD, eeprom_rdy(), inw(), offset, outw, VX_W0_EEPROM_COMMAND, and VX_W0_EEPROM_DATA.

Referenced by t595_probe().

◆ t595_disable()

static void t595_disable ( struct nic nic)
static

Definition at line 447 of file 3c595.c.

447  {
448 
449  t595_reset(nic);
450 
452  udelay(8000);
453  GO_WINDOW(4);
454  outw(0, BASE + VX_W4_MEDIA_TYPE);
455  GO_WINDOW(1);
456 }
#define outw(data, io_addr)
Definition: io.h:319
#define VX_W4_MEDIA_TYPE
Definition: 3c595.h:177
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition: timer.c:60
static void t595_reset(struct nic *nic)
Definition: 3c595.c:68
#define VX_COMMAND
Definition: 3c595.h:119
Definition: nic.h:49
#define GO_WINDOW(b, x)
Definition: 3c509.h:75
#define BASE
Definition: 3c595.h:69
#define STOP_TRANSCEIVER
Definition: 3c509.h:242

References BASE, GO_WINDOW, outw, STOP_TRANSCEIVER, t595_reset(), udelay(), VX_COMMAND, and VX_W4_MEDIA_TYPE.

◆ t595_irq()

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

Definition at line 458 of file 3c595.c.

459 {
460  switch ( action ) {
461  case DISABLE :
462  break;
463  case ENABLE :
464  break;
465  case FORCE :
466  break;
467  }
468 }
Definition: nic.h:35
Definition: nic.h:37
Definition: nic.h:36

References DISABLE, ENABLE, and FORCE.

◆ t595_probe()

static int t595_probe ( struct nic nic,
struct pci_device pci 
)
static

Definition at line 473 of file 3c595.c.

473  {
474 
475  int i;
476  unsigned short *p;
477 
478  if (pci->ioaddr == 0)
479  return 0;
480  eth_nic_base = pci->ioaddr;
481 
482  nic->irqno = 0;
483  nic->ioaddr = pci->ioaddr;
484 
485  GO_WINDOW(0);
487  VX_BUSY_WAIT;
488 
489  vxgetlink();
490 
491 /*
492  printf("\nEEPROM:");
493  for (i = 0; i < (EEPROMSIZE/2); i++) {
494  printf("%hX:", get_e(i));
495  }
496  printf("\n");
497 */
498  /*
499  * Read the station address from the eeprom
500  */
501  p = (unsigned short *) nic->node_addr;
502  for (i = 0; i < 3; i++) {
503  GO_WINDOW(0);
504  p[i] = htons(get_e(EEPROM_OEM_ADDR_0 + i));
505  GO_WINDOW(2);
506  outw(ntohs(p[i]), BASE + VX_W2_ADDR_0 + (i * 2));
507  }
508 
509  DBG ( "Ethernet address: %s\n", eth_ntoa (nic->node_addr) );
510 
511  t595_reset(nic);
513  return 1;
514 
515 }
unsigned char irqno
Definition: nic.h:56
#define outw(data, io_addr)
Definition: io.h:319
unsigned long ioaddr
I/O address.
Definition: pci.h:221
#define ntohs(value)
Definition: byteswap.h:136
#define VX_W2_ADDR_0
Definition: 3c595.h:162
unsigned int ioaddr
Definition: nic.h:55
static unsigned short eth_nic_base
Definition: 3c595.c:38
#define VX_BUSY_WAIT
Definition: 3c595.h:298
static void t595_reset(struct nic *nic)
Definition: 3c595.c:68
static void vxgetlink(void)
Definition: 3c595.c:357
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
Definition: ethernet.c:175
int i
Definition: 3c515.c:164
#define VX_COMMAND
Definition: 3c595.h:119
Definition: nic.h:49
#define GLOBAL_RESET
Definition: 3c509.h:212
static struct nic_operations t595_operations
Definition: 3c595.c:36
unsigned char * node_addr
Definition: nic.h:52
#define GO_WINDOW(b, x)
Definition: 3c509.h:75
#define BASE
Definition: 3c595.h:69
#define EEPROM_OEM_ADDR_0
Definition: 3c595.h:103
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
struct nic_operations * nic_op
Definition: nic.h:50
static int get_e(int offset)
Definition: 3c595.c:345
#define htons(value)
Definition: byteswap.h:135

References BASE, DBG, EEPROM_OEM_ADDR_0, eth_nic_base, eth_ntoa(), get_e(), GLOBAL_RESET, GO_WINDOW, htons, nic::ioaddr, pci_device::ioaddr, nic::irqno, nic::nic_op, nic::node_addr, ntohs, outw, t595_operations, t595_reset(), VX_BUSY_WAIT, VX_COMMAND, VX_W2_ADDR_0, and vxgetlink().

◆ PCI_DRIVER()

PCI_DRIVER ( t595_driver  ,
t595_nics  ,
PCI_NO_CLASS   
)

◆ DRIVER()

DRIVER ( "3C595"  ,
nic_driver  ,
pci_driver  ,
t595_driver  ,
t595_probe  ,
t595_disable   
)

Variable Documentation

◆ t595_operations

static struct nic_operations t595_operations
static
Initial value:
= {
.connect = dummy_connect,
.poll = t595_poll,
.transmit = t595_transmit,
.irq = t595_irq,
}
int dummy_connect(struct nic *nic __unused)
Definition: legacy.c:151
static void t595_transmit(struct nic *nic, const char *d, unsigned int t, unsigned int s, const char *p)
Definition: 3c595.c:165
static void t595_irq(struct nic *nic __unused, irq_action_t action __unused)
Definition: 3c595.c:458
static int t595_poll(struct nic *nic, int retrieve)
Definition: 3c595.c:231

Definition at line 36 of file 3c595.c.

Referenced by t595_probe().

◆ eth_nic_base

unsigned short eth_nic_base
static

Definition at line 38 of file 3c595.c.

Referenced by t595_probe().

◆ vx_connector

unsigned short vx_connector
static

Definition at line 39 of file 3c595.c.

Referenced by vxgetlink(), and vxsetlink().

◆ vx_connectors

unsigned short vx_connectors
static

Definition at line 39 of file 3c595.c.

Referenced by vxgetlink(), and vxsetlink().

◆ conn_tab

struct connector_entry conn_tab[VX_CONNECTORS]
static
Initial value:
= {
#define CONNECTOR_UTP
{ 0x08, "utp"},
#define CONNECTOR_AUI
{ 0x20, "aui"},
{ 0, "???"},
#define CONNECTOR_BNC
{ 0x10, "bnc"},
#define CONNECTOR_TX
{ 0x02, "tx"},
#define CONNECTOR_FX
{ 0x04, "fx"},
#define CONNECTOR_MII
{ 0x40, "mii"},
{ 0, "???"}
}

Referenced by vxgetlink(), and vxsetlink().

◆ padmap

char padmap[]
static
Initial value:
= {
0, 3, 2, 1}

Definition at line 162 of file 3c595.c.

Referenced by t595_transmit().

◆ t595_nics

struct pci_device_id t595_nics[]
static
Initial value:
= {
PCI_ROM(0x10b7, 0x4500, "3c450-1", "3Com450 HomePNA Tornado", 0),
PCI_ROM(0x10b7, 0x5900, "3c590", "3Com590", 0),
PCI_ROM(0x10b7, 0x5950, "3c595", "3Com595", 0),
PCI_ROM(0x10b7, 0x5951, "3c595-1", "3Com595", 0),
PCI_ROM(0x10b7, 0x5952, "3c595-2", "3Com595", 0),
PCI_ROM(0x10b7, 0x7646, "3csoho100-tx-1", "3CSOHO100-TX", 0),
PCI_ROM(0x10b7, 0x9000, "3c900-tpo", "3Com900-TPO", 0),
PCI_ROM(0x10b7, 0x9001, "3c900-t4", "3Com900-Combo", 0),
PCI_ROM(0x10b7, 0x9004, "3c900b-tpo", "3Com900B-TPO", 0),
PCI_ROM(0x10b7, 0x9005, "3c900b-combo", "3Com900B-Combo", 0),
PCI_ROM(0x10b7, 0x9006, "3c900b-tpb2", "3Com900B-2/T", 0),
PCI_ROM(0x10b7, 0x900a, "3c900b-fl", "3Com900B-FL", 0),
PCI_ROM(0x10b7, 0x9800, "3c980-cyclone-1", "3Com980-Cyclone", 0),
PCI_ROM(0x10b7, 0x9805, "3c9805-1", "3Com9805", 0),
}
#define PCI_ROM(_vendor, _device, _name, _description, _data)
Definition: pci.h:303

Definition at line 525 of file 3c595.c.