xref: /openbmc/linux/arch/ia64/include/asm/acpi.h (revision cf07cb1f)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  *  Copyright (C) 1999 VA Linux Systems
4  *  Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
5  *  Copyright (C) 2000,2001 J.I. Lee <jung-ik.lee@intel.com>
6  *  Copyright (C) 2001,2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
7  */
8 
9 #ifndef _ASM_ACPI_H
10 #define _ASM_ACPI_H
11 
12 #ifdef __KERNEL__
13 
14 #include <acpi/pdc_intel.h>
15 
16 #include <linux/init.h>
17 #include <linux/numa.h>
18 #include <asm/numa.h>
19 
20 #ifdef	CONFIG_ACPI
21 extern int acpi_lapic;
22 #define acpi_disabled 0	/* ACPI always enabled on IA64 */
23 #define acpi_noirq 0	/* ACPI always enabled on IA64 */
24 #define acpi_pci_disabled 0 /* ACPI PCI always enabled on IA64 */
25 #define acpi_strict 1	/* no ACPI spec workarounds on IA64 */
26 
27 static inline bool acpi_has_cpu_in_madt(void)
28 {
29 	return !!acpi_lapic;
30 }
31 #endif
32 #define acpi_processor_cstate_check(x) (x) /* no idle limits on IA64 :) */
33 static inline void disable_acpi(void) { }
34 
35 #ifdef CONFIG_IA64_GENERIC
36 const char *acpi_get_sysname (void);
37 #else
38 static inline const char *acpi_get_sysname (void)
39 {
40 # if defined (CONFIG_IA64_HP_SIM)
41 	return "hpsim";
42 # elif defined (CONFIG_IA64_HP_ZX1)
43 	return "hpzx1";
44 # elif defined (CONFIG_IA64_HP_ZX1_SWIOTLB)
45 	return "hpzx1_swiotlb";
46 # elif defined (CONFIG_IA64_SGI_UV)
47 	return "uv";
48 # elif defined (CONFIG_IA64_DIG)
49 	return "dig";
50 # elif defined(CONFIG_IA64_DIG_VTD)
51 	return "dig_vtd";
52 # else
53 #	error Unknown platform.  Fix acpi.c.
54 # endif
55 }
56 #endif
57 int acpi_request_vector (u32 int_type);
58 int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
59 
60 /* Low-level suspend routine. */
61 extern int acpi_suspend_lowlevel(void);
62 
63 extern unsigned long acpi_wakeup_address;
64 
65 /*
66  * Record the cpei override flag and current logical cpu. This is
67  * useful for CPU removal.
68  */
69 extern unsigned int can_cpei_retarget(void);
70 extern unsigned int is_cpu_cpei_target(unsigned int cpu);
71 extern void set_cpei_target_cpu(unsigned int cpu);
72 extern unsigned int get_cpei_target_cpu(void);
73 extern void prefill_possible_map(void);
74 #ifdef CONFIG_ACPI_HOTPLUG_CPU
75 extern int additional_cpus;
76 #else
77 #define additional_cpus 0
78 #endif
79 
80 #ifdef CONFIG_ACPI_NUMA
81 #if MAX_NUMNODES > 256
82 #define MAX_PXM_DOMAINS MAX_NUMNODES
83 #else
84 #define MAX_PXM_DOMAINS (256)
85 #endif
86 extern int pxm_to_nid_map[MAX_PXM_DOMAINS];
87 extern int __initdata nid_to_pxm_map[MAX_NUMNODES];
88 #endif
89 
90 static inline bool arch_has_acpi_pdc(void) { return true; }
91 static inline void arch_acpi_set_pdc_bits(u32 *buf)
92 {
93 	buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP;
94 }
95 
96 #define acpi_unlazy_tlb(x)
97 
98 #ifdef CONFIG_ACPI_NUMA
99 extern cpumask_t early_cpu_possible_map;
100 #define for_each_possible_early_cpu(cpu)  \
101 	for_each_cpu((cpu), &early_cpu_possible_map)
102 
103 static inline void per_cpu_scan_finalize(int min_cpus, int reserve_cpus)
104 {
105 	int low_cpu, high_cpu;
106 	int cpu;
107 	int next_nid = 0;
108 
109 	low_cpu = cpumask_weight(&early_cpu_possible_map);
110 
111 	high_cpu = max(low_cpu, min_cpus);
112 	high_cpu = min(high_cpu + reserve_cpus, NR_CPUS);
113 
114 	for (cpu = low_cpu; cpu < high_cpu; cpu++) {
115 		cpumask_set_cpu(cpu, &early_cpu_possible_map);
116 		if (node_cpuid[cpu].nid == NUMA_NO_NODE) {
117 			node_cpuid[cpu].nid = next_nid;
118 			next_nid++;
119 			if (next_nid >= num_online_nodes())
120 				next_nid = 0;
121 		}
122 	}
123 }
124 
125 extern void acpi_numa_fixup(void);
126 
127 #endif /* CONFIG_ACPI_NUMA */
128 
129 #endif /*__KERNEL__*/
130 
131 #endif /*_ASM_ACPI_H*/
132