forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-09-20 a36159eec6ca17402b0e146b86efaf76568dc353
kernel/arch/ia64/kernel/acpi.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * acpi.c - Architecture-Specific Low-Level ACPI Support
34 *
....@@ -12,24 +13,6 @@
1213 * Copyright (C) 2001 Takayoshi Kochi <t-kochi@bq.jp.nec.com>
1314 * Copyright (C) 2002 Erich Focht <efocht@ess.nec.de>
1415 * 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
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3316 */
3417
3518 #include <linux/module.h>
....@@ -48,7 +31,6 @@
4831 #include <acpi/processor.h>
4932 #include <asm/io.h>
5033 #include <asm/iosapic.h>
51
-#include <asm/machvec.h>
5234 #include <asm/page.h>
5335 #include <asm/numa.h>
5436 #include <asm/sal.h>
....@@ -59,79 +41,6 @@
5941 int acpi_lapic;
6042 unsigned int acpi_cpei_override;
6143 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 */
13544
13645 #define ACPI_MAX_PLATFORM_INTERRUPTS 256
13746
....@@ -177,7 +86,7 @@
17786 static u8 has_8259;
17887
17988 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,
18190 const unsigned long end)
18291 {
18392 struct acpi_madt_local_apic_override *lapic;
....@@ -195,7 +104,7 @@
195104 }
196105
197106 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)
199108 {
200109 struct acpi_madt_local_sapic *lsapic;
201110
....@@ -216,7 +125,7 @@
216125 }
217126
218127 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)
220129 {
221130 struct acpi_madt_local_apic_nmi *lacpi_nmi;
222131
....@@ -230,7 +139,7 @@
230139 }
231140
232141 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)
234143 {
235144 struct acpi_madt_io_sapic *iosapic;
236145
....@@ -245,7 +154,7 @@
245154 static unsigned int __initdata acpi_madt_rev;
246155
247156 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,
249158 const unsigned long end)
250159 {
251160 struct acpi_madt_interrupt_source *plintsrc;
....@@ -329,7 +238,7 @@
329238 }
330239
331240 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,
333242 const unsigned long end)
334243 {
335244 struct acpi_madt_interrupt_override *p;
....@@ -350,7 +259,7 @@
350259 }
351260
352261 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)
354263 {
355264 struct acpi_madt_nmi_source *nmi_src;
356265
....@@ -424,7 +333,7 @@
424333 int pxm;
425334
426335 pxm = pa->proximity_domain_lo;
427
- if (ia64_platform_is("sn2") || acpi_srat_revision >= 2)
336
+ if (acpi_srat_revision >= 2)
428337 pxm += pa->proximity_domain_hi[0] << 8;
429338 return pxm;
430339 }
....@@ -435,7 +344,7 @@
435344 int pxm;
436345
437346 pxm = ma->proximity_domain;
438
- if (!ia64_platform_is("sn2") && acpi_srat_revision <= 1)
347
+ if (acpi_srat_revision <= 1)
439348 pxm &= 0xff;
440349
441350 return pxm;
....@@ -537,7 +446,8 @@
537446 if (srat_num_cpus == 0) {
538447 node_set_online(0);
539448 node_cpuid[0].phys_id = hard_smp_processor_id();
540
- return;
449
+ slit_distance(0, 0) = LOCAL_DISTANCE;
450
+ goto out;
541451 }
542452
543453 /*
....@@ -578,9 +488,9 @@
578488 if (!slit_table) {
579489 for (i = 0; i < MAX_NUMNODES; i++)
580490 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;
584494 }
585495
586496 memset(numa_slit, -1, sizeof(numa_slit));
....@@ -592,7 +502,7 @@
592502 if (!pxm_bit_test(j))
593503 continue;
594504 node_to = pxm_to_node(j);
595
- node_distance(node_from, node_to) =
505
+ slit_distance(node_from, node_to) =
596506 slit_table->entry[i * slit_table->locality_count + j];
597507 }
598508 }
....@@ -605,6 +515,8 @@
605515 printk("\n");
606516 }
607517 #endif
518
+out:
519
+ node_possible_map = node_online_map;
608520 }
609521 #endif /* CONFIG_ACPI_NUMA */
610522
....@@ -727,9 +639,8 @@
727639
728640 if (acpi_table_parse_madt
729641 (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");
733644 }
734645
735646 /* System-Level Interrupt Routing */