Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2216 | Serge | 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 - 2011, 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 | #define __UTDECODE_C__ |
||
117 | |||
118 | #include "acpi.h" |
||
119 | #include "accommon.h" |
||
120 | #include "acnamesp.h" |
||
121 | |||
122 | #define _COMPONENT ACPI_UTILITIES |
||
123 | ACPI_MODULE_NAME ("utdecode") |
||
124 | |||
125 | |||
126 | /******************************************************************************* |
||
127 | * |
||
128 | * FUNCTION: AcpiFormatException |
||
129 | * |
||
130 | * PARAMETERS: Status - The ACPI_STATUS code to be formatted |
||
131 | * |
||
132 | * RETURN: A string containing the exception text. A valid pointer is |
||
133 | * always returned. |
||
134 | * |
||
135 | * DESCRIPTION: This function translates an ACPI exception into an ASCII string |
||
136 | * It is here instead of utxface.c so it is always present. |
||
137 | * |
||
138 | ******************************************************************************/ |
||
139 | |||
140 | const char * |
||
141 | AcpiFormatException ( |
||
142 | ACPI_STATUS Status) |
||
143 | { |
||
144 | const char *Exception = NULL; |
||
145 | |||
146 | |||
147 | ACPI_FUNCTION_ENTRY (); |
||
148 | |||
149 | |||
150 | Exception = AcpiUtValidateException (Status); |
||
151 | if (!Exception) |
||
152 | { |
||
153 | /* Exception code was not recognized */ |
||
154 | |||
155 | ACPI_ERROR ((AE_INFO, |
||
156 | "Unknown exception code: 0x%8.8X", Status)); |
||
157 | |||
158 | Exception = "UNKNOWN_STATUS_CODE"; |
||
159 | } |
||
160 | |||
161 | return (ACPI_CAST_PTR (const char, Exception)); |
||
162 | } |
||
163 | |||
164 | ACPI_EXPORT_SYMBOL (AcpiFormatException) |
||
165 | |||
166 | |||
167 | /* |
||
168 | * Properties of the ACPI Object Types, both internal and external. |
||
169 | * The table is indexed by values of ACPI_OBJECT_TYPE |
||
170 | */ |
||
171 | const UINT8 AcpiGbl_NsProperties[ACPI_NUM_NS_TYPES] = |
||
172 | { |
||
173 | ACPI_NS_NORMAL, /* 00 Any */ |
||
174 | ACPI_NS_NORMAL, /* 01 Number */ |
||
175 | ACPI_NS_NORMAL, /* 02 String */ |
||
176 | ACPI_NS_NORMAL, /* 03 Buffer */ |
||
177 | ACPI_NS_NORMAL, /* 04 Package */ |
||
178 | ACPI_NS_NORMAL, /* 05 FieldUnit */ |
||
179 | ACPI_NS_NEWSCOPE, /* 06 Device */ |
||
180 | ACPI_NS_NORMAL, /* 07 Event */ |
||
181 | ACPI_NS_NEWSCOPE, /* 08 Method */ |
||
182 | ACPI_NS_NORMAL, /* 09 Mutex */ |
||
183 | ACPI_NS_NORMAL, /* 10 Region */ |
||
184 | ACPI_NS_NEWSCOPE, /* 11 Power */ |
||
185 | ACPI_NS_NEWSCOPE, /* 12 Processor */ |
||
186 | ACPI_NS_NEWSCOPE, /* 13 Thermal */ |
||
187 | ACPI_NS_NORMAL, /* 14 BufferField */ |
||
188 | ACPI_NS_NORMAL, /* 15 DdbHandle */ |
||
189 | ACPI_NS_NORMAL, /* 16 Debug Object */ |
||
190 | ACPI_NS_NORMAL, /* 17 DefField */ |
||
191 | ACPI_NS_NORMAL, /* 18 BankField */ |
||
192 | ACPI_NS_NORMAL, /* 19 IndexField */ |
||
193 | ACPI_NS_NORMAL, /* 20 Reference */ |
||
194 | ACPI_NS_NORMAL, /* 21 Alias */ |
||
195 | ACPI_NS_NORMAL, /* 22 MethodAlias */ |
||
196 | ACPI_NS_NORMAL, /* 23 Notify */ |
||
197 | ACPI_NS_NORMAL, /* 24 Address Handler */ |
||
198 | ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 25 Resource Desc */ |
||
199 | ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 26 Resource Field */ |
||
200 | ACPI_NS_NEWSCOPE, /* 27 Scope */ |
||
201 | ACPI_NS_NORMAL, /* 28 Extra */ |
||
202 | ACPI_NS_NORMAL, /* 29 Data */ |
||
203 | ACPI_NS_NORMAL /* 30 Invalid */ |
||
204 | }; |
||
205 | |||
206 | |||
207 | /******************************************************************************* |
||
208 | * |
||
209 | * FUNCTION: AcpiUtHexToAsciiChar |
||
210 | * |
||
211 | * PARAMETERS: Integer - Contains the hex digit |
||
212 | * Position - bit position of the digit within the |
||
213 | * integer (multiple of 4) |
||
214 | * |
||
215 | * RETURN: The converted Ascii character |
||
216 | * |
||
217 | * DESCRIPTION: Convert a hex digit to an Ascii character |
||
218 | * |
||
219 | ******************************************************************************/ |
||
220 | |||
221 | /* Hex to ASCII conversion table */ |
||
222 | |||
223 | static const char AcpiGbl_HexToAscii[] = |
||
224 | { |
||
225 | '0','1','2','3','4','5','6','7', |
||
226 | '8','9','A','B','C','D','E','F' |
||
227 | }; |
||
228 | |||
229 | char |
||
230 | AcpiUtHexToAsciiChar ( |
||
231 | UINT64 Integer, |
||
232 | UINT32 Position) |
||
233 | { |
||
234 | |||
235 | return (AcpiGbl_HexToAscii[(Integer >> Position) & 0xF]); |
||
236 | } |
||
237 | |||
238 | |||
239 | /******************************************************************************* |
||
240 | * |
||
241 | * FUNCTION: AcpiUtGetRegionName |
||
242 | * |
||
243 | * PARAMETERS: Space ID - ID for the region |
||
244 | * |
||
245 | * RETURN: Decoded region SpaceId name |
||
246 | * |
||
247 | * DESCRIPTION: Translate a Space ID into a name string (Debug only) |
||
248 | * |
||
249 | ******************************************************************************/ |
||
250 | |||
251 | /* Region type decoding */ |
||
252 | |||
253 | const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] = |
||
254 | { |
||
255 | "SystemMemory", |
||
256 | "SystemIO", |
||
257 | "PCI_Config", |
||
258 | "EmbeddedControl", |
||
259 | "SMBus", |
||
260 | "SystemCMOS", |
||
261 | "PCIBARTarget", |
||
262 | "IPMI" |
||
263 | }; |
||
264 | |||
265 | |||
266 | char * |
||
267 | AcpiUtGetRegionName ( |
||
268 | UINT8 SpaceId) |
||
269 | { |
||
270 | |||
271 | if (SpaceId >= ACPI_USER_REGION_BEGIN) |
||
272 | { |
||
273 | return ("UserDefinedRegion"); |
||
274 | } |
||
275 | else if (SpaceId == ACPI_ADR_SPACE_DATA_TABLE) |
||
276 | { |
||
277 | return ("DataTable"); |
||
278 | } |
||
279 | else if (SpaceId == ACPI_ADR_SPACE_FIXED_HARDWARE) |
||
280 | { |
||
281 | return ("FunctionalFixedHW"); |
||
282 | } |
||
283 | else if (SpaceId >= ACPI_NUM_PREDEFINED_REGIONS) |
||
284 | { |
||
285 | return ("InvalidSpaceId"); |
||
286 | } |
||
287 | |||
288 | return (ACPI_CAST_PTR (char, AcpiGbl_RegionTypes[SpaceId])); |
||
289 | } |
||
290 | |||
291 | |||
292 | /******************************************************************************* |
||
293 | * |
||
294 | * FUNCTION: AcpiUtGetEventName |
||
295 | * |
||
296 | * PARAMETERS: EventId - Fixed event ID |
||
297 | * |
||
298 | * RETURN: Decoded event ID name |
||
299 | * |
||
300 | * DESCRIPTION: Translate a Event ID into a name string (Debug only) |
||
301 | * |
||
302 | ******************************************************************************/ |
||
303 | |||
304 | /* Event type decoding */ |
||
305 | |||
306 | static const char *AcpiGbl_EventTypes[ACPI_NUM_FIXED_EVENTS] = |
||
307 | { |
||
308 | "PM_Timer", |
||
309 | "GlobalLock", |
||
310 | "PowerButton", |
||
311 | "SleepButton", |
||
312 | "RealTimeClock", |
||
313 | }; |
||
314 | |||
315 | |||
316 | char * |
||
317 | AcpiUtGetEventName ( |
||
318 | UINT32 EventId) |
||
319 | { |
||
320 | |||
321 | if (EventId > ACPI_EVENT_MAX) |
||
322 | { |
||
323 | return ("InvalidEventID"); |
||
324 | } |
||
325 | |||
326 | return (ACPI_CAST_PTR (char, AcpiGbl_EventTypes[EventId])); |
||
327 | } |
||
328 | |||
329 | |||
330 | /******************************************************************************* |
||
331 | * |
||
332 | * FUNCTION: AcpiUtGetTypeName |
||
333 | * |
||
334 | * PARAMETERS: Type - An ACPI object type |
||
335 | * |
||
336 | * RETURN: Decoded ACPI object type name |
||
337 | * |
||
338 | * DESCRIPTION: Translate a Type ID into a name string (Debug only) |
||
339 | * |
||
340 | ******************************************************************************/ |
||
341 | |||
342 | /* |
||
343 | * Elements of AcpiGbl_NsTypeNames below must match |
||
344 | * one-to-one with values of ACPI_OBJECT_TYPE |
||
345 | * |
||
346 | * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; |
||
347 | * when stored in a table it really means that we have thus far seen no |
||
348 | * evidence to indicate what type is actually going to be stored for this entry. |
||
349 | */ |
||
350 | static const char AcpiGbl_BadType[] = "UNDEFINED"; |
||
351 | |||
352 | /* Printable names of the ACPI object types */ |
||
353 | |||
354 | static const char *AcpiGbl_NsTypeNames[] = |
||
355 | { |
||
356 | /* 00 */ "Untyped", |
||
357 | /* 01 */ "Integer", |
||
358 | /* 02 */ "String", |
||
359 | /* 03 */ "Buffer", |
||
360 | /* 04 */ "Package", |
||
361 | /* 05 */ "FieldUnit", |
||
362 | /* 06 */ "Device", |
||
363 | /* 07 */ "Event", |
||
364 | /* 08 */ "Method", |
||
365 | /* 09 */ "Mutex", |
||
366 | /* 10 */ "Region", |
||
367 | /* 11 */ "Power", |
||
368 | /* 12 */ "Processor", |
||
369 | /* 13 */ "Thermal", |
||
370 | /* 14 */ "BufferField", |
||
371 | /* 15 */ "DdbHandle", |
||
372 | /* 16 */ "DebugObject", |
||
373 | /* 17 */ "RegionField", |
||
374 | /* 18 */ "BankField", |
||
375 | /* 19 */ "IndexField", |
||
376 | /* 20 */ "Reference", |
||
377 | /* 21 */ "Alias", |
||
378 | /* 22 */ "MethodAlias", |
||
379 | /* 23 */ "Notify", |
||
380 | /* 24 */ "AddrHandler", |
||
381 | /* 25 */ "ResourceDesc", |
||
382 | /* 26 */ "ResourceFld", |
||
383 | /* 27 */ "Scope", |
||
384 | /* 28 */ "Extra", |
||
385 | /* 29 */ "Data", |
||
386 | /* 30 */ "Invalid" |
||
387 | }; |
||
388 | |||
389 | |||
390 | char * |
||
391 | AcpiUtGetTypeName ( |
||
392 | ACPI_OBJECT_TYPE Type) |
||
393 | { |
||
394 | |||
395 | if (Type > ACPI_TYPE_INVALID) |
||
396 | { |
||
397 | return (ACPI_CAST_PTR (char, AcpiGbl_BadType)); |
||
398 | } |
||
399 | |||
400 | return (ACPI_CAST_PTR (char, AcpiGbl_NsTypeNames[Type])); |
||
401 | } |
||
402 | |||
403 | |||
404 | char * |
||
405 | AcpiUtGetObjectTypeName ( |
||
406 | ACPI_OPERAND_OBJECT *ObjDesc) |
||
407 | { |
||
408 | |||
409 | if (!ObjDesc) |
||
410 | { |
||
411 | return ("[NULL Object Descriptor]"); |
||
412 | } |
||
413 | |||
414 | return (AcpiUtGetTypeName (ObjDesc->Common.Type)); |
||
415 | } |
||
416 | |||
417 | |||
418 | /******************************************************************************* |
||
419 | * |
||
420 | * FUNCTION: AcpiUtGetNodeName |
||
421 | * |
||
422 | * PARAMETERS: Object - A namespace node |
||
423 | * |
||
424 | * RETURN: ASCII name of the node |
||
425 | * |
||
426 | * DESCRIPTION: Validate the node and return the node's ACPI name. |
||
427 | * |
||
428 | ******************************************************************************/ |
||
429 | |||
430 | char * |
||
431 | AcpiUtGetNodeName ( |
||
432 | void *Object) |
||
433 | { |
||
434 | ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) Object; |
||
435 | |||
436 | |||
437 | /* Must return a string of exactly 4 characters == ACPI_NAME_SIZE */ |
||
438 | |||
439 | if (!Object) |
||
440 | { |
||
441 | return ("NULL"); |
||
442 | } |
||
443 | |||
444 | /* Check for Root node */ |
||
445 | |||
446 | if ((Object == ACPI_ROOT_OBJECT) || |
||
447 | (Object == AcpiGbl_RootNode)) |
||
448 | { |
||
449 | return ("\"\\\" "); |
||
450 | } |
||
451 | |||
452 | /* Descriptor must be a namespace node */ |
||
453 | |||
454 | if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) |
||
455 | { |
||
456 | return ("####"); |
||
457 | } |
||
458 | |||
459 | /* |
||
460 | * Ensure name is valid. The name was validated/repaired when the node |
||
461 | * was created, but make sure it has not been corrupted. |
||
462 | */ |
||
463 | AcpiUtRepairName (Node->Name.Ascii); |
||
464 | |||
465 | /* Return the name */ |
||
466 | |||
467 | return (Node->Name.Ascii); |
||
468 | } |
||
469 | |||
470 | |||
471 | /******************************************************************************* |
||
472 | * |
||
473 | * FUNCTION: AcpiUtGetDescriptorName |
||
474 | * |
||
475 | * PARAMETERS: Object - An ACPI object |
||
476 | * |
||
477 | * RETURN: Decoded name of the descriptor type |
||
478 | * |
||
479 | * DESCRIPTION: Validate object and return the descriptor type |
||
480 | * |
||
481 | ******************************************************************************/ |
||
482 | |||
483 | /* Printable names of object descriptor types */ |
||
484 | |||
485 | static const char *AcpiGbl_DescTypeNames[] = |
||
486 | { |
||
487 | /* 00 */ "Not a Descriptor", |
||
488 | /* 01 */ "Cached", |
||
489 | /* 02 */ "State-Generic", |
||
490 | /* 03 */ "State-Update", |
||
491 | /* 04 */ "State-Package", |
||
492 | /* 05 */ "State-Control", |
||
493 | /* 06 */ "State-RootParseScope", |
||
494 | /* 07 */ "State-ParseScope", |
||
495 | /* 08 */ "State-WalkScope", |
||
496 | /* 09 */ "State-Result", |
||
497 | /* 10 */ "State-Notify", |
||
498 | /* 11 */ "State-Thread", |
||
499 | /* 12 */ "Walk", |
||
500 | /* 13 */ "Parser", |
||
501 | /* 14 */ "Operand", |
||
502 | /* 15 */ "Node" |
||
503 | }; |
||
504 | |||
505 | |||
506 | char * |
||
507 | AcpiUtGetDescriptorName ( |
||
508 | void *Object) |
||
509 | { |
||
510 | |||
511 | if (!Object) |
||
512 | { |
||
513 | return ("NULL OBJECT"); |
||
514 | } |
||
515 | |||
516 | if (ACPI_GET_DESCRIPTOR_TYPE (Object) > ACPI_DESC_TYPE_MAX) |
||
517 | { |
||
518 | return ("Not a Descriptor"); |
||
519 | } |
||
520 | |||
521 | return (ACPI_CAST_PTR (char, |
||
522 | AcpiGbl_DescTypeNames[ACPI_GET_DESCRIPTOR_TYPE (Object)])); |
||
523 | |||
524 | } |
||
525 | |||
526 | |||
527 | /******************************************************************************* |
||
528 | * |
||
529 | * FUNCTION: AcpiUtGetReferenceName |
||
530 | * |
||
531 | * PARAMETERS: Object - An ACPI reference object |
||
532 | * |
||
533 | * RETURN: Decoded name of the type of reference |
||
534 | * |
||
535 | * DESCRIPTION: Decode a reference object sub-type to a string. |
||
536 | * |
||
537 | ******************************************************************************/ |
||
538 | |||
539 | /* Printable names of reference object sub-types */ |
||
540 | |||
541 | static const char *AcpiGbl_RefClassNames[] = |
||
542 | { |
||
543 | /* 00 */ "Local", |
||
544 | /* 01 */ "Argument", |
||
545 | /* 02 */ "RefOf", |
||
546 | /* 03 */ "Index", |
||
547 | /* 04 */ "DdbHandle", |
||
548 | /* 05 */ "Named Object", |
||
549 | /* 06 */ "Debug" |
||
550 | }; |
||
551 | |||
552 | const char * |
||
553 | AcpiUtGetReferenceName ( |
||
554 | ACPI_OPERAND_OBJECT *Object) |
||
555 | { |
||
556 | |||
557 | if (!Object) |
||
558 | { |
||
559 | return ("NULL Object"); |
||
560 | } |
||
561 | |||
562 | if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND) |
||
563 | { |
||
564 | return ("Not an Operand object"); |
||
565 | } |
||
566 | |||
567 | if (Object->Common.Type != ACPI_TYPE_LOCAL_REFERENCE) |
||
568 | { |
||
569 | return ("Not a Reference object"); |
||
570 | } |
||
571 | |||
572 | if (Object->Reference.Class > ACPI_REFCLASS_MAX) |
||
573 | { |
||
574 | return ("Unknown Reference class"); |
||
575 | } |
||
576 | |||
577 | return (AcpiGbl_RefClassNames[Object->Reference.Class]); |
||
578 | } |
||
579 | |||
580 | |||
581 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) |
||
582 | /* |
||
583 | * Strings and procedures used for debug only |
||
584 | */ |
||
585 | |||
586 | /******************************************************************************* |
||
587 | * |
||
588 | * FUNCTION: AcpiUtGetMutexName |
||
589 | * |
||
590 | * PARAMETERS: MutexId - The predefined ID for this mutex. |
||
591 | * |
||
592 | * RETURN: Decoded name of the internal mutex |
||
593 | * |
||
594 | * DESCRIPTION: Translate a mutex ID into a name string (Debug only) |
||
595 | * |
||
596 | ******************************************************************************/ |
||
597 | |||
598 | /* Names for internal mutex objects, used for debug output */ |
||
599 | |||
600 | static char *AcpiGbl_MutexNames[ACPI_NUM_MUTEX] = |
||
601 | { |
||
602 | "ACPI_MTX_Interpreter", |
||
603 | "ACPI_MTX_Namespace", |
||
604 | "ACPI_MTX_Tables", |
||
605 | "ACPI_MTX_Events", |
||
606 | "ACPI_MTX_Caches", |
||
607 | "ACPI_MTX_Memory", |
||
608 | "ACPI_MTX_CommandComplete", |
||
609 | "ACPI_MTX_CommandReady" |
||
610 | }; |
||
611 | |||
612 | char * |
||
613 | AcpiUtGetMutexName ( |
||
614 | UINT32 MutexId) |
||
615 | { |
||
616 | |||
617 | if (MutexId > ACPI_MAX_MUTEX) |
||
618 | { |
||
619 | return ("Invalid Mutex ID"); |
||
620 | } |
||
621 | |||
622 | return (AcpiGbl_MutexNames[MutexId]); |
||
623 | } |
||
624 | |||
625 | |||
626 | /******************************************************************************* |
||
627 | * |
||
628 | * FUNCTION: AcpiUtGetNotifyName |
||
629 | * |
||
630 | * PARAMETERS: NotifyValue - Value from the Notify() request |
||
631 | * |
||
632 | * RETURN: Decoded name for the notify value |
||
633 | * |
||
634 | * DESCRIPTION: Translate a Notify Value to a notify namestring. |
||
635 | * |
||
636 | ******************************************************************************/ |
||
637 | |||
638 | /* Names for Notify() values, used for debug output */ |
||
639 | |||
640 | static const char *AcpiGbl_NotifyValueNames[] = |
||
641 | { |
||
642 | "Bus Check", |
||
643 | "Device Check", |
||
644 | "Device Wake", |
||
645 | "Eject Request", |
||
646 | "Device Check Light", |
||
647 | "Frequency Mismatch", |
||
648 | "Bus Mode Mismatch", |
||
649 | "Power Fault", |
||
650 | "Capabilities Check", |
||
651 | "Device PLD Check", |
||
652 | "Reserved", |
||
653 | "System Locality Update" |
||
654 | }; |
||
655 | |||
656 | const char * |
||
657 | AcpiUtGetNotifyName ( |
||
658 | UINT32 NotifyValue) |
||
659 | { |
||
660 | |||
661 | if (NotifyValue <= ACPI_NOTIFY_MAX) |
||
662 | { |
||
663 | return (AcpiGbl_NotifyValueNames[NotifyValue]); |
||
664 | } |
||
665 | else if (NotifyValue <= ACPI_MAX_SYS_NOTIFY) |
||
666 | { |
||
667 | return ("Reserved"); |
||
668 | } |
||
669 | else /* Greater or equal to 0x80 */ |
||
670 | { |
||
671 | return ("**Device Specific**"); |
||
672 | } |
||
673 | } |
||
674 | #endif |
||
675 | |||
676 | |||
677 | /******************************************************************************* |
||
678 | * |
||
679 | * FUNCTION: AcpiUtValidObjectType |
||
680 | * |
||
681 | * PARAMETERS: Type - Object type to be validated |
||
682 | * |
||
683 | * RETURN: TRUE if valid object type, FALSE otherwise |
||
684 | * |
||
685 | * DESCRIPTION: Validate an object type |
||
686 | * |
||
687 | ******************************************************************************/ |
||
688 | |||
689 | BOOLEAN |
||
690 | AcpiUtValidObjectType ( |
||
691 | ACPI_OBJECT_TYPE Type) |
||
692 | { |
||
693 | |||
694 | if (Type > ACPI_TYPE_LOCAL_MAX) |
||
695 | { |
||
696 | /* Note: Assumes all TYPEs are contiguous (external/local) */ |
||
697 | |||
698 | return (FALSE); |
||
699 | } |
||
700 | |||
701 | return (TRUE); |
||
702 | }=>=> |