hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/arch/parisc/kernel/inventory.c
....@@ -1,10 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * inventory.c
3
- *
4
- * This program is free software; you can redistribute it and/or
5
- * modify it under the terms of the GNU General Public License
6
- * as published by the Free Software Foundation; either version
7
- * 2 of the License, or (at your option) any later version.
84 *
95 * Copyright (c) 1999 The Puffin Group (David Kennedy and Alex deVries)
106 * Copyright (c) 2001 Matthew Wilcox for Hewlett-Packard
....@@ -23,6 +19,7 @@
2319 #include <linux/init.h>
2420 #include <linux/slab.h>
2521 #include <linux/mm.h>
22
+#include <linux/platform_device.h>
2623 #include <asm/hardware.h>
2724 #include <asm/io.h>
2825 #include <asm/mmzone.h>
....@@ -31,6 +28,7 @@
3128 #include <asm/processor.h>
3229 #include <asm/page.h>
3330 #include <asm/parisc-device.h>
31
+#include <asm/tlbflush.h>
3432
3533 /*
3634 ** Debug options
....@@ -38,11 +36,12 @@
3836 */
3937 #undef DEBUG_PAT
4038
41
-int pdc_type __read_mostly = PDC_TYPE_ILLEGAL;
39
+int pdc_type __ro_after_init = PDC_TYPE_ILLEGAL;
4240
4341 /* cell number and location (PAT firmware only) */
44
-unsigned long parisc_cell_num __read_mostly;
45
-unsigned long parisc_cell_loc __read_mostly;
42
+unsigned long parisc_cell_num __ro_after_init;
43
+unsigned long parisc_cell_loc __ro_after_init;
44
+unsigned long parisc_pat_pdc_cap __ro_after_init;
4645
4746
4847 void __init setup_pdc(void)
....@@ -81,12 +80,21 @@
8180 #ifdef CONFIG_64BIT
8281 status = pdc_pat_cell_get_number(&cell_info);
8382 if (status == PDC_OK) {
83
+ unsigned long legacy_rev, pat_rev;
8484 pdc_type = PDC_TYPE_PAT;
8585 pr_cont("64 bit PAT.\n");
8686 parisc_cell_num = cell_info.cell_num;
8787 parisc_cell_loc = cell_info.cell_loc;
8888 pr_info("PAT: Running on cell %lu and location %lu.\n",
8989 parisc_cell_num, parisc_cell_loc);
90
+ status = pdc_pat_pd_get_pdc_revisions(&legacy_rev,
91
+ &pat_rev, &parisc_pat_pdc_cap);
92
+ pr_info("PAT: legacy revision 0x%lx, pat_rev 0x%lx, pdc_cap 0x%lx, S-PTLB %d, HPMC_RENDEZ %d.\n",
93
+ legacy_rev, pat_rev, parisc_pat_pdc_cap,
94
+ parisc_pat_pdc_cap
95
+ & PDC_PAT_CAPABILITY_BIT_SIMULTANEOUS_PTLB ? 1:0,
96
+ parisc_pat_pdc_cap
97
+ & PDC_PAT_CAPABILITY_BIT_PDC_HPMC_RENDEZ ? 1:0);
9098 return;
9199 }
92100 #endif
....@@ -628,4 +636,39 @@
628636 }
629637 printk(KERN_INFO "Found devices:\n");
630638 print_parisc_devices();
639
+
640
+#if defined(CONFIG_64BIT) && defined(CONFIG_SMP)
641
+ pa_serialize_tlb_flushes = machine_has_merced_bus();
642
+ if (pa_serialize_tlb_flushes)
643
+ pr_info("Merced bus found: Enable PxTLB serialization.\n");
644
+#endif
645
+
646
+#if defined(CONFIG_FW_CFG_SYSFS)
647
+ if (running_on_qemu) {
648
+ struct resource res[3] = {0,};
649
+ unsigned int base;
650
+
651
+ base = ((unsigned long long) PAGE0->pad0[2] << 32)
652
+ | PAGE0->pad0[3]; /* SeaBIOS stored it here */
653
+
654
+ res[0].name = "fw_cfg";
655
+ res[0].start = base;
656
+ res[0].end = base + 8 - 1;
657
+ res[0].flags = IORESOURCE_MEM;
658
+
659
+ res[1].name = "ctrl";
660
+ res[1].start = 0;
661
+ res[1].flags = IORESOURCE_REG;
662
+
663
+ res[2].name = "data";
664
+ res[2].start = 4;
665
+ res[2].flags = IORESOURCE_REG;
666
+
667
+ if (base) {
668
+ pr_info("Found qemu fw_cfg interface at %#08x\n", base);
669
+ platform_device_register_simple("fw_cfg",
670
+ PLATFORM_DEVID_NONE, res, 3);
671
+ }
672
+ }
673
+#endif
631674 }