blob: b87cee7a6b4c8e65bff9cc1085cb888a194add5d [file] [log] [blame]
Jeff Garzik32c80372005-10-25 01:56:48 -04001/* Copyright 2004 IBM Corporation (jklewis@us.ibm.com) */
2
3#include <stdio.h>
4#include <stdlib.h>
Ben Hutchings5ba70c02011-11-01 16:48:31 +00005#include "internal.h"
Jeff Garzik32c80372005-10-25 01:56:48 -04006
7#define BIT0 0x0001
8#define BIT1 0x0002
9#define BIT2 0x0004
10#define BIT3 0x0008
11#define BIT4 0x0010
12#define BIT5 0x0020
13#define BIT6 0x0040
14#define BIT7 0x0080
15#define BIT8 0x0100
16#define BIT9 0x0200
17#define BIT10 0x0400
18#define BIT11 0x0800
19#define BIT12 0x1000
20#define BIT13 0x2000
21#define BIT14 0x4000
22#define BIT15 0x8000
23
24int pcnet32_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
25{
26 int i, csr;
27 u16 *data = (u16 *) regs->data;
28 int len = regs->len / 2;
29 u16 temp,*ptr;
30
31 printf("Driver: %s\n",info->driver);
32 printf("Version: %s\n",info->version);
33
34 printf("APROM: ");
35 for (i=0; i<8; i++)
36 printf(" %04x ", data[i]);
37 printf("\n");
38
39 csr = i;
40 for (; i<100; i++)
41 {
42 if (((i-csr) & 7) == 0) printf("CSR%02d: ", i-csr);
43 printf(" %04x ", data[i]);
44 if (((i-csr) & 7) == 7) printf("\n");
45 }
46 if (((i-csr) & 7) != 7) printf("\n");
47
48 csr = i;
49 for (; i<136; i++)
50 {
51 if (((i-csr) & 7) == 0) printf("BCR%02d: ", i-csr);
52 printf(" %04x ", data[i]);
53 if (((i-csr) & 7) == 7) printf("\n");
54 }
55 if (((i-csr) & 7) != 7) printf("\n");
56
57 csr = i;
58 for (; i<len; i++)
59 {
Don Fryb2fe65b2005-06-28 09:38:39 -070060 if (((i-csr) & 7) == 0) printf("MII%02d: ", (i-csr) & 0x1f);
Jeff Garzik32c80372005-10-25 01:56:48 -040061 printf(" %04x ", data[i]);
62 if (((i-csr) & 7) == 7) printf("\n");
63 }
64 if (((i-csr) & 7) != 7) printf("\n");
65 printf("\n");
66
67 ptr=&data[8]; /* start of the CSRs */
68
69 printf("CSR0: Status and Control 0x%04x\n ",ptr[0]);
70 temp=ptr[0];
71
72 if(temp & BIT15) printf("ERR ");
73 if(temp & BIT14) printf("BABL ");
74 if(temp & BIT13) printf("CERR ");
75 if(temp & BIT12) printf("MISS ");
76 if(temp & BIT11) printf("MERR ");
77 if(temp & BIT10) printf("RINT ");
78 if(temp & BIT9) printf("TINT ");
79 if(temp & BIT8) printf("IDON ");
80 if(temp & BIT7) printf("INTR ");
81 if(temp & BIT6) printf("INT ");
82 if(temp & BIT5) printf("RXON ");
83 if(temp & BIT4) printf("TXON ");
84 if(temp & BIT3) printf("TDMD ");
85 if(temp & BIT2) printf("STOP ");
86 if(temp & BIT1) printf("STRT ");
87 if(temp & BIT0) printf("INIT ");
88
89 printf("\n");
90
91 printf("CSR3: Interrupt Mask 0x%04x\n ",ptr[3]);
92 temp=ptr[3];
93
94 if(temp & BIT14) printf("BABLM ");
95 if(temp & BIT12) printf("MISSM ");
96 if(temp & BIT11) printf("MERRM ");
97 if(temp & BIT10) printf("RINTM ");
98 if(temp & BIT9) printf("TINTM ");
99 if(temp & BIT8) printf("IDONM ");
100 if(temp & BIT6) printf("DXSUFLO ");
101 if(temp & BIT5) printf("LAPPEN ");
102 if(temp & BIT4) printf("DXMT2PD ");
103 if(temp & BIT3) printf("EMBA ");
104 if(temp & BIT2) printf("BSWP ");
105
106 printf("\n");
107
108 printf("CSR4: Test and Features 0x%04x\n ",ptr[4]);
109 temp=ptr[4];
110
111 if(temp & BIT15) printf("EN124 ");
112 if(temp & BIT14) printf("DMAPLUS ");
113 if(temp & BIT12) printf("TXDPOLL ");
114 if(temp & BIT11) printf("APAD_XMT ");
115 if(temp & BIT10) printf("ASTRP_RCV ");
116 if(temp & BIT9) printf("MFCO ");
117 if(temp & BIT8) printf("MFCON ");
118 if(temp & BIT7) printf("UINTCMD ");
119 if(temp & BIT6) printf("UINT ");
120 if(temp & BIT5) printf("RCVCCO ");
121 if(temp & BIT4) printf("RCVCCOM ");
122 if(temp & BIT3) printf("TXSTRT ");
123 if(temp & BIT2) printf("TXSTRTM ");
124 if(temp & BIT1) printf("JAB ");
125 if(temp & BIT0) printf("JABM ");
126
127 printf("\n");
128
129 printf("CSR5: Ext Control and Int 1 0x%04x\n ",ptr[5]);
130 temp=ptr[5];
131
132 if(temp & BIT15) printf("TOKINTD ");
133 if(temp & BIT14) printf("LTINTEN ");
134 if(temp & BIT11) printf("SINT ");
135 if(temp & BIT10) printf("SINTE ");
136 if(temp & BIT9) printf("SLPINT ");
137 if(temp & BIT8) printf("SLPINTE ");
138 if(temp & BIT7) printf("EXDINT ");
139 if(temp & BIT6) printf("EXDINTE ");
140 if(temp & BIT5) printf("MPPLBA ");
141 if(temp & BIT4) printf("MPINT ");
142 if(temp & BIT3) printf("MPINTE ");
143 if(temp & BIT2) printf("MPEN ");
144 if(temp & BIT1) printf("MPMODE ");
145 if(temp & BIT0) printf("SPND ");
146
147 printf("\n");
148
149 printf("CSR7: Ext Control and Int 2 0x%04x\n ",ptr[7]);
150 temp=ptr[7];
151
152 if(temp & BIT15) printf("FASTSPNDE ");
153 if(temp & BIT14) printf("RXFRTG ");
154 if(temp & BIT13) printf("RDMD ");
155 if(temp & BIT12) printf("RXDPOLL ");
156 if(temp & BIT11) printf("STINT ");
157 if(temp & BIT10) printf("STINTE ");
158 if(temp & BIT9) printf("MREINT ");
159 if(temp & BIT8) printf("MREINTE ");
160 if(temp & BIT7) printf("MAPINT ");
161 if(temp & BIT6) printf("MAPINTE ");
162 if(temp & BIT5) printf("MCCINT ");
163 if(temp & BIT4) printf("MCCINTE ");
164 if(temp & BIT3) printf("MCCIINT ");
165 if(temp & BIT2) printf("MCCIINTE ");
166 if(temp & BIT1) printf("MIIPDTINT ");
167 if(temp & BIT0) printf("MIIPDTINTE ");
168
169 printf("\n");
170
171 printf("CSR15: Mode 0x%04x\n",ptr[15]);
172 printf("CSR40: Current RX Byte Count 0x%04x\n",ptr[40]);
173 printf("CSR41: Current RX Status 0x%04x\n",ptr[41]);
174 printf("CSR42: Current TX Byte Count 0x%04x\n",ptr[42]);
175 printf("CSR43: Current TX Status 0x%04x\n",ptr[43]);
176 printf("CSR88: Chip ID Lower 0x%04x\n",ptr[88]);
Don Fryb2fe65b2005-06-28 09:38:39 -0700177 temp = (((ptr[89] << 16) | ptr[88]) >> 12) & 0xffff;
178 switch (temp) {
179 case 0x2420:
180 printf(" PCnet/PCI 79C970\n");
181 break;
182 case 0x2621:
183 printf(" PCnet/PCI II 79C970A\n");
184 break;
185 case 0x2623:
186 printf(" PCnet/FAST 79C971\n");
187 break;
188 case 0x2624:
189 printf(" PCnet/FAST+ 79C972\n");
190 break;
191 case 0x2625:
192 printf(" PCnet/FAST III 79C973\n");
193 break;
194 case 0x2626:
195 printf(" PCnet/Home 79C978\n");
196 break;
197 case 0x2627:
198 printf(" PCnet/FAST III 79C975\n");
199 break;
200 case 0x2628:
201 printf(" PCnet/PRO 79C976\n");
202 break;
203 }
Jeff Garzik32c80372005-10-25 01:56:48 -0400204
205 printf("CSR89: Chip ID Upper 0x%04x\n ",ptr[89]);
206 temp=ptr[89];
207 printf("VER: %04x PARTIDU: %04x\n",temp >> 12,temp & 0x00000fff);
208
209 printf("CSR112: Missed Frame Count 0x%04x\n",ptr[90]); /* 90 is 112 */
210 printf("CSR114: RX Collision Count 0x%04x\n",ptr[91]);
211
212 printf("\n");
213
214 ptr=&data[100]; /* point to BCR 0 */
215
216 printf("BCR2: Misc. Configuration 0x%04x\n ",ptr[2]);
217 temp=ptr[2];
218
219 if(temp & BIT14) printf("TMAULOOP ");
220 if(temp & BIT12) printf("LEDPE ");
221
222 if(temp & BIT8) printf("APROMWE ");
223 if(temp & BIT7) printf("INTLEVEL ");
224
225 if(temp & BIT3) printf("EADISEL ");
226 if(temp & BIT2) printf("AWAKE ");
227 if(temp & BIT1) printf("ASEL ");
228 if(temp & BIT0) printf("XMAUSEL ");
229
230 printf("\n");
231
232 printf("BCR9: Full-Duplex Control 0x%04x\n",ptr[9]);
233 printf("BCR18: Burst and Bus Control 0x%04x\n",ptr[18]);
234
235 printf("BCR19: EEPROM Control and Status 0x%04x\n ",ptr[19]);
236 temp=ptr[19];
237 if(temp & BIT15) printf("PVALID ");
238 if(temp & BIT13) printf("EEDET ");
239 printf("\n");
240
241 printf("BCR23: PCI Subsystem Vendor ID 0x%04x\n",ptr[23]);
242 printf("BCR24: PCI Subsystem ID 0x%04x\n",ptr[24]);
243 printf("BCR31: Software Timer 0x%04x\n",ptr[31]);
244 printf("BCR32: MII Control and Status 0x%04x\n",ptr[32]);
245 printf("BCR35: PCI Vendor ID 0x%04x\n",ptr[35]);
246
247 return(0);
248}
249