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 | 4a90c7e | 2006-01-13 16:22:00 -0500 | [diff] [blame] | 8 | * Copyright (C) 2000 - 2006, R. Byron Moore |
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 | |
| 44 | #define DEFINE_ACPI_GLOBALS |
| 45 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | #include <acpi/acpi.h> |
| 47 | #include <acpi/acnamesp.h> |
| 48 | |
| 49 | #define _COMPONENT ACPI_UTILITIES |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 50 | ACPI_MODULE_NAME("utglobal") |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 52 | /******************************************************************************* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | * |
| 54 | * FUNCTION: acpi_format_exception |
| 55 | * |
| 56 | * PARAMETERS: Status - The acpi_status code to be formatted |
| 57 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 58 | * RETURN: A string containing the exception text. A valid pointer is |
| 59 | * always returned. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | * |
| 61 | * DESCRIPTION: This function translates an ACPI exception into an ASCII string. |
| 62 | * |
| 63 | ******************************************************************************/ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 64 | const char *acpi_format_exception(acpi_status status) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 66 | acpi_status sub_status; |
| 67 | const char *exception = NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | |
Bob Moore | 4a90c7e | 2006-01-13 16:22:00 -0500 | [diff] [blame] | 69 | ACPI_FUNCTION_ENTRY(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | |
Bob Moore | 4a90c7e | 2006-01-13 16:22:00 -0500 | [diff] [blame] | 71 | /* |
| 72 | * Status is composed of two parts, a "type" and an actual code |
| 73 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | sub_status = (status & ~AE_CODE_MASK); |
| 75 | |
| 76 | switch (status & AE_CODE_MASK) { |
| 77 | case AE_CODE_ENVIRONMENTAL: |
| 78 | |
| 79 | if (sub_status <= AE_CODE_ENV_MAX) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 80 | exception = acpi_gbl_exception_names_env[sub_status]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | } |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 82 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | |
| 84 | case AE_CODE_PROGRAMMER: |
| 85 | |
| 86 | if (sub_status <= AE_CODE_PGM_MAX) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 87 | exception = |
| 88 | acpi_gbl_exception_names_pgm[sub_status - 1]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | } |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 90 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | |
| 92 | case AE_CODE_ACPI_TABLES: |
| 93 | |
| 94 | if (sub_status <= AE_CODE_TBL_MAX) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 95 | exception = |
| 96 | acpi_gbl_exception_names_tbl[sub_status - 1]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 97 | } |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 98 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | |
| 100 | case AE_CODE_AML: |
| 101 | |
| 102 | if (sub_status <= AE_CODE_AML_MAX) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 103 | exception = |
| 104 | acpi_gbl_exception_names_aml[sub_status - 1]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 105 | } |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 106 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 107 | |
| 108 | case AE_CODE_CONTROL: |
| 109 | |
| 110 | if (sub_status <= AE_CODE_CTRL_MAX) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 111 | exception = |
| 112 | acpi_gbl_exception_names_ctrl[sub_status - 1]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 113 | } |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 114 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 115 | |
| 116 | default: |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 117 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | } |
| 119 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 120 | if (!exception) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 121 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 122 | /* Exception code was not recognized */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 123 | |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 124 | ACPI_ERROR((AE_INFO, |
| 125 | "Unknown exception code: 0x%8.8X", status)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 126 | |
Bob Moore | 4a90c7e | 2006-01-13 16:22:00 -0500 | [diff] [blame] | 127 | exception = "UNKNOWN_STATUS_CODE"; |
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 | 4a90c7e | 2006-01-13 16:22:00 -0500 | [diff] [blame] | 130 | return (ACPI_CAST_PTR(const char, exception)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 131 | } |
| 132 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 133 | /******************************************************************************* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 134 | * |
| 135 | * Static global variable initialization. |
| 136 | * |
| 137 | ******************************************************************************/ |
| 138 | |
| 139 | /* |
| 140 | * We want the debug switches statically initialized so they |
| 141 | * are already set when the debugger is entered. |
| 142 | */ |
| 143 | |
| 144 | /* Debug switch - level and trace mask */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 145 | u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 146 | |
| 147 | /* Debug switch - layer (component) mask */ |
| 148 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 149 | u32 acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 150 | u32 acpi_gbl_nesting_level = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 151 | |
| 152 | /* Debugger globals */ |
| 153 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 154 | u8 acpi_gbl_db_terminate_threads = FALSE; |
| 155 | u8 acpi_gbl_abort_method = FALSE; |
| 156 | u8 acpi_gbl_method_executing = FALSE; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 157 | |
| 158 | /* System flags */ |
| 159 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 160 | u32 acpi_gbl_startup_flags = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 161 | |
| 162 | /* System starts uninitialized */ |
| 163 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 164 | u8 acpi_gbl_shutdown = TRUE; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 165 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 166 | const u8 acpi_gbl_decode_to8bit[8] = { 1, 2, 4, 8, 16, 32, 64, 128 }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 167 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 168 | const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 169 | "\\_S0_", |
| 170 | "\\_S1_", |
| 171 | "\\_S2_", |
| 172 | "\\_S3_", |
| 173 | "\\_S4_", |
| 174 | "\\_S5_" |
| 175 | }; |
| 176 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 177 | const char *acpi_gbl_highest_dstate_names[4] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 178 | "_S1D", |
| 179 | "_S2D", |
| 180 | "_S3D", |
| 181 | "_S4D" |
| 182 | }; |
| 183 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 184 | /******************************************************************************* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 185 | * |
| 186 | * Namespace globals |
| 187 | * |
| 188 | ******************************************************************************/ |
| 189 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 190 | /* |
| 191 | * Predefined ACPI Names (Built-in to the Interpreter) |
| 192 | * |
| 193 | * NOTES: |
| 194 | * 1) _SB_ is defined to be a device to allow \_SB_._INI to be run |
| 195 | * during the initialization sequence. |
| 196 | * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to |
| 197 | * perform a Notify() operation on it. |
| 198 | */ |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 199 | const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = { |
| 200 | {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL}, |
| 201 | {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL}, |
| 202 | {"_SB_", ACPI_TYPE_DEVICE, NULL}, |
| 203 | {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, |
| 204 | {"_TZ_", ACPI_TYPE_THERMAL, NULL}, |
| 205 | {"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL}, |
| 206 | {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, |
| 207 | {"_GL_", ACPI_TYPE_MUTEX, (char *)1}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 208 | |
| 209 | #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY) |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 210 | {"_OSI", ACPI_TYPE_METHOD, (char *)1}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 211 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 212 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 213 | /* Table terminator */ |
| 214 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 215 | {NULL, ACPI_TYPE_ANY, NULL} |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 216 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 217 | |
| 218 | /* |
| 219 | * Properties of the ACPI Object Types, both internal and external. |
| 220 | * The table is indexed by values of acpi_object_type |
| 221 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 222 | const u8 acpi_gbl_ns_properties[] = { |
| 223 | ACPI_NS_NORMAL, /* 00 Any */ |
| 224 | ACPI_NS_NORMAL, /* 01 Number */ |
| 225 | ACPI_NS_NORMAL, /* 02 String */ |
| 226 | ACPI_NS_NORMAL, /* 03 Buffer */ |
| 227 | ACPI_NS_NORMAL, /* 04 Package */ |
| 228 | ACPI_NS_NORMAL, /* 05 field_unit */ |
| 229 | ACPI_NS_NEWSCOPE, /* 06 Device */ |
| 230 | ACPI_NS_NORMAL, /* 07 Event */ |
| 231 | ACPI_NS_NEWSCOPE, /* 08 Method */ |
| 232 | ACPI_NS_NORMAL, /* 09 Mutex */ |
| 233 | ACPI_NS_NORMAL, /* 10 Region */ |
| 234 | ACPI_NS_NEWSCOPE, /* 11 Power */ |
| 235 | ACPI_NS_NEWSCOPE, /* 12 Processor */ |
| 236 | ACPI_NS_NEWSCOPE, /* 13 Thermal */ |
| 237 | ACPI_NS_NORMAL, /* 14 buffer_field */ |
| 238 | ACPI_NS_NORMAL, /* 15 ddb_handle */ |
| 239 | ACPI_NS_NORMAL, /* 16 Debug Object */ |
| 240 | ACPI_NS_NORMAL, /* 17 def_field */ |
| 241 | ACPI_NS_NORMAL, /* 18 bank_field */ |
| 242 | ACPI_NS_NORMAL, /* 19 index_field */ |
| 243 | ACPI_NS_NORMAL, /* 20 Reference */ |
| 244 | ACPI_NS_NORMAL, /* 21 Alias */ |
| 245 | ACPI_NS_NORMAL, /* 22 method_alias */ |
| 246 | ACPI_NS_NORMAL, /* 23 Notify */ |
| 247 | ACPI_NS_NORMAL, /* 24 Address Handler */ |
| 248 | ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 25 Resource Desc */ |
| 249 | ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 26 Resource Field */ |
| 250 | ACPI_NS_NEWSCOPE, /* 27 Scope */ |
| 251 | ACPI_NS_NORMAL, /* 28 Extra */ |
| 252 | ACPI_NS_NORMAL, /* 29 Data */ |
| 253 | ACPI_NS_NORMAL /* 30 Invalid */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 254 | }; |
| 255 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 256 | /* Hex to ASCII conversion table */ |
| 257 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 258 | static const char acpi_gbl_hex_to_ascii[] = { |
| 259 | '0', '1', '2', '3', '4', '5', '6', '7', |
| 260 | '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 261 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 262 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 263 | /******************************************************************************* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 264 | * |
| 265 | * FUNCTION: acpi_ut_hex_to_ascii_char |
| 266 | * |
| 267 | * PARAMETERS: Integer - Contains the hex digit |
| 268 | * Position - bit position of the digit within the |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 269 | * integer (multiple of 4) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 270 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 271 | * RETURN: The converted Ascii character |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 272 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 273 | * DESCRIPTION: Convert a hex digit to an Ascii character |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 274 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 275 | ******************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 276 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 277 | char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 278 | { |
| 279 | |
| 280 | return (acpi_gbl_hex_to_ascii[(integer >> position) & 0xF]); |
| 281 | } |
| 282 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 283 | /******************************************************************************* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 284 | * |
| 285 | * Table name globals |
| 286 | * |
| 287 | * NOTE: This table includes ONLY the ACPI tables that the subsystem consumes. |
| 288 | * it is NOT an exhaustive list of all possible ACPI tables. All ACPI tables |
| 289 | * that are not used by the subsystem are simply ignored. |
| 290 | * |
| 291 | * Do NOT add any table to this list that is not consumed directly by this |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 292 | * subsystem (No MADT, ECDT, SBST, etc.) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 293 | * |
| 294 | ******************************************************************************/ |
| 295 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 296 | struct acpi_table_list acpi_gbl_table_lists[ACPI_TABLE_ID_MAX + 1]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 297 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 298 | struct acpi_table_support acpi_gbl_table_data[ACPI_TABLE_ID_MAX + 1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 299 | /*********** Name, Signature, Global typed pointer Signature size, Type How many allowed?, Contains valid AML? */ |
| 300 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 301 | /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL, sizeof(RSDP_SIG) - 1, |
| 302 | ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE} |
| 303 | , |
| 304 | /* DSDT 1 */ {DSDT_SIG, DSDT_SIG, (void *)&acpi_gbl_DSDT, |
| 305 | sizeof(DSDT_SIG) - 1, |
| 306 | ACPI_TABLE_SECONDARY | ACPI_TABLE_SINGLE | |
| 307 | ACPI_TABLE_EXECUTABLE} |
| 308 | , |
| 309 | /* FADT 2 */ {FADT_SIG, FADT_SIG, (void *)&acpi_gbl_FADT, |
| 310 | sizeof(FADT_SIG) - 1, |
| 311 | ACPI_TABLE_PRIMARY | ACPI_TABLE_SINGLE} |
| 312 | , |
| 313 | /* FACS 3 */ {FACS_SIG, FACS_SIG, (void *)&acpi_gbl_FACS, |
| 314 | sizeof(FACS_SIG) - 1, |
| 315 | ACPI_TABLE_SECONDARY | ACPI_TABLE_SINGLE} |
| 316 | , |
| 317 | /* PSDT 4 */ {PSDT_SIG, PSDT_SIG, NULL, sizeof(PSDT_SIG) - 1, |
| 318 | ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE | |
| 319 | ACPI_TABLE_EXECUTABLE} |
| 320 | , |
| 321 | /* SSDT 5 */ {SSDT_SIG, SSDT_SIG, NULL, sizeof(SSDT_SIG) - 1, |
| 322 | ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE | |
| 323 | ACPI_TABLE_EXECUTABLE} |
| 324 | , |
| 325 | /* XSDT 6 */ {XSDT_SIG, XSDT_SIG, NULL, sizeof(RSDT_SIG) - 1, |
| 326 | ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE} |
| 327 | , |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 328 | }; |
| 329 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 330 | /****************************************************************************** |
| 331 | * |
| 332 | * Event and Hardware globals |
| 333 | * |
| 334 | ******************************************************************************/ |
| 335 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 336 | 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] | 337 | /* Name Parent Register Register Bit Position Register Bit Mask */ |
| 338 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 339 | /* ACPI_BITREG_TIMER_STATUS */ {ACPI_REGISTER_PM1_STATUS, |
| 340 | ACPI_BITPOSITION_TIMER_STATUS, |
| 341 | ACPI_BITMASK_TIMER_STATUS}, |
| 342 | /* ACPI_BITREG_BUS_MASTER_STATUS */ {ACPI_REGISTER_PM1_STATUS, |
| 343 | ACPI_BITPOSITION_BUS_MASTER_STATUS, |
| 344 | ACPI_BITMASK_BUS_MASTER_STATUS}, |
| 345 | /* ACPI_BITREG_GLOBAL_LOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS, |
| 346 | ACPI_BITPOSITION_GLOBAL_LOCK_STATUS, |
| 347 | ACPI_BITMASK_GLOBAL_LOCK_STATUS}, |
| 348 | /* ACPI_BITREG_POWER_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS, |
| 349 | ACPI_BITPOSITION_POWER_BUTTON_STATUS, |
| 350 | ACPI_BITMASK_POWER_BUTTON_STATUS}, |
| 351 | /* ACPI_BITREG_SLEEP_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS, |
| 352 | ACPI_BITPOSITION_SLEEP_BUTTON_STATUS, |
| 353 | ACPI_BITMASK_SLEEP_BUTTON_STATUS}, |
| 354 | /* ACPI_BITREG_RT_CLOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS, |
| 355 | ACPI_BITPOSITION_RT_CLOCK_STATUS, |
| 356 | ACPI_BITMASK_RT_CLOCK_STATUS}, |
| 357 | /* ACPI_BITREG_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS, |
| 358 | ACPI_BITPOSITION_WAKE_STATUS, |
| 359 | ACPI_BITMASK_WAKE_STATUS}, |
| 360 | /* ACPI_BITREG_PCIEXP_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS, |
| 361 | ACPI_BITPOSITION_PCIEXP_WAKE_STATUS, |
| 362 | ACPI_BITMASK_PCIEXP_WAKE_STATUS}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 363 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 364 | /* ACPI_BITREG_TIMER_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, |
| 365 | ACPI_BITPOSITION_TIMER_ENABLE, |
| 366 | ACPI_BITMASK_TIMER_ENABLE}, |
| 367 | /* ACPI_BITREG_GLOBAL_LOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, |
| 368 | ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE, |
| 369 | ACPI_BITMASK_GLOBAL_LOCK_ENABLE}, |
| 370 | /* ACPI_BITREG_POWER_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, |
| 371 | ACPI_BITPOSITION_POWER_BUTTON_ENABLE, |
| 372 | ACPI_BITMASK_POWER_BUTTON_ENABLE}, |
| 373 | /* ACPI_BITREG_SLEEP_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, |
| 374 | ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE, |
| 375 | ACPI_BITMASK_SLEEP_BUTTON_ENABLE}, |
| 376 | /* ACPI_BITREG_RT_CLOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, |
| 377 | ACPI_BITPOSITION_RT_CLOCK_ENABLE, |
| 378 | ACPI_BITMASK_RT_CLOCK_ENABLE}, |
| 379 | /* ACPI_BITREG_WAKE_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, 0, 0}, |
| 380 | /* ACPI_BITREG_PCIEXP_WAKE_DISABLE */ {ACPI_REGISTER_PM1_ENABLE, |
| 381 | ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE, |
| 382 | ACPI_BITMASK_PCIEXP_WAKE_DISABLE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 383 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 384 | /* ACPI_BITREG_SCI_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, |
| 385 | ACPI_BITPOSITION_SCI_ENABLE, |
| 386 | ACPI_BITMASK_SCI_ENABLE}, |
| 387 | /* ACPI_BITREG_BUS_MASTER_RLD */ {ACPI_REGISTER_PM1_CONTROL, |
| 388 | ACPI_BITPOSITION_BUS_MASTER_RLD, |
| 389 | ACPI_BITMASK_BUS_MASTER_RLD}, |
| 390 | /* ACPI_BITREG_GLOBAL_LOCK_RELEASE */ {ACPI_REGISTER_PM1_CONTROL, |
| 391 | ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE, |
| 392 | ACPI_BITMASK_GLOBAL_LOCK_RELEASE}, |
| 393 | /* ACPI_BITREG_SLEEP_TYPE_A */ {ACPI_REGISTER_PM1_CONTROL, |
| 394 | ACPI_BITPOSITION_SLEEP_TYPE_X, |
| 395 | ACPI_BITMASK_SLEEP_TYPE_X}, |
| 396 | /* ACPI_BITREG_SLEEP_TYPE_B */ {ACPI_REGISTER_PM1_CONTROL, |
| 397 | ACPI_BITPOSITION_SLEEP_TYPE_X, |
| 398 | ACPI_BITMASK_SLEEP_TYPE_X}, |
| 399 | /* ACPI_BITREG_SLEEP_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, |
| 400 | ACPI_BITPOSITION_SLEEP_ENABLE, |
| 401 | ACPI_BITMASK_SLEEP_ENABLE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 402 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 403 | /* ACPI_BITREG_ARB_DIS */ {ACPI_REGISTER_PM2_CONTROL, |
| 404 | ACPI_BITPOSITION_ARB_DISABLE, |
| 405 | ACPI_BITMASK_ARB_DISABLE} |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 406 | }; |
| 407 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 408 | struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] = { |
| 409 | /* ACPI_EVENT_PMTIMER */ {ACPI_BITREG_TIMER_STATUS, |
| 410 | ACPI_BITREG_TIMER_ENABLE, |
| 411 | ACPI_BITMASK_TIMER_STATUS, |
| 412 | ACPI_BITMASK_TIMER_ENABLE}, |
| 413 | /* ACPI_EVENT_GLOBAL */ {ACPI_BITREG_GLOBAL_LOCK_STATUS, |
| 414 | ACPI_BITREG_GLOBAL_LOCK_ENABLE, |
| 415 | ACPI_BITMASK_GLOBAL_LOCK_STATUS, |
| 416 | ACPI_BITMASK_GLOBAL_LOCK_ENABLE}, |
| 417 | /* ACPI_EVENT_POWER_BUTTON */ {ACPI_BITREG_POWER_BUTTON_STATUS, |
| 418 | ACPI_BITREG_POWER_BUTTON_ENABLE, |
| 419 | ACPI_BITMASK_POWER_BUTTON_STATUS, |
| 420 | ACPI_BITMASK_POWER_BUTTON_ENABLE}, |
| 421 | /* ACPI_EVENT_SLEEP_BUTTON */ {ACPI_BITREG_SLEEP_BUTTON_STATUS, |
| 422 | ACPI_BITREG_SLEEP_BUTTON_ENABLE, |
| 423 | ACPI_BITMASK_SLEEP_BUTTON_STATUS, |
| 424 | ACPI_BITMASK_SLEEP_BUTTON_ENABLE}, |
| 425 | /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, |
| 426 | ACPI_BITREG_RT_CLOCK_ENABLE, |
| 427 | ACPI_BITMASK_RT_CLOCK_STATUS, |
| 428 | ACPI_BITMASK_RT_CLOCK_ENABLE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 429 | }; |
| 430 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 431 | /******************************************************************************* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 432 | * |
| 433 | * FUNCTION: acpi_ut_get_region_name |
| 434 | * |
| 435 | * PARAMETERS: None. |
| 436 | * |
| 437 | * RETURN: Status |
| 438 | * |
| 439 | * DESCRIPTION: Translate a Space ID into a name string (Debug only) |
| 440 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 441 | ******************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 442 | |
| 443 | /* Region type decoding */ |
| 444 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 445 | const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 446 | "SystemMemory", |
| 447 | "SystemIO", |
| 448 | "PCI_Config", |
| 449 | "EmbeddedControl", |
| 450 | "SMBus", |
| 451 | "CMOS", |
| 452 | "PCIBARTarget", |
| 453 | "DataTable" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 454 | }; |
| 455 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 456 | char *acpi_ut_get_region_name(u8 space_id) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 457 | { |
| 458 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 459 | if (space_id >= ACPI_USER_REGION_BEGIN) { |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 460 | return ("UserDefinedRegion"); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 461 | } else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS) { |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 462 | return ("InvalidSpaceId"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 463 | } |
| 464 | |
Bob Moore | defba1d | 2005-12-16 17:05:00 -0500 | [diff] [blame] | 465 | return (ACPI_CAST_PTR(char, acpi_gbl_region_types[space_id])); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 466 | } |
| 467 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 468 | /******************************************************************************* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 469 | * |
| 470 | * FUNCTION: acpi_ut_get_event_name |
| 471 | * |
| 472 | * PARAMETERS: None. |
| 473 | * |
| 474 | * RETURN: Status |
| 475 | * |
| 476 | * DESCRIPTION: Translate a Event ID into a name string (Debug only) |
| 477 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 478 | ******************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 479 | |
| 480 | /* Event type decoding */ |
| 481 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 482 | static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 483 | "PM_Timer", |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 484 | "GlobalLock", |
| 485 | "PowerButton", |
| 486 | "SleepButton", |
| 487 | "RealTimeClock", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 488 | }; |
| 489 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 490 | char *acpi_ut_get_event_name(u32 event_id) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 491 | { |
| 492 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 493 | if (event_id > ACPI_EVENT_MAX) { |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 494 | return ("InvalidEventID"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 495 | } |
| 496 | |
Bob Moore | 4a90c7e | 2006-01-13 16:22:00 -0500 | [diff] [blame] | 497 | return (ACPI_CAST_PTR(char, acpi_gbl_event_types[event_id])); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 498 | } |
| 499 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 500 | /******************************************************************************* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 501 | * |
| 502 | * FUNCTION: acpi_ut_get_type_name |
| 503 | * |
| 504 | * PARAMETERS: None. |
| 505 | * |
| 506 | * RETURN: Status |
| 507 | * |
| 508 | * DESCRIPTION: Translate a Type ID into a name string (Debug only) |
| 509 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 510 | ******************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 511 | |
| 512 | /* |
| 513 | * Elements of acpi_gbl_ns_type_names below must match |
| 514 | * one-to-one with values of acpi_object_type |
| 515 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 516 | * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; |
| 517 | * when stored in a table it really means that we have thus far seen no |
| 518 | * evidence to indicate what type is actually going to be stored for this entry. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 519 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 520 | static const char acpi_gbl_bad_type[] = "UNDEFINED"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 521 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 522 | /* Printable names of the ACPI object types */ |
| 523 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 524 | static const char *acpi_gbl_ns_type_names[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 525 | /* 00 */ "Untyped", |
| 526 | /* 01 */ "Integer", |
| 527 | /* 02 */ "String", |
| 528 | /* 03 */ "Buffer", |
| 529 | /* 04 */ "Package", |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 530 | /* 05 */ "FieldUnit", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 531 | /* 06 */ "Device", |
| 532 | /* 07 */ "Event", |
| 533 | /* 08 */ "Method", |
| 534 | /* 09 */ "Mutex", |
| 535 | /* 10 */ "Region", |
| 536 | /* 11 */ "Power", |
| 537 | /* 12 */ "Processor", |
| 538 | /* 13 */ "Thermal", |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 539 | /* 14 */ "BufferField", |
| 540 | /* 15 */ "DdbHandle", |
| 541 | /* 16 */ "DebugObject", |
| 542 | /* 17 */ "RegionField", |
| 543 | /* 18 */ "BankField", |
| 544 | /* 19 */ "IndexField", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 545 | /* 20 */ "Reference", |
| 546 | /* 21 */ "Alias", |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 547 | /* 22 */ "MethodAlias", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 548 | /* 23 */ "Notify", |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 549 | /* 24 */ "AddrHandler", |
| 550 | /* 25 */ "ResourceDesc", |
| 551 | /* 26 */ "ResourceFld", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 552 | /* 27 */ "Scope", |
| 553 | /* 28 */ "Extra", |
| 554 | /* 29 */ "Data", |
| 555 | /* 30 */ "Invalid" |
| 556 | }; |
| 557 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 558 | char *acpi_ut_get_type_name(acpi_object_type type) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 559 | { |
| 560 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 561 | if (type > ACPI_TYPE_INVALID) { |
Bob Moore | 4a90c7e | 2006-01-13 16:22:00 -0500 | [diff] [blame] | 562 | return (ACPI_CAST_PTR(char, acpi_gbl_bad_type)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 563 | } |
| 564 | |
Bob Moore | 4a90c7e | 2006-01-13 16:22:00 -0500 | [diff] [blame] | 565 | return (ACPI_CAST_PTR(char, acpi_gbl_ns_type_names[type])); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 566 | } |
| 567 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 568 | char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 569 | { |
| 570 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 571 | if (!obj_desc) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 572 | return ("[NULL Object Descriptor]"); |
| 573 | } |
| 574 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 575 | return (acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE(obj_desc))); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 576 | } |
| 577 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 578 | /******************************************************************************* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 579 | * |
| 580 | * FUNCTION: acpi_ut_get_node_name |
| 581 | * |
| 582 | * PARAMETERS: Object - A namespace node |
| 583 | * |
| 584 | * RETURN: Pointer to a string |
| 585 | * |
| 586 | * DESCRIPTION: Validate the node and return the node's ACPI name. |
| 587 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 588 | ******************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 589 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 590 | char *acpi_ut_get_node_name(void *object) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 591 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 592 | struct acpi_namespace_node *node = (struct acpi_namespace_node *)object; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 593 | |
| 594 | /* Must return a string of exactly 4 characters == ACPI_NAME_SIZE */ |
| 595 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 596 | if (!object) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 597 | return ("NULL"); |
| 598 | } |
| 599 | |
| 600 | /* Check for Root node */ |
| 601 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 602 | if ((object == ACPI_ROOT_OBJECT) || (object == acpi_gbl_root_node)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 603 | return ("\"\\\" "); |
| 604 | } |
| 605 | |
| 606 | /* Descriptor must be a namespace node */ |
| 607 | |
Bob Moore | 61686124 | 2006-03-17 16:44:00 -0500 | [diff] [blame] | 608 | if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 609 | return ("####"); |
| 610 | } |
| 611 | |
| 612 | /* Name must be a valid ACPI name */ |
| 613 | |
Bob Moore | c51a4de | 2005-11-17 13:07:00 -0500 | [diff] [blame] | 614 | if (!acpi_ut_valid_acpi_name(node->name.integer)) { |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 615 | node->name.integer = acpi_ut_repair_name(node->name.integer); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 616 | } |
| 617 | |
| 618 | /* Return the name */ |
| 619 | |
| 620 | return (node->name.ascii); |
| 621 | } |
| 622 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 623 | /******************************************************************************* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 624 | * |
| 625 | * FUNCTION: acpi_ut_get_descriptor_name |
| 626 | * |
| 627 | * PARAMETERS: Object - An ACPI object |
| 628 | * |
| 629 | * RETURN: Pointer to a string |
| 630 | * |
| 631 | * DESCRIPTION: Validate object and return the descriptor type |
| 632 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 633 | ******************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 634 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 635 | /* Printable names of object descriptor types */ |
| 636 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 637 | static const char *acpi_gbl_desc_type_names[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 638 | /* 00 */ "Invalid", |
| 639 | /* 01 */ "Cached", |
| 640 | /* 02 */ "State-Generic", |
| 641 | /* 03 */ "State-Update", |
| 642 | /* 04 */ "State-Package", |
| 643 | /* 05 */ "State-Control", |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 644 | /* 06 */ "State-RootParseScope", |
| 645 | /* 07 */ "State-ParseScope", |
| 646 | /* 08 */ "State-WalkScope", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 647 | /* 09 */ "State-Result", |
| 648 | /* 10 */ "State-Notify", |
| 649 | /* 11 */ "State-Thread", |
| 650 | /* 12 */ "Walk", |
| 651 | /* 13 */ "Parser", |
| 652 | /* 14 */ "Operand", |
| 653 | /* 15 */ "Node" |
| 654 | }; |
| 655 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 656 | char *acpi_ut_get_descriptor_name(void *object) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 657 | { |
| 658 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 659 | if (!object) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 660 | return ("NULL OBJECT"); |
| 661 | } |
| 662 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 663 | if (ACPI_GET_DESCRIPTOR_TYPE(object) > ACPI_DESC_TYPE_MAX) { |
Bob Moore | defba1d | 2005-12-16 17:05:00 -0500 | [diff] [blame] | 664 | return (ACPI_CAST_PTR(char, acpi_gbl_bad_type)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 665 | } |
| 666 | |
Bob Moore | defba1d | 2005-12-16 17:05:00 -0500 | [diff] [blame] | 667 | return (ACPI_CAST_PTR(char, |
| 668 | acpi_gbl_desc_type_names[ACPI_GET_DESCRIPTOR_TYPE |
| 669 | (object)])); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 670 | |
| 671 | } |
| 672 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 673 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) |
| 674 | /* |
| 675 | * Strings and procedures used for debug only |
| 676 | */ |
| 677 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 678 | /******************************************************************************* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 679 | * |
| 680 | * FUNCTION: acpi_ut_get_mutex_name |
| 681 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 682 | * PARAMETERS: mutex_id - The predefined ID for this mutex. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 683 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 684 | * RETURN: String containing the name of the mutex. Always returns a valid |
| 685 | * pointer. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 686 | * |
| 687 | * DESCRIPTION: Translate a mutex ID into a name string (Debug only) |
| 688 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 689 | ******************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 690 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 691 | char *acpi_ut_get_mutex_name(u32 mutex_id) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 692 | { |
| 693 | |
Bob Moore | 4c90ece | 2006-06-08 16:29:00 -0400 | [diff] [blame] | 694 | if (mutex_id > ACPI_MAX_MUTEX) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 695 | return ("Invalid Mutex ID"); |
| 696 | } |
| 697 | |
| 698 | return (acpi_gbl_mutex_names[mutex_id]); |
| 699 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 700 | #endif |
| 701 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 702 | /******************************************************************************* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 703 | * |
| 704 | * FUNCTION: acpi_ut_valid_object_type |
| 705 | * |
| 706 | * PARAMETERS: Type - Object type to be validated |
| 707 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 708 | * RETURN: TRUE if valid object type, FALSE otherwise |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 709 | * |
| 710 | * DESCRIPTION: Validate an object type |
| 711 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 712 | ******************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 713 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 714 | u8 acpi_ut_valid_object_type(acpi_object_type type) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 715 | { |
| 716 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 717 | if (type > ACPI_TYPE_LOCAL_MAX) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 718 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 719 | /* Note: Assumes all TYPEs are contiguous (external/local) */ |
| 720 | |
| 721 | return (FALSE); |
| 722 | } |
| 723 | |
| 724 | return (TRUE); |
| 725 | } |
| 726 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 727 | /******************************************************************************* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 728 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 729 | * FUNCTION: acpi_ut_init_globals |
| 730 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 731 | * PARAMETERS: None |
| 732 | * |
| 733 | * RETURN: None |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 734 | * |
| 735 | * DESCRIPTION: Init library globals. All globals that require specific |
| 736 | * initialization should be initialized here! |
| 737 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 738 | ******************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 739 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 740 | void acpi_ut_init_globals(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 741 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 742 | acpi_status status; |
| 743 | u32 i; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 744 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 745 | ACPI_FUNCTION_TRACE(ut_init_globals); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 746 | |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 747 | /* Create all memory caches */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 748 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 749 | status = acpi_ut_create_caches(); |
| 750 | if (ACPI_FAILURE(status)) { |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 751 | return; |
| 752 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 753 | |
| 754 | /* ACPI table structure */ |
| 755 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 756 | for (i = 0; i < (ACPI_TABLE_ID_MAX + 1); i++) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 757 | acpi_gbl_table_lists[i].next = NULL; |
| 758 | acpi_gbl_table_lists[i].count = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 759 | } |
| 760 | |
| 761 | /* Mutex locked flags */ |
| 762 | |
Bob Moore | 4c90ece | 2006-06-08 16:29:00 -0400 | [diff] [blame] | 763 | for (i = 0; i < ACPI_NUM_MUTEX; i++) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 764 | acpi_gbl_mutex_info[i].mutex = NULL; |
| 765 | acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED; |
| 766 | acpi_gbl_mutex_info[i].use_count = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 767 | } |
| 768 | |
Bob Moore | 28f55eb | 2005-12-02 18:27:00 -0500 | [diff] [blame] | 769 | for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++) { |
| 770 | acpi_gbl_owner_id_mask[i] = 0; |
| 771 | } |
| 772 | acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000; /* Last ID is never valid */ |
| 773 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 774 | /* GPE support */ |
| 775 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 776 | acpi_gbl_gpe_xrupt_list_head = NULL; |
| 777 | acpi_gbl_gpe_fadt_blocks[0] = NULL; |
| 778 | acpi_gbl_gpe_fadt_blocks[1] = NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 779 | |
| 780 | /* Global notify handlers */ |
| 781 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 782 | acpi_gbl_system_notify.handler = NULL; |
| 783 | acpi_gbl_device_notify.handler = NULL; |
| 784 | acpi_gbl_exception_handler = NULL; |
| 785 | acpi_gbl_init_handler = NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 786 | |
| 787 | /* Global "typed" ACPI table pointers */ |
| 788 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 789 | acpi_gbl_RSDP = NULL; |
| 790 | acpi_gbl_XSDT = NULL; |
| 791 | acpi_gbl_FACS = NULL; |
| 792 | acpi_gbl_FADT = NULL; |
| 793 | acpi_gbl_DSDT = NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 794 | |
| 795 | /* Global Lock support */ |
| 796 | |
Bob Moore | 967440e3 | 2006-06-23 17:04:00 -0400 | [diff] [blame] | 797 | acpi_gbl_global_lock_semaphore = NULL; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 798 | acpi_gbl_global_lock_acquired = FALSE; |
| 799 | acpi_gbl_global_lock_thread_count = 0; |
| 800 | acpi_gbl_global_lock_handle = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 801 | |
| 802 | /* Miscellaneous variables */ |
| 803 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 804 | acpi_gbl_table_flags = ACPI_PHYSICAL_POINTER; |
| 805 | acpi_gbl_rsdp_original_location = 0; |
| 806 | acpi_gbl_cm_single_step = FALSE; |
| 807 | acpi_gbl_db_terminate_threads = FALSE; |
| 808 | acpi_gbl_shutdown = FALSE; |
| 809 | acpi_gbl_ns_lookup_count = 0; |
| 810 | acpi_gbl_ps_find_count = 0; |
| 811 | acpi_gbl_acpi_hardware_present = TRUE; |
Bob Moore | 28f55eb | 2005-12-02 18:27:00 -0500 | [diff] [blame] | 812 | acpi_gbl_last_owner_id_index = 0; |
| 813 | acpi_gbl_next_owner_id_offset = 0; |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 814 | acpi_gbl_trace_method_name = 0; |
| 815 | acpi_gbl_trace_dbg_level = 0; |
| 816 | acpi_gbl_trace_dbg_layer = 0; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 817 | acpi_gbl_debugger_configuration = DEBUGGER_THREADING; |
| 818 | acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 819 | |
| 820 | /* Hardware oriented */ |
| 821 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 822 | acpi_gbl_events_initialized = FALSE; |
| 823 | acpi_gbl_system_awake_and_running = TRUE; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 824 | |
| 825 | /* Namespace */ |
| 826 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 827 | acpi_gbl_root_node = NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 828 | acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME; |
Bob Moore | 61686124 | 2006-03-17 16:44:00 -0500 | [diff] [blame] | 829 | acpi_gbl_root_node_struct.descriptor_type = ACPI_DESC_TYPE_NAMED; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 830 | acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE; |
| 831 | acpi_gbl_root_node_struct.child = NULL; |
| 832 | acpi_gbl_root_node_struct.peer = NULL; |
| 833 | acpi_gbl_root_node_struct.object = NULL; |
| 834 | acpi_gbl_root_node_struct.flags = ANOBJ_END_OF_PEER_LIST; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 835 | |
| 836 | #ifdef ACPI_DEBUG_OUTPUT |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 837 | acpi_gbl_lowest_stack_pointer = ACPI_SIZE_MAX; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 838 | #endif |
| 839 | |
| 840 | return_VOID; |
| 841 | } |
Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 842 | |
| 843 | ACPI_EXPORT_SYMBOL(acpi_dbg_level) |
| 844 | ACPI_EXPORT_SYMBOL(acpi_dbg_layer) |