ARM: tegra: mcerr: Update client arrays
[linux-3.10.git] / arch / arm / mach-tegra / mcerr-t11.c
1 /*
2  * arch/arm/mach-tegra/mcerr-t11.c
3  *
4  * Tegra 11x SoC-specific mcerr code.
5  *
6  * Copyright (c) 2010-2013, NVIDIA Corporation. All rights reserved.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program; if not, write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21  */
22
23 #include "mcerr.h"
24
25 /*** Auto generated by `mcp.pl'. Do not modify! ***/
26
27 #define dummy_client   client("dummy", "dummy")
28
29 struct mc_client mc_clients[] = {
30         client("ptc", "csr_ptcr"),
31         client("dc", "csr_display0a"),
32         client("dcb", "csr_display0ab"),
33         client("dc", "csr_display0b"),
34         client("dcb", "csr_display0bb"),
35         client("dc", "csr_display0c"),
36         client("dcb", "csr_display0cb"),
37         dummy_client,
38         dummy_client,
39         client("epp", "cbr_eppup"),
40         client("g2", "cbr_g2pr"),
41         client("g2", "cbr_g2sr"),
42         dummy_client,
43         dummy_client,
44         dummy_client,
45         client("avpc", "csr_avpcarm7r"),
46         client("dc", "csr_displayhc"),
47         client("dcb", "csr_displayhcb"),
48         client("nv", "csr_fdcdrd"),
49         client("nv", "csr_fdcdrd2"),
50         client("g2", "csr_g2dr"),
51         client("hda", "csr_hdar"),
52         client("hc", "csr_host1xdmar"),
53         client("hc", "csr_host1xr"),
54         client("nv", "csr_idxsrd"),
55         dummy_client,
56         dummy_client,
57         dummy_client,
58         client("msenc", "csr_msencsrd"),
59         client("ppcs", "csr_ppcsahbdmar"),
60         client("ppcs", "csr_ppcsahbslvr"),
61         dummy_client,
62         client("nv", "csr_texl2srd"),
63         dummy_client,
64         client("vde", "csr_vdebsevr"),
65         client("vde", "csr_vdember"),
66         client("vde", "csr_vdemcer"),
67         client("vde", "csr_vdetper"),
68         client("mpcorelp", "csr_mpcorelpr"),
69         client("mpcore", "csr_mpcorer"),
70         client("epp", "cbw_eppu"),
71         client("epp", "cbw_eppv"),
72         client("epp", "cbw_eppy"),
73         client("msenc", "csw_msencswr"),
74         client("vi", "cbw_viwsb"),
75         client("vi", "cbw_viwu"),
76         client("vi", "cbw_viwv"),
77         client("vi", "cbw_viwy"),
78         client("g2", "ccw_g2dw"),
79         dummy_client,
80         client("avpc", "csw_avpcarm7w"),
81         client("nv", "csw_fdcdwr"),
82         client("nv", "csw_fdcdwr2"),
83         client("hda", "csw_hdaw"),
84         client("hc", "csw_host1xw"),
85         client("isp", "csw_ispw"),
86         client("mpcorelp", "csw_mpcorelpw"),
87         client("mpcore", "csw_mpcorew"),
88         dummy_client,
89         client("ppcs", "csw_ppcsahbdmaw"),
90         client("ppcs", "csw_ppcsahbslvw"),
91         dummy_client,
92         client("vde", "csw_vdebsevw"),
93         client("vde", "csw_vdedbgw"),
94         client("vde", "csw_vdembew"),
95         client("vde", "csw_vdetpmw"),
96         dummy_client,
97         dummy_client,
98         dummy_client,
99         dummy_client,
100         dummy_client,
101         dummy_client,
102         dummy_client,
103         dummy_client,
104         client("xusb_host", "csr_xusb_hostr"),
105         client("xusb_host", "csw_xusb_hostw"),
106         client("xusb_dev", "csr_xusb_devr"),
107         client("xusb_dev", "csw_xusb_devw"),
108         client("nv", "csw_fdcdwr3"),
109         client("nv", "csr_fdcdrd3"),
110         client("nv", "csw_fdcdwr4"),
111         client("nv", "csr_fdcdrd4"),
112         client("emucif", "csr_emucifr"),
113         client("emucif", "csw_emucifw"),
114         client("tsec", "csr_tsecsrd"),
115         client("tsec", "csw_tsecswr"),
116 };
117 int mc_client_last = ARRAY_SIZE(mc_clients) - 1;
118 /*** Done. ***/
119
120 static void mcerr_t11x_info_update(struct mc_client *c, u32 stat)
121 {
122         if (stat & MC_INT_DECERR_EMEM)
123                 c->intr_counts[0]++;
124         if (stat & MC_INT_SECURITY_VIOLATION)
125                 c->intr_counts[1]++;
126         if (stat & MC_INT_INVALID_SMMU_PAGE)
127                 c->intr_counts[2]++;
128         if (stat & MC_INT_DECERR_VPR)
129                 c->intr_counts[3]++;
130         if (stat & MC_INT_SECERR_SEC)
131                 c->intr_counts[4]++;
132
133         if (stat & ~MC_INT_EN_MASK)
134                 c->intr_counts[5]++;
135 }
136
137 /*
138  * T11x reports addresses in a 32 byte range thus we can only give an
139  * approximate location for the invalid memory request, not the exact address.
140  */
141 static void mcerr_t11x_print(const struct mc_error *err,
142                              const struct mc_client *client,
143                              u32 status, phys_addr_t addr,
144                              int secure, int rw, const char *smmu_info)
145 {
146         pr_err("[mcerr] %s: %s\n", client->name, err->msg);
147         pr_err("[mcerr]   status = 0x%08x; addr = [0x%08lx -> 0x%08lx]",
148                status, (ulong)(addr & ~0x1f), (ulong)(addr | 0x1f));
149         pr_err("[mcerr]   secure: %s, access-type: %s, SMMU fault: %s\n",
150                secure ? "yes" : "no", rw ? "write" : "read",
151                smmu_info ? smmu_info : "none");
152 }
153
154 static int mcerr_t11x_debugfs_show(struct seq_file *s, void *v)
155 {
156         int i, j;
157         int do_print;
158
159         seq_printf(s, "%-18s %-9s %-9s %-9s %-10s %-10s %-9s\n",
160                    "client", "decerr", "secerr", "smmuerr",
161                    "decerr-VPR", "secerr-SEC", "unknown");
162         for (i = 0; i < ARRAY_SIZE(mc_clients); i++) {
163                 do_print = 0;
164                 if (strcmp(mc_clients[i].name, "dummy") == 0)
165                         continue;
166                 /* Only print clients who actually have errors. */
167                 for (j = 0; j < INTR_COUNT; j++) {
168                         if (mc_clients[i].intr_counts[j]) {
169                                 do_print = 1;
170                                 break;
171                         }
172                 }
173                 if (do_print)
174                         seq_printf(s, "%-18s %-9u %-9u %-9u %-10u %-10u %-9u\n",
175                                    mc_clients[i].name,
176                                    mc_clients[i].intr_counts[0],
177                                    mc_clients[i].intr_counts[1],
178                                    mc_clients[i].intr_counts[2],
179                                    mc_clients[i].intr_counts[3],
180                                    mc_clients[i].intr_counts[4],
181                                    mc_clients[i].intr_counts[5]);
182         }
183         return 0;
184 }
185
186 /*
187  * Set up chip specific functions and data for handling this particular chip's
188  * error decoding and logging.
189  */
190 void mcerr_chip_specific_setup(struct mcerr_chip_specific *spec)
191 {
192         spec->mcerr_print = mcerr_t11x_print;
193         spec->mcerr_info_update = mcerr_t11x_info_update;
194         spec->mcerr_debugfs_show = mcerr_t11x_debugfs_show;
195         spec->nr_clients = ARRAY_SIZE(mc_clients);
196         return;
197 }