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 | fbb7a2d | 2014-02-08 09:42:25 +0800 | [diff] [blame] | 8 | * Copyright (C) 2000 - 2014, 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 | /* Debug output control masks */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 59 | u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | |
Bjorn Helgaas | e76f427 | 2008-11-13 17:30:13 -0600 | [diff] [blame] | 61 | u32 acpi_dbg_layer = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | |
Lv Zheng | 3aa0b08 | 2014-02-26 10:32:38 +0800 | [diff] [blame] | 63 | /* acpi_gbl_FADT is a local copy of the FADT, converted to a common format. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | |
Lv Zheng | 3aa0b08 | 2014-02-26 10:32:38 +0800 | [diff] [blame] | 65 | struct acpi_table_fadt acpi_gbl_FADT; |
| 66 | u32 acpi_gbl_trace_flags; |
| 67 | acpi_name acpi_gbl_trace_method_name; |
| 68 | u8 acpi_gbl_system_awake_and_running; |
| 69 | u32 acpi_current_gpe_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | |
Lv Zheng | 3aa0b08 | 2014-02-26 10:32:38 +0800 | [diff] [blame] | 71 | /* |
| 72 | * ACPI 5.0 introduces the concept of a "reduced hardware platform", meaning |
| 73 | * that the ACPI hardware is no longer required. A flag in the FADT indicates |
| 74 | * a reduced HW machine, and that flag is duplicated here for convenience. |
| 75 | */ |
| 76 | u8 acpi_gbl_reduced_hardware; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | |
Lv Zheng | 3aa0b08 | 2014-02-26 10:32:38 +0800 | [diff] [blame] | 78 | /* Various state name strings */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 80 | const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | "\\_S0_", |
| 82 | "\\_S1_", |
| 83 | "\\_S2_", |
| 84 | "\\_S3_", |
| 85 | "\\_S4_", |
| 86 | "\\_S5_" |
| 87 | }; |
| 88 | |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 89 | const char *acpi_gbl_lowest_dstate_names[ACPI_NUM_sx_w_METHODS] = { |
| 90 | "_S0W", |
| 91 | "_S1W", |
| 92 | "_S2W", |
| 93 | "_S3W", |
| 94 | "_S4W" |
| 95 | }; |
| 96 | |
| 97 | const char *acpi_gbl_highest_dstate_names[ACPI_NUM_sx_d_METHODS] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 98 | "_S1D", |
| 99 | "_S2D", |
| 100 | "_S3D", |
| 101 | "_S4D" |
| 102 | }; |
| 103 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 104 | /******************************************************************************* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 105 | * |
Bob Moore | 84fb2c9 | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 106 | * Namespace globals |
| 107 | * |
| 108 | ******************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 109 | /* |
| 110 | * Predefined ACPI Names (Built-in to the Interpreter) |
| 111 | * |
| 112 | * NOTES: |
| 113 | * 1) _SB_ is defined to be a device to allow \_SB_._INI to be run |
| 114 | * during the initialization sequence. |
| 115 | * 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] | 116 | * perform a Notify() operation on it. 09/2010: Changed to type Device. |
| 117 | * This still allows notifies, but does not confuse host code that |
| 118 | * searches for valid thermal_zone objects. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 119 | */ |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 120 | const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = { |
| 121 | {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL}, |
| 122 | {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL}, |
| 123 | {"_SB_", ACPI_TYPE_DEVICE, NULL}, |
| 124 | {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, |
Bob Moore | 8125666 | 2010-10-18 08:44:34 +0800 | [diff] [blame] | 125 | {"_TZ_", ACPI_TYPE_DEVICE, NULL}, |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 126 | {"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL}, |
| 127 | {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, |
| 128 | {"_GL_", ACPI_TYPE_MUTEX, (char *)1}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 129 | |
| 130 | #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY) |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 131 | {"_OSI", ACPI_TYPE_METHOD, (char *)1}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 132 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 133 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 134 | /* Table terminator */ |
| 135 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 136 | {NULL, ACPI_TYPE_ANY, NULL} |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 137 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 138 | |
Bob Moore | 33620c5 | 2012-02-14 18:14:27 +0800 | [diff] [blame] | 139 | #if (!ACPI_REDUCED_HARDWARE) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 140 | /****************************************************************************** |
| 141 | * |
| 142 | * Event and Hardware globals |
| 143 | * |
| 144 | ******************************************************************************/ |
| 145 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 146 | 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] | 147 | /* Name Parent Register Register Bit Position Register Bit Mask */ |
| 148 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 149 | /* ACPI_BITREG_TIMER_STATUS */ {ACPI_REGISTER_PM1_STATUS, |
| 150 | ACPI_BITPOSITION_TIMER_STATUS, |
| 151 | ACPI_BITMASK_TIMER_STATUS}, |
| 152 | /* ACPI_BITREG_BUS_MASTER_STATUS */ {ACPI_REGISTER_PM1_STATUS, |
| 153 | ACPI_BITPOSITION_BUS_MASTER_STATUS, |
| 154 | ACPI_BITMASK_BUS_MASTER_STATUS}, |
| 155 | /* ACPI_BITREG_GLOBAL_LOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS, |
| 156 | ACPI_BITPOSITION_GLOBAL_LOCK_STATUS, |
| 157 | ACPI_BITMASK_GLOBAL_LOCK_STATUS}, |
| 158 | /* ACPI_BITREG_POWER_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS, |
| 159 | ACPI_BITPOSITION_POWER_BUTTON_STATUS, |
| 160 | ACPI_BITMASK_POWER_BUTTON_STATUS}, |
| 161 | /* ACPI_BITREG_SLEEP_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS, |
| 162 | ACPI_BITPOSITION_SLEEP_BUTTON_STATUS, |
| 163 | ACPI_BITMASK_SLEEP_BUTTON_STATUS}, |
| 164 | /* ACPI_BITREG_RT_CLOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS, |
| 165 | ACPI_BITPOSITION_RT_CLOCK_STATUS, |
| 166 | ACPI_BITMASK_RT_CLOCK_STATUS}, |
| 167 | /* ACPI_BITREG_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS, |
| 168 | ACPI_BITPOSITION_WAKE_STATUS, |
| 169 | ACPI_BITMASK_WAKE_STATUS}, |
| 170 | /* ACPI_BITREG_PCIEXP_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS, |
| 171 | ACPI_BITPOSITION_PCIEXP_WAKE_STATUS, |
| 172 | ACPI_BITMASK_PCIEXP_WAKE_STATUS}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 173 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 174 | /* ACPI_BITREG_TIMER_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, |
| 175 | ACPI_BITPOSITION_TIMER_ENABLE, |
| 176 | ACPI_BITMASK_TIMER_ENABLE}, |
| 177 | /* ACPI_BITREG_GLOBAL_LOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, |
| 178 | ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE, |
| 179 | ACPI_BITMASK_GLOBAL_LOCK_ENABLE}, |
| 180 | /* ACPI_BITREG_POWER_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, |
| 181 | ACPI_BITPOSITION_POWER_BUTTON_ENABLE, |
| 182 | ACPI_BITMASK_POWER_BUTTON_ENABLE}, |
| 183 | /* ACPI_BITREG_SLEEP_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, |
| 184 | ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE, |
| 185 | ACPI_BITMASK_SLEEP_BUTTON_ENABLE}, |
| 186 | /* ACPI_BITREG_RT_CLOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, |
| 187 | ACPI_BITPOSITION_RT_CLOCK_ENABLE, |
| 188 | ACPI_BITMASK_RT_CLOCK_ENABLE}, |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 189 | /* ACPI_BITREG_PCIEXP_WAKE_DISABLE */ {ACPI_REGISTER_PM1_ENABLE, |
| 190 | ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE, |
| 191 | ACPI_BITMASK_PCIEXP_WAKE_DISABLE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 192 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 193 | /* ACPI_BITREG_SCI_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, |
| 194 | ACPI_BITPOSITION_SCI_ENABLE, |
| 195 | ACPI_BITMASK_SCI_ENABLE}, |
| 196 | /* ACPI_BITREG_BUS_MASTER_RLD */ {ACPI_REGISTER_PM1_CONTROL, |
| 197 | ACPI_BITPOSITION_BUS_MASTER_RLD, |
| 198 | ACPI_BITMASK_BUS_MASTER_RLD}, |
| 199 | /* ACPI_BITREG_GLOBAL_LOCK_RELEASE */ {ACPI_REGISTER_PM1_CONTROL, |
| 200 | ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE, |
| 201 | ACPI_BITMASK_GLOBAL_LOCK_RELEASE}, |
Bob Moore | 82d79b8 | 2009-02-18 14:31:05 +0800 | [diff] [blame] | 202 | /* ACPI_BITREG_SLEEP_TYPE */ {ACPI_REGISTER_PM1_CONTROL, |
| 203 | ACPI_BITPOSITION_SLEEP_TYPE, |
| 204 | ACPI_BITMASK_SLEEP_TYPE}, |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 205 | /* ACPI_BITREG_SLEEP_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, |
| 206 | ACPI_BITPOSITION_SLEEP_ENABLE, |
| 207 | ACPI_BITMASK_SLEEP_ENABLE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 208 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 209 | /* ACPI_BITREG_ARB_DIS */ {ACPI_REGISTER_PM2_CONTROL, |
| 210 | ACPI_BITPOSITION_ARB_DISABLE, |
| 211 | ACPI_BITMASK_ARB_DISABLE} |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 212 | }; |
| 213 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 214 | struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] = { |
| 215 | /* ACPI_EVENT_PMTIMER */ {ACPI_BITREG_TIMER_STATUS, |
| 216 | ACPI_BITREG_TIMER_ENABLE, |
| 217 | ACPI_BITMASK_TIMER_STATUS, |
| 218 | ACPI_BITMASK_TIMER_ENABLE}, |
| 219 | /* ACPI_EVENT_GLOBAL */ {ACPI_BITREG_GLOBAL_LOCK_STATUS, |
| 220 | ACPI_BITREG_GLOBAL_LOCK_ENABLE, |
| 221 | ACPI_BITMASK_GLOBAL_LOCK_STATUS, |
| 222 | ACPI_BITMASK_GLOBAL_LOCK_ENABLE}, |
| 223 | /* ACPI_EVENT_POWER_BUTTON */ {ACPI_BITREG_POWER_BUTTON_STATUS, |
| 224 | ACPI_BITREG_POWER_BUTTON_ENABLE, |
| 225 | ACPI_BITMASK_POWER_BUTTON_STATUS, |
| 226 | ACPI_BITMASK_POWER_BUTTON_ENABLE}, |
| 227 | /* ACPI_EVENT_SLEEP_BUTTON */ {ACPI_BITREG_SLEEP_BUTTON_STATUS, |
| 228 | ACPI_BITREG_SLEEP_BUTTON_ENABLE, |
| 229 | ACPI_BITMASK_SLEEP_BUTTON_STATUS, |
| 230 | ACPI_BITMASK_SLEEP_BUTTON_ENABLE}, |
| 231 | /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, |
| 232 | ACPI_BITREG_RT_CLOCK_ENABLE, |
| 233 | ACPI_BITMASK_RT_CLOCK_STATUS, |
| 234 | ACPI_BITMASK_RT_CLOCK_ENABLE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 235 | }; |
Bob Moore | 33620c5 | 2012-02-14 18:14:27 +0800 | [diff] [blame] | 236 | #endif /* !ACPI_REDUCED_HARDWARE */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 237 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 238 | /******************************************************************************* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 239 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 240 | * FUNCTION: acpi_ut_init_globals |
| 241 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 242 | * PARAMETERS: None |
| 243 | * |
Yi Yang | b417d40 | 2008-08-04 10:30:09 +0800 | [diff] [blame] | 244 | * RETURN: Status |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 245 | * |
Bob Moore | cf48958 | 2012-07-16 09:52:27 +0800 | [diff] [blame] | 246 | * DESCRIPTION: Initialize ACPICA globals. All globals that require specific |
| 247 | * initialization should be initialized here. This allows for |
| 248 | * a warm restart. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 249 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 250 | ******************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 251 | |
Yi Yang | b417d40 | 2008-08-04 10:30:09 +0800 | [diff] [blame] | 252 | acpi_status acpi_ut_init_globals(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 253 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 254 | acpi_status status; |
| 255 | u32 i; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 256 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 257 | ACPI_FUNCTION_TRACE(ut_init_globals); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 258 | |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 259 | /* Create all memory caches */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 260 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 261 | status = acpi_ut_create_caches(); |
| 262 | if (ACPI_FAILURE(status)) { |
Yi Yang | b417d40 | 2008-08-04 10:30:09 +0800 | [diff] [blame] | 263 | return_ACPI_STATUS(status); |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 264 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 265 | |
Lin Ming | f654c0f | 2012-01-12 13:10:32 +0800 | [diff] [blame] | 266 | /* Address Range lists */ |
| 267 | |
| 268 | for (i = 0; i < ACPI_ADDRESS_RANGE_MAX; i++) { |
| 269 | acpi_gbl_address_range_list[i] = NULL; |
| 270 | } |
| 271 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 272 | /* Mutex locked flags */ |
| 273 | |
Bob Moore | 4c90ece | 2006-06-08 16:29:00 -0400 | [diff] [blame] | 274 | for (i = 0; i < ACPI_NUM_MUTEX; i++) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 275 | acpi_gbl_mutex_info[i].mutex = NULL; |
| 276 | acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED; |
| 277 | acpi_gbl_mutex_info[i].use_count = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 278 | } |
| 279 | |
Bob Moore | 28f55eb | 2005-12-02 18:27:00 -0500 | [diff] [blame] | 280 | for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++) { |
| 281 | acpi_gbl_owner_id_mask[i] = 0; |
| 282 | } |
Bob Moore | ec41f19 | 2009-02-18 15:03:30 +0800 | [diff] [blame] | 283 | |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 284 | /* Last owner_ID is never valid */ |
Bob Moore | ec41f19 | 2009-02-18 15:03:30 +0800 | [diff] [blame] | 285 | |
| 286 | acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000; |
Bob Moore | 28f55eb | 2005-12-02 18:27:00 -0500 | [diff] [blame] | 287 | |
Lv Zheng | 9187a41 | 2013-10-31 09:30:28 +0800 | [diff] [blame] | 288 | /* Event counters */ |
| 289 | |
| 290 | acpi_method_count = 0; |
| 291 | acpi_sci_count = 0; |
| 292 | acpi_gpe_count = 0; |
| 293 | |
| 294 | for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { |
| 295 | acpi_fixed_event_count[i] = 0; |
| 296 | } |
| 297 | |
Bob Moore | 33620c5 | 2012-02-14 18:14:27 +0800 | [diff] [blame] | 298 | #if (!ACPI_REDUCED_HARDWARE) |
| 299 | |
Lv Zheng | a2fd4b4 | 2013-09-23 09:52:05 +0800 | [diff] [blame] | 300 | /* GPE/SCI support */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 301 | |
Lv Zheng | 75e4446 | 2012-12-19 05:37:41 +0000 | [diff] [blame] | 302 | acpi_gbl_all_gpes_initialized = FALSE; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 303 | acpi_gbl_gpe_xrupt_list_head = NULL; |
| 304 | acpi_gbl_gpe_fadt_blocks[0] = NULL; |
| 305 | acpi_gbl_gpe_fadt_blocks[1] = NULL; |
Bob Moore | e97d6bf | 2008-12-30 09:45:17 +0800 | [diff] [blame] | 306 | acpi_current_gpe_count = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 307 | |
Bob Moore | 33620c5 | 2012-02-14 18:14:27 +0800 | [diff] [blame] | 308 | acpi_gbl_global_event_handler = NULL; |
Lv Zheng | a2fd4b4 | 2013-09-23 09:52:05 +0800 | [diff] [blame] | 309 | acpi_gbl_sci_handler_list = NULL; |
Bob Moore | 33620c5 | 2012-02-14 18:14:27 +0800 | [diff] [blame] | 310 | |
| 311 | #endif /* !ACPI_REDUCED_HARDWARE */ |
| 312 | |
Lin Ming | 3e08e2d | 2008-04-10 19:06:38 +0400 | [diff] [blame] | 313 | /* Global handlers */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | |
Bob Moore | 86ed4bc | 2012-05-03 11:08:19 +0800 | [diff] [blame] | 315 | acpi_gbl_global_notify[0].handler = NULL; |
| 316 | acpi_gbl_global_notify[1].handler = NULL; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 317 | acpi_gbl_exception_handler = NULL; |
| 318 | acpi_gbl_init_handler = NULL; |
Lin Ming | 3e08e2d | 2008-04-10 19:06:38 +0400 | [diff] [blame] | 319 | acpi_gbl_table_handler = NULL; |
Lin Ming | b0ed7a9 | 2010-08-06 09:35:51 +0800 | [diff] [blame] | 320 | acpi_gbl_interface_handler = NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 321 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 322 | /* Global Lock support */ |
| 323 | |
Bob Moore | 967440e3 | 2006-06-23 17:04:00 -0400 | [diff] [blame] | 324 | acpi_gbl_global_lock_semaphore = NULL; |
Bob Moore | c81da66 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 325 | acpi_gbl_global_lock_mutex = NULL; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 326 | acpi_gbl_global_lock_acquired = FALSE; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 327 | acpi_gbl_global_lock_handle = 0; |
Bob Moore | 009c4cbe | 2008-11-12 15:34:52 +0800 | [diff] [blame] | 328 | acpi_gbl_global_lock_present = FALSE; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 329 | |
| 330 | /* Miscellaneous variables */ |
| 331 | |
Bob Moore | 43323cb | 2010-04-07 11:05:11 +0800 | [diff] [blame] | 332 | acpi_gbl_DSDT = NULL; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 333 | acpi_gbl_cm_single_step = FALSE; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 334 | acpi_gbl_shutdown = FALSE; |
| 335 | acpi_gbl_ns_lookup_count = 0; |
| 336 | acpi_gbl_ps_find_count = 0; |
| 337 | acpi_gbl_acpi_hardware_present = TRUE; |
Bob Moore | 28f55eb | 2005-12-02 18:27:00 -0500 | [diff] [blame] | 338 | acpi_gbl_last_owner_id_index = 0; |
| 339 | acpi_gbl_next_owner_id_offset = 0; |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 340 | acpi_gbl_trace_method_name = 0; |
| 341 | acpi_gbl_trace_dbg_level = 0; |
| 342 | acpi_gbl_trace_dbg_layer = 0; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 343 | acpi_gbl_debugger_configuration = DEBUGGER_THREADING; |
| 344 | acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT; |
Lin Ming | b0ed7a9 | 2010-08-06 09:35:51 +0800 | [diff] [blame] | 345 | acpi_gbl_osi_mutex = NULL; |
Bob Moore | ef09c4f | 2011-02-14 16:13:25 +0800 | [diff] [blame] | 346 | acpi_gbl_reg_methods_executed = FALSE; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 347 | |
| 348 | /* Hardware oriented */ |
| 349 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 350 | acpi_gbl_events_initialized = FALSE; |
| 351 | acpi_gbl_system_awake_and_running = TRUE; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 352 | |
| 353 | /* Namespace */ |
| 354 | |
Lin Ming | 7f0c826 | 2009-08-13 14:03:15 +0800 | [diff] [blame] | 355 | acpi_gbl_module_code_list = NULL; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 356 | acpi_gbl_root_node = NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 357 | acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME; |
Bob Moore | 61686124 | 2006-03-17 16:44:00 -0500 | [diff] [blame] | 358 | acpi_gbl_root_node_struct.descriptor_type = ACPI_DESC_TYPE_NAMED; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 359 | acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE; |
Alexey Starikovskiy | c45b5c0 | 2010-05-26 11:53:07 +0800 | [diff] [blame] | 360 | acpi_gbl_root_node_struct.parent = NULL; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 361 | acpi_gbl_root_node_struct.child = NULL; |
| 362 | acpi_gbl_root_node_struct.peer = NULL; |
| 363 | acpi_gbl_root_node_struct.object = NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 364 | |
Lv Zheng | 56324c1 | 2012-12-19 05:37:03 +0000 | [diff] [blame] | 365 | #ifdef ACPI_DISASSEMBLER |
| 366 | acpi_gbl_external_list = NULL; |
Bob Moore | 4041125 | 2013-03-08 09:23:39 +0000 | [diff] [blame] | 367 | acpi_gbl_num_external_methods = 0; |
| 368 | acpi_gbl_resolved_external_methods = 0; |
Lv Zheng | 56324c1 | 2012-12-19 05:37:03 +0000 | [diff] [blame] | 369 | #endif |
| 370 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 371 | #ifdef ACPI_DEBUG_OUTPUT |
Bob Moore | 1d18c05 | 2008-04-10 19:06:40 +0400 | [diff] [blame] | 372 | acpi_gbl_lowest_stack_pointer = ACPI_CAST_PTR(acpi_size, ACPI_SIZE_MAX); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 373 | #endif |
| 374 | |
Bob Moore | d41eb99 | 2007-02-02 19:48:23 +0300 | [diff] [blame] | 375 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS |
| 376 | acpi_gbl_display_final_mem_stats = FALSE; |
Lv Zheng | 75e4446 | 2012-12-19 05:37:41 +0000 | [diff] [blame] | 377 | acpi_gbl_disable_mem_tracking = FALSE; |
Bob Moore | d41eb99 | 2007-02-02 19:48:23 +0300 | [diff] [blame] | 378 | #endif |
| 379 | |
Lv Zheng | 3aa0b08 | 2014-02-26 10:32:38 +0800 | [diff] [blame] | 380 | #ifdef ACPI_DEBUGGER |
| 381 | acpi_gbl_db_terminate_threads = FALSE; |
| 382 | #endif |
| 383 | |
Yi Yang | b417d40 | 2008-08-04 10:30:09 +0800 | [diff] [blame] | 384 | return_ACPI_STATUS(AE_OK); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 385 | } |
Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 386 | |
Lv Zheng | 75c8044 | 2012-12-19 05:36:49 +0000 | [diff] [blame] | 387 | /* Public globals */ |
Lv Zheng | 3e8214e | 2012-12-19 05:37:15 +0000 | [diff] [blame] | 388 | |
Bob Moore | e97d6bf | 2008-12-30 09:45:17 +0800 | [diff] [blame] | 389 | ACPI_EXPORT_SYMBOL(acpi_gbl_FADT) |
Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 390 | ACPI_EXPORT_SYMBOL(acpi_dbg_level) |
Bob Moore | 1044f1f | 2008-09-27 11:08:41 +0800 | [diff] [blame] | 391 | ACPI_EXPORT_SYMBOL(acpi_dbg_layer) |
Lv Zheng | 9187a41 | 2013-10-31 09:30:28 +0800 | [diff] [blame] | 392 | ACPI_EXPORT_SYMBOL(acpi_gpe_count) |
Bob Moore | e97d6bf | 2008-12-30 09:45:17 +0800 | [diff] [blame] | 393 | ACPI_EXPORT_SYMBOL(acpi_current_gpe_count) |