aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arc/kernel/setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arc/kernel/setup.c')
-rw-r--r--arch/arc/kernel/setup.c113
1 files changed, 63 insertions, 50 deletions
diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
index 3df7f9c72f42..0385df77a697 100644
--- a/arch/arc/kernel/setup.c
+++ b/arch/arc/kernel/setup.c
@@ -40,6 +40,29 @@ struct task_struct *_current_task[NR_CPUS]; /* For stack switching */
40 40
41struct cpuinfo_arc cpuinfo_arc700[NR_CPUS]; 41struct cpuinfo_arc cpuinfo_arc700[NR_CPUS];
42 42
43static const struct id_to_str arc_cpu_rel[] = {
44#ifdef CONFIG_ISA_ARCOMPACT
45 { 0x34, "R4.10"},
46 { 0x35, "R4.11"},
47#else
48 { 0x51, "R2.0" },
49 { 0x52, "R2.1" },
50 { 0x53, "R3.0" },
51#endif
52 { 0x00, NULL }
53};
54
55static const struct id_to_str arc_cpu_nm[] = {
56#ifdef CONFIG_ISA_ARCOMPACT
57 { 0x20, "ARC 600" },
58 { 0x30, "ARC 770" }, /* 750 identified seperately */
59#else
60 { 0x40, "ARC EM" },
61 { 0x50, "ARC HS38" },
62#endif
63 { 0x00, "Unknown" }
64};
65
43static void read_decode_ccm_bcr(struct cpuinfo_arc *cpu) 66static void read_decode_ccm_bcr(struct cpuinfo_arc *cpu)
44{ 67{
45 if (is_isa_arcompact()) { 68 if (is_isa_arcompact()) {
@@ -92,11 +115,26 @@ static void read_arc_build_cfg_regs(void)
92 struct bcr_timer timer; 115 struct bcr_timer timer;
93 struct bcr_generic bcr; 116 struct bcr_generic bcr;
94 struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()]; 117 struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()];
118 const struct id_to_str *tbl;
119
95 FIX_PTR(cpu); 120 FIX_PTR(cpu);
96 121
97 READ_BCR(AUX_IDENTITY, cpu->core); 122 READ_BCR(AUX_IDENTITY, cpu->core);
98 READ_BCR(ARC_REG_ISA_CFG_BCR, cpu->isa); 123 READ_BCR(ARC_REG_ISA_CFG_BCR, cpu->isa);
99 124
125 for (tbl = &arc_cpu_rel[0]; tbl->id != 0; tbl++) {
126 if (cpu->core.family == tbl->id) {
127 cpu->details = tbl->str;
128 break;
129 }
130 }
131
132 for (tbl = &arc_cpu_nm[0]; tbl->id != 0; tbl++) {
133 if ((cpu->core.family & 0xF0) == tbl->id)
134 break;
135 }
136 cpu->name = tbl->str;
137
100 READ_BCR(ARC_REG_TIMERS_BCR, timer); 138 READ_BCR(ARC_REG_TIMERS_BCR, timer);
101 cpu->extn.timer0 = timer.t0; 139 cpu->extn.timer0 = timer.t0;
102 cpu->extn.timer1 = timer.t1; 140 cpu->extn.timer1 = timer.t1;
@@ -111,6 +149,9 @@ static void read_arc_build_cfg_regs(void)
111 cpu->extn.swap = read_aux_reg(ARC_REG_SWAP_BCR) ? 1 : 0; /* 1,3 */ 149 cpu->extn.swap = read_aux_reg(ARC_REG_SWAP_BCR) ? 1 : 0; /* 1,3 */
112 cpu->extn.crc = read_aux_reg(ARC_REG_CRC_BCR) ? 1 : 0; 150 cpu->extn.crc = read_aux_reg(ARC_REG_CRC_BCR) ? 1 : 0;
113 cpu->extn.minmax = read_aux_reg(ARC_REG_MIXMAX_BCR) > 1 ? 1 : 0; /* 2 */ 151 cpu->extn.minmax = read_aux_reg(ARC_REG_MIXMAX_BCR) > 1 ? 1 : 0; /* 2 */
152 cpu->extn.swape = (cpu->core.family >= 0x34) ? 1 :
153 IS_ENABLED(CONFIG_ARC_HAS_SWAPE);
154
114 READ_BCR(ARC_REG_XY_MEM_BCR, cpu->extn_xymem); 155 READ_BCR(ARC_REG_XY_MEM_BCR, cpu->extn_xymem);
115 156
116 /* Read CCM BCRs for boot reporting even if not enabled in Kconfig */ 157 /* Read CCM BCRs for boot reporting even if not enabled in Kconfig */
@@ -160,64 +201,38 @@ static void read_arc_build_cfg_regs(void)
160 cpu->extn.rtt = bcr.ver ? 1 : 0; 201 cpu->extn.rtt = bcr.ver ? 1 : 0;
161 202
162 cpu->extn.debug = cpu->extn.ap | cpu->extn.smart | cpu->extn.rtt; 203 cpu->extn.debug = cpu->extn.ap | cpu->extn.smart | cpu->extn.rtt;
163}
164 204
165static const struct cpuinfo_data arc_cpu_tbl[] = { 205 /* some hacks for lack of feature BCR info in old ARC700 cores */
166#ifdef CONFIG_ISA_ARCOMPACT 206 if (is_isa_arcompact()) {
167 { {0x20, "ARC 600" }, 0x2F}, 207 if (!cpu->isa.ver) /* ISA BCR absent, use Kconfig info */
168 { {0x30, "ARC 700" }, 0x33}, 208 cpu->isa.atomic = IS_ENABLED(CONFIG_ARC_HAS_LLSC);
169 { {0x34, "ARC 700 R4.10"}, 0x34}, 209 else
170 { {0x35, "ARC 700 R4.11"}, 0x35}, 210 cpu->isa.atomic = cpu->isa.atomic1;
171#else
172 { {0x50, "ARC HS38 R2.0"}, 0x51},
173 { {0x52, "ARC HS38 R2.1"}, 0x52},
174 { {0x53, "ARC HS38 R3.0"}, 0x53},
175#endif
176 { {0x00, NULL } }
177};
178 211
212 cpu->isa.be = IS_ENABLED(CONFIG_CPU_BIG_ENDIAN);
213
214 /* there's no direct way to distinguish 750 vs. 770 */
215 if (unlikely(cpu->core.family < 0x34 || cpu->mmu.ver < 3))
216 cpu->name = "ARC750";
217 }
218}
179 219
180static char *arc_cpu_mumbojumbo(int cpu_id, char *buf, int len) 220static char *arc_cpu_mumbojumbo(int cpu_id, char *buf, int len)
181{ 221{
182 struct cpuinfo_arc *cpu = &cpuinfo_arc700[cpu_id]; 222 struct cpuinfo_arc *cpu = &cpuinfo_arc700[cpu_id];
183 struct bcr_identity *core = &cpu->core; 223 struct bcr_identity *core = &cpu->core;
184 const struct cpuinfo_data *tbl; 224 int i, n = 0;
185 char *isa_nm;
186 int i, be, atomic;
187 int n = 0;
188 225
189 FIX_PTR(cpu); 226 FIX_PTR(cpu);
190 227
191 if (is_isa_arcompact()) {
192 isa_nm = "ARCompact";
193 be = IS_ENABLED(CONFIG_CPU_BIG_ENDIAN);
194
195 atomic = cpu->isa.atomic1;
196 if (!cpu->isa.ver) /* ISA BCR absent, use Kconfig info */
197 atomic = IS_ENABLED(CONFIG_ARC_HAS_LLSC);
198 } else {
199 isa_nm = "ARCv2";
200 be = cpu->isa.be;
201 atomic = cpu->isa.atomic;
202 }
203
204 n += scnprintf(buf + n, len - n, 228 n += scnprintf(buf + n, len - n,
205 "\nIDENTITY\t: ARCVER [%#02x] ARCNUM [%#02x] CHIPID [%#4x]\n", 229 "\nIDENTITY\t: ARCVER [%#02x] ARCNUM [%#02x] CHIPID [%#4x]\n",
206 core->family, core->cpu_id, core->chip_id); 230 core->family, core->cpu_id, core->chip_id);
207 231
208 for (tbl = &arc_cpu_tbl[0]; tbl->info.id != 0; tbl++) { 232 n += scnprintf(buf + n, len - n, "processor [%d]\t: %s %s (%s ISA) %s\n",
209 if ((core->family >= tbl->info.id) && 233 cpu_id, cpu->name, cpu->details,
210 (core->family <= tbl->up_range)) { 234 is_isa_arcompact() ? "ARCompact" : "ARCv2",
211 n += scnprintf(buf + n, len - n, 235 IS_AVAIL1(cpu->isa.be, "[Big-Endian]"));
212 "processor [%d]\t: %s (%s ISA) %s\n",
213 cpu_id, tbl->info.str, isa_nm,
214 IS_AVAIL1(be, "[Big-Endian]"));
215 break;
216 }
217 }
218
219 if (tbl->info.id == 0)
220 n += scnprintf(buf + n, len - n, "UNKNOWN ARC Processor\n");
221 236
222 n += scnprintf(buf + n, len - n, "Timers\t\t: %s%s%s%s\nISA Extn\t: ", 237 n += scnprintf(buf + n, len - n, "Timers\t\t: %s%s%s%s\nISA Extn\t: ",
223 IS_AVAIL1(cpu->extn.timer0, "Timer0 "), 238 IS_AVAIL1(cpu->extn.timer0, "Timer0 "),
@@ -226,7 +241,7 @@ static char *arc_cpu_mumbojumbo(int cpu_id, char *buf, int len)
226 CONFIG_ARC_HAS_RTC)); 241 CONFIG_ARC_HAS_RTC));
227 242
228 n += i = scnprintf(buf + n, len - n, "%s%s%s%s%s", 243 n += i = scnprintf(buf + n, len - n, "%s%s%s%s%s",
229 IS_AVAIL2(atomic, "atomic ", CONFIG_ARC_HAS_LLSC), 244 IS_AVAIL2(cpu->isa.atomic, "atomic ", CONFIG_ARC_HAS_LLSC),
230 IS_AVAIL2(cpu->isa.ldd, "ll64 ", CONFIG_ARC_HAS_LL64), 245 IS_AVAIL2(cpu->isa.ldd, "ll64 ", CONFIG_ARC_HAS_LL64),
231 IS_AVAIL1(cpu->isa.unalign, "unalign (not used)")); 246 IS_AVAIL1(cpu->isa.unalign, "unalign (not used)"));
232 247
@@ -253,7 +268,7 @@ static char *arc_cpu_mumbojumbo(int cpu_id, char *buf, int len)
253 IS_AVAIL1(cpu->extn.swap, "swap "), 268 IS_AVAIL1(cpu->extn.swap, "swap "),
254 IS_AVAIL1(cpu->extn.minmax, "minmax "), 269 IS_AVAIL1(cpu->extn.minmax, "minmax "),
255 IS_AVAIL1(cpu->extn.crc, "crc "), 270 IS_AVAIL1(cpu->extn.crc, "crc "),
256 IS_AVAIL2(1, "swape", CONFIG_ARC_HAS_SWAPE)); 271 IS_AVAIL2(cpu->extn.swape, "swape", CONFIG_ARC_HAS_SWAPE));
257 272
258 if (cpu->bpu.ver) 273 if (cpu->bpu.ver)
259 n += scnprintf(buf + n, len - n, 274 n += scnprintf(buf + n, len - n,
@@ -272,9 +287,7 @@ static char *arc_extn_mumbojumbo(int cpu_id, char *buf, int len)
272 287
273 FIX_PTR(cpu); 288 FIX_PTR(cpu);
274 289
275 n += scnprintf(buf + n, len - n, 290 n += scnprintf(buf + n, len - n, "Vector Table\t: %#x\n", cpu->vec_base);
276 "Vector Table\t: %#x\nPeripherals\t: %#lx:%#lx\n",
277 cpu->vec_base, perip_base, perip_end);
278 291
279 if (cpu->extn.fpu_sp || cpu->extn.fpu_dp) 292 if (cpu->extn.fpu_sp || cpu->extn.fpu_dp)
280 n += scnprintf(buf + n, len - n, "FPU\t\t: %s%s\n", 293 n += scnprintf(buf + n, len - n, "FPU\t\t: %s%s\n",
@@ -507,7 +520,7 @@ static void *c_start(struct seq_file *m, loff_t *pos)
507 * way to pass it w/o having to kmalloc/free a 2 byte string. 520 * way to pass it w/o having to kmalloc/free a 2 byte string.
508 * Encode cpu-id as 0xFFcccc, which is decoded by show routine. 521 * Encode cpu-id as 0xFFcccc, which is decoded by show routine.
509 */ 522 */
510 return *pos < num_possible_cpus() ? cpu_to_ptr(*pos) : NULL; 523 return *pos < nr_cpu_ids ? cpu_to_ptr(*pos) : NULL;
511} 524}
512 525
513static void *c_next(struct seq_file *m, void *v, loff_t *pos) 526static void *c_next(struct seq_file *m, void *v, loff_t *pos)