/[grub]/grub/netboot/3c509.c
ViewVC logotype

Diff of /grub/netboot/3c509.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by okuji, Sat Jul 29 19:22:54 2000 UTC revision 1.4 by okuji, Wed Jan 2 21:56:40 2002 UTC
# Line 27  $Id$ Line 27  $Id$
27  #include "etherboot.h"  #include "etherboot.h"
28  #include "nic.h"  #include "nic.h"
29  #include "cards.h"  #include "cards.h"
30    #include "timer.h"
31  #include "3c509.h"  #include "3c509.h"
32    
33  static unsigned char    eth_vendor, eth_flags, eth_laar;  #define udelay(n)       waiton_timer2(((n)*TICKS_PER_MS)/1000)
34  static unsigned short   eth_nic_base, eth_asic_base;  
35  static char             bnc=0, utp=0; /* for 3C509 */  static unsigned short   eth_nic_base;
36    static enum { none, bnc, utp } connector = none;        /* for 3C509 */
37    
38  #ifdef  INCLUDE_3C529  #ifdef  INCLUDE_3C529
39  /*  /*
# Line 55  static struct el3_mca_adapters_struct el Line 57  static struct el3_mca_adapters_struct el
57  };  };
58  #endif  #endif
59    
 /* a surrogate */  
   
 static void DELAY(int val)  
 {  
         int c;  
   
         for(c=0; c<val; c+=20) {  
                 twiddle();  
         }  
 }  
   
60  /**************************************************************************  /**************************************************************************
61  ETH_RESET - Reset adapter  ETH_RESET - Reset adapter
62  ***************************************************************************/  ***************************************************************************/
# Line 77  static void t509_reset(struct nic *nic) Line 68  static void t509_reset(struct nic *nic)
68                          Reset 3Com 509 card                          Reset 3Com 509 card
69          *************************************************************/          *************************************************************/
70    
         if (eth_vendor != VENDOR_3C509)  
                 return;  
   
