| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Initial setup-routines for HP 9000 based hardware. |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 9 | 10 | * Modifications copyright 2001 Ryan Bradetich <rbradetich@uswest.net> |
|---|
| 10 | 11 | * |
|---|
| 11 | 12 | * 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 | | - * |
|---|
| 27 | 13 | */ |
|---|
| 28 | 14 | #include <linux/delay.h> |
|---|
| 29 | 15 | #include <linux/init.h> |
|---|
| .. | .. |
|---|
| 43 | 29 | #include <asm/irq.h> /* for struct irq_region */ |
|---|
| 44 | 30 | #include <asm/parisc-device.h> |
|---|
| 45 | 31 | |
|---|
| 46 | | -struct system_cpuinfo_parisc boot_cpu_data __read_mostly; |
|---|
| 32 | +struct system_cpuinfo_parisc boot_cpu_data __ro_after_init; |
|---|
| 47 | 33 | EXPORT_SYMBOL(boot_cpu_data); |
|---|
| 48 | 34 | #ifdef CONFIG_PA8X00 |
|---|
| 49 | | -int _parisc_requires_coherency __read_mostly; |
|---|
| 35 | +int _parisc_requires_coherency __ro_after_init; |
|---|
| 50 | 36 | EXPORT_SYMBOL(_parisc_requires_coherency); |
|---|
| 51 | 37 | #endif |
|---|
| 52 | 38 | |
|---|
| .. | .. |
|---|
| 177 | 163 | if (cpuid) |
|---|
| 178 | 164 | memset(p, 0, sizeof(struct cpuinfo_parisc)); |
|---|
| 179 | 165 | |
|---|
| 180 | | - p->loops_per_jiffy = loops_per_jiffy; |
|---|
| 181 | 166 | p->dev = dev; /* Save IODC data in case we need it */ |
|---|
| 182 | 167 | p->hpa = dev->hpa.start; /* save CPU hpa */ |
|---|
| 183 | 168 | p->cpuid = cpuid; /* save CPU id */ |
|---|
| .. | .. |
|---|
| 226 | 211 | #ifdef CONFIG_SMP |
|---|
| 227 | 212 | if (cpuid) { |
|---|
| 228 | 213 | set_cpu_present(cpuid, true); |
|---|
| 229 | | - cpu_up(cpuid); |
|---|
| 214 | + add_cpu(cpuid); |
|---|
| 230 | 215 | } |
|---|
| 231 | 216 | #endif |
|---|
| 232 | 217 | |
|---|
| .. | .. |
|---|
| 242 | 227 | void __init collect_boot_cpu_data(void) |
|---|
| 243 | 228 | { |
|---|
| 244 | 229 | unsigned long cr16_seed; |
|---|
| 230 | + char orig_prod_num[64], current_prod_num[64], serial_no[64]; |
|---|
| 245 | 231 | |
|---|
| 246 | 232 | memset(&boot_cpu_data, 0, sizeof(boot_cpu_data)); |
|---|
| 247 | 233 | |
|---|
| .. | .. |
|---|
| 301 | 287 | _parisc_requires_coherency = (boot_cpu_data.cpu_type == mako) || |
|---|
| 302 | 288 | (boot_cpu_data.cpu_type == mako2); |
|---|
| 303 | 289 | #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 | + } |
|---|
| 304 | 299 | } |
|---|
| 305 | 300 | |
|---|
| 306 | 301 | |
|---|
| .. | .. |
|---|
| 377 | 372 | show_cpuinfo (struct seq_file *m, void *v) |
|---|
| 378 | 373 | { |
|---|
| 379 | 374 | 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; |
|---|
| 380 | 382 | |
|---|
| 381 | 383 | for_each_online_cpu(cpu) { |
|---|
| 382 | | - const struct cpuinfo_parisc *cpuinfo = &per_cpu(cpu_data, cpu); |
|---|
| 383 | 384 | #ifdef CONFIG_SMP |
|---|
| 385 | + const struct cpuinfo_parisc *cpuinfo = &per_cpu(cpu_data, cpu); |
|---|
| 386 | + |
|---|
| 384 | 387 | if (0 == cpuinfo->hpa) |
|---|
| 385 | 388 | continue; |
|---|
| 386 | 389 | #endif |
|---|
| .. | .. |
|---|
| 423 | 426 | } |
|---|
| 424 | 427 | seq_printf(m, " (0x%02lx)\n", boot_cpu_data.pdc.capabilities); |
|---|
| 425 | 428 | |
|---|
| 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", |
|---|
| 428 | 430 | boot_cpu_data.pdc.sys_model_name, |
|---|
| 429 | | - cpuinfo->dev ? |
|---|
| 430 | | - cpuinfo->dev->name : "Unknown"); |
|---|
| 431 | + cpu_name); |
|---|
| 431 | 432 | |
|---|
| 432 | 433 | seq_printf(m, "hversion\t: 0x%08x\n" |
|---|
| 433 | 434 | "sversion\t: 0x%08x\n", |
|---|
| .. | .. |
|---|
| 438 | 439 | show_cache_info(m); |
|---|
| 439 | 440 | |
|---|
| 440 | 441 | 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); |
|---|
| 443 | 444 | |
|---|
| 444 | 445 | seq_printf(m, "software id\t: %ld\n\n", |
|---|
| 445 | 446 | boot_cpu_data.pdc.model.sw_id); |
|---|