aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin/kernel/cplb-nompu/cplbinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/blackfin/kernel/cplb-nompu/cplbinfo.c')
-rw-r--r--arch/blackfin/kernel/cplb-nompu/cplbinfo.c195
1 files changed, 0 insertions, 195 deletions
diff --git a/arch/blackfin/kernel/cplb-nompu/cplbinfo.c b/arch/blackfin/kernel/cplb-nompu/cplbinfo.c
deleted file mode 100644
index 1e74f0b9799..00000000000
--- a/arch/blackfin/kernel/cplb-nompu/cplbinfo.c
+++ /dev/null
@@ -1,195 +0,0 @@
1/*
2 * File: arch/blackfin/mach-common/cplbinfo.c
3 * Based on:
4 * Author: Sonic Zhang <sonic.zhang@analog.com>
5 *
6 * Created: Jan. 2005
7 * Description: Display CPLB status
8 *
9 * Modified:
10 * Copyright 2004-2006 Analog Devices Inc.
11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */
29
30#include <linux/module.h>
31#include <linux/kernel.h>
32#include <linux/init.h>
33#include <linux/proc_fs.h>
34#include <linux/uaccess.h>
35
36#include <asm/cplbinit.h>
37#include <asm/blackfin.h>
38
39#define CPLB_I 1
40#define CPLB_D 2
41
42#define SYNC_SYS SSYNC()
43#define SYNC_CORE CSYNC()
44
45#define CPLB_BIT_PAGESIZE 0x30000
46
47static int page_size_table[4] = {
48 0x00000400, /* 1K */
49 0x00001000, /* 4K */
50 0x00100000, /* 1M */
51 0x00400000 /* 4M */
52};
53
54static char page_size_string_table[][4] = { "1K", "4K", "1M", "4M" };
55
56static int cplb_find_entry(unsigned long *cplb_addr,
57 unsigned long *cplb_data, unsigned long addr,
58 unsigned long data)
59{
60 int ii;
61
62 for (ii = 0; ii < 16; ii++)
63 if (addr >= cplb_addr[ii] && addr < cplb_addr[ii] +
64 page_size_table[(cplb_data[ii] & CPLB_BIT_PAGESIZE) >> 16]
65 && (cplb_data[ii] == data))
66 return ii;
67
68 return -1;
69}
70
71static char *cplb_print_entry(char *buf, int type)
72{
73 unsigned long *p_addr = dpdt_table;
74 unsigned long *p_data = dpdt_table + 1;
75 unsigned long *p_icount = dpdt_swapcount_table;
76 unsigned long *p_ocount = dpdt_swapcount_table + 1;
77 unsigned long *cplb_addr = (unsigned long *)DCPLB_ADDR0;
78 unsigned long *cplb_data = (unsigned long *)DCPLB_DATA0;
79 int entry = 0, used_cplb = 0;
80
81 if (type == CPLB_I) {
82 buf += sprintf(buf, "Instruction CPLB entry:\n");
83 p_addr = ipdt_table;
84 p_data = ipdt_table + 1;
85 p_icount = ipdt_swapcount_table;
86 p_ocount = ipdt_swapcount_table + 1;
87 cplb_addr = (unsigned long *)ICPLB_ADDR0;
88 cplb_data = (unsigned long *)ICPLB_DATA0;
89 } else
90 buf += sprintf(buf, "Data CPLB entry:\n");
91
92 buf += sprintf(buf, "Address\t\tData\tSize\tValid\tLocked\tSwapin\tiCount\toCount\n");
93
94 while (*p_addr != 0xffffffff) {
95 entry = cplb_find_entry(cplb_addr, cplb_data, *p_addr, *p_data);
96 if (entry >= 0)
97 used_cplb |= 1 << entry;
98
99 buf +=
100 sprintf(buf,
101 "0x%08lx\t0x%05lx\t%s\t%c\t%c\t%2d\t%ld\t%ld\n",
102 *p_addr, *p_data,
103 page_size_string_table[(*p_data & 0x30000) >> 16],
104 (*p_data & CPLB_VALID) ? 'Y' : 'N',
105 (*p_data & CPLB_LOCK) ? 'Y' : 'N', entry, *p_icount,
106 *p_ocount);
107
108 p_addr += 2;
109 p_data += 2;
110 p_icount += 2;
111 p_ocount += 2;
112 }
113
114 if (used_cplb != 0xffff) {
115 buf += sprintf(buf, "Unused/mismatched CPLBs:\n");
116
117 for (entry = 0; entry < 16; entry++)
118 if (0 == ((1 << entry) & used_cplb)) {
119 int flags = cplb_data[entry];
120 buf +=
121 sprintf(buf,
122 "%2d: 0x%08lx\t0x%05x\t%s\t%c\t%c\n",
123 entry, cplb_addr[entry], flags,
124 page_size_string_table[(flags &
125 0x30000) >>
126 16],
127 (flags & CPLB_VALID) ? 'Y' : 'N',
128 (flags & CPLB_LOCK) ? 'Y' : 'N');
129 }
130 }
131
132 buf += sprintf(buf, "\n");
133
134 return buf;
135}
136
137static int cplbinfo_proc_output(char *buf)
138{
139 char *p;
140
141 p = buf;
142
143 p += sprintf(p, "------------------ CPLB Information ------------------\n\n");
144
145 if (bfin_read_IMEM_CONTROL() & ENICPLB)
146 p = cplb_print_entry(p, CPLB_I);
147 else
148 p += sprintf(p, "Instruction CPLB is disabled.\n\n");
149
150 if (bfin_read_DMEM_CONTROL() & ENDCPLB)
151 p = cplb_print_entry(p, CPLB_D);
152 else
153 p += sprintf(p, "Data CPLB is disabled.\n");
154
155 return p - buf;
156}
157
158static int cplbinfo_read_proc(char *page, char **start, off_t off,
159 int count, int *eof, void *data)
160{
161 int len;
162
163 len = cplbinfo_proc_output(page);
164 if (len <= off + count)
165 *eof = 1;
166 *start = page + off;
167 len -= off;
168 if (len > count)
169 len = count;
170 if (len < 0)
171 len = 0;
172 return len;
173}
174
175static int __init cplbinfo_init(void)
176{
177 struct proc_dir_entry *entry;
178
179 entry = create_proc_entry("cplbinfo", 0, NULL);
180 if (!entry)
181 return -ENOMEM;
182
183 entry->read_proc = cplbinfo_read_proc;
184 entry->data = NULL;
185
186 return 0;
187}
188
189static void __exit cplbinfo_exit(void)
190{
191 remove_proc_entry("cplbinfo", NULL);
192}
193
194module_init(cplbinfo_init);
195module_exit(cplbinfo_exit);