treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / acpi / acpica / utglobal.c
blobe6dcbdc3fc6ec8e3d58f19ba892ae8ab5a709545
1 // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
2 /******************************************************************************
4 * Module Name: utglobal - Global variables for the ACPI subsystem
6 * Copyright (C) 2000 - 2020, Intel Corp.
8 *****************************************************************************/
10 #define EXPORT_ACPI_INTERFACES
11 #define DEFINE_ACPI_GLOBALS
13 #include <acpi/acpi.h>
14 #include "accommon.h"
16 #define _COMPONENT ACPI_UTILITIES
17 ACPI_MODULE_NAME("utglobal")
19 /*******************************************************************************
21 * Static global variable initialization.
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_"
34 const char *acpi_gbl_lowest_dstate_names[ACPI_NUM_sx_w_METHODS] = {
35 "_S0W",
36 "_S1W",
37 "_S2W",
38 "_S3W",
39 "_S4W"
42 const char *acpi_gbl_highest_dstate_names[ACPI_NUM_sx_d_METHODS] = {
43 "_S1D",
44 "_S2D",
45 "_S3D",
46 "_S4D"
49 /* Hex-to-ascii */
51 const char acpi_gbl_lower_hex_digits[] = "0123456789abcdef";
52 const char acpi_gbl_upper_hex_digits[] = "0123456789ABCDEF";
54 /*******************************************************************************
56 * Namespace globals
58 ******************************************************************************/
60 * Predefined ACPI Names (Built-in to the Interpreter)
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.
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},
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.
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 {"_OSI", ACPI_TYPE_METHOD, ACPI_CAST_PTR(char, 1)},
88 /* Table terminator */
90 {NULL, ACPI_TYPE_ANY, NULL}
93 #if (!ACPI_REDUCED_HARDWARE)
94 /******************************************************************************
96 * Event and Hardware globals
98 ******************************************************************************/
100 struct acpi_bit_register_info acpi_gbl_bit_register_info[ACPI_NUM_BITREG] = {
101 /* Name Parent Register Register Bit Position Register Bit Mask */
103 /* ACPI_BITREG_TIMER_STATUS */ {ACPI_REGISTER_PM1_STATUS,
104 ACPI_BITPOSITION_TIMER_STATUS,
105 ACPI_BITMASK_TIMER_STATUS},
106 /* ACPI_BITREG_BUS_MASTER_STATUS */ {ACPI_REGISTER_PM1_STATUS,
107 ACPI_BITPOSITION_BUS_MASTER_STATUS,
108 ACPI_BITMASK_BUS_MASTER_STATUS},
109 /* ACPI_BITREG_GLOBAL_LOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS,
110 ACPI_BITPOSITION_GLOBAL_LOCK_STATUS,
111 ACPI_BITMASK_GLOBAL_LOCK_STATUS},
112 /* ACPI_BITREG_POWER_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS,
113 ACPI_BITPOSITION_POWER_BUTTON_STATUS,
114 ACPI_BITMASK_POWER_BUTTON_STATUS},
115 /* ACPI_BITREG_SLEEP_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS,
116 ACPI_BITPOSITION_SLEEP_BUTTON_STATUS,
117 ACPI_BITMASK_SLEEP_BUTTON_STATUS},
118 /* ACPI_BITREG_RT_CLOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS,
119 ACPI_BITPOSITION_RT_CLOCK_STATUS,
120 ACPI_BITMASK_RT_CLOCK_STATUS},
121 /* ACPI_BITREG_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS,
122 ACPI_BITPOSITION_WAKE_STATUS,
123 ACPI_BITMASK_WAKE_STATUS},
124 /* ACPI_BITREG_PCIEXP_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS,
125 ACPI_BITPOSITION_PCIEXP_WAKE_STATUS,
126 ACPI_BITMASK_PCIEXP_WAKE_STATUS},
128 /* ACPI_BITREG_TIMER_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
129 ACPI_BITPOSITION_TIMER_ENABLE,
130 ACPI_BITMASK_TIMER_ENABLE},
131 /* ACPI_BITREG_GLOBAL_LOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
132 ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE,
133 ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
134 /* ACPI_BITREG_POWER_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
135 ACPI_BITPOSITION_POWER_BUTTON_ENABLE,
136 ACPI_BITMASK_POWER_BUTTON_ENABLE},
137 /* ACPI_BITREG_SLEEP_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
138 ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE,
139 ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
140 /* ACPI_BITREG_RT_CLOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
141 ACPI_BITPOSITION_RT_CLOCK_ENABLE,
142 ACPI_BITMASK_RT_CLOCK_ENABLE},
143 /* ACPI_BITREG_PCIEXP_WAKE_DISABLE */ {ACPI_REGISTER_PM1_ENABLE,
144 ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE,
145 ACPI_BITMASK_PCIEXP_WAKE_DISABLE},
147 /* ACPI_BITREG_SCI_ENABLE */ {ACPI_REGISTER_PM1_CONTROL,
148 ACPI_BITPOSITION_SCI_ENABLE,
149 ACPI_BITMASK_SCI_ENABLE},
150 /* ACPI_BITREG_BUS_MASTER_RLD */ {ACPI_REGISTER_PM1_CONTROL,
151 ACPI_BITPOSITION_BUS_MASTER_RLD,
152 ACPI_BITMASK_BUS_MASTER_RLD},
153 /* ACPI_BITREG_GLOBAL_LOCK_RELEASE */ {ACPI_REGISTER_PM1_CONTROL,
154 ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE,
155 ACPI_BITMASK_GLOBAL_LOCK_RELEASE},
156 /* ACPI_BITREG_SLEEP_TYPE */ {ACPI_REGISTER_PM1_CONTROL,
157 ACPI_BITPOSITION_SLEEP_TYPE,
158 ACPI_BITMASK_SLEEP_TYPE},
159 /* ACPI_BITREG_SLEEP_ENABLE */ {ACPI_REGISTER_PM1_CONTROL,
160 ACPI_BITPOSITION_SLEEP_ENABLE,
161 ACPI_BITMASK_SLEEP_ENABLE},
163 /* ACPI_BITREG_ARB_DIS */ {ACPI_REGISTER_PM2_CONTROL,
164 ACPI_BITPOSITION_ARB_DISABLE,
165 ACPI_BITMASK_ARB_DISABLE}
168 struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] = {
169 /* ACPI_EVENT_PMTIMER */ {ACPI_BITREG_TIMER_STATUS,
170 ACPI_BITREG_TIMER_ENABLE,
171 ACPI_BITMASK_TIMER_STATUS,
172 ACPI_BITMASK_TIMER_ENABLE},
173 /* ACPI_EVENT_GLOBAL */ {ACPI_BITREG_GLOBAL_LOCK_STATUS,
174 ACPI_BITREG_GLOBAL_LOCK_ENABLE,
175 ACPI_BITMASK_GLOBAL_LOCK_STATUS,
176 ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
177 /* ACPI_EVENT_POWER_BUTTON */ {ACPI_BITREG_POWER_BUTTON_STATUS,
178 ACPI_BITREG_POWER_BUTTON_ENABLE,
179 ACPI_BITMASK_POWER_BUTTON_STATUS,
180 ACPI_BITMASK_POWER_BUTTON_ENABLE},
181 /* ACPI_EVENT_SLEEP_BUTTON */ {ACPI_BITREG_SLEEP_BUTTON_STATUS,
182 ACPI_BITREG_SLEEP_BUTTON_ENABLE,
183 ACPI_BITMASK_SLEEP_BUTTON_STATUS,
184 ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
185 /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS,
186 ACPI_BITREG_RT_CLOCK_ENABLE,
187 ACPI_BITMASK_RT_CLOCK_STATUS,
188 ACPI_BITMASK_RT_CLOCK_ENABLE},
190 #endif /* !ACPI_REDUCED_HARDWARE */
192 #if defined (ACPI_DISASSEMBLER) || defined (ACPI_ASL_COMPILER)
194 /* to_pld macro: compile/disassemble strings */
196 const char *acpi_gbl_pld_panel_list[] = {
197 "TOP",
198 "BOTTOM",
199 "LEFT",
200 "RIGHT",
201 "FRONT",
202 "BACK",
203 "UNKNOWN",
204 NULL
207 const char *acpi_gbl_pld_vertical_position_list[] = {
208 "UPPER",
209 "CENTER",
210 "LOWER",
211 NULL
214 const char *acpi_gbl_pld_horizontal_position_list[] = {
215 "LEFT",
216 "CENTER",
217 "RIGHT",
218 NULL
221 const char *acpi_gbl_pld_shape_list[] = {
222 "ROUND",
223 "OVAL",
224 "SQUARE",
225 "VERTICALRECTANGLE",
226 "HORIZONTALRECTANGLE",
227 "VERTICALTRAPEZOID",
228 "HORIZONTALTRAPEZOID",
229 "UNKNOWN",
230 "CHAMFERED",
231 NULL
233 #endif
235 /* Public globals */
237 ACPI_EXPORT_SYMBOL(acpi_gbl_FADT)
238 ACPI_EXPORT_SYMBOL(acpi_dbg_level)
239 ACPI_EXPORT_SYMBOL(acpi_dbg_layer)
240 ACPI_EXPORT_SYMBOL(acpi_gpe_count)
241 ACPI_EXPORT_SYMBOL(acpi_current_gpe_count)