xref: /openbmc/linux/drivers/acpi/acpica/utglobal.c (revision a48c7709)
1 // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
2 /******************************************************************************
3  *
4  * Module Name: utglobal - Global variables for the ACPI subsystem
5  *
6  * Copyright (C) 2000 - 2018, Intel Corp.
7  *
8  *****************************************************************************/
9 
10 #define EXPORT_ACPI_INTERFACES
11 #define DEFINE_ACPI_GLOBALS
12 
13 #include <acpi/acpi.h>
14 #include "accommon.h"
15 
16 #define _COMPONENT          ACPI_UTILITIES
17 ACPI_MODULE_NAME("utglobal")
18 
19 /*******************************************************************************
20  *
21  * Static global variable initialization.
22  *
23  ******************************************************************************/
24 /* Various state name strings */
25 const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT] = {
26 	"\\_S0_",
27 	"\\_S1_",
28 	"\\_S2_",
29 	"\\_S3_",
30 	"\\_S4_",
31 	"\\_S5_"
32 };
33 
34 const char *acpi_gbl_lowest_dstate_names[ACPI_NUM_sx_w_METHODS] = {
35 	"_S0W",
36 	"_S1W",
37 	"_S2W",
38 	"_S3W",
39 	"_S4W"
40 };
41 
42 const char *acpi_gbl_highest_dstate_names[ACPI_NUM_sx_d_METHODS] = {
43 	"_S1D",
44 	"_S2D",
45 	"_S3D",
46 	"_S4D"
47 };
48 
49 /* Hex-to-ascii */
50 
51 const char acpi_gbl_lower_hex_digits[] = "0123456789abcdef";
52 const char acpi_gbl_upper_hex_digits[] = "0123456789ABCDEF";
53 
54 /*******************************************************************************
55  *
56  * Namespace globals
57  *
58  ******************************************************************************/
59 /*
60  * Predefined ACPI Names (Built-in to the Interpreter)
61  *
62  * NOTES:
63  * 1) _SB_ is defined to be a device to allow \_SB_._INI to be run
64  *    during the initialization sequence.
65  * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to
66  *    perform a Notify() operation on it. 09/2010: Changed to type Device.
67  *    This still allows notifies, but does not confuse host code that
68  *    searches for valid thermal_zone objects.
69  */
70 const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = {
71 	{"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL},
72 	{"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL},
73 	{"_SB_", ACPI_TYPE_DEVICE, NULL},
74 	{"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL},
75 	{"_TZ_", ACPI_TYPE_DEVICE, NULL},
76 	/*
77 	 * March, 2015:
78 	 * The _REV object is in the process of being deprecated, because
79 	 * other ACPI implementations permanently return 2. Thus, it
80 	 * has little or no value. Return 2 for compatibility with
81 	 * other ACPI implementations.
82 	 */
83 	{"_REV", ACPI_TYPE_INTEGER, ACPI_CAST_PTR(char, 2)},
84 	{"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME},
85 	{"_GL_", ACPI_TYPE_MUTEX, ACPI_CAST_PTR(char, 1)},
86 
87 #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
88 	{"_OSI", ACPI_TYPE_METHOD, ACPI_CAST_PTR(char, 1)},
89 #endif
90 
91 	/* Table terminator */
92 
93 	{NULL, ACPI_TYPE_ANY, NULL}
94 };
95 
96 #if (!ACPI_REDUCED_HARDWARE)
97 /******************************************************************************
98  *
99  * Event and Hardware globals
100  *
101  ******************************************************************************/
102 
103 struct acpi_bit_register_info acpi_gbl_bit_register_info[ACPI_NUM_BITREG] = {
104 	/* Name                                     Parent Register             Register Bit Position                   Register Bit Mask       */
105 
106 	/* ACPI_BITREG_TIMER_STATUS         */ {ACPI_REGISTER_PM1_STATUS,
107 						ACPI_BITPOSITION_TIMER_STATUS,
108 						ACPI_BITMASK_TIMER_STATUS},
109 	/* ACPI_BITREG_BUS_MASTER_STATUS    */ {ACPI_REGISTER_PM1_STATUS,
110 						ACPI_BITPOSITION_BUS_MASTER_STATUS,
111 						ACPI_BITMASK_BUS_MASTER_STATUS},
112 	/* ACPI_BITREG_GLOBAL_LOCK_STATUS   */ {ACPI_REGISTER_PM1_STATUS,
113 						ACPI_BITPOSITION_GLOBAL_LOCK_STATUS,
114 						ACPI_BITMASK_GLOBAL_LOCK_STATUS},
115 	/* ACPI_BITREG_POWER_BUTTON_STATUS  */ {ACPI_REGISTER_PM1_STATUS,
116 						ACPI_BITPOSITION_POWER_BUTTON_STATUS,
117 						ACPI_BITMASK_POWER_BUTTON_STATUS},
118 	/* ACPI_BITREG_SLEEP_BUTTON_STATUS  */ {ACPI_REGISTER_PM1_STATUS,
119 						ACPI_BITPOSITION_SLEEP_BUTTON_STATUS,
120 						ACPI_BITMASK_SLEEP_BUTTON_STATUS},
121 	/* ACPI_BITREG_RT_CLOCK_STATUS      */ {ACPI_REGISTER_PM1_STATUS,
122 						ACPI_BITPOSITION_RT_CLOCK_STATUS,
123 						ACPI_BITMASK_RT_CLOCK_STATUS},
124 	/* ACPI_BITREG_WAKE_STATUS          */ {ACPI_REGISTER_PM1_STATUS,
125 						ACPI_BITPOSITION_WAKE_STATUS,
126 						ACPI_BITMASK_WAKE_STATUS},
127 	/* ACPI_BITREG_PCIEXP_WAKE_STATUS   */ {ACPI_REGISTER_PM1_STATUS,
128 						ACPI_BITPOSITION_PCIEXP_WAKE_STATUS,
129 						ACPI_BITMASK_PCIEXP_WAKE_STATUS},
130 
131 	/* ACPI_BITREG_TIMER_ENABLE         */ {ACPI_REGISTER_PM1_ENABLE,
132 						ACPI_BITPOSITION_TIMER_ENABLE,
133 						ACPI_BITMASK_TIMER_ENABLE},
134 	/* ACPI_BITREG_GLOBAL_LOCK_ENABLE   */ {ACPI_REGISTER_PM1_ENABLE,
135 						ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE,
136 						ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
137 	/* ACPI_BITREG_POWER_BUTTON_ENABLE  */ {ACPI_REGISTER_PM1_ENABLE,
138 						ACPI_BITPOSITION_POWER_BUTTON_ENABLE,
139 						ACPI_BITMASK_POWER_BUTTON_ENABLE},
140 	/* ACPI_BITREG_SLEEP_BUTTON_ENABLE  */ {ACPI_REGISTER_PM1_ENABLE,
141 						ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE,
142 						ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
143 	/* ACPI_BITREG_RT_CLOCK_ENABLE      */ {ACPI_REGISTER_PM1_ENABLE,
144 						ACPI_BITPOSITION_RT_CLOCK_ENABLE,
145 						ACPI_BITMASK_RT_CLOCK_ENABLE},
146 	/* ACPI_BITREG_PCIEXP_WAKE_DISABLE  */ {ACPI_REGISTER_PM1_ENABLE,
147 						ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE,
148 						ACPI_BITMASK_PCIEXP_WAKE_DISABLE},
149 
150 	/* ACPI_BITREG_SCI_ENABLE           */ {ACPI_REGISTER_PM1_CONTROL,
151 						ACPI_BITPOSITION_SCI_ENABLE,
152 						ACPI_BITMASK_SCI_ENABLE},
153 	/* ACPI_BITREG_BUS_MASTER_RLD       */ {ACPI_REGISTER_PM1_CONTROL,
154 						ACPI_BITPOSITION_BUS_MASTER_RLD,
155 						ACPI_BITMASK_BUS_MASTER_RLD},
156 	/* ACPI_BITREG_GLOBAL_LOCK_RELEASE  */ {ACPI_REGISTER_PM1_CONTROL,
157 						ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE,
158 						ACPI_BITMASK_GLOBAL_LOCK_RELEASE},
159 	/* ACPI_BITREG_SLEEP_TYPE           */ {ACPI_REGISTER_PM1_CONTROL,
160 						ACPI_BITPOSITION_SLEEP_TYPE,
161 						ACPI_BITMASK_SLEEP_TYPE},
162 	/* ACPI_BITREG_SLEEP_ENABLE         */ {ACPI_REGISTER_PM1_CONTROL,
163 						ACPI_BITPOSITION_SLEEP_ENABLE,
164 						ACPI_BITMASK_SLEEP_ENABLE},
165 
166 	/* ACPI_BITREG_ARB_DIS              */ {ACPI_REGISTER_PM2_CONTROL,
167 						ACPI_BITPOSITION_ARB_DISABLE,
168 						ACPI_BITMASK_ARB_DISABLE}
169 };
170 
171 struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] = {
172 	/* ACPI_EVENT_PMTIMER       */ {ACPI_BITREG_TIMER_STATUS,
173 					ACPI_BITREG_TIMER_ENABLE,
174 					ACPI_BITMASK_TIMER_STATUS,
175 					ACPI_BITMASK_TIMER_ENABLE},
176 	/* ACPI_EVENT_GLOBAL        */ {ACPI_BITREG_GLOBAL_LOCK_STATUS,
177 					ACPI_BITREG_GLOBAL_LOCK_ENABLE,
178 					ACPI_BITMASK_GLOBAL_LOCK_STATUS,
179 					ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
180 	/* ACPI_EVENT_POWER_BUTTON  */ {ACPI_BITREG_POWER_BUTTON_STATUS,
181 					ACPI_BITREG_POWER_BUTTON_ENABLE,
182 					ACPI_BITMASK_POWER_BUTTON_STATUS,
183 					ACPI_BITMASK_POWER_BUTTON_ENABLE},
184 	/* ACPI_EVENT_SLEEP_BUTTON  */ {ACPI_BITREG_SLEEP_BUTTON_STATUS,
185 					ACPI_BITREG_SLEEP_BUTTON_ENABLE,
186 					ACPI_BITMASK_SLEEP_BUTTON_STATUS,
187 					ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
188 	/* ACPI_EVENT_RTC           */ {ACPI_BITREG_RT_CLOCK_STATUS,
189 					ACPI_BITREG_RT_CLOCK_ENABLE,
190 					ACPI_BITMASK_RT_CLOCK_STATUS,
191 					ACPI_BITMASK_RT_CLOCK_ENABLE},
192 };
193 #endif				/* !ACPI_REDUCED_HARDWARE */
194 
195 #if defined (ACPI_DISASSEMBLER) || defined (ACPI_ASL_COMPILER)
196 
197 /* to_pld macro: compile/disassemble strings */
198 
199 const char *acpi_gbl_pld_panel_list[] = {
200 	"TOP",
201 	"BOTTOM",
202 	"LEFT",
203 	"RIGHT",
204 	"FRONT",
205 	"BACK",
206 	"UNKNOWN",
207 	NULL
208 };
209 
210 const char *acpi_gbl_pld_vertical_position_list[] = {
211 	"UPPER",
212 	"CENTER",
213 	"LOWER",
214 	NULL
215 };
216 
217 const char *acpi_gbl_pld_horizontal_position_list[] = {
218 	"LEFT",
219 	"CENTER",
220 	"RIGHT",
221 	NULL
222 };
223 
224 const char *acpi_gbl_pld_shape_list[] = {
225 	"ROUND",
226 	"OVAL",
227 	"SQUARE",
228 	"VERTICALRECTANGLE",
229 	"HORIZONTALRECTANGLE",
230 	"VERTICALTRAPEZOID",
231 	"HORIZONTALTRAPEZOID",
232 	"UNKNOWN",
233 	"CHAMFERED",
234 	NULL
235 };
236 #endif
237 
238 /* Public globals */
239 
240 ACPI_EXPORT_SYMBOL(acpi_gbl_FADT)
241 ACPI_EXPORT_SYMBOL(acpi_dbg_level)
242 ACPI_EXPORT_SYMBOL(acpi_dbg_layer)
243 ACPI_EXPORT_SYMBOL(acpi_gpe_count)
244 ACPI_EXPORT_SYMBOL(acpi_current_gpe_count)
245