ARM: tegra: mcerr: Update client arrays
[linux-3.10.git] / arch / arm / mach-tegra / mcerr-t12.c
1 /*
2  * arch/arm/mach-tegra/mcerr-t12.c
3  *
4  * Tegra 12x 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 "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         dummy_client,
40         dummy_client,
41         dummy_client,
42         dummy_client,
43         dummy_client,
44         client("afi", "csr_afir"),
45         client("avpc", "csr_avpcarm7r"),
46         client("dc", "csr_displayhc"),
47         client("dcb", "csr_displayhcb"),
48         dummy_client,
49         dummy_client,
50         dummy_client,
51         client("hda", "csr_hdar"),
52         client("hc", "csr_host1xdmar"),
53         client("hc", "csr_host1xr"),
54         dummy_client,
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         client("sata", "csr_satar"),
62         dummy_client,
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         dummy_client,
71         dummy_client,
72         dummy_client,
73         client("msenc", "csw_msencswr"),
74         dummy_client,
75         dummy_client,
76         dummy_client,
77         dummy_client,
78         dummy_client,
79         client("afi", "csw_afiw"),
80         client("avpc", "csw_avpcarm7w"),
81         dummy_client,
82         dummy_client,
83         client("hda", "csw_hdaw"),
84         client("hc", "csw_host1xw"),
85         dummy_client,
86         client("mpcorelp", "csw_mpcorelpw"),
87         client("mpcore", "csw_mpcorew"),
88         dummy_client,
89         client("ppcs", "csw_ppcsahbdmaw"),
90         client("ppcs", "csw_ppcsahbslvw"),
91         client("sata", "csw_sataw"),
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("isp2", "csr_ispra"),
99         dummy_client,
100         client("isp2", "csw_ispwa"),
101         client("isp2", "csw_ispwb"),
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("isp2b", "csr_isprab"),
109         dummy_client,
110         client("isp2b", "csw_ispwab"),
111         client("isp2b", "csw_ispwbb"),
112         dummy_client,
113         dummy_client,
114         client("tsec", "csr_tsecsrd"),
115         client("tsec", "csw_tsecswr"),
116         client("a9avp", "csr_a9avpscr"),
117         client("a9avp", "csw_a9avpscw"),
118         client("gpu", "csr_gpusrd"),
119         client("gpu", "csw_gpuswr"),
120         client("dc", "csr_displayt"),
121         dummy_client,
122         dummy_client,
123         dummy_client,
124         dummy_client,
125         dummy_client,
126         client("sdmmc1a", "csr_sdmmcra"),
127         client("sdmmc2a", "csr_sdmmcraa"),
128         client("sdmmc3a", "csr_sdmmcr"),
129         client("sdmmc4a", "csr_sdmmcrab"),
130         client("sdmmc1a", "csw_sdmmcwa"),
131         client("sdmmc2a", "csw_sdmmcwaa"),
132         client("sdmmc3a", "csw_sdmmcw"),
133         client("sdmmc4a", "csw_sdmmcwab"),
134         dummy_client,
135         dummy_client,
136         dummy_client,
137         dummy_client,
138         client("vic", "csr_vicsrd"),
139         client("vic", "csw_vicswr"),
140         dummy_client,
141         dummy_client,
142         dummy_client,
143         dummy_client,
144         client("vi", "csw_viw"),
145         client("dc", "csr_displayd"),
146 };
147 int mc_client_last = ARRAY_SIZE(mc_clients) - 1;
148 /*** Done. ***/
149
150 static void mcerr_t12x_info_update(struct mc_client *c, u32 stat)
151 {
152         if (stat & MC_INT_DECERR_EMEM)
153                 c->intr_counts[0]++;
154         if (stat & MC_INT_SECURITY_VIOLATION)
155                 c->intr_counts[1]++;
156         if (stat & MC_INT_INVALID_SMMU_PAGE)
157                 c->intr_counts[2]++;
158         if (stat & MC_INT_INVALID_APB_ASID_UPDATE)
159                 c->intr_counts[3]++;
160         if (stat & MC_INT_DECERR_VPR)
161                 c->intr_counts[4]++;
162         if (stat & MC_INT_SECERR_SEC)
163                 c->intr_counts[5]++;
164         if (stat & MC_INT_DECERR_MTS)
165                 c->intr_counts[6]++;
166
167         if (stat & ~MC_INT_EN_MASK)
168                 c->intr_counts[7]++;
169 }
170
171 static int mcerr_t12x_debugfs_show(struct seq_file *s, void *v)
172 {
173         int i, j;
174         int do_print;
175
176         seq_printf(s, "%-18s %-9s %-9s %-9s %-10s %-10s %-10s %-10s %-9s\n",
177                    "client", "decerr", "secerr", "smmuerr",
178                    "apberr", "decerr-VPR", "secerr-SEC",
179                    "decerr_MST", "unknown");
180         for (i = 0; i < ARRAY_SIZE(mc_clients); i++) {
181                 do_print = 0;
182                 if (strcmp(mc_clients[i].name, "dummy") == 0)
183                         continue;
184                 /* Only print clients who actually have errors. */
185                 for (j = 0; j < INTR_COUNT; j++) {
186                         if (mc_clients[i].intr_counts[j]) {
187                                 do_print = 1;
188                                 break;
189                         }
190                 }
191                 if (do_print)
192                         seq_printf(s, "%-18s %-9u %-9u %-9u %-10u "
193                                         "%-10u %-10u %-10u %-9u\n",
194                                    mc_clients[i].name,
195                                    mc_clients[i].intr_counts[0],
196                                    mc_clients[i].intr_counts[1],
197                                    mc_clients[i].intr_counts[2],
198                                    mc_clients[i].intr_counts[3],
199                                    mc_clients[i].intr_counts[4],
200                                    mc_clients[i].intr_counts[5],
201                                    mc_clients[i].intr_counts[6],
202                                    mc_clients[i].intr_counts[7]);
203         }
204         return 0;
205 }
206
207 /*
208  * Set up chip specific functions and data for handling this particular chip's
209  * error decoding and logging.
210  */
211 void mcerr_chip_specific_setup(struct mcerr_chip_specific *spec)
212 {
213         spec->mcerr_info_update = mcerr_t12x_info_update;
214         spec->mcerr_debugfs_show = mcerr_t12x_debugfs_show;
215         spec->nr_clients = ARRAY_SIZE(mc_clients);
216         return;
217 }
218