1 /******************************************************************************
3 * Module Name: utdecode - Utility decoding routines (value-to-string)
5 *****************************************************************************/
7 /******************************************************************************
11 * Some or all of this work - Copyright (c) 1999 - 2015, Intel Corp.
12 * All rights reserved.
16 * 2.1. This is your license from Intel Corp. under its intellectual property
17 * rights. You may have additional license terms from the party that provided
18 * you this software, covering your right to use that party's intellectual
21 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22 * copy of the source code appearing in this file ("Covered Code") an
23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24 * base code distributed originally by Intel ("Original Intel Code") to copy,
25 * make derivatives, distribute, use and display any portion of the Covered
26 * Code in any form, with the right to sublicense such rights; and
28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29 * license (with the right to sublicense), under only those claims of Intel
30 * patents that are infringed by the Original Intel Code, to make, use, sell,
31 * offer to sell, and import the Covered Code and derivative works thereof
32 * solely to the minimum extent necessary to exercise the above copyright
33 * license, and in no event shall the patent license extend to any additions
34 * to or modifications of the Original Intel Code. No other license or right
35 * is granted directly or by implication, estoppel or otherwise;
37 * The above copyright and patent license is granted only if the following
42 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43 * Redistribution of source code of any substantial portion of the Covered
44 * Code or modification with rights to further distribute source must include
45 * the above Copyright Notice, the above License, this list of Conditions,
46 * and the following Disclaimer and Export Compliance provision. In addition,
47 * Licensee must cause all Covered Code to which Licensee contributes to
48 * contain a file documenting the changes Licensee made to create that Covered
49 * Code and the date of any change. Licensee must include in that file the
50 * documentation of any changes made by any predecessor Licensee. Licensee
51 * must include a prominent statement that the modification is derived,
52 * directly or indirectly, from Original Intel Code.
54 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55 * Redistribution of source code of any substantial portion of the Covered
56 * Code or modification without rights to further distribute source must
57 * include the following Disclaimer and Export Compliance provision in the
58 * documentation and/or other materials provided with distribution. In
59 * addition, Licensee may not authorize further sublicense of source of any
60 * portion of the Covered Code, and must include terms to the effect that the
61 * license from Licensee to its licensee is limited to the intellectual
62 * property embodied in the software Licensee provides to its licensee, and
63 * not to intellectual property embodied in modifications its licensee may
66 * 3.3. Redistribution of Executable. Redistribution in executable form of any
67 * substantial portion of the Covered Code or modification must reproduce the
68 * above Copyright Notice, and the following Disclaimer and Export Compliance
69 * provision in the documentation and/or other materials provided with the
72 * 3.4. Intel retains all right, title, and interest in and to the Original
75 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76 * Intel shall be used in advertising or otherwise to promote the sale, use or
77 * other dealings in products derived from or relating to the Covered Code
78 * without prior written authorization from Intel.
80 * 4. Disclaimer and Export Compliance
82 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
90 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
99 * 4.3. Licensee shall not export, either directly or indirectly, any of this
100 * software or system incorporating such software without first obtaining any
101 * required license or other approval from the U. S. Department of Commerce or
102 * any other agency or department of the United States Government. In the
103 * event Licensee exports any such software from the United States or
104 * re-exports any such software from a foreign destination, Licensee shall
105 * ensure that the distribution and export/re-export of the software is in
106 * compliance with all laws, regulations, orders, or other restrictions of the
107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108 * any of its subsidiaries will export/re-export any technical data, process,
109 * software, or service, directly or indirectly, to any country for which the
110 * United States government or any agency thereof requires an export license,
111 * other governmental approval, or letter of assurance, without first obtaining
112 * such license, approval or letter.
114 *****************************************************************************/
117 #include "accommon.h"
118 #include "acnamesp.h"
120 #define _COMPONENT ACPI_UTILITIES
121 ACPI_MODULE_NAME ("utdecode")
125 * Properties of the ACPI Object Types, both internal and external.
126 * The table is indexed by values of ACPI_OBJECT_TYPE
128 const UINT8 AcpiGbl_NsProperties
[ACPI_NUM_NS_TYPES
] =
130 ACPI_NS_NORMAL
, /* 00 Any */
131 ACPI_NS_NORMAL
, /* 01 Number */
132 ACPI_NS_NORMAL
, /* 02 String */
133 ACPI_NS_NORMAL
, /* 03 Buffer */
134 ACPI_NS_NORMAL
, /* 04 Package */
135 ACPI_NS_NORMAL
, /* 05 FieldUnit */
136 ACPI_NS_NEWSCOPE
, /* 06 Device */
137 ACPI_NS_NORMAL
, /* 07 Event */
138 ACPI_NS_NEWSCOPE
, /* 08 Method */
139 ACPI_NS_NORMAL
, /* 09 Mutex */
140 ACPI_NS_NORMAL
, /* 10 Region */
141 ACPI_NS_NEWSCOPE
, /* 11 Power */
142 ACPI_NS_NEWSCOPE
, /* 12 Processor */
143 ACPI_NS_NEWSCOPE
, /* 13 Thermal */
144 ACPI_NS_NORMAL
, /* 14 BufferField */
145 ACPI_NS_NORMAL
, /* 15 DdbHandle */
146 ACPI_NS_NORMAL
, /* 16 Debug Object */
147 ACPI_NS_NORMAL
, /* 17 DefField */
148 ACPI_NS_NORMAL
, /* 18 BankField */
149 ACPI_NS_NORMAL
, /* 19 IndexField */
150 ACPI_NS_NORMAL
, /* 20 Reference */
151 ACPI_NS_NORMAL
, /* 21 Alias */
152 ACPI_NS_NORMAL
, /* 22 MethodAlias */
153 ACPI_NS_NORMAL
, /* 23 Notify */
154 ACPI_NS_NORMAL
, /* 24 Address Handler */
155 ACPI_NS_NEWSCOPE
| ACPI_NS_LOCAL
, /* 25 Resource Desc */
156 ACPI_NS_NEWSCOPE
| ACPI_NS_LOCAL
, /* 26 Resource Field */
157 ACPI_NS_NEWSCOPE
, /* 27 Scope */
158 ACPI_NS_NORMAL
, /* 28 Extra */
159 ACPI_NS_NORMAL
, /* 29 Data */
160 ACPI_NS_NORMAL
/* 30 Invalid */
164 /*******************************************************************************
166 * FUNCTION: AcpiUtGetRegionName
168 * PARAMETERS: Space ID - ID for the region
170 * RETURN: Decoded region SpaceId name
172 * DESCRIPTION: Translate a Space ID into a name string (Debug only)
174 ******************************************************************************/
176 /* Region type decoding */
178 const char *AcpiGbl_RegionTypes
[ACPI_NUM_PREDEFINED_REGIONS
] =
180 "SystemMemory", /* 0x00 */
181 "SystemIO", /* 0x01 */
182 "PCI_Config", /* 0x02 */
183 "EmbeddedControl", /* 0x03 */
185 "SystemCMOS", /* 0x05 */
186 "PCIBARTarget", /* 0x06 */
188 "GeneralPurposeIo", /* 0x08 */
189 "GenericSerialBus", /* 0x09 */
195 AcpiUtGetRegionName (
199 if (SpaceId
>= ACPI_USER_REGION_BEGIN
)
201 return ("UserDefinedRegion");
203 else if (SpaceId
== ACPI_ADR_SPACE_DATA_TABLE
)
205 return ("DataTable");
207 else if (SpaceId
== ACPI_ADR_SPACE_FIXED_HARDWARE
)
209 return ("FunctionalFixedHW");
211 else if (SpaceId
>= ACPI_NUM_PREDEFINED_REGIONS
)
213 return ("InvalidSpaceId");
216 return (ACPI_CAST_PTR (char, AcpiGbl_RegionTypes
[SpaceId
]));
220 /*******************************************************************************
222 * FUNCTION: AcpiUtGetEventName
224 * PARAMETERS: EventId - Fixed event ID
226 * RETURN: Decoded event ID name
228 * DESCRIPTION: Translate a Event ID into a name string (Debug only)
230 ******************************************************************************/
232 /* Event type decoding */
234 static const char *AcpiGbl_EventTypes
[ACPI_NUM_FIXED_EVENTS
] =
249 if (EventId
> ACPI_EVENT_MAX
)
251 return ("InvalidEventID");
254 return (ACPI_CAST_PTR (char, AcpiGbl_EventTypes
[EventId
]));
258 /*******************************************************************************
260 * FUNCTION: AcpiUtGetTypeName
262 * PARAMETERS: Type - An ACPI object type
264 * RETURN: Decoded ACPI object type name
266 * DESCRIPTION: Translate a Type ID into a name string (Debug only)
268 ******************************************************************************/
271 * Elements of AcpiGbl_NsTypeNames below must match
272 * one-to-one with values of ACPI_OBJECT_TYPE
274 * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching;
275 * when stored in a table it really means that we have thus far seen no
276 * evidence to indicate what type is actually going to be stored for this entry.
278 static const char AcpiGbl_BadType
[] = "UNDEFINED";
280 /* Printable names of the ACPI object types */
282 static const char *AcpiGbl_NsTypeNames
[] =
289 /* 05 */ "FieldUnit",
296 /* 12 */ "Processor",
298 /* 14 */ "BufferField",
299 /* 15 */ "DdbHandle",
300 /* 16 */ "DebugObject",
301 /* 17 */ "RegionField",
302 /* 18 */ "BankField",
303 /* 19 */ "IndexField",
304 /* 20 */ "Reference",
306 /* 22 */ "MethodAlias",
308 /* 24 */ "AddrHandler",
309 /* 25 */ "ResourceDesc",
310 /* 26 */ "ResourceFld",
320 ACPI_OBJECT_TYPE Type
)
323 if (Type
> ACPI_TYPE_INVALID
)
325 return (ACPI_CAST_PTR (char, AcpiGbl_BadType
));
328 return (ACPI_CAST_PTR (char, AcpiGbl_NsTypeNames
[Type
]));
333 AcpiUtGetObjectTypeName (
334 ACPI_OPERAND_OBJECT
*ObjDesc
)
339 return ("[NULL Object Descriptor]");
342 return (AcpiUtGetTypeName (ObjDesc
->Common
.Type
));
346 /*******************************************************************************
348 * FUNCTION: AcpiUtGetNodeName
350 * PARAMETERS: Object - A namespace node
352 * RETURN: ASCII name of the node
354 * DESCRIPTION: Validate the node and return the node's ACPI name.
356 ******************************************************************************/
362 ACPI_NAMESPACE_NODE
*Node
= (ACPI_NAMESPACE_NODE
*) Object
;
365 /* Must return a string of exactly 4 characters == ACPI_NAME_SIZE */
372 /* Check for Root node */
374 if ((Object
== ACPI_ROOT_OBJECT
) ||
375 (Object
== AcpiGbl_RootNode
))
380 /* Descriptor must be a namespace node */
382 if (ACPI_GET_DESCRIPTOR_TYPE (Node
) != ACPI_DESC_TYPE_NAMED
)
388 * Ensure name is valid. The name was validated/repaired when the node
389 * was created, but make sure it has not been corrupted.
391 AcpiUtRepairName (Node
->Name
.Ascii
);
393 /* Return the name */
395 return (Node
->Name
.Ascii
);
399 /*******************************************************************************
401 * FUNCTION: AcpiUtGetDescriptorName
403 * PARAMETERS: Object - An ACPI object
405 * RETURN: Decoded name of the descriptor type
407 * DESCRIPTION: Validate object and return the descriptor type
409 ******************************************************************************/
411 /* Printable names of object descriptor types */
413 static const char *AcpiGbl_DescTypeNames
[] =
415 /* 00 */ "Not a Descriptor",
417 /* 02 */ "State-Generic",
418 /* 03 */ "State-Update",
419 /* 04 */ "State-Package",
420 /* 05 */ "State-Control",
421 /* 06 */ "State-RootParseScope",
422 /* 07 */ "State-ParseScope",
423 /* 08 */ "State-WalkScope",
424 /* 09 */ "State-Result",
425 /* 10 */ "State-Notify",
426 /* 11 */ "State-Thread",
435 AcpiUtGetDescriptorName (
441 return ("NULL OBJECT");
444 if (ACPI_GET_DESCRIPTOR_TYPE (Object
) > ACPI_DESC_TYPE_MAX
)
446 return ("Not a Descriptor");
449 return (ACPI_CAST_PTR (char,
450 AcpiGbl_DescTypeNames
[ACPI_GET_DESCRIPTOR_TYPE (Object
)]));
455 /*******************************************************************************
457 * FUNCTION: AcpiUtGetReferenceName
459 * PARAMETERS: Object - An ACPI reference object
461 * RETURN: Decoded name of the type of reference
463 * DESCRIPTION: Decode a reference object sub-type to a string.
465 ******************************************************************************/
467 /* Printable names of reference object sub-types */
469 static const char *AcpiGbl_RefClassNames
[] =
475 /* 04 */ "DdbHandle",
476 /* 05 */ "Named Object",
481 AcpiUtGetReferenceName (
482 ACPI_OPERAND_OBJECT
*Object
)
487 return ("NULL Object");
490 if (ACPI_GET_DESCRIPTOR_TYPE (Object
) != ACPI_DESC_TYPE_OPERAND
)
492 return ("Not an Operand object");
495 if (Object
->Common
.Type
!= ACPI_TYPE_LOCAL_REFERENCE
)
497 return ("Not a Reference object");
500 if (Object
->Reference
.Class
> ACPI_REFCLASS_MAX
)
502 return ("Unknown Reference class");
505 return (AcpiGbl_RefClassNames
[Object
->Reference
.Class
]);
509 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
511 * Strings and procedures used for debug only
514 /*******************************************************************************
516 * FUNCTION: AcpiUtGetMutexName
518 * PARAMETERS: MutexId - The predefined ID for this mutex.
520 * RETURN: Decoded name of the internal mutex
522 * DESCRIPTION: Translate a mutex ID into a name string (Debug only)
524 ******************************************************************************/
526 /* Names for internal mutex objects, used for debug output */
528 static char *AcpiGbl_MutexNames
[ACPI_NUM_MUTEX
] =
530 "ACPI_MTX_Interpreter",
531 "ACPI_MTX_Namespace",
536 "ACPI_MTX_CommandComplete",
537 "ACPI_MTX_CommandReady"
545 if (MutexId
> ACPI_MAX_MUTEX
)
547 return ("Invalid Mutex ID");
550 return (AcpiGbl_MutexNames
[MutexId
]);
554 /*******************************************************************************
556 * FUNCTION: AcpiUtGetNotifyName
558 * PARAMETERS: NotifyValue - Value from the Notify() request
560 * RETURN: Decoded name for the notify value
562 * DESCRIPTION: Translate a Notify Value to a notify namestring.
564 ******************************************************************************/
566 /* Names for Notify() values, used for debug output */
568 static const char *AcpiGbl_GenericNotify
[ACPI_NOTIFY_MAX
+ 1] =
570 /* 00 */ "Bus Check",
571 /* 01 */ "Device Check",
572 /* 02 */ "Device Wake",
573 /* 03 */ "Eject Request",
574 /* 04 */ "Device Check Light",
575 /* 05 */ "Frequency Mismatch",
576 /* 06 */ "Bus Mode Mismatch",
577 /* 07 */ "Power Fault",
578 /* 08 */ "Capabilities Check",
579 /* 09 */ "Device PLD Check",
581 /* 0B */ "System Locality Update",
582 /* 0C */ "Shutdown Request",
583 /* 0D */ "System Resource Affinity Update"
586 static const char *AcpiGbl_DeviceNotify
[4] =
588 /* 80 */ "Status Change",
589 /* 81 */ "Information Change",
590 /* 82 */ "Device-Specific Change",
591 /* 83 */ "Device-Specific Change"
594 static const char *AcpiGbl_ProcessorNotify
[4] =
596 /* 80 */ "Performance Capability Change",
597 /* 81 */ "C-State Change",
598 /* 82 */ "Throttling Capability Change",
599 /* 83 */ "Device-Specific Change"
602 static const char *AcpiGbl_ThermalNotify
[4] =
604 /* 80 */ "Thermal Status Change",
605 /* 81 */ "Thermal Trip Point Change",
606 /* 82 */ "Thermal Device List Change",
607 /* 83 */ "Thermal Relationship Change"
612 AcpiUtGetNotifyName (
614 ACPI_OBJECT_TYPE Type
)
617 /* 00 - 0D are common to all object types */
619 if (NotifyValue
<= ACPI_NOTIFY_MAX
)
621 return (AcpiGbl_GenericNotify
[NotifyValue
]);
624 /* 0D - 7F are reserved */
626 if (NotifyValue
<= ACPI_MAX_SYS_NOTIFY
)
631 /* 80 - 83 are per-object-type */
633 if (NotifyValue
<= 0x83)
638 case ACPI_TYPE_DEVICE
:
639 return (AcpiGbl_DeviceNotify
[NotifyValue
- 0x80]);
641 case ACPI_TYPE_PROCESSOR
:
642 return (AcpiGbl_ProcessorNotify
[NotifyValue
- 0x80]);
644 case ACPI_TYPE_THERMAL
:
645 return (AcpiGbl_ThermalNotify
[NotifyValue
- 0x80]);
648 return ("Target object type does not support notifies");
652 /* 84 - BF are device-specific */
654 if (NotifyValue
<= ACPI_MAX_DEVICE_SPECIFIC_NOTIFY
)
656 return ("Device-Specific");
659 /* C0 and above are hardware-specific */
661 return ("Hardware-Specific");
666 /*******************************************************************************
668 * FUNCTION: AcpiUtValidObjectType
670 * PARAMETERS: Type - Object type to be validated
672 * RETURN: TRUE if valid object type, FALSE otherwise
674 * DESCRIPTION: Validate an object type
676 ******************************************************************************/
679 AcpiUtValidObjectType (
680 ACPI_OBJECT_TYPE Type
)
683 if (Type
> ACPI_TYPE_LOCAL_MAX
)
685 /* Note: Assumes all TYPEs are contiguous (external/local) */