aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arc
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@synopsys.com>2016-10-20 20:49:15 -0400
committerVineet Gupta <vgupta@synopsys.com>2016-10-28 13:07:43 -0400
commit73e284d2572581d848267c74552215f95f0f0996 (patch)
tree4d08aaf2d2c9ffcb43341ac8ef5be6246180db3e /arch/arc
parent711c1f2671174c918045e2cb20aece976ac516cd (diff)
ARC: boot log: refactor printing abt features not captured in BCRs
On older arc700 cores, some of the features configured were not present in Build config registers. To print about them at boot, we just use the Kconfig option i.e. whether linux is built to use them or not. So yes this seems bogus, but what else can be done. Moreover if linux is booting with these enabled, then the Kconfig info is a good indicator anyways. Over time these "hacks" accumulated in read_arc_build_cfg_regs() as well as arc_cpu_mumbojumbo(). so refactor and move all of those in a single place: read_arc_build_cfg_regs(). This causes some code redcution too: | bloat-o-meter2 arch/arc/kernel/setup.o.0 arch/arc/kernel/setup.o.1 | add/remove: 0/0 grow/shrink: 2/1 up/down: 64/-132 (-68) | function old new delta | setup_processor 610 670 +60 | cpuinfo_arc700 76 80 +4 | arc_cpu_mumbojumbo 752 620 -132 Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Diffstat (limited to 'arch/arc')
-rw-r--r--arch/arc/include/asm/arcregs.h1
-rw-r--r--arch/arc/kernel/setup.c87
2 files changed, 43 insertions, 45 deletions
diff --git a/arch/arc/include/asm/arcregs.h b/arch/arc/include/asm/arcregs.h
index db25c65155cb..819b44c1a719 100644
--- a/arch/arc/include/asm/arcregs.h
+++ b/arch/arc/include/asm/arcregs.h
@@ -349,6 +349,7 @@ struct cpuinfo_arc {
349 struct cpuinfo_arc_bpu bpu; 349 struct cpuinfo_arc_bpu bpu;
350 struct bcr_identity core; 350 struct bcr_identity core;
351 struct bcr_isa isa; 351 struct bcr_isa isa;
352 const char *details;
352 unsigned int vec_base; 353 unsigned int vec_base;
353 struct cpuinfo_arc_ccm iccm, dccm; 354 struct cpuinfo_arc_ccm iccm, dccm;
354 struct { 355 struct {
diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
index a77efa173df0..0170d94f3860 100644
--- a/arch/arc/kernel/setup.c
+++ b/arch/arc/kernel/setup.c
@@ -40,6 +40,20 @@ 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 cpuinfo_data arc_cpu_tbl[] = {
44#ifdef CONFIG_ISA_ARCOMPACT
45 { {0x20, "ARC 600" }, 0x2F},
46 { {0x30, "ARC 700" }, 0x33},
47 { {0x34, "ARC 700 R4.10"}, 0x34},
48 { {0x35, "ARC 700 R4.11"}, 0x35},
49#else
50 { {0x50, "ARC HS38 R2.0"}, 0x51},
51 { {0x52, "ARC HS38 R2.1"}, 0x52},
52 { {0x53, "ARC HS38 R3.0"}, 0x53},
53#endif
54 { {0x00, NULL } }
55};
56
43static void read_decode_ccm_bcr(struct cpuinfo_arc *cpu) 57static void read_decode_ccm_bcr(struct cpuinfo_arc *cpu)
44{ 58{
45 if (is_isa_arcompact()) { 59 if (is_isa_arcompact()) {
@@ -92,11 +106,24 @@ static void read_arc_build_cfg_regs(void)
92 struct bcr_timer timer; 106 struct bcr_timer timer;
93 struct bcr_generic bcr; 107 struct bcr_generic bcr;
94 struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()]; 108 struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()];
109 const struct cpuinfo_data *tbl;
110
95 FIX_PTR(cpu); 111 FIX_PTR(cpu);
96 112
97 READ_BCR(AUX_IDENTITY, cpu->core); 113 READ_BCR(AUX_IDENTITY, cpu->core);
98 READ_BCR(ARC_REG_ISA_CFG_BCR, cpu->isa); 114 READ_BCR(ARC_REG_ISA_CFG_BCR, cpu->isa);
99 115
116 for (tbl = &arc_cpu_tbl[0]; tbl->info.id != 0; tbl++) {
117 if ((cpu->core.family >= tbl->info.id) &&
118 (cpu->core.family <= tbl->up_range)) {
119 cpu->details = tbl->info.str;
120 break;
121 }
122 }
123
124 if (tbl->info.id == 0)
125 cpu->details = "UNKNOWN";
126
100 READ_BCR(ARC_REG_TIMERS_BCR, timer); 127 READ_BCR(ARC_REG_TIMERS_BCR, timer);
101 cpu->extn.timer0 = timer.t0; 128 cpu->extn.timer0 = timer.t0;
102 cpu->extn.timer1 = timer.t1; 129 cpu->extn.timer1 = timer.t1;
@@ -160,64 +187,34 @@ static void read_arc_build_cfg_regs(void)
160 cpu->extn.rtt = bcr.ver ? 1 : 0; 187 cpu->extn.rtt = bcr.ver ? 1 : 0;
161 188
162 cpu->extn.debug = cpu->extn.ap | cpu->extn.smart | cpu->extn.rtt; 189 cpu->extn.debug = cpu->extn.ap | cpu->extn.smart | cpu->extn.rtt;
163}
164 190
165static const struct cpuinfo_data arc_cpu_tbl[] = { 191 /* some hacks for lack of feature BCR info in old ARC700 cores */
166#ifdef CONFIG_ISA_ARCOMPACT 192 if (is_isa_arcompact()) {
167 { {0x20, "ARC 600" }, 0x2F}, 193 if (!cpu->isa.ver) /* ISA BCR absent, use Kconfig info */
168 { {0x30, "ARC 700" }, 0x33}, 194 cpu->isa.atomic = IS_ENABLED(CONFIG_ARC_HAS_LLSC);
169 { {0x34, "ARC 700 R4.10"}, 0x34}, 195 else
170 { {0x35, "ARC 700 R4.11"}, 0x35}, 196 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 197
198 cpu->isa.be = IS_ENABLED(CONFIG_CPU_BIG_ENDIAN);
199 }
200}
179 201
180static char *arc_cpu_mumbojumbo(int cpu_id, char *buf, int len) 202static char *arc_cpu_mumbojumbo(int cpu_id, char *buf, int len)
181{ 203{
182 struct cpuinfo_arc *cpu = &cpuinfo_arc700[cpu_id]; 204 struct cpuinfo_arc *cpu = &cpuinfo_arc700[cpu_id];
183 struct bcr_identity *core = &cpu->core; 205 struct bcr_identity *core = &cpu->core;
184 const struct cpuinfo_data *tbl; 206 int i, n = 0;
185 char *isa_nm;
186 int i, be, atomic;
187 int n = 0;
188 207
189 FIX_PTR(cpu); 208 FIX_PTR(cpu);
190 209
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, 210 n += scnprintf(buf + n, len - n,
205 "\nIDENTITY\t: ARCVER [%#02x] ARCNUM [%#02x] CHIPID [%#4x]\n", 211 "\nIDENTITY\t: ARCVER [%#02x] ARCNUM [%#02x] CHIPID [%#4x]\n",
206 core->family, core->cpu_id, core->chip_id); 212 core->family, core->cpu_id, core->chip_id);
207 213
208 for (tbl = &arc_cpu_tbl[0]; tbl->info.id != 0; tbl++) { 214 n += scnprintf(buf + n, len - n, "processor [%d]\t: %s (%s ISA) %s\n",
209 if ((core->family >= tbl->info.id) && 215 cpu_id, cpu->details,
210 (core->family <= tbl->up_range)) { 216 is_isa_arcompact() ? "ARCompact" : "ARCv2",
211 n += scnprintf(buf + n, len - n, 217 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 218
222 n += scnprintf(buf + n, len - n, "Timers\t\t: %s%s%s%s\nISA Extn\t: ", 219 n += scnprintf(buf + n, len - n, "Timers\t\t: %s%s%s%s\nISA Extn\t: ",
223 IS_AVAIL1(cpu->extn.timer0, "Timer0 "), 220 IS_AVAIL1(cpu->extn.timer0, "Timer0 "),
@@ -226,7 +223,7 @@ static char *arc_cpu_mumbojumbo(int cpu_id, char *buf, int len)
226 CONFIG_ARC_HAS_RTC)); 223 CONFIG_ARC_HAS_RTC));
227 224
228 n += i = scnprintf(buf + n, len - n, "%s%s%s%s%s", 225 n += i = scnprintf(buf + n, len - n, "%s%s%s%s%s",
229 IS_AVAIL2(atomic, "atomic ", CONFIG_ARC_HAS_LLSC), 226 IS_AVAIL2(cpu->isa.atomic, "atomic ", CONFIG_ARC_HAS_LLSC),
230 IS_AVAIL2(cpu->isa.ldd, "ll64 ", CONFIG_ARC_HAS_LL64), 227 IS_AVAIL2(cpu->isa.ldd, "ll64 ", CONFIG_ARC_HAS_LL64),
231 IS_AVAIL1(cpu->isa.unalign, "unalign (not used)")); 228 IS_AVAIL1(cpu->isa.unalign, "unalign (not used)"));
232 229