71          /* stop card */          /* stop card */
72          outw(RX_DISABLE, BASE + EP_COMMAND);          outw(RX_DISABLE, BASE + EP_COMMAND);
73          outw(RX_DISCARD_TOP_PACK, BASE + EP_COMMAND);          outw(RX_DISCARD_TOP_PACK, BASE + EP_COMMAND);
74          while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS);          while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS)
75                    ;
76          outw(TX_DISABLE, BASE + EP_COMMAND);          outw(TX_DISABLE, BASE + EP_COMMAND);
77          outw(STOP_TRANSCEIVER, BASE + EP_COMMAND);          outw(STOP_TRANSCEIVER, BASE + EP_COMMAND);
78            udelay(1000);
79          outw(RX_RESET, BASE + EP_COMMAND);          outw(RX_RESET, BASE + EP_COMMAND);
80          outw(TX_RESET, BASE + EP_COMMAND);          outw(TX_RESET, BASE + EP_COMMAND);
81          outw(C_INTR_LATCH, BASE + EP_COMMAND);          outw(C_INTR_LATCH, BASE + EP_COMMAND);
# Line 96  static void t509_reset(struct nic *nic) Line 86  static void t509_reset(struct nic *nic)
86          /*          /*
87          * initialize card          * initialize card
88          */          */
89          while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS);          while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS)
90                    ;
91    
92          GO_WINDOW(0);          GO_WINDOW(0);
93    
# Line 112  static void t509_reset(struct nic *nic) Line 103  static void t509_reset(struct nic *nic)
103          GO_WINDOW(2);          GO_WINDOW(2);
104    
105          /* Reload the ether_addr. */          /* Reload the ether_addr. */
106          for (i = 0; i < ETHER_ADDR_SIZE; i++)          for (i = 0; i < ETH_ALEN; i++)
107                  outb(nic->node_addr[i], BASE + EP_W2_ADDR_0 + i);                  outb(nic->node_addr[i], BASE + EP_W2_ADDR_0 + i);
108    
109          outw(RX_RESET, BASE + EP_COMMAND);          outw(RX_RESET, BASE + EP_COMMAND);
# Line 133  static void t509_reset(struct nic *nic) Line 124  static void t509_reset(struct nic *nic)
124          outw(SET_RX_FILTER | FIL_INDIVIDUAL | FIL_BRDCST, BASE + EP_COMMAND);          outw(SET_RX_FILTER | FIL_INDIVIDUAL | FIL_BRDCST, BASE + EP_COMMAND);
125    
126          /* configure BNC */          /* configure BNC */
127          if (bnc) {          if (connector == bnc) {
128                  outw(START_TRANSCEIVER, BASE + EP_COMMAND);                  outw(START_TRANSCEIVER, BASE + EP_COMMAND);
129                  DELAY(10000);                  udelay(1000);
130                  }          }
131          /* configure UTP */          /* configure UTP */
132          if (utp) {          else if (connector == utp) {
133                  GO_WINDOW(4);                  GO_WINDOW(4);
134                  outw(ENABLE_UTP, BASE + EP_W4_MEDIA_TYPE);                  outw(ENABLE_UTP, BASE + EP_W4_MEDIA_TYPE);
135                    sleep(2);       /* Give time for media to negotiate */
136                  GO_WINDOW(1);                  GO_WINDOW(1);
137                  }          }
138    
139          /* start tranciever and receiver */          /* start transceiver and receiver */
140          outw(RX_ENABLE, BASE + EP_COMMAND);          outw(RX_ENABLE, BASE + EP_COMMAND);
141          outw(TX_ENABLE, BASE + EP_COMMAND);          outw(TX_ENABLE, BASE + EP_COMMAND);
142    
143          /* set early threshold for minimal packet length */          /* set early threshold for minimal packet length */
144          outw(SET_RX_EARLY_THRESH | ETH_MIN_PACKET, BASE + EP_COMMAND);          outw(SET_RX_EARLY_THRESH | ETH_ZLEN, BASE + EP_COMMAND);
   
145          outw(SET_TX_START_THRESH | 16, BASE + EP_COMMAND);          outw(SET_TX_START_THRESH | 16, BASE + EP_COMMAND);
146  }  }
147    
# Line 171  const char *p)                 /* Packet */ Line 162  const char *p)                 /* Packet */
162          int pad;          int pad;
163          int status;          int status;
164    
         if(eth_vendor != VENDOR_3C509)  
                 return;  
   
165  #ifdef  EDEBUG  #ifdef  EDEBUG
166          printf("{l=%d,t=%x}",s+ETHER_HDR_SIZE,t);          printf("{l=%d,t=%hX}",s+ETH_HLEN,t);
167  #endif  #endif
168    
169          /* swap bytes of type */          /* swap bytes of type */
170          t= htons(t);          t= htons(t);
171    
172          len=s+ETHER_HDR_SIZE; /* actual length of packet */          len=s+ETH_HLEN; /* actual length of packet */
173          pad = padmap[len & 3];          pad = padmap[len & 3];
174    
175          /*          /*
# Line 189  const char *p)                 /* Packet */ Line 177  const char *p)                 /* Packet */
177          * but we drop packets that are too large. Perhaps we should truncate          * but we drop packets that are too large. Perhaps we should truncate
178          * them instead?          * them instead?
179          */          */
180          if (len + pad > ETH_MAX_PACKET) {          if (len + pad > ETH_FRAME_LEN) {
181                  return;                  return;
182          }          }
183    
184          /* drop acknowledgements */          /* drop acknowledgements */
185          while(( status=inb(BASE + EP_W1_TX_STATUS) )& TXS_COMPLETE ) {          while ((status=inb(BASE + EP_W1_TX_STATUS)) & TXS_COMPLETE ) {
186                  if(status & (TXS_UNDERRUN|TXS_MAX_COLLISION|TXS_STATUS_OVERFLOW)) {                  if (status & (TXS_UNDERRUN|TXS_MAX_COLLISION|TXS_STATUS_OVERFLOW)) {
187                          outw(TX_RESET, BASE + EP_COMMAND);                          outw(TX_RESET, BASE + EP_COMMAND);
188                          outw(TX_ENABLE, BASE + EP_COMMAND);                          outw(TX_ENABLE, BASE + EP_COMMAND);
189                  }                  }
   
190                  outb(0x0, BASE + EP_W1_TX_STATUS);                  outb(0x0, BASE + EP_W1_TX_STATUS);
191          }          }
192    
193          while (inw(BASE + EP_W1_FREE_TX) < (unsigned short)len + pad + 4) {          while (inw(BASE + EP_W1_FREE_TX) < (unsigned short)len + pad + 4)
194                  /* no room in FIFO */                  ; /* no room in FIFO */
         }  
