4 * This has all the debug routines that where in *_enet.c
6 * Armin Kuster akuster@mvista.com
9 * Copyright 2002 MontaVista Softare Inc.
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
17 #include <linux/config.h>
18 #include <linux/kernel.h>
19 #include <linux/netdevice.h>
21 #include "ibm_ocp_mal.h"
22 #include "ibm_ocp_zmii.h"
23 #include "ibm_ocp_enet.h"
25 extern int emac_phy_read(struct net_device
*dev
, int mii_id
, int reg
);
27 void emac_phy_dump(struct net_device
*dev
)
29 struct ocp_enet_private
*fep
= dev
->priv
;
33 printk(KERN_DEBUG
" Prepare for Phy dump....\n");
34 for (i
= 0; i
< 0x1A; i
++) {
35 data
= emac_phy_read(dev
, fep
->mii_phy_addr
, i
);
36 printk(KERN_DEBUG
"Phy reg 0x%lx ==> %4x\n", i
, data
);
42 void emac_desc_dump(struct net_device
*dev
)
44 struct ocp_enet_private
*fep
= dev
->priv
;
48 "dumping the receive descriptors: current slot is %d\n",
50 for (curr_slot
= 0; curr_slot
< NUM_RX_BUFF
; curr_slot
++) {
52 "Desc %02d: status 0x%04x, length %3d, addr 0x%x\n",
53 curr_slot
, fep
->rx_desc
[curr_slot
].ctrl
,
54 fep
->rx_desc
[curr_slot
].data_len
,
55 (unsigned int)fep
->rx_desc
[curr_slot
].data_ptr
);
59 void emac_mac_dump(struct net_device
*dev
)
61 struct ocp_enet_private
*fep
= dev
->priv
;
62 volatile emac_t
*emacp
= fep
->emacp
;
64 printk(KERN_DEBUG
"EMAC DEBUG ********** \n");
65 printk(KERN_DEBUG
"EMAC_M0 ==> 0x%x\n", in_be32(&emacp
->em0mr0
));
66 printk(KERN_DEBUG
"EMAC_M1 ==> 0x%x\n", in_be32(&emacp
->em0mr1
));
67 printk(KERN_DEBUG
"EMAC_TXM0==> 0x%x\n", in_be32(&emacp
->em0tmr0
));
68 printk(KERN_DEBUG
"EMAC_TXM1==> 0x%x\n", in_be32(&emacp
->em0tmr1
));
69 printk(KERN_DEBUG
"EMAC_RXM ==> 0x%x\n", in_be32(&emacp
->em0rmr
));
70 printk(KERN_DEBUG
"EMAC_ISR ==> 0x%x\n", in_be32(&emacp
->em0isr
));
71 printk(KERN_DEBUG
"EMAC_IER ==> 0x%x\n", in_be32(&emacp
->em0iser
));
72 printk(KERN_DEBUG
"EMAC_IAH ==> 0x%x\n", in_be32(&emacp
->em0iahr
));
73 printk(KERN_DEBUG
"EMAC_IAL ==> 0x%x\n", in_be32(&emacp
->em0ialr
));
74 printk(KERN_DEBUG
"EMAC_VLAN_TPID_REG ==> 0x%x\n",
75 in_be32(&emacp
->em0vtpid
));
78 void emac_mal_dump(struct net_device
*dev
)
80 struct ibm_ocp_mal
*mal
= ((struct ocp_enet_private
*)dev
->priv
)->mal
;
82 printk(KERN_DEBUG
" MAL DEBUG ********** \n");
83 printk(KERN_DEBUG
" MCR ==> 0x%x\n",
84 (unsigned int)get_mal_dcrn(mal
, DCRN_MALCR
));
85 printk(KERN_DEBUG
" ESR ==> 0x%x\n",
86 (unsigned int)get_mal_dcrn(mal
, DCRN_MALESR
));
87 printk(KERN_DEBUG
" IER ==> 0x%x\n",
88 (unsigned int)get_mal_dcrn(mal
, DCRN_MALIER
));
90 printk(KERN_DEBUG
" DBR ==> 0x%x\n",
91 (unsigned int)get_mal_dcrn(mal
, DCRN_MALDBR
));
92 #endif /* CONFIG_40x */
93 printk(KERN_DEBUG
" TXCASR ==> 0x%x\n",
94 (unsigned int)get_mal_dcrn(mal
, DCRN_MALTXCASR
));
95 printk(KERN_DEBUG
" TXCARR ==> 0x%x\n",
96 (unsigned int)get_mal_dcrn(mal
, DCRN_MALTXCARR
));
97 printk(KERN_DEBUG
" TXEOBISR ==> 0x%x\n",
98 (unsigned int)get_mal_dcrn(mal
, DCRN_MALTXEOBISR
));
99 printk(KERN_DEBUG
" TXDEIR ==> 0x%x\n",
100 (unsigned int)get_mal_dcrn(mal
, DCRN_MALTXDEIR
));
101 printk(KERN_DEBUG
" RXCASR ==> 0x%x\n",
102 (unsigned int)get_mal_dcrn(mal
, DCRN_MALRXCASR
));
103 printk(KERN_DEBUG
" RXCARR ==> 0x%x\n",
104 (unsigned int)get_mal_dcrn(mal
, DCRN_MALRXCARR
));
105 printk(KERN_DEBUG
" RXEOBISR ==> 0x%x\n",
106 (unsigned int)get_mal_dcrn(mal
, DCRN_MALRXEOBISR
));
107 printk(KERN_DEBUG
" RXDEIR ==> 0x%x\n",
108 (unsigned int)get_mal_dcrn(mal
, DCRN_MALRXDEIR
));
109 printk(KERN_DEBUG
" TXCTP0R ==> 0x%x\n",
110 (unsigned int)get_mal_dcrn(mal
, DCRN_MALTXCTP0R
));
111 printk(KERN_DEBUG
" TXCTP1R ==> 0x%x\n",
112 (unsigned int)get_mal_dcrn(mal
, DCRN_MALTXCTP1R
));
113 printk(KERN_DEBUG
" TXCTP2R ==> 0x%x\n",
114 (unsigned int)get_mal_dcrn(mal
, DCRN_MALTXCTP2R
));
115 printk(KERN_DEBUG
" TXCTP3R ==> 0x%x\n",
116 (unsigned int)get_mal_dcrn(mal
, DCRN_MALTXCTP3R
));
117 printk(KERN_DEBUG
" RXCTP0R ==> 0x%x\n",
118 (unsigned int)get_mal_dcrn(mal
, DCRN_MALRXCTP0R
));
119 printk(KERN_DEBUG
" RXCTP1R ==> 0x%x\n",
120 (unsigned int)get_mal_dcrn(mal
, DCRN_MALRXCTP1R
));
121 printk(KERN_DEBUG
" RCBS0 ==> 0x%x\n",
122 (unsigned int)get_mal_dcrn(mal
, DCRN_MALRCBS0
));
123 printk(KERN_DEBUG
" RCBS1 ==> 0x%x\n",
124 (unsigned int)get_mal_dcrn(mal
, DCRN_MALRCBS1
));
127 void emac_serr_dump_0(struct net_device
*dev
)
129 struct ibm_ocp_mal
*mal
= ((struct ocp_enet_private
*)dev
->priv
)->mal
;
130 unsigned long int mal_error
, plb_error
, plb_addr
;
132 mal_error
= get_mal_dcrn(mal
, DCRN_MALESR
);
133 printk(KERN_DEBUG
"ppc405_eth_serr: %s channel %ld \n",
134 (mal_error
& 0x40000000) ? "Receive" :
135 "Transmit", (mal_error
& 0x3e000000) >> 25);
136 printk(KERN_DEBUG
" ----- latched error -----\n");
137 if (mal_error
& MALESR_DE
)
138 printk(KERN_DEBUG
" DE: descriptor error\n");
139 if (mal_error
& MALESR_OEN
)
140 printk(KERN_DEBUG
" ONE: OPB non-fullword error\n");
141 if (mal_error
& MALESR_OTE
)
142 printk(KERN_DEBUG
" OTE: OPB timeout error\n");
143 if (mal_error
& MALESR_OSE
)
144 printk(KERN_DEBUG
" OSE: OPB slave error\n");
146 if (mal_error
& MALESR_PEIN
) {
147 plb_error
= mfdcr(DCRN_PLB0_BESR
);
149 " PEIN: PLB error, PLB0_BESR is 0x%x\n",
150 (unsigned int)plb_error
);
151 plb_addr
= mfdcr(DCRN_PLB0_BEAR
);
153 " PEIN: PLB error, PLB0_BEAR is 0x%x\n",
154 (unsigned int)plb_addr
);
158 void emac_serr_dump_1(struct net_device
*dev
)
160 struct ibm_ocp_mal
*mal
= ((struct ocp_enet_private
*)dev
->priv
)->mal
;
161 int mal_error
= get_mal_dcrn(mal
, DCRN_MALESR
);
163 printk(KERN_DEBUG
" ----- cumulative errors -----\n");
164 if (mal_error
& MALESR_DEI
)
165 printk(KERN_DEBUG
" DEI: descriptor error interrupt\n");
166 if (mal_error
& MALESR_ONEI
)
167 printk(KERN_DEBUG
" OPB non-fullword error interrupt\n");
168 if (mal_error
& MALESR_OTEI
)
169 printk(KERN_DEBUG
" OTEI: timeout error interrupt\n");
170 if (mal_error
& MALESR_OSEI
)
171 printk(KERN_DEBUG
" OSEI: slave error interrupt\n");
172 if (mal_error
& MALESR_PBEI
)
173 printk(KERN_DEBUG
" PBEI: PLB bus error interrupt\n");
176 void emac_err_dump(struct net_device
*dev
, int em0isr
)
178 printk(KERN_DEBUG
"%s: on-chip ethernet error:\n", dev
->name
);
180 if (em0isr
& EMAC_ISR_OVR
)
181 printk(KERN_DEBUG
" OVR: overrun\n");
182 if (em0isr
& EMAC_ISR_PP
)
183 printk(KERN_DEBUG
" PP: control pause packet\n");
184 if (em0isr
& EMAC_ISR_BP
)
185 printk(KERN_DEBUG
" BP: packet error\n");
186 if (em0isr
& EMAC_ISR_RP
)
187 printk(KERN_DEBUG
" RP: runt packet\n");
188 if (em0isr
& EMAC_ISR_SE
)
189 printk(KERN_DEBUG
" SE: short event\n");
190 if (em0isr
& EMAC_ISR_ALE
)
191 printk(KERN_DEBUG
" ALE: odd number of nibbles in packet\n");
192 if (em0isr
& EMAC_ISR_BFCS
)
193 printk(KERN_DEBUG
" BFCS: bad FCS\n");
194 if (em0isr
& EMAC_ISR_PTLE
)
195 printk(KERN_DEBUG
" PTLE: oversized packet\n");
196 if (em0isr
& EMAC_ISR_ORE
)
198 " ORE: packet length field > max allowed LLC\n");
199 if (em0isr
& EMAC_ISR_IRE
)
200 printk(KERN_DEBUG
" IRE: In Range error\n");
201 if (em0isr
& EMAC_ISR_DBDM
)
202 printk(KERN_DEBUG
" DBDM: xmit error or SQE\n");
203 if (em0isr
& EMAC_ISR_DB0
)
204 printk(KERN_DEBUG
" DB0: xmit error or SQE on TX channel 0\n");
205 if (em0isr
& EMAC_ISR_SE0
)
207 " SE0: Signal Quality Error test failure from TX channel 0\n");
208 if (em0isr
& EMAC_ISR_TE0
)
209 printk(KERN_DEBUG
" TE0: xmit channel 0 aborted\n");
210 if (em0isr
& EMAC_ISR_DB1
)
211 printk(KERN_DEBUG
" DB1: xmit error or SQE on TX channel \n");
212 if (em0isr
& EMAC_ISR_SE1
)
214 " SE1: Signal Quality Error test failure from TX channel 1\n");
215 if (em0isr
& EMAC_ISR_TE1
)
216 printk(KERN_DEBUG
" TE1: xmit channel 1 aborted\n");
217 if (em0isr
& EMAC_ISR_MOS
)
218 printk(KERN_DEBUG
" MOS\n");
219 if (em0isr
& EMAC_ISR_MOF
)
220 printk(KERN_DEBUG
" MOF\n");