OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [drivers/] [net/] [ibm_emac/] [ibm_ocp_debug.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/*
2
 * ibm_ocp_debug.c
3
 *
4
 * This has all the debug routines that where in *_enet.c
5
 *
6
 *      Armin Kuster akuster@mvista.com
7
 *      April , 2002
8
 *
9
 * Copyright 2002 MontaVista Softare Inc.
10
 *
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.
15
 *
16
 *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR   IMPLIED
17
 *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
18
 *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
19
 *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT,  INDIRECT,
20
 *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21
 *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
22
 *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23
 *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
24
 *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25
 *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
 *
27
 *  You should have received a copy of the  GNU General Public License along
28
 *  with this program; if not, write  to the Free Software Foundation, Inc.,
29
 *  675 Mass Ave, Cambridge, MA 02139, USA.
30
 *
31
 * TODO:
32
 *
33
 * Version 1.0: (04/15/02)
34
 *      initial release
35
 *      These are all the debug routines from *_enet.c and a few new ones.
36
 *      this was done to reduce the *_enet.c code.
37
 *
38
 * Version 1.1: 04/24/02
39
 *      fixed missind EMAC_DEV macros - Todd
40
 *
41
 */
42
 
43
#include <linux/config.h>
44
#include <linux/kernel.h>
45
#include <linux/netdevice.h>
46
#include <asm/io.h>
47
#include "ibm_ocp_mal.h"
48
#include "ibm_ocp_zmii.h"
49
#include "ibm_ocp_enet.h"
50
 
51
extern int
52
emac_phy_read(struct net_device *dev, int mii_id, int reg);
53
 
54
void emac_phy_dump(struct net_device *dev)
55
{
56
        struct ocp_enet_private *fep = dev->priv;
57
        unsigned long i;
58
        uint data;
59
 
60
        printk(KERN_DEBUG " Prepare for Phy dump....\n");
61
        for (i = 0; i < 0x1A; i++) {
62
                data = emac_phy_read(dev, fep->mii_phy_addr, i);
63
                printk(KERN_DEBUG "Phy reg 0x%lx ==> %4x\n", i, data);
64
                if (i == 0x07)
65
                        i = 0x0f;
66
        }
67
}
68
 
69
void
70
emac_desc_dump(struct net_device *dev)
71
{
72
        struct ocp_enet_private *fep = dev->priv;
73
        int curr_slot;
74
 
75
        printk(KERN_DEBUG "dumping the receive descriptors:  current slot is %d\n",
76
               fep->rx_slot);
77
        for (curr_slot = 0; curr_slot < NUM_RX_BUFF; curr_slot++) {
78
                printk(KERN_DEBUG "Desc %02d: status 0x%04x, length %3d, addr 0x%x\n",
79
                       curr_slot,
80
                       fep->rx_desc[curr_slot].ctrl,
81
                       fep->rx_desc[curr_slot].data_len,
82
                       (unsigned int) fep->rx_desc[curr_slot].data_ptr);
83
        }
84
}
85
 
86
void
87
emac_mac_dump(struct net_device *dev)
88
{
89
        struct ocp_enet_private *fep = dev->priv;
90
        volatile emac_t *emacp = fep->emacp;
91
 
92
        printk(KERN_DEBUG "EMAC DEBUG ********** \n");
93
        printk(KERN_DEBUG "EMAC_M0  ==> 0x%x\n", in_be32(&emacp->em0mr0));
94
        printk(KERN_DEBUG "EMAC_M1  ==> 0x%x\n", in_be32(&emacp->em0mr1));
95
        printk(KERN_DEBUG "EMAC_TXM0==> 0x%x\n", in_be32(&emacp->em0tmr0));
96
        printk(KERN_DEBUG "EMAC_TXM1==> 0x%x\n", in_be32(&emacp->em0tmr1));
97
        printk(KERN_DEBUG "EMAC_RXM ==> 0x%x\n", in_be32(&emacp->em0rmr));
98
        printk(KERN_DEBUG "EMAC_ISR ==> 0x%x\n", in_be32(&emacp->em0isr));
99
        printk(KERN_DEBUG "EMAC_IER ==> 0x%x\n", in_be32(&emacp->em0iser));
100
        printk(KERN_DEBUG "EMAC_IAH ==> 0x%x\n", in_be32(&emacp->em0iahr));
101
        printk(KERN_DEBUG "EMAC_IAL ==> 0x%x\n", in_be32(&emacp->em0ialr));
102
        printk(KERN_DEBUG "EMAC_VLAN_TPID_REG ==> 0x%x\n", in_be32(&emacp->em0vtpid));
103
}
104
 
105
void
106
emac_mal_dump(struct net_device *dev)
107
{
108
        struct ibm_ocp_mal* mal = ((struct ocp_enet_private*)dev->priv)->mal;
109
 
110
        printk(KERN_DEBUG " MAL DEBUG ********** \n");
111
        printk(KERN_DEBUG " MCR      ==> 0x%x\n",
112
               (unsigned int) get_mal_dcrn(mal, DCRN_MALCR));
113
        printk(KERN_DEBUG " ESR      ==> 0x%x\n",
114
               (unsigned int) get_mal_dcrn(mal, DCRN_MALESR));
115
        printk(KERN_DEBUG " IER      ==> 0x%x\n",
116
               (unsigned int) get_mal_dcrn(mal, DCRN_MALIER));
117
#ifdef CONFIG_40x
118
        printk(KERN_DEBUG " DBR      ==> 0x%x\n",
119
               (unsigned int) get_mal_dcrn(mal, DCRN_MALDBR));
120
#endif                          /* CONFIG_40x */
121
        printk(KERN_DEBUG " TXCASR   ==> 0x%x\n",
122
               (unsigned int) get_mal_dcrn(mal, DCRN_MALTXCASR));
123
        printk(KERN_DEBUG " TXCARR   ==> 0x%x\n",
124
               (unsigned int) get_mal_dcrn(mal, DCRN_MALTXCARR));
125
        printk(KERN_DEBUG " TXEOBISR ==> 0x%x\n",
126
               (unsigned int) get_mal_dcrn(mal, DCRN_MALTXEOBISR));
127
        printk(KERN_DEBUG " TXDEIR   ==> 0x%x\n",
128
               (unsigned int) get_mal_dcrn(mal, DCRN_MALTXDEIR));
129
        printk(KERN_DEBUG " RXCASR   ==> 0x%x\n",
130
               (unsigned int) get_mal_dcrn(mal, DCRN_MALRXCASR));
131
        printk(KERN_DEBUG " RXCARR   ==> 0x%x\n",
132
               (unsigned int) get_mal_dcrn(mal, DCRN_MALRXCARR));
133
        printk(KERN_DEBUG " RXEOBISR ==> 0x%x\n",
134
               (unsigned int) get_mal_dcrn(mal, DCRN_MALRXEOBISR));
135
        printk(KERN_DEBUG " RXDEIR   ==> 0x%x\n",
136
               (unsigned int) get_mal_dcrn(mal, DCRN_MALRXDEIR));
137
        printk(KERN_DEBUG " TXCTP0R  ==> 0x%x\n",
138
               (unsigned int) get_mal_dcrn(mal, DCRN_MALTXCTP0R));
139
        printk(KERN_DEBUG " TXCTP1R  ==> 0x%x\n",
140
               (unsigned int) get_mal_dcrn(mal, DCRN_MALTXCTP1R));
141
        printk(KERN_DEBUG " TXCTP2R  ==> 0x%x\n",
142
               (unsigned int) get_mal_dcrn(mal, DCRN_MALTXCTP2R));
143
        printk(KERN_DEBUG " TXCTP3R  ==> 0x%x\n",
144
               (unsigned int) get_mal_dcrn(mal, DCRN_MALTXCTP3R));
145
        printk(KERN_DEBUG " RXCTP0R  ==> 0x%x\n",
146
               (unsigned int) get_mal_dcrn(mal, DCRN_MALRXCTP0R));
147
        printk(KERN_DEBUG " RXCTP1R  ==> 0x%x\n",
148
               (unsigned int) get_mal_dcrn(mal, DCRN_MALRXCTP1R));
149
        printk(KERN_DEBUG " RCBS0    ==> 0x%x\n",
150
               (unsigned int) get_mal_dcrn(mal, DCRN_MALRCBS0));
151
        printk(KERN_DEBUG " RCBS1    ==> 0x%x\n",
152
               (unsigned int) get_mal_dcrn(mal, DCRN_MALRCBS1));
153
}
154
 
155
void
156
emac_serr_dump_0(struct net_device *dev)
157
{
158
        struct ibm_ocp_mal* mal = ((struct ocp_enet_private*)dev->priv)->mal;
159
        unsigned long int mal_error, plb_error, plb_addr;
160
 
161
        mal_error = get_mal_dcrn(mal, DCRN_MALESR);
162
        printk(KERN_DEBUG "ppc405_eth_serr: %s channel %ld \n",
163
               (mal_error & 0x40000000) ? "Receive" :
164
               "Transmit", (mal_error & 0x3e000000) >> 25);
165
        printk(KERN_DEBUG "  -----  latched error  -----\n");
166
        if (mal_error & MALESR_DE)
167
                printk(KERN_DEBUG "  DE: descriptor error\n");
168
        if (mal_error & MALESR_OEN)
169
                printk(KERN_DEBUG
170
                       "  ONE: OPB non-fullword error\n");
171
        if (mal_error & MALESR_OTE)
172
                printk(KERN_DEBUG "  OTE: OPB timeout error\n");
173
        if (mal_error & MALESR_OSE)
174
                printk(KERN_DEBUG "  OSE: OPB slave error\n");
175
 
176
        if (mal_error & MALESR_PEIN) {
177
                plb_error = mfdcr(DCRN_PLB0_BESR);
178
                printk(KERN_DEBUG
179
                       "  PEIN: PLB error, PLB0_BESR is 0x%x\n",
180
                       (unsigned int) plb_error);
181
                plb_addr = mfdcr(DCRN_PLB0_BEAR);
182
                printk(KERN_DEBUG
183
                       "  PEIN: PLB error, PLB0_BEAR is 0x%x\n",
184
                       (unsigned int) plb_addr);
185
        }
186
}
187
 
188
void
189
emac_serr_dump_1(struct net_device *dev)
190
{
191
        struct ibm_ocp_mal* mal = ((struct ocp_enet_private*)dev->priv)->mal;
192
        int mal_error = get_mal_dcrn(mal, DCRN_MALESR);
193
 
194
        printk(KERN_DEBUG "  -----  cumulative errors  -----\n");
195
        if (mal_error & MALESR_DEI)
196
                printk(KERN_DEBUG
197
                       "  DEI: descriptor error interrupt\n");
198
        if (mal_error & MALESR_ONEI)
199
                printk(KERN_DEBUG
200
                       "  OPB non-fullword error interrupt\n");
201
        if (mal_error & MALESR_OTEI)
202
                printk(KERN_DEBUG
203
                       "  OTEI: timeout error interrupt\n");
204
        if (mal_error & MALESR_OSEI)
205
                printk(KERN_DEBUG
206
                       "  OSEI: slave error interrupt\n");
207
        if (mal_error & MALESR_PBEI)
208
                printk(KERN_DEBUG
209
                       "  PBEI: PLB bus error interrupt\n");
210
}
211
 
212
void
213
emac_err_dump(struct net_device *dev, int em0isr)
214
{
215
        printk(KERN_DEBUG "%s: on-chip ethernet error:\n", dev->name);
216
 
217
        if (em0isr & EMAC_ISR_OVR)
218
                printk(KERN_DEBUG "  OVR: overrun\n");
219
        if (em0isr & EMAC_ISR_PP)
220
                printk(KERN_DEBUG "  PP: control pause packet\n");
221
        if (em0isr & EMAC_ISR_BP)
222
                printk(KERN_DEBUG "  BP: packet error\n");
223
        if (em0isr & EMAC_ISR_RP)
224
                printk(KERN_DEBUG "  RP: runt packet\n");
225
        if (em0isr & EMAC_ISR_SE)
226
                printk(KERN_DEBUG "  SE: short event\n");
227
        if (em0isr & EMAC_ISR_ALE)
228
                printk(KERN_DEBUG
229
                       "  ALE: odd number of nibbles in packet\n");
230
        if (em0isr & EMAC_ISR_BFCS)
231
                printk(KERN_DEBUG "  BFCS: bad FCS\n");
232
        if (em0isr & EMAC_ISR_PTLE)
233
                printk(KERN_DEBUG "  PTLE: oversized packet\n");
234
        if (em0isr & EMAC_ISR_ORE)
235
                printk(KERN_DEBUG
236
                       "  ORE: packet length field > max allowed LLC\n");
237
        if (em0isr & EMAC_ISR_IRE)
238
                printk(KERN_DEBUG "  IRE: In Range error\n");
239
        if (em0isr & EMAC_ISR_DBDM)
240
                printk(KERN_DEBUG "  DBDM: xmit error or SQE\n");
241
        if (em0isr & EMAC_ISR_DB0)
242
                printk(KERN_DEBUG
243
                       "  DB0: xmit error or SQE on TX channel 0\n");
244
        if (em0isr & EMAC_ISR_SE0)
245
                printk(KERN_DEBUG
246
                       "  SE0: Signal Quality Error test failure from TX channel 0\n");
247
        if (em0isr & EMAC_ISR_TE0)
248
                printk(KERN_DEBUG "  TE0: xmit channel 0 aborted\n");
249
        if (em0isr & EMAC_ISR_DB1)
250
                printk(KERN_DEBUG
251
                       "  DB1: xmit error or SQE on TX channel \n");
252
        if (em0isr & EMAC_ISR_SE1)
253
                printk(KERN_DEBUG
254
                       "  SE1: Signal Quality Error test failure from TX channel 1\n");
255
        if (em0isr & EMAC_ISR_TE1)
256
                printk(KERN_DEBUG "  TE1: xmit channel 1 aborted\n");
257
        if (em0isr & EMAC_ISR_MOS)
258
                printk(KERN_DEBUG "  MOS\n");
259
        if (em0isr & EMAC_ISR_MOF)
260
                printk(KERN_DEBUG "  MOF\n");
261
 
262
        emac_mac_dump(dev);
263
        emac_mal_dump(dev);
264
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.