1 /*******************************************************************************
3 * Module Name: dmbuffer - AML disassembler, buffer and string support
5 ******************************************************************************/
8 * Copyright (C) 2000 - 2017, Intel Corp.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
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.
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.
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
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.
44 #include <contrib/dev/acpica/include/acpi.h>
45 #include <contrib/dev/acpica/include/accommon.h>
46 #include <contrib/dev/acpica/include/acutils.h>
47 #include <contrib/dev/acpica/include/acdisasm.h>
48 #include <contrib/dev/acpica/include/acparser.h>
49 #include <contrib/dev/acpica/include/amlcode.h>
50 #include <contrib/dev/acpica/include/acinterp.h>
53 #define _COMPONENT ACPI_CA_DEBUGGER
54 ACPI_MODULE_NAME ("dmbuffer")
56 /* Local prototypes */
60 ACPI_PARSE_OBJECT *Op);
64 ACPI_PARSE_OBJECT *Op);
67 AcpiDmGetHardwareIdType (
68 ACPI_PARSE_OBJECT *Op);
77 AcpiDmFindNameByIndex (
82 #define ACPI_BUFFER_BYTES_PER_LINE 8
85 /*******************************************************************************
87 * FUNCTION: AcpiDmDisasmByteList
89 * PARAMETERS: Level - Current source code indentation level
90 * ByteData - Pointer to the byte list
91 * ByteCount - Length of the byte list
95 * DESCRIPTION: Dump an AML "ByteList" in Hex format. 8 bytes per line, prefixed
96 * with the hex buffer offset.
98 ******************************************************************************/
101 AcpiDmDisasmByteList (
117 for (i = 0; i < ByteCount; i += ACPI_BUFFER_BYTES_PER_LINE)
119 /* Line indent and offset prefix for each new line */
121 AcpiDmIndent (Level);
122 if (ByteCount > ACPI_BUFFER_BYTES_PER_LINE)
124 AcpiOsPrintf ("/* %04X */ ", i);
127 /* Dump the actual hex values */
129 for (j = 0; j < ACPI_BUFFER_BYTES_PER_LINE; j++)
131 CurrentIndex = i + j;
132 if (CurrentIndex >= ByteCount)
134 /* Dump fill spaces */
140 AcpiOsPrintf (" 0x%2.2X", ByteData[CurrentIndex]);
142 /* Add comma if there are more bytes to display */
144 if (CurrentIndex < (ByteCount - 1))
154 /* Dump the ASCII equivalents within a comment */
156 AcpiOsPrintf (" /* ");
157 for (j = 0; j < ACPI_BUFFER_BYTES_PER_LINE; j++)
159 CurrentIndex = i + j;
160 if (CurrentIndex >= ByteCount)
165 BufChar = ByteData[CurrentIndex];
166 if (isprint (BufChar))
168 AcpiOsPrintf ("%c", BufChar);
176 /* Finished with this line */
178 AcpiOsPrintf (" */\n");
183 /*******************************************************************************
185 * FUNCTION: AcpiDmByteList
187 * PARAMETERS: Info - Parse tree walk info
192 * DESCRIPTION: Dump a buffer byte list, handling the various types of buffers.
193 * Buffer type must be already set in the Op DisasmOpcode.
195 ******************************************************************************/
199 ACPI_OP_WALK_INFO *Info,
200 ACPI_PARSE_OBJECT *Op)
206 ByteData = Op->Named.Data;
207 ByteCount = (UINT32) Op->Common.Value.Integer;
210 * The byte list belongs to a buffer, and can be produced by either
211 * a ResourceTemplate, Unicode, quoted string, or a plain byte list.
213 switch (Op->Common.Parent->Common.DisasmOpcode)
215 case ACPI_DASM_RESOURCE:
217 AcpiDmResourceTemplate (
218 Info, Op->Common.Parent, ByteData, ByteCount);
221 case ACPI_DASM_STRING:
223 AcpiDmIndent (Info->Level);
224 AcpiUtPrintString ((char *) ByteData, ACPI_UINT16_MAX);
233 case ACPI_DASM_UNICODE:
238 case ACPI_DASM_PLD_METHOD:
240 AcpiDmDisasmByteList (Info->Level, ByteData, ByteCount);
242 AcpiDmPldBuffer (Info->Level, ByteData, ByteCount);
245 case ACPI_DASM_BUFFER:
248 * Not a resource, string, or unicode string.
249 * Just dump the buffer
251 AcpiDmDisasmByteList (Info->Level, ByteData, ByteCount);
257 /*******************************************************************************
259 * FUNCTION: AcpiDmIsUuidBuffer
261 * PARAMETERS: Op - Buffer Object to be examined
263 * RETURN: TRUE if buffer contains a UUID
265 * DESCRIPTION: Determine if a buffer Op contains a UUID
267 * To help determine whether the buffer is a UUID versus a raw data buffer,
268 * there a are a couple bytes we can look at:
270 * xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx
272 * The variant covered by the UUID specification is indicated by the two most
273 * significant bits of N being 1 0 (i.e., the hexadecimal N will always be
276 * The variant covered by the UUID specification has five versions. For this
277 * variant, the four bits of M indicates the UUID version (i.e., the
278 * hexadecimal M will be either 1, 2, 3, 4, or 5).
280 ******************************************************************************/
284 ACPI_PARSE_OBJECT *Op)
288 ACPI_PARSE_OBJECT *SizeOp;
289 ACPI_PARSE_OBJECT *NextOp;
292 /* Buffer size is the buffer argument */
294 SizeOp = Op->Common.Value.Arg;
296 /* Next, the initializer byte list to examine */
298 NextOp = SizeOp->Common.Next;
304 /* Extract the byte list info */
306 ByteData = NextOp->Named.Data;
307 ByteCount = (UINT32) NextOp->Common.Value.Integer;
309 /* Byte count must be exactly 16 */
311 if (ByteCount != UUID_BUFFER_LENGTH)
316 /* Check for valid "M" and "N" values (see function header above) */
318 if (((ByteData[7] & 0xF0) == 0x00) || /* M={1,2,3,4,5} */
319 ((ByteData[7] & 0xF0) > 0x50) ||
320 ((ByteData[8] & 0xF0) < 0x80) || /* N={8,9,A,B} */
321 ((ByteData[8] & 0xF0) > 0xB0))
326 /* Ignore the Size argument in the disassembly of this buffer op */
328 SizeOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
333 /*******************************************************************************
335 * FUNCTION: AcpiDmUuid
337 * PARAMETERS: Op - Byte List op containing a UUID
341 * DESCRIPTION: Dump a buffer containing a UUID as a standard ASCII string.
344 * In its canonical form, the UUID is represented by a string containing 32
345 * lowercase hexadecimal digits, displayed in 5 groups separated by hyphens.
346 * The complete form is 8-4-4-4-12 for a total of 36 characters (32
347 * alphanumeric characters representing hex digits and 4 hyphens). In bytes,
348 * 4-2-2-2-6. Example:
350 * ToUUID ("107ededd-d381-4fd7-8da9-08e9a6c79644")
352 ******************************************************************************/
356 ACPI_PARSE_OBJECT *Op)
359 const char *Description;
362 Data = ACPI_CAST_PTR (UINT8, Op->Named.Data);
364 /* Emit the 36-byte UUID string in the proper format/order */
367 "\"%2.2x%2.2x%2.2x%2.2x-"
371 "%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x\")",
372 Data[3], Data[2], Data[1], Data[0],
376 Data[10], Data[11], Data[12], Data[13], Data[14], Data[15]);
378 /* Dump the UUID description string if available */
380 Description = AcpiAhMatchUuid (Data);
383 AcpiOsPrintf (" /* %s */", Description);
388 /*******************************************************************************
390 * FUNCTION: AcpiDmIsUnicodeBuffer
392 * PARAMETERS: Op - Buffer Object to be examined
394 * RETURN: TRUE if buffer contains a UNICODE string
396 * DESCRIPTION: Determine if a buffer Op contains a Unicode string
398 ******************************************************************************/
401 AcpiDmIsUnicodeBuffer (
402 ACPI_PARSE_OBJECT *Op)
407 ACPI_PARSE_OBJECT *SizeOp;
408 ACPI_PARSE_OBJECT *NextOp;
412 /* Buffer size is the buffer argument */
414 SizeOp = Op->Common.Value.Arg;
416 /* Next, the initializer byte list to examine */
418 NextOp = SizeOp->Common.Next;
424 /* Extract the byte list info */
426 ByteData = NextOp->Named.Data;
427 ByteCount = (UINT32) NextOp->Common.Value.Integer;
428 WordCount = ACPI_DIV_2 (ByteCount);
431 * Unicode string must have an even number of bytes and last
437 ((UINT16 *) (void *) ByteData)[WordCount - 1] != 0)
443 * For each word, 1st byte must be printable ascii, and the
444 * 2nd byte must be zero. This does not allow for escape
445 * sequences, but it is the most secure way to detect a
448 for (i = 0; i < (ByteCount - 2); i += 2)
450 if ((ByteData[i] == 0) ||
451 !(isprint (ByteData[i])) ||
452 (ByteData[(ACPI_SIZE) i + 1] != 0))
458 /* Ignore the Size argument in the disassembly of this buffer op */
460 SizeOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
465 /*******************************************************************************
467 * FUNCTION: AcpiDmIsStringBuffer
469 * PARAMETERS: Op - Buffer Object to be examined
471 * RETURN: TRUE if buffer contains a ASCII string, FALSE otherwise
473 * DESCRIPTION: Determine if a buffer Op contains a ASCII string
475 ******************************************************************************/
478 AcpiDmIsStringBuffer (
479 ACPI_PARSE_OBJECT *Op)
483 ACPI_PARSE_OBJECT *SizeOp;
484 ACPI_PARSE_OBJECT *NextOp;
488 /* Buffer size is the buffer argument */
490 SizeOp = Op->Common.Value.Arg;
492 /* Next, the initializer byte list to examine */
494 NextOp = SizeOp->Common.Next;
500 /* Extract the byte list info */
502 ByteData = NextOp->Named.Data;
503 ByteCount = (UINT32) NextOp->Common.Value.Integer;
505 /* Last byte must be the null terminator */
509 (ByteData[ByteCount-1] != 0))
515 * Check for a possible standalone resource EndTag, ignore it
516 * here. However, this sequence is also the string "Y", but
517 * this seems rare enough to be acceptable.
519 if ((ByteCount == 2) && (ByteData[0] == 0x79))
524 /* Check all bytes for ASCII */
526 for (i = 0; i < (ByteCount - 1); i++)
529 * TBD: allow some escapes (non-ascii chars).
530 * they will be handled in the string output routine
533 /* Not a string if not printable ascii */
535 if (!isprint (ByteData[i]))
545 /*******************************************************************************
547 * FUNCTION: AcpiDmIsPldBuffer
549 * PARAMETERS: Op - Buffer Object to be examined
551 * RETURN: TRUE if buffer appears to contain data produced via the
552 * ToPLD macro, FALSE otherwise
554 * DESCRIPTION: Determine if a buffer Op contains a _PLD structure
556 ******************************************************************************/
560 ACPI_PARSE_OBJECT *Op)
562 ACPI_NAMESPACE_NODE *Node;
563 ACPI_PARSE_OBJECT *SizeOp;
564 ACPI_PARSE_OBJECT *ByteListOp;
565 ACPI_PARSE_OBJECT *ParentOp;
567 UINT64 InitializerSize;
571 * Get the BufferSize argument - Buffer(BufferSize)
572 * If the buffer was generated by the ToPld macro, it must
573 * be a BYTE constant.
575 SizeOp = Op->Common.Value.Arg;
576 if (SizeOp->Common.AmlOpcode != AML_BYTE_OP)
581 /* Check the declared BufferSize, two possibilities */
583 BufferSize = SizeOp->Common.Value.Integer;
584 if ((BufferSize != ACPI_PLD_REV1_BUFFER_SIZE) &&
585 (BufferSize != ACPI_PLD_REV2_BUFFER_SIZE))
591 * Check the initializer list length. This is the actual
592 * number of bytes in the buffer as counted by the AML parser.
593 * The declared BufferSize can be larger than the actual length.
594 * However, for the ToPLD macro, the BufferSize will be the same
595 * as the initializer list length.
597 ByteListOp = SizeOp->Common.Next;
600 return (FALSE); /* Zero-length buffer case */
603 InitializerSize = ByteListOp->Common.Value.Integer;
604 if ((InitializerSize != ACPI_PLD_REV1_BUFFER_SIZE) &&
605 (InitializerSize != ACPI_PLD_REV2_BUFFER_SIZE))
610 /* Final size check */
612 if (BufferSize != InitializerSize)
617 /* Now examine the buffer parent */
619 ParentOp = Op->Common.Parent;
625 /* Check for form: Name(_PLD, Buffer() {}). Not legal, however */
627 if (ParentOp->Common.AmlOpcode == AML_NAME_OP)
629 Node = ParentOp->Common.Node;
631 if (ACPI_COMPARE_NAME (Node->Name.Ascii, METHOD_NAME__PLD))
633 /* Ignore the Size argument in the disassembly of this buffer op */
635 SizeOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
643 * Check for proper form: Name(_PLD, Package() {ToPLD()})
645 * Note: All other forms such as
646 * Return (Package() {ToPLD()})
648 * etc. are not converted back to the ToPLD macro, because
649 * there is really no deterministic way to disassemble the buffer
650 * back to the ToPLD macro, other than trying to find the "_PLD"
653 if (ParentOp->Common.AmlOpcode == AML_PACKAGE_OP)
655 ParentOp = ParentOp->Common.Parent;
661 if (ParentOp->Common.AmlOpcode == AML_NAME_OP)
663 Node = ParentOp->Common.Node;
665 if (ACPI_COMPARE_NAME (Node->Name.Ascii, METHOD_NAME__PLD))
667 /* Ignore the Size argument in the disassembly of this buffer op */
669 SizeOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
679 /*******************************************************************************
681 * FUNCTION: AcpiDmFindNameByIndex
683 * PARAMETERS: Index - Index of array to check
684 * List - Array to reference
686 * RETURN: String from List or empty string
688 * DESCRIPTION: Finds and returns the char string located at the given index
691 ******************************************************************************/
694 AcpiDmFindNameByIndex (
698 const char *NameString;
704 NameString = List[0];
710 NameString = List[i];
715 /* TBD: Add error msg */
720 return (List[Index]);
724 /*******************************************************************************
726 * FUNCTION: AcpiDmPldBuffer
728 * PARAMETERS: Level - Current source code indentation level
729 * ByteData - Pointer to the byte list
730 * ByteCount - Length of the byte list
734 * DESCRIPTION: Dump and format the contents of a _PLD buffer object
736 ******************************************************************************/
738 #define ACPI_PLD_OUTPUT08 "%*.s%-22s = 0x%X,\n", ACPI_MUL_4 (Level), " "
739 #define ACPI_PLD_OUTPUT08P "%*.s%-22s = 0x%X)\n", ACPI_MUL_4 (Level), " "
740 #define ACPI_PLD_OUTPUT16 "%*.s%-22s = 0x%X,\n", ACPI_MUL_4 (Level), " "
741 #define ACPI_PLD_OUTPUT16P "%*.s%-22s = 0x%X)\n", ACPI_MUL_4 (Level), " "
742 #define ACPI_PLD_OUTPUT24 "%*.s%-22s = 0x%X,\n", ACPI_MUL_4 (Level), " "
743 #define ACPI_PLD_OUTPUTSTR "%*.s%-22s = \"%s\",\n", ACPI_MUL_4 (Level), " "
751 ACPI_PLD_INFO *PldInfo;
755 /* Check for valid byte count */
757 if (ByteCount < ACPI_PLD_REV1_BUFFER_SIZE)
762 /* Convert _PLD buffer to local _PLD struct */
764 Status = AcpiDecodePldBuffer (ByteData, ByteCount, &PldInfo);
765 if (ACPI_FAILURE (Status))
772 /* First 32-bit dword */
774 AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Revision", PldInfo->Revision);
775 AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_IgnoreColor", PldInfo->IgnoreColor);
776 AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Red", PldInfo->Red);
777 AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Green", PldInfo->Green);
778 AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Blue", PldInfo->Blue);
780 /* Second 32-bit dword */
782 AcpiOsPrintf (ACPI_PLD_OUTPUT16, "PLD_Width", PldInfo->Width);
783 AcpiOsPrintf (ACPI_PLD_OUTPUT16, "PLD_Height", PldInfo->Height);
785 /* Third 32-bit dword */
787 AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_UserVisible", PldInfo->UserVisible);
788 AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Dock", PldInfo->Dock);
789 AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Lid", PldInfo->Lid);
790 AcpiOsPrintf (ACPI_PLD_OUTPUTSTR, "PLD_Panel",
791 AcpiDmFindNameByIndex(PldInfo->Panel, AcpiGbl_PldPanelList));
793 AcpiOsPrintf (ACPI_PLD_OUTPUTSTR, "PLD_VerticalPosition",
794 AcpiDmFindNameByIndex(PldInfo->VerticalPosition, AcpiGbl_PldVerticalPositionList));
796 AcpiOsPrintf (ACPI_PLD_OUTPUTSTR, "PLD_HorizontalPosition",
797 AcpiDmFindNameByIndex(PldInfo->HorizontalPosition, AcpiGbl_PldHorizontalPositionList));
799 AcpiOsPrintf (ACPI_PLD_OUTPUTSTR, "PLD_Shape",
800 AcpiDmFindNameByIndex(PldInfo->Shape, AcpiGbl_PldShapeList));
801 AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_GroupOrientation", PldInfo->GroupOrientation);
803 AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_GroupToken", PldInfo->GroupToken);
804 AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_GroupPosition", PldInfo->GroupPosition);
805 AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Bay", PldInfo->Bay);
807 /* Fourth 32-bit dword */
809 AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Ejectable", PldInfo->Ejectable);
810 AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_EjectRequired", PldInfo->OspmEjectRequired);
811 AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_CabinetNumber", PldInfo->CabinetNumber);
812 AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_CardCageNumber", PldInfo->CardCageNumber);
813 AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Reference", PldInfo->Reference);
814 AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Rotation", PldInfo->Rotation);
816 if (ByteCount >= ACPI_PLD_REV2_BUFFER_SIZE)
818 AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Order", PldInfo->Order);
820 /* Fifth 32-bit dword */
822 AcpiOsPrintf (ACPI_PLD_OUTPUT16, "PLD_VerticalOffset", PldInfo->VerticalOffset);
823 AcpiOsPrintf (ACPI_PLD_OUTPUT16P, "PLD_HorizontalOffset", PldInfo->HorizontalOffset);
825 else /* Rev 1 buffer */
827 AcpiOsPrintf (ACPI_PLD_OUTPUT08P, "PLD_Order", PldInfo->Order);
834 /*******************************************************************************
836 * FUNCTION: AcpiDmUnicode
838 * PARAMETERS: Op - Byte List op containing Unicode string
842 * DESCRIPTION: Dump Unicode string as a standard ASCII string. (Remove
843 * the extra zero bytes).
845 ******************************************************************************/
849 ACPI_PARSE_OBJECT *Op)
857 /* Extract the buffer info as a WORD buffer */
859 WordData = ACPI_CAST_PTR (UINT16, Op->Named.Data);
860 WordCount = ACPI_DIV_2 (((UINT32) Op->Common.Value.Integer));
862 /* Write every other byte as an ASCII character */
865 for (i = 0; i < (WordCount - 1); i++)
867 OutputValue = (int) WordData[i];
869 /* Handle values that must be escaped */
871 if ((OutputValue == '\"') ||
872 (OutputValue == '\\'))
874 AcpiOsPrintf ("\\%c", OutputValue);
876 else if (!isprint (OutputValue))
878 AcpiOsPrintf ("\\x%2.2X", OutputValue);
882 AcpiOsPrintf ("%c", OutputValue);
886 AcpiOsPrintf ("\")");
890 /*******************************************************************************
892 * FUNCTION: AcpiDmGetHardwareIdType
894 * PARAMETERS: Op - Op to be examined
898 * DESCRIPTION: Determine the type of the argument to a _HID or _CID
899 * 1) Strings are allowed
900 * 2) If Integer, determine if it is a valid EISAID
902 ******************************************************************************/
905 AcpiDmGetHardwareIdType (
906 ACPI_PARSE_OBJECT *Op)
913 switch (Op->Common.AmlOpcode)
917 /* Mark this string as an _HID/_CID string */
919 Op->Common.DisasmOpcode = ACPI_DASM_HID_STRING;
925 /* Determine if a Word/Dword is a valid encoded EISAID */
927 /* Swap from little-endian to big-endian to simplify conversion */
929 BigEndianId = AcpiUtDwordByteSwap ((UINT32) Op->Common.Value.Integer);
931 /* Create the 3 leading ASCII letters */
933 Prefix[0] = ((BigEndianId >> 26) & 0x1F) + 0x40;
934 Prefix[1] = ((BigEndianId >> 21) & 0x1F) + 0x40;
935 Prefix[2] = ((BigEndianId >> 16) & 0x1F) + 0x40;
937 /* Verify that all 3 are ascii and alpha */
939 for (i = 0; i < 3; i++)
941 if (!ACPI_IS_ASCII (Prefix[i]) ||
942 !isalpha (Prefix[i]))
948 /* Mark this node as convertable to an EISA ID string */
950 Op->Common.DisasmOpcode = ACPI_DASM_EISAID;
959 /*******************************************************************************
961 * FUNCTION: AcpiDmCheckForHardwareId
963 * PARAMETERS: Op - Op to be examined
967 * DESCRIPTION: Determine if a Name() Op is a _HID/_CID.
969 ******************************************************************************/
972 AcpiDmCheckForHardwareId (
973 ACPI_PARSE_OBJECT *Op)
976 ACPI_PARSE_OBJECT *NextOp;
979 /* Get the NameSegment */
981 Name = AcpiPsGetName (Op);
987 NextOp = AcpiPsGetDepthNext (NULL, Op);
993 /* Check for _HID - has one argument */
995 if (ACPI_COMPARE_NAME (&Name, METHOD_NAME__HID))
997 AcpiDmGetHardwareIdType (NextOp);
1001 /* Exit if not _CID */
1003 if (!ACPI_COMPARE_NAME (&Name, METHOD_NAME__CID))
1008 /* _CID can contain a single argument or a package */
1010 if (NextOp->Common.AmlOpcode != AML_PACKAGE_OP)
1012 AcpiDmGetHardwareIdType (NextOp);
1016 /* _CID with Package: get the package length, check all elements */
1018 NextOp = AcpiPsGetDepthNext (NULL, NextOp);
1024 /* Don't need to use the length, just walk the peer list */
1026 NextOp = NextOp->Common.Next;
1029 AcpiDmGetHardwareIdType (NextOp);
1030 NextOp = NextOp->Common.Next;
1035 /*******************************************************************************
1037 * FUNCTION: AcpiDmDecompressEisaId
1039 * PARAMETERS: EncodedId - Raw encoded EISA ID.
1043 * DESCRIPTION: Convert an encoded EISAID back to the original ASCII String
1044 * and emit the correct ASL statement. If the ID is known, emit
1045 * a description of the ID as a comment.
1047 ******************************************************************************/
1050 AcpiDmDecompressEisaId (
1053 char IdBuffer[ACPI_EISAID_STRING_SIZE];
1054 const AH_DEVICE_ID *Info;
1057 /* Convert EISAID to a string an emit the statement */
1059 AcpiExEisaIdToString (IdBuffer, EncodedId);
1060 AcpiOsPrintf ("EisaId (\"%s\")", IdBuffer);
1062 /* If we know about the ID, emit the description */
1064 Info = AcpiAhMatchHardwareId (IdBuffer);
1067 AcpiOsPrintf (" /* %s */", Info->Description);