380250164f40748fe4a37e7120b3c96fd0ac910a
[linux-3.10.git] / arch / arm / mach-tegra / mcerr-t14.c
1 /*
2  * arch/arm/mach-tegra/mcerr-t14.c
3  *
4  * Tegra 14x SoC-specific mcerr code.
5  *
6  * Copyright (c) 2012-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 <mach/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", "cbr_display0ab"),
33         client("dc", "csr_display0b"),
34         client("dcb", "csr_display0bb"),
35         client("dc", "csr_display0c"),
36         client("dcb", "cbr_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         client("isp", "csr_ispra"),
99         dummy_client,
100         client("isp", "csw_ispwa"),
101         client("isp", "csw_ispwb"),
102         dummy_client,
103         dummy_client,
104         dummy_client,
105         dummy_client,
106         dummy_client,
107         dummy_client,
108         dummy_client,
109         dummy_client,
110         dummy_client,
111         dummy_client,
112         client("emucif", "csr_emucifr"),
113         client("emucif", "csw_emucifw"),
114         client("tsec", "csr_tsecsrd"),
115         client("tsec", "csw_tsecswr"),
116         client("vi", "csw_viw"),
117         client("bbmci", "csr_bbcr"),
118         client("bbmci", "csw_bbcw"),
119         client("bbmcill", "csr_bbcllr"),
120         client("dc", "csr_displayt"),
121         dummy_client,
122         client("dc", "csr_displayd"),
123 };
124 int mc_client_last = ARRAY_SIZE(mc_clients) - 1;
125 /*** Done. ***/
126
127 static void mcerr_t14x_info_update(struct mc_client *c, u32 stat)
128 {
129         if (stat & MC_INT_DECERR_EMEM)
130                 c->intr_counts[0]++;
131         if (stat & MC_INT_SECURITY_VIOLATION)
132                 c->intr_counts[1]++;
133         if (stat & MC_INT_INVALID_SMMU_PAGE)
134                 c->intr_counts[2]++;
135         if (stat & MC_INT_DECERR_VPR)
136                 c->intr_counts[3]++;
137         if (stat & MC_INT_SECERR_SEC)
138                 c->intr_counts[4]++;
139         if (stat & MC_INT_BBC_PRIVATE_MEM_VIOLATION)
140                 c->intr_counts[5]++;
141         if (stat & MC_INT_DECERR_BBC)
142                 c->intr_counts[6]++;
143
144         if (stat & ~MC_INT_EN_MASK)
145                 c->intr_counts[7]++;
146 }
147
148 #define fmt_hdr "%-18s %-18s %-9s %-9s %-9s %-10s %-10s %-9s %-9s %-9s\n"
149 #define fmt_cli "%-18s %-18s %-9u %-9u %-9u %-10u %-10u %-9u %-9u %-9u\n";
150 static int mcerr_t14x_debugfs_show(struct seq_file *s, void *v)
151 {
152         int i, j;
153         int do_print;
154
155         seq_printf(s, fmt_hdr,
156                    "swgid", "client", "decerr", "secerr", "smmuerr",
157                    "decerr-VPR", "secerr-SEC", "priv-bbc", "decerr-bbc",
158                    "unknown");
159         for (i = 0; i < ARRAY_SIZE(mc_clients); i++) {
160                 do_print = 0;
161                 if (strcmp(mc_clients[i].name, "dummy") == 0)
162                         continue;
163                 /* Only print clients who actually have errors. */
164                 for (j = 0; j < INTR_COUNT; j++) {
165                         if (mc_clients[i].intr_counts[j]) {
166                                 do_print = 1;
167                                 break;
168                         }
169                 }
170                 if (do_print)
171                         seq_printf(s, fmt_cli,
172                                    mc_clients[i].swgid,
173                                    mc_clients[i].name,
174                                    mc_clients[i].intr_counts[0],
175                                    mc_clients[i].intr_counts[1],
176                                    mc_clients[i].intr_counts[2],
177                                    mc_clients[i].intr_counts[3],
178                                    mc_clients[i].intr_counts[4],
179                                    mc_clients[i].intr_counts[5],
180                                    mc_clients[i].intr_counts[6],
181                                    mc_clients[i].intr_counts[7]);
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_info_update = mcerr_t14x_info_update;
193         spec->mcerr_debugfs_show = mcerr_t14x_debugfs_show;
194         spec->nr_clients = ARRAY_SIZE(mc_clients);
195         return;
196 }