• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2001 Sun Microsystems (thockin@sun.com) */
2 #include <stdio.h>
3 #include "internal.h"
4 
5 static const char * const csr0_tap[4] = {
6 	"No transmit automatic polling",
7 	"Transmit automatic polling every 200 seconds",
8 	"Transmit automatic polling every 800 seconds",
9 	"Transmit automatic polling every 1.6 milliseconds",
10 };
11 
12 static const char * const csr0_cache_al[4] = {
13 	"not used",
14 	"8-longword boundary alignment",
15 	"16-longword boundary alignment",
16 	"32-longword boundary alignment",
17 };
18 
19 static const char * const csr5_buserr[8] = {
20 	"      Bus error: parity",
21 	"      Bus error: master abort",
22 	"      Bus error: target abort",
23 	"      Bus error: (unknown code, reserved)",
24 	"      Bus error: (unknown code, reserved)",
25 	"      Bus error: (unknown code, reserved)",
26 	"      Bus error: (unknown code, reserved)",
27 	"      Bus error: (unknown code, reserved)",
28 };
29 
30 static const int csr6_tx_thresh[4] = {
31 	72,
32 	96,
33 	128,
34 	160,
35 };
36 
37 static const char * const csr6_om[4] = {
38 	"normal",
39 	"internal loopback",
40 	"external loopback",
41 	"unknown (not used)",
42 };
43 
44 static const char * const csr5_tx_state[8] = {
45 	"stopped",
46 	"running: fetch desc",
47 	"running: wait xmit end",
48 	"running: read buf",
49 	"unknown (reserved)",
50 	"running: setup packet",
51 	"suspended",
52 	"running: close desc",
53 };
54 
55 static const char * const csr5_rx_state[8] = {
56 	"stopped",
57 	"running: fetch desc",
58 	"running: chk pkt end",
59 	"running: wait for pkt",
60 	"suspended",
61 	"running: close",
62 	"running: flush",
63 	"running: queue",
64 };
65 
66 static const char * const csr12_nway_state[8] = {
67 	"Autonegotiation disable",
68 	"Transmit disable",
69 	"Ability detect",
70 	"Acknowledge detect",
71 	"Complete acknowledge",
72 	"FLP link good, nway complete",
73 	"Link check",
74 	"unknown (reserved)",
75 };
76 
77 static const char * const csr14_tp_comp[4] = {
78 	"Compensation Disabled Mode",
79 	"Compensation Disabled Mode",
80 	"High Power Mode",
81 	"Normal Compensation Mode",
82 };
83 
84 static void
print_ring_addresses(u32 csr3,u32 csr4)85 print_ring_addresses(u32 csr3, u32 csr4)
86 {
87 	fprintf(stdout,
88 		"0x18: CSR3 (Rx Ring Base Address)        0x%08x\n"
89 		"0x20: CSR4 (Tx Ring Base Address)        0x%08x\n"
90 		,
91 		csr3,
92 		csr4);
93 }
94 
95 static void
print_rx_missed(u32 csr8)96 print_rx_missed(u32 csr8)
97 {
98 	fprintf(stdout,
99 		"0x40: CSR8 (Missed Frames Counter)       0x%08x\n", csr8);
100 	if (csr8 & (1 << 16))
101 		fprintf(stdout,
102 		"      Counter overflow\n");
103 	else {
104 		unsigned int rx_missed = csr8 & 0xffff;
105 		if (!rx_missed)
106 			fprintf(stdout,
107 			"      No missed frames\n");
108 		else
109 			fprintf(stdout,
110 			"      %u missed frames\n", rx_missed);
111 	}
112 }
113 
de21040_dump_regs(struct ethtool_drvinfo * info maybe_unused,struct ethtool_regs * regs)114 static void de21040_dump_regs(struct ethtool_drvinfo *info maybe_unused,
115 			      struct ethtool_regs *regs)
116 {
117 	u32 tmp, v, *data = (u32 *)regs->data;
118 
119 	fprintf(stdout, "21040 Registers\n");
120 	fprintf(stdout, "---------------\n");
121 
122 	/*
123 	 * CSR0
124 	 */
125 	v = data[0];
126 	fprintf(stdout,
127 		"0x00: CSR0 (Bus Mode)                    0x%08x\n"
128 		"      %s\n"
129 		"      %s address space\n"
130 		"      Cache alignment: %s\n"
131 		,
132 		v,
133 		csr0_tap[(v >> 17) & 3],
134 		v & (1 << 16) ? "Diagnostic" : "Standard",
135 		csr0_cache_al[(v >> 14) & 3]);
136 	tmp = (v >> 8) & 0x3f;
137 	if (tmp == 0)
138 		fprintf(stdout, "      Programmable burst length unlimited\n");
139 	else
140 		fprintf(stdout,
141 			"      Programmable burst length %d longwords\n",
142 			tmp);
143 	fprintf(stdout,
144 		"      %s endian data buffers\n"
145 		"      Descriptor skip length %d longwords\n"
146 		"      %s bus arbitration scheme\n"
147 		,
148 		v & (1 << 7) ? "Big" : "Little",
149 		(v >> 2) & 0x1f,
150 		v & (1 << 1) ? "Round-robin" : "RX-has-priority");
151 	if (v & (1 << 0))
152 		fprintf(stdout, "      Software reset asserted\n");
153 
154 	/*
155 	 * CSR3, 4
156 	 */
157 	print_ring_addresses(data[3], data[4]);
158 
159 	/*
160 	 * CSR5
161 	 */
162 	v = data[5];
163 	fprintf(stdout,
164 		"0x28: CSR5 (Status)                      0x%08x\n"
165 		"%s"
166 		"      Transmit process %s\n"
167 		"      Receive process %s\n"
168 		"      Link %s\n"
169 		,
170 		v,
171 		v & (1 << 13) ? csr5_buserr[(v >> 23) & 0x7] : "",
172 		csr5_tx_state[(v >> 20) & 0x7],
173 		csr5_rx_state[(v >> 17) & 0x7],
174 		v & (1 << 12) ? "fail" : "OK");
175 	if (v & (1 << 16))
176 		fprintf(stdout,
177 		"      Normal interrupts: %s%s%s\n"
178 		,
179 		v & (1 << 0) ? "TxOK " : "",
180 		v & (1 << 2) ? "TxNoBufs " : "",
181 		v & (1 << 6) ? "RxOK" : "");
182 	if (v & (1 << 15))
183 		fprintf(stdout,
184 		"      Abnormal intr: %s%s%s%s%s%s%s%s\n"
185 		,
186 		v & (1 << 1) ? "TxStop " : "",
187 		v & (1 << 3) ? "TxJabber " : "",
188 		v & (1 << 5) ? "TxUnder " : "",
189 		v & (1 << 7) ? "RxNoBufs " : "",
190 		v & (1 << 8) ? "RxStopped " : "",
191 		v & (1 << 9) ? "RxTimeout " : "",
192 		v & (1 << 10) ? "AUI_TP " : "",
193 		v & (1 << 11) ? "FD_Short " : "");
194 
195 	/*
196 	 * CSR6
197 	 */
198 	v = data[6];
199 	fprintf(stdout,
200 		"0x30: CSR6 (Operating Mode)              0x%08x\n"
201 		"%s"
202 		"%s"
203 		"      Transmit threshold %d bytes\n"
204 		"      Transmit DMA %sabled\n"
205 		"%s"
206 		"      Operating mode: %s\n"
207 		"      %s duplex\n"
208 		"%s"
209 		"%s"
210 		"%s"
211 		"%s"
212 		"%s"
213 		"%s"
214 		"%s"
215 		"      Receive DMA %sabled\n"
216 		"      %s filtering mode\n"
217 		,
218 		v,
219 		v & (1<<17) ? "      Capture effect enabled\n" : "",
220 		v & (1<<16) ? "      Back pressure enabled\n" : "",
221 		csr6_tx_thresh[(v >> 14) & 3],
222 		v & (1<<13) ? "en" : "dis",
223 		v & (1<<12) ? "      Forcing collisions\n" : "",
224 		csr6_om[(v >> 10) & 3],
225 		v & (1<<9) ? "Full" : "Half",
226 		v & (1<<8) ? "      Flaky oscillator disable\n" : "",
227 		v & (1<<7) ? "      Pass All Multicast\n" : "",
228 		v & (1<<6) ? "      Promisc Mode\n" : "",
229 		v & (1<<5) ? "      Start/Stop Backoff Counter\n" : "",
230 		v & (1<<4) ? "      Inverse Filtering\n" : "",
231 		v & (1<<3) ? "      Pass Bad Frames\n" : "",
232 		v & (1<<2) ? "      Hash-only Filtering\n" : "",
233 		v & (1<<1) ? "en" : "dis",
234 		v & (1<<0) ? "Hash" : "Perfect");
235 
236 	/*
237 	 * CSR7
238 	 */
239 	v = data[7];
240 	fprintf(stdout,
241 		"0x38: CSR7 (Interrupt Mask)              0x%08x\n"
242 		"%s"
243 		"%s"
244 		"%s"
245 		"%s"
246 		"%s"
247 		"%s"
248 		"%s"
249 		"%s"
250 		"%s"
251 		"%s"
252 		"%s"
253 		"%s"
254 		"%s"
255 		"%s"
256 		"%s"
257 		,
258 		v,
259 		v & (1<<16) ? "      Normal interrupt summary\n" : "",
260 		v & (1<<15) ? "      Abnormal interrupt summary\n" : "",
261 		v & (1<<13) ? "      System error\n" : "",
262 		v & (1<<12) ? "      Link fail\n" : "",
263 		v & (1<<11) ? "      Full duplex\n" : "",
264 		v & (1<<10) ? "      AUI_TP pin\n" : "",
265 		v & (1<<9) ? "      Receive watchdog timeout\n" : "",
266 		v & (1<<8) ? "      Receive stopped\n" : "",
267 		v & (1<<7) ? "      Receive buffer unavailable\n" : "",
268 		v & (1<<6) ? "      Receive interrupt\n" : "",
269 		v & (1<<5) ? "      Transmit underflow\n" : "",
270 		v & (1<<3) ? "      Transmit jabber timeout\n" : "",
271 		v & (1<<2) ? "      Transmit buffer unavailable\n" : "",
272 		v & (1<<1) ? "      Transmit stopped\n" : "",
273 		v & (1<<0) ? "      Transmit interrupt\n" : "");
274 
275 	/*
276 	 * CSR8
277 	 */
278 	print_rx_missed(data[8]);
279 
280 	/*
281 	 * CSR9
282 	 */
283 	v = data[9];
284 	fprintf(stdout,
285 		"0x48: CSR9 (Ethernet Address ROM)        0x%08x\n", v);
286 
287 	/*
288 	 * CSR11
289 	 */
290 	v = data[11];
291 	fprintf(stdout,
292 		"0x58: CSR11 (Full Duplex Autoconfig)     0x%08x\n", v);
293 
294 	/*
295 	 * CSR12
296 	 */
297 	v = data[12];
298 	fprintf(stdout,
299 		"0x60: CSR12 (SIA Status)                 0x%08x\n"
300 		"%s"
301 		"%s"
302 		"%s"
303 		"%s"
304 		"%s"
305 		"%s"
306 		"%s"
307 		"      AUI_TP pin: %s\n"
308 		,
309 		v,
310 		v & (1<<7) ? "      PLL sampler high\n" : "",
311 		v & (1<<6) ? "      PLL sampler low\n" : "",
312 		v & (1<<5) ? "      PLL self-test pass\n" : "",
313 		v & (1<<4) ? "      PLL self-test done\n" : "",
314 		v & (1<<3) ? "      Autopolarity state\n" : "",
315 		v & (1<<2) ? "      Link fail\n" : "",
316 		v & (1<<1) ? "      Network connection error\n" : "",
317 		v & (1<<0) ? "AUI" : "TP");
318 
319 	/*
320 	 * CSR13
321 	 */
322 	v = data[13];
323 	fprintf(stdout,
324 		"0x68: CSR13 (SIA Connectivity)           0x%08x\n"
325 		"%s"
326 		"%s"
327 		"%s"
328 		"%s"
329 		"      External port output multiplexer select: %u%u%u%u\n"
330 		"%s"
331 		"%s"
332 		"%s"
333 		"%s"
334 		"      %s interface selected\n"
335 		"%s"
336 		"%s"
337 		"%s"
338 		,
339 		v,
340 		v & (1<<15) ? "      Enable pins 5, 6, 7\n" : "",
341 		v & (1<<14) ? "      Enable pins 2, 4\n" : "",
342 		v & (1<<13) ? "      Enable pins 1, 3\n" : "",
343 		v & (1<<12) ? "      Input enable\n" : "",
344 		v & (1<<11) ? 1 : 0,
345 		v & (1<<10) ? 1 : 0,
346 		v & (1<<9) ? 1 : 0,
347 		v & (1<<8) ? 1 : 0,
348 		v & (1<<7) ? "      APLL start\n" : "",
349 		v & (1<<6) ? "      Serial interface input multiplexer\n" : "",
350 		v & (1<<5) ? "      Encoder input multiplexer\n" : "",
351 		v & (1<<4) ? "      SIA PLL external input enable\n" : "",
352 		v & (1<<3) ? "AUI" : "10base-T",
353 		v & (1<<2) ? "      CSR autoconfiguration\n" : "",
354 		v & (1<<1) ? "      AUI_TP pin autoconfiguration\n" : "",
355 		v & (1<<0) ? "      SIA reset\n" : "");
356 
357 	/*
358 	 * CSR14
359 	 */
360 	v = data[14];
361 	fprintf(stdout,
362 		"0x70: CSR14 (SIA Transmit and Receive)   0x%08x\n"
363 		"%s"
364 		"%s"
365 		"%s"
366 		"%s"
367 		"%s"
368 		"%s"
369 		"%s"
370 		"      %s\n"
371 		"%s"
372 		"%s"
373 		"%s"
374 		"%s"
375 		,
376 		v,
377 		v & (1<<14) ? "      Set polarity plus\n" : "",
378 		v & (1<<13) ? "      Autopolarity enable\n" : "",
379 		v & (1<<12) ? "      Link test enable\n" : "",
380 		v & (1<<11) ? "      Heartbeat enable\n" : "",
381 		v & (1<<10) ? "      Collision detect enable\n" : "",
382 		v & (1<<9) ? "      Collision squelch enable\n" : "",
383 		v & (1<<8) ? "      Receive squelch enable\n" : "",
384 		csr14_tp_comp[(v >> 4) & 0x3],
385 		v & (1<<3) ? "      Link pulse send enable\n" : "",
386 		v & (1<<2) ? "      Driver enable\n" : "",
387 		v & (1<<1) ? "      Loopback enable\n" : "",
388 		v & (1<<0) ? "      Encoder enable\n" : "");
389 
390 	/*
391 	 * CSR15
392 	 */
393 	v = data[15];
394 	fprintf(stdout,
395 		"0x78: CSR15 (SIA General)                0x%08x\n"
396 		"%s"
397 		"%s"
398 		"%s"
399 		"%s"
400 		"%s"
401 		"%s"
402 		"%s"
403 		"%s"
404 		"%s"
405 		"%s"
406 		,
407 		v,
408 		v & (1<<13) ? "      Force receiver low\n" : "",
409 		v & (1<<12) ? "      PLL self-test start\n" : "",
410 		v & (1<<11) ? "      Force link fail\n" : "",
411 		v & (1<<9) ? "      Force unsquelch\n" : "",
412 		v & (1<<8) ? "      Test clock\n" : "",
413 		v & (1<<5) ? "      Receive watchdog release\n" : "",
414 		v & (1<<4) ? "      Receive watchdog disable\n" : "",
415 		v & (1<<2) ? "      Jabber clock\n" : "",
416 		v & (1<<1) ? "      Host unjab\n" : "",
417 		v & (1<<0) ? "      Jabber disable\n" : "");
418 }
419 
de21041_dump_regs(struct ethtool_drvinfo * info maybe_unused,struct ethtool_regs * regs)420 static void de21041_dump_regs(struct ethtool_drvinfo *info maybe_unused,
421 			      struct ethtool_regs *regs)
422 {
423 	u32 tmp, v, *data = (u32 *)regs->data;
424 
425 	fprintf(stdout, "21041 Registers\n");
426 	fprintf(stdout, "---------------\n");
427 
428 	/*
429 	 * CSR0
430 	 */
431 	v = data[0];
432 	fprintf(stdout,
433 		"0x00: CSR0 (Bus Mode)                    0x%08x\n"
434 		"      %s endian descriptors\n"
435 		"      %s\n"
436 		"      %s address space\n"
437 		"      Cache alignment: %s\n"
438 		,
439 		v,
440 		v & (1 << 20) ? "Big" : "Little",
441 		csr0_tap[(v >> 17) & 3],
442 		v & (1 << 16) ? "Diagnostic" : "Standard",
443 		csr0_cache_al[(v >> 14) & 3]);
444 	tmp = (v >> 8) & 0x3f;
445 	if (tmp == 0)
446 		fprintf(stdout, "      Programmable burst length unlimited\n");
447 	else
448 		fprintf(stdout,
449 			"      Programmable burst length %d longwords\n",
450 			tmp);
451 	fprintf(stdout,
452 		"      %s endian data buffers\n"
453 		"      Descriptor skip length %d longwords\n"
454 		"      %s bus arbitration scheme\n"
455 		,
456 		v & (1 << 7) ? "Big" : "Little",
457 		(v >> 2) & 0x1f,
458 		v & (1 << 1) ? "Round-robin" : "RX-has-priority");
459 	if (v & (1 << 0))
460 		fprintf(stdout, "      Software reset asserted\n");
461 
462 	/*
463 	 * CSR3, 4
464 	 */
465 	print_ring_addresses(data[3], data[4]);
466 
467 	/*
468 	 * CSR5
469 	 */
470 	v = data[5];
471 	fprintf(stdout,
472 		"0x28: CSR5 (Status)                      0x%08x\n"
473 		"%s"
474 		"      Transmit process %s\n"
475 		"      Receive process %s\n"
476 		"      Link %s\n"
477 		,
478 		v,
479 		v & (1 << 13) ? csr5_buserr[(v >> 23) & 0x7] : "",
480 		csr5_tx_state[(v >> 20) & 0x7],
481 		csr5_rx_state[(v >> 17) & 0x7],
482 		v & (1 << 12) ? "fail" : "OK");
483 	if (v & (1 << 16))
484 		fprintf(stdout,
485 		"      Normal interrupts: %s%s%s%s%s\n"
486 		,
487 		v & (1 << 0) ? "TxOK " : "",
488 		v & (1 << 2) ? "TxNoBufs " : "",
489 		v & (1 << 6) ? "RxOK" : "",
490 		v & (1 << 11) ? "TimerExp " : "",
491 		v & (1 << 14) ? "EarlyRx " : "");
492 	if (v & (1 << 15))
493 		fprintf(stdout,
494 		"      Abnormal intr: %s%s%s%s%s%s%s\n"
495 		,
496 		v & (1 << 1) ? "TxStop " : "",
497 		v & (1 << 3) ? "TxJabber " : "",
498 		v & (1 << 4) ? "ANC " : "",
499 		v & (1 << 5) ? "TxUnder " : "",
500 		v & (1 << 7) ? "RxNoBufs " : "",
501 		v & (1 << 8) ? "RxStopped " : "",
502 		v & (1 << 9) ? "RxTimeout " : "");
503 
504 	/*
505 	 * CSR6
506 	 */
507 	v = data[6];
508 	fprintf(stdout,
509 		"0x30: CSR6 (Operating Mode)              0x%08x\n"
510 		"%s"
511 		"%s"
512 		"      Transmit threshold %d bytes\n"
513 		"      Transmit DMA %sabled\n"
514 		"%s"
515 		"      Operating mode: %s\n"
516 		"      %s duplex\n"
517 		"%s"
518 		"%s"
519 		"%s"
520 		"%s"
521 		"%s"
522 		"%s"
523 		"%s"
524 		"      Receive DMA %sabled\n"
525 		"      %s filtering mode\n"
526 		,
527 		v,
528 		v & (1<<31) ? "      Special capture effect enabled\n" : "",
529 		v & (1<<17) ? "      Capture effect enabled\n" : "",
530 		csr6_tx_thresh[(v >> 14) & 3],
531 		v & (1<<13) ? "en" : "dis",
532 		v & (1<<12) ? "      Forcing collisions\n" : "",
533 		csr6_om[(v >> 10) & 3],
534 		v & (1<<9) ? "Full" : "Half",
535 		v & (1<<8) ? "      Flaky oscillator disable\n" : "",
536 		v & (1<<7) ? "      Pass All Multicast\n" : "",
537 		v & (1<<6) ? "      Promisc Mode\n" : "",
538 		v & (1<<5) ? "      Start/Stop Backoff Counter\n" : "",
539 		v & (1<<4) ? "      Inverse Filtering\n" : "",
540 		v & (1<<3) ? "      Pass Bad Frames\n" : "",
541 		v & (1<<2) ? "      Hash-only Filtering\n" : "",
542 		v & (1<<1) ? "en" : "dis",
543 		v & (1<<0) ? "Hash" : "Perfect");
544 
545 	/*
546 	 * CSR7
547 	 */
548 	v = data[7];
549 	fprintf(stdout,
550 		"0x38: CSR7 (Interrupt Mask)              0x%08x\n"
551 		"%s"
552 		"%s"
553 		"%s"
554 		"%s"
555 		"%s"
556 		"%s"
557 		"%s"
558 		"%s"
559 		"%s"
560 		"%s"
561 		"%s"
562 		"%s"
563 		"%s"
564 		"%s"
565 		"%s"
566 		"%s"
567 		,
568 		v,
569 		v & (1<<16) ? "      Normal interrupt summary\n" : "",
570 		v & (1<<15) ? "      Abnormal interrupt summary\n" : "",
571 		v & (1<<14) ? "      Early receive interrupt\n" : "",
572 		v & (1<<13) ? "      System error\n" : "",
573 		v & (1<<12) ? "      Link fail\n" : "",
574 		v & (1<<11) ? "      Timer expired\n" : "",
575 		v & (1<<9) ? "      Receive watchdog timeout\n" : "",
576 		v & (1<<8) ? "      Receive stopped\n" : "",
577 		v & (1<<7) ? "      Receive buffer unavailable\n" : "",
578 		v & (1<<6) ? "      Receive interrupt\n" : "",
579 		v & (1<<5) ? "      Transmit underflow\n" : "",
580 		v & (1<<4) ? "      Link pass\n" : "",
581 		v & (1<<3) ? "      Transmit jabber timeout\n" : "",
582 		v & (1<<2) ? "      Transmit buffer unavailable\n" : "",
583 		v & (1<<1) ? "      Transmit stopped\n" : "",
584 		v & (1<<0) ? "      Transmit interrupt\n" : "");
585 
586 	/*
587 	 * CSR8
588 	 */
589 	print_rx_missed(data[8]);
590 
591 	/*
592 	 * CSR9
593 	 */
594 	v = data[9];
595 	fprintf(stdout,
596 		"0x48: CSR9 (Boot and Ethernet ROMs)      0x%08x\n"
597 		"      Select bits: %s%s%s%s%s%s\n"
598 		"      Data: %d%d%d%d%d%d%d%d\n"
599 		,
600 		v,
601 		v & (1<<15) ? "Mode " : "",
602 		v & (1<<14) ? "Read " : "",
603 		v & (1<<13) ? "Write " : "",
604 		v & (1<<12) ? "BootROM " : "",
605 		v & (1<<11) ? "SROM " : "",
606 		v & (1<<10) ? "ExtReg " : "",
607 		v & (1<<7) ? 1 : 0,
608 		v & (1<<6) ? 1 : 0,
609 		v & (1<<5) ? 1 : 0,
610 		v & (1<<4) ? 1 : 0,
611 		v & (1<<3) ? 1 : 0,
612 		v & (1<<2) ? 1 : 0,
613 		v & (1<<1) ? 1 : 0,
614 		v & (1<<0) ? 1 : 0);
615 
616 	/*
617 	 * CSR10
618 	 */
619 	v = data[10];
620 	fprintf(stdout,
621 		"0x50: CSR10 (Boot ROM Address)           0x%08x\n", v);
622 
623 	/*
624 	 * CSR11
625 	 */
626 	v = data[11];
627 	fprintf(stdout,
628 		"0x58: CSR11 (General Purpose Timer)      0x%08x\n"
629 		"%s"
630 		"      Timer value: %u cycles\n"
631 		,
632 		v,
633 		v & (1<<16) ? "      Continuous mode\n" : "",
634 		v & 0xffff);
635 
636 	/*
637 	 * CSR12
638 	 */
639 	v = data[12];
640 	fprintf(stdout,
641 		"0x60: CSR12 (SIA Status)                 0x%08x\n"
642 		"      Link partner code word 0x%04x\n"
643 		"%s"
644 		"      NWay state: %s\n"
645 		"%s"
646 		"%s"
647 		"%s"
648 		"%s"
649 		"%s"
650 		"%s"
651 		"%s"
652 		"%s"
653 		"%s"
654 		"%s"
655 		"%s"
656 		,
657 		v,
658 		v >> 16,
659 		v & (1<<15) ? "      Link partner negotiable\n" : "",
660 		csr12_nway_state[(v >> 12) & 0x7],
661 		v & (1<<11) ? "      Transmit remote fault\n" : "",
662 		v & (1<<10) ? "      Unstable NLP detected\n" : "",
663 		v & (1<<9) ? "      Non-selected port receive activity\n" : "",
664 		v & (1<<8) ? "      Selected port receive activity\n" : "",
665 		v & (1<<7) ? "      PLL sampler high\n" : "",
666 		v & (1<<6) ? "      PLL sampler low\n" : "",
667 		v & (1<<5) ? "      PLL self-test pass\n" : "",
668 		v & (1<<4) ? "      PLL self-test done\n" : "",
669 		v & (1<<3) ? "      Autopolarity state\n" : "",
670 		v & (1<<2) ? "      Link fail\n" : "",
671 		v & (1<<1) ? "      Network connection error\n" : "");
672 
673 	/*
674 	 * CSR13
675 	 */
676 	v = data[13];
677 	fprintf(stdout,
678 		"0x68: CSR13 (SIA Connectivity)           0x%08x\n"
679 		"      SIA Diagnostic Mode 0x%04x\n"
680 		"      %s\n"
681 		"%s"
682 		"%s"
683 		,
684 		v,
685 		(v >> 4) & 0xfff,
686 		v & (1<<3) ? "AUI/BNC port" : "10base-T port",
687 		v & (1<<2) ? "      CSR autoconfiguration enabled\n" : "",
688 		v & (1<<0) ? "      SIA register reset asserted\n" : "");
689 
690 	/*
691 	 * CSR14
692 	 */
693 	v = data[14];
694 	fprintf(stdout,
695 		"0x70: CSR14 (SIA Transmit and Receive)   0x%08x\n"
696 		"%s"
697 		"%s"
698 		"%s"
699 		"%s"
700 		"%s"
701 		"%s"
702 		"%s"
703 		"%s"
704 		"%s"
705 		"%s"
706 		"      %s\n"
707 		"%s"
708 		"%s"
709 		"%s"
710 		"%s"
711 		,
712 		v,
713 		v & (1<<15) ? "      10base-T/AUI autosensing\n" : "",
714 		v & (1<<14) ? "      Set polarity plus\n" : "",
715 		v & (1<<13) ? "      Autopolarity enable\n" : "",
716 		v & (1<<12) ? "      Link test enable\n" : "",
717 		v & (1<<11) ? "      Heartbeat enable\n" : "",
718 		v & (1<<10) ? "      Collision detect enable\n" : "",
719 		v & (1<<9) ? "      Collision squelch enable\n" : "",
720 		v & (1<<8) ? "      Receive squelch enable\n" : "",
721 		v & (1<<7) ? "      Autonegotiation enable\n" : "",
722 		v & (1<<6) ? "      Must Be One\n" : "",
723 		csr14_tp_comp[(v >> 4) & 0x3],
724 		v & (1<<3) ? "      Link pulse send enable\n" : "",
725 		v & (1<<2) ? "      Driver enable\n" : "",
726 		v & (1<<1) ? "      Loopback enable\n" : "",
727 		v & (1<<0) ? "      Encoder enable\n" : "");
728 
729 	/*
730 	 * CSR15
731 	 */
732 	v = data[15];
733 	fprintf(stdout,
734 		"0x78: CSR15 (SIA General)                0x%08x\n"
735 		"%s"
736 		"%s"
737 		"%s"
738 		"%s"
739 		"%s"
740 		"%s"
741 		"%s"
742 		"%s"
743 		"%s"
744 		"%s"
745 		"%s"
746 		"%s"
747 		"      %s port selected\n"
748 		"%s"
749 		"%s"
750 		"%s"
751 		,
752 		v,
753 		v & (1<<15) ? "      GP LED2 on\n" : "",
754 		v & (1<<14) ? "      GP LED2 enable\n" : "",
755 		v & (1<<13) ? "      Force receiver low\n" : "",
756 		v & (1<<12) ? "      PLL self-test start\n" : "",
757 		v & (1<<11) ? "      LED stretch disable\n" : "",
758 		v & (1<<10) ? "      Force link fail\n" : "",
759 		v & (1<<9) ? "      Force unsquelch\n" : "",
760 		v & (1<<8) ? "      Test clock\n" : "",
761 		v & (1<<7) ? "      GP LED1 on\n" : "",
762 		v & (1<<6) ? "      GP LED1 enable\n" : "",
763 		v & (1<<5) ? "      Receive watchdog release\n" : "",
764 		v & (1<<4) ? "      Receive watchdog disable\n" : "",
765 		v & (1<<3) ? "AUI" : "BNC",
766 		v & (1<<2) ? "      Jabber clock\n" : "",
767 		v & (1<<1) ? "      Host unjab\n" : "",
768 		v & (1<<0) ? "      Jabber disable\n" : "");
769 }
770 
771 int
de2104x_dump_regs(struct ethtool_drvinfo * info,struct ethtool_regs * regs)772 de2104x_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
773 {
774 	unsigned int de21040 = regs->version & 1;
775 
776 	if (de21040)
777 		de21040_dump_regs(info, regs);
778 	else
779 		de21041_dump_regs(info, regs);
780 
781 	return 0;
782 }
783 
784