195    
196          outw(len, BASE + EP_W1_TX_PIO_WR_1);          outw(len, BASE + EP_W1_TX_PIO_WR_1);
197          outw(0x0, BASE + EP_W1_TX_PIO_WR_1);    /* Second dword meaningless */          outw(0x0, BASE + EP_W1_TX_PIO_WR_1);    /* Second dword meaningless */
198    
199          /* write packet */          /* write packet */
200          outsw(BASE + EP_W1_TX_PIO_WR_1, d, ETHER_ADDR_SIZE/2);          outsw(BASE + EP_W1_TX_PIO_WR_1, d, ETH_ALEN/2);
201          outsw(BASE + EP_W1_TX_PIO_WR_1, nic->node_addr, ETHER_ADDR_SIZE/2);          outsw(BASE + EP_W1_TX_PIO_WR_1, nic->node_addr, ETH_ALEN/2);
202          outw(t, BASE + EP_W1_TX_PIO_WR_1);          outw(t, BASE + EP_W1_TX_PIO_WR_1);
203          outsw(BASE + EP_W1_TX_PIO_WR_1, p, s / 2);          outsw(BASE + EP_W1_TX_PIO_WR_1, p, s / 2);
204          if (s & 1)          if (s & 1)
# Line 221  const char *p)                 /* Packet */ Line 207  const char *p)                 /* Packet */
207          while (pad--)          while (pad--)
208                  outb(0, BASE + EP_W1_TX_PIO_WR_1);      /* Padding */                  outb(0, BASE + EP_W1_TX_PIO_WR_1);      /* Padding */
209    
210          /* timeout after sending */          /* wait for Tx complete */
211          DELAY(1000);          while((inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS) != 0)
212                    ;
213  }  }
214    
215  /**************************************************************************  /**************************************************************************
# Line 236  static int t509_poll(struct nic *nic) Line 223  static int t509_poll(struct nic *nic)
223          short status, cst;          short status, cst;
224          register short rx_fifo;          register short rx_fifo;
225    
         if(eth_vendor!=VENDOR_3C509)  
                 return 0;  
   
226          cst=inw(BASE + EP_STATUS);          cst=inw(BASE + EP_STATUS);
227    
228  #ifdef  EDEBUG  #ifdef  EDEBUG
229          if(cst & 0x1FFF)          if(cst & 0x1FFF)
230                  printf("-%x-",cst);                  printf("-%hX-",cst);
231  #endif  #endif
232    
233          if( (cst & S_RX_COMPLETE)==0 ) {          if( (cst & S_RX_COMPLETE)==0 ) {
# Line 256  static int t509_poll(struct nic *nic) Line 240  static int t509_poll(struct nic *nic)
240    
241          status = inw(BASE + EP_W1_RX_STATUS);          status = inw(BASE + EP_W1_RX_STATUS);
242  #ifdef  EDEBUG  #ifdef  EDEBUG
243          printf("*%x*",status);          printf("*%hX*",status);
244  #endif  #endif
245    
246          if (status & ERR_RX) {          if (status & ERR_RX) {
# Line 280  static int t509_poll(struct nic *nic) Line 264  static int t509_poll(struct nic *nic)
264          while(1) {          while(1) {
265                  status = inw(BASE + EP_W1_RX_STATUS);                  status = inw(BASE + EP_W1_RX_STATUS);
266  #ifdef  EDEBUG  #ifdef  EDEBUG
267                  printf("*%x*",status);                  printf("*%hX*",status);
268  #endif  #endif
269                  rx_fifo = status & RX_BYTES_MASK;                  rx_fifo = status & RX_BYTES_MASK;
   
270                  if(rx_fifo>0) {                  if(rx_fifo>0) {
271                          insw(BASE + EP_W1_RX_PIO_RD_1, nic->packet+nic->packetlen, rx_fifo / 2);                          insw(BASE + EP_W1_RX_PIO_RD_1, nic->packet+nic->packetlen, rx_fifo / 2);
272                          if(rx_fifo & 1)                          if(rx_fifo & 1)
# Line 293  static int t509_poll(struct nic *nic) Line 276  static int t509_poll(struct nic *nic)
276                          printf("+%d",rx_fifo);                          printf("+%d",rx_fifo);
277  #endif  #endif
278                  }                  }
   
279                  if(( status & RX_INCOMPLETE )==0) {                  if(( status & RX_INCOMPLETE )==0) {
280  #ifdef  EDEBUG  #ifdef  EDEBUG
281                          printf("=%d",nic->packetlen);                          printf("=%d",nic->packetlen);
282  #endif  #endif
283                          break;                          break;
284                  }                  }
285                    udelay(1000);   /* if incomplete wait 1 ms */
                 DELAY(1000);  
