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