Home | History | Annotate | Line # | Download | only in disassembler
dmbuffer.c revision 1.1.1.4
      1      1.1    jruoho /*******************************************************************************
      2      1.1    jruoho  *
      3      1.1    jruoho  * Module Name: dmbuffer - AML disassembler, buffer and string support
      4      1.1    jruoho  *
      5      1.1    jruoho  ******************************************************************************/
      6      1.1    jruoho 
      7  1.1.1.2    jruoho /*
      8  1.1.1.4  christos  * Copyright (C) 2000 - 2014, Intel Corp.
      9      1.1    jruoho  * All rights reserved.
     10      1.1    jruoho  *
     11  1.1.1.2    jruoho  * Redistribution and use in source and binary forms, with or without
     12  1.1.1.2    jruoho  * modification, are permitted provided that the following conditions
     13  1.1.1.2    jruoho  * are met:
     14  1.1.1.2    jruoho  * 1. Redistributions of source code must retain the above copyright
     15  1.1.1.2    jruoho  *    notice, this list of conditions, and the following disclaimer,
     16  1.1.1.2    jruoho  *    without modification.
     17  1.1.1.2    jruoho  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     18  1.1.1.2    jruoho  *    substantially similar to the "NO WARRANTY" disclaimer below
     19  1.1.1.2    jruoho  *    ("Disclaimer") and any redistribution must be conditioned upon
     20  1.1.1.2    jruoho  *    including a substantially similar Disclaimer requirement for further
     21  1.1.1.2    jruoho  *    binary redistribution.
     22  1.1.1.2    jruoho  * 3. Neither the names of the above-listed copyright holders nor the names
     23  1.1.1.2    jruoho  *    of any contributors may be used to endorse or promote products derived
     24  1.1.1.2    jruoho  *    from this software without specific prior written permission.
     25  1.1.1.2    jruoho  *
     26  1.1.1.2    jruoho  * Alternatively, this software may be distributed under the terms of the
     27  1.1.1.2    jruoho  * GNU General Public License ("GPL") version 2 as published by the Free
     28  1.1.1.2    jruoho  * Software Foundation.
     29  1.1.1.2    jruoho  *
     30  1.1.1.2    jruoho  * NO WARRANTY
     31  1.1.1.2    jruoho  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     32  1.1.1.2    jruoho  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     33  1.1.1.2    jruoho  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
     34  1.1.1.2    jruoho  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     35  1.1.1.2    jruoho  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     36  1.1.1.2    jruoho  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     37  1.1.1.2    jruoho  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     38  1.1.1.2    jruoho  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     39  1.1.1.2    jruoho  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     40  1.1.1.2    jruoho  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     41  1.1.1.2    jruoho  * POSSIBILITY OF SUCH DAMAGES.
     42  1.1.1.2    jruoho  */
     43      1.1    jruoho 
     44      1.1    jruoho #include "acpi.h"
     45      1.1    jruoho #include "accommon.h"
     46  1.1.1.4  christos #include "acutils.h"
     47      1.1    jruoho #include "acdisasm.h"
     48      1.1    jruoho #include "acparser.h"
     49      1.1    jruoho #include "amlcode.h"
     50  1.1.1.4  christos #include "acinterp.h"
     51      1.1    jruoho 
     52      1.1    jruoho 
     53      1.1    jruoho #ifdef ACPI_DISASSEMBLER
     54      1.1    jruoho 
     55      1.1    jruoho #define _COMPONENT          ACPI_CA_DEBUGGER
     56      1.1    jruoho         ACPI_MODULE_NAME    ("dmbuffer")
     57      1.1    jruoho 
     58      1.1    jruoho /* Local prototypes */
     59      1.1    jruoho 
     60      1.1    jruoho static void
     61  1.1.1.4  christos AcpiDmUuid (
     62  1.1.1.4  christos     ACPI_PARSE_OBJECT       *Op);
     63  1.1.1.4  christos 
     64  1.1.1.4  christos static void
     65      1.1    jruoho AcpiDmUnicode (
     66      1.1    jruoho     ACPI_PARSE_OBJECT       *Op);
     67      1.1    jruoho 
     68      1.1    jruoho static void
     69  1.1.1.4  christos AcpiDmGetHardwareIdType (
     70      1.1    jruoho     ACPI_PARSE_OBJECT       *Op);
     71      1.1    jruoho 
     72  1.1.1.3  christos static void
     73  1.1.1.3  christos AcpiDmPldBuffer (
     74  1.1.1.3  christos     UINT32                  Level,
     75  1.1.1.3  christos     UINT8                   *ByteData,
     76  1.1.1.3  christos     UINT32                  ByteCount);
     77  1.1.1.3  christos 
     78      1.1    jruoho 
     79  1.1.1.4  christos #define ACPI_BUFFER_BYTES_PER_LINE      8
     80  1.1.1.4  christos 
     81  1.1.1.4  christos 
     82      1.1    jruoho /*******************************************************************************
     83      1.1    jruoho  *
     84      1.1    jruoho  * FUNCTION:    AcpiDmDisasmByteList
     85      1.1    jruoho  *
     86      1.1    jruoho  * PARAMETERS:  Level               - Current source code indentation level
     87      1.1    jruoho  *              ByteData            - Pointer to the byte list
     88      1.1    jruoho  *              ByteCount           - Length of the byte list
     89      1.1    jruoho  *
     90      1.1    jruoho  * RETURN:      None
     91      1.1    jruoho  *
     92      1.1    jruoho  * DESCRIPTION: Dump an AML "ByteList" in Hex format. 8 bytes per line, prefixed
     93      1.1    jruoho  *              with the hex buffer offset.
     94      1.1    jruoho  *
     95      1.1    jruoho  ******************************************************************************/
     96      1.1    jruoho 
     97      1.1    jruoho void
     98      1.1    jruoho AcpiDmDisasmByteList (
     99      1.1    jruoho     UINT32                  Level,
    100      1.1    jruoho     UINT8                   *ByteData,
    101      1.1    jruoho     UINT32                  ByteCount)
    102      1.1    jruoho {
    103      1.1    jruoho     UINT32                  i;
    104  1.1.1.4  christos     UINT32                  j;
    105  1.1.1.4  christos     UINT32                  CurrentIndex;
    106  1.1.1.4  christos     UINT8                   BufChar;
    107      1.1    jruoho 
    108      1.1    jruoho 
    109      1.1    jruoho     if (!ByteCount)
    110      1.1    jruoho     {
    111      1.1    jruoho         return;
    112      1.1    jruoho     }
    113      1.1    jruoho 
    114  1.1.1.4  christos     for (i = 0; i < ByteCount; i += ACPI_BUFFER_BYTES_PER_LINE)
    115      1.1    jruoho     {
    116  1.1.1.4  christos         /* Line indent and offset prefix for each new line */
    117  1.1.1.4  christos 
    118  1.1.1.4  christos         AcpiDmIndent (Level);
    119  1.1.1.4  christos         if (ByteCount > ACPI_BUFFER_BYTES_PER_LINE)
    120  1.1.1.4  christos         {
    121  1.1.1.4  christos             AcpiOsPrintf ("/* %04X */ ", i);
    122  1.1.1.4  christos         }
    123  1.1.1.4  christos 
    124  1.1.1.4  christos         /* Dump the actual hex values */
    125      1.1    jruoho 
    126  1.1.1.4  christos         for (j = 0; j < ACPI_BUFFER_BYTES_PER_LINE; j++)
    127      1.1    jruoho         {
    128  1.1.1.4  christos             CurrentIndex = i + j;
    129  1.1.1.4  christos             if (CurrentIndex >= ByteCount)
    130      1.1    jruoho             {
    131  1.1.1.4  christos                 /* Dump fill spaces */
    132  1.1.1.4  christos 
    133  1.1.1.4  christos                 AcpiOsPrintf ("      ");
    134  1.1.1.4  christos                 continue;
    135      1.1    jruoho             }
    136      1.1    jruoho 
    137  1.1.1.4  christos             AcpiOsPrintf (" 0x%2.2X", ByteData[CurrentIndex]);
    138  1.1.1.4  christos 
    139  1.1.1.4  christos             /* Add comma if there are more bytes to display */
    140  1.1.1.4  christos 
    141  1.1.1.4  christos             if (CurrentIndex < (ByteCount - 1))
    142      1.1    jruoho             {
    143  1.1.1.4  christos                 AcpiOsPrintf (",");
    144  1.1.1.4  christos             }
    145  1.1.1.4  christos             else
    146  1.1.1.4  christos             {
    147  1.1.1.4  christos                 AcpiOsPrintf (" ");
    148      1.1    jruoho             }
    149      1.1    jruoho         }
    150      1.1    jruoho 
    151  1.1.1.4  christos         /* Dump the ASCII equivalents within a comment */
    152      1.1    jruoho 
    153  1.1.1.4  christos         AcpiOsPrintf ("  /* ");
    154  1.1.1.4  christos         for (j = 0; j < ACPI_BUFFER_BYTES_PER_LINE; j++)
    155      1.1    jruoho         {
    156  1.1.1.4  christos             CurrentIndex = i + j;
    157  1.1.1.4  christos             if (CurrentIndex >= ByteCount)
    158  1.1.1.4  christos             {
    159  1.1.1.4  christos                 break;
    160  1.1.1.4  christos             }
    161  1.1.1.4  christos 
    162  1.1.1.4  christos             BufChar = ByteData[CurrentIndex];
    163  1.1.1.4  christos             if (ACPI_IS_PRINT (BufChar))
    164  1.1.1.4  christos             {
    165  1.1.1.4  christos                 AcpiOsPrintf ("%c", BufChar);
    166  1.1.1.4  christos             }
    167  1.1.1.4  christos             else
    168  1.1.1.4  christos             {
    169  1.1.1.4  christos                 AcpiOsPrintf (".");
    170  1.1.1.4  christos             }
    171      1.1    jruoho         }
    172      1.1    jruoho 
    173  1.1.1.4  christos         /* Finished with this line */
    174  1.1.1.4  christos 
    175  1.1.1.4  christos         AcpiOsPrintf (" */\n");
    176      1.1    jruoho     }
    177      1.1    jruoho }
    178      1.1    jruoho 
    179      1.1    jruoho 
    180      1.1    jruoho /*******************************************************************************
    181      1.1    jruoho  *
    182      1.1    jruoho  * FUNCTION:    AcpiDmByteList
    183      1.1    jruoho  *
    184      1.1    jruoho  * PARAMETERS:  Info            - Parse tree walk info
    185      1.1    jruoho  *              Op              - Byte list op
    186      1.1    jruoho  *
    187      1.1    jruoho  * RETURN:      None
    188      1.1    jruoho  *
    189      1.1    jruoho  * DESCRIPTION: Dump a buffer byte list, handling the various types of buffers.
    190      1.1    jruoho  *              Buffer type must be already set in the Op DisasmOpcode.
    191      1.1    jruoho  *
    192      1.1    jruoho  ******************************************************************************/
    193      1.1    jruoho 
    194      1.1    jruoho void
    195      1.1    jruoho AcpiDmByteList (
    196      1.1    jruoho     ACPI_OP_WALK_INFO       *Info,
    197      1.1    jruoho     ACPI_PARSE_OBJECT       *Op)
    198      1.1    jruoho {
    199      1.1    jruoho     UINT8                   *ByteData;
    200      1.1    jruoho     UINT32                  ByteCount;
    201      1.1    jruoho 
    202      1.1    jruoho 
    203      1.1    jruoho     ByteData = Op->Named.Data;
    204      1.1    jruoho     ByteCount = (UINT32) Op->Common.Value.Integer;
    205      1.1    jruoho 
    206      1.1    jruoho     /*
    207      1.1    jruoho      * The byte list belongs to a buffer, and can be produced by either
    208      1.1    jruoho      * a ResourceTemplate, Unicode, quoted string, or a plain byte list.
    209      1.1    jruoho      */
    210      1.1    jruoho     switch (Op->Common.Parent->Common.DisasmOpcode)
    211      1.1    jruoho     {
    212      1.1    jruoho     case ACPI_DASM_RESOURCE:
    213      1.1    jruoho 
    214      1.1    jruoho         AcpiDmResourceTemplate (Info, Op->Common.Parent, ByteData, ByteCount);
    215      1.1    jruoho         break;
    216      1.1    jruoho 
    217      1.1    jruoho     case ACPI_DASM_STRING:
    218      1.1    jruoho 
    219      1.1    jruoho         AcpiDmIndent (Info->Level);
    220  1.1.1.3  christos         AcpiUtPrintString ((char *) ByteData, ACPI_UINT16_MAX);
    221      1.1    jruoho         AcpiOsPrintf ("\n");
    222      1.1    jruoho         break;
    223      1.1    jruoho 
    224  1.1.1.4  christos     case ACPI_DASM_UUID:
    225  1.1.1.4  christos 
    226  1.1.1.4  christos         AcpiDmUuid (Op);
    227  1.1.1.4  christos         break;
    228  1.1.1.4  christos 
    229      1.1    jruoho     case ACPI_DASM_UNICODE:
    230      1.1    jruoho 
    231      1.1    jruoho         AcpiDmUnicode (Op);
    232      1.1    jruoho         break;
    233      1.1    jruoho 
    234  1.1.1.3  christos     case ACPI_DASM_PLD_METHOD:
    235  1.1.1.3  christos 
    236  1.1.1.3  christos         AcpiDmDisasmByteList (Info->Level, ByteData, ByteCount);
    237  1.1.1.3  christos         AcpiDmPldBuffer (Info->Level, ByteData, ByteCount);
    238  1.1.1.3  christos         break;
    239  1.1.1.3  christos 
    240      1.1    jruoho     case ACPI_DASM_BUFFER:
    241      1.1    jruoho     default:
    242      1.1    jruoho         /*
    243      1.1    jruoho          * Not a resource, string, or unicode string.
    244      1.1    jruoho          * Just dump the buffer
    245      1.1    jruoho          */
    246      1.1    jruoho         AcpiDmDisasmByteList (Info->Level, ByteData, ByteCount);
    247      1.1    jruoho         break;
    248      1.1    jruoho     }
    249      1.1    jruoho }
    250      1.1    jruoho 
    251      1.1    jruoho 
    252      1.1    jruoho /*******************************************************************************
    253      1.1    jruoho  *
    254  1.1.1.4  christos  * FUNCTION:    AcpiDmIsUuidBuffer
    255  1.1.1.4  christos  *
    256  1.1.1.4  christos  * PARAMETERS:  Op              - Buffer Object to be examined
    257  1.1.1.4  christos  *
    258  1.1.1.4  christos  * RETURN:      TRUE if buffer contains a UUID
    259  1.1.1.4  christos  *
    260  1.1.1.4  christos  * DESCRIPTION: Determine if a buffer Op contains a UUID
    261  1.1.1.4  christos  *
    262  1.1.1.4  christos  * To help determine whether the buffer is a UUID versus a raw data buffer,
    263  1.1.1.4  christos  * there a are a couple bytes we can look at:
    264  1.1.1.4  christos  *
    265  1.1.1.4  christos  *    xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx
    266  1.1.1.4  christos  *
    267  1.1.1.4  christos  * The variant covered by the UUID specification is indicated by the two most
    268  1.1.1.4  christos  * significant bits of N being 1 0 (i.e., the hexadecimal N will always be
    269  1.1.1.4  christos  * 8, 9, A, or B).
    270  1.1.1.4  christos  *
    271  1.1.1.4  christos  * The variant covered by the UUID specification has five versions. For this
    272  1.1.1.4  christos  * variant, the four bits of M indicates the UUID version (i.e., the
    273  1.1.1.4  christos  * hexadecimal M will be either 1, 2, 3, 4, or 5).
    274  1.1.1.4  christos  *
    275  1.1.1.4  christos  ******************************************************************************/
    276  1.1.1.4  christos 
    277  1.1.1.4  christos BOOLEAN
    278  1.1.1.4  christos AcpiDmIsUuidBuffer (
    279  1.1.1.4  christos     ACPI_PARSE_OBJECT       *Op)
    280  1.1.1.4  christos {
    281  1.1.1.4  christos     UINT8                   *ByteData;
    282  1.1.1.4  christos     UINT32                  ByteCount;
    283  1.1.1.4  christos     ACPI_PARSE_OBJECT       *SizeOp;
    284  1.1.1.4  christos     ACPI_PARSE_OBJECT       *NextOp;
    285  1.1.1.4  christos 
    286  1.1.1.4  christos 
    287  1.1.1.4  christos     /* Buffer size is the buffer argument */
    288  1.1.1.4  christos 
    289  1.1.1.4  christos     SizeOp = Op->Common.Value.Arg;
    290  1.1.1.4  christos 
    291  1.1.1.4  christos     /* Next, the initializer byte list to examine */
    292  1.1.1.4  christos 
    293  1.1.1.4  christos     NextOp = SizeOp->Common.Next;
    294  1.1.1.4  christos     if (!NextOp)
    295  1.1.1.4  christos     {
    296  1.1.1.4  christos         return (FALSE);
    297  1.1.1.4  christos     }
    298  1.1.1.4  christos 
    299  1.1.1.4  christos     /* Extract the byte list info */
    300  1.1.1.4  christos 
    301  1.1.1.4  christos     ByteData = NextOp->Named.Data;
    302  1.1.1.4  christos     ByteCount = (UINT32) NextOp->Common.Value.Integer;
    303  1.1.1.4  christos 
    304  1.1.1.4  christos     /* Byte count must be exactly 16 */
    305  1.1.1.4  christos 
    306  1.1.1.4  christos     if (ByteCount != UUID_BUFFER_LENGTH)
    307  1.1.1.4  christos     {
    308  1.1.1.4  christos         return (FALSE);
    309  1.1.1.4  christos     }
    310  1.1.1.4  christos 
    311  1.1.1.4  christos     /* Check for valid "M" and "N" values (see function header above) */
    312  1.1.1.4  christos 
    313  1.1.1.4  christos     if (((ByteData[7] & 0xF0) == 0x00) || /* M={1,2,3,4,5} */
    314  1.1.1.4  christos         ((ByteData[7] & 0xF0) > 0x50)  ||
    315  1.1.1.4  christos         ((ByteData[8] & 0xF0) < 0x80)  || /* N={8,9,A,B} */
    316  1.1.1.4  christos         ((ByteData[8] & 0xF0) > 0xB0))
    317  1.1.1.4  christos     {
    318  1.1.1.4  christos         return (FALSE);
    319  1.1.1.4  christos     }
    320  1.1.1.4  christos 
    321  1.1.1.4  christos     /* Ignore the Size argument in the disassembly of this buffer op */
    322  1.1.1.4  christos 
    323  1.1.1.4  christos     SizeOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
    324  1.1.1.4  christos     return (TRUE);
    325  1.1.1.4  christos }
    326  1.1.1.4  christos 
    327  1.1.1.4  christos 
    328  1.1.1.4  christos /*******************************************************************************
    329  1.1.1.4  christos  *
    330  1.1.1.4  christos  * FUNCTION:    AcpiDmUuid
    331  1.1.1.4  christos  *
    332  1.1.1.4  christos  * PARAMETERS:  Op              - Byte List op containing a UUID
    333  1.1.1.4  christos  *
    334  1.1.1.4  christos  * RETURN:      None
    335  1.1.1.4  christos  *
    336  1.1.1.4  christos  * DESCRIPTION: Dump a buffer containing a UUID as a standard ASCII string.
    337  1.1.1.4  christos  *
    338  1.1.1.4  christos  * Output Format:
    339  1.1.1.4  christos  * In its canonical form, the UUID is represented by a string containing 32
    340  1.1.1.4  christos  * lowercase hexadecimal digits, displayed in 5 groups separated by hyphens.
    341  1.1.1.4  christos  * The complete form is 8-4-4-4-12 for a total of 36 characters (32
    342  1.1.1.4  christos  * alphanumeric characters representing hex digits and 4 hyphens). In bytes,
    343  1.1.1.4  christos  * 4-2-2-2-6. Example:
    344  1.1.1.4  christos  *
    345  1.1.1.4  christos  *    ToUUID ("107ededd-d381-4fd7-8da9-08e9a6c79644")
    346  1.1.1.4  christos  *
    347  1.1.1.4  christos  ******************************************************************************/
    348  1.1.1.4  christos 
    349  1.1.1.4  christos static void
    350  1.1.1.4  christos AcpiDmUuid (
    351  1.1.1.4  christos     ACPI_PARSE_OBJECT       *Op)
    352  1.1.1.4  christos {
    353  1.1.1.4  christos     UINT8                   *Data;
    354  1.1.1.4  christos     const char              *Description;
    355  1.1.1.4  christos 
    356  1.1.1.4  christos 
    357  1.1.1.4  christos     Data = ACPI_CAST_PTR (UINT8, Op->Named.Data);
    358  1.1.1.4  christos 
    359  1.1.1.4  christos     /* Emit the 36-byte UUID string in the proper format/order */
    360  1.1.1.4  christos 
    361  1.1.1.4  christos     AcpiOsPrintf (
    362  1.1.1.4  christos         "\"%2.2x%2.2x%2.2x%2.2x-"
    363  1.1.1.4  christos         "%2.2x%2.2x-"
    364  1.1.1.4  christos         "%2.2x%2.2x-"
    365  1.1.1.4  christos         "%2.2x%2.2x-"
    366  1.1.1.4  christos         "%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x\")",
    367  1.1.1.4  christos         Data[3], Data[2], Data[1], Data[0],
    368  1.1.1.4  christos         Data[5], Data[4],
    369  1.1.1.4  christos         Data[7], Data[6],
    370  1.1.1.4  christos         Data[8], Data[9],
    371  1.1.1.4  christos         Data[10], Data[11], Data[12], Data[13], Data[14], Data[15]);
    372  1.1.1.4  christos 
    373  1.1.1.4  christos     /* Dump the UUID description string if available */
    374  1.1.1.4  christos 
    375  1.1.1.4  christos     Description = AcpiAhMatchUuid (Data);
    376  1.1.1.4  christos     if (Description)
    377  1.1.1.4  christos     {
    378  1.1.1.4  christos         AcpiOsPrintf (" /* %s */", Description);
    379  1.1.1.4  christos     }
    380  1.1.1.4  christos }
    381  1.1.1.4  christos 
    382  1.1.1.4  christos 
    383  1.1.1.4  christos /*******************************************************************************
    384  1.1.1.4  christos  *
    385      1.1    jruoho  * FUNCTION:    AcpiDmIsUnicodeBuffer
    386      1.1    jruoho  *
    387      1.1    jruoho  * PARAMETERS:  Op              - Buffer Object to be examined
    388      1.1    jruoho  *
    389      1.1    jruoho  * RETURN:      TRUE if buffer contains a UNICODE string
    390      1.1    jruoho  *
    391      1.1    jruoho  * DESCRIPTION: Determine if a buffer Op contains a Unicode string
    392      1.1    jruoho  *
    393      1.1    jruoho  ******************************************************************************/
    394      1.1    jruoho 
    395      1.1    jruoho BOOLEAN
    396      1.1    jruoho AcpiDmIsUnicodeBuffer (
    397      1.1    jruoho     ACPI_PARSE_OBJECT       *Op)
    398      1.1    jruoho {
    399      1.1    jruoho     UINT8                   *ByteData;
    400      1.1    jruoho     UINT32                  ByteCount;
    401      1.1    jruoho     UINT32                  WordCount;
    402      1.1    jruoho     ACPI_PARSE_OBJECT       *SizeOp;
    403      1.1    jruoho     ACPI_PARSE_OBJECT       *NextOp;
    404      1.1    jruoho     UINT32                  i;
    405      1.1    jruoho 
    406      1.1    jruoho 
    407      1.1    jruoho     /* Buffer size is the buffer argument */
    408      1.1    jruoho 
    409      1.1    jruoho     SizeOp = Op->Common.Value.Arg;
    410      1.1    jruoho 
    411      1.1    jruoho     /* Next, the initializer byte list to examine */
    412      1.1    jruoho 
    413      1.1    jruoho     NextOp = SizeOp->Common.Next;
    414      1.1    jruoho     if (!NextOp)
    415      1.1    jruoho     {
    416      1.1    jruoho         return (FALSE);
    417      1.1    jruoho     }
    418      1.1    jruoho 
    419      1.1    jruoho     /* Extract the byte list info */
    420      1.1    jruoho 
    421      1.1    jruoho     ByteData = NextOp->Named.Data;
    422      1.1    jruoho     ByteCount = (UINT32) NextOp->Common.Value.Integer;
    423      1.1    jruoho     WordCount = ACPI_DIV_2 (ByteCount);
    424      1.1    jruoho 
    425      1.1    jruoho     /*
    426      1.1    jruoho      * Unicode string must have an even number of bytes and last
    427      1.1    jruoho      * word must be zero
    428      1.1    jruoho      */
    429      1.1    jruoho     if ((!ByteCount)     ||
    430      1.1    jruoho          (ByteCount < 4) ||
    431      1.1    jruoho          (ByteCount & 1) ||
    432      1.1    jruoho         ((UINT16 *) (void *) ByteData)[WordCount - 1] != 0)
    433      1.1    jruoho     {
    434      1.1    jruoho         return (FALSE);
    435      1.1    jruoho     }
    436      1.1    jruoho 
    437      1.1    jruoho     /* For each word, 1st byte must be ascii, 2nd byte must be zero */
    438      1.1    jruoho 
    439      1.1    jruoho     for (i = 0; i < (ByteCount - 2); i += 2)
    440      1.1    jruoho     {
    441      1.1    jruoho         if ((!ACPI_IS_PRINT (ByteData[i])) ||
    442      1.1    jruoho             (ByteData[(ACPI_SIZE) i + 1] != 0))
    443      1.1    jruoho         {
    444      1.1    jruoho             return (FALSE);
    445      1.1    jruoho         }
    446      1.1    jruoho     }
    447      1.1    jruoho 
    448      1.1    jruoho     /* Ignore the Size argument in the disassembly of this buffer op */
    449      1.1    jruoho 
    450      1.1    jruoho     SizeOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
    451      1.1    jruoho     return (TRUE);
    452      1.1    jruoho }
    453      1.1    jruoho 
    454      1.1    jruoho 
    455      1.1    jruoho /*******************************************************************************
    456      1.1    jruoho  *
    457      1.1    jruoho  * FUNCTION:    AcpiDmIsStringBuffer
    458      1.1    jruoho  *
    459      1.1    jruoho  * PARAMETERS:  Op              - Buffer Object to be examined
    460      1.1    jruoho  *
    461      1.1    jruoho  * RETURN:      TRUE if buffer contains a ASCII string, FALSE otherwise
    462      1.1    jruoho  *
    463      1.1    jruoho  * DESCRIPTION: Determine if a buffer Op contains a ASCII string
    464      1.1    jruoho  *
    465      1.1    jruoho  ******************************************************************************/
    466      1.1    jruoho 
    467      1.1    jruoho BOOLEAN
    468      1.1    jruoho AcpiDmIsStringBuffer (
    469      1.1    jruoho     ACPI_PARSE_OBJECT       *Op)
    470      1.1    jruoho {
    471      1.1    jruoho     UINT8                   *ByteData;
    472      1.1    jruoho     UINT32                  ByteCount;
    473      1.1    jruoho     ACPI_PARSE_OBJECT       *SizeOp;
    474      1.1    jruoho     ACPI_PARSE_OBJECT       *NextOp;
    475      1.1    jruoho     UINT32                  i;
    476      1.1    jruoho 
    477      1.1    jruoho 
    478      1.1    jruoho     /* Buffer size is the buffer argument */
    479      1.1    jruoho 
    480      1.1    jruoho     SizeOp = Op->Common.Value.Arg;
    481      1.1    jruoho 
    482      1.1    jruoho     /* Next, the initializer byte list to examine */
    483      1.1    jruoho 
    484      1.1    jruoho     NextOp = SizeOp->Common.Next;
    485      1.1    jruoho     if (!NextOp)
    486      1.1    jruoho     {
    487      1.1    jruoho         return (FALSE);
    488      1.1    jruoho     }
    489      1.1    jruoho 
    490      1.1    jruoho     /* Extract the byte list info */
    491      1.1    jruoho 
    492      1.1    jruoho     ByteData = NextOp->Named.Data;
    493      1.1    jruoho     ByteCount = (UINT32) NextOp->Common.Value.Integer;
    494      1.1    jruoho 
    495      1.1    jruoho     /* Last byte must be the null terminator */
    496      1.1    jruoho 
    497      1.1    jruoho     if ((!ByteCount)     ||
    498      1.1    jruoho          (ByteCount < 2) ||
    499      1.1    jruoho          (ByteData[ByteCount-1] != 0))
    500      1.1    jruoho     {
    501      1.1    jruoho         return (FALSE);
    502      1.1    jruoho     }
    503      1.1    jruoho 
    504      1.1    jruoho     for (i = 0; i < (ByteCount - 1); i++)
    505      1.1    jruoho     {
    506      1.1    jruoho         /* TBD: allow some escapes (non-ascii chars).
    507      1.1    jruoho          * they will be handled in the string output routine
    508      1.1    jruoho          */
    509      1.1    jruoho 
    510      1.1    jruoho         if (!ACPI_IS_PRINT (ByteData[i]))
    511      1.1    jruoho         {
    512      1.1    jruoho             return (FALSE);
    513      1.1    jruoho         }
    514      1.1    jruoho     }
    515      1.1    jruoho 
    516      1.1    jruoho     return (TRUE);
    517      1.1    jruoho }
    518      1.1    jruoho 
    519      1.1    jruoho 
    520      1.1    jruoho /*******************************************************************************
    521      1.1    jruoho  *
    522  1.1.1.3  christos  * FUNCTION:    AcpiDmIsPldBuffer
    523  1.1.1.3  christos  *
    524  1.1.1.3  christos  * PARAMETERS:  Op                  - Buffer Object to be examined
    525  1.1.1.3  christos  *
    526  1.1.1.3  christos  * RETURN:      TRUE if buffer contains a ASCII string, FALSE otherwise
    527  1.1.1.3  christos  *
    528  1.1.1.3  christos  * DESCRIPTION: Determine if a buffer Op contains a _PLD structure
    529  1.1.1.3  christos  *
    530  1.1.1.3  christos  ******************************************************************************/
    531  1.1.1.3  christos 
    532  1.1.1.3  christos BOOLEAN
    533  1.1.1.3  christos AcpiDmIsPldBuffer (
    534  1.1.1.3  christos     ACPI_PARSE_OBJECT       *Op)
    535  1.1.1.3  christos {
    536  1.1.1.3  christos     ACPI_NAMESPACE_NODE     *Node;
    537  1.1.1.3  christos     ACPI_PARSE_OBJECT       *ParentOp;
    538  1.1.1.3  christos 
    539  1.1.1.3  christos 
    540  1.1.1.3  christos     ParentOp = Op->Common.Parent;
    541  1.1.1.3  christos     if (!ParentOp)
    542  1.1.1.3  christos     {
    543  1.1.1.3  christos         return (FALSE);
    544  1.1.1.3  christos     }
    545  1.1.1.3  christos 
    546  1.1.1.3  christos     /* Check for form: Name(_PLD, Buffer() {}). Not legal, however */
    547  1.1.1.3  christos 
    548  1.1.1.3  christos     if (ParentOp->Common.AmlOpcode == AML_NAME_OP)
    549  1.1.1.3  christos     {
    550  1.1.1.3  christos         Node = ParentOp->Common.Node;
    551  1.1.1.3  christos 
    552  1.1.1.3  christos         if (ACPI_COMPARE_NAME (Node->Name.Ascii, METHOD_NAME__PLD))
    553  1.1.1.3  christos         {
    554  1.1.1.3  christos             return (TRUE);
    555  1.1.1.3  christos         }
    556  1.1.1.3  christos 
    557  1.1.1.3  christos         return (FALSE);
    558  1.1.1.3  christos     }
    559  1.1.1.3  christos 
    560  1.1.1.3  christos     /* Check for proper form: Name(_PLD, Package() {Buffer() {}}) */
    561  1.1.1.3  christos 
    562  1.1.1.3  christos     if (ParentOp->Common.AmlOpcode == AML_PACKAGE_OP)
    563  1.1.1.3  christos     {
    564  1.1.1.3  christos         ParentOp = ParentOp->Common.Parent;
    565  1.1.1.3  christos         if (!ParentOp)
    566  1.1.1.3  christos         {
    567  1.1.1.3  christos             return (FALSE);
    568  1.1.1.3  christos         }
    569  1.1.1.3  christos 
    570  1.1.1.3  christos         if (ParentOp->Common.AmlOpcode == AML_NAME_OP)
    571  1.1.1.3  christos         {
    572  1.1.1.3  christos             Node = ParentOp->Common.Node;
    573  1.1.1.3  christos 
    574  1.1.1.3  christos             if (ACPI_COMPARE_NAME (Node->Name.Ascii, METHOD_NAME__PLD))
    575  1.1.1.3  christos             {
    576  1.1.1.3  christos                 return (TRUE);
    577  1.1.1.3  christos             }
    578  1.1.1.3  christos         }
    579  1.1.1.3  christos     }
    580  1.1.1.3  christos 
    581  1.1.1.3  christos     return (FALSE);
    582  1.1.1.3  christos }
    583  1.1.1.3  christos 
    584  1.1.1.3  christos 
    585  1.1.1.3  christos /*******************************************************************************
    586  1.1.1.3  christos  *
    587  1.1.1.3  christos  * FUNCTION:    AcpiDmPldBuffer
    588  1.1.1.3  christos  *
    589  1.1.1.3  christos  * PARAMETERS:  Level               - Current source code indentation level
    590  1.1.1.3  christos  *              ByteData            - Pointer to the byte list
    591  1.1.1.3  christos  *              ByteCount           - Length of the byte list
    592  1.1.1.3  christos  *
    593  1.1.1.3  christos  * RETURN:      None
    594  1.1.1.3  christos  *
    595  1.1.1.3  christos  * DESCRIPTION: Dump and format the contents of a _PLD buffer object
    596  1.1.1.3  christos  *
    597  1.1.1.3  christos  ******************************************************************************/
    598  1.1.1.3  christos 
    599  1.1.1.3  christos #define ACPI_PLD_OUTPUT08     "%*.s/* %18s : %-6.2X */\n", ACPI_MUL_4 (Level), " "
    600  1.1.1.3  christos #define ACPI_PLD_OUTPUT16   "%*.s/* %18s : %-6.4X */\n", ACPI_MUL_4 (Level), " "
    601  1.1.1.3  christos #define ACPI_PLD_OUTPUT24   "%*.s/* %18s : %-6.6X */\n", ACPI_MUL_4 (Level), " "
    602  1.1.1.3  christos 
    603  1.1.1.3  christos static void
    604  1.1.1.3  christos AcpiDmPldBuffer (
    605  1.1.1.3  christos     UINT32                  Level,
    606  1.1.1.3  christos     UINT8                   *ByteData,
    607  1.1.1.3  christos     UINT32                  ByteCount)
    608  1.1.1.3  christos {
    609  1.1.1.3  christos     ACPI_PLD_INFO           *PldInfo;
    610  1.1.1.3  christos     ACPI_STATUS             Status;
    611  1.1.1.3  christos 
    612  1.1.1.3  christos 
    613  1.1.1.3  christos     /* Check for valid byte count */
    614  1.1.1.3  christos 
    615  1.1.1.3  christos     if (ByteCount < ACPI_PLD_REV1_BUFFER_SIZE)
    616  1.1.1.3  christos     {
    617  1.1.1.3  christos         return;
    618  1.1.1.3  christos     }
    619  1.1.1.3  christos 
    620  1.1.1.3  christos     /* Convert _PLD buffer to local _PLD struct */
    621  1.1.1.3  christos 
    622  1.1.1.3  christos     Status = AcpiDecodePldBuffer (ByteData, ByteCount, &PldInfo);
    623  1.1.1.3  christos     if (ACPI_FAILURE (Status))
    624  1.1.1.3  christos     {
    625  1.1.1.3  christos         return;
    626  1.1.1.3  christos     }
    627  1.1.1.3  christos 
    628  1.1.1.3  christos     /* First 32-bit dword */
    629  1.1.1.3  christos 
    630  1.1.1.3  christos     AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "Revision", PldInfo->Revision);
    631  1.1.1.3  christos     AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "IgnoreColor", PldInfo->IgnoreColor);
    632  1.1.1.3  christos     AcpiOsPrintf (ACPI_PLD_OUTPUT24,"Color", PldInfo->Color);
    633  1.1.1.3  christos 
    634  1.1.1.3  christos     /* Second 32-bit dword */
    635  1.1.1.3  christos 
    636  1.1.1.3  christos     AcpiOsPrintf (ACPI_PLD_OUTPUT16,"Width", PldInfo->Width);
    637  1.1.1.3  christos     AcpiOsPrintf (ACPI_PLD_OUTPUT16,"Height", PldInfo->Height);
    638  1.1.1.3  christos 
    639  1.1.1.3  christos     /* Third 32-bit dword */
    640  1.1.1.3  christos 
    641  1.1.1.3  christos     AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "UserVisible", PldInfo->UserVisible);
    642  1.1.1.3  christos     AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "Dock", PldInfo->Dock);
    643  1.1.1.3  christos     AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "Lid", PldInfo->Lid);
    644  1.1.1.3  christos     AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "Panel", PldInfo->Panel);
    645  1.1.1.3  christos     AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "VerticalPosition", PldInfo->VerticalPosition);
    646  1.1.1.3  christos     AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "HorizontalPosition", PldInfo->HorizontalPosition);
    647  1.1.1.3  christos     AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "Shape", PldInfo->Shape);
    648  1.1.1.3  christos     AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "GroupOrientation", PldInfo->GroupOrientation);
    649  1.1.1.3  christos     AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "GroupToken", PldInfo->GroupToken);
    650  1.1.1.3  christos     AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "GroupPosition", PldInfo->GroupPosition);
    651  1.1.1.3  christos     AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "Bay", PldInfo->Bay);
    652  1.1.1.3  christos 
    653  1.1.1.3  christos     /* Fourth 32-bit dword */
    654  1.1.1.3  christos 
    655  1.1.1.3  christos     AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "Ejectable", PldInfo->Ejectable);
    656  1.1.1.3  christos     AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "OspmEjectRequired", PldInfo->OspmEjectRequired);
    657  1.1.1.3  christos     AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "CabinetNumber", PldInfo->CabinetNumber);
    658  1.1.1.3  christos     AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "CardCageNumber", PldInfo->CardCageNumber);
    659  1.1.1.3  christos     AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "Reference", PldInfo->Reference);
    660  1.1.1.3  christos     AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "Rotation", PldInfo->Rotation);
    661  1.1.1.3  christos     AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "Order", PldInfo->Order);
    662  1.1.1.3  christos 
    663  1.1.1.3  christos     /* Fifth 32-bit dword */
    664  1.1.1.3  christos 
    665  1.1.1.3  christos     if (ByteCount >= ACPI_PLD_REV1_BUFFER_SIZE)
    666  1.1.1.3  christos     {
    667  1.1.1.3  christos         AcpiOsPrintf (ACPI_PLD_OUTPUT16,"VerticalOffset", PldInfo->VerticalOffset);
    668  1.1.1.3  christos         AcpiOsPrintf (ACPI_PLD_OUTPUT16,"HorizontalOffset", PldInfo->HorizontalOffset);
    669  1.1.1.3  christos     }
    670  1.1.1.3  christos 
    671  1.1.1.3  christos     ACPI_FREE (PldInfo);
    672  1.1.1.3  christos }
    673  1.1.1.3  christos 
    674  1.1.1.3  christos 
    675  1.1.1.3  christos /*******************************************************************************
    676  1.1.1.3  christos  *
    677      1.1    jruoho  * FUNCTION:    AcpiDmUnicode
    678      1.1    jruoho  *
    679      1.1    jruoho  * PARAMETERS:  Op              - Byte List op containing Unicode string
    680      1.1    jruoho  *
    681      1.1    jruoho  * RETURN:      None
    682      1.1    jruoho  *
    683  1.1.1.3  christos  * DESCRIPTION: Dump Unicode string as a standard ASCII string. (Remove
    684      1.1    jruoho  *              the extra zero bytes).
    685      1.1    jruoho  *
    686      1.1    jruoho  ******************************************************************************/
    687      1.1    jruoho 
    688      1.1    jruoho static void
    689      1.1    jruoho AcpiDmUnicode (
    690      1.1    jruoho     ACPI_PARSE_OBJECT       *Op)
    691      1.1    jruoho {
    692      1.1    jruoho     UINT16                  *WordData;
    693      1.1    jruoho     UINT32                  WordCount;
    694      1.1    jruoho     UINT32                  i;
    695      1.1    jruoho 
    696      1.1    jruoho 
    697      1.1    jruoho     /* Extract the buffer info as a WORD buffer */
    698      1.1    jruoho 
    699      1.1    jruoho     WordData = ACPI_CAST_PTR (UINT16, Op->Named.Data);
    700      1.1    jruoho     WordCount = ACPI_DIV_2 (((UINT32) Op->Common.Value.Integer));
    701      1.1    jruoho 
    702      1.1    jruoho     /* Write every other byte as an ASCII character */
    703      1.1    jruoho 
    704  1.1.1.3  christos     AcpiOsPrintf ("\"");
    705      1.1    jruoho     for (i = 0; i < (WordCount - 1); i++)
    706      1.1    jruoho     {
    707      1.1    jruoho         AcpiOsPrintf ("%c", (int) WordData[i]);
    708      1.1    jruoho     }
    709      1.1    jruoho 
    710      1.1    jruoho     AcpiOsPrintf ("\")");
    711      1.1    jruoho }
    712      1.1    jruoho 
    713      1.1    jruoho 
    714      1.1    jruoho /*******************************************************************************
    715      1.1    jruoho  *
    716  1.1.1.4  christos  * FUNCTION:    AcpiDmGetHardwareIdType
    717      1.1    jruoho  *
    718      1.1    jruoho  * PARAMETERS:  Op              - Op to be examined
    719      1.1    jruoho  *
    720      1.1    jruoho  * RETURN:      None
    721      1.1    jruoho  *
    722  1.1.1.4  christos  * DESCRIPTION: Determine the type of the argument to a _HID or _CID
    723  1.1.1.4  christos  *              1) Strings are allowed
    724  1.1.1.4  christos  *              2) If Integer, determine if it is a valid EISAID
    725      1.1    jruoho  *
    726      1.1    jruoho  ******************************************************************************/
    727      1.1    jruoho 
    728      1.1    jruoho static void
    729  1.1.1.4  christos AcpiDmGetHardwareIdType (
    730      1.1    jruoho     ACPI_PARSE_OBJECT       *Op)
    731      1.1    jruoho {
    732      1.1    jruoho     UINT32                  BigEndianId;
    733      1.1    jruoho     UINT32                  Prefix[3];
    734      1.1    jruoho     UINT32                  i;
    735      1.1    jruoho 
    736      1.1    jruoho 
    737  1.1.1.4  christos     switch (Op->Common.AmlOpcode)
    738      1.1    jruoho     {
    739  1.1.1.4  christos     case AML_STRING_OP:
    740      1.1    jruoho 
    741  1.1.1.4  christos         /* Mark this string as an _HID/_CID string */
    742      1.1    jruoho 
    743  1.1.1.4  christos         Op->Common.DisasmOpcode = ACPI_DASM_HID_STRING;
    744  1.1.1.4  christos         break;
    745      1.1    jruoho 
    746  1.1.1.4  christos     case AML_WORD_OP:
    747  1.1.1.4  christos     case AML_DWORD_OP:
    748      1.1    jruoho 
    749  1.1.1.4  christos         /* Determine if a Word/Dword is a valid encoded EISAID */
    750      1.1    jruoho 
    751  1.1.1.4  christos         /* Swap from little-endian to big-endian to simplify conversion */
    752      1.1    jruoho 
    753  1.1.1.4  christos         BigEndianId = AcpiUtDwordByteSwap ((UINT32) Op->Common.Value.Integer);
    754  1.1.1.4  christos 
    755  1.1.1.4  christos         /* Create the 3 leading ASCII letters */
    756  1.1.1.4  christos 
    757  1.1.1.4  christos         Prefix[0] = ((BigEndianId >> 26) & 0x1F) + 0x40;
    758  1.1.1.4  christos         Prefix[1] = ((BigEndianId >> 21) & 0x1F) + 0x40;
    759  1.1.1.4  christos         Prefix[2] = ((BigEndianId >> 16) & 0x1F) + 0x40;
    760  1.1.1.4  christos 
    761  1.1.1.4  christos         /* Verify that all 3 are ascii and alpha */
    762  1.1.1.4  christos 
    763  1.1.1.4  christos         for (i = 0; i < 3; i++)
    764      1.1    jruoho         {
    765  1.1.1.4  christos             if (!ACPI_IS_ASCII (Prefix[i]) ||
    766  1.1.1.4  christos                 !ACPI_IS_ALPHA (Prefix[i]))
    767  1.1.1.4  christos             {
    768  1.1.1.4  christos                 return;
    769  1.1.1.4  christos             }
    770      1.1    jruoho         }
    771      1.1    jruoho 
    772  1.1.1.4  christos         /* Mark this node as convertable to an EISA ID string */
    773      1.1    jruoho 
    774  1.1.1.4  christos         Op->Common.DisasmOpcode = ACPI_DASM_EISAID;
    775  1.1.1.4  christos         break;
    776  1.1.1.4  christos 
    777  1.1.1.4  christos     default:
    778  1.1.1.4  christos         break;
    779  1.1.1.4  christos     }
    780      1.1    jruoho }
    781      1.1    jruoho 
    782      1.1    jruoho 
    783      1.1    jruoho /*******************************************************************************
    784      1.1    jruoho  *
    785  1.1.1.4  christos  * FUNCTION:    AcpiDmCheckForHardwareId
    786      1.1    jruoho  *
    787      1.1    jruoho  * PARAMETERS:  Op              - Op to be examined
    788      1.1    jruoho  *
    789      1.1    jruoho  * RETURN:      None
    790      1.1    jruoho  *
    791  1.1.1.4  christos  * DESCRIPTION: Determine if a Name() Op is a _HID/_CID.
    792      1.1    jruoho  *
    793      1.1    jruoho  ******************************************************************************/
    794      1.1    jruoho 
    795      1.1    jruoho void
    796  1.1.1.4  christos AcpiDmCheckForHardwareId (
    797      1.1    jruoho     ACPI_PARSE_OBJECT       *Op)
    798      1.1    jruoho {
    799      1.1    jruoho     UINT32                  Name;
    800      1.1    jruoho     ACPI_PARSE_OBJECT       *NextOp;
    801      1.1    jruoho 
    802      1.1    jruoho 
    803      1.1    jruoho     /* Get the NameSegment */
    804      1.1    jruoho 
    805      1.1    jruoho     Name = AcpiPsGetName (Op);
    806      1.1    jruoho     if (!Name)
    807      1.1    jruoho     {
    808      1.1    jruoho         return;
    809      1.1    jruoho     }
    810      1.1    jruoho 
    811      1.1    jruoho     NextOp = AcpiPsGetDepthNext (NULL, Op);
    812      1.1    jruoho     if (!NextOp)
    813      1.1    jruoho     {
    814      1.1    jruoho         return;
    815      1.1    jruoho     }
    816      1.1    jruoho 
    817      1.1    jruoho     /* Check for _HID - has one argument */
    818      1.1    jruoho 
    819      1.1    jruoho     if (ACPI_COMPARE_NAME (&Name, METHOD_NAME__HID))
    820      1.1    jruoho     {
    821  1.1.1.4  christos         AcpiDmGetHardwareIdType (NextOp);
    822      1.1    jruoho         return;
    823      1.1    jruoho     }
    824      1.1    jruoho 
    825      1.1    jruoho     /* Exit if not _CID */
    826      1.1    jruoho 
    827      1.1    jruoho     if (!ACPI_COMPARE_NAME (&Name, METHOD_NAME__CID))
    828      1.1    jruoho     {
    829      1.1    jruoho         return;
    830      1.1    jruoho     }
    831      1.1    jruoho 
    832      1.1    jruoho     /* _CID can contain a single argument or a package */
    833      1.1    jruoho 
    834      1.1    jruoho     if (NextOp->Common.AmlOpcode != AML_PACKAGE_OP)
    835      1.1    jruoho     {
    836  1.1.1.4  christos         AcpiDmGetHardwareIdType (NextOp);
    837      1.1    jruoho         return;
    838      1.1    jruoho     }
    839      1.1    jruoho 
    840  1.1.1.4  christos     /* _CID with Package: get the package length, check all elements */
    841      1.1    jruoho 
    842      1.1    jruoho     NextOp = AcpiPsGetDepthNext (NULL, NextOp);
    843  1.1.1.4  christos     if (!NextOp)
    844  1.1.1.4  christos     {
    845  1.1.1.4  christos         return;
    846  1.1.1.4  christos     }
    847      1.1    jruoho 
    848      1.1    jruoho     /* Don't need to use the length, just walk the peer list */
    849      1.1    jruoho 
    850      1.1    jruoho     NextOp = NextOp->Common.Next;
    851      1.1    jruoho     while (NextOp)
    852      1.1    jruoho     {
    853  1.1.1.4  christos         AcpiDmGetHardwareIdType (NextOp);
    854      1.1    jruoho         NextOp = NextOp->Common.Next;
    855      1.1    jruoho     }
    856      1.1    jruoho }
    857      1.1    jruoho 
    858      1.1    jruoho 
    859      1.1    jruoho /*******************************************************************************
    860      1.1    jruoho  *
    861  1.1.1.4  christos  * FUNCTION:    AcpiDmDecompressEisaId
    862      1.1    jruoho  *
    863      1.1    jruoho  * PARAMETERS:  EncodedId       - Raw encoded EISA ID.
    864      1.1    jruoho  *
    865      1.1    jruoho  * RETURN:      None
    866      1.1    jruoho  *
    867  1.1.1.4  christos  * DESCRIPTION: Convert an encoded EISAID back to the original ASCII String
    868  1.1.1.4  christos  *              and emit the correct ASL statement. If the ID is known, emit
    869  1.1.1.4  christos  *              a description of the ID as a comment.
    870      1.1    jruoho  *
    871      1.1    jruoho  ******************************************************************************/
    872      1.1    jruoho 
    873      1.1    jruoho void
    874  1.1.1.4  christos AcpiDmDecompressEisaId (
    875      1.1    jruoho     UINT32                  EncodedId)
    876      1.1    jruoho {
    877  1.1.1.4  christos     char                    IdBuffer[ACPI_EISAID_STRING_SIZE];
    878  1.1.1.4  christos     const AH_DEVICE_ID      *Info;
    879      1.1    jruoho 
    880      1.1    jruoho 
    881  1.1.1.4  christos     /* Convert EISAID to a string an emit the statement */
    882      1.1    jruoho 
    883  1.1.1.4  christos     AcpiExEisaIdToString (IdBuffer, EncodedId);
    884  1.1.1.4  christos     AcpiOsPrintf ("EisaId (\"%s\")", IdBuffer);
    885      1.1    jruoho 
    886  1.1.1.4  christos     /* If we know about the ID, emit the description */
    887      1.1    jruoho 
    888  1.1.1.4  christos     Info = AcpiAhMatchHardwareId (IdBuffer);
    889  1.1.1.4  christos     if (Info)
    890  1.1.1.4  christos     {
    891  1.1.1.4  christos         AcpiOsPrintf (" /* %s */", Info->Description);
    892  1.1.1.4  christos     }
    893      1.1    jruoho }
    894      1.1    jruoho 
    895      1.1    jruoho #endif
    896