Home | History | Annotate | Line # | Download | only in disassembler
dmresrcl2.c revision 1.1.1.5
      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.4  christos  * Copyright (C) 2000 - 2016, 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  christos 
    411      1.1  christos /*******************************************************************************
    412      1.1  christos  *
    413      1.1  christos  * FUNCTION:    AcpiDmDumpSerialBusVendorData
    414      1.1  christos  *
    415      1.1  christos  * PARAMETERS:  Resource            - Pointer to the resource descriptor
    416      1.1  christos  *
    417      1.1  christos  * RETURN:      None
    418      1.1  christos  *
    419      1.1  christos  * DESCRIPTION: Dump optional serial bus vendor data
    420      1.1  christos  *
    421      1.1  christos  ******************************************************************************/
    422      1.1  christos 
    423      1.1  christos static void
    424      1.1  christos AcpiDmDumpSerialBusVendorData (
    425      1.1  christos     AML_RESOURCE            *Resource,
    426      1.1  christos     UINT32                  Level)
    427      1.1  christos {
    428      1.1  christos     UINT8                   *VendorData;
    429      1.1  christos     UINT32                  VendorLength;
    430      1.1  christos 
    431      1.1  christos 
    432      1.1  christos     /* Get the (optional) vendor data and length */
    433      1.1  christos 
    434      1.1  christos     switch (Resource->CommonSerialBus.Type)
    435      1.1  christos     {
    436      1.1  christos     case AML_RESOURCE_I2C_SERIALBUSTYPE:
    437      1.1  christos 
    438      1.1  christos         VendorLength = Resource->CommonSerialBus.TypeDataLength -
    439      1.1  christos             AML_RESOURCE_I2C_MIN_DATA_LEN;
    440      1.1  christos 
    441      1.1  christos         VendorData = ACPI_ADD_PTR (UINT8, Resource,
    442      1.1  christos             sizeof (AML_RESOURCE_I2C_SERIALBUS));
    443      1.1  christos         break;
    444      1.1  christos 
    445      1.1  christos     case AML_RESOURCE_SPI_SERIALBUSTYPE:
    446      1.1  christos 
    447      1.1  christos         VendorLength = Resource->CommonSerialBus.TypeDataLength -
    448      1.1  christos             AML_RESOURCE_SPI_MIN_DATA_LEN;
    449      1.1  christos 
    450      1.1  christos         VendorData = ACPI_ADD_PTR (UINT8, Resource,
    451      1.1  christos             sizeof (AML_RESOURCE_SPI_SERIALBUS));
    452      1.1  christos         break;
    453      1.1  christos 
    454      1.1  christos     case AML_RESOURCE_UART_SERIALBUSTYPE:
    455      1.1  christos 
    456      1.1  christos         VendorLength = Resource->CommonSerialBus.TypeDataLength -
    457      1.1  christos             AML_RESOURCE_UART_MIN_DATA_LEN;
    458      1.1  christos 
    459      1.1  christos         VendorData = ACPI_ADD_PTR (UINT8, Resource,
    460      1.1  christos             sizeof (AML_RESOURCE_UART_SERIALBUS));
    461      1.1  christos         break;
    462      1.1  christos 
    463      1.1  christos     default:
    464      1.1  christos 
    465      1.1  christos         return;
    466      1.1  christos     }
    467      1.1  christos 
    468      1.1  christos     /* Dump the vendor bytes as a RawDataBuffer object */
    469      1.1  christos 
    470      1.1  christos     AcpiDmDumpRawDataBuffer (VendorData, VendorLength, Level);
    471      1.1  christos }
    472      1.1  christos 
    473      1.1  christos 
    474      1.1  christos /*******************************************************************************
    475      1.1  christos  *
    476      1.1  christos  * FUNCTION:    AcpiDmI2cSerialBusDescriptor
    477      1.1  christos  *
    478  1.1.1.2  christos  * PARAMETERS:  Info                - Extra resource info
    479  1.1.1.2  christos  *              Resource            - Pointer to the resource descriptor
    480      1.1  christos  *              Length              - Length of the descriptor in bytes
    481      1.1  christos  *              Level               - Current source code indentation level
    482      1.1  christos  *
    483      1.1  christos  * RETURN:      None
    484      1.1  christos  *
    485      1.1  christos  * DESCRIPTION: Decode a I2C serial bus descriptor
    486      1.1  christos  *
    487      1.1  christos  ******************************************************************************/
    488      1.1  christos 
    489      1.1  christos static void
    490      1.1  christos AcpiDmI2cSerialBusDescriptor (
    491  1.1.1.2  christos     ACPI_OP_WALK_INFO       *Info,
    492      1.1  christos     AML_RESOURCE            *Resource,
    493      1.1  christos     UINT32                  Length,
    494      1.1  christos     UINT32                  Level)
    495      1.1  christos {
    496      1.1  christos     UINT32                  ResourceSourceOffset;
    497  1.1.1.2  christos     char                    *DeviceName;
    498      1.1  christos 
    499      1.1  christos 
    500      1.1  christos     /* SlaveAddress, SlaveMode, ConnectionSpeed, AddressingMode */
    501      1.1  christos 
    502      1.1  christos     AcpiDmIndent (Level);
    503  1.1.1.5  christos     AcpiOsPrintf ("I2cSerialBusV2 (0x%4.4X, %s, 0x%8.8X,\n",
    504      1.1  christos         Resource->I2cSerialBus.SlaveAddress,
    505      1.1  christos         AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.Flags)],
    506      1.1  christos         Resource->I2cSerialBus.ConnectionSpeed);
    507      1.1  christos 
    508      1.1  christos     AcpiDmIndent (Level + 1);
    509      1.1  christos     AcpiOsPrintf ("%s, ",
    510      1.1  christos         AcpiGbl_AmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.TypeSpecificFlags)]);
    511      1.1  christos 
    512      1.1  christos     /* ResourceSource is a required field */
    513      1.1  christos 
    514      1.1  christos     ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
    515      1.1  christos         Resource->CommonSerialBus.TypeDataLength;
    516      1.1  christos 
    517  1.1.1.2  christos     DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset),
    518  1.1.1.2  christos     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
    519      1.1  christos 
    520      1.1  christos     /* ResourceSourceIndex, ResourceUsage */
    521      1.1  christos 
    522      1.1  christos     AcpiOsPrintf (",\n");
    523      1.1  christos     AcpiDmIndent (Level + 1);
    524      1.1  christos     AcpiOsPrintf ("0x%2.2X, ", Resource->I2cSerialBus.ResSourceIndex);
    525      1.1  christos 
    526      1.1  christos     AcpiOsPrintf ("%s, ",
    527      1.1  christos         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->I2cSerialBus.Flags, 1)]);
    528      1.1  christos 
    529      1.1  christos     /* Insert a descriptor name */
    530      1.1  christos 
    531      1.1  christos     AcpiDmDescriptorName ();
    532  1.1.1.5  christos 
    533  1.1.1.5  christos     /* Share */
    534  1.1.1.5  christos 
    535  1.1.1.5  christos     AcpiOsPrintf (", %s,\n",
    536  1.1.1.5  christos         AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->I2cSerialBus.Flags, 2)]);
    537      1.1  christos 
    538      1.1  christos     /* Dump the vendor data */
    539      1.1  christos 
    540      1.1  christos     AcpiDmIndent (Level + 1);
    541      1.1  christos     AcpiDmDumpSerialBusVendorData (Resource, Level);
    542      1.1  christos     AcpiOsPrintf (")\n");
    543  1.1.1.2  christos 
    544  1.1.1.2  christos     MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
    545      1.1  christos }
    546      1.1  christos 
    547      1.1  christos 
    548      1.1  christos /*******************************************************************************
    549      1.1  christos  *
    550      1.1  christos  * FUNCTION:    AcpiDmSpiSerialBusDescriptor
    551      1.1  christos  *
    552  1.1.1.2  christos  * PARAMETERS:  Info                - Extra resource info
    553  1.1.1.2  christos  *              Resource            - Pointer to the resource descriptor
    554      1.1  christos  *              Length              - Length of the descriptor in bytes
    555      1.1  christos  *              Level               - Current source code indentation level
    556      1.1  christos  *
    557      1.1  christos  * RETURN:      None
    558      1.1  christos  *
    559      1.1  christos  * DESCRIPTION: Decode a SPI serial bus descriptor
    560      1.1  christos  *
    561      1.1  christos  ******************************************************************************/
    562      1.1  christos 
    563      1.1  christos static void
    564      1.1  christos AcpiDmSpiSerialBusDescriptor (
    565  1.1.1.2  christos     ACPI_OP_WALK_INFO       *Info,
    566      1.1  christos     AML_RESOURCE            *Resource,
    567      1.1  christos     UINT32                  Length,
    568      1.1  christos     UINT32                  Level)
    569      1.1  christos {
    570      1.1  christos     UINT32                  ResourceSourceOffset;
    571  1.1.1.2  christos     char                    *DeviceName;
    572      1.1  christos 
    573      1.1  christos 
    574      1.1  christos     /* DeviceSelection, DeviceSelectionPolarity, WireMode, DataBitLength */
    575      1.1  christos 
    576      1.1  christos     AcpiDmIndent (Level);
    577  1.1.1.5  christos     AcpiOsPrintf ("SpiSerialBusV2 (0x%4.4X, %s, %s, 0x%2.2X,\n",
    578      1.1  christos         Resource->SpiSerialBus.DeviceSelection,
    579      1.1  christos         AcpiGbl_DpDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags, 1)],
    580      1.1  christos         AcpiGbl_WmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags)],
    581      1.1  christos         Resource->SpiSerialBus.DataBitLength);
    582      1.1  christos 
    583      1.1  christos     /* SlaveMode, ConnectionSpeed, ClockPolarity, ClockPhase */
    584      1.1  christos 
    585      1.1  christos     AcpiDmIndent (Level + 1);
    586      1.1  christos     AcpiOsPrintf ("%s, 0x%8.8X, %s,\n",
    587      1.1  christos         AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.Flags)],
    588      1.1  christos         Resource->SpiSerialBus.ConnectionSpeed,
    589      1.1  christos         AcpiGbl_CpoDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.ClockPolarity)]);
    590      1.1  christos 
    591      1.1  christos     AcpiDmIndent (Level + 1);
    592      1.1  christos     AcpiOsPrintf ("%s, ",
    593      1.1  christos         AcpiGbl_CphDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.ClockPhase)]);
    594      1.1  christos 
    595      1.1  christos     /* ResourceSource is a required field */
    596      1.1  christos 
    597      1.1  christos     ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
    598      1.1  christos         Resource->CommonSerialBus.TypeDataLength;
    599      1.1  christos 
    600  1.1.1.2  christos     DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset),
    601  1.1.1.2  christos     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
    602      1.1  christos 
    603      1.1  christos     /* ResourceSourceIndex, ResourceUsage */
    604      1.1  christos 
    605      1.1  christos     AcpiOsPrintf (",\n");
    606      1.1  christos     AcpiDmIndent (Level + 1);
    607      1.1  christos     AcpiOsPrintf ("0x%2.2X, ", Resource->SpiSerialBus.ResSourceIndex);
    608      1.1  christos 
    609      1.1  christos     AcpiOsPrintf ("%s, ",
    610      1.1  christos         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.Flags, 1)]);
    611      1.1  christos 
    612      1.1  christos     /* Insert a descriptor name */
    613      1.1  christos 
    614      1.1  christos     AcpiDmDescriptorName ();
    615  1.1.1.5  christos 
    616  1.1.1.5  christos     /* Share */
    617  1.1.1.5  christos 
    618  1.1.1.5  christos     AcpiOsPrintf (", %s,\n",
    619  1.1.1.5  christos         AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.Flags, 2)]);
    620      1.1  christos 
    621      1.1  christos     /* Dump the vendor data */
    622      1.1  christos 
    623      1.1  christos     AcpiDmIndent (Level + 1);
    624      1.1  christos     AcpiDmDumpSerialBusVendorData (Resource, Level);
    625      1.1  christos     AcpiOsPrintf (")\n");
    626  1.1.1.2  christos 
    627  1.1.1.2  christos     MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
    628      1.1  christos }
    629      1.1  christos 
    630      1.1  christos 
    631      1.1  christos /*******************************************************************************
    632      1.1  christos  *
    633      1.1  christos  * FUNCTION:    AcpiDmUartSerialBusDescriptor
    634      1.1  christos  *
    635  1.1.1.2  christos  * PARAMETERS:  Info                - Extra resource info
    636  1.1.1.2  christos  *              Resource            - Pointer to the resource descriptor
    637      1.1  christos  *              Length              - Length of the descriptor in bytes
    638      1.1  christos  *              Level               - Current source code indentation level
    639      1.1  christos  *
    640      1.1  christos  * RETURN:      None
    641      1.1  christos  *
    642      1.1  christos  * DESCRIPTION: Decode a UART serial bus descriptor
    643      1.1  christos  *
    644      1.1  christos  ******************************************************************************/
    645      1.1  christos 
    646      1.1  christos static void
    647      1.1  christos AcpiDmUartSerialBusDescriptor (
    648  1.1.1.2  christos     ACPI_OP_WALK_INFO       *Info,
    649      1.1  christos     AML_RESOURCE            *Resource,
    650      1.1  christos     UINT32                  Length,
    651      1.1  christos     UINT32                  Level)
    652      1.1  christos {
    653      1.1  christos     UINT32                  ResourceSourceOffset;
    654  1.1.1.2  christos     char                    *DeviceName;
    655      1.1  christos 
    656      1.1  christos 
    657      1.1  christos     /* ConnectionSpeed, BitsPerByte, StopBits */
    658      1.1  christos 
    659      1.1  christos     AcpiDmIndent (Level);
    660  1.1.1.5  christos     AcpiOsPrintf ("UartSerialBusV2 (0x%8.8X, %s, %s,\n",
    661      1.1  christos         Resource->UartSerialBus.DefaultBaudRate,
    662      1.1  christos         AcpiGbl_BpbDecode [ACPI_EXTRACT_3BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 4)],
    663      1.1  christos         AcpiGbl_SbDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 2)]);
    664      1.1  christos 
    665      1.1  christos     /* LinesInUse, IsBigEndian, Parity, FlowControl */
    666      1.1  christos 
    667      1.1  christos     AcpiDmIndent (Level + 1);
    668      1.1  christos     AcpiOsPrintf ("0x%2.2X, %s, %s, %s,\n",
    669      1.1  christos         Resource->UartSerialBus.LinesEnabled,
    670      1.1  christos         AcpiGbl_EdDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 7)],
    671      1.1  christos         AcpiGbl_PtDecode [ACPI_GET_3BIT_FLAG (Resource->UartSerialBus.Parity)],
    672      1.1  christos         AcpiGbl_FcDecode [ACPI_GET_2BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags)]);
    673      1.1  christos 
    674      1.1  christos     /* ReceiveBufferSize, TransmitBufferSize */
    675      1.1  christos 
    676      1.1  christos     AcpiDmIndent (Level + 1);
    677      1.1  christos     AcpiOsPrintf ("0x%4.4X, 0x%4.4X, ",
    678      1.1  christos         Resource->UartSerialBus.RxFifoSize,
    679      1.1  christos         Resource->UartSerialBus.TxFifoSize);
    680      1.1  christos 
    681      1.1  christos     /* ResourceSource is a required field */
    682      1.1  christos 
    683      1.1  christos     ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
    684      1.1  christos         Resource->CommonSerialBus.TypeDataLength;
    685      1.1  christos 
    686  1.1.1.2  christos     DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset),
    687  1.1.1.2  christos     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
    688      1.1  christos 
    689      1.1  christos     /* ResourceSourceIndex, ResourceUsage */
    690      1.1  christos 
    691      1.1  christos     AcpiOsPrintf (",\n");
    692      1.1  christos     AcpiDmIndent (Level + 1);
    693      1.1  christos     AcpiOsPrintf ("0x%2.2X, ", Resource->UartSerialBus.ResSourceIndex);
    694      1.1  christos 
    695      1.1  christos     AcpiOsPrintf ("%s, ",
    696      1.1  christos         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.Flags, 1)]);
    697      1.1  christos 
    698      1.1  christos     /* Insert a descriptor name */
    699      1.1  christos 
    700      1.1  christos     AcpiDmDescriptorName ();
    701  1.1.1.5  christos 
    702  1.1.1.5  christos     /* Share */
    703  1.1.1.5  christos 
    704  1.1.1.5  christos     AcpiOsPrintf (", %s,\n",
    705  1.1.1.5  christos         AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.Flags, 2)]);
    706      1.1  christos 
    707      1.1  christos     /* Dump the vendor data */
    708      1.1  christos 
    709      1.1  christos     AcpiDmIndent (Level + 1);
    710      1.1  christos     AcpiDmDumpSerialBusVendorData (Resource, Level);
    711      1.1  christos     AcpiOsPrintf (")\n");
    712  1.1.1.2  christos 
    713  1.1.1.2  christos     MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
    714      1.1  christos }
    715      1.1  christos 
    716      1.1  christos 
    717      1.1  christos /*******************************************************************************
    718      1.1  christos  *
    719      1.1  christos  * FUNCTION:    AcpiDmSerialBusDescriptor
    720      1.1  christos  *
    721  1.1.1.2  christos  * PARAMETERS:  Info                - Extra resource info
    722  1.1.1.2  christos  *              Resource            - Pointer to the resource descriptor
    723      1.1  christos  *              Length              - Length of the descriptor in bytes
    724      1.1  christos  *              Level               - Current source code indentation level
    725      1.1  christos  *
    726      1.1  christos  * RETURN:      None
    727      1.1  christos  *
    728      1.1  christos  * DESCRIPTION: Decode a I2C/SPI/UART serial bus descriptor
    729      1.1  christos  *
    730      1.1  christos  ******************************************************************************/
    731      1.1  christos 
    732      1.1  christos void
    733      1.1  christos AcpiDmSerialBusDescriptor (
    734  1.1.1.2  christos     ACPI_OP_WALK_INFO       *Info,
    735      1.1  christos     AML_RESOURCE            *Resource,
    736      1.1  christos     UINT32                  Length,
    737      1.1  christos     UINT32                  Level)
    738      1.1  christos {
    739      1.1  christos 
    740      1.1  christos     SerialBusResourceDispatch [Resource->CommonSerialBus.Type] (
    741  1.1.1.2  christos         Info, Resource, Length, Level);
    742      1.1  christos }
    743