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