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