Home | History | Annotate | Line # | Download | only in disassembler
      1 /*******************************************************************************
      2  *
      3  * Module Name: dmresrcl2.c - "Large" Resource Descriptor disassembly (#2)
      4  *
      5  ******************************************************************************/
      6 
      7 /******************************************************************************
      8  *
      9  * 1. Copyright Notice
     10  *
     11  * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp.
     12  * All rights reserved.
     13  *
     14  * 2. License
     15  *
     16  * 2.1. This is your license from Intel Corp. under its intellectual property
     17  * rights. You may have additional license terms from the party that provided
     18  * you this software, covering your right to use that party's intellectual
     19  * property rights.
     20  *
     21  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
     22  * copy of the source code appearing in this file ("Covered Code") an
     23  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
     24  * base code distributed originally by Intel ("Original Intel Code") to copy,
     25  * make derivatives, distribute, use and display any portion of the Covered
     26  * Code in any form, with the right to sublicense such rights; and
     27  *
     28  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
     29  * license (with the right to sublicense), under only those claims of Intel
     30  * patents that are infringed by the Original Intel Code, to make, use, sell,
     31  * offer to sell, and import the Covered Code and derivative works thereof
     32  * solely to the minimum extent necessary to exercise the above copyright
     33  * license, and in no event shall the patent license extend to any additions
     34  * to or modifications of the Original Intel Code. No other license or right
     35  * is granted directly or by implication, estoppel or otherwise;
     36  *
     37  * The above copyright and patent license is granted only if the following
     38  * conditions are met:
     39  *
     40  * 3. Conditions
     41  *
     42  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
     43  * Redistribution of source code of any substantial portion of the Covered
     44  * Code or modification with rights to further distribute source must include
     45  * the above Copyright Notice, the above License, this list of Conditions,
     46  * and the following Disclaimer and Export Compliance provision. In addition,
     47  * Licensee must cause all Covered Code to which Licensee contributes to
     48  * contain a file documenting the changes Licensee made to create that Covered
     49  * Code and the date of any change. Licensee must include in that file the
     50  * documentation of any changes made by any predecessor Licensee. Licensee
     51  * must include a prominent statement that the modification is derived,
     52  * directly or indirectly, from Original Intel Code.
     53  *
     54  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
     55  * Redistribution of source code of any substantial portion of the Covered
     56  * Code or modification without rights to further distribute source must
     57  * include the following Disclaimer and Export Compliance provision in the
     58  * documentation and/or other materials provided with distribution. In
     59  * addition, Licensee may not authorize further sublicense of source of any
     60  * portion of the Covered Code, and must include terms to the effect that the
     61  * license from Licensee to its licensee is limited to the intellectual
     62  * property embodied in the software Licensee provides to its licensee, and
     63  * not to intellectual property embodied in modifications its licensee may
     64  * make.
     65  *
     66  * 3.3. Redistribution of Executable. Redistribution in executable form of any
     67  * substantial portion of the Covered Code or modification must reproduce the
     68  * above Copyright Notice, and the following Disclaimer and Export Compliance
     69  * provision in the documentation and/or other materials provided with the
     70  * distribution.
     71  *
     72  * 3.4. Intel retains all right, title, and interest in and to the Original
     73  * Intel Code.
     74  *
     75  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
     76  * Intel shall be used in advertising or otherwise to promote the sale, use or
     77  * other dealings in products derived from or relating to the Covered Code
     78  * without prior written authorization from Intel.
     79  *
     80  * 4. Disclaimer and Export Compliance
     81  *
     82  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
     83  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
     84  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
     85  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
     86  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
     87  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
     88  * PARTICULAR PURPOSE.
     89  *
     90  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
     91  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
     92  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
     93  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
     94  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
     95  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
     96  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
     97  * LIMITED REMEDY.
     98  *
     99  * 4.3. Licensee shall not export, either directly or indirectly, any of this
    100  * software or system incorporating such software without first obtaining any
    101  * required license or other approval from the U. S. Department of Commerce or
    102  * any other agency or department of the United States Government. In the
    103  * event Licensee exports any such software from the United States or
    104  * re-exports any such software from a foreign destination, Licensee shall
    105  * ensure that the distribution and export/re-export of the software is in
    106  * compliance with all laws, regulations, orders, or other restrictions of the
    107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
    108  * any of its subsidiaries will export/re-export any technical data, process,
    109  * software, or service, directly or indirectly, to any country for which the
    110  * United States government or any agency thereof requires an export license,
    111  * other governmental approval, or letter of assurance, without first obtaining
    112  * such license, approval or letter.
    113  *
    114  *****************************************************************************
    115  *
    116  * Alternatively, you may choose to be licensed under the terms of the
    117  * following license:
    118  *
    119  * Redistribution and use in source and binary forms, with or without
    120  * modification, are permitted provided that the following conditions
    121  * are met:
    122  * 1. Redistributions of source code must retain the above copyright
    123  *    notice, this list of conditions, and the following disclaimer,
    124  *    without modification.
    125  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
    126  *    substantially similar to the "NO WARRANTY" disclaimer below
    127  *    ("Disclaimer") and any redistribution must be conditioned upon
    128  *    including a substantially similar Disclaimer requirement for further
    129  *    binary redistribution.
    130  * 3. Neither the names of the above-listed copyright holders nor the names
    131  *    of any contributors may be used to endorse or promote products derived
    132  *    from this software without specific prior written permission.
    133  *
    134  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    135  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    136  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    137  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    138  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    139  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    140  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    141  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    142  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    143  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    144  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    145  *
    146  * Alternatively, you may choose to be licensed under the terms of the
    147  * GNU General Public License ("GPL") version 2 as published by the Free
    148  * Software Foundation.
    149  *
    150  *****************************************************************************/
    151 
    152 #include "acpi.h"
    153 #include "accommon.h"
    154 #include "acdisasm.h"
    155 
    156 #ifdef _KERNEL
    157 #define MpSaveGpioInfo(a, b, c, d, e)
    158 #define MpSaveSerialInfo(a, b, c)
    159 #endif
    160 
    161 #define _COMPONENT          ACPI_CA_DEBUGGER
    162         ACPI_MODULE_NAME    ("dbresrcl2")
    163 
    164 /* Local prototypes */
    165 
    166 static void
    167 AcpiDmCsi2SerialBusDescriptor (
    168     ACPI_OP_WALK_INFO       *Info,
    169     AML_RESOURCE            *Resource,
    170     UINT32                  Length,
    171     UINT32                  Level);
    172 
    173 static void
    174 AcpiDmI2cSerialBusDescriptor (
    175     ACPI_OP_WALK_INFO       *Info,
    176     AML_RESOURCE            *Resource,
    177     UINT32                  Length,
    178     UINT32                  Level);
    179 
    180 static void
    181 AcpiDmSpiSerialBusDescriptor (
    182     ACPI_OP_WALK_INFO       *Info,
    183     AML_RESOURCE            *Resource,
    184     UINT32                  Length,
    185     UINT32                  Level);
    186 
    187 static void
    188 AcpiDmUartSerialBusDescriptor (
    189     ACPI_OP_WALK_INFO       *Info,
    190     AML_RESOURCE            *Resource,
    191     UINT32                  Length,
    192     UINT32                  Level);
    193 
    194 static void
    195 AcpiDmGpioCommon (
    196     ACPI_OP_WALK_INFO       *Info,
    197     AML_RESOURCE            *Resource,
    198     UINT32                  Level);
    199 
    200 static void
    201 AcpiDmDumpRawDataBuffer (
    202     UINT8                   *Buffer,
    203     UINT32                  Length,
    204     UINT32                  Level);
    205 
    206 
    207 /* Dispatch table for the serial bus descriptors */
    208 
    209 static ACPI_RESOURCE_HANDLER        SerialBusResourceDispatch [] =
    210 {
    211     NULL,
    212     AcpiDmI2cSerialBusDescriptor,
    213     AcpiDmSpiSerialBusDescriptor,
    214     AcpiDmUartSerialBusDescriptor,
    215     AcpiDmCsi2SerialBusDescriptor
    216 };
    217 
    218 
    219 /*******************************************************************************
    220  *
    221  * FUNCTION:    AcpiDmDumpRawDataBuffer
    222  *
    223  * PARAMETERS:  Buffer              - Pointer to the data bytes
    224  *              Length              - Length of the descriptor in bytes
    225  *              Level               - Current source code indentation level
    226  *
    227  * RETURN:      None
    228  *
    229  * DESCRIPTION: Dump a data buffer as a RawDataBuffer() object. Used for
    230  *              vendor data bytes.
    231  *
    232  ******************************************************************************/
    233 
    234 static void
    235 AcpiDmDumpRawDataBuffer (
    236     UINT8                   *Buffer,
    237     UINT32                  Length,
    238     UINT32                  Level)
    239 {
    240     UINT32                  Index;
    241     UINT32                  i;
    242     UINT32                  j;
    243 
    244 
    245     if (!Length)
    246     {
    247         return;
    248     }
    249 
    250     AcpiOsPrintf ("RawDataBuffer (0x%.2X)  // Vendor Data", Length);
    251 
    252     AcpiOsPrintf ("\n");
    253     AcpiDmIndent (Level + 1);
    254     AcpiOsPrintf ("{\n");
    255     AcpiDmIndent (Level + 2);
    256 
    257     for (i = 0; i < Length;)
    258     {
    259         for (j = 0; j < 8; j++)
    260         {
    261             Index = i + j;
    262             if (Index >= Length)
    263             {
    264                 goto Finish;
    265             }
    266 
    267             AcpiOsPrintf ("0x%2.2X", Buffer[Index]);
    268             if ((Index + 1) >= Length)
    269             {
    270                 goto Finish;
    271             }
    272 
    273             AcpiOsPrintf (", ");
    274         }
    275 
    276         AcpiOsPrintf ("\n");
    277         AcpiDmIndent (Level + 2);
    278 
    279         i += 8;
    280     }
    281 
    282 Finish:
    283     AcpiOsPrintf ("\n");
    284     AcpiDmIndent (Level + 1);
    285     AcpiOsPrintf ("}");
    286 }
    287 
    288 
    289 /*******************************************************************************
    290  *
    291  * FUNCTION:    AcpiDmGpioCommon
    292  *
    293  * PARAMETERS:  Info                - Extra resource info
    294  *              Resource            - Pointer to the resource descriptor
    295  *              Level               - Current source code indentation level
    296  *
    297  * RETURN:      None
    298  *
    299  * DESCRIPTION: Decode common parts of a GPIO Interrupt descriptor
    300  *
    301  ******************************************************************************/
    302 
    303 static void
    304 AcpiDmGpioCommon (
    305     ACPI_OP_WALK_INFO       *Info,
    306     AML_RESOURCE            *Resource,
    307     UINT32                  Level)
    308 {
    309     UINT16                  *PinList;
    310     UINT8                   *VendorData;
    311     char                    *DeviceName = NULL;
    312     UINT32                  PinCount;
    313     UINT32                  i;
    314 
    315 
    316     /* ResourceSource, ResourceSourceIndex, ResourceType */
    317 
    318     AcpiDmIndent (Level + 1);
    319     if (Resource->Gpio.ResSourceOffset)
    320     {
    321         DeviceName = ACPI_ADD_PTR (char,
    322             Resource, Resource->Gpio.ResSourceOffset);
    323         AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
    324     }
    325 
    326     AcpiOsPrintf (", ");
    327     AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.ResSourceIndex);
    328     AcpiOsPrintf ("%s, ",
    329         AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.Flags)]);
    330 
    331     /* Insert a descriptor name */
    332 
    333     AcpiDmDescriptorName ();
    334     AcpiOsPrintf (",");
    335 
    336     /* Dump the vendor data */
    337 
    338     if (Resource->Gpio.VendorOffset)
    339     {
    340         AcpiOsPrintf ("\n");
    341         AcpiDmIndent (Level + 1);
    342         VendorData = ACPI_ADD_PTR (UINT8, Resource,
    343             Resource->Gpio.VendorOffset);
    344 
    345         AcpiDmDumpRawDataBuffer (VendorData,
    346             Resource->Gpio.VendorLength, Level);
    347     }
    348 
    349     AcpiOsPrintf (")\n");
    350 
    351     /* Dump the interrupt list */
    352 
    353     AcpiDmIndent (Level + 1);
    354     AcpiOsPrintf ("{   // Pin list\n");
    355 
    356     PinCount = ((UINT32) (Resource->Gpio.ResSourceOffset -
    357         Resource->Gpio.PinTableOffset)) /
    358         sizeof (UINT16);
    359 
    360     PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
    361         Resource->Gpio.PinTableOffset);
    362 
    363     for (i = 0; i < PinCount; i++)
    364     {
    365         AcpiDmIndent (Level + 2);
    366         AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
    367             ((i + 1) < PinCount) ? "," : "");
    368     }
    369 
    370     AcpiDmIndent (Level + 1);
    371     AcpiOsPrintf ("}\n");
    372 
    373     MpSaveGpioInfo (Info->MappingOp, Resource,
    374         PinCount, PinList, DeviceName);
    375 }
    376 
    377 
    378 /*******************************************************************************
    379  *
    380  * FUNCTION:    AcpiDmGpioIntDescriptor
    381  *
    382  * PARAMETERS:  Info                - Extra resource info
    383  *              Resource            - Pointer to the resource descriptor
    384  *              Length              - Length of the descriptor in bytes
    385  *              Level               - Current source code indentation level
    386  *
    387  * RETURN:      None
    388  *
    389  * DESCRIPTION: Decode a GPIO Interrupt descriptor
    390  *
    391  ******************************************************************************/
    392 
    393 static void
    394 AcpiDmGpioIntDescriptor (
    395     ACPI_OP_WALK_INFO       *Info,
    396     AML_RESOURCE            *Resource,
    397     UINT32                  Length,
    398     UINT32                  Level)
    399 {
    400 
    401     /* Dump the GpioInt-specific portion of the descriptor */
    402 
    403     /* EdgeLevel, ActiveLevel, Shared */
    404 
    405     AcpiDmIndent (Level);
    406     AcpiOsPrintf ("GpioInt (%s, %s, %s, ",
    407         AcpiGbl_HeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.IntFlags)],
    408         AcpiGbl_LlDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 1)],
    409         AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]);
    410 
    411     /* PinConfig, DebounceTimeout */
    412 
    413     if (Resource->Gpio.PinConfig <= 3)
    414     {
    415         AcpiOsPrintf ("%s, ",
    416             AcpiGbl_PpcDecode[Resource->Gpio.PinConfig]);
    417     }
    418     else
    419     {
    420         AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig);
    421     }
    422     AcpiOsPrintf ("0x%4.4X,\n", Resource->Gpio.DebounceTimeout);
    423 
    424     /* Dump the GpioInt/GpioIo common portion of the descriptor */
    425 
    426     AcpiDmGpioCommon (Info, Resource, Level);
    427 }
    428 
    429 
    430 /*******************************************************************************
    431  *
    432  * FUNCTION:    AcpiDmGpioIoDescriptor
    433  *
    434  * PARAMETERS:  Info                - Extra resource info
    435  *              Resource            - Pointer to the resource descriptor
    436  *              Length              - Length of the descriptor in bytes
    437  *              Level               - Current source code indentation level
    438  *
    439  * RETURN:      None
    440  *
    441  * DESCRIPTION: Decode a GPIO I/O descriptor
    442  *
    443  ******************************************************************************/
    444 
    445 static void
    446 AcpiDmGpioIoDescriptor (
    447     ACPI_OP_WALK_INFO       *Info,
    448     AML_RESOURCE            *Resource,
    449     UINT32                  Length,
    450     UINT32                  Level)
    451 {
    452 
    453     /* Dump the GpioIo-specific portion of the descriptor */
    454 
    455     /* Shared, PinConfig */
    456 
    457     AcpiDmIndent (Level);
    458     AcpiOsPrintf ("GpioIo (%s, ",
    459         AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]);
    460 
    461     if (Resource->Gpio.PinConfig <= 3)
    462     {
    463         AcpiOsPrintf ("%s, ",
    464             AcpiGbl_PpcDecode[Resource->Gpio.PinConfig]);
    465     }
    466     else
    467     {
    468         AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig);
    469     }
    470 
    471     /* DebounceTimeout, DriveStrength, IoRestriction */
    472 
    473     AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DebounceTimeout);
    474     AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DriveStrength);
    475     AcpiOsPrintf ("%s,\n",
    476         AcpiGbl_IorDecode [ACPI_GET_2BIT_FLAG (Resource->Gpio.IntFlags)]);
    477 
    478     /* Dump the GpioInt/GpioIo common portion of the descriptor */
    479 
    480     AcpiDmGpioCommon (Info, Resource, Level);
    481 }
    482 
    483 
    484 /*******************************************************************************
    485  *
    486  * FUNCTION:    AcpiDmGpioDescriptor
    487  *
    488  * PARAMETERS:  Info                - Extra resource info
    489  *              Resource            - Pointer to the resource descriptor
    490  *              Length              - Length of the descriptor in bytes
    491  *              Level               - Current source code indentation level
    492  *
    493  * RETURN:      None
    494  *
    495  * DESCRIPTION: Decode a GpioInt/GpioIo GPIO Interrupt/IO descriptor
    496  *
    497  ******************************************************************************/
    498 
    499 void
    500 AcpiDmGpioDescriptor (
    501     ACPI_OP_WALK_INFO       *Info,
    502     AML_RESOURCE            *Resource,
    503     UINT32                  Length,
    504     UINT32                  Level)
    505 {
    506     UINT8                   ConnectionType;
    507 
    508 
    509     ConnectionType = Resource->Gpio.ConnectionType;
    510 
    511     switch (ConnectionType)
    512     {
    513     case AML_RESOURCE_GPIO_TYPE_INT:
    514 
    515         AcpiDmGpioIntDescriptor (Info, Resource, Length, Level);
    516         break;
    517 
    518     case AML_RESOURCE_GPIO_TYPE_IO:
    519 
    520         AcpiDmGpioIoDescriptor (Info, Resource, Length, Level);
    521         break;
    522 
    523     default:
    524 
    525         AcpiOsPrintf ("Unknown GPIO type\n");
    526         break;
    527     }
    528 }
    529 
    530 void
    531 AcpiDmClockInputDescriptor (
    532     ACPI_OP_WALK_INFO       *Info,
    533     AML_RESOURCE            *Resource,
    534     UINT32                  Length,
    535     UINT32                  Level)
    536 {
    537     char                    *DeviceName = NULL;
    538     UINT8                   *ResourceIndex = NULL;
    539     AcpiDmIndent (Level);
    540 
    541     AcpiOsPrintf ("ClockInput (");
    542 
    543     AcpiOsPrintf ("0x%8.8X, ", Resource->ClockInput.FrequencyNumerator);
    544 
    545     AcpiOsPrintf ("0x%4.4X, ", Resource->ClockInput.FrequencyDivisor);
    546 
    547     AcpiOsPrintf ("%s, ",
    548         AcpiGbl_ClockInputScale [ACPI_EXTRACT_2BIT_FLAG (Resource->ClockInput.Flags, 1)]);
    549 
    550     AcpiOsPrintf ("%s, ",
    551         AcpiGbl_ClockInputMode [ACPI_GET_1BIT_FLAG (Resource->ClockInput.Flags)]);
    552 
    553     if (Length > sizeof(Resource->ClockInput))
    554     {
    555         DeviceName = ACPI_ADD_PTR (char,
    556             Resource, sizeof(Resource->ClockInput)+1),
    557         AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
    558 
    559         AcpiOsPrintf (", ");
    560         ResourceIndex = ACPI_ADD_PTR (UINT8,
    561             Resource, sizeof(Resource->ClockInput)),
    562 
    563         AcpiOsPrintf ("0x%2.2X", *ResourceIndex);
    564     }
    565 
    566     AcpiOsPrintf (")\n");
    567 
    568 }
    569 
    570 /*******************************************************************************
    571  *
    572  * FUNCTION:    AcpiDmPinFunctionDescriptor
    573  *
    574  * PARAMETERS:  Info                - Extra resource info
    575  *              Resource            - Pointer to the resource descriptor
    576  *              Length              - Length of the descriptor in bytes
    577  *              Level               - Current source code indentation level
    578  *
    579  * RETURN:      None
    580  *
    581  * DESCRIPTION: Decode a PinFunction descriptor
    582  *
    583  ******************************************************************************/
    584 
    585 void
    586 AcpiDmPinFunctionDescriptor (
    587     ACPI_OP_WALK_INFO       *Info,
    588     AML_RESOURCE            *Resource,
    589     UINT32                  Length,
    590     UINT32                  Level)
    591 {
    592     UINT16                  *PinList;
    593     UINT8                   *VendorData;
    594     char                    *DeviceName = NULL;
    595     UINT32                  PinCount;
    596     UINT32                  i;
    597 
    598     AcpiDmIndent (Level);
    599     AcpiOsPrintf ("PinFunction (%s, ",
    600         AcpiGbl_ShrDecode [ACPI_GET_1BIT_FLAG (Resource->PinFunction.Flags)]);
    601 
    602     if (Resource->PinFunction.PinConfig <= 3)
    603     {
    604         AcpiOsPrintf ("%s, ",
    605             AcpiGbl_PpcDecode[Resource->PinFunction.PinConfig]);
    606     }
    607     else
    608     {
    609         AcpiOsPrintf ("0x%2.2X, ", Resource->PinFunction.PinConfig);
    610     }
    611 
    612     /* FunctionNumber */
    613 
    614     AcpiOsPrintf ("0x%4.4X, ", Resource->PinFunction.FunctionNumber);
    615 
    616     if (Resource->PinFunction.ResSourceOffset)
    617     {
    618         DeviceName = ACPI_ADD_PTR (char,
    619             Resource, Resource->PinFunction.ResSourceOffset),
    620         AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
    621     }
    622 
    623     AcpiOsPrintf (", ");
    624     AcpiOsPrintf ("0x%2.2X,\n", Resource->PinFunction.ResSourceIndex);
    625 
    626     AcpiDmIndent (Level + 1);
    627 
    628     /* Always ResourceConsumer */
    629     AcpiOsPrintf ("%s, ", AcpiGbl_ConsumeDecode [ACPI_CONSUMER]);
    630 
    631     /* Insert a descriptor name */
    632 
    633     AcpiDmDescriptorName ();
    634 
    635     AcpiOsPrintf (",");
    636 
    637     /* Dump the vendor data */
    638 
    639     if (Resource->PinFunction.VendorLength)
    640     {
    641         AcpiOsPrintf ("\n");
    642         AcpiDmIndent (Level + 1);
    643         VendorData = ACPI_ADD_PTR (UINT8, Resource,
    644             Resource->PinFunction.VendorOffset);
    645 
    646         AcpiDmDumpRawDataBuffer (VendorData,
    647             Resource->PinFunction.VendorLength, Level);
    648     }
    649 
    650     AcpiOsPrintf (")\n");
    651 
    652     AcpiDmIndent (Level + 1);
    653 
    654     /* Dump the interrupt list */
    655 
    656     AcpiOsPrintf ("{   // Pin list\n");
    657 
    658     PinCount = ((UINT32) (Resource->PinFunction.ResSourceOffset -
    659         Resource->PinFunction.PinTableOffset)) /
    660         sizeof (UINT16);
    661 
    662     PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
    663         Resource->PinFunction.PinTableOffset);
    664 
    665     for (i = 0; i < PinCount; i++)
    666     {
    667         AcpiDmIndent (Level + 2);
    668         AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
    669             ((i + 1) < PinCount) ? "," : "");
    670     }
    671 
    672     AcpiDmIndent (Level + 1);
    673     AcpiOsPrintf ("}\n");
    674 }
    675 
    676 
    677 /*******************************************************************************
    678  *
    679  * FUNCTION:    AcpiDmDumpSerialBusVendorData
    680  *
    681  * PARAMETERS:  Resource            - Pointer to the resource descriptor
    682  *
    683  * RETURN:      None
    684  *
    685  * DESCRIPTION: Dump optional serial bus vendor data
    686  *
    687  ******************************************************************************/
    688 
    689 static void
    690 AcpiDmDumpSerialBusVendorData (
    691     AML_RESOURCE            *Resource,
    692     UINT32                  Level)
    693 {
    694     UINT8                   *VendorData;
    695     UINT32                  VendorLength;
    696 
    697 
    698     /* Get the (optional) vendor data and length */
    699 
    700     switch (Resource->CommonSerialBus.Type)
    701     {
    702     case AML_RESOURCE_I2C_SERIALBUSTYPE:
    703 
    704         VendorLength = Resource->CommonSerialBus.TypeDataLength -
    705             AML_RESOURCE_I2C_MIN_DATA_LEN;
    706 
    707         VendorData = ACPI_ADD_PTR (UINT8, Resource,
    708             sizeof (AML_RESOURCE_I2C_SERIALBUS));
    709         break;
    710 
    711     case AML_RESOURCE_SPI_SERIALBUSTYPE:
    712 
    713         VendorLength = Resource->CommonSerialBus.TypeDataLength -
    714             AML_RESOURCE_SPI_MIN_DATA_LEN;
    715 
    716         VendorData = ACPI_ADD_PTR (UINT8, Resource,
    717             sizeof (AML_RESOURCE_SPI_SERIALBUS));
    718         break;
    719 
    720     case AML_RESOURCE_UART_SERIALBUSTYPE:
    721 
    722         VendorLength = Resource->CommonSerialBus.TypeDataLength -
    723             AML_RESOURCE_UART_MIN_DATA_LEN;
    724 
    725         VendorData = ACPI_ADD_PTR (UINT8, Resource,
    726             sizeof (AML_RESOURCE_UART_SERIALBUS));
    727         break;
    728 
    729     case AML_RESOURCE_CSI2_SERIALBUSTYPE:
    730 
    731         VendorLength = Resource->CommonSerialBus.TypeDataLength -
    732             AML_RESOURCE_CSI2_MIN_DATA_LEN;
    733 
    734         VendorData = ACPI_ADD_PTR (UINT8, Resource,
    735             sizeof (AML_RESOURCE_CSI2_SERIALBUS));
    736         break;
    737 
    738     default:
    739 
    740         return;
    741     }
    742 
    743     /* Dump the vendor bytes as a RawDataBuffer object */
    744 
    745     AcpiDmDumpRawDataBuffer (VendorData, VendorLength, Level);
    746 }
    747 
    748 
    749 /*******************************************************************************
    750  *
    751  * FUNCTION:    AcpiDmCsi2SerialBusDescriptor
    752  *
    753  * PARAMETERS:  Info                - Extra resource info
    754  *              Resource            - Pointer to the resource descriptor
    755  *              Length              - Length of the descriptor in bytes
    756  *              Level               - Current source code indentation level
    757  *
    758  * RETURN:      None
    759  *
    760  * DESCRIPTION: Decode a CSI2 serial bus descriptor
    761  *
    762  ******************************************************************************/
    763 
    764 static void
    765 AcpiDmCsi2SerialBusDescriptor (
    766     ACPI_OP_WALK_INFO       *Info,
    767     AML_RESOURCE            *Resource,
    768     UINT32                  Length,
    769     UINT32                  Level)
    770 {
    771     UINT32                  ResourceSourceOffset;
    772     char                    *DeviceName;
    773 
    774 
    775     /* SlaveMode, PhyType, LocalPortInstance */
    776 
    777     AcpiDmIndent (Level);
    778     AcpiOsPrintf ("Csi2Bus (%s,",
    779         AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->Csi2SerialBus.Flags)]);
    780 
    781     AcpiOsPrintf (" 0x%2.2X, 0x%2.2X,\n",
    782         Resource->Csi2SerialBus.TypeSpecificFlags & 0x03,
    783         (Resource->Csi2SerialBus.TypeSpecificFlags & 0xFC) >> 2);
    784 
    785     /* ResourceSource is a required field */
    786 
    787     ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
    788         Resource->CommonSerialBus.TypeDataLength;
    789 
    790     AcpiDmIndent (Level + 1);
    791     DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
    792     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
    793 
    794     /* ResourceSourceIndex, ResourceUsage */
    795 
    796     AcpiOsPrintf (",\n");
    797     AcpiDmIndent (Level + 1);
    798     AcpiOsPrintf ("0x%2.2X, ", Resource->Csi2SerialBus.ResSourceIndex);
    799 
    800     AcpiOsPrintf ("%s, ",
    801         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->Csi2SerialBus.Flags, 1)]);
    802 
    803     /* Insert a descriptor name */
    804 
    805     AcpiDmDescriptorName ();
    806 
    807     /* Dump the vendor data */
    808 
    809     AcpiOsPrintf (",\n");
    810     AcpiDmIndent (Level + 1);
    811     AcpiDmDumpSerialBusVendorData (Resource, Level);
    812     AcpiOsPrintf (")\n");
    813 
    814     MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
    815 }
    816 
    817 
    818 /*******************************************************************************
    819  *
    820  * FUNCTION:    AcpiDmI2cSerialBusDescriptor
    821  *
    822  * PARAMETERS:  Info                - Extra resource info
    823  *              Resource            - Pointer to the resource descriptor
    824  *              Length              - Length of the descriptor in bytes
    825  *              Level               - Current source code indentation level
    826  *
    827  * RETURN:      None
    828  *
    829  * DESCRIPTION: Decode a I2C serial bus descriptor
    830  *
    831  ******************************************************************************/
    832 
    833 static void
    834 AcpiDmI2cSerialBusDescriptor (
    835     ACPI_OP_WALK_INFO       *Info,
    836     AML_RESOURCE            *Resource,
    837     UINT32                  Length,
    838     UINT32                  Level)
    839 {
    840     UINT32                  ResourceSourceOffset;
    841     char                    *DeviceName;
    842 
    843 
    844     /* SlaveAddress, SlaveMode, ConnectionSpeed, AddressingMode */
    845 
    846     AcpiDmIndent (Level);
    847     AcpiOsPrintf ("I2cSerialBusV2 (0x%4.4X, %s, 0x%8.8X,\n",
    848         Resource->I2cSerialBus.SlaveAddress,
    849         AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.Flags)],
    850         Resource->I2cSerialBus.ConnectionSpeed);
    851 
    852     AcpiDmIndent (Level + 1);
    853     AcpiOsPrintf ("%s, ",
    854         AcpiGbl_AmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.TypeSpecificFlags)]);
    855 
    856     /* ResourceSource is a required field */
    857 
    858     ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
    859         Resource->CommonSerialBus.TypeDataLength;
    860 
    861     DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
    862     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
    863 
    864     /* ResourceSourceIndex, ResourceUsage */
    865 
    866     AcpiOsPrintf (",\n");
    867     AcpiDmIndent (Level + 1);
    868     AcpiOsPrintf ("0x%2.2X, ", Resource->I2cSerialBus.ResSourceIndex);
    869 
    870     AcpiOsPrintf ("%s, ",
    871         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->I2cSerialBus.Flags, 1)]);
    872 
    873     /* Insert a descriptor name */
    874 
    875     AcpiDmDescriptorName ();
    876 
    877     /* Share */
    878 
    879     AcpiOsPrintf (", %s,\n",
    880         AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->I2cSerialBus.Flags, 2)]);
    881 
    882     /* Dump the vendor data */
    883 
    884     AcpiDmIndent (Level + 1);
    885     AcpiDmDumpSerialBusVendorData (Resource, Level);
    886     AcpiOsPrintf (")\n");
    887 
    888     MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
    889 }
    890 
    891 
    892 /*******************************************************************************
    893  *
    894  * FUNCTION:    AcpiDmSpiSerialBusDescriptor
    895  *
    896  * PARAMETERS:  Info                - Extra resource info
    897  *              Resource            - Pointer to the resource descriptor
    898  *              Length              - Length of the descriptor in bytes
    899  *              Level               - Current source code indentation level
    900  *
    901  * RETURN:      None
    902  *
    903  * DESCRIPTION: Decode a SPI serial bus descriptor
    904  *
    905  ******************************************************************************/
    906 
    907 static void
    908 AcpiDmSpiSerialBusDescriptor (
    909     ACPI_OP_WALK_INFO       *Info,
    910     AML_RESOURCE            *Resource,
    911     UINT32                  Length,
    912     UINT32                  Level)
    913 {
    914     UINT32                  ResourceSourceOffset;
    915     char                    *DeviceName;
    916 
    917 
    918     /* DeviceSelection, DeviceSelectionPolarity, WireMode, DataBitLength */
    919 
    920     AcpiDmIndent (Level);
    921     AcpiOsPrintf ("SpiSerialBusV2 (0x%4.4X, %s, %s, 0x%2.2X,\n",
    922         Resource->SpiSerialBus.DeviceSelection,
    923         AcpiGbl_DpDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags, 1)],
    924         AcpiGbl_WmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags)],
    925         Resource->SpiSerialBus.DataBitLength);
    926 
    927     /* SlaveMode, ConnectionSpeed, ClockPolarity, ClockPhase */
    928 
    929     AcpiDmIndent (Level + 1);
    930     AcpiOsPrintf ("%s, 0x%8.8X, %s,\n",
    931         AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.Flags)],
    932         Resource->SpiSerialBus.ConnectionSpeed,
    933         AcpiGbl_CpoDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.ClockPolarity)]);
    934 
    935     AcpiDmIndent (Level + 1);
    936     AcpiOsPrintf ("%s, ",
    937         AcpiGbl_CphDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.ClockPhase)]);
    938 
    939     /* ResourceSource is a required field */
    940 
    941     ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
    942         Resource->CommonSerialBus.TypeDataLength;
    943 
    944     DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
    945     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
    946 
    947     /* ResourceSourceIndex, ResourceUsage */
    948 
    949     AcpiOsPrintf (",\n");
    950     AcpiDmIndent (Level + 1);
    951     AcpiOsPrintf ("0x%2.2X, ", Resource->SpiSerialBus.ResSourceIndex);
    952 
    953     AcpiOsPrintf ("%s, ",
    954         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.Flags, 1)]);
    955 
    956     /* Insert a descriptor name */
    957 
    958     AcpiDmDescriptorName ();
    959 
    960     /* Share */
    961 
    962     AcpiOsPrintf (", %s,\n",
    963         AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.Flags, 2)]);
    964 
    965     /* Dump the vendor data */
    966 
    967     AcpiDmIndent (Level + 1);
    968     AcpiDmDumpSerialBusVendorData (Resource, Level);
    969     AcpiOsPrintf (")\n");
    970 
    971     MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
    972 }
    973 
    974 
    975 /*******************************************************************************
    976  *
    977  * FUNCTION:    AcpiDmUartSerialBusDescriptor
    978  *
    979  * PARAMETERS:  Info                - Extra resource info
    980  *              Resource            - Pointer to the resource descriptor
    981  *              Length              - Length of the descriptor in bytes
    982  *              Level               - Current source code indentation level
    983  *
    984  * RETURN:      None
    985  *
    986  * DESCRIPTION: Decode a UART serial bus descriptor
    987  *
    988  ******************************************************************************/
    989 
    990 static void
    991 AcpiDmUartSerialBusDescriptor (
    992     ACPI_OP_WALK_INFO       *Info,
    993     AML_RESOURCE            *Resource,
    994     UINT32                  Length,
    995     UINT32                  Level)
    996 {
    997     UINT32                  ResourceSourceOffset;
    998     char                    *DeviceName;
    999 
   1000 
   1001     /* ConnectionSpeed, BitsPerByte, StopBits */
   1002 
   1003     AcpiDmIndent (Level);
   1004     AcpiOsPrintf ("UartSerialBusV2 (0x%8.8X, %s, %s,\n",
   1005         Resource->UartSerialBus.DefaultBaudRate,
   1006         AcpiGbl_BpbDecode [ACPI_EXTRACT_3BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 4)],
   1007         AcpiGbl_SbDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 2)]);
   1008 
   1009     /* LinesInUse, IsBigEndian, Parity, FlowControl */
   1010 
   1011     AcpiDmIndent (Level + 1);
   1012     AcpiOsPrintf ("0x%2.2X, %s, %s, %s,\n",
   1013         Resource->UartSerialBus.LinesEnabled,
   1014         AcpiGbl_EdDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 7)],
   1015         AcpiGbl_PtDecode [ACPI_GET_3BIT_FLAG (Resource->UartSerialBus.Parity)],
   1016         AcpiGbl_FcDecode [ACPI_GET_2BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags)]);
   1017 
   1018     /* ReceiveBufferSize, TransmitBufferSize */
   1019 
   1020     AcpiDmIndent (Level + 1);
   1021     AcpiOsPrintf ("0x%4.4X, 0x%4.4X, ",
   1022         Resource->UartSerialBus.RxFifoSize,
   1023         Resource->UartSerialBus.TxFifoSize);
   1024 
   1025     /* ResourceSource is a required field */
   1026 
   1027     ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
   1028         Resource->CommonSerialBus.TypeDataLength;
   1029 
   1030     DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
   1031     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
   1032 
   1033     /* ResourceSourceIndex, ResourceUsage */
   1034 
   1035     AcpiOsPrintf (",\n");
   1036     AcpiDmIndent (Level + 1);
   1037     AcpiOsPrintf ("0x%2.2X, ", Resource->UartSerialBus.ResSourceIndex);
   1038 
   1039     AcpiOsPrintf ("%s, ",
   1040         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.Flags, 1)]);
   1041 
   1042     /* Insert a descriptor name */
   1043 
   1044     AcpiDmDescriptorName ();
   1045 
   1046     /* Share */
   1047 
   1048     AcpiOsPrintf (", %s,\n",
   1049         AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.Flags, 2)]);
   1050 
   1051     /* Dump the vendor data */
   1052 
   1053     AcpiDmIndent (Level + 1);
   1054     AcpiDmDumpSerialBusVendorData (Resource, Level);
   1055     AcpiOsPrintf (")\n");
   1056 
   1057     MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
   1058 }
   1059 
   1060 
   1061 /*******************************************************************************
   1062  *
   1063  * FUNCTION:    AcpiDmSerialBusDescriptor
   1064  *
   1065  * PARAMETERS:  Info                - Extra resource info
   1066  *              Resource            - Pointer to the resource descriptor
   1067  *              Length              - Length of the descriptor in bytes
   1068  *              Level               - Current source code indentation level
   1069  *
   1070  * RETURN:      None
   1071  *
   1072  * DESCRIPTION: Decode a I2C/SPI/UART/CSI2 serial bus descriptor
   1073  *
   1074  ******************************************************************************/
   1075 
   1076 void
   1077 AcpiDmSerialBusDescriptor (
   1078     ACPI_OP_WALK_INFO       *Info,
   1079     AML_RESOURCE            *Resource,
   1080     UINT32                  Length,
   1081     UINT32                  Level)
   1082 {
   1083 
   1084     SerialBusResourceDispatch [Resource->CommonSerialBus.Type] (
   1085         Info, Resource, Length, Level);
   1086 }
   1087 
   1088 /*******************************************************************************
   1089  *
   1090  * FUNCTION:    AcpiDmPinConfig
   1091  *
   1092  * PARAMETERS:  PinConfigType       - Pin configuration type
   1093  *              PinConfigValue      - Pin configuration value
   1094  *
   1095  * RETURN:      None
   1096  *
   1097  * DESCRIPTION: Pretty prints PinConfig type and value.
   1098  *
   1099  ******************************************************************************/
   1100 
   1101 static void
   1102 AcpiDmPinConfig(
   1103     UINT8                   PinConfigType,
   1104     UINT32                  PinConfigValue)
   1105 {
   1106     if (PinConfigType <= 13)
   1107     {
   1108         AcpiOsPrintf ("0x%2.2X /* %s */, ", PinConfigType,
   1109             AcpiGbl_PtypDecode[PinConfigType]);
   1110     }
   1111     else
   1112     {
   1113         AcpiOsPrintf ("0x%2.2X, /* Vendor Defined */ ", PinConfigType);
   1114     }
   1115 
   1116     /* PinConfigValue */
   1117 
   1118     AcpiOsPrintf ("0x%4.4X,\n", PinConfigValue);
   1119 }
   1120 
   1121 /*******************************************************************************
   1122  *
   1123  * FUNCTION:    AcpiDmPinConfigDescriptor
   1124  *
   1125  * PARAMETERS:  Info                - Extra resource info
   1126  *              Resource            - Pointer to the resource descriptor
   1127  *              Length              - Length of the descriptor in bytes
   1128  *              Level               - Current source code indentation level
   1129  *
   1130  * RETURN:      None
   1131  *
   1132  * DESCRIPTION: Decode a PinConfig descriptor
   1133  *
   1134  ******************************************************************************/
   1135 
   1136 void
   1137 AcpiDmPinConfigDescriptor (
   1138     ACPI_OP_WALK_INFO       *Info,
   1139     AML_RESOURCE            *Resource,
   1140     UINT32                  Length,
   1141     UINT32                  Level)
   1142 {
   1143     UINT16                  *PinList;
   1144     UINT8                   *VendorData;
   1145     char                    *DeviceName = NULL;
   1146     UINT32                  PinCount;
   1147     UINT32                  i;
   1148 
   1149     AcpiDmIndent (Level);
   1150     AcpiOsPrintf ("PinConfig (%s, ",
   1151         AcpiGbl_ShrDecode [ACPI_GET_1BIT_FLAG (Resource->PinConfig.Flags)]);
   1152 
   1153     AcpiDmPinConfig (Resource->PinConfig.PinConfigType,
   1154         Resource->PinConfig.PinConfigValue);
   1155 
   1156     AcpiDmIndent (Level + 1);
   1157 
   1158     if (Resource->PinConfig.ResSourceOffset)
   1159     {
   1160         DeviceName = ACPI_ADD_PTR (char,
   1161             Resource, Resource->PinConfig.ResSourceOffset),
   1162         AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
   1163     }
   1164 
   1165     AcpiOsPrintf (", ");
   1166     AcpiOsPrintf ("0x%2.2X, ", Resource->PinConfig.ResSourceIndex);
   1167 
   1168     AcpiOsPrintf ("%s, ",
   1169         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->PinConfig.Flags, 1)]);
   1170 
   1171     /* Insert a descriptor name */
   1172 
   1173     AcpiDmDescriptorName ();
   1174 
   1175     AcpiOsPrintf (",");
   1176 
   1177     /* Dump the vendor data */
   1178 
   1179     if (Resource->PinConfig.VendorLength)
   1180     {
   1181         AcpiOsPrintf ("\n");
   1182         AcpiDmIndent (Level + 1);
   1183         VendorData = ACPI_ADD_PTR (UINT8, Resource,
   1184             Resource->PinConfig.VendorOffset);
   1185 
   1186         AcpiDmDumpRawDataBuffer (VendorData,
   1187             Resource->PinConfig.VendorLength, Level);
   1188     }
   1189 
   1190     AcpiOsPrintf (")\n");
   1191 
   1192     AcpiDmIndent (Level + 1);
   1193 
   1194     /* Dump the interrupt list */
   1195 
   1196     AcpiOsPrintf ("{   // Pin list\n");
   1197 
   1198     PinCount = ((UINT32) (Resource->PinConfig.ResSourceOffset -
   1199         Resource->PinConfig.PinTableOffset)) /
   1200         sizeof (UINT16);
   1201 
   1202     PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
   1203         Resource->PinConfig.PinTableOffset);
   1204 
   1205     for (i = 0; i < PinCount; i++)
   1206     {
   1207         AcpiDmIndent (Level + 2);
   1208         AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
   1209             ((i + 1) < PinCount) ? "," : "");
   1210     }
   1211 
   1212     AcpiDmIndent (Level + 1);
   1213     AcpiOsPrintf ("}\n");
   1214 }
   1215 
   1216 /*******************************************************************************
   1217  *
   1218  * FUNCTION:    AcpiDmPinGroupDescriptor
   1219  *
   1220  * PARAMETERS:  Info                - Extra resource info
   1221  *              Resource            - Pointer to the resource descriptor
   1222  *              Length              - Length of the descriptor in bytes
   1223  *              Level               - Current source code indentation level
   1224  *
   1225  * RETURN:      None
   1226  *
   1227  * DESCRIPTION: Decode a PinGroup descriptor
   1228  *
   1229  ******************************************************************************/
   1230 
   1231 void
   1232 AcpiDmPinGroupDescriptor (
   1233     ACPI_OP_WALK_INFO       *Info,
   1234     AML_RESOURCE            *Resource,
   1235     UINT32                  Length,
   1236     UINT32                  Level)
   1237 {
   1238     char                    *Label;
   1239     UINT16                  *PinList;
   1240     UINT8                   *VendorData;
   1241     UINT32                  PinCount;
   1242     UINT32                  i;
   1243 
   1244     AcpiDmIndent (Level);
   1245     /* Always producer */
   1246     AcpiOsPrintf ("PinGroup (");
   1247 
   1248     Label = ACPI_ADD_PTR (char,
   1249         Resource, Resource->PinGroup.LabelOffset),
   1250     AcpiUtPrintString (Label, ACPI_UINT16_MAX);
   1251 
   1252     AcpiOsPrintf (", ");
   1253 
   1254     AcpiOsPrintf ("%s, ",
   1255         AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->PinGroup.Flags)]);
   1256 
   1257     /* Insert a descriptor name */
   1258 
   1259     AcpiDmDescriptorName ();
   1260 
   1261     AcpiOsPrintf (",");
   1262 
   1263     /* Dump the vendor data */
   1264 
   1265     if (Resource->PinGroup.VendorLength)
   1266     {
   1267         AcpiOsPrintf ("\n");
   1268         AcpiDmIndent (Level + 1);
   1269         VendorData = ACPI_ADD_PTR (UINT8, Resource,
   1270             Resource->PinGroup.VendorOffset);
   1271 
   1272         AcpiDmDumpRawDataBuffer (VendorData,
   1273             Resource->PinGroup.VendorLength, Level);
   1274     }
   1275 
   1276     AcpiOsPrintf (")\n");
   1277 
   1278     AcpiDmIndent (Level + 1);
   1279 
   1280     /* Dump the interrupt list */
   1281 
   1282     AcpiOsPrintf ("{   // Pin list\n");
   1283 
   1284     PinCount = (Resource->PinGroup.LabelOffset -
   1285         Resource->PinGroup.PinTableOffset) / sizeof (UINT16);
   1286 
   1287     PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
   1288         Resource->PinGroup.PinTableOffset);
   1289 
   1290     for (i = 0; i < PinCount; i++)
   1291     {
   1292         AcpiDmIndent (Level + 2);
   1293         AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
   1294             ((i + 1) < PinCount) ? "," : "");
   1295     }
   1296 
   1297     AcpiDmIndent (Level + 1);
   1298     AcpiOsPrintf ("}\n");
   1299 }
   1300 
   1301 /*******************************************************************************
   1302  *
   1303  * FUNCTION:    AcpiDmPinGroupFunctionDescriptor
   1304  *
   1305  * PARAMETERS:  Info                - Extra resource info
   1306  *              Resource            - Pointer to the resource descriptor
   1307  *              Length              - Length of the descriptor in bytes
   1308  *              Level               - Current source code indentation level
   1309  *
   1310  * RETURN:      None
   1311  *
   1312  * DESCRIPTION: Decode a PinGroupFunction descriptor
   1313  *
   1314  ******************************************************************************/
   1315 
   1316 void
   1317 AcpiDmPinGroupFunctionDescriptor (
   1318     ACPI_OP_WALK_INFO       *Info,
   1319     AML_RESOURCE            *Resource,
   1320     UINT32                  Length,
   1321     UINT32                  Level)
   1322 {
   1323     UINT8                   *VendorData;
   1324     char                    *DeviceName = NULL;
   1325     char                    *Label = NULL;
   1326 
   1327     AcpiDmIndent (Level);
   1328     AcpiOsPrintf ("PinGroupFunction (%s, ",
   1329         AcpiGbl_ShrDecode [ACPI_GET_1BIT_FLAG (Resource->PinGroupFunction.Flags)]);
   1330 
   1331     /* FunctionNumber */
   1332 
   1333     AcpiOsPrintf ("0x%4.4X, ", Resource->PinGroupFunction.FunctionNumber);
   1334 
   1335     DeviceName = ACPI_ADD_PTR (char,
   1336         Resource, Resource->PinGroupFunction.ResSourceOffset),
   1337     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
   1338 
   1339     AcpiOsPrintf (", ");
   1340     AcpiOsPrintf ("0x%2.2X,\n", Resource->PinGroupFunction.ResSourceIndex);
   1341 
   1342     AcpiDmIndent (Level + 1);
   1343 
   1344     Label = ACPI_ADD_PTR (char, Resource,
   1345         Resource->PinGroupFunction.ResSourceLabelOffset);
   1346     AcpiUtPrintString (Label, ACPI_UINT16_MAX);
   1347 
   1348     AcpiOsPrintf (", ");
   1349 
   1350     AcpiOsPrintf ("%s, ",
   1351         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->PinGroupFunction.Flags, 1)]);
   1352 
   1353     /* Insert a descriptor name */
   1354 
   1355     AcpiDmDescriptorName ();
   1356 
   1357     AcpiOsPrintf (",");
   1358 
   1359     /* Dump the vendor data */
   1360 
   1361     if (Resource->PinGroupFunction.VendorLength)
   1362     {
   1363         AcpiOsPrintf ("\n");
   1364         AcpiDmIndent (Level + 1);
   1365         VendorData = ACPI_ADD_PTR (UINT8, Resource,
   1366             Resource->PinGroupFunction.VendorOffset);
   1367 
   1368         AcpiDmDumpRawDataBuffer (VendorData,
   1369             Resource->PinGroupFunction.VendorLength, Level);
   1370     }
   1371 
   1372     AcpiOsPrintf (")\n");
   1373 }
   1374 
   1375 /*******************************************************************************
   1376  *
   1377  * FUNCTION:    AcpiDmPinGroupConfigDescriptor
   1378  *
   1379  * PARAMETERS:  Info                - Extra resource info
   1380  *              Resource            - Pointer to the resource descriptor
   1381  *              Length              - Length of the descriptor in bytes
   1382  *              Level               - Current source code indentation level
   1383  *
   1384  * RETURN:      None
   1385  *
   1386  * DESCRIPTION: Decode a PinGroupConfig descriptor
   1387  *
   1388  ******************************************************************************/
   1389 
   1390 void
   1391 AcpiDmPinGroupConfigDescriptor (
   1392     ACPI_OP_WALK_INFO       *Info,
   1393     AML_RESOURCE            *Resource,
   1394     UINT32                  Length,
   1395     UINT32                  Level)
   1396 {
   1397     UINT8                   *VendorData;
   1398     char                    *DeviceName = NULL;
   1399     char                    *Label = NULL;
   1400 
   1401     AcpiDmIndent (Level);
   1402     AcpiOsPrintf ("PinGroupConfig (%s, ",
   1403         AcpiGbl_ShrDecode [ACPI_GET_1BIT_FLAG (Resource->PinGroupConfig.Flags)]);
   1404 
   1405     AcpiDmPinConfig(Resource->PinGroupConfig.PinConfigType,
   1406         Resource->PinGroupConfig.PinConfigValue);
   1407 
   1408     AcpiDmIndent (Level + 1);
   1409 
   1410     DeviceName = ACPI_ADD_PTR (char,
   1411         Resource, Resource->PinGroupConfig.ResSourceOffset),
   1412     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
   1413 
   1414     AcpiOsPrintf (", ");
   1415     AcpiOsPrintf ("0x%2.2X, ", Resource->PinGroupConfig.ResSourceIndex);
   1416 
   1417     Label = ACPI_ADD_PTR (char, Resource,
   1418         Resource->PinGroupConfig.ResSourceLabelOffset);
   1419     AcpiUtPrintString (Label, ACPI_UINT16_MAX);
   1420 
   1421     AcpiOsPrintf (", ");
   1422 
   1423     AcpiOsPrintf ("%s, ",
   1424         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->PinGroupConfig.Flags, 1)]);
   1425 
   1426     /* Insert a descriptor name */
   1427 
   1428     AcpiDmDescriptorName ();
   1429 
   1430     AcpiOsPrintf (",");
   1431 
   1432     /* Dump the vendor data */
   1433 
   1434     if (Resource->PinGroupConfig.VendorLength)
   1435     {
   1436         AcpiOsPrintf ("\n");
   1437         AcpiDmIndent (Level + 1);
   1438         VendorData = ACPI_ADD_PTR (UINT8, Resource,
   1439             Resource->PinGroupConfig.VendorOffset);
   1440 
   1441         AcpiDmDumpRawDataBuffer (VendorData,
   1442             Resource->PinGroupConfig.VendorLength, Level);
   1443     }
   1444 
   1445     AcpiOsPrintf (")\n");
   1446 }
   1447