286          }          }
   
287          /* acknowledge reception of packet */          /* acknowledge reception of packet */
288          outw(RX_DISCARD_TOP_PACK, BASE + EP_COMMAND);          outw(RX_DISCARD_TOP_PACK, BASE + EP_COMMAND);
289          while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS);          while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS)
290                    ;
291  #ifdef  EDEBUG  #ifdef  EDEBUG
292          type = (nic->packet[12]<<8) | nic->packet[13];          type = (nic->packet[12]<<8) | nic->packet[13];
293          if(nic->packet[0]+nic->packet[1]+nic->packet[2]+nic->packet[3]+nic->packet[4]+          if(nic->packet[0]+nic->packet[1]+nic->packet[2]+nic->packet[3]+nic->packet[4]+
294              nic->packet[5] == 0xFF*ETHER_ADDR_SIZE)              nic->packet[5] == 0xFF*ETH_ALEN)
295                  printf(",t=0x%x,b]",type);                  printf(",t=%hX,b]",type);
296          else          else
297                  printf(",t=0x%x]",type);                  printf(",t=%hX]",type);
298  #endif  #endif
299          return 1;          return (1);
300  }  }
301    
   
302  /*************************************************************************  /*************************************************************************
303          3Com 509 - specific routines          3Com 509 - specific routines
304  **************************************************************************/  **************************************************************************/
# Line 384  get_eeprom_data(int id_port, int offset) Line 364  get_eeprom_data(int id_port, int offset)
364  {  {
365          int i, data = 0;          int i, data = 0;
366          outb(0x80 + offset, id_port);          outb(0x80 + offset, id_port);
367          DELAY(10000);          /* Do we really need this wait? Won't be noticeable anyway */
368            udelay(10000);
369          for (i = 0; i < 16; i++)          for (i = 0; i < 16; i++)
370                  data = (data << 1) | (inw(id_port) & 1);                  data = (data << 1) | (inw(id_port) & 1);
371          return (data);          return (data);
# Line 415  struct nic *t509_probe(struct nic *nic, Line 396  struct nic *t509_probe(struct nic *nic,
396    
397          t509_disable(nic);              /* in case board was active */          t509_disable(nic);              /* in case board was active */
398                                          /* note that nic is not used */                                          /* note that nic is not used */
399            for (failcount = 0; failcount < 4000; failcount++) {
400          for (failcount=0; failcount<4000; failcount++) {                  int data, j, io_base, id_port;
                 int data, j, io_base, id_port = EP_ID_PORT;  
401                  unsigned short k;                  unsigned short k;
402                  int ep_current_tag = EP_LAST_TAG + 1;                  int ep_current_tag;
403                  short *p;                  short *p;
404  #ifdef  INCLUDE_3C529  #ifdef  INCLUDE_3C529
405                  int curboard;                  int curboard;
# Line 427  struct nic *t509_probe(struct nic *nic, Line 407  struct nic *t509_probe(struct nic *nic,
407    
408                  id_port = EP_ID_PORT;                  id_port = EP_ID_PORT;
409                  ep_current_tag = EP_LAST_TAG + 1;                  ep_current_tag = EP_LAST_TAG + 1;
                 eth_vendor = VENDOR_NONE;  
410    
411          /*********************************************************          /*********************************************************
412                          Search for 3Com 509 card                          Search for 3Com 509 card
# Line 476  struct nic *t509_probe(struct nic *nic, Line 455  struct nic *t509_probe(struct nic *nic,
455                  outb_p(0, MCA_ADAPTER_SETUP_REG);                  outb_p(0, MCA_ADAPTER_SETUP_REG);
456    
457                  if (mcafound) {                  if (mcafound) {
                         eth_vendor = VENDOR_3C509;  
   
458                          eth_nic_base = ((short)((mca_pos4&0xfc)|0x02)) << 8;                          eth_nic_base = ((short)((mca_pos4&0xfc)|0x02)) << 8;
459                          mca_irq = mca_pos5 & 0x0f;                          mca_irq = mca_pos5 & 0x0f;
460                          ep_current_tag--;                          ep_current_tag--;
# Line 487  struct nic *t509_probe(struct nic *nic, Line 464  struct nic *t509_probe(struct nic *nic,
464  #endif  #endif
465          /* Look for the EISA boards, leave them activated */          /* Look for the EISA boards, leave them activated */
466          /* search for the first card, ignore all others */          /* search for the first card, ignore all others */
467          for(j = 1; j < 16 && eth_vendor==VENDOR_NONE ; j++) {          for(j = 1; j < 16; j++) {
468                  io_base = (j * EP_EISA_START) | EP_EISA_W0;                  io_base = (j * EP_EISA_START) | EP_EISA_W0;
469                  if (inw(io_base + EP_W0_MFG_ID) != MFG_ID)                  if (inw(io_base + EP_W0_MFG_ID) != MFG_ID)
470                          continue;                          continue;
471    
472                  /* we must found 0x1f if the board is EISA configurated */                  /* we must have found 0x1f if the board is EISA configurated */
473                  if ((inw(io_base + EP_W0_ADDRESS_CFG) & 0x1f) != 0x1f)                  if ((inw(io_base + EP_W0_ADDRESS_CFG) & 0x1f) != 0x1f)
474                          continue;                          continue;
475    
476                  /* Reset and Enable the card */                  /* Reset and Enable the card */
477                  outb(W0_P4_CMD_RESET_ADAPTER, io_base + EP_W0_CONFIG_CTRL);                  outb(W0_P4_CMD_RESET_ADAPTER, io_base + EP_W0_CONFIG_CTRL);
478                  DELAY(10000); /* we must wait at least 10 ms */                  udelay(1000); /* Must wait 800 µs, be conservative */
479                  outb(W0_P4_CMD_ENABLE_ADAPTER, io_base + EP_W0_CONFIG_CTRL);                  outb(W0_P4_CMD_ENABLE_ADAPTER, io_base + EP_W0_CONFIG_CTRL);
480    
481                  /*                  /*
# Line 506  struct nic *t509_probe(struct nic *nic, Line 483  struct nic *t509_probe(struct nic *nic,
483                   * x000 - x00F, where x is the slot number.                   * x000 - x00F, where x is the slot number.
484                   */                   */
485                  eth_nic_base = j * EP_EISA_START;                  eth_nic_base = j * EP_EISA_START;
486                  eth_vendor = VENDOR_3C509;                  break;
487          }          }
488          ep_current_tag--;          ep_current_tag--;
489    
490          /* Look for the ISA boards. Init and leave them actived */          /* Look for the ISA boards. Init and leave them actived */
491          /* search for the first card, ignore all others */          /* search for the first card, ignore all others */
492          outb(0xc0, id_port);    /* Global reset */          outb(0xc0, id_port);    /* Global reset */
493          DELAY(10000);          udelay(1000);           /* wait 1 ms */
494          for (i = 0; i < EP_MAX_BOARDS && eth_vendor==VENDOR_NONE; i++) {          for (i = 0; i < EP_MAX_BOARDS; i++) {
495                  outb(0, id_port);                  outb(0, id_port);
496                  outb(0, id_port);                  outb(0, id_port);
497                  send_ID_sequence(id_port);                  send_ID_sequence(id_port);
# Line 531  struct nic *t509_probe(struct nic *nic, Line 508  struct nic *t509_probe(struct nic *nic,
508                      (get_eeprom_data(id_port, EEPROM_ADDR_CFG) & 0x1f) * 0x10 + 0x200;                      (get_eeprom_data(id_port, EEPROM_ADDR_CFG) & 0x1f) * 0x10 + 0x200;
509                  outb(ep_current_tag, id_port);  /* tags board */                  outb(ep_current_tag, id_port);  /* tags board */
510                  outb(ACTIVATE_ADAPTER_TO_CONFIG, id_port);                  outb(ACTIVATE_ADAPTER_TO_CONFIG, id_port);
                 eth_vendor = VENDOR_3C509;  
511                  ep_current_tag--;                  ep_current_tag--;
512                    break;
513          }          }
514    
515          if(eth_vendor != VENDOR_3C509)          if (i >= EP_MAX_BOARDS)
516                  goto no3c509;                  goto no3c509;
517    
518          /*          /*
# Line 550  struct nic *t509_probe(struct nic *nic, Line 527  struct nic *t509_probe(struct nic *nic,
527           */           */
528          if (mcafound) {          if (mcafound) {
529                  if (mcafound->id != k) {                  if (mcafound->id != k) {
530                          printf("MCA: PROD_ID in EEPROM does not match MCA card ID! (%x != %x)\n", k, mcafound->id);                          printf("MCA: PROD_ID in EEPROM does not match MCA card ID! (%hX != %hX)\n", k, mcafound->id);
531                          goto no3c509;                          goto no3c509;
532                  }                  }
533          } else { /* for ISA/EISA */          } else { /* for ISA/EISA */
# Line 564  struct nic *t509_probe(struct nic *nic, Line 541  struct nic *t509_probe(struct nic *nic,
541    
542  #ifdef  INCLUDE_3C529  #ifdef  INCLUDE_3C529
543          if (mcafound) {          if (mcafound) {
544                  printf("%s board found on MCA at 0x%x IRQ %d -",                  printf("%s board found on MCA at %#hx IRQ %d -",
545                         mcafound->name, eth_nic_base, mca_irq);                         mcafound->name, eth_nic_base, mca_irq);
546          } else {          } else {
547  #endif  #endif
548                  if(eth_nic_base >= EP_EISA_START) {                  if(eth_nic_base >= EP_EISA_START)
549                          printf("3C5x9 board on EISA at 0x%x - ",eth_nic_base);                          printf("3C5x9 board on EISA at %#hx - ",eth_nic_base);
550                  } else {                  else
551                          printf("3C5x9 board on ISA at 0x%x - ",eth_nic_base);                          printf("3C5x9 board on ISA at %#hx - ",eth_nic_base);
                 }  
552  #ifdef  INCLUDE_3C529  #ifdef  INCLUDE_3C529
553          }          }
554  #endif  #endif
# Line 583  struct nic *t509_probe(struct nic *nic, Line 559  struct nic *t509_probe(struct nic *nic,
559    
560          switch(j) {          switch(j) {
561                  case 0:                  case 0:
562                          if(i & IS_UTP) {                          if (i & IS_UTP) {
563                                  printf("10baseT\n");                                  printf("10baseT\n");
564                                  utp=1;                                  connector = utp;
565                                  }                                  }
566                          else {                          else {
567                                  printf("10baseT not present\n");                                  printf("10baseT not present\n");
                                 eth_vendor=VENDOR_NONE;  
568                                  goto no3c509;                                  goto no3c509;
569                                  }                                  }
   
570                          break;                          break;
571                  case 1:                  case 1:
572                          if(i & IS_AUI)                          if (i & IS_AUI)
573                                  printf("10base5\n");                                  printf("10base5\n");
574                          else {                          else {
575                                  printf("10base5 not present\n");                                  printf("10base5 not present\n");
                                 eth_vendor=VENDOR_NONE;  
576                                  goto no3c509;                                  goto no3c509;
577                                  }                                  }
   
578                          break;                          break;
579                  case 3:                  case 3:
580                          if(i & IS_BNC) {                          if (i & IS_BNC) {
581                                  printf("10base2\n");                                  printf("10base2\n");
582                                  bnc=1;                                  connector = bnc;
583                                  }                                  }
584                          else {                          else {
585                                  printf("10base2 not present\n");                                  printf("10base2 not present\n");
                                 eth_vendor=VENDOR_NONE;  
586                                  goto no3c509;                                  goto no3c509;
587                                  }                                  }
   
588                          break;                          break;
589                  default:                  default:
590                          printf("unknown connector\n");                          printf("unknown connector\n");
                         eth_vendor=VENDOR_NONE;  
591                          goto no3c509;                          goto no3c509;
592                  }                  }
593          /*          /*
594          * Read the station address from the eeprom          * Read the station address from the eeprom
595          */          */
596          p = (unsigned short *) nic->node_addr;          p = (unsigned short *) nic->node_addr;
597          for (i = 0; i < 3; i++) {          for (i = 0; i < ETH_ALEN / 2; i++) {
598                  GO_WINDOW(0);                  GO_WINDOW(0);
599                  p[i] = htons(get_e(i));                  p[i] = htons(get_e(i));
600                  GO_WINDOW(2);                  GO_WINDOW(2);
601                  outw(ntohs(p[i]), BASE + EP_W2_ADDR_0 + (i * 2));                  outw(ntohs(p[i]), BASE + EP_W2_ADDR_0 + (i * 2));
602          }          }
603            printf("Ethernet address: %!\n", nic->node_addr);
         printf("Ethernet address: ");  
         for(i=0; i<5; i++) {  
                 printf("%b:",nic->node_addr[i]);  
         }  
         printf("%b\n",nic->node_addr[i]);  
   
604          t509_reset(nic);          t509_reset(nic);
605          nic->reset = t509_reset;          nic->reset = t509_reset;
606          nic->poll = t509_poll;          nic->poll = t509_poll;
# Line 645  struct nic *t509_probe(struct nic *nic, Line 608  struct nic *t509_probe(struct nic *nic,
608          nic->disable = t509_disable;          nic->disable = t509_disable;
609          return nic;          return nic;
610  no3c509:  no3c509:
         eth_vendor = VENDOR_NONE;  
611          printf("(probe fail)");          printf("(probe fail)");
612          }          }
613          return 0;          return 0;
# Line 656  no3c509: Line 618  no3c509:
618   *  c-basic-offset: 8   *  c-basic-offset: 8
619   * End:   * End:
620   */   */
   

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26