hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/arch/parisc/kernel/processor.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Initial setup-routines for HP 9000 based hardware.
34 *
....@@ -9,21 +10,6 @@
910 * Modifications copyright 2001 Ryan Bradetich <rbradetich@uswest.net>
1011 *
1112 * Initial PA-RISC Version: 04-23-1999 by Helge Deller
12
- *
13
- * This program is free software; you can redistribute it and/or modify
14
- * it under the terms of the GNU General Public License as published by
15
- * the Free Software Foundation; either version 2, or (at your option)
16
- * any later version.
17
- *
18
- * This program is distributed in the hope that it will be useful,
19
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
- * GNU General Public License for more details.
22
- *
23
- * You should have received a copy of the GNU General Public License
24
- * along with this program; if not, write to the Free Software
25
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26
- *
2713 */
2814 #include <linux/delay.h>
2915 #include <linux/init.h>
....@@ -43,10 +29,10 @@
4329 #include <asm/irq.h> /* for struct irq_region */
4430 #include <asm/parisc-device.h>
4531
46
-struct system_cpuinfo_parisc boot_cpu_data __read_mostly;
32
+struct system_cpuinfo_parisc boot_cpu_data __ro_after_init;
4733 EXPORT_SYMBOL(boot_cpu_data);
4834 #ifdef CONFIG_PA8X00
49
-int _parisc_requires_coherency __read_mostly;
35
+int _parisc_requires_coherency __ro_after_init;
5036 EXPORT_SYMBOL(_parisc_requires_coherency);
5137 #endif
5238
....@@ -177,7 +163,6 @@
177163 if (cpuid)
178164 memset(p, 0, sizeof(struct cpuinfo_parisc));
179165
180
- p->loops_per_jiffy = loops_per_jiffy;
181166 p->dev = dev; /* Save IODC data in case we need it */
182167 p->hpa = dev->hpa.start; /* save CPU hpa */
183168 p->cpuid = cpuid; /* save CPU id */
....@@ -226,7 +211,7 @@
226211 #ifdef CONFIG_SMP
227212 if (cpuid) {
228213 set_cpu_present(cpuid, true);
229
- cpu_up(cpuid);
214
+ add_cpu(cpuid);
230215 }
231216 #endif
232217
....@@ -242,6 +227,7 @@
242227 void __init collect_boot_cpu_data(void)
243228 {
244229 unsigned long cr16_seed;
230
+ char orig_prod_num[64], current_prod_num[64], serial_no[64];
245231
246232 memset(&boot_cpu_data, 0, sizeof(boot_cpu_data));
247233
....@@ -301,6 +287,15 @@
301287 _parisc_requires_coherency = (boot_cpu_data.cpu_type == mako) ||
302288 (boot_cpu_data.cpu_type == mako2);
303289 #endif
290
+
291
+ if (pdc_model_platform_info(orig_prod_num, current_prod_num, serial_no) == PDC_OK) {
292
+ printk(KERN_INFO "product %s, original product %s, S/N: %s\n",
293
+ current_prod_num[0] ? current_prod_num : "n/a",
294
+ orig_prod_num, serial_no);
295
+ add_device_randomness(orig_prod_num, strlen(orig_prod_num));
296
+ add_device_randomness(current_prod_num, strlen(current_prod_num));
297
+ add_device_randomness(serial_no, strlen(serial_no));
298
+ }
304299 }
305300
306301
....@@ -377,10 +372,18 @@
377372 show_cpuinfo (struct seq_file *m, void *v)
378373 {
379374 unsigned long cpu;
375
+ char cpu_name[60], *p;
376
+
377
+ /* strip PA path from CPU name to not confuse lscpu */
378
+ strlcpy(cpu_name, per_cpu(cpu_data, 0).dev->name, sizeof(cpu_name));
379
+ p = strrchr(cpu_name, '[');
380
+ if (p)
381
+ *(--p) = 0;
380382
381383 for_each_online_cpu(cpu) {
382
- const struct cpuinfo_parisc *cpuinfo = &per_cpu(cpu_data, cpu);
383384 #ifdef CONFIG_SMP
385
+ const struct cpuinfo_parisc *cpuinfo = &per_cpu(cpu_data, cpu);
386
+
384387 if (0 == cpuinfo->hpa)
385388 continue;
386389 #endif
....@@ -423,11 +426,9 @@
423426 }
424427 seq_printf(m, " (0x%02lx)\n", boot_cpu_data.pdc.capabilities);
425428
426
- seq_printf(m, "model\t\t: %s\n"
427
- "model name\t: %s\n",
429
+ seq_printf(m, "model\t\t: %s - %s\n",
428430 boot_cpu_data.pdc.sys_model_name,
429
- cpuinfo->dev ?
430
- cpuinfo->dev->name : "Unknown");
431
+ cpu_name);
431432
432433 seq_printf(m, "hversion\t: 0x%08x\n"
433434 "sversion\t: 0x%08x\n",
....@@ -438,8 +439,8 @@
438439 show_cache_info(m);
439440
440441 seq_printf(m, "bogomips\t: %lu.%02lu\n",
441
- cpuinfo->loops_per_jiffy / (500000 / HZ),
442
- (cpuinfo->loops_per_jiffy / (5000 / HZ)) % 100);
442
+ loops_per_jiffy / (500000 / HZ),
443
+ loops_per_jiffy / (5000 / HZ) % 100);
443444
444445 seq_printf(m, "software id\t: %ld\n\n",
445446 boot_cpu_data.pdc.model.sw_id);