.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * acpi.c - Architecture-Specific Low-Level ACPI Support |
---|
3 | 4 | * |
---|
.. | .. |
---|
12 | 13 | * Copyright (C) 2001 Takayoshi Kochi <t-kochi@bq.jp.nec.com> |
---|
13 | 14 | * Copyright (C) 2002 Erich Focht <efocht@ess.nec.de> |
---|
14 | 15 | * Copyright (C) 2004 Ashok Raj <ashok.raj@intel.com> |
---|
15 | | - * |
---|
16 | | - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
17 | | - * |
---|
18 | | - * This program is free software; you can redistribute it and/or modify |
---|
19 | | - * it under the terms of the GNU General Public License as published by |
---|
20 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
21 | | - * (at your option) any later version. |
---|
22 | | - * |
---|
23 | | - * This program is distributed in the hope that it will be useful, |
---|
24 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
25 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
26 | | - * GNU General Public License for more details. |
---|
27 | | - * |
---|
28 | | - * You should have received a copy of the GNU General Public License |
---|
29 | | - * along with this program; if not, write to the Free Software |
---|
30 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
31 | | - * |
---|
32 | | - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
33 | 16 | */ |
---|
34 | 17 | |
---|
35 | 18 | #include <linux/module.h> |
---|
.. | .. |
---|
48 | 31 | #include <acpi/processor.h> |
---|
49 | 32 | #include <asm/io.h> |
---|
50 | 33 | #include <asm/iosapic.h> |
---|
51 | | -#include <asm/machvec.h> |
---|
52 | 34 | #include <asm/page.h> |
---|
53 | 35 | #include <asm/numa.h> |
---|
54 | 36 | #include <asm/sal.h> |
---|
.. | .. |
---|
59 | 41 | int acpi_lapic; |
---|
60 | 42 | unsigned int acpi_cpei_override; |
---|
61 | 43 | unsigned int acpi_cpei_phys_cpuid; |
---|
62 | | - |
---|
63 | | -unsigned long acpi_wakeup_address = 0; |
---|
64 | | - |
---|
65 | | -#ifdef CONFIG_IA64_GENERIC |
---|
66 | | -static unsigned long __init acpi_find_rsdp(void) |
---|
67 | | -{ |
---|
68 | | - unsigned long rsdp_phys = 0; |
---|
69 | | - |
---|
70 | | - if (efi.acpi20 != EFI_INVALID_TABLE_ADDR) |
---|
71 | | - rsdp_phys = efi.acpi20; |
---|
72 | | - else if (efi.acpi != EFI_INVALID_TABLE_ADDR) |
---|
73 | | - printk(KERN_WARNING PREFIX |
---|
74 | | - "v1.0/r0.71 tables no longer supported\n"); |
---|
75 | | - return rsdp_phys; |
---|
76 | | -} |
---|
77 | | - |
---|
78 | | -const char __init * |
---|
79 | | -acpi_get_sysname(void) |
---|
80 | | -{ |
---|
81 | | - unsigned long rsdp_phys; |
---|
82 | | - struct acpi_table_rsdp *rsdp; |
---|
83 | | - struct acpi_table_xsdt *xsdt; |
---|
84 | | - struct acpi_table_header *hdr; |
---|
85 | | -#ifdef CONFIG_INTEL_IOMMU |
---|
86 | | - u64 i, nentries; |
---|
87 | | -#endif |
---|
88 | | - |
---|
89 | | - rsdp_phys = acpi_find_rsdp(); |
---|
90 | | - if (!rsdp_phys) { |
---|
91 | | - printk(KERN_ERR |
---|
92 | | - "ACPI 2.0 RSDP not found, default to \"dig\"\n"); |
---|
93 | | - return "dig"; |
---|
94 | | - } |
---|
95 | | - |
---|
96 | | - rsdp = (struct acpi_table_rsdp *)__va(rsdp_phys); |
---|
97 | | - if (strncmp(rsdp->signature, ACPI_SIG_RSDP, sizeof(ACPI_SIG_RSDP) - 1)) { |
---|
98 | | - printk(KERN_ERR |
---|
99 | | - "ACPI 2.0 RSDP signature incorrect, default to \"dig\"\n"); |
---|
100 | | - return "dig"; |
---|
101 | | - } |
---|
102 | | - |
---|
103 | | - xsdt = (struct acpi_table_xsdt *)__va(rsdp->xsdt_physical_address); |
---|
104 | | - hdr = &xsdt->header; |
---|
105 | | - if (strncmp(hdr->signature, ACPI_SIG_XSDT, sizeof(ACPI_SIG_XSDT) - 1)) { |
---|
106 | | - printk(KERN_ERR |
---|
107 | | - "ACPI 2.0 XSDT signature incorrect, default to \"dig\"\n"); |
---|
108 | | - return "dig"; |
---|
109 | | - } |
---|
110 | | - |
---|
111 | | - if (!strcmp(hdr->oem_id, "HP")) { |
---|
112 | | - return "hpzx1"; |
---|
113 | | - } else if (!strcmp(hdr->oem_id, "SGI")) { |
---|
114 | | - if (!strcmp(hdr->oem_table_id + 4, "UV")) |
---|
115 | | - return "uv"; |
---|
116 | | - else |
---|
117 | | - return "sn2"; |
---|
118 | | - } |
---|
119 | | - |
---|
120 | | -#ifdef CONFIG_INTEL_IOMMU |
---|
121 | | - /* Look for Intel IOMMU */ |
---|
122 | | - nentries = (hdr->length - sizeof(*hdr)) / |
---|
123 | | - sizeof(xsdt->table_offset_entry[0]); |
---|
124 | | - for (i = 0; i < nentries; i++) { |
---|
125 | | - hdr = __va(xsdt->table_offset_entry[i]); |
---|
126 | | - if (strncmp(hdr->signature, ACPI_SIG_DMAR, |
---|
127 | | - sizeof(ACPI_SIG_DMAR) - 1) == 0) |
---|
128 | | - return "dig_vtd"; |
---|
129 | | - } |
---|
130 | | -#endif |
---|
131 | | - |
---|
132 | | - return "dig"; |
---|
133 | | -} |
---|
134 | | -#endif /* CONFIG_IA64_GENERIC */ |
---|
135 | 44 | |
---|
136 | 45 | #define ACPI_MAX_PLATFORM_INTERRUPTS 256 |
---|
137 | 46 | |
---|
.. | .. |
---|
177 | 86 | static u8 has_8259; |
---|
178 | 87 | |
---|
179 | 88 | static int __init |
---|
180 | | -acpi_parse_lapic_addr_ovr(struct acpi_subtable_header * header, |
---|
| 89 | +acpi_parse_lapic_addr_ovr(union acpi_subtable_headers * header, |
---|
181 | 90 | const unsigned long end) |
---|
182 | 91 | { |
---|
183 | 92 | struct acpi_madt_local_apic_override *lapic; |
---|
.. | .. |
---|
195 | 104 | } |
---|
196 | 105 | |
---|
197 | 106 | static int __init |
---|
198 | | -acpi_parse_lsapic(struct acpi_subtable_header * header, const unsigned long end) |
---|
| 107 | +acpi_parse_lsapic(union acpi_subtable_headers *header, const unsigned long end) |
---|
199 | 108 | { |
---|
200 | 109 | struct acpi_madt_local_sapic *lsapic; |
---|
201 | 110 | |
---|
.. | .. |
---|
216 | 125 | } |
---|
217 | 126 | |
---|
218 | 127 | static int __init |
---|
219 | | -acpi_parse_lapic_nmi(struct acpi_subtable_header * header, const unsigned long end) |
---|
| 128 | +acpi_parse_lapic_nmi(union acpi_subtable_headers * header, const unsigned long end) |
---|
220 | 129 | { |
---|
221 | 130 | struct acpi_madt_local_apic_nmi *lacpi_nmi; |
---|
222 | 131 | |
---|
.. | .. |
---|
230 | 139 | } |
---|
231 | 140 | |
---|
232 | 141 | static int __init |
---|
233 | | -acpi_parse_iosapic(struct acpi_subtable_header * header, const unsigned long end) |
---|
| 142 | +acpi_parse_iosapic(union acpi_subtable_headers * header, const unsigned long end) |
---|
234 | 143 | { |
---|
235 | 144 | struct acpi_madt_io_sapic *iosapic; |
---|
236 | 145 | |
---|
.. | .. |
---|
245 | 154 | static unsigned int __initdata acpi_madt_rev; |
---|
246 | 155 | |
---|
247 | 156 | static int __init |
---|
248 | | -acpi_parse_plat_int_src(struct acpi_subtable_header * header, |
---|
| 157 | +acpi_parse_plat_int_src(union acpi_subtable_headers * header, |
---|
249 | 158 | const unsigned long end) |
---|
250 | 159 | { |
---|
251 | 160 | struct acpi_madt_interrupt_source *plintsrc; |
---|
.. | .. |
---|
329 | 238 | } |
---|
330 | 239 | |
---|
331 | 240 | static int __init |
---|
332 | | -acpi_parse_int_src_ovr(struct acpi_subtable_header * header, |
---|
| 241 | +acpi_parse_int_src_ovr(union acpi_subtable_headers * header, |
---|
333 | 242 | const unsigned long end) |
---|
334 | 243 | { |
---|
335 | 244 | struct acpi_madt_interrupt_override *p; |
---|
.. | .. |
---|
350 | 259 | } |
---|
351 | 260 | |
---|
352 | 261 | static int __init |
---|
353 | | -acpi_parse_nmi_src(struct acpi_subtable_header * header, const unsigned long end) |
---|
| 262 | +acpi_parse_nmi_src(union acpi_subtable_headers * header, const unsigned long end) |
---|
354 | 263 | { |
---|
355 | 264 | struct acpi_madt_nmi_source *nmi_src; |
---|
356 | 265 | |
---|
.. | .. |
---|
424 | 333 | int pxm; |
---|
425 | 334 | |
---|
426 | 335 | pxm = pa->proximity_domain_lo; |
---|
427 | | - if (ia64_platform_is("sn2") || acpi_srat_revision >= 2) |
---|
| 336 | + if (acpi_srat_revision >= 2) |
---|
428 | 337 | pxm += pa->proximity_domain_hi[0] << 8; |
---|
429 | 338 | return pxm; |
---|
430 | 339 | } |
---|
.. | .. |
---|
435 | 344 | int pxm; |
---|
436 | 345 | |
---|
437 | 346 | pxm = ma->proximity_domain; |
---|
438 | | - if (!ia64_platform_is("sn2") && acpi_srat_revision <= 1) |
---|
| 347 | + if (acpi_srat_revision <= 1) |
---|
439 | 348 | pxm &= 0xff; |
---|
440 | 349 | |
---|
441 | 350 | return pxm; |
---|
.. | .. |
---|
537 | 446 | if (srat_num_cpus == 0) { |
---|
538 | 447 | node_set_online(0); |
---|
539 | 448 | node_cpuid[0].phys_id = hard_smp_processor_id(); |
---|
540 | | - return; |
---|
| 449 | + slit_distance(0, 0) = LOCAL_DISTANCE; |
---|
| 450 | + goto out; |
---|
541 | 451 | } |
---|
542 | 452 | |
---|
543 | 453 | /* |
---|
.. | .. |
---|
578 | 488 | if (!slit_table) { |
---|
579 | 489 | for (i = 0; i < MAX_NUMNODES; i++) |
---|
580 | 490 | for (j = 0; j < MAX_NUMNODES; j++) |
---|
581 | | - node_distance(i, j) = i == j ? LOCAL_DISTANCE : |
---|
582 | | - REMOTE_DISTANCE; |
---|
583 | | - return; |
---|
| 491 | + slit_distance(i, j) = i == j ? |
---|
| 492 | + LOCAL_DISTANCE : REMOTE_DISTANCE; |
---|
| 493 | + goto out; |
---|
584 | 494 | } |
---|
585 | 495 | |
---|
586 | 496 | memset(numa_slit, -1, sizeof(numa_slit)); |
---|
.. | .. |
---|
592 | 502 | if (!pxm_bit_test(j)) |
---|
593 | 503 | continue; |
---|
594 | 504 | node_to = pxm_to_node(j); |
---|
595 | | - node_distance(node_from, node_to) = |
---|
| 505 | + slit_distance(node_from, node_to) = |
---|
596 | 506 | slit_table->entry[i * slit_table->locality_count + j]; |
---|
597 | 507 | } |
---|
598 | 508 | } |
---|
.. | .. |
---|
605 | 515 | printk("\n"); |
---|
606 | 516 | } |
---|
607 | 517 | #endif |
---|
| 518 | +out: |
---|
| 519 | + node_possible_map = node_online_map; |
---|
608 | 520 | } |
---|
609 | 521 | #endif /* CONFIG_ACPI_NUMA */ |
---|
610 | 522 | |
---|
.. | .. |
---|
727 | 639 | |
---|
728 | 640 | if (acpi_table_parse_madt |
---|
729 | 641 | (ACPI_MADT_TYPE_IO_SAPIC, acpi_parse_iosapic, NR_IOSAPICS) < 1) { |
---|
730 | | - if (!ia64_platform_is("sn2")) |
---|
731 | | - printk(KERN_ERR PREFIX |
---|
732 | | - "Error parsing MADT - no IOSAPIC entries\n"); |
---|
| 642 | + printk(KERN_ERR PREFIX |
---|
| 643 | + "Error parsing MADT - no IOSAPIC entries\n"); |
---|
733 | 644 | } |
---|
734 | 645 | |
---|
735 | 646 | /* System-Level Interrupt Routing */ |
---|