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