]>
Commit | Line | Data |
---|---|---|
748534f4 JP |
1 | /* |
2 | * 3c90x.c -- This file implements the 3c90x driver for etherboot. Written | |
3 | * by Greg Beeley, Greg.Beeley@LightSys.org. Modified by Steve Smith, | |
4 | * Steve.Smith@Juno.Com. Alignment bug fix Neil Newell (nn@icenoir.net). | |
5 | * | |
6 | * This program Copyright (C) 1999 LightSys Technology Services, Inc. | |
7 | * Portions Copyright (C) 1999 Steve Smith | |
8 | * | |
9 | * This program may be re-distributed in source or binary form, modified, | |
10 | * sold, or copied for any purpose, provided that the above copyright message | |
11 | * and this text are included with all source copies or derivative works, and | |
12 | * provided that the above copyright message and this text are included in the | |
13 | * documentation of any binary-only distributions. This program is distributed | |
14 | * WITHOUT ANY WARRANTY, without even the warranty of FITNESS FOR A PARTICULAR | |
15 | * PURPOSE or MERCHANTABILITY. Please read the associated documentation | |
16 | * "3c90x.txt" before compiling and using this driver. | |
17 | * | |
18 | * -------- | |
19 | * | |
20 | * Program written with the assistance of the 3com documentation for | |
21 | * the 3c905B-TX card, as well as with some assistance from the 3c59x | |
22 | * driver Donald Becker wrote for the Linux kernel, and with some assistance | |
23 | * from the remainder of the Etherboot distribution. | |
24 | * | |
25 | * REVISION HISTORY: | |
26 | * | |
27 | * v0.10 1-26-1998 GRB Initial implementation. | |
28 | * v0.90 1-27-1998 GRB System works. | |
29 | * v1.00pre1 2-11-1998 GRB Got prom boot issue fixed. | |
30 | * v2.0 9-24-1999 SCS Modified for 3c905 (from 3c905b code) | |
31 | * Re-wrote poll and transmit for | |
32 | * better error recovery and heavy | |
33 | * network traffic operation | |
34 | * v2.01 5-26-2003 NN Fixed driver alignment issue which | |
35 | * caused system lockups if driver structures | |
36 | * not 8-byte aligned. | |
37 | * | |
38 | */ | |
39 | ||
40 | #include "etherboot-compat.h" | |
42125f27 | 41 | #include "net.h" |
748534f4 JP |
42 | #include <timer.h> |
43 | #include <io.h> | |
44 | #include <pci.h> | |
7a914840 | 45 | #include <pci-bother.h> |
748534f4 JP |
46 | #include <minilib.h> |
47 | #include <output.h> | |
68beefa8 | 48 | #include <paging.h> |
748534f4 JP |
49 | |
50 | #define XCVR_MAGIC (0x5A00) | |
51 | /** any single transmission fails after 16 collisions or other errors | |
52 | ** this is the number of times to retry the transmission -- this should | |
53 | ** be plenty | |
54 | **/ | |
c25f3f39 | 55 | #define XMIT_RETRIES 5 |
748534f4 JP |
56 | |
57 | /*** Register definitions for the 3c905 ***/ | |
58 | enum Registers | |
59 | { | |
60 | regPowerMgmtCtrl_w = 0x7c, /** 905B Revision Only **/ | |
61 | regUpMaxBurst_w = 0x7a, /** 905B Revision Only **/ | |
62 | regDnMaxBurst_w = 0x78, /** 905B Revision Only **/ | |
63 | regDebugControl_w = 0x74, /** 905B Revision Only **/ | |
64 | regDebugData_l = 0x70, /** 905B Revision Only **/ | |
65 | regRealTimeCnt_l = 0x40, /** Universal **/ | |
66 | regUpBurstThresh_b = 0x3e, /** 905B Revision Only **/ | |
67 | regUpPoll_b = 0x3d, /** 905B Revision Only **/ | |
68 | regUpPriorityThresh_b = 0x3c, /** 905B Revision Only **/ | |
69 | regUpListPtr_l = 0x38, /** Universal **/ | |
70 | regCountdown_w = 0x36, /** Universal **/ | |
71 | regFreeTimer_w = 0x34, /** Universal **/ | |
72 | regUpPktStatus_l = 0x30, /** Universal with Exception, pg 130 **/ | |
73 | regTxFreeThresh_b = 0x2f, /** 90X Revision Only **/ | |
74 | regDnPoll_b = 0x2d, /** 905B Revision Only **/ | |
75 | regDnPriorityThresh_b = 0x2c, /** 905B Revision Only **/ | |
76 | regDnBurstThresh_b = 0x2a, /** 905B Revision Only **/ | |
77 | regDnListPtr_l = 0x24, /** Universal with Exception, pg 107 **/ | |
78 | regDmaCtrl_l = 0x20, /** Universal with Exception, pg 106 **/ | |
79 | /** **/ | |
80 | regIntStatusAuto_w = 0x1e, /** 905B Revision Only **/ | |
81 | regTxStatus_b = 0x1b, /** Universal with Exception, pg 113 **/ | |
82 | regTimer_b = 0x1a, /** Universal **/ | |
83 | regTxPktId_b = 0x18, /** 905B Revision Only **/ | |
84 | regCommandIntStatus_w = 0x0e, /** Universal (Command Variations) **/ | |
85 | }; | |
86 | ||
87 | /** following are windowed registers **/ | |
88 | enum Registers7 | |
89 | { | |
90 | regPowerMgmtEvent_7_w = 0x0c, /** 905B Revision Only **/ | |
91 | regVlanEtherType_7_w = 0x04, /** 905B Revision Only **/ | |
92 | regVlanMask_7_w = 0x00, /** 905B Revision Only **/ | |
93 | }; | |
94 | ||
95 | enum Registers6 | |
96 | { | |
97 | regBytesXmittedOk_6_w = 0x0c, /** Universal **/ | |
98 | regBytesRcvdOk_6_w = 0x0a, /** Universal **/ | |
99 | regUpperFramesOk_6_b = 0x09, /** Universal **/ | |
100 | regFramesDeferred_6_b = 0x08, /** Universal **/ | |
101 | regFramesRecdOk_6_b = 0x07, /** Universal with Exceptions, pg 142 **/ | |
102 | regFramesXmittedOk_6_b = 0x06, /** Universal **/ | |
103 | regRxOverruns_6_b = 0x05, /** Universal **/ | |
104 | regLateCollisions_6_b = 0x04, /** Universal **/ | |
105 | regSingleCollisions_6_b = 0x03, /** Universal **/ | |
106 | regMultipleCollisions_6_b = 0x02, /** Universal **/ | |
107 | regSqeErrors_6_b = 0x01, /** Universal **/ | |
108 | regCarrierLost_6_b = 0x00, /** Universal **/ | |
109 | }; | |
110 | ||
111 | enum Registers5 | |
112 | { | |
113 | regIndicationEnable_5_w = 0x0c, /** Universal **/ | |
114 | regInterruptEnable_5_w = 0x0a, /** Universal **/ | |
115 | regTxReclaimThresh_5_b = 0x09, /** 905B Revision Only **/ | |
116 | regRxFilter_5_b = 0x08, /** Universal **/ | |
117 | regRxEarlyThresh_5_w = 0x06, /** Universal **/ | |
118 | regTxStartThresh_5_w = 0x00, /** Universal **/ | |
119 | }; | |
120 | ||
121 | enum Registers4 | |
122 | { | |
123 | regUpperBytesOk_4_b = 0x0d, /** Universal **/ | |
124 | regBadSSD_4_b = 0x0c, /** Universal **/ | |
125 | regMediaStatus_4_w = 0x0a, /** Universal with Exceptions, pg 201 **/ | |
126 | regPhysicalMgmt_4_w = 0x08, /** Universal **/ | |
127 | regNetworkDiagnostic_4_w = 0x06, /** Universal with Exceptions, pg 203 **/ | |
128 | regFifoDiagnostic_4_w = 0x04, /** Universal with Exceptions, pg 196 **/ | |
129 | regVcoDiagnostic_4_w = 0x02, /** Undocumented? **/ | |
130 | }; | |
131 | ||
132 | enum Registers3 | |
133 | { | |
134 | regTxFree_3_w = 0x0c, /** Universal **/ | |
135 | regRxFree_3_w = 0x0a, /** Universal with Exceptions, pg 125 **/ | |
136 | regResetMediaOptions_3_w = 0x08, /** Media Options on B Revision, **/ | |
137 | /** Reset Options on Non-B Revision **/ | |
138 | regMacControl_3_w = 0x06, /** Universal with Exceptions, pg 199 **/ | |
139 | regMaxPktSize_3_w = 0x04, /** 905B Revision Only **/ | |
140 | regInternalConfig_3_l = 0x00, /** Universal, different bit **/ | |
141 | /** definitions, pg 59 **/ | |
142 | }; | |
143 | ||
144 | enum Registers2 | |
145 | { | |
146 | regResetOptions_2_w = 0x0c, /** 905B Revision Only **/ | |
147 | regStationMask_2_3w = 0x06, /** Universal with Exceptions, pg 127 **/ | |
148 | regStationAddress_2_3w = 0x00, /** Universal with Exceptions, pg 127 **/ | |
149 | }; | |
150 | ||
151 | enum Registers1 | |
152 | { | |
153 | regRxStatus_1_w = 0x0a, /** 90X Revision Only, Pg 126 **/ | |
154 | }; | |
155 | ||
156 | enum Registers0 | |
157 | { | |
158 | regEepromData_0_w = 0x0c, /** Universal **/ | |
159 | regEepromCommand_0_w = 0x0a, /** Universal **/ | |
160 | regBiosRomData_0_b = 0x08, /** 905B Revision Only **/ | |
161 | regBiosRomAddr_0_l = 0x04, /** 905B Revision Only **/ | |
162 | }; | |
163 | ||
164 | ||
165 | /*** The names for the eight register windows ***/ | |
166 | enum Windows | |
167 | { | |
168 | winPowerVlan7 = 0x07, | |
169 | winStatistics6 = 0x06, | |
170 | winTxRxControl5 = 0x05, | |
171 | winDiagnostics4 = 0x04, | |
172 | winTxRxOptions3 = 0x03, | |
173 | winAddressing2 = 0x02, | |
174 | winUnused1 = 0x01, | |
175 | winEepromBios0 = 0x00, | |
176 | }; | |
177 | ||
178 | ||
179 | /*** Command definitions for the 3c90X ***/ | |
180 | enum Commands | |
181 | { | |
182 | cmdGlobalReset = 0x00, /** Universal with Exceptions, pg 151 **/ | |
183 | cmdSelectRegisterWindow = 0x01, /** Universal **/ | |
184 | cmdEnableDcConverter = 0x02, /** **/ | |
185 | cmdRxDisable = 0x03, /** **/ | |
186 | cmdRxEnable = 0x04, /** Universal **/ | |
187 | cmdRxReset = 0x05, /** Universal **/ | |
188 | cmdStallCtl = 0x06, /** Universal **/ | |
189 | cmdTxEnable = 0x09, /** Universal **/ | |
190 | cmdTxDisable = 0x0A, /** **/ | |
191 | cmdTxReset = 0x0B, /** Universal **/ | |
192 | cmdRequestInterrupt = 0x0C, /** **/ | |
193 | cmdAcknowledgeInterrupt = 0x0D, /** Universal **/ | |
194 | cmdSetInterruptEnable = 0x0E, /** Universal **/ | |
195 | cmdSetIndicationEnable = 0x0F, /** Universal **/ | |
196 | cmdSetRxFilter = 0x10, /** Universal **/ | |
197 | cmdSetRxEarlyThresh = 0x11, /** **/ | |
198 | cmdSetTxStartThresh = 0x13, /** **/ | |
199 | cmdStatisticsEnable = 0x15, /** **/ | |
200 | cmdStatisticsDisable = 0x16, /** **/ | |
201 | cmdDisableDcConverter = 0x17, /** **/ | |
202 | cmdSetTxReclaimThresh = 0x18, /** **/ | |
203 | cmdSetHashFilterBit = 0x19, /** **/ | |
204 | }; | |
205 | ||
206 | ||
207 | /*** Values for int status register bitmask **/ | |
208 | #define INT_INTERRUPTLATCH (1<<0) | |
209 | #define INT_HOSTERROR (1<<1) | |
210 | #define INT_TXCOMPLETE (1<<2) | |
211 | #define INT_RXCOMPLETE (1<<4) | |
212 | #define INT_RXEARLY (1<<5) | |
213 | #define INT_INTREQUESTED (1<<6) | |
214 | #define INT_UPDATESTATS (1<<7) | |
215 | #define INT_LINKEVENT (1<<8) | |
216 | #define INT_DNCOMPLETE (1<<9) | |
217 | #define INT_UPCOMPLETE (1<<10) | |
218 | #define INT_CMDINPROGRESS (1<<12) | |
219 | #define INT_WINDOWNUMBER (7<<13) | |
220 | ||
221 | ||
222 | /*** TX descriptor ***/ | |
223 | typedef struct | |
224 | { | |
225 | unsigned int DnNextPtr; | |
226 | unsigned int FrameStartHeader; | |
54d4b877 JW |
227 | struct { |
228 | unsigned int addr; | |
229 | unsigned int len; | |
230 | } __attribute ((aligned(8))) segments[64]; | |
748534f4 JP |
231 | } |
232 | TXD __attribute__ ((aligned(8))); /* 64-bit aligned for bus mastering */ | |
233 | ||
234 | /*** RX descriptor ***/ | |
235 | typedef struct | |
236 | { | |
237 | unsigned int UpNextPtr; | |
238 | unsigned int UpPktStatus; | |
239 | unsigned int DataAddr; | |
240 | unsigned int DataLength; | |
241 | } | |
242 | RXD __attribute__ ((aligned(8))); /* 64-bit aligned for bus mastering */ | |
243 | ||
244 | /*** Global variables ***/ | |
245 | static struct | |
246 | { | |
247 | unsigned int is3c556; | |
248 | unsigned char isBrev; | |
249 | unsigned char CurrentWindow; | |
250 | unsigned int IOAddr; | |
251 | unsigned char HWAddr[ETH_ALEN]; | |
252 | TXD TransmitDPD; | |
253 | RXD ReceiveUPD; | |
254 | } | |
255 | INF_3C90X; | |
7a914840 | 256 | static struct nic nic; |
748534f4 | 257 | |
c2e34447 JW |
258 | #define _outl(v,a) outl((a),(v)) |
259 | #define _outw(v,a) outw((a),(v)) | |
260 | #define _outb(v,a) outb((a),(v)) | |
748534f4 | 261 | |
31ddf9b3 JW |
262 | static int _issue_command(int ioaddr, int cmd, int param) |
263 | { | |
264 | outw(ioaddr + regCommandIntStatus_w, (cmd << 11) | param); | |
748534f4 | 265 | |
31ddf9b3 JW |
266 | while (inw(ioaddr + regCommandIntStatus_w) & INT_CMDINPROGRESS) |
267 | ; | |
748534f4 | 268 | |
31ddf9b3 JW |
269 | return 0; |
270 | } | |
748534f4 JP |
271 | |
272 | ||
273 | /*** a3c90x_internal_SetWindow: selects a register window set. | |
274 | ***/ | |
31ddf9b3 JW |
275 | static int _set_window(int ioaddr, int window) |
276 | { | |
277 | if (INF_3C90X.CurrentWindow == window) | |
278 | return 0; | |
748534f4 | 279 | |
31ddf9b3 | 280 | _issue_command(ioaddr, cmdSelectRegisterWindow, window); |
748534f4 JP |
281 | INF_3C90X.CurrentWindow = window; |
282 | ||
31ddf9b3 JW |
283 | return 0; |
284 | } | |
748534f4 JP |
285 | |
286 | ||
287 | /*** a3c90x_internal_ReadEeprom - read data from the serial eeprom. | |
288 | ***/ | |
289 | static unsigned short | |
290 | a3c90x_internal_ReadEeprom(int ioaddr, int address) | |
c2e34447 JW |
291 | { |
292 | unsigned short val; | |
748534f4 JP |
293 | |
294 | /** Select correct window **/ | |
31ddf9b3 | 295 | _set_window(INF_3C90X.IOAddr, winEepromBios0); |
748534f4 JP |
296 | |
297 | /** Make sure the eeprom isn't busy **/ | |
c2e34447 JW |
298 | do |
299 | { | |
300 | int i; | |
301 | for (i = 0; i < 165; i++) | |
302 | inb(0x80); /* wait 165 usec */ | |
303 | } | |
304 | while(0x8000 & inw(ioaddr + regEepromCommand_0_w)); | |
748534f4 JP |
305 | |
306 | /** Read the value. **/ | |
307 | if (INF_3C90X.is3c556) | |
c2e34447 | 308 | _outw(address + (0x230), ioaddr + regEepromCommand_0_w); |
748534f4 | 309 | else |
c2e34447 | 310 | _outw(address + 0x80, ioaddr + regEepromCommand_0_w); |
748534f4 | 311 | |
c2e34447 JW |
312 | do |
313 | { | |
314 | int i; | |
315 | for (i = 0; i < 165; i++) | |
316 | inb(0x80); /* wait 165 usec */ | |
317 | } | |
318 | while(0x8000 & inw(ioaddr + regEepromCommand_0_w)); | |
319 | val = inw(ioaddr + regEepromData_0_w); | |
320 | ||
321 | return val; | |
322 | } | |
748534f4 JP |
323 | |
324 | ||
325 | #ifdef CFG_3C90X_BOOTROM_FIX | |
326 | /*** a3c90x_internal_WriteEepromWord - write a physical word of | |
327 | *** data to the onboard serial eeprom (not the BIOS prom, but the | |
328 | *** nvram in the card that stores, among other things, the MAC | |
329 | *** address). | |
330 | ***/ | |
331 | static int | |
332 | a3c90x_internal_WriteEepromWord(int ioaddr, int address, unsigned short value) | |
333 | { | |
334 | /** Select register window **/ | |
31ddf9b3 | 335 | _set_window(ioaddr, winEepromBios0); |
748534f4 JP |
336 | |
337 | /** Verify Eeprom not busy **/ | |
338 | while((1<<15) & inw(ioaddr + regEepromCommand_0_w)); | |
339 | ||
340 | /** Issue WriteEnable, and wait for completion. **/ | |
c2e34447 | 341 | _outw(0x30, ioaddr + regEepromCommand_0_w); |
748534f4 JP |
342 | while((1<<15) & inw(ioaddr + regEepromCommand_0_w)); |
343 | ||
344 | /** Issue EraseRegister, and wait for completion. **/ | |
c2e34447 | 345 | _outw(address + ((0x03)<<6), ioaddr + regEepromCommand_0_w); |
748534f4 JP |
346 | while((1<<15) & inw(ioaddr + regEepromCommand_0_w)); |
347 | ||
348 | /** Send the new data to the eeprom, and wait for completion. **/ | |
c2e34447 JW |
349 | _outw(value, ioaddr + regEepromData_0_w); |
350 | _outw(0x30, ioaddr + regEepromCommand_0_w); | |
748534f4 JP |
351 | while((1<<15) & inw(ioaddr + regEepromCommand_0_w)); |
352 | ||
353 | /** Burn the new data into the eeprom, and wait for completion. **/ | |
c2e34447 | 354 | _outw(address + ((0x01)<<6), ioaddr + regEepromCommand_0_w); |
748534f4 JP |
355 | while((1<<15) & inw(ioaddr + regEepromCommand_0_w)); |
356 | ||
357 | return 0; | |
358 | } | |
359 | #endif | |
360 | ||
361 | #ifdef CFG_3C90X_BOOTROM_FIX | |
362 | /*** a3c90x_internal_WriteEeprom - write data to the serial eeprom, | |
363 | *** and re-compute the eeprom checksum. | |
364 | ***/ | |
365 | static int | |
366 | a3c90x_internal_WriteEeprom(int ioaddr, int address, unsigned short value) | |
367 | { | |
368 | int cksum = 0,v; | |
369 | int i; | |
370 | int maxAddress, cksumAddress; | |
371 | ||
372 | if (INF_3C90X.isBrev) | |
373 | { | |
374 | maxAddress=0x1f; | |
375 | cksumAddress=0x20; | |
376 | } | |
377 | else | |
378 | { | |
379 | maxAddress=0x16; | |
380 | cksumAddress=0x17; | |
381 | } | |
382 | ||
383 | /** Write the value. **/ | |
384 | if (a3c90x_internal_WriteEepromWord(ioaddr, address, value) == -1) | |
385 | return -1; | |
386 | ||
387 | /** Recompute the checksum. **/ | |
388 | for(i=0;i<=maxAddress;i++) | |
389 | { | |
390 | v = a3c90x_internal_ReadEeprom(ioaddr, i); | |
391 | cksum ^= (v & 0xFF); | |
392 | cksum ^= ((v>>8) & 0xFF); | |
393 | } | |
394 | /** Write the checksum to the location in the eeprom **/ | |
395 | if (a3c90x_internal_WriteEepromWord(ioaddr, cksumAddress, cksum) == -1) | |
396 | return -1; | |
397 | ||
398 | return 0; | |
399 | } | |
400 | #endif | |
401 | ||
402 | /*** a3c90x_reset: exported function that resets the card to its default | |
403 | *** state. This is so the Linux driver can re-set the card up the way | |
404 | *** it wants to. If CFG_3C90X_PRESERVE_XCVR is defined, then the reset will | |
405 | *** not alter the selected transceiver that we used to download the boot | |
406 | *** image. | |
407 | ***/ | |
408 | static void a3c90x_reset(void) | |
409 | { | |
410 | #ifdef CFG_3C90X_PRESERVE_XCVR | |
411 | int cfg; | |
412 | /** Read the current InternalConfig value. **/ | |
31ddf9b3 | 413 | _set_window(INF_3C90X.IOAddr, winTxRxOptions3); |
748534f4 JP |
414 | cfg = inl(INF_3C90X.IOAddr + regInternalConfig_3_l); |
415 | #endif | |
416 | ||
417 | /** Send the reset command to the card **/ | |
99182958 | 418 | outputf("3c90x: issuing RESET"); |
31ddf9b3 | 419 | _issue_command(INF_3C90X.IOAddr, cmdGlobalReset, 0); |
748534f4 JP |
420 | |
421 | /** global reset command resets station mask, non-B revision cards | |
422 | ** require explicit reset of values | |
423 | **/ | |
31ddf9b3 | 424 | _set_window(INF_3C90X.IOAddr, winAddressing2); |
c2e34447 JW |
425 | _outw(0, INF_3C90X.IOAddr + regStationMask_2_3w+0); |
426 | _outw(0, INF_3C90X.IOAddr + regStationMask_2_3w+2); | |
427 | _outw(0, INF_3C90X.IOAddr + regStationMask_2_3w+4); | |
748534f4 JP |
428 | |
429 | #ifdef CFG_3C90X_PRESERVE_XCVR | |
430 | /** Re-set the original InternalConfig value from before reset **/ | |
31ddf9b3 | 431 | _set_window(INF_3C90X.IOAddr, winTxRxOptions3); |
c2e34447 | 432 | _outl(cfg, INF_3C90X.IOAddr + regInternalConfig_3_l); |
748534f4 JP |
433 | |
434 | /** enable DC converter for 10-Base-T **/ | |
435 | if ((cfg&0x0300) == 0x0300) | |
436 | { | |
31ddf9b3 | 437 | _issue_command(INF_3C90X.IOAddr, cmdEnableDcConverter, 0); |
748534f4 JP |
438 | } |
439 | #endif | |
440 | ||
441 | /** Issue transmit reset, wait for command completion **/ | |
31ddf9b3 | 442 | _issue_command(INF_3C90X.IOAddr, cmdTxReset, 0); |
748534f4 | 443 | if (! INF_3C90X.isBrev) |
c2e34447 | 444 | _outb(0x01, INF_3C90X.IOAddr + regTxFreeThresh_b); |
31ddf9b3 | 445 | _issue_command(INF_3C90X.IOAddr, cmdTxEnable, 0); |
748534f4 JP |
446 | |
447 | /** | |
448 | ** reset of the receiver on B-revision cards re-negotiates the link | |
449 | ** takes several seconds (a computer eternity) | |
450 | **/ | |
451 | if (INF_3C90X.isBrev) | |
31ddf9b3 | 452 | _issue_command(INF_3C90X.IOAddr, cmdRxReset, 0x04); |
748534f4 | 453 | else |
31ddf9b3 JW |
454 | _issue_command(INF_3C90X.IOAddr, cmdRxReset, 0x00); |
455 | while (inw(INF_3C90X.IOAddr + regCommandIntStatus_w) & INT_CMDINPROGRESS) | |
456 | ; | |
457 | _issue_command(INF_3C90X.IOAddr, cmdRxEnable, 0); | |
748534f4 | 458 | |
31ddf9b3 | 459 | _issue_command(INF_3C90X.IOAddr, cmdSetInterruptEnable, 0); |
748534f4 | 460 | /** enable rxComplete and txComplete **/ |
31ddf9b3 | 461 | _issue_command(INF_3C90X.IOAddr, cmdSetIndicationEnable, 0x0014); |
748534f4 | 462 | /** acknowledge any pending status flags **/ |
31ddf9b3 | 463 | _issue_command(INF_3C90X.IOAddr, cmdAcknowledgeInterrupt, 0x661); |
748534f4 JP |
464 | |
465 | return; | |
466 | } | |
467 | ||
468 | ||
469 | ||
470 | /*** a3c90x_transmit: exported function that transmits a packet. Does not | |
471 | *** return any particular status. Parameters are: | |
472 | *** dest_addr[6] - destination address, ethernet; | |
473 | *** proto - protocol type (ARP, IP, etc); | |
474 | *** size - size of the non-header part of the packet that needs transmitted; | |
475 | *** pkt - the pointer to the packet data itself. | |
476 | ***/ | |
477 | static void | |
54d4b877 | 478 | a3c90x_transmit(struct pbuf *p) |
31ddf9b3 | 479 | { |
31ddf9b3 | 480 | unsigned char status; |
3dd054cf | 481 | static unsigned int stillwaiting = 0; |
54d4b877 | 482 | unsigned int n, len; |
3dd054cf | 483 | |
037ce545 JW |
484 | _issue_command(INF_3C90X.IOAddr, cmdStallCtl, 2 /* Stall download */); |
485 | ||
486 | /** Setup the DPD (download descriptor) **/ | |
487 | INF_3C90X.TransmitDPD.DnNextPtr = 0; | |
54d4b877 JW |
488 | len = 0; |
489 | n = 0; | |
490 | for (; p; p = p->next) | |
491 | { | |
492 | INF_3C90X.TransmitDPD.segments[n].addr = (unsigned int)p->payload; | |
493 | INF_3C90X.TransmitDPD.segments[n].len = p->len | (p->next ? 0 : (1 << 31)); | |
494 | len += p->len; | |
495 | n++; | |
496 | } | |
037ce545 | 497 | /** set notification for transmission completion (bit 15) **/ |
54d4b877 | 498 | INF_3C90X.TransmitDPD.FrameStartHeader = (len) | 0x8000; |
037ce545 | 499 | |
54d4b877 JW |
500 | outputf("3c90x: Sending %d byte %d seg packet", len, n); |
501 | ||
037ce545 JW |
502 | /** Send the packet **/ |
503 | outl(INF_3C90X.IOAddr + regDnListPtr_l, v2p(&(INF_3C90X.TransmitDPD))); | |
504 | _issue_command(INF_3C90X.IOAddr, cmdStallCtl, 3 /* Unstall download */); | |
31ddf9b3 | 505 | |
037ce545 JW |
506 | oneshot_start_ms(10); |
507 | while((inl(INF_3C90X.IOAddr + regDnListPtr_l) != 0) && oneshot_running()) | |
508 | ; | |
509 | if (!oneshot_running()) | |
510 | { | |
511 | outputf("3c90x: Download engine pointer timeout"); | |
512 | return; | |
513 | } | |
3dd054cf | 514 | |
037ce545 JW |
515 | oneshot_start_ms(10); |
516 | stillwaiting = 1; | |
2a44d504 JW |
517 | if (stillwaiting) |
518 | { | |
519 | while (!(inw(INF_3C90X.IOAddr + regCommandIntStatus_w) & INT_TXCOMPLETE) && oneshot_running()) | |
520 | ; | |
521 | if (!(inw(INF_3C90X.IOAddr + regCommandIntStatus_w) & INT_TXCOMPLETE)) | |
522 | { | |
523 | outputf("3c90x: tx timeout? txstat %02x", inb(INF_3C90X.IOAddr + regTxStatus_b)); | |
524 | outputf("3c90x: Gen sts %04x", inw(INF_3C90X.IOAddr + regCommandIntStatus_w)); | |
525 | } | |
526 | status = inb(INF_3C90X.IOAddr + regTxStatus_b); | |
527 | outb(INF_3C90X.IOAddr + regTxStatus_b, 0x00); | |
528 | stillwaiting = 0; | |
529 | } | |
31ddf9b3 | 530 | |
3dd054cf | 531 | #if 0 |
037ce545 JW |
532 | /** successful completion (sans "interrupt Requested" bit) **/ |
533 | if ((status & 0xbf) == 0x80) | |
534 | return; | |
31ddf9b3 | 535 | |
037ce545 JW |
536 | outputf("3c90x: Status (%hhX)", status); |
537 | /** check error codes **/ | |
538 | if (status & 0x02) | |
539 | { | |
540 | outputf("3c90x: Tx Reclaim Error (%hhX)", status); | |
541 | a3c90x_reset(); | |
542 | } else if (status & 0x04) { | |
543 | outputf("3c90x: Tx Status Overflow (%hhX)", status); | |
544 | for (i=0; i<32; i++) | |
545 | _outb(0x00, INF_3C90X.IOAddr + regTxStatus_b); | |
546 | /** must re-enable after max collisions before re-issuing tx **/ | |
547 | _issue_command(INF_3C90X.IOAddr, cmdTxEnable, 0); | |
548 | } else if (status & 0x08) { | |
549 | outputf("3c90x: Tx Max Collisions (%hhX)", status); | |
550 | /** must re-enable after max collisions before re-issuing tx **/ | |
551 | _issue_command(INF_3C90X.IOAddr, cmdTxEnable, 0); | |
552 | } else if (status & 0x10) { | |
553 | outputf("3c90x: Tx Underrun (%hhX)", status); | |
554 | a3c90x_reset(); | |
555 | } else if (status & 0x20) { | |
556 | outputf("3c90x: Tx Jabber (%hhX)", status); | |
557 | a3c90x_reset(); | |
558 | } else if ((status & 0x80) != 0x80) { | |
559 | outputf("3c90x: Internal Error - Incomplete Transmission (%hhX)", status); | |
560 | a3c90x_reset(); | |
748534f4 | 561 | } |
037ce545 | 562 | #endif |
31ddf9b3 | 563 | } |
748534f4 JP |
564 | |
565 | ||
566 | ||
567 | /*** a3c90x_poll: exported routine that waits for a certain length of time | |
568 | *** for a packet, and if it sees none, returns 0. This routine should | |
569 | *** copy the packet to nic->packet if it gets a packet and set the size | |
570 | *** in nic->packetlen. Return 1 if a packet was found. | |
571 | ***/ | |
572 | static int | |
573 | a3c90x_poll(struct nic *nic, int retrieve) | |
574 | { | |
575 | int i, errcode; | |
576 | ||
577 | if (!(inw(INF_3C90X.IOAddr + regCommandIntStatus_w)&0x0010)) | |
578 | { | |
579 | return 0; | |
580 | } | |
581 | ||
582 | if ( ! retrieve ) return 1; | |
583 | ||
584 | /** we don't need to acknowledge rxComplete -- the upload engine | |
585 | ** does it for us. | |
586 | **/ | |
587 | ||
588 | /** Build the up-load descriptor **/ | |
589 | INF_3C90X.ReceiveUPD.UpNextPtr = 0; | |
590 | INF_3C90X.ReceiveUPD.UpPktStatus = 0; | |
923ea2c2 | 591 | INF_3C90X.ReceiveUPD.DataAddr = v2p(nic->packet); |
748534f4 JP |
592 | INF_3C90X.ReceiveUPD.DataLength = 1536 + (1<<31); |
593 | ||
594 | /** Submit the upload descriptor to the NIC **/ | |
923ea2c2 | 595 | _outl(v2p(&(INF_3C90X.ReceiveUPD)), |
748534f4 JP |
596 | INF_3C90X.IOAddr + regUpListPtr_l); |
597 | ||
598 | /** Wait for upload completion (upComplete(15) or upError (14)) **/ | |
599 | for(i=0;i<40000;i++); | |
600 | while((INF_3C90X.ReceiveUPD.UpPktStatus & ((1<<14) | (1<<15))) == 0) | |
601 | for(i=0;i<40000;i++); | |
602 | ||
603 | /** Check for Error (else we have good packet) **/ | |
604 | if (INF_3C90X.ReceiveUPD.UpPktStatus & (1<<14)) | |
605 | { | |
606 | errcode = INF_3C90X.ReceiveUPD.UpPktStatus; | |
607 | if (errcode & (1<<16)) | |
608 | outputf("3C90X: Rx Overrun (%hX)",errcode>>16); | |
609 | else if (errcode & (1<<17)) | |
610 | outputf("3C90X: Runt Frame (%hX)",errcode>>16); | |
611 | else if (errcode & (1<<18)) | |
612 | outputf("3C90X: Alignment Error (%hX)",errcode>>16); | |
613 | else if (errcode & (1<<19)) | |
614 | outputf("3C90X: CRC Error (%hX)",errcode>>16); | |
615 | else if (errcode & (1<<20)) | |
616 | outputf("3C90X: Oversized Frame (%hX)",errcode>>16); | |
617 | else | |
618 | outputf("3C90X: Packet error (%hX)",errcode>>16); | |
619 | return 0; | |
620 | } | |
621 | ||
622 | /** Ok, got packet. Set length in nic->packetlen. **/ | |
623 | nic->packetlen = (INF_3C90X.ReceiveUPD.UpPktStatus & 0x1FFF); | |
624 | ||
625 | return 1; | |
626 | } | |
627 | ||
628 | ||
629 | ||
630 | /*** a3c90x_disable: exported routine to disable the card. What's this for? | |
631 | *** the eepro100.c driver didn't have one, so I just left this one empty too. | |
632 | *** Ideas anyone? | |
633 | *** Must turn off receiver at least so stray packets will not corrupt memory | |
634 | *** [Ken] | |
635 | ***/ | |
636 | void a3c90x_disable(struct dev *dev) | |
637 | { | |
638 | /* reset and disable merge */ | |
639 | a3c90x_reset(); | |
640 | /* Disable the receiver and transmitter. */ | |
c2e34447 JW |
641 | _outw(cmdRxDisable, INF_3C90X.IOAddr + regCommandIntStatus_w); |
642 | _outw(cmdTxDisable, INF_3C90X.IOAddr + regCommandIntStatus_w); | |
748534f4 JP |
643 | } |
644 | ||
645 | ||
646 | /*** a3c90x_probe: exported routine to probe for the 3c905 card and perform | |
647 | *** initialization. If this routine is called, the pci functions did find the | |
648 | *** card. We just have to init it here. | |
649 | ***/ | |
650 | static int a3c90x_probe(struct pci_dev * pci, void * data) | |
651 | { | |
748534f4 JP |
652 | INF_3C90X.is3c556 = (pci->did == 0x6055); |
653 | ||
654 | int i, c; | |
c2e34447 | 655 | unsigned short eeprom[0x100]; |
748534f4 JP |
656 | unsigned int cfg; |
657 | unsigned int mopt; | |
658 | unsigned int mstat; | |
659 | unsigned short linktype; | |
660 | #define HWADDR_OFFSET 10 | |
661 | ||
662 | unsigned long ioaddr = 0; | |
663 | for (i = 0; i < 6; i++) { | |
664 | if (pci->bars[i].type == PCI_BAR_IO) { | |
665 | ioaddr = pci->bars[i].addr; | |
666 | break; | |
667 | } | |
668 | } | |
669 | ||
670 | if (ioaddr == 0) | |
c2e34447 JW |
671 | { |
672 | outputf("3c90x: Unable to find I/O address"); | |
673 | return 0; | |
674 | } | |
675 | ||
676 | /* Power it on */ | |
677 | pci_write16(pci->bus, pci->dev, pci->fn, 0xE0, | |
678 | pci_read16(pci->bus, pci->dev, pci->fn, 0xE0) & ~0x3); | |
679 | ||
680 | outputf("3c90x: Picked I/O address %04x", ioaddr); | |
047916ed | 681 | pci_bother_add(pci); |
42125f27 JP |
682 | nic.ioaddr = ioaddr & ~3; |
683 | nic.irqno = 0; | |
748534f4 | 684 | |
c2e34447 | 685 | INF_3C90X.IOAddr = ioaddr; |
748534f4 JP |
686 | INF_3C90X.CurrentWindow = 255; |
687 | switch (a3c90x_internal_ReadEeprom(INF_3C90X.IOAddr, 0x03)) | |
688 | { | |
689 | case 0x9000: /** 10 Base TPO **/ | |
690 | case 0x9001: /** 10/100 T4 **/ | |
691 | case 0x9050: /** 10/100 TPO **/ | |
692 | case 0x9051: /** 10 Base Combo **/ | |
693 | INF_3C90X.isBrev = 0; | |
694 | break; | |
695 | ||
696 | case 0x9004: /** 10 Base TPO **/ | |
697 | case 0x9005: /** 10 Base Combo **/ | |
698 | case 0x9006: /** 10 Base TPO and Base2 **/ | |
699 | case 0x900A: /** 10 Base FL **/ | |
700 | case 0x9055: /** 10/100 TPO **/ | |
701 | case 0x9056: /** 10/100 T4 **/ | |
702 | case 0x905A: /** 10 Base FX **/ | |
703 | default: | |
704 | INF_3C90X.isBrev = 1; | |
705 | break; | |
706 | } | |
707 | ||
708 | /** Load the EEPROM contents **/ | |
709 | if (INF_3C90X.isBrev) | |
710 | { | |
c2e34447 | 711 | for(i=0;i<=/*0x20*/0x7F;i++) |
748534f4 JP |
712 | { |
713 | eeprom[i] = a3c90x_internal_ReadEeprom(INF_3C90X.IOAddr, i); | |
714 | } | |
715 | ||
716 | #ifdef CFG_3C90X_BOOTROM_FIX | |
717 | /** Set xcvrSelect in InternalConfig in eeprom. **/ | |
718 | /* only necessary for 3c905b revision cards with boot PROM bug!!! */ | |
719 | a3c90x_internal_WriteEeprom(INF_3C90X.IOAddr, 0x13, 0x0160); | |
720 | #endif | |
721 | ||
722 | #ifdef CFG_3C90X_XCVR | |
723 | if (CFG_3C90X_XCVR == 255) | |
724 | { | |
725 | /** Clear the LanWorks register **/ | |
726 | a3c90x_internal_WriteEeprom(INF_3C90X.IOAddr, 0x16, 0); | |
727 | } | |
728 | else | |
729 | { | |
730 | /** Set the selected permanent-xcvrSelect in the | |
731 | ** LanWorks register | |
732 | **/ | |
733 | a3c90x_internal_WriteEeprom(INF_3C90X.IOAddr, 0x16, | |
734 | XCVR_MAGIC + ((CFG_3C90X_XCVR) & 0x000F)); | |
735 | } | |
736 | #endif | |
737 | } | |
738 | else | |
739 | { | |
c2e34447 | 740 | for(i=0;i<=/*0x17*/0x7F;i++) |
748534f4 JP |
741 | { |
742 | eeprom[i] = a3c90x_internal_ReadEeprom(INF_3C90X.IOAddr, i); | |
743 | } | |
744 | } | |
745 | ||
746 | /** Print identification message **/ | |
747 | #ifdef CFG_3C90X_BOOTROM_FIX | |
748 | if (INF_3C90X.isBrev) | |
749 | { | |
750 | outputf("NOTE: 3c905b bootrom fix enabled; has side " | |
751 | "effects. See 3c90x.txt for info."); | |
752 | } | |
753 | #endif | |
754 | ||
755 | /** Retrieve the Hardware address and print it on the screen. **/ | |
756 | INF_3C90X.HWAddr[0] = eeprom[HWADDR_OFFSET + 0]>>8; | |
757 | INF_3C90X.HWAddr[1] = eeprom[HWADDR_OFFSET + 0]&0xFF; | |
758 | INF_3C90X.HWAddr[2] = eeprom[HWADDR_OFFSET + 1]>>8; | |
759 | INF_3C90X.HWAddr[3] = eeprom[HWADDR_OFFSET + 1]&0xFF; | |
760 | INF_3C90X.HWAddr[4] = eeprom[HWADDR_OFFSET + 2]>>8; | |
761 | INF_3C90X.HWAddr[5] = eeprom[HWADDR_OFFSET + 2]&0xFF; | |
c2e34447 JW |
762 | outputf("MAC Address = %02x:%02x:%02x:%02x:%02x:%02x", |
763 | INF_3C90X.HWAddr[0], | |
764 | INF_3C90X.HWAddr[1], | |
765 | INF_3C90X.HWAddr[2], | |
766 | INF_3C90X.HWAddr[3], | |
767 | INF_3C90X.HWAddr[4], | |
768 | INF_3C90X.HWAddr[5]); | |
748534f4 JP |
769 | |
770 | /** 3C556: Invert MII power **/ | |
771 | if (INF_3C90X.is3c556) { | |
772 | unsigned int tmp; | |
31ddf9b3 | 773 | _set_window(INF_3C90X.IOAddr, winAddressing2); |
748534f4 JP |
774 | tmp = inw(INF_3C90X.IOAddr + regResetOptions_2_w); |
775 | tmp |= 0x4000; | |
c2e34447 | 776 | _outw(tmp, INF_3C90X.IOAddr + regResetOptions_2_w); |
748534f4 JP |
777 | } |
778 | ||
779 | /* Test if the link is good, if not continue */ | |
31ddf9b3 | 780 | _set_window(INF_3C90X.IOAddr, winDiagnostics4); |
748534f4 JP |
781 | mstat = inw(INF_3C90X.IOAddr + regMediaStatus_4_w); |
782 | if((mstat & (1<<11)) == 0) { | |
783 | outputf("Valid link not established"); | |
784 | return 0; | |
785 | } | |
786 | ||
787 | /** Program the MAC address into the station address registers **/ | |
31ddf9b3 | 788 | _set_window(INF_3C90X.IOAddr, winAddressing2); |
c2e34447 JW |
789 | _outw(htons(eeprom[HWADDR_OFFSET + 0]), INF_3C90X.IOAddr + regStationAddress_2_3w); |
790 | _outw(htons(eeprom[HWADDR_OFFSET + 1]), INF_3C90X.IOAddr + regStationAddress_2_3w+2); | |
791 | _outw(htons(eeprom[HWADDR_OFFSET + 2]), INF_3C90X.IOAddr + regStationAddress_2_3w+4); | |
792 | _outw(0, INF_3C90X.IOAddr + regStationMask_2_3w+0); | |
793 | _outw(0, INF_3C90X.IOAddr + regStationMask_2_3w+2); | |
794 | _outw(0, INF_3C90X.IOAddr + regStationMask_2_3w+4); | |
748534f4 JP |
795 | |
796 | /** Fill in our entry in the etherboot arp table **/ | |
797 | /* XXX ? for lwip? | |
798 | for(i=0;i<ETH_ALEN;i++) | |
42125f27 | 799 | nic.node_addr[i] = (eeprom[HWADDR_OFFSET + i/2] >> (8*((i&1)^1))) & 0xff; |
748534f4 JP |
800 | */ |
801 | ||
802 | /** Read the media options register, print a message and set default | |
803 | ** xcvr. | |
804 | ** | |
805 | ** Uses Media Option command on B revision, Reset Option on non-B | |
806 | ** revision cards -- same register address | |
807 | **/ | |
31ddf9b3 | 808 | _set_window(INF_3C90X.IOAddr, winTxRxOptions3); |
748534f4 JP |
809 | mopt = inw(INF_3C90X.IOAddr + regResetMediaOptions_3_w); |
810 | ||
811 | /** mask out VCO bit that is defined as 10baseFL bit on B-rev cards **/ | |
812 | if (! INF_3C90X.isBrev) | |
813 | { | |
814 | mopt &= 0x7F; | |
815 | } | |
816 | ||
817 | outputf("Connectors present: "); | |
818 | c = 0; | |
819 | linktype = 0x0008; | |
820 | if (mopt & 0x01) | |
821 | { | |
822 | outputf("%s100Base-T4",(c++)?", ":""); | |
823 | linktype = 0x0006; | |
824 | } | |
825 | if (mopt & 0x04) | |
826 | { | |
827 | outputf("%s100Base-FX",(c++)?", ":""); | |
828 | linktype = 0x0005; | |
829 | } | |
830 | if (mopt & 0x10) | |
831 | { | |
832 | outputf("%s10Base-2",(c++)?", ":""); | |
833 | linktype = 0x0003; | |
834 | } | |
835 | if (mopt & 0x20) | |
836 | { | |
837 | outputf("%sAUI",(c++)?", ":""); | |
838 | linktype = 0x0001; | |
839 | } | |
840 | if (mopt & 0x40) | |
841 | { | |
842 | outputf("%sMII",(c++)?", ":""); | |
843 | linktype = 0x0006; | |
844 | } | |
845 | if ((mopt & 0xA) == 0xA) | |
846 | { | |
847 | outputf("%s10Base-T / 100Base-TX",(c++)?", ":""); | |
848 | linktype = 0x0008; | |
849 | } | |
850 | else if ((mopt & 0xA) == 0x2) | |
851 | { | |
852 | outputf("%s100Base-TX",(c++)?", ":""); | |
853 | linktype = 0x0008; | |
854 | } | |
855 | else if ((mopt & 0xA) == 0x8) | |
856 | { | |
857 | outputf("%s10Base-T",(c++)?", ":""); | |
858 | linktype = 0x0008; | |
859 | } | |
860 | outputf("."); | |
861 | ||
862 | /** Determine transceiver type to use, depending on value stored in | |
863 | ** eeprom 0x16 | |
864 | **/ | |
865 | if (INF_3C90X.isBrev) | |
866 | { | |
867 | if ((eeprom[0x16] & 0xFF00) == XCVR_MAGIC) | |
868 | { | |
869 | /** User-defined **/ | |
870 | linktype = eeprom[0x16] & 0x000F; | |
871 | } | |
872 | } | |
873 | else | |
874 | { | |
875 | #ifdef CFG_3C90X_XCVR | |
876 | if (CFG_3C90X_XCVR != 255) | |
877 | linktype = CFG_3C90X_XCVR; | |
878 | #endif /* CFG_3C90X_XCVR */ | |
879 | ||
880 | /** I don't know what MII MAC only mode is!!! **/ | |
881 | if (linktype == 0x0009) | |
882 | { | |
883 | if (INF_3C90X.isBrev) | |
884 | outputf("WARNING: MII External MAC Mode only supported on B-revision " | |
885 | "cards!!!!\nFalling Back to MII Mode\n"); | |
886 | linktype = 0x0006; | |
887 | } | |
888 | } | |
889 | ||
890 | /** enable DC converter for 10-Base-T **/ | |
891 | if (linktype == 0x0003) | |
892 | { | |
31ddf9b3 | 893 | _issue_command(INF_3C90X.IOAddr, cmdEnableDcConverter, 0); |
748534f4 JP |
894 | } |
895 | ||
896 | /** Set the link to the type we just determined. **/ | |
31ddf9b3 | 897 | _set_window(INF_3C90X.IOAddr, winTxRxOptions3); |
748534f4 JP |
898 | cfg = inl(INF_3C90X.IOAddr + regInternalConfig_3_l); |
899 | cfg &= ~(0xF<<20); | |
900 | cfg |= (linktype<<20); | |
c2e34447 | 901 | _outl(cfg, INF_3C90X.IOAddr + regInternalConfig_3_l); |
748534f4 JP |
902 | |
903 | /** Now that we set the xcvr type, reset the Tx and Rx, re-enable. **/ | |
31ddf9b3 | 904 | _issue_command(INF_3C90X.IOAddr, cmdTxReset, 0); |
748534f4 | 905 | if (!INF_3C90X.isBrev) |
c2e34447 | 906 | _outb(0x01, INF_3C90X.IOAddr + regTxFreeThresh_b); |
748534f4 | 907 | |
31ddf9b3 | 908 | _issue_command(INF_3C90X.IOAddr, cmdTxEnable, 0); |
748534f4 JP |
909 | |
910 | /** | |
911 | ** reset of the receiver on B-revision cards re-negotiates the link | |
912 | ** takes several seconds (a computer eternity) | |
913 | **/ | |
914 | if (INF_3C90X.isBrev) | |
31ddf9b3 | 915 | _issue_command(INF_3C90X.IOAddr, cmdRxReset, 0x04); |
748534f4 | 916 | else |
31ddf9b3 | 917 | _issue_command(INF_3C90X.IOAddr, cmdRxReset, 0x00); |
748534f4 JP |
918 | |
919 | /** Set the RX filter = receive only individual pkts & multicast & bcast. **/ | |
31ddf9b3 JW |
920 | _issue_command(INF_3C90X.IOAddr, cmdSetRxFilter, 0x01 + 0x02 + 0x04); |
921 | _issue_command(INF_3C90X.IOAddr, cmdRxEnable, 0); | |
748534f4 JP |
922 | |
923 | ||
924 | /** | |
925 | ** set Indication and Interrupt flags , acknowledge any IRQ's | |
926 | **/ | |
31ddf9b3 JW |
927 | _issue_command(INF_3C90X.IOAddr, cmdSetInterruptEnable, 0); |
928 | _issue_command(INF_3C90X.IOAddr, cmdSetIndicationEnable, 0x0014); | |
929 | _issue_command(INF_3C90X.IOAddr, cmdAcknowledgeInterrupt, 0x661); | |
748534f4 JP |
930 | |
931 | /* * Set our exported functions **/ | |
42125f27 JP |
932 | nic.poll = a3c90x_poll; |
933 | nic.transmit = a3c90x_transmit; | |
47c41031 | 934 | memcpy(nic.hwaddr, INF_3C90X.HWAddr, 6); |
c2e34447 | 935 | eth_register(&nic); |
748534f4 JP |
936 | |
937 | return 1; | |
938 | } | |
939 | ||
940 | static struct pci_id a3c90x_nics[] = { | |
941 | /* Original 90x revisions: */ | |
942 | PCI_ROM(0x10b7, 0x6055, "3c556", "3C556"), /* Huricane */ | |
943 | PCI_ROM(0x10b7, 0x9000, "3c905-tpo", "3Com900-TPO"), /* 10 Base TPO */ | |
944 | PCI_ROM(0x10b7, 0x9001, "3c905-t4", "3Com900-Combo"), /* 10/100 T4 */ | |
945 | PCI_ROM(0x10b7, 0x9050, "3c905-tpo100", "3Com905-TX"), /* 100 Base TX / 10/100 TPO */ | |
946 | PCI_ROM(0x10b7, 0x9051, "3c905-combo", "3Com905-T4"), /* 100 Base T4 / 10 Base Combo */ | |
947 | /* Newer 90xB revisions: */ | |
948 | PCI_ROM(0x10b7, 0x9004, "3c905b-tpo", "3Com900B-TPO"), /* 10 Base TPO */ | |
949 | PCI_ROM(0x10b7, 0x9005, "3c905b-combo", "3Com900B-Combo"), /* 10 Base Combo */ | |
950 | PCI_ROM(0x10b7, 0x9006, "3c905b-tpb2", "3Com900B-2/T"), /* 10 Base TP and Base2 */ | |
951 | PCI_ROM(0x10b7, 0x900a, "3c905b-fl", "3Com900B-FL"), /* 10 Base FL */ | |
952 | PCI_ROM(0x10b7, 0x9055, "3c905b-tpo100", "3Com905B-TX"), /* 10/100 TPO */ | |
953 | PCI_ROM(0x10b7, 0x9056, "3c905b-t4", "3Com905B-T4"), /* 10/100 T4 */ | |
954 | PCI_ROM(0x10b7, 0x9058, "3c905b-9058", "3Com905B-9058"), /* Cyclone 10/100/BNC */ | |
955 | PCI_ROM(0x10b7, 0x905a, "3c905b-fx", "3Com905B-FL"), /* 100 Base FX / 10 Base FX */ | |
956 | /* Newer 90xC revision: */ | |
957 | PCI_ROM(0x10b7, 0x9200, "3c905c-tpo", "3Com905C-TXM"), /* 10/100 TPO (3C905C-TXM) */ | |
958 | PCI_ROM(0x10b7, 0x9202, "3c920b-emb-ati", "3c920B-EMB-WNM (ATI Radeon 9100 IGP)"), /* 3c920B-EMB-WNM (ATI Radeon 9100 IGP) */ | |
959 | PCI_ROM(0x10b7, 0x9210, "3c920b-emb-wnm","3Com20B-EMB WNM"), | |
960 | PCI_ROM(0x10b7, 0x9800, "3c980", "3Com980-Cyclone"), /* Cyclone */ | |
961 | PCI_ROM(0x10b7, 0x9805, "3c9805", "3Com9805"), /* Dual Port Server Cyclone */ | |
962 | PCI_ROM(0x10b7, 0x7646, "3csoho100-tx", "3CSOHO100-TX"), /* Hurricane */ | |
963 | PCI_ROM(0x10b7, 0x4500, "3c450", "3Com450 HomePNA Tornado"), | |
964 | PCI_ROM(0x10b7, 0x1201, "3c982a", "3Com982A"), | |
965 | PCI_ROM(0x10b7, 0x1202, "3c982b", "3Com982B"), | |
966 | }; | |
967 | ||
968 | struct pci_driver a3c90x_driver = { | |
969 | .name = "3C90X", | |
970 | .probe = a3c90x_probe, | |
971 | .ids = a3c90x_nics, | |
972 | .id_count = sizeof(a3c90x_nics)/sizeof(a3c90x_nics[0]), | |
973 | }; |