|
@@ -44,33 +44,27 @@
|
44
|
44
|
* *********************************************************/
|
45
|
45
|
|
46
|
46
|
|
47
|
|
-#define ISA_PNP
|
48
|
|
-/*#define EDEBUG1*/
|
49
|
|
-
|
50
|
47
|
/* to get some global routines like printf */
|
51
|
48
|
#include "etherboot.h"
|
52
|
49
|
/* to get the interface to the body of the program */
|
53
|
50
|
#include "nic.h"
|
54
|
|
-#include "isa.h"
|
|
51
|
+#include "isapnp.h"
|
|
52
|
+#include "isa.h" /* for ISA_ROM */
|
55
|
53
|
#include "timer.h"
|
56
|
54
|
|
57
|
|
-#ifdef ISA_PNP
|
58
|
|
-
|
59
|
55
|
static void t3c515_wait(unsigned int nticks)
|
60
|
56
|
{
|
61
|
57
|
unsigned int to = currticks() + nticks;
|
62
|
58
|
while (currticks() < to)
|
63
|
59
|
/* wait */ ;
|
64
|
60
|
}
|
65
|
|
-#endif
|
|
61
|
+
|
66
|
62
|
/* TJL definations */
|
67
|
63
|
#define HZ 100
|
68
|
64
|
#define u16 unsigned short
|
69
|
65
|
#define u32 unsigned long
|
70
|
66
|
#define s16 signed short
|
71
|
67
|
#define s32 signed long
|
72
|
|
-static unsigned short eth_nic_base;
|
73
|
|
-#define BASE (eth_nic_base)
|
74
|
68
|
static int if_port;
|
75
|
69
|
struct corkscrew_private *vp;
|
76
|
70
|
/* Brought directly from 3c515.c by Becker */
|
|
@@ -103,15 +97,10 @@ static int max_interrupt_work = 20;
|
103
|
97
|
static int rx_nocopy, rx_copy, queued_packet;
|
104
|
98
|
*/
|
105
|
99
|
|
106
|
|
-#ifdef DRIVER_DEBUG
|
107
|
|
-static int corkscrew_debug = DRIVER_DEBUG;
|
108
|
|
-#else
|
109
|
|
-static int corkscrew_debug = 1;
|
110
|
|
-#endif
|
111
|
|
-
|
112
|
100
|
#define CORKSCREW_ID 10
|
113
|
101
|
|
114
|
|
-#define EL3WINDOW(win_num) outw(SelectWindow + (win_num), ioaddr + EL3_CMD)
|
|
102
|
+#define EL3WINDOW(win_num) \
|
|
103
|
+ outw(SelectWindow + (win_num), nic->ioaddr + EL3_CMD)
|
115
|
104
|
#define EL3_CMD 0x0e
|
116
|
105
|
#define EL3_STATUS 0x0e
|
117
|
106
|
#define RX_BYTES_MASK (unsigned short) (0x07ff)
|
|
@@ -296,7 +285,7 @@ static int corkscrew_probe1(int ioaddr, int irq, int product_index,
|
296
|
285
|
|
297
|
286
|
/* This driver uses 'options' to pass the media type, full-duplex flag, etc. */
|
298
|
287
|
/* Note: this is the only limit on the number of cards supported!! */
|
299
|
|
-static int options[8] = { -1, -1, -1, -1, -1, -1, -1, -1, };
|
|
288
|
+static int options = -1;
|
300
|
289
|
|
301
|
290
|
/* End Brought directly from 3c515.c by Becker */
|
302
|
291
|
|
|
@@ -305,21 +294,19 @@ RESET - Reset adapter
|
305
|
294
|
***************************************************************************/
|
306
|
295
|
static void t515_reset(struct nic *nic)
|
307
|
296
|
{
|
308
|
|
- int ioaddr = BASE;
|
309
|
297
|
union wn3_config config;
|
310
|
298
|
int i;
|
311
|
299
|
|
312
|
300
|
/* Before initializing select the active media port. */
|
313
|
301
|
EL3WINDOW(3);
|
314
|
302
|
if (vp->full_duplex)
|
315
|
|
- outb(0x20, ioaddr + Wn3_MAC_Ctrl); /* Set the full-duplex bit. */
|
316
|
|
- config.i = inl(ioaddr + Wn3_Config);
|
|
303
|
+ outb(0x20, nic->ioaddr + Wn3_MAC_Ctrl); /* Set the full-duplex bit. */
|
|
304
|
+ config.i = inl(nic->ioaddr + Wn3_Config);
|
317
|
305
|
|
318
|
306
|
if (vp->media_override != 7) {
|
319
|
|
- if (corkscrew_debug > 1)
|
320
|
|
- printf("Media override to transceiver %d (%s).\n",
|
321
|
|
- vp->media_override,
|
322
|
|
- media_tbl[vp->media_override].name);
|
|
307
|
+ DBG ( "Media override to transceiver %d (%s).\n",
|
|
308
|
+ vp->media_override,
|
|
309
|
+ media_tbl[vp->media_override].name);
|
323
|
310
|
if_port = vp->media_override;
|
324
|
311
|
} else if (vp->autoselect) {
|
325
|
312
|
/* Find first available media type, starting with 100baseTx. */
|
|
@@ -327,66 +314,63 @@ static void t515_reset(struct nic *nic)
|
327
|
314
|
while (!(vp->available_media & media_tbl[if_port].mask))
|
328
|
315
|
if_port = media_tbl[if_port].next;
|
329
|
316
|
|
330
|
|
- if (corkscrew_debug > 1)
|
331
|
|
- printf("Initial media type %s.\n",
|
332
|
|
- media_tbl[if_port].name);
|
|
317
|
+ DBG ( "Initial media type %s.\n",
|
|
318
|
+ media_tbl[if_port].name);
|
333
|
319
|
} else
|
334
|
320
|
if_port = vp->default_media;
|
335
|
321
|
|
336
|
322
|
config.u.xcvr = if_port;
|
337
|
|
- outl(config.i, ioaddr + Wn3_Config);
|
|
323
|
+ outl(config.i, nic->ioaddr + Wn3_Config);
|
338
|
324
|
|
339
|
|
- if (corkscrew_debug > 1) {
|
340
|
|
- printf("corkscrew_open() InternalConfig 0x%hX.\n",
|
341
|
|
- config.i);
|
342
|
|
- }
|
|
325
|
+ DBG ( "corkscrew_open() InternalConfig 0x%hX.\n",
|
|
326
|
+ config.i);
|
343
|
327
|
|
344
|
|
- outw(TxReset, ioaddr + EL3_CMD);
|
|
328
|
+ outw(TxReset, nic->ioaddr + EL3_CMD);
|
345
|
329
|
for (i = 20; i >= 0; i--)
|
346
|
|
- if (!(inw(ioaddr + EL3_STATUS) & CmdInProgress))
|
|
330
|
+ if (!(inw(nic->ioaddr + EL3_STATUS) & CmdInProgress))
|
347
|
331
|
break;
|
348
|
332
|
|
349
|
|
- outw(RxReset, ioaddr + EL3_CMD);
|
|
333
|
+ outw(RxReset, nic->ioaddr + EL3_CMD);
|
350
|
334
|
/* Wait a few ticks for the RxReset command to complete. */
|
351
|
335
|
for (i = 20; i >= 0; i--)
|
352
|
|
- if (!(inw(ioaddr + EL3_STATUS) & CmdInProgress))
|
|
336
|
+ if (!(inw(nic->ioaddr + EL3_STATUS) & CmdInProgress))
|
353
|
337
|
break;
|
354
|
338
|
|
355
|
|
- outw(SetStatusEnb | 0x00, ioaddr + EL3_CMD);
|
|
339
|
+ outw(SetStatusEnb | 0x00, nic->ioaddr + EL3_CMD);
|
356
|
340
|
|
357
|
|
- if (corkscrew_debug > 1) {
|
|
341
|
+#ifdef debug_3c515
|
358
|
342
|
EL3WINDOW(4);
|
359
|
|
- printf("FIXME: fix print for irq, not 9");
|
360
|
|
- printf("corkscrew_open() irq %d media status 0x%hX.\n",
|
361
|
|
- 9, inw(ioaddr + Wn4_Media));
|
362
|
|
- }
|
|
343
|
+ DBG ( "FIXME: fix print for irq, not 9" );
|
|
344
|
+ DBG ( "corkscrew_open() irq %d media status 0x%hX.\n",
|
|
345
|
+ 9, inw(nic->ioaddr + Wn4_Media) );
|
|
346
|
+#endif
|
363
|
347
|
|
364
|
348
|
/* Set the station address and mask in window 2 each time opened. */
|
365
|
349
|
EL3WINDOW(2);
|
366
|
350
|
for (i = 0; i < 6; i++)
|
367
|
|
- outb(nic->node_addr[i], ioaddr + i);
|
|
351
|
+ outb(nic->node_addr[i], nic->ioaddr + i);
|
368
|
352
|
for (; i < 12; i += 2)
|
369
|
|
- outw(0, ioaddr + i);
|
|
353
|
+ outw(0, nic->ioaddr + i);
|
370
|
354
|
|
371
|
355
|
if (if_port == 3)
|
372
|
356
|
/* Start the thinnet transceiver. We should really wait 50ms... */
|
373
|
|
- outw(StartCoax, ioaddr + EL3_CMD);
|
|
357
|
+ outw(StartCoax, nic->ioaddr + EL3_CMD);
|
374
|
358
|
EL3WINDOW(4);
|
375
|
|
- outw((inw(ioaddr + Wn4_Media) & ~(Media_10TP | Media_SQE)) |
|
376
|
|
- media_tbl[if_port].media_bits, ioaddr + Wn4_Media);
|
|
359
|
+ outw((inw(nic->ioaddr + Wn4_Media) & ~(Media_10TP | Media_SQE)) |
|
|
360
|
+ media_tbl[if_port].media_bits, nic->ioaddr + Wn4_Media);
|
377
|
361
|
|
378
|
362
|
/* Switch to the stats window, and clear all stats by reading. */
|
379
|
|
-/* outw(StatsDisable, ioaddr + EL3_CMD);*/
|
|
363
|
+/* outw(StatsDisable, nic->ioaddr + EL3_CMD);*/
|
380
|
364
|
EL3WINDOW(6);
|
381
|
365
|
for (i = 0; i < 10; i++)
|
382
|
|
- inb(ioaddr + i);
|
383
|
|
- inw(ioaddr + 10);
|
384
|
|
- inw(ioaddr + 12);
|
|
366
|
+ inb(nic->ioaddr + i);
|
|
367
|
+ inw(nic->ioaddr + 10);
|
|
368
|
+ inw(nic->ioaddr + 12);
|
385
|
369
|
/* New: On the Vortex we must also clear the BadSSD counter. */
|
386
|
370
|
EL3WINDOW(4);
|
387
|
|
- inb(ioaddr + 12);
|
|
371
|
+ inb(nic->ioaddr + 12);
|
388
|
372
|
/* ..and on the Boomerang we enable the extra statistics bits. */
|
389
|
|
- outw(0x0040, ioaddr + Wn4_NetDiag);
|
|
373
|
+ outw(0x0040, nic->ioaddr + Wn4_NetDiag);
|
390
|
374
|
|
391
|
375
|
/* Switch to register set 7 for normal use. */
|
392
|
376
|
EL3WINDOW(7);
|
|
@@ -397,37 +381,36 @@ static void t515_reset(struct nic *nic)
|
397
|
381
|
if (vp->full_bus_master_rx) { /* Boomerang bus master. */
|
398
|
382
|
printf("FIXME: Is this if necessary");
|
399
|
383
|
vp->cur_rx = vp->dirty_rx = 0;
|
400
|
|
- if (corkscrew_debug > 2)
|
401
|
|
- printf(" Filling in the Rx ring.\n");
|
|
384
|
+ DBG ( " Filling in the Rx ring.\n" );
|
402
|
385
|
for (i = 0; i < RX_RING_SIZE; i++) {
|
403
|
386
|
printf("FIXME: Is this if necessary");
|
404
|
387
|
}
|
405
|
388
|
}
|
406
|
389
|
if (vp->full_bus_master_tx) { /* Boomerang bus master Tx. */
|
407
|
390
|
vp->cur_tx = vp->dirty_tx = 0;
|
408
|
|
- outb(PKT_BUF_SZ >> 8, ioaddr + TxFreeThreshold); /* Room for a packet. */
|
|
391
|
+ outb(PKT_BUF_SZ >> 8, nic->ioaddr + TxFreeThreshold); /* Room for a packet. */
|
409
|
392
|
/* Clear the Tx ring. */
|
410
|
393
|
for (i = 0; i < TX_RING_SIZE; i++)
|
411
|
394
|
vp->tx_skbuff[i] = 0;
|
412
|
|
- outl(0, ioaddr + DownListPtr);
|
|
395
|
+ outl(0, nic->ioaddr + DownListPtr);
|
413
|
396
|
}
|
414
|
397
|
/* Set receiver mode: presumably accept b-case and phys addr only. */
|
415
|
398
|
outw(SetRxFilter | RxStation | RxMulticast | RxBroadcast | RxProm,
|
416
|
|
- ioaddr + EL3_CMD);
|
|
399
|
+ nic->ioaddr + EL3_CMD);
|
417
|
400
|
|
418
|
|
- outw(RxEnable, ioaddr + EL3_CMD); /* Enable the receiver. */
|
419
|
|
- outw(TxEnable, ioaddr + EL3_CMD); /* Enable transmitter. */
|
|
401
|
+ outw(RxEnable, nic->ioaddr + EL3_CMD); /* Enable the receiver. */
|
|
402
|
+ outw(TxEnable, nic->ioaddr + EL3_CMD); /* Enable transmitter. */
|
420
|
403
|
/* Allow status bits to be seen. */
|
421
|
404
|
outw(SetStatusEnb | AdapterFailure | IntReq | StatsFull |
|
422
|
405
|
(vp->full_bus_master_tx ? DownComplete : TxAvailable) |
|
423
|
406
|
(vp->full_bus_master_rx ? UpComplete : RxComplete) |
|
424
|
|
- (vp->bus_master ? DMADone : 0), ioaddr + EL3_CMD);
|
|
407
|
+ (vp->bus_master ? DMADone : 0), nic->ioaddr + EL3_CMD);
|
425
|
408
|
/* Ack all pending events, and set active indicator mask. */
|
426
|
409
|
outw(AckIntr | IntLatch | TxAvailable | RxEarly | IntReq,
|
427
|
|
- ioaddr + EL3_CMD);
|
|
410
|
+ nic->ioaddr + EL3_CMD);
|
428
|
411
|
outw(SetIntrEnb | IntLatch | TxAvailable | RxComplete | StatsFull
|
429
|
412
|
| (vp->bus_master ? DMADone : 0) | UpComplete | DownComplete,
|
430
|
|
- ioaddr + EL3_CMD);
|
|
413
|
+ nic->ioaddr + EL3_CMD);
|
431
|
414
|
|
432
|
415
|
}
|
433
|
416
|
|
|
@@ -439,23 +422,23 @@ static int t515_poll(struct nic *nic, int retrieve)
|
439
|
422
|
short status, cst;
|
440
|
423
|
register short rx_fifo;
|
441
|
424
|
|
442
|
|
- cst = inw(BASE + EL3_STATUS);
|
|
425
|
+ cst = inw(nic->ioaddr + EL3_STATUS);
|
443
|
426
|
|
444
|
427
|
if ((cst & RxComplete) == 0) {
|
445
|
428
|
/* Ack all pending events, and set active indicator mask. */
|
446
|
429
|
outw(AckIntr | IntLatch | TxAvailable | RxEarly | IntReq,
|
447
|
|
- BASE + EL3_CMD);
|
|
430
|
+ nic->ioaddr + EL3_CMD);
|
448
|
431
|
outw(SetIntrEnb | IntLatch | TxAvailable | RxComplete |
|
449
|
432
|
StatsFull | (vp->
|
450
|
433
|
bus_master ? DMADone : 0) | UpComplete |
|
451
|
|
- DownComplete, BASE + EL3_CMD);
|
|
434
|
+ DownComplete, nic->ioaddr + EL3_CMD);
|
452
|
435
|
return 0;
|
453
|
436
|
}
|
454
|
|
- status = inw(BASE + RxStatus);
|
|
437
|
+ status = inw(nic->ioaddr + RxStatus);
|
455
|
438
|
|
456
|
439
|
if (status & RxDError) {
|
457
|
440
|
printf("RxDError\n");
|
458
|
|
- outw(RxDiscard, BASE + EL3_CMD);
|
|
441
|
+ outw(RxDiscard, nic->ioaddr + EL3_CMD);
|
459
|
442
|
return 0;
|
460
|
443
|
}
|
461
|
444
|
|
|
@@ -465,54 +448,46 @@ static int t515_poll(struct nic *nic, int retrieve)
|
465
|
448
|
|
466
|
449
|
if ( ! retrieve ) return 1;
|
467
|
450
|
|
468
|
|
-#ifdef EDEBUG
|
469
|
|
- printf("[l=%d", rx_fifo);
|
470
|
|
-#endif
|
471
|
|
- insw(BASE + RX_FIFO, nic->packet, rx_fifo / 2);
|
|
451
|
+ DBG ( "[l=%d", rx_fifo );
|
|
452
|
+ insw(nic->ioaddr + RX_FIFO, nic->packet, rx_fifo / 2);
|
472
|
453
|
if (rx_fifo & 1)
|
473
|
|
- nic->packet[rx_fifo - 1] = inb(BASE + RX_FIFO);
|
|
454
|
+ nic->packet[rx_fifo - 1] = inb(nic->ioaddr + RX_FIFO);
|
474
|
455
|
nic->packetlen = rx_fifo;
|
475
|
456
|
|
476
|
457
|
while (1) {
|
477
|
|
- status = inw(BASE + RxStatus);
|
478
|
|
-#ifdef EDEBUG
|
479
|
|
- printf("0x%hX*", status);
|
480
|
|
-#endif
|
|
458
|
+ status = inw(nic->ioaddr + RxStatus);
|
|
459
|
+ DBG ( "0x%hX*", status );
|
481
|
460
|
rx_fifo = status & RX_BYTES_MASK;
|
482
|
461
|
|
483
|
462
|
if (rx_fifo > 0) {
|
484
|
|
- insw(BASE + RX_FIFO, nic->packet + nic->packetlen,
|
|
463
|
+ insw(nic->ioaddr + RX_FIFO, nic->packet + nic->packetlen,
|
485
|
464
|
rx_fifo / 2);
|
486
|
465
|
if (rx_fifo & 1)
|
487
|
466
|
nic->packet[nic->packetlen + rx_fifo - 1] =
|
488
|
|
- inb(BASE + RX_FIFO);
|
|
467
|
+ inb(nic->ioaddr + RX_FIFO);
|
489
|
468
|
nic->packetlen += rx_fifo;
|
490
|
|
-#ifdef EDEBUG
|
491
|
|
- printf("+%d", rx_fifo);
|
492
|
|
-#endif
|
|
469
|
+ DBG ( "+%d", rx_fifo );
|
493
|
470
|
}
|
494
|
471
|
if ((status & RxComplete) == 0) {
|
495
|
|
-#ifdef EDEBUG
|
496
|
|
- printf("=%d", nic->packetlen);
|
497
|
|
-#endif
|
|
472
|
+ DBG ( "=%d", nic->packetlen );
|
498
|
473
|
break;
|
499
|
474
|
}
|
500
|
475
|
udelay(1000);
|
501
|
476
|
}
|
502
|
477
|
|
503
|
478
|
/* acknowledge reception of packet */
|
504
|
|
- outw(RxDiscard, BASE + EL3_CMD);
|
505
|
|
- while (inw(BASE + EL3_STATUS) & CmdInProgress);
|
506
|
|
-#ifdef EDEBUG
|
|
479
|
+ outw(RxDiscard, nic->ioaddr + EL3_CMD);
|
|
480
|
+ while (inw(nic->ioaddr + EL3_STATUS) & CmdInProgress);
|
|
481
|
+#ifdef debug_3c515
|
507
|
482
|
{
|
508
|
483
|
unsigned short type = 0;
|
509
|
484
|
type = (nic->packet[12] << 8) | nic->packet[13];
|
510
|
485
|
if (nic->packet[0] + nic->packet[1] + nic->packet[2] +
|
511
|
486
|
nic->packet[3] + nic->packet[4] + nic->packet[5] ==
|
512
|
487
|
0xFF * ETH_ALEN)
|
513
|
|
- printf(",t=0x%hX,b]", type);
|
|
488
|
+ DBG ( ",t=0x%hX,b]", type );
|
514
|
489
|
else
|
515
|
|
- printf(",t=0x%hX]", type);
|
|
490
|
+ DBG ( ",t=0x%hX]", type );
|
516
|
491
|
}
|
517
|
492
|
#endif
|
518
|
493
|
|
|
@@ -537,9 +512,7 @@ static void t515_transmit(struct nic *nic, const char *d, /* Destination */
|
537
|
512
|
int pad;
|
538
|
513
|
int status;
|
539
|
514
|
|
540
|
|
-#ifdef EDEBUG
|
541
|
|
- printf("{l=%d,t=0x%hX}", s + ETH_HLEN, t);
|
542
|
|
-#endif
|
|
515
|
+ DBG ( "{l=%d,t=0x%hX}", s + ETH_HLEN, t );
|
543
|
516
|
|
544
|
517
|
/* swap bytes of type */
|
545
|
518
|
t = htons(t);
|
|
@@ -557,36 +530,36 @@ static void t515_transmit(struct nic *nic, const char *d, /* Destination */
|
557
|
530
|
return;
|
558
|
531
|
}
|
559
|
532
|
/* drop acknowledgements */
|
560
|
|
- while ((status = inb(BASE + TxStatus)) & TxComplete) {
|
|
533
|
+ while ((status = inb(nic->ioaddr + TxStatus)) & TxComplete) {
|
561
|
534
|
/*if(status & (TXS_UNDERRUN|0x88|TXS_STATUS_OVERFLOW)) { */
|
562
|
|
- outw(TxReset, BASE + EL3_CMD);
|
563
|
|
- outw(TxEnable, BASE + EL3_CMD);
|
|
535
|
+ outw(TxReset, nic->ioaddr + EL3_CMD);
|
|
536
|
+ outw(TxEnable, nic->ioaddr + EL3_CMD);
|
564
|
537
|
/* } */
|
565
|
538
|
|
566
|
|
- outb(0x0, BASE + TxStatus);
|
|
539
|
+ outb(0x0, nic->ioaddr + TxStatus);
|
567
|
540
|
}
|
568
|
541
|
|
569
|
|
- while (inw(BASE + TxFree) < len + pad + 4) {
|
|
542
|
+ while (inw(nic->ioaddr + TxFree) < len + pad + 4) {
|
570
|
543
|
/* no room in FIFO */
|
571
|
544
|
}
|
572
|
545
|
|
573
|
|
- outw(len, BASE + TX_FIFO);
|
574
|
|
- outw(0x0, BASE + TX_FIFO); /* Second dword meaningless */
|
|
546
|
+ outw(len, nic->ioaddr + TX_FIFO);
|
|
547
|
+ outw(0x0, nic->ioaddr + TX_FIFO); /* Second dword meaningless */
|
575
|
548
|
|
576
|
549
|
/* write packet */
|
577
|
|
- outsw(BASE + TX_FIFO, d, ETH_ALEN / 2);
|
578
|
|
- outsw(BASE + TX_FIFO, nic->node_addr, ETH_ALEN / 2);
|
579
|
|
- outw(t, BASE + TX_FIFO);
|
580
|
|
- outsw(BASE + TX_FIFO, p, s / 2);
|
|
550
|
+ outsw(nic->ioaddr + TX_FIFO, d, ETH_ALEN / 2);
|
|
551
|
+ outsw(nic->ioaddr + TX_FIFO, nic->node_addr, ETH_ALEN / 2);
|
|
552
|
+ outw(t, nic->ioaddr + TX_FIFO);
|
|
553
|
+ outsw(nic->ioaddr + TX_FIFO, p, s / 2);
|
581
|
554
|
|
582
|
555
|
if (s & 1)
|
583
|
|
- outb(*(p + s - 1), BASE + TX_FIFO);
|
|
556
|
+ outb(*(p + s - 1), nic->ioaddr + TX_FIFO);
|
584
|
557
|
|
585
|
558
|
while (pad--)
|
586
|
|
- outb(0, BASE + TX_FIFO); /* Padding */
|
|
559
|
+ outb(0, nic->ioaddr + TX_FIFO); /* Padding */
|
587
|
560
|
|
588
|
561
|
/* wait for Tx complete */
|
589
|
|
- while ((inw(BASE + EL3_STATUS) & CmdInProgress) != 0);
|
|
562
|
+ while ((inw(nic->ioaddr + EL3_STATUS) & CmdInProgress) != 0);
|
590
|
563
|
}
|
591
|
564
|
|
592
|
565
|
/**************************************************************************
|
|
@@ -602,15 +575,15 @@ static void t515_disable ( struct nic *nic ) {
|
602
|
575
|
have no way to determine if this works */
|
603
|
576
|
|
604
|
577
|
/* Disable the receiver and transmitter. */
|
605
|
|
- outw(RxDisable, BASE + EL3_CMD);
|
606
|
|
- outw(TxDisable, BASE + EL3_CMD);
|
|
578
|
+ outw(RxDisable, nic->ioaddr + EL3_CMD);
|
|
579
|
+ outw(TxDisable, nic->ioaddr + EL3_CMD);
|
607
|
580
|
|
608
|
581
|
if (if_port == XCVR_10base2)
|
609
|
582
|
/* Turn off thinnet power. Green! */
|
610
|
|
- outw(StopCoax, BASE + EL3_CMD);
|
|
583
|
+ outw(StopCoax, nic->ioaddr + EL3_CMD);
|
611
|
584
|
|
612
|
585
|
|
613
|
|
- outw(SetIntrEnb | 0x0000, BASE + EL3_CMD);
|
|
586
|
+ outw(SetIntrEnb | 0x0000, nic->ioaddr + EL3_CMD);
|
614
|
587
|
#ifdef ISA_PNP
|
615
|
588
|
/*Deactivate */
|
616
|
589
|
/* ACTIVATE;
|
|
@@ -632,61 +605,6 @@ static void t515_irq(struct nic *nic __unused, irq_action_t action __unused)
|
632
|
605
|
}
|
633
|
606
|
}
|
634
|
607
|
|
635
|
|
-/**************************************************************************
|
636
|
|
-PROBE - Look for an adapter, this routine's visible to the outside
|
637
|
|
-You should omit the last argument struct pci_device * for a non-PCI NIC
|
638
|
|
-***************************************************************************/
|
639
|
|
-void config_pnp_device(void);
|
640
|
|
-
|
641
|
|
-static int t515_probe(struct dev *dev,
|
642
|
|
- unsigned short *probe_addrs __unused)
|
643
|
|
-{
|
644
|
|
- struct nic *nic = (struct nic *) dev;
|
645
|
|
- /* Direct copy from Beckers 3c515.c removing any ISAPNP sections */
|
646
|
|
- int cards_found = 0;
|
647
|
|
- static int ioaddr;
|
648
|
|
-#ifdef ISA_PNP
|
649
|
|
- config_pnp_device();
|
650
|
|
-#endif
|
651
|
|
- /* Check all locations on the ISA bus -- evil! */
|
652
|
|
- for (ioaddr = 0x100; ioaddr < 0x400; ioaddr += 0x20) {
|
653
|
|
- int irq;
|
654
|
|
-
|
655
|
|
- /* Check the resource configuration for a matching ioaddr. */
|
656
|
|
- if ((inw(ioaddr + 0x2002) & 0x1f0) != (ioaddr & 0x1f0))
|
657
|
|
- continue;
|
658
|
|
- /* Verify by reading the device ID from the EEPROM. */
|
659
|
|
- {
|
660
|
|
- int timer;
|
661
|
|
- outw(EEPROM_Read + 7, ioaddr + Wn0EepromCmd);
|
662
|
|
- /* Pause for at least 162 us. for the read to take place. */
|
663
|
|
- for (timer = 4; timer >= 0; timer--) {
|
664
|
|
- t3c515_wait(1);
|
665
|
|
- if ((inw(ioaddr + Wn0EepromCmd) & 0x0200)
|
666
|
|
- == 0)
|
667
|
|
- break;
|
668
|
|
- }
|
669
|
|
- if (inw(ioaddr + Wn0EepromData) != 0x6d50)
|
670
|
|
- continue;
|
671
|
|
- }
|
672
|
|
- printf
|
673
|
|
- ("3c515 Resource configuration register 0x%hX, DCR 0x%hX.\n",
|
674
|
|
- inl(ioaddr + 0x2002), inw(ioaddr + 0x2000));
|
675
|
|
- irq = inw(ioaddr + 0x2002) & 15;
|
676
|
|
- BASE = ioaddr;
|
677
|
|
- corkscrew_found_device(BASE, irq, CORKSCREW_ID,
|
678
|
|
- options[cards_found], nic);
|
679
|
|
- cards_found++;
|
680
|
|
- }
|
681
|
|
- if (corkscrew_debug)
|
682
|
|
- printf("%d 3c515 cards found.\n", cards_found);
|
683
|
|
-
|
684
|
|
- if (cards_found > 0) {
|
685
|
|
- t515_reset(nic);
|
686
|
|
-
|
687
|
|
- nic->irqno = 0;
|
688
|
|
- nic->ioaddr = BASE;
|
689
|
|
-static struct nic_operations t515_operations;
|
690
|
608
|
static struct nic_operations t515_operations = {
|
691
|
609
|
.connect = dummy_connect,
|
692
|
610
|
.poll = t515_poll,
|
|
@@ -694,15 +612,50 @@ static struct nic_operations t515_operations = {
|
694
|
612
|
.irq = t515_irq,
|
695
|
613
|
.disable = t515_disable,
|
696
|
614
|
};
|
697
|
|
- nic->nic_op = &t515_operations;
|
698
|
615
|
|
699
|
|
- /* Based on PnP ISA map */
|
700
|
|
- dev->devid.vendor_id = htons(ISAPNP_VENDOR('T', 'C', 'M'));
|
701
|
|
- dev->devid.device_id = htons(0x5051);
|
702
|
|
- return 1;
|
703
|
|
- } else
|
|
616
|
+/**************************************************************************
|
|
617
|
+PROBE - Look for an adapter, this routine's visible to the outside
|
|
618
|
+You should omit the last argument struct pci_device * for a non-PCI NIC
|
|
619
|
+***************************************************************************/
|
|
620
|
+static int t515_probe ( struct dev *dev, struct isapnp_device *isapnp ) {
|
|
621
|
+ struct nic *nic = nic_device ( dev );
|
|
622
|
+ /* Direct copy from Beckers 3c515.c removing any ISAPNP sections */
|
|
623
|
+
|
|
624
|
+ nic->ioaddr = isapnp->ioaddr;
|
|
625
|
+ nic->irqno = isapnp->irqno;
|
|
626
|
+ activate_isapnp_device ( isapnp, 1 );
|
|
627
|
+
|
|
628
|
+ /* Check the resource configuration for a matching ioaddr. */
|
|
629
|
+ if ((unsigned)(inw(nic->ioaddr + 0x2002) & 0x1f0)
|
|
630
|
+ != (nic->ioaddr & 0x1f0)) {
|
|
631
|
+ DBG ( "3c515 ioaddr mismatch\n" );
|
704
|
632
|
return 0;
|
|
633
|
+ }
|
|
634
|
+
|
|
635
|
+ /* Verify by reading the device ID from the EEPROM. */
|
|
636
|
+ {
|
|
637
|
+ int timer;
|
|
638
|
+ outw(EEPROM_Read + 7, nic->ioaddr + Wn0EepromCmd);
|
|
639
|
+ /* Pause for at least 162 us. for the read to take place. */
|
|
640
|
+ for (timer = 4; timer >= 0; timer--) {
|
|
641
|
+ t3c515_wait(1);
|
|
642
|
+ if ((inw(nic->ioaddr + Wn0EepromCmd) & 0x0200) == 0)
|
|
643
|
+ break;
|
|
644
|
+ }
|
|
645
|
+ if (inw(nic->ioaddr + Wn0EepromData) != 0x6d50) {
|
|
646
|
+ DBG ( "3c515 read incorrect vendor ID from EEPROM" );
|
|
647
|
+ return 0;
|
|
648
|
+ }
|
705
|
649
|
|
|
650
|
+ }
|
|
651
|
+ DBG ( "3c515 Resource configuration register 0x%hX, DCR 0x%hX.\n",
|
|
652
|
+ inl(nic->ioaddr + 0x2002), inw(nic->ioaddr + 0x2000) );
|
|
653
|
+ corkscrew_found_device(nic->ioaddr, nic->irqno, CORKSCREW_ID,
|
|
654
|
+ options, nic);
|
|
655
|
+
|
|
656
|
+ t515_reset(nic);
|
|
657
|
+ nic->nic_op = &t515_operations;
|
|
658
|
+ return 1;
|
706
|
659
|
}
|
707
|
660
|
|
708
|
661
|
static int
|
|
@@ -733,7 +686,6 @@ corkscrew_probe1(int ioaddr, int irq, int product_index __unused,
|
733
|
686
|
{
|
734
|
687
|
unsigned int eeprom[0x40], checksum = 0; /* EEPROM contents */
|
735
|
688
|
int i;
|
736
|
|
- ioaddr = BASE;
|
737
|
689
|
|
738
|
690
|
printf("3Com %s at 0x%hX, ", vp->product_name, ioaddr);
|
739
|
691
|
|
|
@@ -750,9 +702,7 @@ corkscrew_probe1(int ioaddr, int irq, int product_index __unused,
|
750
|
702
|
break;
|
751
|
703
|
}
|
752
|
704
|
eeprom[i] = inw(ioaddr + Wn0EepromData);
|
753
|
|
-#ifdef EDEBUG1
|
754
|
|
- printf("Value %d: %hX ", i, eeprom[i]);
|
755
|
|
-#endif
|
|
705
|
+ DBG ( "Value %d: %hX ", i, eeprom[i] );
|
756
|
706
|
checksum ^= eeprom[i];
|
757
|
707
|
if (i < 3)
|
758
|
708
|
phys_addr[i] = htons(eeprom[i]);
|
|
@@ -767,9 +717,9 @@ corkscrew_probe1(int ioaddr, int irq, int product_index __unused,
|
767
|
717
|
}
|
768
|
718
|
printf(", IRQ %d\n", irq);
|
769
|
719
|
/* Tell them about an invalid IRQ. */
|
770
|
|
- if (corkscrew_debug && (irq <= 0 || irq > 15))
|
771
|
|
- printf
|
772
|
|
- (" *** Warning: this IRQ is unlikely to work! ***\n");
|
|
720
|
+ if ( (irq <= 0 || irq > 15) ) {
|
|
721
|
+ DBG (" *** Warning: this IRQ is unlikely to work! ***\n" );
|
|
722
|
+ }
|
773
|
723
|
|
774
|
724
|
{
|
775
|
725
|
char *ram_split[] = { "5:3", "3:1", "1:1", "3:5" };
|
|
@@ -777,10 +727,9 @@ corkscrew_probe1(int ioaddr, int irq, int product_index __unused,
|
777
|
727
|
EL3WINDOW(3);
|
778
|
728
|
vp->available_media = inw(ioaddr + Wn3_Options);
|
779
|
729
|
config.i = inl(ioaddr + Wn3_Config);
|
780
|
|
- if (corkscrew_debug > 1)
|
781
|
|
- printf
|
782
|
|
- (" Internal config register is %4.4x, transceivers 0x%hX.\n",
|
783
|
|
- config.i, inw(ioaddr + Wn3_Options));
|
|
730
|
+ DBG ( " Internal config register is %4.4x, "
|
|
731
|
+ "transceivers 0x%hX.\n",
|
|
732
|
+ config.i, inw(ioaddr + Wn3_Options) );
|
784
|
733
|
printf
|
785
|
734
|
(" %dK %s-wide RAM %s Rx:Tx split, %s%s interface.\n",
|
786
|
735
|
8 << config.u.ram_size,
|
|
@@ -808,10 +757,14 @@ corkscrew_probe1(int ioaddr, int irq, int product_index __unused,
|
808
|
757
|
return 0;
|
809
|
758
|
}
|
810
|
759
|
|
811
|
|
-static struct isa_driver t515_driver __isa_driver = {
|
812
|
|
- .type = NIC_DRIVER,
|
813
|
|
- .name = "3C515",
|
814
|
|
- .probe = t515_probe,
|
815
|
|
- .ioaddrs = 0,
|
|
760
|
+static struct isapnp_id t515_adapters[] = {
|
|
761
|
+ { "3c515 (ISAPnP)", ISAPNP_VENDOR('T','C','M'), 0x5051 },
|
816
|
762
|
};
|
817
|
|
-ISA_ROM("3c515","3c515, Fast EtherLink ISA");
|
|
763
|
+
|
|
764
|
+static struct isapnp_driver t515_driver =
|
|
765
|
+ ISAPNP_DRIVER ( "3c515", t515_adapters );
|
|
766
|
+
|
|
767
|
+BOOT_DRIVER ( "3c515", find_isapnp_boot_device, t515_driver,
|
|
768
|
+ t515_probe );
|
|
769
|
+
|
|
770
|
+ISA_ROM ( "3c515", "3c515 Fast EtherLink ISAPnP" );
|