.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * 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. |
---|
8 | 4 | * |
---|
9 | 5 | * Copyright (c) 1999 The Puffin Group (David Kennedy and Alex deVries) |
---|
10 | 6 | * Copyright (c) 2001 Matthew Wilcox for Hewlett-Packard |
---|
.. | .. |
---|
23 | 19 | #include <linux/init.h> |
---|
24 | 20 | #include <linux/slab.h> |
---|
25 | 21 | #include <linux/mm.h> |
---|
| 22 | +#include <linux/platform_device.h> |
---|
26 | 23 | #include <asm/hardware.h> |
---|
27 | 24 | #include <asm/io.h> |
---|
28 | 25 | #include <asm/mmzone.h> |
---|
.. | .. |
---|
31 | 28 | #include <asm/processor.h> |
---|
32 | 29 | #include <asm/page.h> |
---|
33 | 30 | #include <asm/parisc-device.h> |
---|
| 31 | +#include <asm/tlbflush.h> |
---|
34 | 32 | |
---|
35 | 33 | /* |
---|
36 | 34 | ** Debug options |
---|
.. | .. |
---|
38 | 36 | */ |
---|
39 | 37 | #undef DEBUG_PAT |
---|
40 | 38 | |
---|
41 | | -int pdc_type __read_mostly = PDC_TYPE_ILLEGAL; |
---|
| 39 | +int pdc_type __ro_after_init = PDC_TYPE_ILLEGAL; |
---|
42 | 40 | |
---|
43 | 41 | /* 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; |
---|
46 | 45 | |
---|
47 | 46 | |
---|
48 | 47 | void __init setup_pdc(void) |
---|
.. | .. |
---|
81 | 80 | #ifdef CONFIG_64BIT |
---|
82 | 81 | status = pdc_pat_cell_get_number(&cell_info); |
---|
83 | 82 | if (status == PDC_OK) { |
---|
| 83 | + unsigned long legacy_rev, pat_rev; |
---|
84 | 84 | pdc_type = PDC_TYPE_PAT; |
---|
85 | 85 | pr_cont("64 bit PAT.\n"); |
---|
86 | 86 | parisc_cell_num = cell_info.cell_num; |
---|
87 | 87 | parisc_cell_loc = cell_info.cell_loc; |
---|
88 | 88 | pr_info("PAT: Running on cell %lu and location %lu.\n", |
---|
89 | 89 | 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); |
---|
90 | 98 | return; |
---|
91 | 99 | } |
---|
92 | 100 | #endif |
---|
.. | .. |
---|
628 | 636 | } |
---|
629 | 637 | printk(KERN_INFO "Found devices:\n"); |
---|
630 | 638 | 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 |
---|
631 | 674 | } |
---|