~ubuntu-branches/ubuntu/karmic/linux-mvl-dove/karmic-proposed

« back to all changes in this revision

Viewing changes to arch/arm/mach-dove/dump_cp15_regs.c

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Bader
  • Date: 2010-03-10 22:24:12 UTC
  • mto: (15.1.2 karmic-security)
  • mto: This revision was merged to the branch mainline in revision 18.
  • Revision ID: james.westby@ubuntu.com-20100310222412-k86m3r53jw0je7x1
Tags: upstream-2.6.31
ImportĀ upstreamĀ versionĀ 2.6.31

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * arch/arm/mach-dove/dump_cp15_regs.c
3
 
 *
4
 
 * This file is licensed under the terms of the GNU General Public
5
 
 * License version 2.  This program is licensed "as is" without any
6
 
 * warranty of any kind, whether express or implied.
7
 
 */
8
 
 
9
 
#include <linux/module.h>
10
 
#include <linux/moduleparam.h>
11
 
#include <linux/init.h>
12
 
 
13
 
#include <linux/kernel.h>
14
 
#include <linux/errno.h>
15
 
#include <linux/types.h>
16
 
#include <linux/proc_fs.h>
17
 
 
18
 
static int
19
 
proc_dump_cp15_read(char *page, char **start, off_t off, int count, int *eof,
20
 
                        void *data)
21
 
