Home | History | Annotate | Line # | Download | only in disassembler
dmresrcl2.c revision 1.1.1.9
      1 /*******************************************************************************
      2  *
      3  * Module Name: dmresrcl2.c - "Large" Resource Descriptor disassembly (#2)
      4  *
      5  ******************************************************************************/
      6 
      7 /*
      8  * Copyright (C) 2000 - 2018, Intel Corp.
      9  * All rights reserved.
     10  *
     11  * Redistribution and use in source and binary forms, with or without
     12  * modification, are permitted provided that the following conditions
     13  * are met:
     14  * 1. Redistributions of source code must retain the above copyright
     15  *    notice, this list of conditions, and the following disclaimer,
     16  *    without modification.
     17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     18  *    substantially similar to the "NO WARRANTY" disclaimer below
     19  *    ("Disclaimer") and any redistribution must be conditioned upon
     20  *    including a substantially similar Disclaimer requirement for further
     21  *    binary redistribution.
     22  * 3. Neither the names of the above-listed copyright holders nor the names
     23  *    of any contributors may be used to endorse or promote products derived
     24  *    from this software without specific prior written permission.
     25  *
     26  * Alternatively, this software may be distributed under the terms of the
     27  * GNU General Public License ("GPL") version 2 as published by the Free
     28  * Software Foundation.
     29  *
     30  * NO WARRANTY
     31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
     34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     41  * POSSIBILITY OF SUCH DAMAGES.
     42  */
     43 
     44 #include "acpi.h"
     45 #include "accommon.h"
     46 #include "acdisasm.h"
     47 
     48 
     49 #define _COMPONENT          ACPI_CA_DEBUGGER
     50         ACPI_MODULE_NAME    ("dbresrcl2")
     51 
     52 /* Local prototypes */
     53 
     54 static void
     55 AcpiDmI2cSerialBusDescriptor (
     56     ACPI_OP_WALK_INFO       *Info,
     57     AML_RESOURCE            *Resource,
     58     UINT32                  Length,
     59     UINT32                  Level);
     60 
     61 static void
     62 AcpiDmSpiSerialBusDescriptor (
     63     ACPI_OP_WALK_INFO       *Info,
     64     AML_RESOURCE            *Resource,
     65     UINT32                  Length,
     66     UINT32                  Level);
     67 
     68 static void
     69 AcpiDmUartSerialBusDescriptor (
     70     ACPI_OP_WALK_INFO       *Info,
     71     AML_RESOURCE            *Resource,
     72     UINT32                  Length,
     73     UINT32                  Level);
     74 
     75 static void
     76 AcpiDmGpioCommon (
     77     ACPI_OP_WALK_INFO       *Info,
     78     AML_RESOURCE            *Resource,
     79     UINT32                  Level);
     80 
     81 static void
     82 AcpiDmDumpRawDataBuffer (
     83     UINT8                   *Buffer,
     84     UINT32                  Length,
     85     UINT32                  Level);
     86 
     87 
     88 /* Dispatch table for the serial bus descriptors */
     89 
     90 static ACPI_RESOURCE_HANDLER        SerialBusResourceDispatch [] =
     91 {
     92     NULL,
     93     AcpiDmI2cSerialBusDescriptor,
     94     AcpiDmSpiSerialBusDescriptor,
     95     AcpiDmUartSerialBusDescriptor
     96 };
     97 
     98 
     99 /*******************************************************************************
    100  *
    101  * FUNCTION:    AcpiDmDumpRawDataBuffer
    102  *
    103  * PARAMETERS:  Buffer              - Pointer to the data bytes
    104  *              Length              - Length of the descriptor in bytes
    105  *              Level               - Current source code indentation level
    106  *
    107  * RETURN:      None
    108  *
    109  * DESCRIPTION: Dump a data buffer as a RawDataBuffer() object. Used for
    110  *              vendor data bytes.
    111  *
    112  ******************************************************************************/
    113 
    114 static void
    115 AcpiDmDumpRawDataBuffer (
    116     UINT8                   *Buffer,
    117     UINT32                  Length,
    118     UINT32                  Level)
    119 {
    120     UINT32                  Index;
    121     UINT32                  i;
    122     UINT32                  j;
    123 
    124 
    125     if (!Length)
    126     {
    127         return;
    128     }
    129 
    130     AcpiOsPrintf ("RawDataBuffer (0x%.2X)  // Vendor Data", Length);
    131 
    132     AcpiOsPrintf ("\n");
    133     AcpiDmIndent (Level + 1);
    134     AcpiOsPrintf ("{\n");
    135     AcpiDmIndent (Level + 2);
    136 
    137     for (i = 0; i < Length;)
    138     {
    139         for (j = 0; j < 8; j++)
    140         {
    141             Index = i + j;
    142             if (Index >= Length)
    143             {
    144                 goto Finish;
    145             }
    146 
    147             AcpiOsPrintf ("0x%2.2X", Buffer[Index]);
    148             if ((Index + 1) >= Length)
    149             {
    150                 goto Finish;
    151             }
    152 
    153             AcpiOsPrintf (", ");
    154         }
    155 
    156         AcpiOsPrintf ("\n");
    157         AcpiDmIndent (Level + 2);
    158 
    159         i += 8;
    160     }
    161 
    162 Finish:
    163     AcpiOsPrintf ("\n");
    164     AcpiDmIndent (Level + 1);
    165     AcpiOsPrintf ("}");
    166 }
    167 
    168 
    169 /*******************************************************************************
    170  *
    171  * FUNCTION:    AcpiDmGpioCommon
    172  *
    173  * PARAMETERS:  Info                - Extra resource info
    174  *              Resource            - Pointer to the resource descriptor
    175  *              Level               - Current source code indentation level
    176  *
    177  * RETURN:      None
    178  *
    179  * DESCRIPTION: Decode common parts of a GPIO Interrupt descriptor
    180  *
    181  ******************************************************************************/
    182 
    183 static void
    184 AcpiDmGpioCommon (
    185     ACPI_OP_WALK_INFO       *Info,
    186     AML_RESOURCE            *Resource,
    187     UINT32                  Level)
    188 {
    189     UINT16                  *PinList;
    190     UINT8                   *VendorData;
    191     char                    *DeviceName = NULL;
    192     UINT32                  PinCount;
    193     UINT32                  i;
    194 
    195 
    196     /* ResourceSource, ResourceSourceIndex, ResourceType */
    197 
    198     AcpiDmIndent (Level + 1);
    199     if (Resource->Gpio.ResSourceOffset)
    200     {
    201         DeviceName = ACPI_ADD_PTR (char,
    202             Resource, Resource->Gpio.ResSourceOffset),
    203         AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
    204     }
    205 
    206     AcpiOsPrintf (", ");
    207     AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.ResSourceIndex);
    208     AcpiOsPrintf ("%s, ",
    209         AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.Flags)]);
    210 
    211     /* Insert a descriptor name */
    212 
    213     AcpiDmDescriptorName ();
    214     AcpiOsPrintf (",");
    215 
    216     /* Dump the vendor data */
    217 
    218     if (Resource->Gpio.VendorOffset)
    219     {
    220         AcpiOsPrintf ("\n");
    221         AcpiDmIndent (Level + 1);
    222         VendorData = ACPI_ADD_PTR (UINT8, Resource,
    223             Resource->Gpio.VendorOffset);
    224 
    225         AcpiDmDumpRawDataBuffer (VendorData,
    226             Resource->Gpio.VendorLength, Level);
    227     }
    228 
    229     AcpiOsPrintf (")\n");
    230 
    231     /* Dump the interrupt list */
    232 
    233     AcpiDmIndent (Level + 1);
    234     AcpiOsPrintf ("{   // Pin list\n");
    235 
    236     PinCount = ((UINT32) (Resource->Gpio.ResSourceOffset -
    237         Resource->Gpio.PinTableOffset)) /
    238         sizeof (UINT16);
    239 
    240     PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
    241         Resource->Gpio.PinTableOffset);
    242 
    243     for (i = 0; i < PinCount; i++)
    244     {
    245         AcpiDmIndent (Level + 2);
    246         AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
    247             ((i + 1) < PinCount) ? "," : "");
    248     }
    249 
    250     AcpiDmIndent (Level + 1);
    251     AcpiOsPrintf ("}\n");
    252 
    253     MpSaveGpioInfo (Info->MappingOp, Resource,
    254         PinCount, PinList, DeviceName);
    255 }
    256 
    257 
    258 /*******************************************************************************
    259  *
    260  * FUNCTION:    AcpiDmGpioIntDescriptor
    261  *
    262  * PARAMETERS:  Info                - Extra resource info
    263  *              Resource            - Pointer to the resource descriptor
    264  *              Length              - Length of the descriptor in bytes
    265  *              Level               - Current source code indentation level
    266  *
    267  * RETURN:      None
    268  *
    269  * DESCRIPTION: Decode a GPIO Interrupt descriptor
    270  *
    271  ******************************************************************************/
    272 
    273 static void
    274 AcpiDmGpioIntDescriptor (
    275     ACPI_OP_WALK_INFO       *Info,
    276     AML_RESOURCE            *Resource,
    277     UINT32                  Length,
    278     UINT32                  Level)
    279 {
    280 
    281     /* Dump the GpioInt-specific portion of the descriptor */
    282 
    283     /* EdgeLevel, ActiveLevel, Shared */
    284 
    285     AcpiDmIndent (Level);
    286     AcpiOsPrintf ("GpioInt (%s, %s, %s, ",
    287         AcpiGbl_HeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.IntFlags)],
    288         AcpiGbl_LlDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 1)],
    289         AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]);
    290 
    291     /* PinConfig, DebounceTimeout */
    292 
    293     if (Resource->Gpio.PinConfig <= 3)
    294     {
    295         AcpiOsPrintf ("%s, ",
    296             AcpiGbl_PpcDecode[Resource->Gpio.PinConfig]);
    297     }
    298     else
    299     {
    300         AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig);
    301     }
    302     AcpiOsPrintf ("0x%4.4X,\n", Resource->Gpio.DebounceTimeout);
    303 
    304     /* Dump the GpioInt/GpioIo common portion of the descriptor */
    305 
    306     AcpiDmGpioCommon (Info, Resource, Level);
    307 }
    308 
    309 
    310 /*******************************************************************************
    311  *
    312  * FUNCTION:    AcpiDmGpioIoDescriptor
    313  *
    314  * PARAMETERS:  Info                - Extra resource info
    315  *              Resource            - Pointer to the resource descriptor
    316  *              Length              - Length of the descriptor in bytes
    317  *              Level               - Current source code indentation level
    318  *
    319  * RETURN:      None
    320  *
    321  * DESCRIPTION: Decode a GPIO I/O descriptor
    322  *
    323  ******************************************************************************/
    324 
    325 static void
    326 AcpiDmGpioIoDescriptor (
    327     ACPI_OP_WALK_INFO       *Info,
    328     AML_RESOURCE            *Resource,
    329     UINT32                  Length,
    330     UINT32                  Level)
    331 {
    332 
    333     /* Dump the GpioIo-specific portion of the descriptor */
    334 
    335     /* Shared, PinConfig */
    336 
    337     AcpiDmIndent (Level);
    338     AcpiOsPrintf ("GpioIo (%s, ",
    339         AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]);
    340 
    341     if (Resource->Gpio.PinConfig <= 3)
    342     {
    343         AcpiOsPrintf ("%s, ",
    344             AcpiGbl_PpcDecode[Resource->Gpio.PinConfig]);
    345     }
    346     else
    347     {
    348         AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig);
    349     }
    350 
    351     /* DebounceTimeout, DriveStrength, IoRestriction */
    352 
    353     AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DebounceTimeout);
    354     AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DriveStrength);
    355     AcpiOsPrintf ("%s,\n",
    356         AcpiGbl_IorDecode [ACPI_GET_2BIT_FLAG (Resource->Gpio.IntFlags)]);
    357 
    358     /* Dump the GpioInt/GpioIo common portion of the descriptor */
    359 
    360     AcpiDmGpioCommon (Info, Resource, Level);
    361 }
    362 
    363 
    364 /*******************************************************************************
    365  *
    366  * FUNCTION:    AcpiDmGpioDescriptor
    367  *
    368  * PARAMETERS:  Info                - Extra resource info
    369  *              Resource            - Pointer to the resource descriptor
    370  *              Length              - Length of the descriptor in bytes
    371  *              Level               - Current source code indentation level
    372  *
    373  * RETURN:      None
    374  *
    375  * DESCRIPTION: Decode a GpioInt/GpioIo GPIO Interrupt/IO descriptor
    376  *
    377  ******************************************************************************/
    378 
    379 void
    380 AcpiDmGpioDescriptor (
    381     ACPI_OP_WALK_INFO       *Info,
    382     AML_RESOURCE            *Resource,
    383     UINT32                  Length,
    384     UINT32                  Level)
    385 {
    386     UINT8                   ConnectionType;
    387 
    388 
    389     ConnectionType = Resource->Gpio.ConnectionType;
    390 
    391     switch (ConnectionType)
    392     {
    393     case AML_RESOURCE_GPIO_TYPE_INT:
    394 
    395         AcpiDmGpioIntDescriptor (Info, Resource, Length, Level);
    396         break;
    397 
    398     case AML_RESOURCE_GPIO_TYPE_IO:
    399 
    400         AcpiDmGpioIoDescriptor (Info, Resource, Length, Level);
    401         break;
    402 
    403     default:
    404 
    405         AcpiOsPrintf ("Unknown GPIO type\n");
    406         break;
    407     }
    408 }
    409 
    410 /*******************************************************************************
    411  *
    412  * FUNCTION:    AcpiDmPinFunctionDescriptor
    413  *
    414  * PARAMETERS:  Info                - Extra resource info
    415  *              Resource            - Pointer to the resource descriptor
    416  *              Length              - Length of the descriptor in bytes
    417  *              Level               - Current source code indentation level
    418  *
    419  * RETURN:      None
    420  *
    421  * DESCRIPTION: Decode a PinFunction descriptor
    422  *
    423  ******************************************************************************/
    424 
    425 void
    426 AcpiDmPinFunctionDescriptor (
    427     ACPI_OP_WALK_INFO       *Info,
    428     AML_RESOURCE            *Resource,
    429     UINT32                  Length,
    430     UINT32                  Level)
    431 {
    432     UINT16                  *PinList;
    433     UINT8                   *VendorData;
    434     char                    *DeviceName = NULL;
    435     UINT32                  PinCount;
    436     UINT32                  i;
    437 
    438     AcpiDmIndent (Level);
    439     AcpiOsPrintf ("PinFunction (%s, ",
    440         AcpiGbl_ShrDecode [ACPI_GET_1BIT_FLAG (Resource->PinFunction.Flags)]);
    441 
    442     if (Resource->PinFunction.PinConfig <= 3)
    443     {
    444         AcpiOsPrintf ("%s, ",
    445             AcpiGbl_PpcDecode[Resource->PinFunction.PinConfig]);
    446     }
    447     else
    448     {
    449         AcpiOsPrintf ("0x%2.2X, ", Resource->PinFunction.PinConfig);
    450     }
    451 
    452     /* FunctionNumber */
    453 
    454     AcpiOsPrintf ("0x%4.4X, ", Resource->PinFunction.FunctionNumber);
    455 
    456     if (Resource->PinFunction.ResSourceOffset)
    457     {
    458         DeviceName = ACPI_ADD_PTR (char,
    459             Resource, Resource->PinFunction.ResSourceOffset),
    460         AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
    461     }
    462 
    463     AcpiOsPrintf (", ");
    464     AcpiOsPrintf ("0x%2.2X,\n", Resource->PinFunction.ResSourceIndex);
    465 
    466     AcpiDmIndent (Level + 1);
    467 
    468     /* Always ResourceConsumer */
    469     AcpiOsPrintf ("%s, ", AcpiGbl_ConsumeDecode [ACPI_CONSUMER]);
    470 
    471     /* Insert a descriptor name */
    472 
    473     AcpiDmDescriptorName ();
    474 
    475     AcpiOsPrintf (",");
    476 
    477     /* Dump the vendor data */
    478 
    479     if (Resource->PinFunction.VendorLength)
    480     {
    481         AcpiOsPrintf ("\n");
    482         AcpiDmIndent (Level + 1);
    483         VendorData = ACPI_ADD_PTR (UINT8, Resource,
    484             Resource->PinFunction.VendorOffset);
    485 
    486         AcpiDmDumpRawDataBuffer (VendorData,
    487             Resource->PinFunction.VendorLength, Level);
    488     }
    489 
    490     AcpiOsPrintf (")\n");
    491 
    492     AcpiDmIndent (Level + 1);
    493 
    494     /* Dump the interrupt list */
    495 
    496     AcpiOsPrintf ("{   // Pin list\n");
    497 
    498     PinCount = ((UINT32) (Resource->PinFunction.ResSourceOffset -
    499         Resource->PinFunction.PinTableOffset)) /
    500         sizeof (UINT16);
    501 
    502     PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
    503         Resource->PinFunction.PinTableOffset);
    504 
    505     for (i = 0; i < PinCount; i++)
    506     {
    507         AcpiDmIndent (Level + 2);
    508         AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
    509             ((i + 1) < PinCount) ? "," : "");
    510     }
    511 
    512     AcpiDmIndent (Level + 1);
    513     AcpiOsPrintf ("}\n");
    514 }
    515 
    516 
    517 /*******************************************************************************
    518  *
    519  * FUNCTION:    AcpiDmDumpSerialBusVendorData
    520  *
    521  * PARAMETERS:  Resource            - Pointer to the resource descriptor
    522  *
    523  * RETURN:      None
    524  *
    525  * DESCRIPTION: Dump optional serial bus vendor data
    526  *
    527  ******************************************************************************/
    528 
    529 static void
    530 AcpiDmDumpSerialBusVendorData (
    531     AML_RESOURCE            *Resource,
    532     UINT32                  Level)
    533 {
    534     UINT8                   *VendorData;
    535     UINT32                  VendorLength;
    536 
    537 
    538     /* Get the (optional) vendor data and length */
    539 
    540     switch (Resource->CommonSerialBus.Type)
    541     {
    542     case AML_RESOURCE_I2C_SERIALBUSTYPE:
    543 
    544         VendorLength = Resource->CommonSerialBus.TypeDataLength -
    545             AML_RESOURCE_I2C_MIN_DATA_LEN;
    546 
    547         VendorData = ACPI_ADD_PTR (UINT8, Resource,
    548             sizeof (AML_RESOURCE_I2C_SERIALBUS));
    549         break;
    550 
    551     case AML_RESOURCE_SPI_SERIALBUSTYPE:
    552 
    553         VendorLength = Resource->CommonSerialBus.TypeDataLength -
    554             AML_RESOURCE_SPI_MIN_DATA_LEN;
    555 
    556         VendorData = ACPI_ADD_PTR (UINT8, Resource,
    557             sizeof (AML_RESOURCE_SPI_SERIALBUS));
    558         break;
    559 
    560     case AML_RESOURCE_UART_SERIALBUSTYPE:
    561 
    562         VendorLength = Resource->CommonSerialBus.TypeDataLength -
    563             AML_RESOURCE_UART_MIN_DATA_LEN;
    564 
    565         VendorData = ACPI_ADD_PTR (UINT8, Resource,
    566             sizeof (AML_RESOURCE_UART_SERIALBUS));
    567         break;
    568 
    569     default:
    570 
    571         return;
    572     }
    573 
    574     /* Dump the vendor bytes as a RawDataBuffer object */
    575 
    576     AcpiDmDumpRawDataBuffer (VendorData, VendorLength, Level);
    577 }
    578 
    579 
    580 /*******************************************************************************
    581  *
    582  * FUNCTION:    AcpiDmI2cSerialBusDescriptor
    583  *
    584  * PARAMETERS:  Info                - Extra resource info
    585  *              Resource            - Pointer to the resource descriptor
    586  *              Length              - Length of the descriptor in bytes
    587  *              Level               - Current source code indentation level
    588  *
    589  * RETURN:      None
    590  *
    591  * DESCRIPTION: Decode a I2C serial bus descriptor
    592  *
    593  ******************************************************************************/
    594 
    595 static void
    596 AcpiDmI2cSerialBusDescriptor (
    597     ACPI_OP_WALK_INFO       *Info,
    598     AML_RESOURCE            *Resource,
    599     UINT32                  Length,
    600     UINT32                  Level)
    601 {
    602     UINT32                  ResourceSourceOffset;
    603     char                    *DeviceName;
    604 
    605 
    606     /* SlaveAddress, SlaveMode, ConnectionSpeed, AddressingMode */
    607 
    608     AcpiDmIndent (Level);
    609     AcpiOsPrintf ("I2cSerialBusV2 (0x%4.4X, %s, 0x%8.8X,\n",
    610         Resource->I2cSerialBus.SlaveAddress,
    611         AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.Flags)],
    612         Resource->I2cSerialBus.ConnectionSpeed);
    613 
    614     AcpiDmIndent (Level + 1);
    615     AcpiOsPrintf ("%s, ",
    616         AcpiGbl_AmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.TypeSpecificFlags)]);
    617 
    618     /* ResourceSource is a required field */
    619 
    620     ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
    621         Resource->CommonSerialBus.TypeDataLength;
    622 
    623     DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
    624     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
    625 
    626     /* ResourceSourceIndex, ResourceUsage */
    627 
    628     AcpiOsPrintf (",\n");
    629     AcpiDmIndent (Level + 1);
    630     AcpiOsPrintf ("0x%2.2X, ", Resource->I2cSerialBus.ResSourceIndex);
    631 
    632     AcpiOsPrintf ("%s, ",
    633         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->I2cSerialBus.Flags, 1)]);
    634 
    635     /* Insert a descriptor name */
    636 
    637     AcpiDmDescriptorName ();
    638 
    639     /* Share */
    640 
    641     AcpiOsPrintf (", %s,\n",
    642         AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->I2cSerialBus.Flags, 2)]);
    643 
    644     /* Dump the vendor data */
    645 
    646     AcpiDmIndent (Level + 1);
    647     AcpiDmDumpSerialBusVendorData (Resource, Level);
    648     AcpiOsPrintf (")\n");
    649 
    650     MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
    651 }
    652 
    653 
    654 /*******************************************************************************
    655  *
    656  * FUNCTION:    AcpiDmSpiSerialBusDescriptor
    657  *
    658  * PARAMETERS:  Info                - Extra resource info
    659  *              Resource            - Pointer to the resource descriptor
    660  *              Length              - Length of the descriptor in bytes
    661  *              Level               - Current source code indentation level
    662  *
    663  * RETURN:      None
    664  *
    665  * DESCRIPTION: Decode a SPI serial bus descriptor
    666  *
    667  ******************************************************************************/
    668 
    669 static void
    670 AcpiDmSpiSerialBusDescriptor (
    671     ACPI_OP_WALK_INFO       *Info,
    672     AML_RESOURCE            *Resource,
    673     UINT32                  Length,
    674     UINT32                  Level)
    675 {
    676     UINT32                  ResourceSourceOffset;
    677     char                    *DeviceName;
    678 
    679 
    680     /* DeviceSelection, DeviceSelectionPolarity, WireMode, DataBitLength */
    681 
    682     AcpiDmIndent (Level);
    683     AcpiOsPrintf ("SpiSerialBusV2 (0x%4.4X, %s, %s, 0x%2.2X,\n",
    684         Resource->SpiSerialBus.DeviceSelection,
    685         AcpiGbl_DpDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags, 1)],
    686         AcpiGbl_WmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags)],
    687         Resource->SpiSerialBus.DataBitLength);
    688 
    689     /* SlaveMode, ConnectionSpeed, ClockPolarity, ClockPhase */
    690 
    691     AcpiDmIndent (Level + 1);
    692     AcpiOsPrintf ("%s, 0x%8.8X, %s,\n",
    693         AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.Flags)],
    694         Resource->SpiSerialBus.ConnectionSpeed,
    695         AcpiGbl_CpoDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.ClockPolarity)]);
    696 
    697     AcpiDmIndent (Level + 1);
    698     AcpiOsPrintf ("%s, ",
    699         AcpiGbl_CphDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.ClockPhase)]);
    700 
    701     /* ResourceSource is a required field */
    702 
    703     ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
    704         Resource->CommonSerialBus.TypeDataLength;
    705 
    706     DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
    707     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
    708 
    709     /* ResourceSourceIndex, ResourceUsage */
    710 
    711     AcpiOsPrintf (",\n");
    712     AcpiDmIndent (Level + 1);
    713     AcpiOsPrintf ("0x%2.2X, ", Resource->SpiSerialBus.ResSourceIndex);
    714 
    715     AcpiOsPrintf ("%s, ",
    716         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.Flags, 1)]);
    717 
    718     /* Insert a descriptor name */
    719 
    720     AcpiDmDescriptorName ();
    721 
    722     /* Share */
    723 
    724     AcpiOsPrintf (", %s,\n",
    725         AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.Flags, 2)]);
    726 
    727     /* Dump the vendor data */
    728 
    729     AcpiDmIndent (Level + 1);
    730     AcpiDmDumpSerialBusVendorData (Resource, Level);
    731     AcpiOsPrintf (")\n");
    732 
    733     MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
    734 }
    735 
    736 
    737 /*******************************************************************************
    738  *
    739  * FUNCTION:    AcpiDmUartSerialBusDescriptor
    740  *
    741  * PARAMETERS:  Info                - Extra resource info
    742  *              Resource            - Pointer to the resource descriptor
    743  *              Length              - Length of the descriptor in bytes
    744  *              Level               - Current source code indentation level
    745  *
    746  * RETURN:      None
    747  *
    748  * DESCRIPTION: Decode a UART serial bus descriptor
    749  *
    750  ******************************************************************************/
    751 
    752 static void
    753 AcpiDmUartSerialBusDescriptor (
    754     ACPI_OP_WALK_INFO       *Info,
    755     AML_RESOURCE            *Resource,
    756     UINT32                  Length,
    757     UINT32                  Level)
    758 {
    759     UINT32                  ResourceSourceOffset;
    760     char                    *DeviceName;
    761 
    762 
    763     /* ConnectionSpeed, BitsPerByte, StopBits */
    764 
    765     AcpiDmIndent (Level);
    766     AcpiOsPrintf ("UartSerialBusV2 (0x%8.8X, %s, %s,\n",
    767         Resource->UartSerialBus.DefaultBaudRate,
    768         AcpiGbl_BpbDecode [ACPI_EXTRACT_3BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 4)],
    769         AcpiGbl_SbDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 2)]);
    770 
    771     /* LinesInUse, IsBigEndian, Parity, FlowControl */
    772 
    773     AcpiDmIndent (Level + 1);
    774     AcpiOsPrintf ("0x%2.2X, %s, %s, %s,\n",
    775         Resource->UartSerialBus.LinesEnabled,
    776         AcpiGbl_EdDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 7)],
    777         AcpiGbl_PtDecode [ACPI_GET_3BIT_FLAG (Resource->UartSerialBus.Parity)],
    778         AcpiGbl_FcDecode [ACPI_GET_2BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags)]);
    779 
    780     /* ReceiveBufferSize, TransmitBufferSize */
    781 
    782     AcpiDmIndent (Level + 1);
    783     AcpiOsPrintf ("0x%4.4X, 0x%4.4X, ",
    784         Resource->UartSerialBus.RxFifoSize,
    785         Resource->UartSerialBus.TxFifoSize);
    786 
    787     /* ResourceSource is a required field */
    788 
    789     ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
    790         Resource->CommonSerialBus.TypeDataLength;
    791 
    792     DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
    793     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
    794 
    795     /* ResourceSourceIndex, ResourceUsage */
    796 
    797     AcpiOsPrintf (",\n");
    798     AcpiDmIndent (Level + 1);
    799     AcpiOsPrintf ("0x%2.2X, ", Resource->UartSerialBus.ResSourceIndex);
    800 
    801     AcpiOsPrintf ("%s, ",
    802         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.Flags, 1)]);
    803 
    804     /* Insert a descriptor name */
    805 
    806     AcpiDmDescriptorName ();
    807 
    808     /* Share */
    809 
    810     AcpiOsPrintf (", %s,\n",
    811         AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.Flags, 2)]);
    812 
    813     /* Dump the vendor data */
    814 
    815     AcpiDmIndent (Level + 1);
    816     AcpiDmDumpSerialBusVendorData (Resource, Level);
    817     AcpiOsPrintf (")\n");
    818 
    819     MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
    820 }
    821 
    822 
    823 /*******************************************************************************
    824  *
    825  * FUNCTION:    AcpiDmSerialBusDescriptor
    826  *
    827  * PARAMETERS:  Info                - Extra resource info
    828  *              Resource            - Pointer to the resource descriptor
    829  *              Length              - Length of the descriptor in bytes
    830  *              Level               - Current source code indentation level
    831  *
    832  * RETURN:      None
    833  *
    834  * DESCRIPTION: Decode a I2C/SPI/UART serial bus descriptor
    835  *
    836  ******************************************************************************/
    837 
    838 void
    839 AcpiDmSerialBusDescriptor (
    840     ACPI_OP_WALK_INFO       *Info,
    841     AML_RESOURCE            *Resource,
    842     UINT32                  Length,
    843     UINT32                  Level)
    844 {
    845 
    846     SerialBusResourceDispatch [Resource->CommonSerialBus.Type] (
    847         Info, Resource, Length, Level);
    848 }
    849 
    850 /*******************************************************************************
    851  *
    852  * FUNCTION:    AcpiDmPinConfig
    853  *
    854  * PARAMETERS:  PinConfigType       - Pin configuration type
    855  *              PinConfigValue      - Pin configuration value
    856  *
    857  * RETURN:      None
    858  *
    859  * DESCRIPTION: Pretty prints PinConfig type and value.
    860  *
    861  ******************************************************************************/
    862 
    863 static void
    864 AcpiDmPinConfig(
    865     UINT8                   PinConfigType,
    866     UINT32                  PinConfigValue)
    867 {
    868     if (PinConfigType <= 13)
    869     {
    870         AcpiOsPrintf ("0x%2.2X /* %s */, ", PinConfigType,
    871             AcpiGbl_PtypDecode[PinConfigType]);
    872     }
    873     else
    874     {
    875         AcpiOsPrintf ("0x%2.2X, /* Vendor Defined */ ", PinConfigType);
    876     }
    877 
    878     /* PinConfigValue */
    879 
    880     AcpiOsPrintf ("0x%4.4X,\n", PinConfigValue);
    881 }
    882 
    883 /*******************************************************************************
    884  *
    885  * FUNCTION:    AcpiDmPinConfigDescriptor
    886  *
    887  * PARAMETERS:  Info                - Extra resource info
    888  *              Resource            - Pointer to the resource descriptor
    889  *              Length              - Length of the descriptor in bytes
    890  *              Level               - Current source code indentation level
    891  *
    892  * RETURN:      None
    893  *
    894  * DESCRIPTION: Decode a PinConfig descriptor
    895  *
    896  ******************************************************************************/
    897 
    898 void
    899 AcpiDmPinConfigDescriptor (
    900     ACPI_OP_WALK_INFO       *Info,
    901     AML_RESOURCE            *Resource,
    902     UINT32                  Length,
    903     UINT32                  Level)
    904 {
    905     UINT16                  *PinList;
    906     UINT8                   *VendorData;
    907     char                    *DeviceName = NULL;
    908     UINT32                  PinCount;
    909     UINT32                  i;
    910 
    911     AcpiDmIndent (Level);
    912     AcpiOsPrintf ("PinConfig (%s, ",
    913         AcpiGbl_ShrDecode [ACPI_GET_1BIT_FLAG (Resource->PinConfig.Flags)]);
    914 
    915     AcpiDmPinConfig (Resource->PinConfig.PinConfigType,
    916         Resource->PinConfig.PinConfigValue);
    917 
    918     AcpiDmIndent (Level + 1);
    919 
    920     if (Resource->PinConfig.ResSourceOffset)
    921     {
    922         DeviceName = ACPI_ADD_PTR (char,
    923             Resource, Resource->PinConfig.ResSourceOffset),
    924         AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
    925     }
    926 
    927     AcpiOsPrintf (", ");
    928     AcpiOsPrintf ("0x%2.2X, ", Resource->PinConfig.ResSourceIndex);
    929 
    930     AcpiOsPrintf ("%s, ",
    931         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->PinConfig.Flags, 1)]);
    932 
    933     /* Insert a descriptor name */
    934 
    935     AcpiDmDescriptorName ();
    936 
    937     AcpiOsPrintf (",");
    938 
    939     /* Dump the vendor data */
    940 
    941     if (Resource->PinConfig.VendorLength)
    942     {
    943         AcpiOsPrintf ("\n");
    944         AcpiDmIndent (Level + 1);
    945         VendorData = ACPI_ADD_PTR (UINT8, Resource,
    946             Resource->PinConfig.VendorOffset);
    947 
    948         AcpiDmDumpRawDataBuffer (VendorData,
    949             Resource->PinConfig.VendorLength, Level);
    950     }
    951 
    952     AcpiOsPrintf (")\n");
    953 
    954     AcpiDmIndent (Level + 1);
    955 
    956     /* Dump the interrupt list */
    957 
    958     AcpiOsPrintf ("{   // Pin list\n");
    959 
    960     PinCount = ((UINT32) (Resource->PinConfig.ResSourceOffset -
    961         Resource->PinConfig.PinTableOffset)) /
    962         sizeof (UINT16);
    963 
    964     PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
    965         Resource->PinConfig.PinTableOffset);
    966 
    967     for (i = 0; i < PinCount; i++)
    968     {
    969         AcpiDmIndent (Level + 2);
    970         AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
    971             ((i + 1) < PinCount) ? "," : "");
    972     }
    973 
    974     AcpiDmIndent (Level + 1);
    975     AcpiOsPrintf ("}\n");
    976 }
    977 
    978 /*******************************************************************************
    979  *
    980  * FUNCTION:    AcpiDmPinGroupDescriptor
    981  *
    982  * PARAMETERS:  Info                - Extra resource info
    983  *              Resource            - Pointer to the resource descriptor
    984  *              Length              - Length of the descriptor in bytes
    985  *              Level               - Current source code indentation level
    986  *
    987  * RETURN:      None
    988  *
    989  * DESCRIPTION: Decode a PinGroup descriptor
    990  *
    991  ******************************************************************************/
    992 
    993 void
    994 AcpiDmPinGroupDescriptor (
    995     ACPI_OP_WALK_INFO       *Info,
    996     AML_RESOURCE            *Resource,
    997     UINT32                  Length,
    998     UINT32                  Level)
    999 {
   1000     char                    *Label;
   1001     UINT16                  *PinList;
   1002     UINT8                   *VendorData;
   1003     UINT32                  PinCount;
   1004     UINT32                  i;
   1005 
   1006     AcpiDmIndent (Level);
   1007     /* Always producer */
   1008     AcpiOsPrintf ("PinGroup (");
   1009 
   1010     Label = ACPI_ADD_PTR (char,
   1011         Resource, Resource->PinGroup.LabelOffset),
   1012     AcpiUtPrintString (Label, ACPI_UINT16_MAX);
   1013 
   1014     AcpiOsPrintf (", ");
   1015 
   1016     AcpiOsPrintf ("%s, ",
   1017         AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->PinGroup.Flags)]);
   1018 
   1019     /* Insert a descriptor name */
   1020 
   1021     AcpiDmDescriptorName ();
   1022 
   1023     AcpiOsPrintf (",");
   1024 
   1025     /* Dump the vendor data */
   1026 
   1027     if (Resource->PinGroup.VendorLength)
   1028     {
   1029         AcpiOsPrintf ("\n");
   1030         AcpiDmIndent (Level + 1);
   1031         VendorData = ACPI_ADD_PTR (UINT8, Resource,
   1032             Resource->PinGroup.VendorOffset);
   1033 
   1034         AcpiDmDumpRawDataBuffer (VendorData,
   1035             Resource->PinGroup.VendorLength, Level);
   1036     }
   1037 
   1038     AcpiOsPrintf (")\n");
   1039 
   1040     AcpiDmIndent (Level + 1);
   1041 
   1042     /* Dump the interrupt list */
   1043 
   1044     AcpiOsPrintf ("{   // Pin list\n");
   1045 
   1046     PinCount = (Resource->PinGroup.LabelOffset -
   1047         Resource->PinGroup.PinTableOffset) / sizeof (UINT16);
   1048 
   1049     PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
   1050         Resource->PinGroup.PinTableOffset);
   1051 
   1052     for (i = 0; i < PinCount; i++)
   1053     {
   1054         AcpiDmIndent (Level + 2);
   1055         AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
   1056             ((i + 1) < PinCount) ? "," : "");
   1057     }
   1058 
   1059     AcpiDmIndent (Level + 1);
   1060     AcpiOsPrintf ("}\n");
   1061 }
   1062 
   1063 /*******************************************************************************
   1064  *
   1065  * FUNCTION:    AcpiDmPinGroupFunctionDescriptor
   1066  *
   1067  * PARAMETERS:  Info                - Extra resource info
   1068  *              Resource            - Pointer to the resource descriptor
   1069  *              Length              - Length of the descriptor in bytes
   1070  *              Level               - Current source code indentation level
   1071  *
   1072  * RETURN:      None
   1073  *
   1074  * DESCRIPTION: Decode a PinGroupFunction descriptor
   1075  *
   1076  ******************************************************************************/
   1077 
   1078 void
   1079 AcpiDmPinGroupFunctionDescriptor (
   1080     ACPI_OP_WALK_INFO       *Info,
   1081     AML_RESOURCE            *Resource,
   1082     UINT32                  Length,
   1083     UINT32                  Level)
   1084 {
   1085     UINT8                   *VendorData;
   1086     char                    *DeviceName = NULL;
   1087     char                    *Label = NULL;
   1088 
   1089     AcpiDmIndent (Level);
   1090     AcpiOsPrintf ("PinGroupFunction (%s, ",
   1091         AcpiGbl_ShrDecode [ACPI_GET_1BIT_FLAG (Resource->PinGroupFunction.Flags)]);
   1092 
   1093     /* FunctionNumber */
   1094 
   1095     AcpiOsPrintf ("0x%4.4X, ", Resource->PinGroupFunction.FunctionNumber);
   1096 
   1097     DeviceName = ACPI_ADD_PTR (char,
   1098         Resource, Resource->PinGroupFunction.ResSourceOffset),
   1099     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
   1100 
   1101     AcpiOsPrintf (", ");
   1102     AcpiOsPrintf ("0x%2.2X,\n", Resource->PinGroupFunction.ResSourceIndex);
   1103 
   1104     AcpiDmIndent (Level + 1);
   1105 
   1106     Label = ACPI_ADD_PTR (char, Resource,
   1107         Resource->PinGroupFunction.ResSourceLabelOffset);
   1108     AcpiUtPrintString (Label, ACPI_UINT16_MAX);
   1109 
   1110     AcpiOsPrintf (", ");
   1111 
   1112     AcpiOsPrintf ("%s, ",
   1113         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->PinGroupFunction.Flags, 1)]);
   1114 
   1115     /* Insert a descriptor name */
   1116 
   1117     AcpiDmDescriptorName ();
   1118 
   1119     AcpiOsPrintf (",");
   1120 
   1121     /* Dump the vendor data */
   1122 
   1123     if (Resource->PinGroupFunction.VendorLength)
   1124     {
   1125         AcpiOsPrintf ("\n");
   1126         AcpiDmIndent (Level + 1);
   1127         VendorData = ACPI_ADD_PTR (UINT8, Resource,
   1128             Resource->PinGroupFunction.VendorOffset);
   1129 
   1130         AcpiDmDumpRawDataBuffer (VendorData,
   1131             Resource->PinGroupFunction.VendorLength, Level);
   1132     }
   1133 
   1134     AcpiOsPrintf (")\n");
   1135 }
   1136 
   1137 /*******************************************************************************
   1138  *
   1139  * FUNCTION:    AcpiDmPinGroupConfigDescriptor
   1140  *
   1141  * PARAMETERS:  Info                - Extra resource info
   1142  *              Resource            - Pointer to the resource descriptor
   1143  *              Length              - Length of the descriptor in bytes
   1144  *              Level               - Current source code indentation level
   1145  *
   1146  * RETURN:      None
   1147  *
   1148  * DESCRIPTION: Decode a PinGroupConfig descriptor
   1149  *
   1150  ******************************************************************************/
   1151 
   1152 void
   1153 AcpiDmPinGroupConfigDescriptor (
   1154     ACPI_OP_WALK_INFO       *Info,
   1155     AML_RESOURCE            *Resource,
   1156     UINT32                  Length,
   1157     UINT32                  Level)
   1158 {
   1159     UINT8                   *VendorData;
   1160     char                    *DeviceName = NULL;
   1161     char                    *Label = NULL;
   1162 
   1163     AcpiDmIndent (Level);
   1164     AcpiOsPrintf ("PinGroupConfig (%s, ",
   1165         AcpiGbl_ShrDecode [ACPI_GET_1BIT_FLAG (Resource->PinGroupConfig.Flags)]);
   1166 
   1167     AcpiDmPinConfig(Resource->PinGroupConfig.PinConfigType,
   1168         Resource->PinGroupConfig.PinConfigValue);
   1169 
   1170     AcpiDmIndent (Level + 1);
   1171 
   1172     DeviceName = ACPI_ADD_PTR (char,
   1173         Resource, Resource->PinGroupConfig.ResSourceOffset),
   1174     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
   1175 
   1176     AcpiOsPrintf (", ");
   1177     AcpiOsPrintf ("0x%2.2X, ", Resource->PinGroupConfig.ResSourceIndex);
   1178 
   1179     Label = ACPI_ADD_PTR (char, Resource,
   1180         Resource->PinGroupConfig.ResSourceLabelOffset);
   1181     AcpiUtPrintString (Label, ACPI_UINT16_MAX);
   1182 
   1183     AcpiOsPrintf (", ");
   1184 
   1185     AcpiOsPrintf ("%s, ",
   1186         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->PinGroupConfig.Flags, 1)]);
   1187 
   1188     /* Insert a descriptor name */
   1189 
   1190     AcpiDmDescriptorName ();
   1191 
   1192     AcpiOsPrintf (",");
   1193 
   1194     /* Dump the vendor data */
   1195 
   1196     if (Resource->PinGroupConfig.VendorLength)
   1197     {
   1198         AcpiOsPrintf ("\n");
   1199         AcpiDmIndent (Level + 1);
   1200         VendorData = ACPI_ADD_PTR (UINT8, Resource,
   1201             Resource->PinGroupConfig.VendorOffset);
   1202 
   1203         AcpiDmDumpRawDataBuffer (VendorData,
   1204             Resource->PinGroupConfig.VendorLength, Level);
   1205     }
   1206 
   1207     AcpiOsPrintf (")\n");
   1208 }
   1209