aboutsummaryrefslogtreecommitdiff
path: root/arch/blackfin/kernel/cplbinfo.c
diff options
context:
space:
mode:
authorBernd Schmidt <bernds_cb1@t-online.de>2009-01-07 23:14:38 +0800
committerBryan Wu <cooloney@kernel.org>2009-01-07 23:14:38 +0800
commitdbdf20db537a5369c65330f878ad4905020a8bfa (patch)
treec7fa553755e2d75a6e98d3f32fbe41fab9f72609 /arch/blackfin/kernel/cplbinfo.c
parent6651ece9e257302ee695ee76e69a4427f7033235 (diff)
Blackfin arch: Faster C implementation of no-MPU CPLB handler
This is a mixture ofcMichael McTernan's patch and the existing cplb-mpu code. We ditch the old cplb-nompu implementation, which is a good example of why a good algorithm in a HLL is preferrable to a bad algorithm written in assembly. Rather than try to construct a table of all posible CPLBs and search it, we just create a (smaller) table of memory regions and their attributes. Some of the data structures are now unified for both the mpu and nompu cases. A lot of needless complexity in cplbinit.c is removed. Further optimizations: * compile cplbmgr.c with a lot of -ffixed-reg options, and omit saving these registers on the stack when entering a CPLB exception. * lose cli/nop/nop/sti sequences for some workarounds - these don't * make sense in an exception context Additional code unification should be possible after this. [Mike Frysinger <vapier.adi@gmail.com>: - convert CPP if statements to C if statements - remove redundant statements - use a do...while loop rather than a for loop to get slightly better optimization and to avoid gcc "may be used uninitialized" warnings ... we know that the [id]cplb_nr_bounds variables will never be 0, so this is OK - the no-mpu code was the last user of MAX_MEM_SIZE and with that rewritten, we can punt it - add some BUG_ON() checks to make sure we dont overflow the small cplb_bounds array - add i/d cplb entries for the bootrom because there is functions/data in there we want to access - we do not need a NULL trailing entry as any time we access the bounds arrays, we use the nr_bounds variable ] Signed-off-by: Michael McTernan <mmcternan@airvana.com> Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bernd Schmidt <bernds_cb1@t-online.de> Signed-off-by: Bryan Wu <cooloney@kernel.org>
Diffstat (limited to 'arch/blackfin/kernel/cplbinfo.c')
-rw-r--r--arch/blackfin/kernel/cplbinfo.c84
1 files changed, 0 insertions, 84 deletions
diff --git a/arch/blackfin/kernel/cplbinfo.c b/arch/blackfin/kernel/cplbinfo.c
index 1d3bbec1a19..64d78300dd0 100644
--- a/arch/blackfin/kernel/cplbinfo.c
+++ b/arch/blackfin/kernel/cplbinfo.c
@@ -20,8 +20,6 @@ static char const page_strtbl[][3] = { "1K", "4K", "1M", "4M" };
#define page(flags) (((flags) & 0x30000) >> 16)
#define strpage(flags) page_strtbl[page(flags)]
-#ifdef CONFIG_MPU
-
struct cplbinfo_data {
loff_t pos;
char cplb_type;
@@ -75,88 +73,6 @@ static void cplbinfo_seq_init(struct cplbinfo_data *cdata, unsigned int cpu)
}
}
-#else
-
-struct cplbinfo_data {
- loff_t pos;
- char cplb_type;
- u32 mem_control;
- unsigned long *pdt_tables, *pdt_swapcount;
- unsigned long cplb_addr, cplb_data;
-};
-
-extern int page_size_table[];
-
-static int cplb_find_entry(unsigned long addr_tbl, unsigned long data_tbl,
- unsigned long addr_find, unsigned long data_find)
-{
- int i;
-
- for (i = 0; i < 16; ++i) {
- unsigned long cplb_addr = bfin_read32(addr_tbl + i * 4);
- unsigned long cplb_data = bfin_read32(data_tbl + i * 4);
- if (addr_find >= cplb_addr &&
- addr_find < cplb_addr + page_size_table[page(cplb_data)] &&
- cplb_data == data_find)
- return i;
- }
-
- return -1;
-}
-
-static void cplbinfo_print_header(struct seq_file *m)
-{
- seq_printf(m, "Address\t\tData\tSize\tValid\tLocked\tSwapin\tiCount\toCount\n");
-}
-
-static int cplbinfo_nomore(struct cplbinfo_data *cdata)
-{
- return cdata->pdt_tables[cdata->pos * 2] == 0xffffffff;
-}
-
-static int cplbinfo_show(struct seq_file *m, void *p)
-{
- struct cplbinfo_data *cdata;
- unsigned long data, addr;
- int entry;
- loff_t pos;
-
- cdata = p;
- pos = cdata->pos * 2;
- addr = cdata->pdt_tables[pos];
- data = cdata->pdt_tables[pos + 1];
- entry = cplb_find_entry(cdata->cplb_addr, cdata->cplb_data, addr, data);
-
- seq_printf(m,
- "0x%08lx\t0x%05lx\t%s\t%c\t%c\t%2d\t%ld\t%ld\n",
- addr, data, strpage(data),
- (data & CPLB_VALID) ? 'Y' : 'N',
- (data & CPLB_LOCK) ? 'Y' : 'N', entry,
- cdata->pdt_swapcount[pos],
- cdata->pdt_swapcount[pos + 1]);
-
- return 0;
-}
-
-static void cplbinfo_seq_init(struct cplbinfo_data *cdata, unsigned int cpu)
-{
- if (cdata->cplb_type == 'I') {
- cdata->mem_control = bfin_read_IMEM_CONTROL();
- cdata->pdt_tables = ipdt_tables[cpu];
- cdata->pdt_swapcount = ipdt_swapcount_tables[cpu];
- cdata->cplb_addr = ICPLB_ADDR0;
- cdata->cplb_data = ICPLB_DATA0;
- } else {
- cdata->mem_control = bfin_read_DMEM_CONTROL();
- cdata->pdt_tables = dpdt_tables[cpu];
- cdata->pdt_swapcount = dpdt_swapcount_tables[cpu];
- cdata->cplb_addr = DCPLB_ADDR0;
- cdata->cplb_data = DCPLB_DATA0;
- }
-}
-
-#endif
-
static void *cplbinfo_start(struct seq_file *m, loff_t *pos)
{
struct cplbinfo_data *cdata = m->private;