Home | History | Annotate | Line # | Download | only in disassembler
dmresrc.c revision 1.3.24.1
      1       1.1  jruoho /*******************************************************************************
      2       1.1  jruoho  *
      3       1.1  jruoho  * Module Name: dmresrc.c - Resource Descriptor disassembly
      4       1.1  jruoho  *
      5       1.1  jruoho  ******************************************************************************/
      6       1.1  jruoho 
      7       1.3  jruoho /*
      8  1.3.24.1   rmind  * Copyright (C) 2000 - 2013, Intel Corp.
      9       1.1  jruoho  * All rights reserved.
     10       1.1  jruoho  *
     11       1.3  jruoho  * Redistribution and use in source and binary forms, with or without
     12       1.3  jruoho  * modification, are permitted provided that the following conditions
     13       1.3  jruoho  * are met:
     14       1.3  jruoho  * 1. Redistributions of source code must retain the above copyright
     15       1.3  jruoho  *    notice, this list of conditions, and the following disclaimer,
     16       1.3  jruoho  *    without modification.
     17       1.3  jruoho  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     18       1.3  jruoho  *    substantially similar to the "NO WARRANTY" disclaimer below
     19       1.3  jruoho  *    ("Disclaimer") and any redistribution must be conditioned upon
     20       1.3  jruoho  *    including a substantially similar Disclaimer requirement for further
     21       1.3  jruoho  *    binary redistribution.
     22       1.3  jruoho  * 3. Neither the names of the above-listed copyright holders nor the names
     23       1.3  jruoho  *    of any contributors may be used to endorse or promote products derived
     24       1.3  jruoho  *    from this software without specific prior written permission.
     25       1.3  jruoho  *
     26       1.3  jruoho  * Alternatively, this software may be distributed under the terms of the
     27       1.3  jruoho  * GNU General Public License ("GPL") version 2 as published by the Free
     28       1.3  jruoho  * Software Foundation.
     29       1.3  jruoho  *
     30       1.3  jruoho  * NO WARRANTY
     31       1.3  jruoho  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     32       1.3  jruoho  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     33       1.3  jruoho  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
     34       1.3  jruoho  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     35       1.3  jruoho  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     36       1.3  jruoho  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     37       1.3  jruoho  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     38       1.3  jruoho  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     39       1.3  jruoho  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     40       1.3  jruoho  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     41       1.3  jruoho  * POSSIBILITY OF SUCH DAMAGES.
     42       1.3  jruoho  */
     43       1.1  jruoho 
     44       1.1  jruoho 
     45       1.1  jruoho #include "acpi.h"
     46       1.1  jruoho #include "accommon.h"
     47       1.1  jruoho #include "amlcode.h"
     48       1.1  jruoho #include "acdisasm.h"
     49       1.1  jruoho 
     50       1.1  jruoho #ifdef ACPI_DISASSEMBLER
     51       1.1  jruoho 
     52       1.1  jruoho #define _COMPONENT          ACPI_CA_DEBUGGER
     53       1.1  jruoho         ACPI_MODULE_NAME    ("dbresrc")
     54       1.1  jruoho 
     55       1.1  jruoho 
     56       1.1  jruoho /* Dispatch tables for Resource disassembly functions */
     57       1.1  jruoho 
     58       1.1  jruoho static ACPI_RESOURCE_HANDLER    AcpiGbl_DmResourceDispatch [] =
     59       1.1  jruoho {
     60       1.1  jruoho     /* Small descriptors */
     61       1.1  jruoho 
     62       1.1  jruoho     NULL,                           /* 0x00, Reserved */
     63       1.1  jruoho     NULL,                           /* 0x01, Reserved */
     64       1.1  jruoho     NULL,                           /* 0x02, Reserved */
     65       1.1  jruoho     NULL,                           /* 0x03, Reserved */
     66       1.1  jruoho     AcpiDmIrqDescriptor,            /* 0x04, ACPI_RESOURCE_NAME_IRQ_FORMAT */
     67       1.1  jruoho     AcpiDmDmaDescriptor,            /* 0x05, ACPI_RESOURCE_NAME_DMA_FORMAT */
     68       1.1  jruoho     AcpiDmStartDependentDescriptor, /* 0x06, ACPI_RESOURCE_NAME_START_DEPENDENT */
     69       1.1  jruoho     AcpiDmEndDependentDescriptor,   /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */
     70       1.1  jruoho     AcpiDmIoDescriptor,             /* 0x08, ACPI_RESOURCE_NAME_IO_PORT */
     71       1.1  jruoho     AcpiDmFixedIoDescriptor,        /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO_PORT */
     72  1.3.24.1   rmind     AcpiDmFixedDmaDescriptor,       /* 0x0A, ACPI_RESOURCE_NAME_FIXED_DMA */
     73       1.1  jruoho     NULL,                           /* 0x0B, Reserved */
     74       1.1  jruoho     NULL,                           /* 0x0C, Reserved */
     75       1.1  jruoho     NULL,                           /* 0x0D, Reserved */
     76       1.1  jruoho     AcpiDmVendorSmallDescriptor,    /* 0x0E, ACPI_RESOURCE_NAME_SMALL_VENDOR */
     77       1.1  jruoho     NULL,                           /* 0x0F, ACPI_RESOURCE_NAME_END_TAG (not used) */
     78       1.1  jruoho 
     79       1.1  jruoho     /* Large descriptors */
     80       1.1  jruoho 
     81       1.1  jruoho     NULL,                           /* 0x00, Reserved */
     82       1.1  jruoho     AcpiDmMemory24Descriptor,       /* 0x01, ACPI_RESOURCE_NAME_MEMORY_24 */
     83       1.1  jruoho     AcpiDmGenericRegisterDescriptor,/* 0x02, ACPI_RESOURCE_NAME_GENERIC_REGISTER */
     84       1.1  jruoho     NULL,                           /* 0x03, Reserved */
     85       1.1  jruoho     AcpiDmVendorLargeDescriptor,    /* 0x04, ACPI_RESOURCE_NAME_LARGE_VENDOR */
     86       1.1  jruoho     AcpiDmMemory32Descriptor,       /* 0x05, ACPI_RESOURCE_NAME_MEMORY_32 */
     87       1.1  jruoho     AcpiDmFixedMemory32Descriptor,  /* 0x06, ACPI_RESOURCE_NAME_FIXED_MEMORY_32 */
     88       1.1  jruoho     AcpiDmDwordDescriptor,          /* 0x07, ACPI_RESOURCE_NAME_DWORD_ADDRESS_SPACE */
     89       1.1  jruoho     AcpiDmWordDescriptor,           /* 0x08, ACPI_RESOURCE_NAME_WORD_ADDRESS_SPACE */
     90       1.1  jruoho     AcpiDmInterruptDescriptor,      /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_XRUPT */
     91       1.1  jruoho     AcpiDmQwordDescriptor,          /* 0x0A, ACPI_RESOURCE_NAME_QWORD_ADDRESS_SPACE */
     92  1.3.24.1   rmind     AcpiDmExtendedDescriptor,       /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS_SPACE */
     93  1.3.24.1   rmind     AcpiDmGpioDescriptor,           /* 0x0C, ACPI_RESOURCE_NAME_GPIO */
     94  1.3.24.1   rmind     NULL,                           /* 0x0D, Reserved */
     95  1.3.24.1   rmind     AcpiDmSerialBusDescriptor       /* 0x0E, ACPI_RESOURCE_NAME_SERIAL_BUS */
     96       1.1  jruoho };
     97       1.1  jruoho 
     98       1.1  jruoho 
     99       1.1  jruoho /* Only used for single-threaded applications */
    100       1.1  jruoho /* TBD: remove when name is passed as parameter to the dump functions */
    101       1.1  jruoho 
    102       1.1  jruoho static UINT32               ResourceName;
    103       1.1  jruoho 
    104       1.1  jruoho 
    105       1.1  jruoho /*******************************************************************************
    106       1.1  jruoho  *
    107       1.1  jruoho  * FUNCTION:    AcpiDmDescriptorName
    108       1.1  jruoho  *
    109       1.1  jruoho  * PARAMETERS:  None
    110       1.1  jruoho  *
    111       1.1  jruoho  * RETURN:      None
    112       1.1  jruoho  *
    113       1.1  jruoho  * DESCRIPTION: Emit a name for the descriptor if one is present (indicated
    114       1.1  jruoho  *              by the name being changed from the default name.) A name is only
    115       1.1  jruoho  *              emitted if a reference to the descriptor has been made somewhere
    116       1.1  jruoho  *              in the original ASL code.
    117       1.1  jruoho  *
    118       1.1  jruoho  ******************************************************************************/
    119       1.1  jruoho 
    120       1.1  jruoho void
    121       1.1  jruoho AcpiDmDescriptorName (
    122       1.1  jruoho     void)
    123       1.1  jruoho {
    124       1.1  jruoho 
    125       1.1  jruoho     if (ResourceName == ACPI_DEFAULT_RESNAME)
    126       1.1  jruoho     {
    127       1.1  jruoho         return;
    128       1.1  jruoho     }
    129       1.1  jruoho 
    130       1.1  jruoho     AcpiOsPrintf ("%4.4s", (char *) &ResourceName);
    131       1.1  jruoho }
    132       1.1  jruoho 
    133       1.1  jruoho 
    134       1.1  jruoho /*******************************************************************************
    135       1.1  jruoho  *
    136       1.1  jruoho  * FUNCTION:    AcpiDmDumpInteger*
    137       1.1  jruoho  *
    138       1.1  jruoho  * PARAMETERS:  Value               - Value to emit
    139       1.1  jruoho  *              Name                - Associated name (emitted as a comment)
    140       1.1  jruoho  *
    141       1.1  jruoho  * RETURN:      None
    142       1.1  jruoho  *
    143       1.1  jruoho  * DESCRIPTION: Integer output helper functions
    144       1.1  jruoho  *
    145       1.1  jruoho  ******************************************************************************/
    146       1.1  jruoho 
    147       1.1  jruoho void
    148       1.1  jruoho AcpiDmDumpInteger8 (
    149       1.1  jruoho     UINT8                   Value,
    150       1.2  jruoho     const char              *Name)
    151       1.1  jruoho {
    152       1.1  jruoho     AcpiOsPrintf ("0x%2.2X,               // %s\n", Value, Name);
    153       1.1  jruoho }
    154       1.1  jruoho 
    155       1.1  jruoho void
    156       1.1  jruoho AcpiDmDumpInteger16 (
    157       1.1  jruoho     UINT16                  Value,
    158       1.2  jruoho     const char              *Name)
    159       1.1  jruoho {
    160       1.1  jruoho     AcpiOsPrintf ("0x%4.4X,             // %s\n", Value, Name);
    161       1.1  jruoho }
    162       1.1  jruoho 
    163       1.1  jruoho void
    164       1.1  jruoho AcpiDmDumpInteger32 (
    165       1.1  jruoho     UINT32                  Value,
    166       1.2  jruoho     const char              *Name)
    167       1.1  jruoho {
    168       1.1  jruoho     AcpiOsPrintf ("0x%8.8X,         // %s\n", Value, Name);
    169       1.1  jruoho }
    170       1.1  jruoho 
    171       1.1  jruoho void
    172       1.1  jruoho AcpiDmDumpInteger64 (
    173       1.1  jruoho     UINT64                  Value,
    174       1.2  jruoho     const char              *Name)
    175       1.1  jruoho {
    176       1.1  jruoho     AcpiOsPrintf ("0x%8.8X%8.8X, // %s\n", ACPI_FORMAT_UINT64 (Value), Name);
    177       1.1  jruoho }
    178       1.1  jruoho 
    179       1.1  jruoho 
    180       1.1  jruoho /*******************************************************************************
    181       1.1  jruoho  *
    182       1.1  jruoho  * FUNCTION:    AcpiDmBitList
    183       1.1  jruoho  *
    184       1.1  jruoho  * PARAMETERS:  Mask            - 16-bit value corresponding to 16 interrupt
    185       1.1  jruoho  *                                or DMA values
    186       1.1  jruoho  *
    187       1.1  jruoho  * RETURN:      None
    188       1.1  jruoho  *
    189       1.1  jruoho  * DESCRIPTION: Dump a bit mask as a list of individual interrupt/DMA levels.
    190       1.1  jruoho  *
    191       1.1  jruoho  ******************************************************************************/
    192       1.1  jruoho 
    193       1.1  jruoho void
    194       1.1  jruoho AcpiDmBitList (
    195       1.1  jruoho     UINT16                  Mask)
    196       1.1  jruoho {
    197       1.1  jruoho     UINT32                  i;
    198       1.1  jruoho     BOOLEAN                 Previous = FALSE;
    199       1.1  jruoho 
    200       1.1  jruoho 
    201       1.1  jruoho     /* Open the initializer list */
    202       1.1  jruoho 
    203       1.1  jruoho     AcpiOsPrintf ("{");
    204       1.1  jruoho 
    205       1.1  jruoho     /* Examine each bit */
    206       1.1  jruoho 
    207       1.1  jruoho     for (i = 0; i < 16; i++)
    208       1.1  jruoho     {
    209       1.1  jruoho         /* Only interested in bits that are set to 1 */
    210       1.1  jruoho 
    211       1.1  jruoho         if (Mask & 1)
    212       1.1  jruoho         {
    213       1.1  jruoho             if (Previous)
    214       1.1  jruoho             {
    215       1.1  jruoho                 AcpiOsPrintf (",");
    216       1.1  jruoho             }
    217       1.1  jruoho             Previous = TRUE;
    218       1.1  jruoho             AcpiOsPrintf ("%u", i);
    219       1.1  jruoho         }
    220       1.1  jruoho 
    221       1.1  jruoho         Mask >>= 1;
    222       1.1  jruoho     }
    223       1.1  jruoho 
    224       1.1  jruoho     /* Close list */
    225       1.1  jruoho 
    226       1.1  jruoho     AcpiOsPrintf ("}\n");
    227       1.1  jruoho }
    228       1.1  jruoho 
    229       1.1  jruoho 
    230       1.1  jruoho /*******************************************************************************
    231       1.1  jruoho  *
    232       1.1  jruoho  * FUNCTION:    AcpiDmResourceTemplate
    233       1.1  jruoho  *
    234       1.1  jruoho  * PARAMETERS:  Info            - Curent parse tree walk info
    235       1.1  jruoho  *              ByteData        - Pointer to the byte list data
    236       1.1  jruoho  *              ByteCount       - Length of the byte list
    237       1.1  jruoho  *
    238       1.1  jruoho  * RETURN:      None
    239       1.1  jruoho  *
    240       1.1  jruoho  * DESCRIPTION: Dump the contents of a Resource Template containing a set of
    241       1.1  jruoho  *              Resource Descriptors.
    242       1.1  jruoho  *
    243       1.1  jruoho  ******************************************************************************/
    244       1.1  jruoho 
    245       1.1  jruoho void
    246       1.1  jruoho AcpiDmResourceTemplate (
    247       1.1  jruoho     ACPI_OP_WALK_INFO       *Info,
    248       1.1  jruoho     ACPI_PARSE_OBJECT       *Op,
    249       1.1  jruoho     UINT8                   *ByteData,
    250       1.1  jruoho     UINT32                  ByteCount)
    251       1.1  jruoho {
    252       1.1  jruoho     ACPI_STATUS             Status;
    253       1.1  jruoho     UINT32                  CurrentByteOffset;
    254       1.1  jruoho     UINT8                   ResourceType;
    255       1.1  jruoho     UINT32                  ResourceLength;
    256       1.1  jruoho     void                    *Aml;
    257       1.1  jruoho     UINT32                  Level;
    258       1.1  jruoho     BOOLEAN                 DependentFns = FALSE;
    259       1.1  jruoho     UINT8                   ResourceIndex;
    260       1.1  jruoho     ACPI_NAMESPACE_NODE     *Node;
    261       1.1  jruoho 
    262       1.1  jruoho 
    263       1.1  jruoho     Level = Info->Level;
    264       1.1  jruoho     ResourceName = ACPI_DEFAULT_RESNAME;
    265       1.1  jruoho     Node = Op->Common.Node;
    266       1.1  jruoho     if (Node)
    267       1.1  jruoho     {
    268       1.1  jruoho         Node = Node->Child;
    269       1.1  jruoho     }
    270       1.1  jruoho 
    271       1.1  jruoho     for (CurrentByteOffset = 0; CurrentByteOffset < ByteCount;)
    272       1.1  jruoho     {
    273       1.1  jruoho         Aml = &ByteData[CurrentByteOffset];
    274       1.1  jruoho 
    275       1.1  jruoho         /* Get the descriptor type and length */
    276       1.1  jruoho 
    277       1.1  jruoho         ResourceType = AcpiUtGetResourceType (Aml);
    278       1.1  jruoho         ResourceLength = AcpiUtGetResourceLength (Aml);
    279       1.1  jruoho 
    280       1.1  jruoho         /* Validate the Resource Type and Resource Length */
    281       1.1  jruoho 
    282  1.3.24.1   rmind         Status = AcpiUtValidateResource (NULL, Aml, &ResourceIndex);
    283       1.1  jruoho         if (ACPI_FAILURE (Status))
    284       1.1  jruoho         {
    285       1.1  jruoho             AcpiOsPrintf ("/*** Could not validate Resource, type (%X) %s***/\n",
    286       1.1  jruoho                 ResourceType, AcpiFormatException (Status));
    287       1.1  jruoho             return;
    288       1.1  jruoho         }
    289       1.1  jruoho 
    290       1.1  jruoho         /* Point to next descriptor */
    291       1.1  jruoho 
    292       1.1  jruoho         CurrentByteOffset += AcpiUtGetDescriptorLength (Aml);
    293       1.1  jruoho 
    294       1.1  jruoho         /* Descriptor pre-processing */
    295       1.1  jruoho 
    296       1.1  jruoho         switch (ResourceType)
    297       1.1  jruoho         {
    298       1.1  jruoho         case ACPI_RESOURCE_NAME_START_DEPENDENT:
    299       1.1  jruoho 
    300       1.1  jruoho             /* Finish a previous StartDependentFns */
    301       1.1  jruoho 
    302       1.1  jruoho             if (DependentFns)
    303       1.1  jruoho             {
    304       1.1  jruoho                 Level--;
    305       1.1  jruoho                 AcpiDmIndent (Level);
    306       1.1  jruoho                 AcpiOsPrintf ("}\n");
    307       1.1  jruoho             }
    308       1.1  jruoho             break;
    309       1.1  jruoho 
    310       1.1  jruoho         case ACPI_RESOURCE_NAME_END_DEPENDENT:
    311       1.1  jruoho 
    312       1.1  jruoho             Level--;
    313       1.1  jruoho             DependentFns = FALSE;
    314       1.1  jruoho             break;
    315       1.1  jruoho 
    316       1.1  jruoho         case ACPI_RESOURCE_NAME_END_TAG:
    317       1.1  jruoho 
    318       1.1  jruoho             /* Normal exit, the resource list is finished */
    319       1.1  jruoho 
    320       1.1  jruoho             if (DependentFns)
    321       1.1  jruoho             {
    322       1.1  jruoho                 /*
    323       1.1  jruoho                  * Close an open StartDependentDescriptor. This indicates a
    324       1.1  jruoho                  * missing EndDependentDescriptor.
    325       1.1  jruoho                  */
    326       1.1  jruoho                 Level--;
    327       1.1  jruoho                 DependentFns = FALSE;
    328       1.1  jruoho 
    329       1.1  jruoho                 /* Go ahead and insert EndDependentFn() */
    330       1.1  jruoho 
    331       1.1  jruoho                 AcpiDmEndDependentDescriptor (Aml, ResourceLength, Level);
    332       1.1  jruoho 
    333       1.1  jruoho                 AcpiDmIndent (Level);
    334       1.1  jruoho                 AcpiOsPrintf (
    335       1.1  jruoho                     "/*** Disassembler: inserted missing EndDependentFn () ***/\n");
    336       1.1  jruoho             }
    337       1.1  jruoho             return;
    338       1.1  jruoho 
    339       1.1  jruoho         default:
    340  1.3.24.1   rmind 
    341       1.1  jruoho             break;
    342       1.1  jruoho         }
    343       1.1  jruoho 
    344       1.1  jruoho         /* Disassemble the resource structure */
    345       1.1  jruoho 
    346       1.1  jruoho         if (Node)
    347       1.1  jruoho         {
    348       1.1  jruoho             ResourceName = Node->Name.Integer;
    349       1.1  jruoho             Node = Node->Peer;
    350       1.1  jruoho         }
    351       1.1  jruoho 
    352       1.1  jruoho         AcpiGbl_DmResourceDispatch [ResourceIndex] (
    353       1.1  jruoho             Aml, ResourceLength, Level);
    354       1.1  jruoho 
    355       1.1  jruoho         /* Descriptor post-processing */
    356       1.1  jruoho 
    357       1.1  jruoho         if (ResourceType == ACPI_RESOURCE_NAME_START_DEPENDENT)
    358       1.1  jruoho         {
    359       1.1  jruoho             DependentFns = TRUE;
    360       1.1  jruoho             Level++;
    361       1.1  jruoho         }
    362       1.1  jruoho     }
    363       1.1  jruoho }
    364       1.1  jruoho 
    365       1.1  jruoho 
    366       1.1  jruoho /*******************************************************************************
    367       1.1  jruoho  *
    368       1.1  jruoho  * FUNCTION:    AcpiDmIsResourceTemplate
    369       1.1  jruoho  *
    370  1.3.24.1   rmind  * PARAMETERS:  WalkState           - Current walk info
    371  1.3.24.1   rmind  *              Op                  - Buffer Op to be examined
    372       1.1  jruoho  *
    373       1.1  jruoho  * RETURN:      Status. AE_OK if valid template
    374       1.1  jruoho  *
    375       1.1  jruoho  * DESCRIPTION: Walk a byte list to determine if it consists of a valid set
    376  1.3.24.1   rmind  *              of resource descriptors. Nothing is output.
    377       1.1  jruoho  *
    378       1.1  jruoho  ******************************************************************************/
    379       1.1  jruoho 
    380       1.1  jruoho ACPI_STATUS
    381       1.1  jruoho AcpiDmIsResourceTemplate (
    382  1.3.24.1   rmind     ACPI_WALK_STATE         *WalkState,
    383       1.1  jruoho     ACPI_PARSE_OBJECT       *Op)
    384       1.1  jruoho {
    385       1.1  jruoho     ACPI_STATUS             Status;
    386       1.1  jruoho     ACPI_PARSE_OBJECT       *NextOp;
    387       1.1  jruoho     UINT8                   *Aml;
    388       1.1  jruoho     UINT8                   *EndAml;
    389       1.1  jruoho     ACPI_SIZE               Length;
    390       1.1  jruoho 
    391       1.1  jruoho 
    392       1.1  jruoho     /* This op must be a buffer */
    393       1.1  jruoho 
    394       1.1  jruoho     if (Op->Common.AmlOpcode != AML_BUFFER_OP)
    395       1.1  jruoho     {
    396       1.1  jruoho         return (AE_TYPE);
    397       1.1  jruoho     }
    398       1.1  jruoho 
    399       1.1  jruoho     /* Get the ByteData list and length */
    400       1.1  jruoho 
    401       1.1  jruoho     NextOp = Op->Common.Value.Arg;
    402  1.3.24.1   rmind     if (!NextOp)
    403  1.3.24.1   rmind     {
    404  1.3.24.1   rmind         AcpiOsPrintf ("NULL byte list in buffer\n");
    405  1.3.24.1   rmind         return (AE_TYPE);
    406  1.3.24.1   rmind     }
    407  1.3.24.1   rmind 
    408       1.1  jruoho     NextOp = NextOp->Common.Next;
    409       1.1  jruoho     if (!NextOp)
    410       1.1  jruoho     {
    411       1.1  jruoho         return (AE_TYPE);
    412       1.1  jruoho     }
    413       1.1  jruoho 
    414       1.1  jruoho     Aml = NextOp->Named.Data;
    415       1.1  jruoho     Length = (ACPI_SIZE) NextOp->Common.Value.Integer;
    416       1.1  jruoho 
    417       1.1  jruoho     /* Walk the byte list, abort on any invalid descriptor type or length */
    418       1.1  jruoho 
    419  1.3.24.1   rmind     Status = AcpiUtWalkAmlResources (WalkState, Aml, Length,
    420  1.3.24.1   rmind         NULL, ACPI_CAST_INDIRECT_PTR (void, &EndAml));
    421       1.1  jruoho     if (ACPI_FAILURE (Status))
    422       1.1  jruoho     {
    423       1.1  jruoho         return (AE_TYPE);
    424       1.1  jruoho     }
    425       1.1  jruoho 
    426       1.1  jruoho     /*
    427       1.1  jruoho      * For the resource template to be valid, one EndTag must appear
    428       1.1  jruoho      * at the very end of the ByteList, not before. (For proper disassembly
    429       1.1  jruoho      * of a ResourceTemplate, the buffer must not have any extra data after
    430       1.1  jruoho      * the EndTag.)
    431       1.1  jruoho      */
    432       1.1  jruoho     if ((Aml + Length - sizeof (AML_RESOURCE_END_TAG)) != EndAml)
    433       1.1  jruoho     {
    434       1.1  jruoho         return (AE_AML_NO_RESOURCE_END_TAG);
    435       1.1  jruoho     }
    436       1.1  jruoho 
    437       1.1  jruoho     /*
    438       1.1  jruoho      * All resource descriptors are valid, therefore this list appears
    439       1.1  jruoho      * to be a valid resource template
    440       1.1  jruoho      */
    441       1.1  jruoho     return (AE_OK);
    442       1.1  jruoho }
    443       1.1  jruoho 
    444       1.1  jruoho #endif
    445