diff options
author | Graf Yang <graf.yang@analog.com> | 2008-11-18 04:48:22 -0500 |
---|---|---|
committer | Bryan Wu <cooloney@kernel.org> | 2008-11-18 04:48:22 -0500 |
commit | b8a989893cbdeb6c97a7b5af5f38fb0e480235f9 (patch) | |
tree | 658cf6df93dac687f0d6b94111d0f53b3dd0177c /arch/blackfin/kernel | |
parent | 6b3087c64a92a36ae20d33479b4df6d7afc910d4 (diff) |
Blackfin arch: SMP supporting patchset: Blackfin CPLB related code
Blackfin dual core BF561 processor can support SMP like features.
https://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:smp-like
In this patch, we provide SMP extend to Blackfin CPLB related code
Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Diffstat (limited to 'arch/blackfin/kernel')
-rw-r--r-- | arch/blackfin/kernel/cplb-mpu/cacheinit.c | 4 | ||||
-rw-r--r-- | arch/blackfin/kernel/cplb-mpu/cplbinfo.c | 43 | ||||
-rw-r--r-- | arch/blackfin/kernel/cplb-mpu/cplbinit.c | 43 | ||||
-rw-r--r-- | arch/blackfin/kernel/cplb-mpu/cplbmgr.c | 102 | ||||
-rw-r--r-- | arch/blackfin/kernel/cplb-nompu/cacheinit.c | 9 | ||||
-rw-r--r-- | arch/blackfin/kernel/cplb-nompu/cplbinfo.c | 55 | ||||
-rw-r--r-- | arch/blackfin/kernel/cplb-nompu/cplbinit.c | 89 | ||||
-rw-r--r-- | arch/blackfin/kernel/cplb-nompu/cplbmgr.S | 29 |
8 files changed, 189 insertions, 185 deletions
diff --git a/arch/blackfin/kernel/cplb-mpu/cacheinit.c b/arch/blackfin/kernel/cplb-mpu/cacheinit.c index a8b712a24c59..c6ff947f9d37 100644 --- a/arch/blackfin/kernel/cplb-mpu/cacheinit.c +++ b/arch/blackfin/kernel/cplb-mpu/cacheinit.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <asm/cplbinit.h> | 25 | #include <asm/cplbinit.h> |
26 | 26 | ||
27 | #if defined(CONFIG_BFIN_ICACHE) | 27 | #if defined(CONFIG_BFIN_ICACHE) |
28 | void __init bfin_icache_init(void) | 28 | void __cpuinit bfin_icache_init(struct cplb_entry *icplb_tbl) |
29 | { | 29 | { |
30 | unsigned long ctrl; | 30 | unsigned long ctrl; |
31 | int i; | 31 | int i; |
@@ -43,7 +43,7 @@ void __init bfin_icache_init(void) | |||
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | #if defined(CONFIG_BFIN_DCACHE) | 45 | #if defined(CONFIG_BFIN_DCACHE) |
46 | void __init bfin_dcache_init(void) | 46 | void __cpuinit bfin_dcache_init(struct cplb_entry *dcplb_tbl) |
47 | { | 47 | { |
48 | unsigned long ctrl; | 48 | unsigned long ctrl; |
49 | int i; | 49 | int i; |
diff --git a/arch/blackfin/kernel/cplb-mpu/cplbinfo.c b/arch/blackfin/kernel/cplb-mpu/cplbinfo.c index 822beefa3a4b..00cb2cf3a420 100644 --- a/arch/blackfin/kernel/cplb-mpu/cplbinfo.c +++ b/arch/blackfin/kernel/cplb-mpu/cplbinfo.c | |||
@@ -66,32 +66,32 @@ static char *cplb_print_entry(char *buf, struct cplb_entry *tbl, int switched) | |||
66 | return buf; | 66 | return buf; |
67 | } | 67 | } |
68 | 68 | ||
69 | int cplbinfo_proc_output(char *buf) | 69 | int cplbinfo_proc_output(char *buf, void *data) |
70 | { | 70 | { |
71 | char *p; | 71 | char *p; |
72 | unsigned int cpu = (unsigned int)data;; | ||
72 | 73 | ||
73 | p = buf; | 74 | p = buf; |
74 | 75 | ||
75 | p += sprintf(p, "------------------ CPLB Information ------------------\n\n"); | 76 | p += sprintf(p, "------------- CPLB Information on CPU%u --------------\n\n", cpu); |
76 | |||
77 | if (bfin_read_IMEM_CONTROL() & ENICPLB) { | 77 | if (bfin_read_IMEM_CONTROL() & ENICPLB) { |
78 | p += sprintf(p, "Instruction CPLB entry:\n"); | 78 | p += sprintf(p, "Instruction CPLB entry:\n"); |
79 | p = cplb_print_entry(p, icplb_tbl, first_switched_icplb); | 79 | p = cplb_print_entry(p, icplb_tbl[cpu], first_switched_icplb); |
80 | } else | 80 | } else |
81 | p += sprintf(p, "Instruction CPLB is disabled.\n\n"); | 81 | p += sprintf(p, "Instruction CPLB is disabled.\n\n"); |
82 | 82 | ||
83 | if (1 || bfin_read_DMEM_CONTROL() & ENDCPLB) { | 83 | if (1 || bfin_read_DMEM_CONTROL() & ENDCPLB) { |
84 | p += sprintf(p, "Data CPLB entry:\n"); | 84 | p += sprintf(p, "Data CPLB entry:\n"); |
85 | p = cplb_print_entry(p, dcplb_tbl, first_switched_dcplb); | 85 | p = cplb_print_entry(p, dcplb_tbl[cpu], first_switched_dcplb); |
86 | } else | 86 | } else |
87 | p += sprintf(p, "Data CPLB is disabled.\n"); | 87 | p += sprintf(p, "Data CPLB is disabled.\n"); |
88 | 88 | ||
89 | p += sprintf(p, "ICPLB miss: %d\nICPLB supervisor miss: %d\n", | 89 | p += sprintf(p, "ICPLB miss: %d\nICPLB supervisor miss: %d\n", |
90 | nr_icplb_miss, nr_icplb_supv_miss); | 90 | nr_icplb_miss[cpu], nr_icplb_supv_miss[cpu]); |
91 | p += sprintf(p, "DCPLB miss: %d\nDCPLB protection fault:%d\n", | 91 | p += sprintf(p, "DCPLB miss: %d\nDCPLB protection fault:%d\n", |
92 | nr_dcplb_miss, nr_dcplb_prot); | 92 | nr_dcplb_miss[cpu], nr_dcplb_prot[cpu]); |
93 | p += sprintf(p, "CPLB flushes: %d\n", | 93 | p += sprintf(p, "CPLB flushes: %d\n", |
94 | nr_cplb_flush); | 94 | nr_cplb_flush[cpu]); |
95 | 95 | ||
96 | return p - buf; | 96 | return p - buf; |
97 | } | 97 | } |
@@ -101,7 +101,7 @@ static int cplbinfo_read_proc(char *page, char **start, off_t off, | |||
101 | { | 101 | { |
102 | int len; | 102 | int len; |
103 | 103 | ||
104 | len = cplbinfo_proc_output(page); | 104 | len = cplbinfo_proc_output(page, data); |
105 | if (len <= off + count) | 105 | if (len <= off + count) |
106 | *eof = 1; | 106 | *eof = 1; |
107 | *start = page + off; | 107 | *start = page + off; |
@@ -115,20 +115,33 @@ static int cplbinfo_read_proc(char *page, char **start, off_t off, | |||
115 | 115 | ||
116 | static int __init cplbinfo_init(void) | 116 | static int __init cplbinfo_init(void) |
117 | { | 117 | { |
118 | struct proc_dir_entry *entry; | 118 | struct proc_dir_entry *parent, *entry; |
119 | unsigned int cpu; | ||
120 | unsigned char str[10]; | ||
121 | |||
122 | parent = proc_mkdir("cplbinfo", NULL); | ||
119 | 123 | ||
120 | entry = create_proc_entry("cplbinfo", 0, NULL); | 124 | for_each_online_cpu(cpu) { |
121 | if (!entry) | 125 | sprintf(str, "cpu%u", cpu); |
122 | return -ENOMEM; | 126 | entry = create_proc_entry(str, 0, parent); |
127 | if (!entry) | ||
128 | return -ENOMEM; | ||
123 | 129 | ||
124 | entry->read_proc = cplbinfo_read_proc; | 130 | entry->read_proc = cplbinfo_read_proc; |
125 | entry->data = NULL; | 131 | entry->data = (void *)cpu; |
132 | } | ||
126 | 133 | ||
127 | return 0; | 134 | return 0; |
128 | } | 135 | } |
129 | 136 | ||
130 | static void __exit cplbinfo_exit(void) | 137 | static void __exit cplbinfo_exit(void) |
131 | { | 138 | { |
139 | unsigned int cpu; | ||
140 | unsigned char str[20]; | ||
141 | for_each_online_cpu(cpu) { | ||
142 | sprintf(str, "cplbinfo/cpu%u", cpu); | ||
143 | remove_proc_entry(str, NULL); | ||
144 | } | ||
132 | remove_proc_entry("cplbinfo", NULL); | 145 | remove_proc_entry("cplbinfo", NULL); |
133 | } | 146 | } |
134 | 147 | ||
diff --git a/arch/blackfin/kernel/cplb-mpu/cplbinit.c b/arch/blackfin/kernel/cplb-mpu/cplbinit.c index 55af729f8495..269d2a3530a6 100644 --- a/arch/blackfin/kernel/cplb-mpu/cplbinit.c +++ b/arch/blackfin/kernel/cplb-mpu/cplbinit.c | |||
@@ -30,13 +30,13 @@ | |||
30 | # error the MPU will not function safely while Anomaly 05000263 applies | 30 | # error the MPU will not function safely while Anomaly 05000263 applies |
31 | #endif | 31 | #endif |
32 | 32 | ||
33 | struct cplb_entry icplb_tbl[MAX_CPLBS]; | 33 | struct cplb_entry icplb_tbl[NR_CPUS][MAX_CPLBS]; |
34 | struct cplb_entry dcplb_tbl[MAX_CPLBS]; | 34 | struct cplb_entry dcplb_tbl[NR_CPUS][MAX_CPLBS]; |
35 | 35 | ||
36 | int first_switched_icplb, first_switched_dcplb; | 36 | int first_switched_icplb, first_switched_dcplb; |
37 | int first_mask_dcplb; | 37 | int first_mask_dcplb; |
38 | 38 | ||
39 | void __init generate_cplb_tables(void) | 39 | void __init generate_cplb_tables_cpu(unsigned int cpu) |
40 | { | 40 | { |
41 | int i_d, i_i; | 41 | int i_d, i_i; |
42 | unsigned long addr; | 42 | unsigned long addr; |
@@ -55,15 +55,16 @@ void __init generate_cplb_tables(void) | |||
55 | d_cache |= CPLB_L1_AOW | CPLB_WT; | 55 | d_cache |= CPLB_L1_AOW | CPLB_WT; |
56 | #endif | 56 | #endif |
57 | #endif | 57 | #endif |
58 | |||
58 | i_d = i_i = 0; | 59 | i_d = i_i = 0; |
59 | 60 | ||
60 | /* Set up the zero page. */ | 61 | /* Set up the zero page. */ |
61 | dcplb_tbl[i_d].addr = 0; | 62 | dcplb_tbl[cpu][i_d].addr = 0; |
62 | dcplb_tbl[i_d++].data = SDRAM_OOPS | PAGE_SIZE_1KB; | 63 | dcplb_tbl[cpu][i_d++].data = SDRAM_OOPS | PAGE_SIZE_1KB; |
63 | 64 | ||
64 | #if 0 | 65 | #if 0 |
65 | icplb_tbl[i_i].addr = 0; | 66 | icplb_tbl[cpu][i_i].addr = 0; |
66 | icplb_tbl[i_i++].data = i_cache | CPLB_USER_RD | PAGE_SIZE_4KB; | 67 | icplb_tbl[cpu][i_i++].data = i_cache | CPLB_USER_RD | PAGE_SIZE_4KB; |
67 | #endif | 68 | #endif |
68 | 69 | ||
69 | /* Cover kernel memory with 4M pages. */ | 70 | /* Cover kernel memory with 4M pages. */ |
@@ -72,28 +73,28 @@ void __init generate_cplb_tables(void) | |||
72 | i_data = i_cache | CPLB_VALID | CPLB_PORTPRIO | PAGE_SIZE_4MB; | 73 | i_data = i_cache | CPLB_VALID | CPLB_PORTPRIO | PAGE_SIZE_4MB; |
73 | 74 | ||
74 | for (; addr < memory_start; addr += 4 * 1024 * 1024) { | 75 | for (; addr < memory_start; addr += 4 * 1024 * 1024) { |
75 | dcplb_tbl[i_d].addr = addr; | 76 | dcplb_tbl[cpu][i_d].addr = addr; |
76 | dcplb_tbl[i_d++].data = d_data; | 77 | dcplb_tbl[cpu][i_d++].data = d_data; |
77 | icplb_tbl[i_i].addr = addr; | 78 | icplb_tbl[cpu][i_i].addr = addr; |
78 | icplb_tbl[i_i++].data = i_data | (addr == 0 ? CPLB_USER_RD : 0); | 79 | icplb_tbl[cpu][i_i++].data = i_data | (addr == 0 ? CPLB_USER_RD : 0); |
79 | } | 80 | } |
80 | 81 | ||
81 | /* Cover L1 memory. One 4M area for code and data each is enough. */ | 82 | /* Cover L1 memory. One 4M area for code and data each is enough. */ |
82 | #if L1_DATA_A_LENGTH > 0 || L1_DATA_B_LENGTH > 0 | 83 | #if L1_DATA_A_LENGTH > 0 || L1_DATA_B_LENGTH > 0 |
83 | dcplb_tbl[i_d].addr = L1_DATA_A_START; | 84 | dcplb_tbl[cpu][i_d].addr = get_l1_data_a_start_cpu(cpu); |
84 | dcplb_tbl[i_d++].data = L1_DMEMORY | PAGE_SIZE_4MB; | 85 | dcplb_tbl[cpu][i_d++].data = L1_DMEMORY | PAGE_SIZE_4MB; |
85 | #endif | 86 | #endif |
86 | #if L1_CODE_LENGTH > 0 | 87 | #if L1_CODE_LENGTH > 0 |
87 | icplb_tbl[i_i].addr = L1_CODE_START; | 88 | icplb_tbl[cpu][i_i].addr = get_l1_code_start_cpu(cpu); |
88 | icplb_tbl[i_i++].data = L1_IMEMORY | PAGE_SIZE_4MB; | 89 | icplb_tbl[cpu][i_i++].data = L1_IMEMORY | PAGE_SIZE_4MB; |
89 | #endif | 90 | #endif |
90 | 91 | ||
91 | /* Cover L2 memory */ | 92 | /* Cover L2 memory */ |
92 | #if L2_LENGTH > 0 | 93 | #if L2_LENGTH > 0 |
93 | dcplb_tbl[i_d].addr = L2_START; | 94 | dcplb_tbl[cpu][i_d].addr = L2_START; |
94 | dcplb_tbl[i_d++].data = L2_DMEMORY | PAGE_SIZE_1MB; | 95 | dcplb_tbl[cpu][i_d++].data = L2_DMEMORY | PAGE_SIZE_1MB; |
95 | icplb_tbl[i_i].addr = L2_START; | 96 | icplb_tbl[cpu][i_i].addr = L2_START; |
96 | icplb_tbl[i_i++].data = L2_IMEMORY | PAGE_SIZE_1MB; | 97 | icplb_tbl[cpu][i_i++].data = L2_IMEMORY | PAGE_SIZE_1MB; |
97 | #endif | 98 | #endif |
98 | 99 | ||
99 | first_mask_dcplb = i_d; | 100 | first_mask_dcplb = i_d; |
@@ -101,7 +102,7 @@ void __init generate_cplb_tables(void) | |||
101 | first_switched_icplb = i_i; | 102 | first_switched_icplb = i_i; |
102 | 103 | ||
103 | while (i_d < MAX_CPLBS) | 104 | while (i_d < MAX_CPLBS) |
104 | dcplb_tbl[i_d++].data = 0; | 105 | dcplb_tbl[cpu][i_d++].data = 0; |
105 | while (i_i < MAX_CPLBS) | 106 | while (i_i < MAX_CPLBS) |
106 | icplb_tbl[i_i++].data = 0; | 107 | icplb_tbl[cpu][i_i++].data = 0; |
107 | } | 108 | } |
diff --git a/arch/blackfin/kernel/cplb-mpu/cplbmgr.c b/arch/blackfin/kernel/cplb-mpu/cplbmgr.c index baa52e261f0d..76bd99177de5 100644 --- a/arch/blackfin/kernel/cplb-mpu/cplbmgr.c +++ b/arch/blackfin/kernel/cplb-mpu/cplbmgr.c | |||
@@ -30,10 +30,11 @@ | |||
30 | 30 | ||
31 | int page_mask_nelts; | 31 | int page_mask_nelts; |
32 | int page_mask_order; | 32 | int page_mask_order; |
33 | unsigned long *current_rwx_mask; | 33 | unsigned long *current_rwx_mask[NR_CPUS]; |
34 | 34 | ||
35 | int nr_dcplb_miss, nr_icplb_miss, nr_icplb_supv_miss, nr_dcplb_prot; | 35 | int nr_dcplb_miss[NR_CPUS], nr_icplb_miss[NR_CPUS]; |
36 | int nr_cplb_flush; | 36 | int nr_icplb_supv_miss[NR_CPUS], nr_dcplb_prot[NR_CPUS]; |
37 | int nr_cplb_flush[NR_CPUS]; | ||
37 | 38 | ||
38 | static inline void disable_dcplb(void) | 39 | static inline void disable_dcplb(void) |
39 | { | 40 | { |
@@ -98,42 +99,42 @@ static inline int write_permitted(int status, unsigned long data) | |||
98 | } | 99 | } |
99 | 100 | ||
100 | /* Counters to implement round-robin replacement. */ | 101 | /* Counters to implement round-robin replacement. */ |
101 | static int icplb_rr_index, dcplb_rr_index; | 102 | static int icplb_rr_index[NR_CPUS], dcplb_rr_index[NR_CPUS]; |
102 | 103 | ||
103 | /* | 104 | /* |
104 | * Find an ICPLB entry to be evicted and return its index. | 105 | * Find an ICPLB entry to be evicted and return its index. |
105 | */ | 106 | */ |
106 | static int evict_one_icplb(void) | 107 | static int evict_one_icplb(unsigned int cpu) |
107 | { | 108 | { |
108 | int i; | 109 | int i; |
109 | for (i = first_switched_icplb; i < MAX_CPLBS; i++) | 110 | for (i = first_switched_icplb; i < MAX_CPLBS; i++) |
110 | if ((icplb_tbl[i].data & CPLB_VALID) == 0) | 111 | if ((icplb_tbl[cpu][i].data & CPLB_VALID) == 0) |
111 | return i; | 112 | return i; |
112 | i = first_switched_icplb + icplb_rr_index; | 113 | i = first_switched_icplb + icplb_rr_index[cpu]; |
113 | if (i >= MAX_CPLBS) { | 114 | if (i >= MAX_CPLBS) { |
114 | i -= MAX_CPLBS - first_switched_icplb; | 115 | i -= MAX_CPLBS - first_switched_icplb; |
115 | icplb_rr_index -= MAX_CPLBS - first_switched_icplb; | 116 | icplb_rr_index[cpu] -= MAX_CPLBS - first_switched_icplb; |
116 | } | 117 | } |
117 | icplb_rr_index++; | 118 | icplb_rr_index[cpu]++; |
118 | return i; | 119 | return i; |
119 | } | 120 | } |
120 | 121 | ||
121 | static int evict_one_dcplb(void) | 122 | static int evict_one_dcplb(unsigned int cpu) |
122 | { | 123 | { |
123 | int i; | 124 | int i; |
124 | for (i = first_switched_dcplb; i < MAX_CPLBS; i++) | 125 | for (i = first_switched_dcplb; i < MAX_CPLBS; i++) |
125 | if ((dcplb_tbl[i].data & CPLB_VALID) == 0) | 126 | if ((dcplb_tbl[cpu][i].data & CPLB_VALID) == 0) |
126 | return i; | 127 | return i; |
127 | i = first_switched_dcplb + dcplb_rr_index; | 128 | i = first_switched_dcplb + dcplb_rr_index[cpu]; |
128 | if (i >= MAX_CPLBS) { | 129 | if (i >= MAX_CPLBS) { |
129 | i -= MAX_CPLBS - first_switched_dcplb; | 130 | i -= MAX_CPLBS - first_switched_dcplb; |
130 | dcplb_rr_index -= MAX_CPLBS - first_switched_dcplb; | 131 | dcplb_rr_index[cpu] -= MAX_CPLBS - first_switched_dcplb; |
131 | } | 132 | } |
132 | dcplb_rr_index++; | 133 | dcplb_rr_index[cpu]++; |
133 | return i; | 134 | return i; |
134 | } | 135 | } |
135 | 136 | ||
136 | static noinline int dcplb_miss(void) | 137 | static noinline int dcplb_miss(unsigned int cpu) |
137 | { | 138 | { |
138 | unsigned long addr = bfin_read_DCPLB_FAULT_ADDR(); | 139 | unsigned long addr = bfin_read_DCPLB_FAULT_ADDR(); |
139 | int status = bfin_read_DCPLB_STATUS(); | 140 | int status = bfin_read_DCPLB_STATUS(); |
@@ -141,7 +142,7 @@ static noinline int dcplb_miss(void) | |||
141 | int idx; | 142 | int idx; |
142 | unsigned long d_data; | 143 | unsigned long d_data; |
143 | 144 | ||
144 | nr_dcplb_miss++; | 145 | nr_dcplb_miss[cpu]++; |
145 | 146 | ||
146 | d_data = CPLB_SUPV_WR | CPLB_VALID | CPLB_DIRTY | PAGE_SIZE_4KB; | 147 | d_data = CPLB_SUPV_WR | CPLB_VALID | CPLB_DIRTY | PAGE_SIZE_4KB; |
147 | #ifdef CONFIG_BFIN_DCACHE | 148 | #ifdef CONFIG_BFIN_DCACHE |
@@ -168,25 +169,25 @@ static noinline int dcplb_miss(void) | |||
168 | } else if (addr >= _ramend) { | 169 | } else if (addr >= _ramend) { |
169 | d_data |= CPLB_USER_RD | CPLB_USER_WR; | 170 | d_data |= CPLB_USER_RD | CPLB_USER_WR; |
170 | } else { | 171 | } else { |
171 | mask = current_rwx_mask; | 172 | mask = current_rwx_mask[cpu]; |
172 | if (mask) { | 173 | if (mask) { |
173 | int page = addr >> PAGE_SHIFT; | 174 | int page = addr >> PAGE_SHIFT; |
174 | int offs = page >> 5; | 175 | int idx = page >> 5; |
175 | int bit = 1 << (page & 31); | 176 | int bit = 1 << (page & 31); |
176 | 177 | ||
177 | if (mask[offs] & bit) | 178 | if (mask[idx] & bit) |
178 | d_data |= CPLB_USER_RD; | 179 | d_data |= CPLB_USER_RD; |
179 | 180 | ||
180 | mask += page_mask_nelts; | 181 | mask += page_mask_nelts; |
181 | if (mask[offs] & bit) | 182 | if (mask[idx] & bit) |
182 | d_data |= CPLB_USER_WR; | 183 | d_data |= CPLB_USER_WR; |
183 | } | 184 | } |
184 | } | 185 | } |
185 | idx = evict_one_dcplb(); | 186 | idx = evict_one_dcplb(cpu); |
186 | 187 | ||
187 | addr &= PAGE_MASK; | 188 | addr &= PAGE_MASK; |
188 | dcplb_tbl[idx].addr = addr; | 189 | dcplb_tbl[cpu][idx].addr = addr; |
189 | dcplb_tbl[idx].data = d_data; | 190 | dcplb_tbl[cpu][idx].data = d_data; |
190 | 191 | ||
191 | disable_dcplb(); | 192 | disable_dcplb(); |
192 | bfin_write32(DCPLB_DATA0 + idx * 4, d_data); | 193 | bfin_write32(DCPLB_DATA0 + idx * 4, d_data); |
@@ -196,21 +197,21 @@ static noinline int dcplb_miss(void) | |||
196 | return 0; | 197 | return 0; |
197 | } | 198 | } |
198 | 199 | ||
199 | static noinline int icplb_miss(void) | 200 | static noinline int icplb_miss(unsigned int cpu) |
200 | { | 201 | { |
201 | unsigned long addr = bfin_read_ICPLB_FAULT_ADDR(); | 202 | unsigned long addr = bfin_read_ICPLB_FAULT_ADDR(); |
202 | int status = bfin_read_ICPLB_STATUS(); | 203 | int status = bfin_read_ICPLB_STATUS(); |
203 | int idx; | 204 | int idx; |
204 | unsigned long i_data; | 205 | unsigned long i_data; |
205 | 206 | ||
206 | nr_icplb_miss++; | 207 | nr_icplb_miss[cpu]++; |
207 | 208 | ||
208 | /* If inside the uncached DMA region, fault. */ | 209 | /* If inside the uncached DMA region, fault. */ |
209 | if (addr >= _ramend - DMA_UNCACHED_REGION && addr < _ramend) | 210 | if (addr >= _ramend - DMA_UNCACHED_REGION && addr < _ramend) |
210 | return CPLB_PROT_VIOL; | 211 | return CPLB_PROT_VIOL; |
211 | 212 | ||
212 | if (status & FAULT_USERSUPV) | 213 | if (status & FAULT_USERSUPV) |
213 | nr_icplb_supv_miss++; | 214 | nr_icplb_supv_miss[cpu]++; |
214 | 215 | ||
215 | /* | 216 | /* |
216 | * First, try to find a CPLB that matches this address. If we | 217 | * First, try to find a CPLB that matches this address. If we |
@@ -218,8 +219,8 @@ static noinline int icplb_miss(void) | |||
218 | * that the instruction crosses a page boundary. | 219 | * that the instruction crosses a page boundary. |
219 | */ | 220 | */ |
220 | for (idx = first_switched_icplb; idx < MAX_CPLBS; idx++) { | 221 | for (idx = first_switched_icplb; idx < MAX_CPLBS; idx++) { |
221 | if (icplb_tbl[idx].data & CPLB_VALID) { | 222 | if (icplb_tbl[cpu][idx].data & CPLB_VALID) { |
222 | unsigned long this_addr = icplb_tbl[idx].addr; | 223 | unsigned long this_addr = icplb_tbl[cpu][idx].addr; |
223 | if (this_addr <= addr && this_addr + PAGE_SIZE > addr) { | 224 | if (this_addr <= addr && this_addr + PAGE_SIZE > addr) { |
224 | addr += PAGE_SIZE; | 225 | addr += PAGE_SIZE; |
225 | break; | 226 | break; |
@@ -257,23 +258,23 @@ static noinline int icplb_miss(void) | |||
257 | * Otherwise, check the x bitmap of the current process. | 258 | * Otherwise, check the x bitmap of the current process. |
258 | */ | 259 | */ |
259 | if (!(status & FAULT_USERSUPV)) { | 260 | if (!(status & FAULT_USERSUPV)) { |
260 | unsigned long *mask = current_rwx_mask; | 261 | unsigned long *mask = current_rwx_mask[cpu]; |
261 | 262 | ||
262 | if (mask) { | 263 | if (mask) { |
263 | int page = addr >> PAGE_SHIFT; | 264 | int page = addr >> PAGE_SHIFT; |
264 | int offs = page >> 5; | 265 | int idx = page >> 5; |
265 | int bit = 1 << (page & 31); | 266 | int bit = 1 << (page & 31); |
266 | 267 | ||
267 | mask += 2 * page_mask_nelts; | 268 | mask += 2 * page_mask_nelts; |
268 | if (mask[offs] & bit) | 269 | if (mask[idx] & bit) |
269 | i_data |= CPLB_USER_RD; | 270 | i_data |= CPLB_USER_RD; |
270 | } | 271 | } |
271 | } | 272 | } |
272 | } | 273 | } |
273 | idx = evict_one_icplb(); | 274 | idx = evict_one_icplb(cpu); |
274 | addr &= PAGE_MASK; | 275 | addr &= PAGE_MASK; |
275 | icplb_tbl[idx].addr = addr; | 276 | icplb_tbl[cpu][idx].addr = addr; |
276 | icplb_tbl[idx].data = i_data; | 277 | icplb_tbl[cpu][idx].data = i_data; |
277 | 278 | ||
278 | disable_icplb(); | 279 | disable_icplb(); |
279 | bfin_write32(ICPLB_DATA0 + idx * 4, i_data); | 280 | bfin_write32(ICPLB_DATA0 + idx * 4, i_data); |
@@ -283,19 +284,19 @@ static noinline int icplb_miss(void) | |||
283 | return 0; | 284 | return 0; |
284 | } | 285 | } |
285 | 286 | ||
286 | static noinline int dcplb_protection_fault(void) | 287 | static noinline int dcplb_protection_fault(unsigned int cpu) |
287 | { | 288 | { |
288 | int status = bfin_read_DCPLB_STATUS(); | 289 | int status = bfin_read_DCPLB_STATUS(); |
289 | 290 | ||
290 | nr_dcplb_prot++; | 291 | nr_dcplb_prot[cpu]++; |
291 | 292 | ||
292 | if (status & FAULT_RW) { | 293 | if (status & FAULT_RW) { |
293 | int idx = faulting_cplb_index(status); | 294 | int idx = faulting_cplb_index(status); |
294 | unsigned long data = dcplb_tbl[idx].data; | 295 | unsigned long data = dcplb_tbl[cpu][idx].data; |
295 | if (!(data & CPLB_WT) && !(data & CPLB_DIRTY) && | 296 | if (!(data & CPLB_WT) && !(data & CPLB_DIRTY) && |
296 | write_permitted(status, data)) { | 297 | write_permitted(status, data)) { |
297 | data |= CPLB_DIRTY; | 298 | data |= CPLB_DIRTY; |
298 | dcplb_tbl[idx].data = data; | 299 | dcplb_tbl[cpu][idx].data = data; |
299 | bfin_write32(DCPLB_DATA0 + idx * 4, data); | 300 | bfin_write32(DCPLB_DATA0 + idx * 4, data); |
300 | return 0; | 301 | return 0; |
301 | } | 302 | } |
@@ -306,36 +307,37 @@ static noinline int dcplb_protection_fault(void) | |||
306 | int cplb_hdr(int seqstat, struct pt_regs *regs) | 307 | int cplb_hdr(int seqstat, struct pt_regs *regs) |
307 | { | 308 | { |
308 | int cause = seqstat & 0x3f; | 309 | int cause = seqstat & 0x3f; |
310 | unsigned int cpu = smp_processor_id(); | ||
309 | switch (cause) { | 311 | switch (cause) { |
310 | case 0x23: | 312 | case 0x23: |
311 | return dcplb_protection_fault(); | 313 | return dcplb_protection_fault(cpu); |
312 | case 0x2C: | 314 | case 0x2C: |
313 | return icplb_miss(); | 315 | return icplb_miss(cpu); |
314 | case 0x26: | 316 | case 0x26: |
315 | return dcplb_miss(); | 317 | return dcplb_miss(cpu); |
316 | default: | 318 | default: |
317 | return 1; | 319 | return 1; |
318 | } | 320 | } |
319 | } | 321 | } |
320 | 322 | ||
321 | void flush_switched_cplbs(void) | 323 | void flush_switched_cplbs(unsigned int cpu) |
322 | { | 324 | { |
323 | int i; | 325 | int i; |
324 | unsigned long flags; | 326 | unsigned long flags; |
325 | 327 | ||
326 | nr_cplb_flush++; | 328 | nr_cplb_flush[cpu]++; |
327 | 329 | ||
328 | local_irq_save(flags); | 330 | local_irq_save(flags); |
329 | disable_icplb(); | 331 | disable_icplb(); |
330 | for (i = first_switched_icplb; i < MAX_CPLBS; i++) { | 332 | for (i = first_switched_icplb; i < MAX_CPLBS; i++) { |
331 | icplb_tbl[i].data = 0; | 333 | icplb_tbl[cpu][i].data = 0; |
332 | bfin_write32(ICPLB_DATA0 + i * 4, 0); | 334 | bfin_write32(ICPLB_DATA0 + i * 4, 0); |
333 | } | 335 | } |
334 | enable_icplb(); | 336 | enable_icplb(); |
335 | 337 | ||
336 | disable_dcplb(); | 338 | disable_dcplb(); |
337 | for (i = first_switched_dcplb; i < MAX_CPLBS; i++) { | 339 | for (i = first_switched_dcplb; i < MAX_CPLBS; i++) { |
338 | dcplb_tbl[i].data = 0; | 340 | dcplb_tbl[cpu][i].data = 0; |
339 | bfin_write32(DCPLB_DATA0 + i * 4, 0); | 341 | bfin_write32(DCPLB_DATA0 + i * 4, 0); |
340 | } | 342 | } |
341 | enable_dcplb(); | 343 | enable_dcplb(); |
@@ -343,7 +345,7 @@ void flush_switched_cplbs(void) | |||
343 | 345 | ||
344 | } | 346 | } |
345 | 347 | ||
346 | void set_mask_dcplbs(unsigned long *masks) | 348 | void set_mask_dcplbs(unsigned long *masks, unsigned int cpu) |
347 | { | 349 | { |
348 | int i; | 350 | int i; |
349 | unsigned long addr = (unsigned long)masks; | 351 | unsigned long addr = (unsigned long)masks; |
@@ -351,12 +353,12 @@ void set_mask_dcplbs(unsigned long *masks) | |||
351 | unsigned long flags; | 353 | unsigned long flags; |
352 | 354 | ||
353 | if (!masks) { | 355 | if (!masks) { |
354 | current_rwx_mask = masks; | 356 | current_rwx_mask[cpu] = masks; |
355 | return; | 357 | return; |
356 | } | 358 | } |
357 | 359 | ||
358 | local_irq_save(flags); | 360 | local_irq_save(flags); |
359 | current_rwx_mask = masks; | 361 | current_rwx_mask[cpu] = masks; |
360 | 362 | ||
361 | d_data = CPLB_SUPV_WR | CPLB_VALID | CPLB_DIRTY | PAGE_SIZE_4KB; | 363 | d_data = CPLB_SUPV_WR | CPLB_VALID | CPLB_DIRTY | PAGE_SIZE_4KB; |
362 | #ifdef CONFIG_BFIN_DCACHE | 364 | #ifdef CONFIG_BFIN_DCACHE |
@@ -368,8 +370,8 @@ void set_mask_dcplbs(unsigned long *masks) | |||
368 | 370 | ||
369 | disable_dcplb(); | 371 | disable_dcplb(); |
370 | for (i = first_mask_dcplb; i < first_switched_dcplb; i++) { | 372 | for (i = first_mask_dcplb; i < first_switched_dcplb; i++) { |
371 | dcplb_tbl[i].addr = addr; | 373 | dcplb_tbl[cpu][i].addr = addr; |
372 | dcplb_tbl[i].data = d_data; | 374 | dcplb_tbl[cpu][i].data = d_data; |
373 | bfin_write32(DCPLB_DATA0 + i * 4, d_data); | 375 | bfin_write32(DCPLB_DATA0 + i * 4, d_data); |
374 | bfin_write32(DCPLB_ADDR0 + i * 4, addr); | 376 | bfin_write32(DCPLB_ADDR0 + i * 4, addr); |
375 | addr += PAGE_SIZE; | 377 | addr += PAGE_SIZE; |
diff --git a/arch/blackfin/kernel/cplb-nompu/cacheinit.c b/arch/blackfin/kernel/cplb-nompu/cacheinit.c index bd0831592c2c..3a385aec67d5 100644 --- a/arch/blackfin/kernel/cplb-nompu/cacheinit.c +++ b/arch/blackfin/kernel/cplb-nompu/cacheinit.c | |||
@@ -25,9 +25,9 @@ | |||
25 | #include <asm/cplbinit.h> | 25 | #include <asm/cplbinit.h> |
26 | 26 | ||
27 | #if defined(CONFIG_BFIN_ICACHE) | 27 | #if defined(CONFIG_BFIN_ICACHE) |
28 | void __init bfin_icache_init(void) | 28 | void __cpuinit bfin_icache_init(u_long icplb[]) |
29 | { | 29 | { |
30 | unsigned long *table = icplb_table; | 30 | unsigned long *table = icplb; |
31 | unsigned long ctrl; | 31 | unsigned long ctrl; |
32 | int i; | 32 | int i; |
33 | 33 | ||
@@ -47,9 +47,9 @@ void __init bfin_icache_init(void) | |||
47 | #endif | 47 | #endif |
48 | 48 | ||
49 | #if defined(CONFIG_BFIN_DCACHE) | 49 | #if defined(CONFIG_BFIN_DCACHE) |
50 | void __init bfin_dcache_init(void) | 50 | void __cpuinit bfin_dcache_init(u_long dcplb[]) |
51 | { | 51 | { |
52 | unsigned long *table = dcplb_table; | 52 | unsigned long *table = dcplb; |
53 | unsigned long ctrl; | 53 | unsigned long ctrl; |
54 | int i; | 54 | int i; |
55 | 55 | ||
@@ -64,6 +64,7 @@ void __init bfin_dcache_init(void) | |||
64 | ctrl = bfin_read_DMEM_CONTROL(); | 64 | ctrl = bfin_read_DMEM_CONTROL(); |
65 | ctrl |= DMEM_CNTR; | 65 | ctrl |= DMEM_CNTR; |
66 | bfin_write_DMEM_CONTROL(ctrl); | 66 | bfin_write_DMEM_CONTROL(ctrl); |
67 | |||
67 | SSYNC(); | 68 | SSYNC(); |
68 | } | 69 | } |
69 | #endif | 70 | #endif |
diff --git a/arch/blackfin/kernel/cplb-nompu/cplbinfo.c b/arch/blackfin/kernel/cplb-nompu/cplbinfo.c index 1e74f0b97996..3f0080954e6f 100644 --- a/arch/blackfin/kernel/cplb-nompu/cplbinfo.c +++ b/arch/blackfin/kernel/cplb-nompu/cplbinfo.c | |||
@@ -68,22 +68,22 @@ static int cplb_find_entry(unsigned long *cplb_addr, | |||
68 | return -1; | 68 | return -1; |
69 | } | 69 | } |
70 | 70 | ||
71 | static char *cplb_print_entry(char *buf, int type) | 71 | static char *cplb_print_entry(char *buf, int type, unsigned int cpu) |
72 | { | 72 | { |
73 | unsigned long *p_addr = dpdt_table; | 73 | unsigned long *p_addr = dpdt_tables[cpu]; |
74 | unsigned long *p_data = dpdt_table + 1; | 74 | unsigned long *p_data = dpdt_tables[cpu] + 1; |
75 | unsigned long *p_icount = dpdt_swapcount_table; | 75 | unsigned long *p_icount = dpdt_swapcount_tables[cpu]; |
76 | unsigned long *p_ocount = dpdt_swapcount_table + 1; | 76 | unsigned long *p_ocount = dpdt_swapcount_tables[cpu] + 1; |
77 | unsigned long *cplb_addr = (unsigned long *)DCPLB_ADDR0; | 77 | unsigned long *cplb_addr = (unsigned long *)DCPLB_ADDR0; |
78 | unsigned long *cplb_data = (unsigned long *)DCPLB_DATA0; | 78 | unsigned long *cplb_data = (unsigned long *)DCPLB_DATA0; |
79 | int entry = 0, used_cplb = 0; | 79 | int entry = 0, used_cplb = 0; |
80 | 80 | ||
81 | if (type == CPLB_I) { | 81 | if (type == CPLB_I) { |
82 | buf += sprintf(buf, "Instruction CPLB entry:\n"); | 82 | buf += sprintf(buf, "Instruction CPLB entry:\n"); |
83 | p_addr = ipdt_table; | 83 | p_addr = ipdt_tables[cpu]; |
84 | p_data = ipdt_table + 1; | 84 | p_data = ipdt_tables[cpu] + 1; |
85 | p_icount = ipdt_swapcount_table; | 85 | p_icount = ipdt_swapcount_tables[cpu]; |
86 | p_ocount = ipdt_swapcount_table + 1; | 86 | p_ocount = ipdt_swapcount_tables[cpu] + 1; |
87 | cplb_addr = (unsigned long *)ICPLB_ADDR0; | 87 | cplb_addr = (unsigned long *)ICPLB_ADDR0; |
88 | cplb_data = (unsigned long *)ICPLB_DATA0; | 88 | cplb_data = (unsigned long *)ICPLB_DATA0; |
89 | } else | 89 | } else |
@@ -134,24 +134,24 @@ static char *cplb_print_entry(char *buf, int type) | |||
134 | return buf; | 134 | return buf; |
135 | } | 135 | } |
136 | 136 | ||
137 | static int cplbinfo_proc_output(char *buf) | 137 | static int cplbinfo_proc_output(char *buf, void *data) |
138 | { | 138 | { |
139 | unsigned int cpu = (unsigned int)data; | ||
139 | char *p; | 140 | char *p; |
140 | 141 | ||
141 | p = buf; | 142 | p = buf; |
142 | 143 | ||
143 | p += sprintf(p, "------------------ CPLB Information ------------------\n\n"); | 144 | p += sprintf(p, "------------- CPLB Information on CPU%u--------------\n\n", cpu); |
144 | 145 | ||
145 | if (bfin_read_IMEM_CONTROL() & ENICPLB) | 146 | if (bfin_read_IMEM_CONTROL() & ENICPLB) |
146 | p = cplb_print_entry(p, CPLB_I); | 147 | p = cplb_print_entry(p, CPLB_I, cpu); |
147 | else | 148 | else |
148 | p += sprintf(p, "Instruction CPLB is disabled.\n\n"); | 149 | p += sprintf(p, "Instruction CPLB is disabled.\n\n"); |
149 | 150 | ||
150 | if (bfin_read_DMEM_CONTROL() & ENDCPLB) | 151 | if (bfin_read_DMEM_CONTROL() & ENDCPLB) |
151 | p = cplb_print_entry(p, CPLB_D); | 152 | p = cplb_print_entry(p, CPLB_D, cpu); |
152 | else | 153 | else |
153 | p += sprintf(p, "Data CPLB is disabled.\n"); | 154 | p += sprintf(p, "Data CPLB is disabled.\n"); |
154 | |||
155 | return p - buf; | 155 | return p - buf; |
156 | } | 156 | } |
157 | 157 | ||
@@ -160,7 +160,7 @@ static int cplbinfo_read_proc(char *page, char **start, off_t off, | |||
160 | { | 160 | { |
161 | int len; | 161 | int len; |
162 | 162 | ||
163 | len = cplbinfo_proc_output(page); | 163 | len = cplbinfo_proc_output(page, data); |
164 | if (len <= off + count) | 164 | if (len <= off + count) |
165 | *eof = 1; | 165 | *eof = 1; |
166 | *start = page + off; | 166 | *start = page + off; |
@@ -174,20 +174,33 @@ static int cplbinfo_read_proc(char *page, char **start, off_t off, | |||
174 | 174 | ||
175 | static int __init cplbinfo_init(void) | 175 | static int __init cplbinfo_init(void) |
176 | { | 176 | { |
177 | struct proc_dir_entry *entry; | 177 | struct proc_dir_entry *parent, *entry; |
178 | unsigned int cpu; | ||
179 | unsigned char str[10]; | ||
180 | |||
181 | parent = proc_mkdir("cplbinfo", NULL); | ||
178 | 182 | ||
179 | entry = create_proc_entry("cplbinfo", 0, NULL); | 183 | for_each_online_cpu(cpu) { |
180 | if (!entry) | 184 | sprintf(str, "cpu%u", cpu); |
181 | return -ENOMEM; | 185 | entry = create_proc_entry(str, 0, parent); |
186 | if (!entry) | ||
187 | return -ENOMEM; | ||
182 | 188 | ||
183 | entry->read_proc = cplbinfo_read_proc; | 189 | entry->read_proc = cplbinfo_read_proc; |
184 | entry->data = NULL; | 190 | entry->data = (void *)cpu; |
191 | } | ||
185 | 192 | ||
186 | return 0; | 193 | return 0; |
187 | } | 194 | } |
188 | 195 | ||
189 | static void __exit cplbinfo_exit(void) | 196 | static void __exit cplbinfo_exit(void) |
190 | { | 197 | { |
198 | unsigned int cpu; | ||
199 | unsigned char str[20]; | ||
200 | for_each_online_cpu(cpu) { | ||
201 | sprintf(str, "cplbinfo/cpu%u", cpu); | ||
202 | remove_proc_entry(str, NULL); | ||
203 | } | ||
191 | remove_proc_entry("cplbinfo", NULL); | 204 | remove_proc_entry("cplbinfo", NULL); |
192 | } | 205 | } |
193 | 206 | ||
diff --git a/arch/blackfin/kernel/cplb-nompu/cplbinit.c b/arch/blackfin/kernel/cplb-nompu/cplbinit.c index 2debc900e246..8966c706b71a 100644 --- a/arch/blackfin/kernel/cplb-nompu/cplbinit.c +++ b/arch/blackfin/kernel/cplb-nompu/cplbinit.c | |||
@@ -27,46 +27,20 @@ | |||
27 | #include <asm/cplb.h> | 27 | #include <asm/cplb.h> |
28 | #include <asm/cplbinit.h> | 28 | #include <asm/cplbinit.h> |
29 | 29 | ||
30 | #define CPLB_MEM CONFIG_MAX_MEM_SIZE | 30 | u_long icplb_tables[NR_CPUS][CPLB_TBL_ENTRIES+1]; |
31 | 31 | u_long dcplb_tables[NR_CPUS][CPLB_TBL_ENTRIES+1]; | |
32 | /* | ||
33 | * Number of required data CPLB switchtable entries | ||
34 | * MEMSIZE / 4 (we mostly install 4M page size CPLBs | ||
35 | * approx 16 for smaller 1MB page size CPLBs for allignment purposes | ||
36 | * 1 for L1 Data Memory | ||
37 | * possibly 1 for L2 Data Memory | ||
38 | * 1 for CONFIG_DEBUG_HUNT_FOR_ZERO | ||
39 | * 1 for ASYNC Memory | ||
40 | */ | ||
41 | #define MAX_SWITCH_D_CPLBS (((CPLB_MEM / 4) + 16 + 1 + 1 + 1 \ | ||
42 | + ASYNC_MEMORY_CPLB_COVERAGE) * 2) | ||
43 | |||
44 | /* | ||
45 | * Number of required instruction CPLB switchtable entries | ||
46 | * MEMSIZE / 4 (we mostly install 4M page size CPLBs | ||
47 | * approx 12 for smaller 1MB page size CPLBs for allignment purposes | ||
48 | * 1 for L1 Instruction Memory | ||
49 | * possibly 1 for L2 Instruction Memory | ||
50 | * 1 for CONFIG_DEBUG_HUNT_FOR_ZERO | ||
51 | */ | ||
52 | #define MAX_SWITCH_I_CPLBS (((CPLB_MEM / 4) + 12 + 1 + 1 + 1) * 2) | ||
53 | |||
54 | |||
55 | u_long icplb_table[MAX_CPLBS + 1]; | ||
56 | u_long dcplb_table[MAX_CPLBS + 1]; | ||
57 | 32 | ||
58 | #ifdef CONFIG_CPLB_SWITCH_TAB_L1 | 33 | #ifdef CONFIG_CPLB_SWITCH_TAB_L1 |
59 | # define PDT_ATTR __attribute__((l1_data)) | 34 | #define PDT_ATTR __attribute__((l1_data)) |
60 | #else | 35 | #else |
61 | # define PDT_ATTR | 36 | #define PDT_ATTR |
62 | #endif | 37 | #endif |
63 | 38 | ||
64 | u_long ipdt_table[MAX_SWITCH_I_CPLBS + 1] PDT_ATTR; | 39 | u_long ipdt_tables[NR_CPUS][MAX_SWITCH_I_CPLBS+1] PDT_ATTR; |
65 | u_long dpdt_table[MAX_SWITCH_D_CPLBS + 1] PDT_ATTR; | 40 | u_long dpdt_tables[NR_CPUS][MAX_SWITCH_D_CPLBS+1] PDT_ATTR; |
66 | |||
67 | #ifdef CONFIG_CPLB_INFO | 41 | #ifdef CONFIG_CPLB_INFO |
68 | u_long ipdt_swapcount_table[MAX_SWITCH_I_CPLBS] PDT_ATTR; | 42 | u_long ipdt_swapcount_tables[NR_CPUS][MAX_SWITCH_I_CPLBS] PDT_ATTR; |
69 | u_long dpdt_swapcount_table[MAX_SWITCH_D_CPLBS] PDT_ATTR; | 43 | u_long dpdt_swapcount_tables[NR_CPUS][MAX_SWITCH_D_CPLBS] PDT_ATTR; |
70 | #endif | 44 | #endif |
71 | 45 | ||
72 | struct s_cplb { | 46 | struct s_cplb { |
@@ -93,8 +67,8 @@ static struct cplb_desc cplb_data[] = { | |||
93 | .name = "Zero Pointer Guard Page", | 67 | .name = "Zero Pointer Guard Page", |
94 | }, | 68 | }, |
95 | { | 69 | { |
96 | .start = L1_CODE_START, | 70 | .start = 0, /* dyanmic */ |
97 | .end = L1_CODE_START + L1_CODE_LENGTH, | 71 | .end = 0, /* dynamic */ |
98 | .psize = SIZE_4M, | 72 | .psize = SIZE_4M, |
99 | .attr = INITIAL_T | SWITCH_T | I_CPLB, | 73 | .attr = INITIAL_T | SWITCH_T | I_CPLB, |
100 | .i_conf = L1_IMEMORY, | 74 | .i_conf = L1_IMEMORY, |
@@ -103,8 +77,8 @@ static struct cplb_desc cplb_data[] = { | |||
103 | .name = "L1 I-Memory", | 77 | .name = "L1 I-Memory", |
104 | }, | 78 | }, |
105 | { | 79 | { |
106 | .start = L1_DATA_A_START, | 80 | .start = 0, /* dynamic */ |
107 | .end = L1_DATA_B_START + L1_DATA_B_LENGTH, | 81 | .end = 0, /* dynamic */ |
108 | .psize = SIZE_4M, | 82 | .psize = SIZE_4M, |
109 | .attr = INITIAL_T | SWITCH_T | D_CPLB, | 83 | .attr = INITIAL_T | SWITCH_T | D_CPLB, |
110 | .i_conf = 0, | 84 | .i_conf = 0, |
@@ -117,6 +91,16 @@ static struct cplb_desc cplb_data[] = { | |||
117 | .name = "L1 D-Memory", | 91 | .name = "L1 D-Memory", |
118 | }, | 92 | }, |
119 | { | 93 | { |
94 | .start = L2_START, | ||
95 | .end = L2_START + L2_LENGTH, | ||
96 | .psize = SIZE_1M, | ||
97 | .attr = L2_ATTR, | ||
98 | .i_conf = L2_IMEMORY, | ||
99 | .d_conf = L2_DMEMORY, | ||
100 | .valid = (L2_LENGTH > 0), | ||
101 | .name = "L2 Memory", | ||
102 | }, | ||
103 | { | ||
120 | .start = 0, | 104 | .start = 0, |
121 | .end = 0, /* dynamic */ | 105 | .end = 0, /* dynamic */ |
122 | .psize = 0, | 106 | .psize = 0, |
@@ -165,16 +149,6 @@ static struct cplb_desc cplb_data[] = { | |||
165 | .name = "Asynchronous Memory Banks", | 149 | .name = "Asynchronous Memory Banks", |
166 | }, | 150 | }, |
167 | { | 151 | { |
168 | .start = L2_START, | ||
169 | .end = L2_START + L2_LENGTH, | ||
170 | .psize = SIZE_1M, | ||
171 | .attr = SWITCH_T | I_CPLB | D_CPLB, | ||
172 | .i_conf = L2_IMEMORY, | ||
173 | .d_conf = L2_DMEMORY, | ||
174 | .valid = (L2_LENGTH > 0), | ||
175 | .name = "L2 Memory", | ||
176 | }, | ||
177 | { | ||
178 | .start = BOOT_ROM_START, | 152 | .start = BOOT_ROM_START, |
179 | .end = BOOT_ROM_START + BOOT_ROM_LENGTH, | 153 | .end = BOOT_ROM_START + BOOT_ROM_LENGTH, |
180 | .psize = SIZE_1M, | 154 | .psize = SIZE_1M, |
@@ -310,7 +284,7 @@ __fill_data_cplbtab(struct cplb_tab *t, int i, u32 a_start, u32 a_end) | |||
310 | } | 284 | } |
311 | } | 285 | } |
312 | 286 | ||
313 | void __init generate_cplb_tables(void) | 287 | void __init generate_cplb_tables_cpu(unsigned int cpu) |
314 | { | 288 | { |
315 | 289 | ||
316 | u16 i, j, process; | 290 | u16 i, j, process; |
@@ -322,8 +296,8 @@ void __init generate_cplb_tables(void) | |||
322 | 296 | ||
323 | printk(KERN_INFO "NOMPU: setting up cplb tables for global access\n"); | 297 | printk(KERN_INFO "NOMPU: setting up cplb tables for global access\n"); |
324 | 298 | ||
325 | cplb.init_i.size = MAX_CPLBS; | 299 | cplb.init_i.size = CPLB_TBL_ENTRIES; |
326 | cplb.init_d.size = MAX_CPLBS; | 300 | cplb.init_d.size = CPLB_TBL_ENTRIES; |
327 | cplb.switch_i.size = MAX_SWITCH_I_CPLBS; | 301 | cplb.switch_i.size = MAX_SWITCH_I_CPLBS; |
328 | cplb.switch_d.size = MAX_SWITCH_D_CPLBS; | 302 | cplb.switch_d.size = MAX_SWITCH_D_CPLBS; |
329 | 303 | ||
@@ -332,11 +306,15 @@ void __init generate_cplb_tables(void) | |||
332 | cplb.switch_i.pos = 0; | 306 | cplb.switch_i.pos = 0; |
333 | cplb.switch_d.pos = 0; | 307 | cplb.switch_d.pos = 0; |
334 | 308 | ||
335 | cplb.init_i.tab = icplb_table; | 309 | cplb.init_i.tab = icplb_tables[cpu]; |
336 | cplb.init_d.tab = dcplb_table; | 310 | cplb.init_d.tab = dcplb_tables[cpu]; |
337 | cplb.switch_i.tab = ipdt_table; | 311 | cplb.switch_i.tab = ipdt_tables[cpu]; |
338 | cplb.switch_d.tab = dpdt_table; | 312 | cplb.switch_d.tab = dpdt_tables[cpu]; |
339 | 313 | ||
314 | cplb_data[L1I_MEM].start = get_l1_code_start_cpu(cpu); | ||
315 | cplb_data[L1I_MEM].end = cplb_data[L1I_MEM].start + L1_CODE_LENGTH; | ||
316 | cplb_data[L1D_MEM].start = get_l1_data_a_start_cpu(cpu); | ||
317 | cplb_data[L1D_MEM].end = get_l1_data_b_start_cpu(cpu) + L1_DATA_B_LENGTH; | ||
340 | cplb_data[SDRAM_KERN].end = memory_end; | 318 | cplb_data[SDRAM_KERN].end = memory_end; |
341 | 319 | ||
342 | #ifdef CONFIG_MTD_UCLINUX | 320 | #ifdef CONFIG_MTD_UCLINUX |
@@ -459,6 +437,5 @@ void __init generate_cplb_tables(void) | |||
459 | cplb.switch_d.tab[cplb.switch_d.pos] = -1; | 437 | cplb.switch_d.tab[cplb.switch_d.pos] = -1; |
460 | 438 | ||
461 | } | 439 | } |
462 | |||
463 | #endif | 440 | #endif |
464 | 441 | ||
diff --git a/arch/blackfin/kernel/cplb-nompu/cplbmgr.S b/arch/blackfin/kernel/cplb-nompu/cplbmgr.S index f5cf3accef37..985f3fc793f6 100644 --- a/arch/blackfin/kernel/cplb-nompu/cplbmgr.S +++ b/arch/blackfin/kernel/cplb-nompu/cplbmgr.S | |||
@@ -52,6 +52,7 @@ | |||
52 | #include <linux/linkage.h> | 52 | #include <linux/linkage.h> |
53 | #include <asm/blackfin.h> | 53 | #include <asm/blackfin.h> |
54 | #include <asm/cplb.h> | 54 | #include <asm/cplb.h> |
55 | #include <asm/asm-offsets.h> | ||
55 | 56 | ||
56 | #ifdef CONFIG_EXCPT_IRQ_SYSC_L1 | 57 | #ifdef CONFIG_EXCPT_IRQ_SYSC_L1 |
57 | .section .l1.text | 58 | .section .l1.text |
@@ -164,10 +165,9 @@ ENTRY(_cplb_mgr) | |||
164 | .Lifound_victim: | 165 | .Lifound_victim: |
165 | #ifdef CONFIG_CPLB_INFO | 166 | #ifdef CONFIG_CPLB_INFO |
166 | R7 = [P0 - 0x104]; | 167 | R7 = [P0 - 0x104]; |
167 | P2.L = _ipdt_table; | 168 | GET_PDA(P2, R2); |
168 | P2.H = _ipdt_table; | 169 | P3 = [P2 + PDA_IPDT_SWAPCOUNT]; |
169 | P3.L = _ipdt_swapcount_table; | 170 | P2 = [P2 + PDA_IPDT]; |
170 | P3.H = _ipdt_swapcount_table; | ||
171 | P3 += -4; | 171 | P3 += -4; |
172 | .Licount: | 172 | .Licount: |
173 | R2 = [P2]; /* address from config table */ | 173 | R2 = [P2]; /* address from config table */ |
@@ -208,11 +208,10 @@ ENTRY(_cplb_mgr) | |||
208 | * range. | 208 | * range. |
209 | */ | 209 | */ |
210 | 210 | ||
211 | P2.L = _ipdt_table; | 211 | GET_PDA(P3, R0); |
212 | P2.H = _ipdt_table; | 212 | P2 = [P3 + PDA_IPDT]; |
213 | #ifdef CONFIG_CPLB_INFO | 213 | #ifdef CONFIG_CPLB_INFO |
214 | P3.L = _ipdt_swapcount_table; | 214 | P3 = [P3 + PDA_IPDT_SWAPCOUNT]; |
215 | P3.H = _ipdt_swapcount_table; | ||
216 | P3 += -8; | 215 | P3 += -8; |
217 | #endif | 216 | #endif |
218 | P0.L = _page_size_table; | 217 | P0.L = _page_size_table; |
@@ -469,10 +468,9 @@ ENTRY(_cplb_mgr) | |||
469 | 468 | ||
470 | #ifdef CONFIG_CPLB_INFO | 469 | #ifdef CONFIG_CPLB_INFO |
471 | R7 = [P0 - 0x104]; | 470 | R7 = [P0 - 0x104]; |
472 | P2.L = _dpdt_table; | 471 | GET_PDA(P2, R2); |
473 | P2.H = _dpdt_table; | 472 | P3 = [P2 + PDA_DPDT_SWAPCOUNT]; |
474 | P3.L = _dpdt_swapcount_table; | 473 | P2 = [P2 + PDA_DPDT]; |
475 | P3.H = _dpdt_swapcount_table; | ||
476 | P3 += -4; | 474 | P3 += -4; |
477 | .Ldicount: | 475 | .Ldicount: |
478 | R2 = [P2]; | 476 | R2 = [P2]; |
@@ -541,11 +539,10 @@ ENTRY(_cplb_mgr) | |||
541 | 539 | ||
542 | R0 = I0; /* Our faulting address */ | 540 | R0 = I0; /* Our faulting address */ |
543 | 541 | ||
544 | P2.L = _dpdt_table; | 542 | GET_PDA(P3, R1); |
545 | P2.H = _dpdt_table; | 543 | P2 = [P3 + PDA_DPDT]; |
546 | #ifdef CONFIG_CPLB_INFO | 544 | #ifdef CONFIG_CPLB_INFO |
547 | P3.L = _dpdt_swapcount_table; | 545 | P3 = [P3 + PDA_DPDT_SWAPCOUNT]; |
548 | P3.H = _dpdt_swapcount_table; | ||
549 | P3 += -8; | 546 | P3 += -8; |
550 | #endif | 547 | #endif |
551 | 548 | ||