Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * Module Name: utglobal - Global variables for the ACPI subsystem |
| 4 | * |
| 5 | *****************************************************************************/ |
| 6 | |
| 7 | /* |
Bob Moore | c8100dc | 2016-01-15 08:17:03 +0800 | [diff] [blame] | 8 | * Copyright (C) 2000 - 2016, Intel Corp. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | * All rights reserved. |
| 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without |
| 12 | * modification, are permitted provided that the following conditions |
| 13 | * are met: |
| 14 | * 1. Redistributions of source code must retain the above copyright |
| 15 | * notice, this list of conditions, and the following disclaimer, |
| 16 | * without modification. |
| 17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer |
| 18 | * substantially similar to the "NO WARRANTY" disclaimer below |
| 19 | * ("Disclaimer") and any redistribution must be conditioned upon |
| 20 | * including a substantially similar Disclaimer requirement for further |
| 21 | * binary redistribution. |
| 22 | * 3. Neither the names of the above-listed copyright holders nor the names |
| 23 | * of any contributors may be used to endorse or promote products derived |
| 24 | * from this software without specific prior written permission. |
| 25 | * |
| 26 | * Alternatively, this software may be distributed under the terms of the |
| 27 | * GNU General Public License ("GPL") version 2 as published by the Free |
| 28 | * Software Foundation. |
| 29 | * |
| 30 | * NO WARRANTY |
| 31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR |
| 34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
| 40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 41 | * POSSIBILITY OF SUCH DAMAGES. |
| 42 | */ |
| 43 | |
Lv Zheng | 839e928 | 2013-10-29 09:29:51 +0800 | [diff] [blame] | 44 | #define EXPORT_ACPI_INTERFACES |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | #define DEFINE_ACPI_GLOBALS |
| 46 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | #include <acpi/acpi.h> |
Len Brown | e2f7a77 | 2009-01-09 00:30:03 -0500 | [diff] [blame] | 48 | #include "accommon.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | |
| 50 | #define _COMPONENT ACPI_UTILITIES |
Bob Moore | e97d6bf | 2008-12-30 09:45:17 +0800 | [diff] [blame] | 51 | ACPI_MODULE_NAME("utglobal") |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 53 | /******************************************************************************* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | * Static global variable initialization. |
| 56 | * |
| 57 | ******************************************************************************/ |
Lv Zheng | 3aa0b08 | 2014-02-26 10:32:38 +0800 | [diff] [blame] | 58 | /* Various state name strings */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 59 | const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | "\\_S0_", |
| 61 | "\\_S1_", |
| 62 | "\\_S2_", |
| 63 | "\\_S3_", |
| 64 | "\\_S4_", |
| 65 | "\\_S5_" |
| 66 | }; |
| 67 | |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 68 | const char *acpi_gbl_lowest_dstate_names[ACPI_NUM_sx_w_METHODS] = { |
| 69 | "_S0W", |
| 70 | "_S1W", |
| 71 | "_S2W", |
| 72 | "_S3W", |
| 73 | "_S4W" |
| 74 | }; |
| 75 | |
| 76 | const char *acpi_gbl_highest_dstate_names[ACPI_NUM_sx_d_METHODS] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | "_S1D", |
| 78 | "_S2D", |
| 79 | "_S3D", |
| 80 | "_S4D" |
| 81 | }; |
| 82 | |
Bob Moore | 0dfaaa3 | 2016-03-24 09:40:40 +0800 | [diff] [blame] | 83 | /* Hex-to-ascii */ |
| 84 | |
| 85 | const char acpi_gbl_lower_hex_digits[] = "0123456789abcdef"; |
| 86 | const char acpi_gbl_upper_hex_digits[] = "0123456789ABCDEF"; |
| 87 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 88 | /******************************************************************************* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | * |
Bob Moore | 84fb2c9 | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 90 | * Namespace globals |
| 91 | * |
| 92 | ******************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 93 | /* |
| 94 | * Predefined ACPI Names (Built-in to the Interpreter) |
| 95 | * |
| 96 | * NOTES: |
| 97 | * 1) _SB_ is defined to be a device to allow \_SB_._INI to be run |
| 98 | * during the initialization sequence. |
| 99 | * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to |
Bob Moore | 8125666 | 2010-10-18 08:44:34 +0800 | [diff] [blame] | 100 | * perform a Notify() operation on it. 09/2010: Changed to type Device. |
| 101 | * This still allows notifies, but does not confuse host code that |
| 102 | * searches for valid thermal_zone objects. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 | */ |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 104 | const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = { |
| 105 | {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL}, |
| 106 | {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL}, |
| 107 | {"_SB_", ACPI_TYPE_DEVICE, NULL}, |
| 108 | {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, |
Bob Moore | 8125666 | 2010-10-18 08:44:34 +0800 | [diff] [blame] | 109 | {"_TZ_", ACPI_TYPE_DEVICE, NULL}, |
Rafael J. Wysocki | ea7d521 | 2015-07-01 23:24:05 +0200 | [diff] [blame] | 110 | /* |
| 111 | * March, 2015: |
| 112 | * The _REV object is in the process of being deprecated, because |
| 113 | * other ACPI implementations permanently return 2. Thus, it |
| 114 | * has little or no value. Return 2 for compatibility with |
| 115 | * other ACPI implementations. |
| 116 | */ |
| 117 | {"_REV", ACPI_TYPE_INTEGER, ACPI_CAST_PTR(char, 2)}, |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 118 | {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, |
Rafael J. Wysocki | ea7d521 | 2015-07-01 23:24:05 +0200 | [diff] [blame] | 119 | {"_GL_", ACPI_TYPE_MUTEX, ACPI_CAST_PTR(char, 1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 120 | |
| 121 | #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY) |
Rafael J. Wysocki | ea7d521 | 2015-07-01 23:24:05 +0200 | [diff] [blame] | 122 | {"_OSI", ACPI_TYPE_METHOD, ACPI_CAST_PTR(char, 1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 123 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 124 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 125 | /* Table terminator */ |
| 126 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 127 | {NULL, ACPI_TYPE_ANY, NULL} |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 128 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 129 | |
Bob Moore | 33620c5 | 2012-02-14 18:14:27 +0800 | [diff] [blame] | 130 | #if (!ACPI_REDUCED_HARDWARE) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 131 | /****************************************************************************** |
| 132 | * |
| 133 | * Event and Hardware globals |
| 134 | * |
| 135 | ******************************************************************************/ |
| 136 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 137 | struct acpi_bit_register_info acpi_gbl_bit_register_info[ACPI_NUM_BITREG] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 138 | /* Name Parent Register Register Bit Position Register Bit Mask */ |
| 139 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 140 | /* ACPI_BITREG_TIMER_STATUS */ {ACPI_REGISTER_PM1_STATUS, |
| 141 | ACPI_BITPOSITION_TIMER_STATUS, |
| 142 | ACPI_BITMASK_TIMER_STATUS}, |
| 143 | /* ACPI_BITREG_BUS_MASTER_STATUS */ {ACPI_REGISTER_PM1_STATUS, |
| 144 | ACPI_BITPOSITION_BUS_MASTER_STATUS, |
| 145 | ACPI_BITMASK_BUS_MASTER_STATUS}, |
| 146 | /* ACPI_BITREG_GLOBAL_LOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS, |
| 147 | ACPI_BITPOSITION_GLOBAL_LOCK_STATUS, |
| 148 | ACPI_BITMASK_GLOBAL_LOCK_STATUS}, |
| 149 | /* ACPI_BITREG_POWER_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS, |
| 150 | ACPI_BITPOSITION_POWER_BUTTON_STATUS, |
| 151 | ACPI_BITMASK_POWER_BUTTON_STATUS}, |
| 152 | /* ACPI_BITREG_SLEEP_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS, |
| 153 | ACPI_BITPOSITION_SLEEP_BUTTON_STATUS, |
| 154 | ACPI_BITMASK_SLEEP_BUTTON_STATUS}, |
| 155 | /* ACPI_BITREG_RT_CLOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS, |
| 156 | ACPI_BITPOSITION_RT_CLOCK_STATUS, |
| 157 | ACPI_BITMASK_RT_CLOCK_STATUS}, |
| 158 | /* ACPI_BITREG_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS, |
| 159 | ACPI_BITPOSITION_WAKE_STATUS, |
| 160 | ACPI_BITMASK_WAKE_STATUS}, |
| 161 | /* ACPI_BITREG_PCIEXP_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS, |
| 162 | ACPI_BITPOSITION_PCIEXP_WAKE_STATUS, |
| 163 | ACPI_BITMASK_PCIEXP_WAKE_STATUS}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 164 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 165 | /* ACPI_BITREG_TIMER_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, |
| 166 | ACPI_BITPOSITION_TIMER_ENABLE, |
| 167 | ACPI_BITMASK_TIMER_ENABLE}, |
| 168 | /* ACPI_BITREG_GLOBAL_LOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, |
| 169 | ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE, |
| 170 | ACPI_BITMASK_GLOBAL_LOCK_ENABLE}, |
| 171 | /* ACPI_BITREG_POWER_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, |
| 172 | ACPI_BITPOSITION_POWER_BUTTON_ENABLE, |
| 173 | ACPI_BITMASK_POWER_BUTTON_ENABLE}, |
| 174 | /* ACPI_BITREG_SLEEP_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, |
| 175 | ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE, |
| 176 | ACPI_BITMASK_SLEEP_BUTTON_ENABLE}, |
| 177 | /* ACPI_BITREG_RT_CLOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, |
| 178 | ACPI_BITPOSITION_RT_CLOCK_ENABLE, |
| 179 | ACPI_BITMASK_RT_CLOCK_ENABLE}, |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 180 | /* ACPI_BITREG_PCIEXP_WAKE_DISABLE */ {ACPI_REGISTER_PM1_ENABLE, |
| 181 | ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE, |
| 182 | ACPI_BITMASK_PCIEXP_WAKE_DISABLE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 183 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 184 | /* ACPI_BITREG_SCI_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, |
| 185 | ACPI_BITPOSITION_SCI_ENABLE, |
| 186 | ACPI_BITMASK_SCI_ENABLE}, |
| 187 | /* ACPI_BITREG_BUS_MASTER_RLD */ {ACPI_REGISTER_PM1_CONTROL, |
| 188 | ACPI_BITPOSITION_BUS_MASTER_RLD, |
| 189 | ACPI_BITMASK_BUS_MASTER_RLD}, |
| 190 | /* ACPI_BITREG_GLOBAL_LOCK_RELEASE */ {ACPI_REGISTER_PM1_CONTROL, |
| 191 | ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE, |
| 192 | ACPI_BITMASK_GLOBAL_LOCK_RELEASE}, |
Bob Moore | 82d79b8 | 2009-02-18 14:31:05 +0800 | [diff] [blame] | 193 | /* ACPI_BITREG_SLEEP_TYPE */ {ACPI_REGISTER_PM1_CONTROL, |
| 194 | ACPI_BITPOSITION_SLEEP_TYPE, |
| 195 | ACPI_BITMASK_SLEEP_TYPE}, |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 196 | /* ACPI_BITREG_SLEEP_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, |
| 197 | ACPI_BITPOSITION_SLEEP_ENABLE, |
| 198 | ACPI_BITMASK_SLEEP_ENABLE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 199 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 200 | /* ACPI_BITREG_ARB_DIS */ {ACPI_REGISTER_PM2_CONTROL, |
| 201 | ACPI_BITPOSITION_ARB_DISABLE, |
| 202 | ACPI_BITMASK_ARB_DISABLE} |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 203 | }; |
| 204 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 205 | struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] = { |
| 206 | /* ACPI_EVENT_PMTIMER */ {ACPI_BITREG_TIMER_STATUS, |
| 207 | ACPI_BITREG_TIMER_ENABLE, |
| 208 | ACPI_BITMASK_TIMER_STATUS, |
| 209 | ACPI_BITMASK_TIMER_ENABLE}, |
| 210 | /* ACPI_EVENT_GLOBAL */ {ACPI_BITREG_GLOBAL_LOCK_STATUS, |
| 211 | ACPI_BITREG_GLOBAL_LOCK_ENABLE, |
| 212 | ACPI_BITMASK_GLOBAL_LOCK_STATUS, |
| 213 | ACPI_BITMASK_GLOBAL_LOCK_ENABLE}, |
| 214 | /* ACPI_EVENT_POWER_BUTTON */ {ACPI_BITREG_POWER_BUTTON_STATUS, |
| 215 | ACPI_BITREG_POWER_BUTTON_ENABLE, |
| 216 | ACPI_BITMASK_POWER_BUTTON_STATUS, |
| 217 | ACPI_BITMASK_POWER_BUTTON_ENABLE}, |
| 218 | /* ACPI_EVENT_SLEEP_BUTTON */ {ACPI_BITREG_SLEEP_BUTTON_STATUS, |
| 219 | ACPI_BITREG_SLEEP_BUTTON_ENABLE, |
| 220 | ACPI_BITMASK_SLEEP_BUTTON_STATUS, |
| 221 | ACPI_BITMASK_SLEEP_BUTTON_ENABLE}, |
| 222 | /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, |
| 223 | ACPI_BITREG_RT_CLOCK_ENABLE, |
| 224 | ACPI_BITMASK_RT_CLOCK_STATUS, |
| 225 | ACPI_BITMASK_RT_CLOCK_ENABLE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 226 | }; |
Bob Moore | 33620c5 | 2012-02-14 18:14:27 +0800 | [diff] [blame] | 227 | #endif /* !ACPI_REDUCED_HARDWARE */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 228 | |
Bob Moore | fe0f876 | 2016-03-24 09:40:05 +0800 | [diff] [blame] | 229 | #if defined (ACPI_DISASSEMBLER) || defined (ACPI_ASL_COMPILER) |
| 230 | |
| 231 | /* to_pld macro: compile/disassemble strings */ |
| 232 | |
| 233 | const char *acpi_gbl_pld_panel_list[] = { |
| 234 | "TOP", |
| 235 | "BOTTOM", |
| 236 | "LEFT", |
| 237 | "RIGHT", |
| 238 | "FRONT", |
| 239 | "BACK", |
| 240 | "UNKNOWN", |
| 241 | NULL |
| 242 | }; |
| 243 | |
| 244 | const char *acpi_gbl_pld_vertical_position_list[] = { |
| 245 | "UPPER", |
| 246 | "CENTER", |
| 247 | "LOWER", |
| 248 | NULL |
| 249 | }; |
| 250 | |
| 251 | const char *acpi_gbl_pld_horizontal_position_list[] = { |
| 252 | "LEFT", |
| 253 | "CENTER", |
| 254 | "RIGHT", |
| 255 | NULL |
| 256 | }; |
| 257 | |
| 258 | const char *acpi_gbl_pld_shape_list[] = { |
| 259 | "ROUND", |
| 260 | "OVAL", |
| 261 | "SQUARE", |
| 262 | "VERTICALRECTANGLE", |
| 263 | "HORIZONTALRECTANGLE", |
| 264 | "VERTICALTRAPEZOID", |
| 265 | "HORIZONTALTRAPEZOID", |
| 266 | "UNKNOWN", |
| 267 | "CHAMFERED", |
| 268 | NULL |
| 269 | }; |
| 270 | #endif |
| 271 | |
Lv Zheng | 75c8044 | 2012-12-19 05:36:49 +0000 | [diff] [blame] | 272 | /* Public globals */ |
Lv Zheng | 3e8214e | 2012-12-19 05:37:15 +0000 | [diff] [blame] | 273 | |
Bob Moore | e97d6bf | 2008-12-30 09:45:17 +0800 | [diff] [blame] | 274 | ACPI_EXPORT_SYMBOL(acpi_gbl_FADT) |
Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 275 | ACPI_EXPORT_SYMBOL(acpi_dbg_level) |
Bob Moore | 1044f1f | 2008-09-27 11:08:41 +0800 | [diff] [blame] | 276 | ACPI_EXPORT_SYMBOL(acpi_dbg_layer) |
Lv Zheng | 9187a41 | 2013-10-31 09:30:28 +0800 | [diff] [blame] | 277 | ACPI_EXPORT_SYMBOL(acpi_gpe_count) |
Bob Moore | e97d6bf | 2008-12-30 09:45:17 +0800 | [diff] [blame] | 278 | ACPI_EXPORT_SYMBOL(acpi_current_gpe_count) |