]> nv-tegra.nvidia Code Review - linux-3.10.git/blob - arch/arm/mach-tegra/mcerr-t14.c
ARM: tegra11: clock: Force out-of-table shared bus max limit
[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, 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 #define dummy_client    client("dummy")
26
27 static char unknown_buf[30];
28
29 struct mc_client mc_clients[] = {
30         client("ptc"),
31         client("display0_wina"),        client("display1_wina"),
32         client("display0_winb"),        client("display1_winb"),
33         client("display0_winc"),        client("display1_winc"),
34         dummy_client,                   dummy_client,
35         client("epp"),
36         client("gr2d_pat"), /* 10 */    client("gr2d_src"),
37         dummy_client,                   dummy_client,
38         dummy_client,                   client("avp"),
39         client("display0_cursor"),      client("display1_cursor"),
40         client("gr3d_fdc0"),            client("gr3d_fdc1"),
41         client("gr2d_dst"), /* 20 */
42         client("hda"),
43         client("host1x_dma"),           client("host1x_generic"),
44         client("gr3d0_idx"),            dummy_client,
45         dummy_client,                   dummy_client,
46         client("msenc"),
47         client("ahb_dma"),              client("ahb_slave"), /* 30 */
48         dummy_client,                   client("gr3d0_tex"),
49         dummy_client,
50         client("vde_bsev"),             client("vde_mbe"),
51         client("vde_mce"),              client("vde_tpe"),
52         client("cpu_lp"),               client("cpu"),
53         client("epp_u"), /* 40 */
54         client("epp_v"),
55         client("epp_y"),
56         client("msenc"),
57         client("vi_sb"),                client("vi_u"),
58         client("vi_v"),                 client("vi_y"),
59         client("gr2d_dst"),
60         dummy_client,
61         client("avp"), /* 50 */
62         client("gr3d_fdc0"),            client("gr3d_fdc1"),
63         client("hda"),
64         client("host1x"),
65         client("isp"),
66         client("cpu_lp"),               client("cpu"),
67         dummy_client,
68         client("ahb_dma"),              client("ahb_slave"), /* 60 */
69         dummy_client,
70         client("vde_bsev"),             client("vde_dbg"),
71         client("vde_mbe"),              client("vde_tpm"),
72         dummy_client,                   dummy_client,
73         client("ve_ispra"),             dummy_client,
74         client("ve_ispwa"), /* 70 */    client("ve_ispwb"),
75         dummy_client,                   dummy_client,
76         dummy_client,                   dummy_client,
77         dummy_client,                   dummy_client,
78         dummy_client,                   dummy_client,
79         dummy_client, /* 80 */          dummy_client,
80         client("emucif"),               client("emucif"),
81         client("tsec"),                 client("tsec"),
82         client("viw"),                  client("bbcr"),
83         client("bbcw"),                 client("bbcllr"),
84         client("disp_t"), /* 90 */      client("disp_d"),
85 };
86
87 int mc_client_last = ARRAY_SIZE(mc_clients) - 1;
88
89 static const char *mcerr_t14x_info(u32 stat)
90 {
91         if (stat & MC_INT_DECERR_EMEM)
92                 return "MC_DECERR";
93         else if (stat & MC_INT_SECURITY_VIOLATION)
94                 return "MC_SECURITY_ERR";
95         else if (stat & MC_INT_INVALID_SMMU_PAGE)
96                 return "MC_SMMU_ERR";
97         else if (stat & MC_INT_DECERR_VPR)
98                 return "MC_DECERR_VPR";
99         else if (stat & MC_INT_SECERR_SEC)
100                 return "MC_SECERR_SEC";
101         else if (stat & MC_INT_BBC_PRIVATE_MEM_VIOLATION)
102                 return "MC_BBC_PRIVATE_MEM_VIOLATION";
103         else if (stat & MC_INT_DECERR_BBC)
104                 return "MC_DECERR_BBC";
105
106         /* Otherwise we have an unknown type... */
107         snprintf(unknown_buf, 30, "unknown - 0x%04x", stat);
108         return unknown_buf;
109 }
110
111 static void mcerr_t14x_info_update(struct mc_client *c, u32 stat)
112 {
113         if (stat & MC_INT_DECERR_EMEM)
114                 c->intr_counts[0]++;
115         else if (stat & MC_INT_SECURITY_VIOLATION)
116                 c->intr_counts[1]++;
117         else if (stat & MC_INT_INVALID_SMMU_PAGE)
118                 c->intr_counts[2]++;
119         else if (stat & MC_INT_DECERR_VPR)
120                 c->intr_counts[3]++;
121         else if (stat & MC_INT_SECERR_SEC)
122                 c->intr_counts[4]++;
123         else if (stat & MC_INT_BBC_PRIVATE_MEM_VIOLATION)
124                 c->intr_counts[5]++;
125         else if (stat & MC_INT_DECERR_BBC)
126                 c->intr_counts[6]++;
127         else
128                 c->intr_counts[7]++;
129 }
130
131 static int mcerr_t14x_debugfs_show(struct seq_file *s, void *v)
132 {
133         int i, j;
134         int do_print;
135         const char *fmt = "%-18s %-9u %-9u %-9u %-10u %-10u %-9u %-9u %-9u\n";
136
137         seq_printf(s, "%-18s %-9s %-9s %-9s %-10s %-10s %-9s %-9s %-9s\n",
138                    "client", "decerr", "secerr", "smmuerr",
139                    "decerr-VPR", "secerr-SEC", "priv-bbc", "decerr-bbc",
140                    "unknown");
141         for (i = 0; i < ARRAY_SIZE(mc_clients); i++) {
142                 do_print = 0;
143                 if (strcmp(mc_clients[i].name, "dummy") == 0)
144                         continue;
145                 /* Only print clients who actually have errors. */
146                 for (j = 0; j < INTR_COUNT; j++) {
147                         if (mc_clients[i].intr_counts[j]) {
148                                 do_print = 1;
149                                 break;
150                         }
151                 }
152                 if (do_print)
153                         seq_printf(s, fmt,
154                                    mc_clients[i].name,
155                                    mc_clients[i].intr_counts[0],
156                                    mc_clients[i].intr_counts[1],
157                                    mc_clients[i].intr_counts[2],
158                                    mc_clients[i].intr_counts[3],
159                                    mc_clients[i].intr_counts[4],
160                                    mc_clients[i].intr_counts[5],
161                                    mc_clients[i].intr_counts[6],
162                                    mc_clients[i].intr_counts[7]);
163         }
164         return 0;
165 }
166
167 /*
168  * Set up chip specific functions and data for handling this particular chip's
169  * error decoding and logging.
170  */
171 void mcerr_chip_specific_setup(struct mcerr_chip_specific *spec)
172 {
173         spec->mcerr_info = mcerr_t14x_info;
174         spec->mcerr_info_update = mcerr_t14x_info_update;
175         spec->mcerr_debugfs_show = mcerr_t14x_debugfs_show;
176         spec->nr_clients = ARRAY_SIZE(mc_clients);
177         return;
178 }