1 1.1 jruoho /****************************************************************************** 2 1.1 jruoho * 3 1.1 jruoho * Module Name: utdecode - Utility decoding routines (value-to-string) 4 1.1 jruoho * 5 1.1 jruoho *****************************************************************************/ 6 1.1 jruoho 7 1.21 christos /****************************************************************************** 8 1.21 christos * 9 1.21 christos * 1. Copyright Notice 10 1.21 christos * 11 1.22 christos * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. 12 1.1 jruoho * All rights reserved. 13 1.1 jruoho * 14 1.21 christos * 2. License 15 1.21 christos * 16 1.21 christos * 2.1. This is your license from Intel Corp. under its intellectual property 17 1.21 christos * rights. You may have additional license terms from the party that provided 18 1.21 christos * you this software, covering your right to use that party's intellectual 19 1.21 christos * property rights. 20 1.21 christos * 21 1.21 christos * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 22 1.21 christos * copy of the source code appearing in this file ("Covered Code") an 23 1.21 christos * irrevocable, perpetual, worldwide license under Intel's copyrights in the 24 1.21 christos * base code distributed originally by Intel ("Original Intel Code") to copy, 25 1.21 christos * make derivatives, distribute, use and display any portion of the Covered 26 1.21 christos * Code in any form, with the right to sublicense such rights; and 27 1.21 christos * 28 1.21 christos * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 29 1.21 christos * license (with the right to sublicense), under only those claims of Intel 30 1.21 christos * patents that are infringed by the Original Intel Code, to make, use, sell, 31 1.21 christos * offer to sell, and import the Covered Code and derivative works thereof 32 1.21 christos * solely to the minimum extent necessary to exercise the above copyright 33 1.21 christos * license, and in no event shall the patent license extend to any additions 34 1.21 christos * to or modifications of the Original Intel Code. No other license or right 35 1.21 christos * is granted directly or by implication, estoppel or otherwise; 36 1.21 christos * 37 1.21 christos * The above copyright and patent license is granted only if the following 38 1.21 christos * conditions are met: 39 1.21 christos * 40 1.21 christos * 3. Conditions 41 1.21 christos * 42 1.21 christos * 3.1. Redistribution of Source with Rights to Further Distribute Source. 43 1.21 christos * Redistribution of source code of any substantial portion of the Covered 44 1.21 christos * Code or modification with rights to further distribute source must include 45 1.21 christos * the above Copyright Notice, the above License, this list of Conditions, 46 1.21 christos * and the following Disclaimer and Export Compliance provision. In addition, 47 1.21 christos * Licensee must cause all Covered Code to which Licensee contributes to 48 1.21 christos * contain a file documenting the changes Licensee made to create that Covered 49 1.21 christos * Code and the date of any change. Licensee must include in that file the 50 1.21 christos * documentation of any changes made by any predecessor Licensee. Licensee 51 1.21 christos * must include a prominent statement that the modification is derived, 52 1.21 christos * directly or indirectly, from Original Intel Code. 53 1.21 christos * 54 1.21 christos * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 55 1.21 christos * Redistribution of source code of any substantial portion of the Covered 56 1.21 christos * Code or modification without rights to further distribute source must 57 1.21 christos * include the following Disclaimer and Export Compliance provision in the 58 1.21 christos * documentation and/or other materials provided with distribution. In 59 1.21 christos * addition, Licensee may not authorize further sublicense of source of any 60 1.21 christos * portion of the Covered Code, and must include terms to the effect that the 61 1.21 christos * license from Licensee to its licensee is limited to the intellectual 62 1.21 christos * property embodied in the software Licensee provides to its licensee, and 63 1.21 christos * not to intellectual property embodied in modifications its licensee may 64 1.21 christos * make. 65 1.21 christos * 66 1.21 christos * 3.3. Redistribution of Executable. Redistribution in executable form of any 67 1.21 christos * substantial portion of the Covered Code or modification must reproduce the 68 1.21 christos * above Copyright Notice, and the following Disclaimer and Export Compliance 69 1.21 christos * provision in the documentation and/or other materials provided with the 70 1.21 christos * distribution. 71 1.21 christos * 72 1.21 christos * 3.4. Intel retains all right, title, and interest in and to the Original 73 1.21 christos * Intel Code. 74 1.21 christos * 75 1.21 christos * 3.5. Neither the name Intel nor any other trademark owned or controlled by 76 1.21 christos * Intel shall be used in advertising or otherwise to promote the sale, use or 77 1.21 christos * other dealings in products derived from or relating to the Covered Code 78 1.21 christos * without prior written authorization from Intel. 79 1.21 christos * 80 1.21 christos * 4. Disclaimer and Export Compliance 81 1.21 christos * 82 1.21 christos * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 83 1.21 christos * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 84 1.21 christos * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 85 1.21 christos * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 86 1.21 christos * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 87 1.21 christos * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 88 1.21 christos * PARTICULAR PURPOSE. 89 1.21 christos * 90 1.21 christos * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 91 1.21 christos * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 92 1.21 christos * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 93 1.21 christos * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 94 1.21 christos * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 95 1.21 christos * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 96 1.21 christos * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 97 1.21 christos * LIMITED REMEDY. 98 1.21 christos * 99 1.21 christos * 4.3. Licensee shall not export, either directly or indirectly, any of this 100 1.21 christos * software or system incorporating such software without first obtaining any 101 1.21 christos * required license or other approval from the U. S. Department of Commerce or 102 1.21 christos * any other agency or department of the United States Government. In the 103 1.21 christos * event Licensee exports any such software from the United States or 104 1.21 christos * re-exports any such software from a foreign destination, Licensee shall 105 1.21 christos * ensure that the distribution and export/re-export of the software is in 106 1.21 christos * compliance with all laws, regulations, orders, or other restrictions of the 107 1.21 christos * U.S. Export Administration Regulations. Licensee agrees that neither it nor 108 1.21 christos * any of its subsidiaries will export/re-export any technical data, process, 109 1.21 christos * software, or service, directly or indirectly, to any country for which the 110 1.21 christos * United States government or any agency thereof requires an export license, 111 1.21 christos * other governmental approval, or letter of assurance, without first obtaining 112 1.21 christos * such license, approval or letter. 113 1.21 christos * 114 1.21 christos ***************************************************************************** 115 1.21 christos * 116 1.21 christos * Alternatively, you may choose to be licensed under the terms of the 117 1.21 christos * following license: 118 1.21 christos * 119 1.1 jruoho * Redistribution and use in source and binary forms, with or without 120 1.1 jruoho * modification, are permitted provided that the following conditions 121 1.1 jruoho * are met: 122 1.1 jruoho * 1. Redistributions of source code must retain the above copyright 123 1.1 jruoho * notice, this list of conditions, and the following disclaimer, 124 1.1 jruoho * without modification. 125 1.1 jruoho * 2. Redistributions in binary form must reproduce at minimum a disclaimer 126 1.1 jruoho * substantially similar to the "NO WARRANTY" disclaimer below 127 1.1 jruoho * ("Disclaimer") and any redistribution must be conditioned upon 128 1.1 jruoho * including a substantially similar Disclaimer requirement for further 129 1.1 jruoho * binary redistribution. 130 1.1 jruoho * 3. Neither the names of the above-listed copyright holders nor the names 131 1.1 jruoho * of any contributors may be used to endorse or promote products derived 132 1.1 jruoho * from this software without specific prior written permission. 133 1.1 jruoho * 134 1.1 jruoho * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 135 1.1 jruoho * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 136 1.18 christos * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 137 1.1 jruoho * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 138 1.21 christos * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 139 1.21 christos * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 140 1.21 christos * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 141 1.21 christos * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 142 1.21 christos * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 143 1.21 christos * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 144 1.21 christos * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 145 1.21 christos * 146 1.21 christos * Alternatively, you may choose to be licensed under the terms of the 147 1.21 christos * GNU General Public License ("GPL") version 2 as published by the Free 148 1.21 christos * Software Foundation. 149 1.21 christos * 150 1.21 christos *****************************************************************************/ 151 1.1 jruoho 152 1.1 jruoho #include "acpi.h" 153 1.1 jruoho #include "accommon.h" 154 1.1 jruoho #include "acnamesp.h" 155 1.11 christos #include "amlcode.h" 156 1.1 jruoho 157 1.1 jruoho #define _COMPONENT ACPI_UTILITIES 158 1.1 jruoho ACPI_MODULE_NAME ("utdecode") 159 1.1 jruoho 160 1.1 jruoho 161 1.1 jruoho /* 162 1.1 jruoho * Properties of the ACPI Object Types, both internal and external. 163 1.1 jruoho * The table is indexed by values of ACPI_OBJECT_TYPE 164 1.1 jruoho */ 165 1.1 jruoho const UINT8 AcpiGbl_NsProperties[ACPI_NUM_NS_TYPES] = 166 1.1 jruoho { 167 1.1 jruoho ACPI_NS_NORMAL, /* 00 Any */ 168 1.1 jruoho ACPI_NS_NORMAL, /* 01 Number */ 169 1.1 jruoho ACPI_NS_NORMAL, /* 02 String */ 170 1.1 jruoho ACPI_NS_NORMAL, /* 03 Buffer */ 171 1.1 jruoho ACPI_NS_NORMAL, /* 04 Package */ 172 1.1 jruoho ACPI_NS_NORMAL, /* 05 FieldUnit */ 173 1.1 jruoho ACPI_NS_NEWSCOPE, /* 06 Device */ 174 1.1 jruoho ACPI_NS_NORMAL, /* 07 Event */ 175 1.1 jruoho ACPI_NS_NEWSCOPE, /* 08 Method */ 176 1.1 jruoho ACPI_NS_NORMAL, /* 09 Mutex */ 177 1.1 jruoho ACPI_NS_NORMAL, /* 10 Region */ 178 1.1 jruoho ACPI_NS_NEWSCOPE, /* 11 Power */ 179 1.1 jruoho ACPI_NS_NEWSCOPE, /* 12 Processor */ 180 1.1 jruoho ACPI_NS_NEWSCOPE, /* 13 Thermal */ 181 1.1 jruoho ACPI_NS_NORMAL, /* 14 BufferField */ 182 1.1 jruoho ACPI_NS_NORMAL, /* 15 DdbHandle */ 183 1.1 jruoho ACPI_NS_NORMAL, /* 16 Debug Object */ 184 1.1 jruoho ACPI_NS_NORMAL, /* 17 DefField */ 185 1.1 jruoho ACPI_NS_NORMAL, /* 18 BankField */ 186 1.1 jruoho ACPI_NS_NORMAL, /* 19 IndexField */ 187 1.1 jruoho ACPI_NS_NORMAL, /* 20 Reference */ 188 1.1 jruoho ACPI_NS_NORMAL, /* 21 Alias */ 189 1.1 jruoho ACPI_NS_NORMAL, /* 22 MethodAlias */ 190 1.1 jruoho ACPI_NS_NORMAL, /* 23 Notify */ 191 1.1 jruoho ACPI_NS_NORMAL, /* 24 Address Handler */ 192 1.1 jruoho ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 25 Resource Desc */ 193 1.1 jruoho ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 26 Resource Field */ 194 1.1 jruoho ACPI_NS_NEWSCOPE, /* 27 Scope */ 195 1.1 jruoho ACPI_NS_NORMAL, /* 28 Extra */ 196 1.1 jruoho ACPI_NS_NORMAL, /* 29 Data */ 197 1.1 jruoho ACPI_NS_NORMAL /* 30 Invalid */ 198 1.1 jruoho }; 199 1.1 jruoho 200 1.1 jruoho 201 1.1 jruoho /******************************************************************************* 202 1.1 jruoho * 203 1.1 jruoho * FUNCTION: AcpiUtGetRegionName 204 1.1 jruoho * 205 1.1 jruoho * PARAMETERS: Space ID - ID for the region 206 1.1 jruoho * 207 1.1 jruoho * RETURN: Decoded region SpaceId name 208 1.1 jruoho * 209 1.1 jruoho * DESCRIPTION: Translate a Space ID into a name string (Debug only) 210 1.1 jruoho * 211 1.1 jruoho ******************************************************************************/ 212 1.1 jruoho 213 1.1 jruoho /* Region type decoding */ 214 1.1 jruoho 215 1.1 jruoho const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] = 216 1.1 jruoho { 217 1.17 christos "SystemMemory", /* 0x00 */ 218 1.17 christos "SystemIO", /* 0x01 */ 219 1.17 christos "PCI_Config", /* 0x02 */ 220 1.17 christos "EmbeddedControl", /* 0x03 */ 221 1.17 christos "SMBus", /* 0x04 */ 222 1.17 christos "SystemCMOS", /* 0x05 */ 223 1.17 christos "PCIBARTarget", /* 0x06 */ 224 1.17 christos "IPMI", /* 0x07 */ 225 1.17 christos "GeneralPurposeIo", /* 0x08 */ 226 1.17 christos "GenericSerialBus", /* 0x09 */ 227 1.17 christos "PCC", /* 0x0A */ 228 1.17 christos "PlatformRtMechanism" /* 0x0B */ 229 1.1 jruoho }; 230 1.1 jruoho 231 1.1 jruoho 232 1.2 jruoho const char * 233 1.1 jruoho AcpiUtGetRegionName ( 234 1.1 jruoho UINT8 SpaceId) 235 1.1 jruoho { 236 1.1 jruoho 237 1.1 jruoho if (SpaceId >= ACPI_USER_REGION_BEGIN) 238 1.1 jruoho { 239 1.1 jruoho return ("UserDefinedRegion"); 240 1.1 jruoho } 241 1.4 jruoho else if (SpaceId == ACPI_ADR_SPACE_DATA_TABLE) 242 1.4 jruoho { 243 1.4 jruoho return ("DataTable"); 244 1.4 jruoho } 245 1.1 jruoho else if (SpaceId == ACPI_ADR_SPACE_FIXED_HARDWARE) 246 1.1 jruoho { 247 1.1 jruoho return ("FunctionalFixedHW"); 248 1.1 jruoho } 249 1.1 jruoho else if (SpaceId >= ACPI_NUM_PREDEFINED_REGIONS) 250 1.1 jruoho { 251 1.1 jruoho return ("InvalidSpaceId"); 252 1.1 jruoho } 253 1.1 jruoho 254 1.8 christos return (AcpiGbl_RegionTypes[SpaceId]); 255 1.1 jruoho } 256 1.1 jruoho 257 1.1 jruoho 258 1.1 jruoho /******************************************************************************* 259 1.1 jruoho * 260 1.1 jruoho * FUNCTION: AcpiUtGetEventName 261 1.1 jruoho * 262 1.1 jruoho * PARAMETERS: EventId - Fixed event ID 263 1.1 jruoho * 264 1.1 jruoho * RETURN: Decoded event ID name 265 1.1 jruoho * 266 1.1 jruoho * DESCRIPTION: Translate a Event ID into a name string (Debug only) 267 1.1 jruoho * 268 1.1 jruoho ******************************************************************************/ 269 1.1 jruoho 270 1.1 jruoho /* Event type decoding */ 271 1.1 jruoho 272 1.1 jruoho static const char *AcpiGbl_EventTypes[ACPI_NUM_FIXED_EVENTS] = 273 1.1 jruoho { 274 1.1 jruoho "PM_Timer", 275 1.1 jruoho "GlobalLock", 276 1.1 jruoho "PowerButton", 277 1.1 jruoho "SleepButton", 278 1.1 jruoho "RealTimeClock", 279 1.1 jruoho }; 280 1.1 jruoho 281 1.1 jruoho 282 1.2 jruoho const char * 283 1.1 jruoho AcpiUtGetEventName ( 284 1.1 jruoho UINT32 EventId) 285 1.1 jruoho { 286 1.1 jruoho 287 1.1 jruoho if (EventId > ACPI_EVENT_MAX) 288 1.1 jruoho { 289 1.1 jruoho return ("InvalidEventID"); 290 1.1 jruoho } 291 1.1 jruoho 292 1.8 christos return (AcpiGbl_EventTypes[EventId]); 293 1.1 jruoho } 294 1.1 jruoho 295 1.1 jruoho 296 1.1 jruoho /******************************************************************************* 297 1.1 jruoho * 298 1.1 jruoho * FUNCTION: AcpiUtGetTypeName 299 1.1 jruoho * 300 1.1 jruoho * PARAMETERS: Type - An ACPI object type 301 1.1 jruoho * 302 1.1 jruoho * RETURN: Decoded ACPI object type name 303 1.1 jruoho * 304 1.1 jruoho * DESCRIPTION: Translate a Type ID into a name string (Debug only) 305 1.1 jruoho * 306 1.1 jruoho ******************************************************************************/ 307 1.1 jruoho 308 1.1 jruoho /* 309 1.1 jruoho * Elements of AcpiGbl_NsTypeNames below must match 310 1.1 jruoho * one-to-one with values of ACPI_OBJECT_TYPE 311 1.1 jruoho * 312 1.1 jruoho * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; 313 1.1 jruoho * when stored in a table it really means that we have thus far seen no 314 1.8 christos * evidence to indicate what type is actually going to be stored for this 315 1.8 christos & entry. 316 1.1 jruoho */ 317 1.1 jruoho static const char AcpiGbl_BadType[] = "UNDEFINED"; 318 1.1 jruoho 319 1.1 jruoho /* Printable names of the ACPI object types */ 320 1.1 jruoho 321 1.1 jruoho static const char *AcpiGbl_NsTypeNames[] = 322 1.1 jruoho { 323 1.1 jruoho /* 00 */ "Untyped", 324 1.1 jruoho /* 01 */ "Integer", 325 1.1 jruoho /* 02 */ "String", 326 1.1 jruoho /* 03 */ "Buffer", 327 1.1 jruoho /* 04 */ "Package", 328 1.1 jruoho /* 05 */ "FieldUnit", 329 1.1 jruoho /* 06 */ "Device", 330 1.1 jruoho /* 07 */ "Event", 331 1.1 jruoho /* 08 */ "Method", 332 1.1 jruoho /* 09 */ "Mutex", 333 1.1 jruoho /* 10 */ "Region", 334 1.1 jruoho /* 11 */ "Power", 335 1.1 jruoho /* 12 */ "Processor", 336 1.1 jruoho /* 13 */ "Thermal", 337 1.1 jruoho /* 14 */ "BufferField", 338 1.1 jruoho /* 15 */ "DdbHandle", 339 1.1 jruoho /* 16 */ "DebugObject", 340 1.1 jruoho /* 17 */ "RegionField", 341 1.1 jruoho /* 18 */ "BankField", 342 1.1 jruoho /* 19 */ "IndexField", 343 1.1 jruoho /* 20 */ "Reference", 344 1.1 jruoho /* 21 */ "Alias", 345 1.1 jruoho /* 22 */ "MethodAlias", 346 1.1 jruoho /* 23 */ "Notify", 347 1.1 jruoho /* 24 */ "AddrHandler", 348 1.1 jruoho /* 25 */ "ResourceDesc", 349 1.1 jruoho /* 26 */ "ResourceFld", 350 1.1 jruoho /* 27 */ "Scope", 351 1.1 jruoho /* 28 */ "Extra", 352 1.1 jruoho /* 29 */ "Data", 353 1.1 jruoho /* 30 */ "Invalid" 354 1.1 jruoho }; 355 1.1 jruoho 356 1.1 jruoho 357 1.8 christos const char * 358 1.1 jruoho AcpiUtGetTypeName ( 359 1.1 jruoho ACPI_OBJECT_TYPE Type) 360 1.1 jruoho { 361 1.1 jruoho 362 1.1 jruoho if (Type > ACPI_TYPE_INVALID) 363 1.1 jruoho { 364 1.8 christos return (AcpiGbl_BadType); 365 1.1 jruoho } 366 1.1 jruoho 367 1.8 christos return (AcpiGbl_NsTypeNames[Type]); 368 1.1 jruoho } 369 1.1 jruoho 370 1.1 jruoho 371 1.2 jruoho const char * 372 1.1 jruoho AcpiUtGetObjectTypeName ( 373 1.1 jruoho ACPI_OPERAND_OBJECT *ObjDesc) 374 1.1 jruoho { 375 1.8 christos ACPI_FUNCTION_TRACE (UtGetObjectTypeName); 376 1.8 christos 377 1.1 jruoho 378 1.1 jruoho if (!ObjDesc) 379 1.1 jruoho { 380 1.8 christos ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n")); 381 1.11 christos return_STR ("[NULL Object Descriptor]"); 382 1.8 christos } 383 1.8 christos 384 1.8 christos /* These descriptor types share a common area */ 385 1.8 christos 386 1.8 christos if ((ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) && 387 1.8 christos (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_NAMED)) 388 1.8 christos { 389 1.8 christos ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 390 1.8 christos "Invalid object descriptor type: 0x%2.2X [%s] (%p)\n", 391 1.8 christos ACPI_GET_DESCRIPTOR_TYPE (ObjDesc), 392 1.8 christos AcpiUtGetDescriptorName (ObjDesc), ObjDesc)); 393 1.8 christos 394 1.11 christos return_STR ("Invalid object"); 395 1.1 jruoho } 396 1.1 jruoho 397 1.10 christos return_STR (AcpiUtGetTypeName (ObjDesc->Common.Type)); 398 1.1 jruoho } 399 1.1 jruoho 400 1.1 jruoho 401 1.1 jruoho /******************************************************************************* 402 1.1 jruoho * 403 1.1 jruoho * FUNCTION: AcpiUtGetNodeName 404 1.1 jruoho * 405 1.1 jruoho * PARAMETERS: Object - A namespace node 406 1.1 jruoho * 407 1.1 jruoho * RETURN: ASCII name of the node 408 1.1 jruoho * 409 1.1 jruoho * DESCRIPTION: Validate the node and return the node's ACPI name. 410 1.1 jruoho * 411 1.1 jruoho ******************************************************************************/ 412 1.1 jruoho 413 1.2 jruoho const char * 414 1.1 jruoho AcpiUtGetNodeName ( 415 1.1 jruoho void *Object) 416 1.1 jruoho { 417 1.1 jruoho ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) Object; 418 1.1 jruoho 419 1.1 jruoho 420 1.15 christos /* Must return a string of exactly 4 characters == ACPI_NAMESEG_SIZE */ 421 1.1 jruoho 422 1.1 jruoho if (!Object) 423 1.1 jruoho { 424 1.1 jruoho return ("NULL"); 425 1.1 jruoho } 426 1.1 jruoho 427 1.1 jruoho /* Check for Root node */ 428 1.1 jruoho 429 1.1 jruoho if ((Object == ACPI_ROOT_OBJECT) || 430 1.1 jruoho (Object == AcpiGbl_RootNode)) 431 1.1 jruoho { 432 1.1 jruoho return ("\"\\\" "); 433 1.1 jruoho } 434 1.1 jruoho 435 1.1 jruoho /* Descriptor must be a namespace node */ 436 1.1 jruoho 437 1.1 jruoho if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) 438 1.1 jruoho { 439 1.1 jruoho return ("####"); 440 1.1 jruoho } 441 1.1 jruoho 442 1.1 jruoho /* 443 1.1 jruoho * Ensure name is valid. The name was validated/repaired when the node 444 1.1 jruoho * was created, but make sure it has not been corrupted. 445 1.1 jruoho */ 446 1.1 jruoho AcpiUtRepairName (Node->Name.Ascii); 447 1.1 jruoho 448 1.1 jruoho /* Return the name */ 449 1.1 jruoho 450 1.1 jruoho return (Node->Name.Ascii); 451 1.1 jruoho } 452 1.1 jruoho 453 1.1 jruoho 454 1.1 jruoho /******************************************************************************* 455 1.1 jruoho * 456 1.1 jruoho * FUNCTION: AcpiUtGetDescriptorName 457 1.1 jruoho * 458 1.1 jruoho * PARAMETERS: Object - An ACPI object 459 1.1 jruoho * 460 1.1 jruoho * RETURN: Decoded name of the descriptor type 461 1.1 jruoho * 462 1.1 jruoho * DESCRIPTION: Validate object and return the descriptor type 463 1.1 jruoho * 464 1.1 jruoho ******************************************************************************/ 465 1.1 jruoho 466 1.1 jruoho /* Printable names of object descriptor types */ 467 1.1 jruoho 468 1.1 jruoho static const char *AcpiGbl_DescTypeNames[] = 469 1.1 jruoho { 470 1.1 jruoho /* 00 */ "Not a Descriptor", 471 1.15 christos /* 01 */ "Cached Object", 472 1.1 jruoho /* 02 */ "State-Generic", 473 1.1 jruoho /* 03 */ "State-Update", 474 1.1 jruoho /* 04 */ "State-Package", 475 1.1 jruoho /* 05 */ "State-Control", 476 1.1 jruoho /* 06 */ "State-RootParseScope", 477 1.1 jruoho /* 07 */ "State-ParseScope", 478 1.1 jruoho /* 08 */ "State-WalkScope", 479 1.1 jruoho /* 09 */ "State-Result", 480 1.1 jruoho /* 10 */ "State-Notify", 481 1.1 jruoho /* 11 */ "State-Thread", 482 1.15 christos /* 12 */ "Tree Walk State", 483 1.15 christos /* 13 */ "Parse Tree Op", 484 1.15 christos /* 14 */ "Operand Object", 485 1.15 christos /* 15 */ "Namespace Node" 486 1.1 jruoho }; 487 1.1 jruoho 488 1.1 jruoho 489 1.2 jruoho const char * 490 1.1 jruoho AcpiUtGetDescriptorName ( 491 1.1 jruoho void *Object) 492 1.1 jruoho { 493 1.1 jruoho 494 1.1 jruoho if (!Object) 495 1.1 jruoho { 496 1.1 jruoho return ("NULL OBJECT"); 497 1.1 jruoho } 498 1.1 jruoho 499 1.1 jruoho if (ACPI_GET_DESCRIPTOR_TYPE (Object) > ACPI_DESC_TYPE_MAX) 500 1.1 jruoho { 501 1.1 jruoho return ("Not a Descriptor"); 502 1.1 jruoho } 503 1.1 jruoho 504 1.8 christos return (AcpiGbl_DescTypeNames[ACPI_GET_DESCRIPTOR_TYPE (Object)]); 505 1.1 jruoho } 506 1.1 jruoho 507 1.1 jruoho 508 1.1 jruoho /******************************************************************************* 509 1.1 jruoho * 510 1.1 jruoho * FUNCTION: AcpiUtGetReferenceName 511 1.1 jruoho * 512 1.1 jruoho * PARAMETERS: Object - An ACPI reference object 513 1.1 jruoho * 514 1.1 jruoho * RETURN: Decoded name of the type of reference 515 1.1 jruoho * 516 1.1 jruoho * DESCRIPTION: Decode a reference object sub-type to a string. 517 1.1 jruoho * 518 1.1 jruoho ******************************************************************************/ 519 1.1 jruoho 520 1.1 jruoho /* Printable names of reference object sub-types */ 521 1.1 jruoho 522 1.1 jruoho static const char *AcpiGbl_RefClassNames[] = 523 1.1 jruoho { 524 1.1 jruoho /* 00 */ "Local", 525 1.1 jruoho /* 01 */ "Argument", 526 1.1 jruoho /* 02 */ "RefOf", 527 1.1 jruoho /* 03 */ "Index", 528 1.1 jruoho /* 04 */ "DdbHandle", 529 1.1 jruoho /* 05 */ "Named Object", 530 1.1 jruoho /* 06 */ "Debug" 531 1.1 jruoho }; 532 1.1 jruoho 533 1.1 jruoho const char * 534 1.1 jruoho AcpiUtGetReferenceName ( 535 1.1 jruoho ACPI_OPERAND_OBJECT *Object) 536 1.1 jruoho { 537 1.1 jruoho 538 1.1 jruoho if (!Object) 539 1.1 jruoho { 540 1.1 jruoho return ("NULL Object"); 541 1.1 jruoho } 542 1.1 jruoho 543 1.1 jruoho if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND) 544 1.1 jruoho { 545 1.1 jruoho return ("Not an Operand object"); 546 1.1 jruoho } 547 1.1 jruoho 548 1.1 jruoho if (Object->Common.Type != ACPI_TYPE_LOCAL_REFERENCE) 549 1.1 jruoho { 550 1.1 jruoho return ("Not a Reference object"); 551 1.1 jruoho } 552 1.1 jruoho 553 1.1 jruoho if (Object->Reference.Class > ACPI_REFCLASS_MAX) 554 1.1 jruoho { 555 1.1 jruoho return ("Unknown Reference class"); 556 1.1 jruoho } 557 1.1 jruoho 558 1.1 jruoho return (AcpiGbl_RefClassNames[Object->Reference.Class]); 559 1.1 jruoho } 560 1.1 jruoho 561 1.1 jruoho 562 1.1 jruoho /******************************************************************************* 563 1.1 jruoho * 564 1.1 jruoho * FUNCTION: AcpiUtGetMutexName 565 1.1 jruoho * 566 1.1 jruoho * PARAMETERS: MutexId - The predefined ID for this mutex. 567 1.1 jruoho * 568 1.1 jruoho * RETURN: Decoded name of the internal mutex 569 1.1 jruoho * 570 1.1 jruoho * DESCRIPTION: Translate a mutex ID into a name string (Debug only) 571 1.1 jruoho * 572 1.1 jruoho ******************************************************************************/ 573 1.1 jruoho 574 1.1 jruoho /* Names for internal mutex objects, used for debug output */ 575 1.1 jruoho 576 1.8 christos static const char *AcpiGbl_MutexNames[ACPI_NUM_MUTEX] = 577 1.1 jruoho { 578 1.1 jruoho "ACPI_MTX_Interpreter", 579 1.1 jruoho "ACPI_MTX_Namespace", 580 1.1 jruoho "ACPI_MTX_Tables", 581 1.1 jruoho "ACPI_MTX_Events", 582 1.1 jruoho "ACPI_MTX_Caches", 583 1.1 jruoho "ACPI_MTX_Memory", 584 1.1 jruoho }; 585 1.1 jruoho 586 1.2 jruoho const char * 587 1.1 jruoho AcpiUtGetMutexName ( 588 1.1 jruoho UINT32 MutexId) 589 1.1 jruoho { 590 1.1 jruoho 591 1.1 jruoho if (MutexId > ACPI_MAX_MUTEX) 592 1.1 jruoho { 593 1.1 jruoho return ("Invalid Mutex ID"); 594 1.1 jruoho } 595 1.1 jruoho 596 1.1 jruoho return (AcpiGbl_MutexNames[MutexId]); 597 1.1 jruoho } 598 1.1 jruoho 599 1.1 jruoho 600 1.13 christos #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 601 1.13 christos 602 1.13 christos /* 603 1.13 christos * Strings and procedures used for debug only 604 1.13 christos */ 605 1.13 christos 606 1.1 jruoho /******************************************************************************* 607 1.1 jruoho * 608 1.1 jruoho * FUNCTION: AcpiUtGetNotifyName 609 1.1 jruoho * 610 1.1 jruoho * PARAMETERS: NotifyValue - Value from the Notify() request 611 1.1 jruoho * 612 1.1 jruoho * RETURN: Decoded name for the notify value 613 1.1 jruoho * 614 1.1 jruoho * DESCRIPTION: Translate a Notify Value to a notify namestring. 615 1.1 jruoho * 616 1.1 jruoho ******************************************************************************/ 617 1.1 jruoho 618 1.1 jruoho /* Names for Notify() values, used for debug output */ 619 1.1 jruoho 620 1.9 christos static const char *AcpiGbl_GenericNotify[ACPI_GENERIC_NOTIFY_MAX + 1] = 621 1.1 jruoho { 622 1.5 christos /* 00 */ "Bus Check", 623 1.5 christos /* 01 */ "Device Check", 624 1.5 christos /* 02 */ "Device Wake", 625 1.5 christos /* 03 */ "Eject Request", 626 1.5 christos /* 04 */ "Device Check Light", 627 1.5 christos /* 05 */ "Frequency Mismatch", 628 1.5 christos /* 06 */ "Bus Mode Mismatch", 629 1.5 christos /* 07 */ "Power Fault", 630 1.5 christos /* 08 */ "Capabilities Check", 631 1.5 christos /* 09 */ "Device PLD Check", 632 1.6 christos /* 0A */ "Reserved", 633 1.6 christos /* 0B */ "System Locality Update", 634 1.12 christos /* 0C */ "Reserved (was previously Shutdown Request)", /* Reserved in ACPI 6.0 */ 635 1.12 christos /* 0D */ "System Resource Affinity Update", 636 1.15 christos /* 0E */ "Heterogeneous Memory Attributes Update", /* ACPI 6.2 */ 637 1.15 christos /* 0F */ "Error Disconnect Recover" /* ACPI 6.3 */ 638 1.6 christos }; 639 1.6 christos 640 1.9 christos static const char *AcpiGbl_DeviceNotify[5] = 641 1.6 christos { 642 1.6 christos /* 80 */ "Status Change", 643 1.6 christos /* 81 */ "Information Change", 644 1.6 christos /* 82 */ "Device-Specific Change", 645 1.9 christos /* 83 */ "Device-Specific Change", 646 1.9 christos /* 84 */ "Reserved" 647 1.1 jruoho }; 648 1.1 jruoho 649 1.9 christos static const char *AcpiGbl_ProcessorNotify[5] = 650 1.6 christos { 651 1.6 christos /* 80 */ "Performance Capability Change", 652 1.6 christos /* 81 */ "C-State Change", 653 1.6 christos /* 82 */ "Throttling Capability Change", 654 1.9 christos /* 83 */ "Guaranteed Change", 655 1.9 christos /* 84 */ "Minimum Excursion" 656 1.6 christos }; 657 1.6 christos 658 1.9 christos static const char *AcpiGbl_ThermalNotify[5] = 659 1.6 christos { 660 1.6 christos /* 80 */ "Thermal Status Change", 661 1.6 christos /* 81 */ "Thermal Trip Point Change", 662 1.6 christos /* 82 */ "Thermal Device List Change", 663 1.9 christos /* 83 */ "Thermal Relationship Change", 664 1.9 christos /* 84 */ "Reserved" 665 1.6 christos }; 666 1.6 christos 667 1.6 christos 668 1.1 jruoho const char * 669 1.1 jruoho AcpiUtGetNotifyName ( 670 1.6 christos UINT32 NotifyValue, 671 1.6 christos ACPI_OBJECT_TYPE Type) 672 1.1 jruoho { 673 1.1 jruoho 674 1.15 christos /* 00 - 0F are "common to all object types" (from ACPI Spec) */ 675 1.6 christos 676 1.9 christos if (NotifyValue <= ACPI_GENERIC_NOTIFY_MAX) 677 1.1 jruoho { 678 1.6 christos return (AcpiGbl_GenericNotify[NotifyValue]); 679 1.1 jruoho } 680 1.6 christos 681 1.15 christos /* 10 - 7F are reserved */ 682 1.6 christos 683 1.6 christos if (NotifyValue <= ACPI_MAX_SYS_NOTIFY) 684 1.1 jruoho { 685 1.1 jruoho return ("Reserved"); 686 1.1 jruoho } 687 1.6 christos 688 1.9 christos /* 80 - 84 are per-object-type */ 689 1.6 christos 690 1.9 christos if (NotifyValue <= ACPI_SPECIFIC_NOTIFY_MAX) 691 1.5 christos { 692 1.6 christos switch (Type) 693 1.6 christos { 694 1.6 christos case ACPI_TYPE_ANY: 695 1.6 christos case ACPI_TYPE_DEVICE: 696 1.6 christos return (AcpiGbl_DeviceNotify [NotifyValue - 0x80]); 697 1.6 christos 698 1.6 christos case ACPI_TYPE_PROCESSOR: 699 1.6 christos return (AcpiGbl_ProcessorNotify [NotifyValue - 0x80]); 700 1.6 christos 701 1.6 christos case ACPI_TYPE_THERMAL: 702 1.6 christos return (AcpiGbl_ThermalNotify [NotifyValue - 0x80]); 703 1.6 christos 704 1.6 christos default: 705 1.6 christos return ("Target object type does not support notifies"); 706 1.6 christos } 707 1.5 christos } 708 1.6 christos 709 1.6 christos /* 84 - BF are device-specific */ 710 1.6 christos 711 1.6 christos if (NotifyValue <= ACPI_MAX_DEVICE_SPECIFIC_NOTIFY) 712 1.1 jruoho { 713 1.6 christos return ("Device-Specific"); 714 1.1 jruoho } 715 1.6 christos 716 1.6 christos /* C0 and above are hardware-specific */ 717 1.6 christos 718 1.6 christos return ("Hardware-Specific"); 719 1.1 jruoho } 720 1.11 christos 721 1.11 christos 722 1.11 christos /******************************************************************************* 723 1.11 christos * 724 1.11 christos * FUNCTION: AcpiUtGetArgumentTypeName 725 1.11 christos * 726 1.11 christos * PARAMETERS: ArgType - an ARGP_* parser argument type 727 1.11 christos * 728 1.11 christos * RETURN: Decoded ARGP_* type 729 1.11 christos * 730 1.11 christos * DESCRIPTION: Decode an ARGP_* parser type, as defined in the amlcode.h file, 731 1.11 christos * and used in the acopcode.h file. For example, ARGP_TERMARG. 732 1.11 christos * Used for debug only. 733 1.11 christos * 734 1.11 christos ******************************************************************************/ 735 1.11 christos 736 1.11 christos static const char *AcpiGbl_ArgumentType[20] = 737 1.11 christos { 738 1.11 christos /* 00 */ "Unknown ARGP", 739 1.11 christos /* 01 */ "ByteData", 740 1.11 christos /* 02 */ "ByteList", 741 1.11 christos /* 03 */ "CharList", 742 1.11 christos /* 04 */ "DataObject", 743 1.11 christos /* 05 */ "DataObjectList", 744 1.11 christos /* 06 */ "DWordData", 745 1.11 christos /* 07 */ "FieldList", 746 1.11 christos /* 08 */ "Name", 747 1.11 christos /* 09 */ "NameString", 748 1.11 christos /* 0A */ "ObjectList", 749 1.11 christos /* 0B */ "PackageLength", 750 1.11 christos /* 0C */ "SuperName", 751 1.11 christos /* 0D */ "Target", 752 1.11 christos /* 0E */ "TermArg", 753 1.11 christos /* 0F */ "TermList", 754 1.11 christos /* 10 */ "WordData", 755 1.11 christos /* 11 */ "QWordData", 756 1.11 christos /* 12 */ "SimpleName", 757 1.11 christos /* 13 */ "NameOrRef" 758 1.11 christos }; 759 1.11 christos 760 1.11 christos const char * 761 1.11 christos AcpiUtGetArgumentTypeName ( 762 1.11 christos UINT32 ArgType) 763 1.11 christos { 764 1.11 christos 765 1.11 christos if (ArgType > ARGP_MAX) 766 1.11 christos { 767 1.11 christos return ("Unknown ARGP"); 768 1.11 christos } 769 1.11 christos 770 1.11 christos return (AcpiGbl_ArgumentType[ArgType]); 771 1.11 christos } 772 1.11 christos 773 1.1 jruoho #endif 774 1.1 jruoho 775 1.1 jruoho 776 1.1 jruoho /******************************************************************************* 777 1.1 jruoho * 778 1.1 jruoho * FUNCTION: AcpiUtValidObjectType 779 1.1 jruoho * 780 1.1 jruoho * PARAMETERS: Type - Object type to be validated 781 1.1 jruoho * 782 1.1 jruoho * RETURN: TRUE if valid object type, FALSE otherwise 783 1.1 jruoho * 784 1.1 jruoho * DESCRIPTION: Validate an object type 785 1.1 jruoho * 786 1.1 jruoho ******************************************************************************/ 787 1.1 jruoho 788 1.1 jruoho BOOLEAN 789 1.1 jruoho AcpiUtValidObjectType ( 790 1.1 jruoho ACPI_OBJECT_TYPE Type) 791 1.1 jruoho { 792 1.1 jruoho 793 1.1 jruoho if (Type > ACPI_TYPE_LOCAL_MAX) 794 1.1 jruoho { 795 1.1 jruoho /* Note: Assumes all TYPEs are contiguous (external/local) */ 796 1.1 jruoho 797 1.1 jruoho return (FALSE); 798 1.1 jruoho } 799 1.1 jruoho 800 1.1 jruoho return (TRUE); 801 1.1 jruoho } 802