|
@@ -27,7 +27,6 @@
|
27
|
27
|
*
|
28
|
28
|
*---------------------------------------------------------------------------*/
|
29
|
29
|
#define LINUX_OUT_MACROS 1
|
30
|
|
-#define SMC9000_VERBOSE 1
|
31
|
30
|
#define SMC9000_DEBUG 0
|
32
|
31
|
|
33
|
32
|
#include "etherboot.h"
|
|
@@ -39,7 +38,6 @@
|
39
|
38
|
# define _outw outw
|
40
|
39
|
|
41
|
40
|
static const char smc9000_version[] = "Version 0.99 98-09-30";
|
42
|
|
-static unsigned int smc9000_base=0;
|
43
|
41
|
static const char *interfaces[ 2 ] = { "TP", "AUI" };
|
44
|
42
|
static const char *chip_ids[ 15 ] = {
|
45
|
43
|
NULL, NULL, NULL,
|
|
@@ -97,11 +95,11 @@ static void smc_reset(int ioaddr)
|
97
|
95
|
|
98
|
96
|
|
99
|
97
|
/*----------------------------------------------------------------------
|
100
|
|
- * Function: smc_probe( int ioaddr )
|
|
98
|
+ * Function: smc9000_probe_addr( int ioaddr )
|
101
|
99
|
*
|
102
|
100
|
* Purpose:
|
103
|
101
|
* Tests to see if a given ioaddr points to an SMC9xxx chip.
|
104
|
|
- * Returns a 0 on success
|
|
102
|
+ * Returns a 1 on success
|
105
|
103
|
*
|
106
|
104
|
* Algorithm:
|
107
|
105
|
* (1) see if the high byte of BANK_SELECT is 0x33
|
|
@@ -110,7 +108,7 @@ static void smc_reset(int ioaddr)
|
110
|
108
|
*
|
111
|
109
|
* ---------------------------------------------------------------------
|
112
|
110
|
*/
|
113
|
|
-static int smc_probe( int ioaddr )
|
|
111
|
+static int smc9000_probe_addr( unsigned short ioaddr )
|
114
|
112
|
{
|
115
|
113
|
word bank;
|
116
|
114
|
word revision_register;
|
|
@@ -119,14 +117,14 @@ static int smc_probe( int ioaddr )
|
119
|
117
|
/* First, see if the high byte is 0x33 */
|
120
|
118
|
bank = inw(ioaddr + BANK_SELECT);
|
121
|
119
|
if ((bank & 0xFF00) != 0x3300) {
|
122
|
|
- return -1;
|
|
120
|
+ return 0;
|
123
|
121
|
}
|
124
|
122
|
/* The above MIGHT indicate a device, but I need to write to further
|
125
|
123
|
* test this. */
|
126
|
124
|
_outw(0x0, ioaddr + BANK_SELECT);
|
127
|
125
|
bank = inw(ioaddr + BANK_SELECT);
|
128
|
126
|
if ((bank & 0xFF00) != 0x3300) {
|
129
|
|
- return -1;
|
|
127
|
+ return 0;
|
130
|
128
|
}
|
131
|
129
|
|
132
|
130
|
/* well, we've already written once, so hopefully another time won't
|
|
@@ -136,14 +134,12 @@ static int smc_probe( int ioaddr )
|
136
|
134
|
base_address_register = inw(ioaddr + BASE);
|
137
|
135
|
|
138
|
136
|
if (ioaddr != (base_address_register >> 3 & 0x3E0)) {
|
139
|
|
-#ifdef SMC9000_VERBOSE
|
140
|
|
- printf("SMC9000: IOADDR %hX doesn't match configuration (%hX)."
|
141
|
|
- "Probably not a SMC chip\n",
|
142
|
|
- ioaddr, base_address_register >> 3 & 0x3E0);
|
143
|
|
-#endif
|
|
137
|
+ DBG("SMC9000: IOADDR %hX doesn't match configuration (%hX)."
|
|
138
|
+ "Probably not a SMC chip\n",
|
|
139
|
+ ioaddr, base_address_register >> 3 & 0x3E0);
|
144
|
140
|
/* well, the base address register didn't match. Must not have
|
145
|
141
|
* been a SMC chip after all. */
|
146
|
|
- return -1;
|
|
142
|
+ return 0;
|
147
|
143
|
}
|
148
|
144
|
|
149
|
145
|
|
|
@@ -154,17 +150,15 @@ static int smc_probe( int ioaddr )
|
154
|
150
|
revision_register = inw(ioaddr + REVISION);
|
155
|
151
|
if (!chip_ids[(revision_register >> 4) & 0xF]) {
|
156
|
152
|
/* I don't recognize this chip, so... */
|
157
|
|
-#ifdef SMC9000_VERBOSE
|
158
|
|
- printf("SMC9000: IO %hX: Unrecognized revision register:"
|
159
|
|
- " %hX, Contact author.\n", ioaddr, revision_register);
|
160
|
|
-#endif
|
161
|
|
- return -1;
|
|
153
|
+ DBG( "SMC9000: IO %hX: Unrecognized revision register:"
|
|
154
|
+ " %hX, Contact author.\n", ioaddr, revision_register );
|
|
155
|
+ return 0;
|
162
|
156
|
}
|
163
|
157
|
|
164
|
158
|
/* at this point I'll assume that the chip is an SMC9xxx.
|
165
|
159
|
* It might be prudent to check a listing of MAC addresses
|
166
|
160
|
* against the hardware address, or do some other tests. */
|
167
|
|
- return 0;
|
|
161
|
+ return 1;
|
168
|
162
|
}
|
169
|
163
|
|
170
|
164
|
|
|
@@ -192,25 +186,23 @@ static void smc9000_transmit(
|
192
|
186
|
numPages = length / 256;
|
193
|
187
|
|
194
|
188
|
if (numPages > 7 ) {
|
195
|
|
-#ifdef SMC9000_VERBOSE
|
196
|
|
- printf("SMC9000: Far too big packet error. \n");
|
197
|
|
-#endif
|
|
189
|
+ DBG("SMC9000: Far too big packet error. \n");
|
198
|
190
|
return;
|
199
|
191
|
}
|
200
|
192
|
|
201
|
193
|
/* dont try more than, say 30 times */
|
202
|
194
|
for (i=0;i<30;i++) {
|
203
|
195
|
/* now, try to allocate the memory */
|
204
|
|
- SMC_SELECT_BANK(smc9000_base, 2);
|
205
|
|
- _outw(MC_ALLOC | numPages, smc9000_base + MMU_CMD);
|
|
196
|
+ SMC_SELECT_BANK(nic->ioaddr, 2);
|
|
197
|
+ _outw(MC_ALLOC | numPages, nic->ioaddr + MMU_CMD);
|
206
|
198
|
|
207
|
199
|
status = 0;
|
208
|
200
|
/* wait for the memory allocation to finnish */
|
209
|
201
|
for (time_out = currticks() + 5*TICKS_PER_SEC; currticks() < time_out; ) {
|
210
|
|
- status = inb(smc9000_base + INTERRUPT);
|
|
202
|
+ status = inb(nic->ioaddr + INTERRUPT);
|
211
|
203
|
if ( status & IM_ALLOC_INT ) {
|
212
|
204
|
/* acknowledge the interrupt */
|
213
|
|
- _outb(IM_ALLOC_INT, smc9000_base + INTERRUPT);
|
|
205
|
+ _outb(IM_ALLOC_INT, nic->ioaddr + INTERRUPT);
|
214
|
206
|
break;
|
215
|
207
|
}
|
216
|
208
|
}
|
|
@@ -220,12 +212,12 @@ static void smc9000_transmit(
|
220
|
212
|
break;
|
221
|
213
|
} else {
|
222
|
214
|
printf("SMC9000: Memory allocation timed out, resetting MMU.\n");
|
223
|
|
- _outw(MC_RESET, smc9000_base + MMU_CMD);
|
|
215
|
+ _outw(MC_RESET, nic->ioaddr + MMU_CMD);
|
224
|
216
|
}
|
225
|
217
|
}
|
226
|
218
|
|
227
|
219
|
/* If I get here, I _know_ there is a packet slot waiting for me */
|
228
|
|
- packet_no = inb(smc9000_base + PNR_ARR + 1);
|
|
220
|
+ packet_no = inb(nic->ioaddr + PNR_ARR + 1);
|
229
|
221
|
if (packet_no & 0x80) {
|
230
|
222
|
/* or isn't there? BAD CHIP! */
|
231
|
223
|
printf("SMC9000: Memory allocation failed. \n");
|
|
@@ -233,10 +225,10 @@ static void smc9000_transmit(
|
233
|
225
|
}
|
234
|
226
|
|
235
|
227
|
/* we have a packet address, so tell the card to use it */
|
236
|
|
- _outb(packet_no, smc9000_base + PNR_ARR);
|
|
228
|
+ _outb(packet_no, nic->ioaddr + PNR_ARR);
|
237
|
229
|
|
238
|
230
|
/* point to the beginning of the packet */
|
239
|
|
- _outw(PTR_AUTOINC, smc9000_base + POINTER);
|
|
231
|
+ _outw(PTR_AUTOINC, nic->ioaddr + POINTER);
|
240
|
232
|
|
241
|
233
|
#if SMC9000_DEBUG > 2
|
242
|
234
|
printf("Trying to xmit packet of length %hX\n", length );
|
|
@@ -244,73 +236,71 @@ static void smc9000_transmit(
|
244
|
236
|
|
245
|
237
|
/* send the packet length ( +6 for status, length and ctl byte )
|
246
|
238
|
* and the status word ( set to zeros ) */
|
247
|
|
- _outw(0, smc9000_base + DATA_1 );
|
|
239
|
+ _outw(0, nic->ioaddr + DATA_1 );
|
248
|
240
|
|
249
|
241
|
/* send the packet length ( +6 for status words, length, and ctl) */
|
250
|
|
- _outb((length+6) & 0xFF, smc9000_base + DATA_1);
|
251
|
|
- _outb((length+6) >> 8 , smc9000_base + DATA_1);
|
|
242
|
+ _outb((length+6) & 0xFF, nic->ioaddr + DATA_1);
|
|
243
|
+ _outb((length+6) >> 8 , nic->ioaddr + DATA_1);
|
252
|
244
|
|
253
|
245
|
/* Write the contents of the packet */
|
254
|
246
|
|
255
|
247
|
/* The ethernet header first... */
|
256
|
|
- outsw(smc9000_base + DATA_1, d, ETH_ALEN >> 1);
|
257
|
|
- outsw(smc9000_base + DATA_1, nic->node_addr, ETH_ALEN >> 1);
|
258
|
|
- _outw(htons(t), smc9000_base + DATA_1);
|
|
248
|
+ outsw(nic->ioaddr + DATA_1, d, ETH_ALEN >> 1);
|
|
249
|
+ outsw(nic->ioaddr + DATA_1, nic->node_addr, ETH_ALEN >> 1);
|
|
250
|
+ _outw(htons(t), nic->ioaddr + DATA_1);
|
259
|
251
|
|
260
|
252
|
/* ... the data ... */
|
261
|
|
- outsw(smc9000_base + DATA_1 , p, s >> 1);
|
|
253
|
+ outsw(nic->ioaddr + DATA_1 , p, s >> 1);
|
262
|
254
|
|
263
|
255
|
/* ... and the last byte, if there is one. */
|
264
|
256
|
if ((s & 1) == 0) {
|
265
|
|
- _outw(0, smc9000_base + DATA_1);
|
|
257
|
+ _outw(0, nic->ioaddr + DATA_1);
|
266
|
258
|
} else {
|
267
|
|
- _outb(p[s-1], smc9000_base + DATA_1);
|
268
|
|
- _outb(0x20, smc9000_base + DATA_1);
|
|
259
|
+ _outb(p[s-1], nic->ioaddr + DATA_1);
|
|
260
|
+ _outb(0x20, nic->ioaddr + DATA_1);
|
269
|
261
|
}
|
270
|
262
|
|
271
|
263
|
/* and let the chipset deal with it */
|
272
|
|
- _outw(MC_ENQUEUE , smc9000_base + MMU_CMD);
|
|
264
|
+ _outw(MC_ENQUEUE , nic->ioaddr + MMU_CMD);
|
273
|
265
|
|
274
|
266
|
status = 0; time_out = currticks() + 5*TICKS_PER_SEC;
|
275
|
267
|
do {
|
276
|
|
- status = inb(smc9000_base + INTERRUPT);
|
|
268
|
+ status = inb(nic->ioaddr + INTERRUPT);
|
277
|
269
|
|
278
|
270
|
if ((status & IM_TX_INT ) != 0) {
|
279
|
271
|
word tx_status;
|
280
|
272
|
|
281
|
273
|
/* ack interrupt */
|
282
|
|
- _outb(IM_TX_INT, smc9000_base + INTERRUPT);
|
|
274
|
+ _outb(IM_TX_INT, nic->ioaddr + INTERRUPT);
|
283
|
275
|
|
284
|
|
- packet_no = inw(smc9000_base + FIFO_PORTS);
|
|
276
|
+ packet_no = inw(nic->ioaddr + FIFO_PORTS);
|
285
|
277
|
packet_no &= 0x7F;
|
286
|
278
|
|
287
|
279
|
/* select this as the packet to read from */
|
288
|
|
- _outb( packet_no, smc9000_base + PNR_ARR );
|
|
280
|
+ _outb( packet_no, nic->ioaddr + PNR_ARR );
|
289
|
281
|
|
290
|
282
|
/* read the first word from this packet */
|
291
|
|
- _outw( PTR_AUTOINC | PTR_READ, smc9000_base + POINTER );
|
|
283
|
+ _outw( PTR_AUTOINC | PTR_READ, nic->ioaddr + POINTER );
|
292
|
284
|
|
293
|
|
- tx_status = inw( smc9000_base + DATA_1 );
|
|
285
|
+ tx_status = inw( nic->ioaddr + DATA_1 );
|
294
|
286
|
|
295
|
287
|
if (0 == (tx_status & TS_SUCCESS)) {
|
296
|
|
-#ifdef SMC9000_VERBOSE
|
297
|
|
- printf("SMC9000: TX FAIL STATUS: %hX \n", tx_status);
|
298
|
|
-#endif
|
|
288
|
+ DBG("SMC9000: TX FAIL STATUS: %hX \n", tx_status);
|
299
|
289
|
/* re-enable transmit */
|
300
|
|
- SMC_SELECT_BANK(smc9000_base, 0);
|
301
|
|
- _outw(inw(smc9000_base + TCR ) | TCR_ENABLE, smc9000_base + TCR );
|
|
290
|
+ SMC_SELECT_BANK(nic->ioaddr, 0);
|
|
291
|
+ _outw(inw(nic->ioaddr + TCR ) | TCR_ENABLE, nic->ioaddr + TCR );
|
302
|
292
|
}
|
303
|
293
|
|
304
|
294
|
/* kill the packet */
|
305
|
|
- SMC_SELECT_BANK(smc9000_base, 2);
|
306
|
|
- _outw(MC_FREEPKT, smc9000_base + MMU_CMD);
|
|
295
|
+ SMC_SELECT_BANK(nic->ioaddr, 2);
|
|
296
|
+ _outw(MC_FREEPKT, nic->ioaddr + MMU_CMD);
|
307
|
297
|
|
308
|
298
|
return;
|
309
|
299
|
}
|
310
|
300
|
}while(currticks() < time_out);
|
311
|
301
|
|
312
|
|
- printf("SMC9000: Waring TX timed out, resetting board\n");
|
313
|
|
- smc_reset(smc9000_base);
|
|
302
|
+ printf("SMC9000: TX timed out, resetting board\n");
|
|
303
|
+ smc_reset(nic->ioaddr);
|
314
|
304
|
return;
|
315
|
305
|
}
|
316
|
306
|
|
|
@@ -319,22 +309,19 @@ static void smc9000_transmit(
|
319
|
309
|
***************************************************************************/
|
320
|
310
|
static int smc9000_poll(struct nic *nic, int retrieve)
|
321
|
311
|
{
|
322
|
|
- if(!smc9000_base)
|
323
|
|
- return 0;
|
324
|
|
-
|
325
|
|
- SMC_SELECT_BANK(smc9000_base, 2);
|
326
|
|
- if (inw(smc9000_base + FIFO_PORTS) & FP_RXEMPTY)
|
|
312
|
+ SMC_SELECT_BANK(nic->ioaddr, 2);
|
|
313
|
+ if (inw(nic->ioaddr + FIFO_PORTS) & FP_RXEMPTY)
|
327
|
314
|
return 0;
|
328
|
315
|
|
329
|
316
|
if ( ! retrieve ) return 1;
|
330
|
317
|
|
331
|
318
|
/* start reading from the start of the packet */
|
332
|
|
- _outw(PTR_READ | PTR_RCV | PTR_AUTOINC, smc9000_base + POINTER);
|
|
319
|
+ _outw(PTR_READ | PTR_RCV | PTR_AUTOINC, nic->ioaddr + POINTER);
|
333
|
320
|
|
334
|
321
|
/* First read the status and check that we're ok */
|
335
|
|
- if (!(inw(smc9000_base + DATA_1) & RS_ERRORS)) {
|
|
322
|
+ if (!(inw(nic->ioaddr + DATA_1) & RS_ERRORS)) {
|
336
|
323
|
/* Next: read the packet length and mask off the top bits */
|
337
|
|
- nic->packetlen = (inw(smc9000_base + DATA_1) & 0x07ff);
|
|
324
|
+ nic->packetlen = (inw(nic->ioaddr + DATA_1) & 0x07ff);
|
338
|
325
|
|
339
|
326
|
/* the packet length includes the 3 extra words */
|
340
|
327
|
nic->packetlen -= 6;
|
|
@@ -343,36 +330,33 @@ static int smc9000_poll(struct nic *nic, int retrieve)
|
343
|
330
|
(nic->packetlen >> 1), nic->packetlen & 1);
|
344
|
331
|
#endif
|
345
|
332
|
/* read the packet (and the last "extra" word) */
|
346
|
|
- insw(smc9000_base + DATA_1, nic->packet, (nic->packetlen+2) >> 1);
|
|
333
|
+ insw(nic->ioaddr + DATA_1, nic->packet, (nic->packetlen+2) >> 1);
|
347
|
334
|
/* is there an odd last byte ? */
|
348
|
335
|
if (nic->packet[nic->packetlen+1] & 0x20)
|
349
|
336
|
nic->packetlen++;
|
350
|
337
|
|
351
|
338
|
/* error or good, tell the card to get rid of this packet */
|
352
|
|
- _outw(MC_RELEASE, smc9000_base + MMU_CMD);
|
|
339
|
+ _outw(MC_RELEASE, nic->ioaddr + MMU_CMD);
|
353
|
340
|
return 1;
|
354
|
341
|
}
|
355
|
342
|
|
356
|
343
|
printf("SMC9000: RX error\n");
|
357
|
344
|
/* error or good, tell the card to get rid of this packet */
|
358
|
|
- _outw(MC_RELEASE, smc9000_base + MMU_CMD);
|
|
345
|
+ _outw(MC_RELEASE, nic->ioaddr + MMU_CMD);
|
359
|
346
|
return 0;
|
360
|
347
|
}
|
361
|
348
|
|
362
|
|
-static void smc9000_disable ( struct nic *nic __unused ) {
|
363
|
|
- if(!smc9000_base)
|
364
|
|
- return;
|
365
|
|
-
|
366
|
|
- smc_reset(smc9000_base);
|
|
349
|
+static void smc9000_disable ( struct nic *nic ) {
|
|
350
|
+ smc_reset(nic->ioaddr);
|
367
|
351
|
|
368
|
352
|
/* no more interrupts for me */
|
369
|
|
- SMC_SELECT_BANK(smc9000_base, 2);
|
370
|
|
- _outb( 0, smc9000_base + INT_MASK);
|
|
353
|
+ SMC_SELECT_BANK(nic->ioaddr, 2);
|
|
354
|
+ _outb( 0, nic->ioaddr + INT_MASK);
|
371
|
355
|
|
372
|
356
|
/* and tell the card to stay away from that nasty outside world */
|
373
|
|
- SMC_SELECT_BANK(smc9000_base, 0);
|
374
|
|
- _outb( RCR_CLEAR, smc9000_base + RCR );
|
375
|
|
- _outb( TCR_CLEAR, smc9000_base + TCR );
|
|
357
|
+ SMC_SELECT_BANK(nic->ioaddr, 0);
|
|
358
|
+ _outb( RCR_CLEAR, nic->ioaddr + RCR );
|
|
359
|
+ _outb( TCR_CLEAR, nic->ioaddr + TCR );
|
376
|
360
|
}
|
377
|
361
|
|
378
|
362
|
static void smc9000_irq(struct nic *nic __unused, irq_action_t action __unused)
|
|
@@ -387,13 +371,20 @@ static void smc9000_irq(struct nic *nic __unused, irq_action_t action __unused)
|
387
|
371
|
}
|
388
|
372
|
}
|
389
|
373
|
|
|
374
|
+static struct nic_operations smc9000_operations = {
|
|
375
|
+ .connect = dummy_connect,
|
|
376
|
+ .poll = smc9000_poll,
|
|
377
|
+ .transmit = smc9000_transmit,
|
|
378
|
+ .irq = smc9000_irq,
|
|
379
|
+ .disable = smc9000_disable,
|
|
380
|
+};
|
|
381
|
+
|
390
|
382
|
/**************************************************************************
|
391
|
383
|
* ETH_PROBE - Look for an adapter
|
392
|
384
|
***************************************************************************/
|
393
|
385
|
|
394
|
|
-static int smc9000_probe(struct dev *dev, unsigned short *probe_addrs)
|
395
|
|
-{
|
396
|
|
- struct nic *nic = (struct nic *)dev;
|
|
386
|
+static int smc9000_probe ( struct dev *dev, struct isa_device *isa ) {
|
|
387
|
+ struct nic *nic = nic_device ( dev );
|
397
|
388
|
unsigned short revision;
|
398
|
389
|
int memory;
|
399
|
390
|
int media;
|
|
@@ -401,63 +392,33 @@ static int smc9000_probe(struct dev *dev, unsigned short *probe_addrs)
|
401
|
392
|
const char * if_string;
|
402
|
393
|
int i;
|
403
|
394
|
|
404
|
|
- /*
|
405
|
|
- * the SMC9000 can be at any of the following port addresses. To change,
|
406
|
|
- * for a slightly different card, you can add it to the array. Keep in
|
407
|
|
- * mind that the array must end in zero.
|
408
|
|
- */
|
409
|
|
- static unsigned short portlist[] = {
|
410
|
|
-#ifdef SMC9000_SCAN
|
411
|
|
- SMC9000_SCAN,
|
412
|
|
-#else
|
413
|
|
- 0x200, 0x220, 0x240, 0x260, 0x280, 0x2A0, 0x2C0, 0x2E0,
|
414
|
|
- 0x300, 0x320, 0x340, 0x360, 0x380, 0x3A0, 0x3C0, 0x3E0,
|
415
|
|
-#endif
|
416
|
|
- 0 };
|
417
|
|
-
|
418
|
|
- /* if no addresses supplied, fall back on defaults */
|
419
|
|
- if (probe_addrs == 0 || probe_addrs[0] == 0)
|
420
|
|
- probe_addrs = portlist;
|
421
|
|
-
|
422
|
|
- /* check every ethernet address */
|
423
|
|
- for (i = 0; probe_addrs[i]; i++) {
|
424
|
|
- /* check this specific address */
|
425
|
|
- if (smc_probe(probe_addrs[i]) == 0)
|
426
|
|
- smc9000_base = probe_addrs[i];
|
427
|
|
- }
|
428
|
|
-
|
429
|
|
- /* couldn't find anything */
|
430
|
|
- if(0 == smc9000_base)
|
431
|
|
- goto out;
|
432
|
|
-
|
433
|
395
|
nic->irqno = 0;
|
434
|
|
- nic->ioaddr = smc9000_base;
|
|
396
|
+ nic->ioaddr = isa->ioaddr;
|
435
|
397
|
|
436
|
398
|
/*
|
437
|
399
|
* Get the MAC address ( bank 1, regs 4 - 9 )
|
438
|
400
|
*/
|
439
|
|
- SMC_SELECT_BANK(smc9000_base, 1);
|
|
401
|
+ SMC_SELECT_BANK(nic->ioaddr, 1);
|
440
|
402
|
for ( i = 0; i < 6; i += 2 ) {
|
441
|
403
|
word address;
|
442
|
404
|
|
443
|
|
- address = inw(smc9000_base + ADDR0 + i);
|
|
405
|
+ address = inw(nic->ioaddr + ADDR0 + i);
|
444
|
406
|
nic->node_addr[i+1] = address >> 8;
|
445
|
407
|
nic->node_addr[i] = address & 0xFF;
|
446
|
408
|
}
|
447
|
409
|
|
448
|
|
-
|
449
|
410
|
/* get the memory information */
|
450
|
|
- SMC_SELECT_BANK(smc9000_base, 0);
|
451
|
|
- memory = ( inw(smc9000_base + MCR) >> 9 ) & 0x7; /* multiplier */
|
452
|
|
- memory *= 256 * (inw(smc9000_base + MIR) & 0xFF);
|
|
411
|
+ SMC_SELECT_BANK(nic->ioaddr, 0);
|
|
412
|
+ memory = ( inw(nic->ioaddr + MCR) >> 9 ) & 0x7; /* multiplier */
|
|
413
|
+ memory *= 256 * (inw(nic->ioaddr + MIR) & 0xFF);
|
453
|
414
|
|
454
|
415
|
/*
|
455
|
416
|
* Now, I want to find out more about the chip. This is sort of
|
456
|
417
|
* redundant, but it's cleaner to have it in both, rather than having
|
457
|
418
|
* one VERY long probe procedure.
|
458
|
419
|
*/
|
459
|
|
- SMC_SELECT_BANK(smc9000_base, 3);
|
460
|
|
- revision = inw(smc9000_base + REVISION);
|
|
420
|
+ SMC_SELECT_BANK(nic->ioaddr, 3);
|
|
421
|
+ revision = inw(nic->ioaddr + REVISION);
|
461
|
422
|
version_string = chip_ids[(revision >> 4) & 0xF];
|
462
|
423
|
|
463
|
424
|
if (((revision & 0xF0) >> 4 == CHIP_9196) &&
|
|
@@ -469,12 +430,12 @@ static int smc9000_probe(struct dev *dev, unsigned short *probe_addrs)
|
469
|
430
|
|
470
|
431
|
if ( !version_string ) {
|
471
|
432
|
/* I shouldn't get here because this call was done before.... */
|
472
|
|
- goto out;
|
|
433
|
+ return 0;
|
473
|
434
|
}
|
474
|
435
|
|
475
|
436
|
/* is it using AUI or 10BaseT ? */
|
476
|
|
- SMC_SELECT_BANK(smc9000_base, 1);
|
477
|
|
- if (inw(smc9000_base + CONFIG) & CFG_AUI_SELECT)
|
|
437
|
+ SMC_SELECT_BANK(nic->ioaddr, 1);
|
|
438
|
+ if (inw(nic->ioaddr + CONFIG) & CFG_AUI_SELECT)
|
478
|
439
|
media = 2;
|
479
|
440
|
else
|
480
|
441
|
media = 1;
|
|
@@ -482,67 +443,63 @@ static int smc9000_probe(struct dev *dev, unsigned short *probe_addrs)
|
482
|
443
|
if_string = interfaces[media - 1];
|
483
|
444
|
|
484
|
445
|
/* now, reset the chip, and put it into a known state */
|
485
|
|
- smc_reset(smc9000_base);
|
|
446
|
+ smc_reset(nic->ioaddr);
|
486
|
447
|
|
487
|
448
|
printf("SMC9000 %s\n", smc9000_version);
|
488
|
|
-#ifdef SMC9000_VERBOSE
|
489
|
|
- printf("Copyright (C) 1998 Daniel Engstr\x94m\n");
|
490
|
|
- printf("Copyright (C) 1996 Eric Stahlman\n");
|
491
|
|
-#endif
|
|
449
|
+ DBG("Copyright (C) 1998 Daniel Engstr\x94m\n");
|
|
450
|
+ DBG("Copyright (C) 1996 Eric Stahlman\n");
|
492
|
451
|
|
493
|
452
|
printf("%s rev:%d I/O port:%hX Interface:%s RAM:%d bytes \n",
|
494
|
453
|
version_string, revision & 0xF,
|
495
|
|
- smc9000_base, if_string, memory );
|
|
454
|
+ nic->ioaddr, if_string, memory );
|
496
|
455
|
/*
|
497
|
456
|
* Print the Ethernet address
|
498
|
457
|
*/
|
499
|
458
|
printf("Ethernet MAC address: %!\n", nic->node_addr);
|
500
|
459
|
|
501
|
|
- SMC_SELECT_BANK(smc9000_base, 0);
|
|
460
|
+ SMC_SELECT_BANK(nic->ioaddr, 0);
|
502
|
461
|
|
503
|
462
|
/* see the header file for options in TCR/RCR NORMAL*/
|
504
|
|
- _outw(TCR_NORMAL, smc9000_base + TCR);
|
505
|
|
- _outw(RCR_NORMAL, smc9000_base + RCR);
|
|
463
|
+ _outw(TCR_NORMAL, nic->ioaddr + TCR);
|
|
464
|
+ _outw(RCR_NORMAL, nic->ioaddr + RCR);
|
506
|
465
|
|
507
|
466
|
/* Select which interface to use */
|
508
|
|
- SMC_SELECT_BANK(smc9000_base, 1);
|
|
467
|
+ SMC_SELECT_BANK(nic->ioaddr, 1);
|
509
|
468
|
if ( media == 1 ) {
|
510
|
|
- _outw( inw( smc9000_base + CONFIG ) & ~CFG_AUI_SELECT,
|
511
|
|
- smc9000_base + CONFIG );
|
|
469
|
+ _outw( inw( nic->ioaddr + CONFIG ) & ~CFG_AUI_SELECT,
|
|
470
|
+ nic->ioaddr + CONFIG );
|
512
|
471
|
}
|
513
|
472
|
else if ( media == 2 ) {
|
514
|
|
- _outw( inw( smc9000_base + CONFIG ) | CFG_AUI_SELECT,
|
515
|
|
- smc9000_base + CONFIG );
|
|
473
|
+ _outw( inw( nic->ioaddr + CONFIG ) | CFG_AUI_SELECT,
|
|
474
|
+ nic->ioaddr + CONFIG );
|
516
|
475
|
}
|
517
|
|
-static struct nic_operations smc9000_operations;
|
518
|
|
-static struct nic_operations smc9000_operations = {
|
519
|
|
- .connect = dummy_connect,
|
520
|
|
- .poll = smc9000_poll,
|
521
|
|
- .transmit = smc9000_transmit,
|
522
|
|
- .irq = smc9000_irq,
|
523
|
|
- .disable = smc9000_disable,
|
524
|
|
-};
|
|
476
|
+
|
525
|
477
|
nic->nic_op = &smc9000_operations;
|
|
478
|
+ return 1;
|
|
479
|
+}
|
526
|
480
|
|
527
|
|
- /* Based on PnP ISA map */
|
528
|
|
- dev->devid.vendor_id = htons(GENERIC_ISAPNP_VENDOR);
|
529
|
|
- dev->devid.device_id = htons(0x8228);
|
|
481
|
+/*
|
|
482
|
+ * The SMC9000 can be at any of the following port addresses. To
|
|
483
|
+ * change for a slightly different card, you can add it to the array.
|
|
484
|
+ *
|
|
485
|
+ */
|
|
486
|
+static struct isa_probe_addr smc9000_probe_addrs[] = {
|
|
487
|
+ { 0x200 }, { 0x220 }, { 0x240 }, { 0x260 },
|
|
488
|
+ { 0x280 }, { 0x2A0 }, { 0x2C0 }, { 0x2E0 },
|
|
489
|
+ { 0x300 }, { 0x320 }, { 0x340 }, { 0x360 },
|
|
490
|
+ { 0x380 }, { 0x3A0 }, { 0x3C0 }, { 0x3E0 },
|
|
491
|
+};
|
530
|
492
|
|
531
|
|
- return 1;
|
|
493
|
+static struct isa_driver smc9000_driver =
|
|
494
|
+ISA_DRIVER ( "SMC9000", smc9000_probe_addrs, smc9000_probe_addr,
|
|
495
|
+ GENERIC_ISAPNP_VENDOR, 0x8228 );
|
532
|
496
|
|
533
|
|
-out:
|
534
|
|
-#ifdef SMC9000_VERBOSE
|
535
|
|
- /* printf("No SMC9000 adapters found\n"); */
|
536
|
|
-#endif
|
537
|
|
- smc9000_base = 0;
|
|
497
|
+BOOT_DRIVER ( "SMC9000", find_isa_boot_device, smc9000_driver, smc9000_probe );
|
538
|
498
|
|
539
|
|
- return (0);
|
540
|
|
-}
|
|
499
|
+ISA_ROM( "smc9000", "SMC9000" );
|
541
|
500
|
|
542
|
|
-static struct isa_driver smc9000_driver __isa_driver = {
|
543
|
|
- .type = NIC_DRIVER,
|
544
|
|
- .name = "SMC9000",
|
545
|
|
- .probe = smc9000_probe,
|
546
|
|
- .ioaddrs = 0,
|
547
|
|
-};
|
548
|
|
-ISA_ROM("smc9000","SMC9000");
|
|
501
|
+/*
|
|
502
|
+ * Local variables:
|
|
503
|
+ * c-basic-offset: 3
|
|
504
|
+ * End:
|
|
505
|
+ */
|