1 /******************************************************************************
2 *
3 * Module Name: utdecode - Utility decoding routines (value-to-string)
4 *
5 *****************************************************************************/
6
7 /*
8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
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 __UTDECODE_C__
45
46 #include "acpi.h"
47 #include "accommon.h"
48 #include "acnamesp.h"
49
50 #define _COMPONENT ACPI_UTILITIES
51 ACPI_MODULE_NAME ("utdecode")
52
53
54 /*******************************************************************************
55 *
56 * FUNCTION: AcpiFormatException
57 *
58 * PARAMETERS: Status - The ACPI_STATUS code to be formatted
59 *
60 * RETURN: A string containing the exception text. A valid pointer is
61 * always returned.
62 *
63 * DESCRIPTION: This function translates an ACPI exception into an ASCII string
64 * It is here instead of utxface.c so it is always present.
65 *
66 ******************************************************************************/
67
68 const char *
69 AcpiFormatException (
70 ACPI_STATUS Status)
71 {
72 const char *Exception = NULL;
73
74
75 ACPI_FUNCTION_ENTRY ();
76
77
78 Exception = AcpiUtValidateException (Status);
79 if (!Exception)
80 {
81 /* Exception code was not recognized */
82
83 ACPI_ERROR ((AE_INFO,
84 "Unknown exception code: 0x%8.8X", Status));
85
86 Exception = "UNKNOWN_STATUS_CODE";
87 }
88
89 return (ACPI_CAST_PTR (const char, Exception));
90 }
91
92 ACPI_EXPORT_SYMBOL (AcpiFormatException)
93
94
95 /*
96 * Properties of the ACPI Object Types, both internal and external.
97 * The table is indexed by values of ACPI_OBJECT_TYPE
98 */
99 const UINT8 AcpiGbl_NsProperties[ACPI_NUM_NS_TYPES] =
100 {
101 ACPI_NS_NORMAL, /* 00 Any */
102 ACPI_NS_NORMAL, /* 01 Number */
103 ACPI_NS_NORMAL, /* 02 String */
104 ACPI_NS_NORMAL, /* 03 Buffer */
105 ACPI_NS_NORMAL, /* 04 Package */
106 ACPI_NS_NORMAL, /* 05 FieldUnit */
107 ACPI_NS_NEWSCOPE, /* 06 Device */
108 ACPI_NS_NORMAL, /* 07 Event */
109 ACPI_NS_NEWSCOPE, /* 08 Method */
110 ACPI_NS_NORMAL, /* 09 Mutex */
111 ACPI_NS_NORMAL, /* 10 Region */
112 ACPI_NS_NEWSCOPE, /* 11 Power */
113 ACPI_NS_NEWSCOPE, /* 12 Processor */
114 ACPI_NS_NEWSCOPE, /* 13 Thermal */
163 return (AcpiGbl_HexToAscii[(Integer >> Position) & 0xF]);
164 }
165
166
167 /*******************************************************************************
168 *
169 * FUNCTION: AcpiUtGetRegionName
170 *
171 * PARAMETERS: Space ID - ID for the region
172 *
173 * RETURN: Decoded region SpaceId name
174 *
175 * DESCRIPTION: Translate a Space ID into a name string (Debug only)
176 *
177 ******************************************************************************/
178
179 /* Region type decoding */
180
181 const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] =
182 {
183 "SystemMemory",
184 "SystemIO",
185 "PCI_Config",
186 "EmbeddedControl",
187 "SMBus",
188 "SystemCMOS",
189 "PCIBARTarget",
190 "IPMI"
191 };
192
193
194 char *
195 AcpiUtGetRegionName (
196 UINT8 SpaceId)
197 {
198
199 if (SpaceId >= ACPI_USER_REGION_BEGIN)
200 {
201 return ("UserDefinedRegion");
202 }
203 else if (SpaceId == ACPI_ADR_SPACE_DATA_TABLE)
204 {
205 return ("DataTable");
206 }
207 else if (SpaceId == ACPI_ADR_SPACE_FIXED_HARDWARE)
208 {
209 return ("FunctionalFixedHW");
210 }
548 }
549
550 return (AcpiGbl_MutexNames[MutexId]);
551 }
552
553
554 /*******************************************************************************
555 *
556 * FUNCTION: AcpiUtGetNotifyName
557 *
558 * PARAMETERS: NotifyValue - Value from the Notify() request
559 *
560 * RETURN: Decoded name for the notify value
561 *
562 * DESCRIPTION: Translate a Notify Value to a notify namestring.
563 *
564 ******************************************************************************/
565
566 /* Names for Notify() values, used for debug output */
567
568 static const char *AcpiGbl_NotifyValueNames[] =
569 {
570 "Bus Check",
571 "Device Check",
572 "Device Wake",
573 "Eject Request",
574 "Device Check Light",
575 "Frequency Mismatch",
576 "Bus Mode Mismatch",
577 "Power Fault",
578 "Capabilities Check",
579 "Device PLD Check",
580 "Reserved",
581 "System Locality Update"
582 };
583
584 const char *
585 AcpiUtGetNotifyName (
586 UINT32 NotifyValue)
587 {
588
589 if (NotifyValue <= ACPI_NOTIFY_MAX)
590 {
591 return (AcpiGbl_NotifyValueNames[NotifyValue]);
592 }
593 else if (NotifyValue <= ACPI_MAX_SYS_NOTIFY)
594 {
595 return ("Reserved");
596 }
597 else /* Greater or equal to 0x80 */
598 {
599 return ("**Device Specific**");
600 }
601 }
602 #endif
603
604
605 /*******************************************************************************
606 *
607 * FUNCTION: AcpiUtValidObjectType
608 *
609 * PARAMETERS: Type - Object type to be validated
610 *
611 * RETURN: TRUE if valid object type, FALSE otherwise
612 *
613 * DESCRIPTION: Validate an object type
614 *
615 ******************************************************************************/
616
617 BOOLEAN
618 AcpiUtValidObjectType (
619 ACPI_OBJECT_TYPE Type)
620 {
|
1 /******************************************************************************
2 *
3 * Module Name: utdecode - Utility decoding routines (value-to-string)
4 *
5 *****************************************************************************/
6
7 /*
8 * Copyright (C) 2000 - 2014, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
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 __UTDECODE_C__
45
46 #include "acpi.h"
47 #include "accommon.h"
48 #include "acnamesp.h"
49
50 #define _COMPONENT ACPI_UTILITIES
51 ACPI_MODULE_NAME ("utdecode")
52
53
54 /*
55 * Properties of the ACPI Object Types, both internal and external.
56 * The table is indexed by values of ACPI_OBJECT_TYPE
57 */
58 const UINT8 AcpiGbl_NsProperties[ACPI_NUM_NS_TYPES] =
59 {
60 ACPI_NS_NORMAL, /* 00 Any */
61 ACPI_NS_NORMAL, /* 01 Number */
62 ACPI_NS_NORMAL, /* 02 String */
63 ACPI_NS_NORMAL, /* 03 Buffer */
64 ACPI_NS_NORMAL, /* 04 Package */
65 ACPI_NS_NORMAL, /* 05 FieldUnit */
66 ACPI_NS_NEWSCOPE, /* 06 Device */
67 ACPI_NS_NORMAL, /* 07 Event */
68 ACPI_NS_NEWSCOPE, /* 08 Method */
69 ACPI_NS_NORMAL, /* 09 Mutex */
70 ACPI_NS_NORMAL, /* 10 Region */
71 ACPI_NS_NEWSCOPE, /* 11 Power */
72 ACPI_NS_NEWSCOPE, /* 12 Processor */
73 ACPI_NS_NEWSCOPE, /* 13 Thermal */
122 return (AcpiGbl_HexToAscii[(Integer >> Position) & 0xF]);
123 }
124
125
126 /*******************************************************************************
127 *
128 * FUNCTION: AcpiUtGetRegionName
129 *
130 * PARAMETERS: Space ID - ID for the region
131 *
132 * RETURN: Decoded region SpaceId name
133 *
134 * DESCRIPTION: Translate a Space ID into a name string (Debug only)
135 *
136 ******************************************************************************/
137
138 /* Region type decoding */
139
140 const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] =
141 {
142 "SystemMemory", /* 0x00 */
143 "SystemIO", /* 0x01 */
144 "PCI_Config", /* 0x02 */
145 "EmbeddedControl", /* 0x03 */
146 "SMBus", /* 0x04 */
147 "SystemCMOS", /* 0x05 */
148 "PCIBARTarget", /* 0x06 */
149 "IPMI", /* 0x07 */
150 "GeneralPurposeIo", /* 0x08 */
151 "GenericSerialBus", /* 0x09 */
152 "PCC" /* 0x0A */
153 };
154
155
156 char *
157 AcpiUtGetRegionName (
158 UINT8 SpaceId)
159 {
160
161 if (SpaceId >= ACPI_USER_REGION_BEGIN)
162 {
163 return ("UserDefinedRegion");
164 }
165 else if (SpaceId == ACPI_ADR_SPACE_DATA_TABLE)
166 {
167 return ("DataTable");
168 }
169 else if (SpaceId == ACPI_ADR_SPACE_FIXED_HARDWARE)
170 {
171 return ("FunctionalFixedHW");
172 }
510 }
511
512 return (AcpiGbl_MutexNames[MutexId]);
513 }
514
515
516 /*******************************************************************************
517 *
518 * FUNCTION: AcpiUtGetNotifyName
519 *
520 * PARAMETERS: NotifyValue - Value from the Notify() request
521 *
522 * RETURN: Decoded name for the notify value
523 *
524 * DESCRIPTION: Translate a Notify Value to a notify namestring.
525 *
526 ******************************************************************************/
527
528 /* Names for Notify() values, used for debug output */
529
530 static const char *AcpiGbl_NotifyValueNames[ACPI_NOTIFY_MAX + 1] =
531 {
532 /* 00 */ "Bus Check",
533 /* 01 */ "Device Check",
534 /* 02 */ "Device Wake",
535 /* 03 */ "Eject Request",
536 /* 04 */ "Device Check Light",
537 /* 05 */ "Frequency Mismatch",
538 /* 06 */ "Bus Mode Mismatch",
539 /* 07 */ "Power Fault",
540 /* 08 */ "Capabilities Check",
541 /* 09 */ "Device PLD Check",
542 /* 10 */ "Reserved",
543 /* 11 */ "System Locality Update",
544 /* 12 */ "Shutdown Request"
545 };
546
547 const char *
548 AcpiUtGetNotifyName (
549 UINT32 NotifyValue)
550 {
551
552 if (NotifyValue <= ACPI_NOTIFY_MAX)
553 {
554 return (AcpiGbl_NotifyValueNames[NotifyValue]);
555 }
556 else if (NotifyValue <= ACPI_MAX_SYS_NOTIFY)
557 {
558 return ("Reserved");
559 }
560 else if (NotifyValue <= ACPI_MAX_DEVICE_SPECIFIC_NOTIFY)
561 {
562 return ("Device Specific");
563 }
564 else
565 {
566 return ("Hardware Specific");
567 }
568 }
569 #endif
570
571
572 /*******************************************************************************
573 *
574 * FUNCTION: AcpiUtValidObjectType
575 *
576 * PARAMETERS: Type - Object type to be validated
577 *
578 * RETURN: TRUE if valid object type, FALSE otherwise
579 *
580 * DESCRIPTION: Validate an object type
581 *
582 ******************************************************************************/
583
584 BOOLEAN
585 AcpiUtValidObjectType (
586 ACPI_OBJECT_TYPE Type)
587 {
|