{
22
 
        char *p = page;
23
 
        int len;
24
 
        unsigned int value;
25
 
        
26
 
        asm volatile("mrc p15, 0, %0, c0, c0, 0": "=r"(value));
27
 
        p += sprintf(p, "Main ID: 0x%08x\n", value);
28
 
        
29
 
        asm volatile("mrc p15, 0, %0, c0, c0, 1": "=r"(value));
30
 
        p += sprintf(p, "Cache Type: 0x%08x\n", value);
31
 
        
32
 
        asm volatile("mrc p15, 0, %0, c0, c0, 3": "=r"(value));
33
 
        p += sprintf(p, "TLB Type: 0x%08x\n", value);
34
 
        
35
 
        asm volatile("mrc p15, 0, %0, c0, c1, 0": "=r"(value));
36
 
        p += sprintf(p, "Processor Feature 0: 0x%08x\n", value);
37
 
        
38
 
        asm volatile("mrc p15, 0, %0, c0, c1, 1": "=r"(value));
39
 
        p += sprintf(p, "Processor Feature 1: 0x%08x\n", value);
40
 
        
41
 
        asm volatile("mrc p15, 0, %0, c0, c1, 2": "=r"(value));
42
 
        p += sprintf(p, "Debug Feature 0: 0x%08x\n", value);
43
 
        
44
 
        asm volatile("mrc p15, 0, %0, c0, c1, 3": "=r"(value));
45
 
        p += sprintf(p, "Auxiliary Feature 0: 0x%08x\n", value);
46
 
        
47
 
        asm volatile("mrc p15, 0, %0, c0, c1, 4": "=r"(value));
48
 
        p += sprintf(p, "Memory Model Feature 0: 0x%08x\n", value);
49
 
        
50
 
        asm volatile("mrc p15, 0, %0, c0, c1, 5": "=r"(value));
51
 
        p += sprintf(p, "Memory Model Feature 1: 0x%08x\n", value);
52
 
        
53
 
        asm volatile("mrc p15, 0, %0, c0, c1, 6": "=r"(value));
54
 
        p += sprintf(p, "Memory Model Feature 2: 0x%08x\n", value);
55
 
 
56
 
        asm volatile("mrc p15, 0, %0, c0, c1, 7": "=r"(value));
57
 
        p += sprintf(p, "Memory Model Feature 3: 0x%08x\n", value);
58
 
        
59
 
        asm volatile("mrc p15, 0, %0, c0, c2, 0": "=r"(value));
60
 
        p += sprintf(p, "Set Attribute 0: 0x%08x\n", value);
61
 
        
62
 
        asm volatile("mrc p15, 0, %0, c0, c2, 1": "=r"(value));
63
 
        p += sprintf(p, "Set Attribute 1: 0x%08x\n", value);
64
 
        
65
 
        asm volatile("mrc p15, 0, %0, c0, c2, 2": "=r"(value));
66
 
        p += sprintf(p, "Set Attribute 2: 0x%08x\n", value);
67
 
 
68
 
        asm volatile("mrc p15, 0, %0, c0, c2, 3": "=r"(value));
69
 
        p += sprintf(p, "Set Attribute 3: 0x%08x\n", value);
70
 
        
71
 
        asm volatile("mrc p15, 0, %0, c0, c2, 4": "=r"(value));
72
 
        p += sprintf(p, "Set Attribute 4: 0x%08x\n", value);
73
 
        
74
 
        asm volatile("mrc p15, 0, %0, c0, c2, 5": "=r"(value));
75
 
        p += sprintf(p, "Set Attribute 5: 0x%08x\n", value);
76
 
#ifdef CONFIG_CPU_V7
77
 
        asm volatile("mrc p15, 1, %0, c0, c0, 0": "=r"(value));
78
 
        p += sprintf(p, "Current Cache Size ID: 0x%08x\n", value);
79
 
        
80
 
        asm volatile("mrc p15, 1, %0, c0, c0, 1": "=r"(value));
81
 
        p += sprintf(p, "Current Cache Level ID: 0x%08x\n", value);
82
 
 
83
 
        asm volatile("mrc p15, 2, %0, c0, c0, 0": "=r"(value));
84
 
        p += sprintf(p, "Cache Size Selection: 0x%08x\n", value);
85
 
 
86
 
#endif
87
 
        asm volatile("mrc p15, 0, %0, c1, c0, 0": "=r"(value));
88
 
        p += sprintf(p, "Control : 0x%08x\n", value);
89
 
#if defined(CONFIG_CPU_V6) || defined(CONFIG_DOVE_DEBUGGER_MODE_V6)
90
 
#ifndef CONFIG_DOVE_REV_Z0      
91
 
        p += sprintf(p, "    L2\t\t: %s\n", (value & (1 << 26)) ?
92
 
                     "Enabled" : "Disabled");
93
 
#endif
94
 
#endif
95
 
        asm volatile("mrc p15, 0, %0, c1, c0, 1": "=r"(value));
96
 
        p += sprintf(p, "Auxiliary Control : 0x%08x\n", value);
97
 
 
98
 
#ifdef CONFIG_CPU_V7
99
 
#ifndef CONFIG_DOVE_DEBUGGER_MODE_V6
100
 
        p += sprintf(p, "    L2\t\t: %s\n", (value & (1 << 1)) ?
101
 
                     "Enabled" : "Disabled");
102
 
#endif
103
 
#endif
104
 
        asm volatile("mrc p15, 0, %0, c1, c0, 2": "=r"(value));
105
 
        p += sprintf(p, "Coprocessor Access Control : 0x%08x\n", value);
106
 
        
107
 
        asm volatile("mrc p15, 0, %0, c1, c1, 0": "=r"(value));
108
 
        p += sprintf(p, "Secure Configuration : 0x%08x\n", value);
109
 
 
110
 
        asm volatile("mrc p15, 0, %0, c2, c0, 0": "=r"(value));
111
 
        p += sprintf(p, "Translation Table Base 0 : 0x%08x\n", value);
112
 
        
113
 
        asm volatile("mrc p15, 0, %0, c2, c0, 1": "=r"(value));
114
 
        p += sprintf(p, "Translation Table Base 1 : 0x%08x\n", value);
115
 
        
116
 
        asm volatile("mrc p15, 0, %0, c2, c0, 2": "=r"(value));
117
 
        p += sprintf(p, "Translation Table Control : 0x%08x\n", value);
118
 
        
119
 
        asm volatile("mrc p15, 0, %0, c3, c0, 0": "=r"(value));
120
 
        p += sprintf(p, "Domain Access Control : 0x%08x\n", value);
121
 
        
122
 
        asm volatile("mrc p15, 0, %0, c5, c0, 0": "=r"(value));
123
 
        p += sprintf(p, "Data Fault Status : 0x%08x\n", value);
124
 
 
125
 
        asm volatile("mrc p15, 0, %0, c5, c0, 1": "=r"(value));
126
 
        p += sprintf(p, "Instruction Fault Status : 0x%08x\n", value);
127
 
        
128
 
        asm volatile("mrc p15, 0, %0, c6, c0, 0": "=r"(value));
129
 
        p += sprintf(p, "Data Fault Address : 0x%08x\n", value);
130
 
 
131
 
        asm volatile("mrc p15, 0, %0, c6, c0, 1": "=r"(value));
132
 
        p += sprintf(p, "Watchpoint Fault Address : 0x%08x\n", value);
133
 
 
134
 
        asm volatile("mrc p15, 0, %0, c6, c0, 2": "=r"(value));
135
 
        p += sprintf(p, "Instruction Fault Address : 0x%08x\n", value);
136
 
        
137
 
        asm volatile("mrc p15, 0, %0, c7, c10, 6": "=r"(value));
138
 
        p += sprintf(p, "Cache Dirty Status: 0x%08x\n", value);
139
 
        
140
 
        asm volatile("mrc p15, 1, %0, c15, c1, 0": "=r"(value));
141
 
        p += sprintf(p, "L2 Extra Features: 0x%08x\n", value);
142
 
 
143
 
        asm volatile("mrc p15, 1, %0, c15, c1, 0": "=r"(value));
144
 
        p += sprintf(p, "Control Configuration: 0x%08x\n", value);
145
 
        p += sprintf(p, "    Write Buffer Coalescing\t: %s\n", (value & (1 << 8)) ?
146
 
                     "Enabled" : "Disabled");
147
 
        if (value & (1 << 8))
148
 
                p += sprintf(p, "    WB WAIT CYC\t: 0x%x\n", (value >> 9) & 0x7);
149
 
 
150
 
        p += sprintf(p, "    Coprocessor dual issue \t: %s\n", (value & (1 << 15)) ?
151
 
                     "Disabled" : "Enabled");
152
 
 
153
 
        p += sprintf(p, "    L2 Cache Burst 8 \t: %s\n", (value & (1 << 20)) ?
154
 
                     "Enabled" : "Disabled");
155
 
 
156
 
        p += sprintf(p, "    L2 Cache Way 7-4 \t: %s\n", (value & (1 << 21)) ?
157
 
                     "Enabled" : "Disabled");
158
 
                
159
 
#ifdef CONFIG_DOVE_REV_Z0
160
 
        p += sprintf(p, "    L2\t\t: %s\n", (value & (1 << 22)) ?
161
 
                     "Enabled" : "Disabled");
162
 
#endif
163
 
        p += sprintf(p, "    L2 ECC\t: %s\n", (value & (1 << 23)) ?
164
 
                     "Enabled" : "Disabled");
165
 
 
166
 
        p += sprintf(p, "    L2 Prefetch\t: %s\n", (value & (1 << 24)) ?
167
 
                     "Disabled" : "Enabled");
168
 
 
169
 
        p += sprintf(p, "    L2 write allocate\t: %s\n", (value & (1 << 28)) ?
170
 
                     "Enabled" : "Disabled");
171
 
 
172
 
        p += sprintf(p, "    Streaming\t: %s\n", (value & (1 << 29)) ?
173
 
                     "Enabled" : "Disabled");
174
 
        
175
 
        asm volatile("mrc p15, 1, %0, c15, c12, 0": "=r"(value));
176
 
        p += sprintf(p, "CPU ID Code Extension: 0x%08x\n", value);
177
 
        
178
 
        asm volatile("mrc p15, 1, %0, c15, c9, 6": "=r"(value));
179
 
        p += sprintf(p, "L2C Error Counter: 0x%08x\n", value);
180
 
 
181
 
        p += sprintf(p, "    L2C Uncorrectable Errors \t: 0x%04x\n", value & 0xFFFF);
182
 
        p += sprintf(p, "    L2C Correctable Errors \t: 0x%04x\n", 
183
 
                     (value >> 16) & 0xFFFF);
184
 
 
185
 
        asm volatile("mrc p15, 1, %0, c15, c9, 7": "=r"(value));
186
 
        p += sprintf(p, "L2C Error Threshold: 0x%08x\n", value);
187
 
         
188
 
        asm volatile("mrc p15, 1, %0, c15, c11, 7": "=r"(value));
189
 
        p += sprintf(p, "L2C Error Capture: 0x%08x\n", value);
190
 
        
191
 
        asm volatile("mrc p15, 0, %0, c9, c14, 0": "=r"(value));
192
 
        p += sprintf(p, "User mode access for PMC registers: %s\n", (value & 1) ?
193
 
                     "Enabled" : "Disabled");
194
 
        asm volatile("mrc p15, 0, %0, c10, c2, 0": "=r"(value));
195
 
        p += sprintf(p, "Memory Attribute PRRR: 0x%08x\n", value);
196
 
 
197
 
        asm volatile("mrc p15, 0, %0, c10, c2, 1": "=r"(value));
198
 
        p += sprintf(p, "Memory Attribute NMRR: 0x%08x\n", value);
199
 
 
200
 
        asm volatile("mrc p15, 1, %0, c15, c1, 1": "=r"(value));
201
 
        p += sprintf(p, "Auxiliary Debug Modes Control: 0x%08x\n", value);
202
 
 
203
 
        len = (p - page) - off;
204
 
        if (len < 0)
205
 
                len = 0;
206
 
        
207
 
        *eof = (len <= count) ? 1 : 0;
208
 
        *start = page + off;
209
 
 
210
 
        return len;
211
 
}
212
 
int dump_init_module(void)
213
 
{
214
 
#ifdef CONFIG_PROC_FS
215
 
        struct proc_dir_entry *res;
216
 
        res = create_proc_entry("mv_dump_cp15", S_IRUSR, NULL);
217
 
        if (!res)
218
 
                return -ENOMEM;
219
 
 
220
 
        res->read_proc = proc_dump_cp15_read;
221
 
#endif
222
 
 
223
 
        return 0;
224
 
}
225
 
 
226
 
void dump_cleanup_module(void)
227
 
{
228
 
        remove_proc_entry("mv_dump_cp15", NULL);
229
 
}
230
 
 
231
 
module_init(dump_init_module);
232
 
module_exit(dump_cleanup_module);
233
 
 
234
 
MODULE_AUTHOR("Saeed Bishara");
235
 
MODULE_LICENSE("GPL");
236