Home | History | Annotate | Line # | Download | only in compiler
      1 /******************************************************************************
      2  *
      3  * Module Name: aslrestype1 - Miscellaneous small resource descriptors
      4  *
      5  *****************************************************************************/
      6 
      7 /*
      8  * Copyright (C) 2000 - 2025, Intel Corp.
      9  * All rights reserved.
     10  *
     11  * Redistribution and use in source and binary forms, with or without
     12  * modification, are permitted provided that the following conditions
     13  * are met:
     14  * 1. Redistributions of source code must retain the above copyright
     15  *    notice, this list of conditions, and the following disclaimer,
     16  *    without modification.
     17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     18  *    substantially similar to the "NO WARRANTY" disclaimer below
     19  *    ("Disclaimer") and any redistribution must be conditioned upon
     20  *    including a substantially similar Disclaimer requirement for further
     21  *    binary redistribution.
     22  * 3. Neither the names of the above-listed copyright holders nor the names
     23  *    of any contributors may be used to endorse or promote products derived
     24  *    from this software without specific prior written permission.
     25  *
     26  * Alternatively, this software may be distributed under the terms of the
     27  * GNU General Public License ("GPL") version 2 as published by the Free
     28  * Software Foundation.
     29  *
     30  * NO WARRANTY
     31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     41  * POSSIBILITY OF SUCH DAMAGES.
     42  */
     43 
     44 #include "aslcompiler.h"
     45 #include "aslcompiler.y.h"
     46 
     47 #define _COMPONENT          ACPI_COMPILER
     48         ACPI_MODULE_NAME    ("aslrestype1")
     49 
     50 /*
     51  * This module contains miscellaneous small resource descriptors:
     52  *
     53  * EndTag
     54  * EndDependentFn
     55  * Memory24
     56  * Memory32
     57  * Memory32Fixed
     58  * StartDependentFn
     59  * StartDependentFnNoPri
     60  * VendorShort
     61  */
     62 
     63 /*******************************************************************************
     64  *
     65  * FUNCTION:    RsDoEndTagDescriptor
     66  *
     67  * PARAMETERS:  Info                - Parse Op and resource template offset
     68  *
     69  * RETURN:      Completed resource node
     70  *
     71  * DESCRIPTION: Construct a short "EndDependentFn" descriptor
     72  *
     73  ******************************************************************************/
     74 
     75 ASL_RESOURCE_NODE *
     76 RsDoEndTagDescriptor (
     77     ASL_RESOURCE_INFO       *Info)
     78 {
     79     AML_RESOURCE            *Descriptor;
     80     ASL_RESOURCE_NODE       *Rnode;
     81 
     82 
     83     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_END_TAG));
     84 
     85     Descriptor = Rnode->Buffer;
     86     Descriptor->EndTag.DescriptorType = ACPI_RESOURCE_NAME_END_TAG |
     87                                         ASL_RDESC_END_TAG_SIZE;
     88     Descriptor->EndTag.Checksum = 0;
     89     return (Rnode);
     90 }
     91 
     92 
     93 /*******************************************************************************
     94  *
     95  * FUNCTION:    RsDoEndDependentDescriptor
     96  *
     97  * PARAMETERS:  Info                - Parse Op and resource template offset
     98  *
     99  * RETURN:      Completed resource node
    100  *
    101  * DESCRIPTION: Construct a short "EndDependentFn" descriptor
    102  *
    103  ******************************************************************************/
    104 
    105 ASL_RESOURCE_NODE *
    106 RsDoEndDependentDescriptor (
    107     ASL_RESOURCE_INFO       *Info)
    108 {
    109     AML_RESOURCE            *Descriptor;
    110     ASL_RESOURCE_NODE       *Rnode;
    111 
    112 
    113     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_END_DEPENDENT));
    114 
    115     Descriptor = Rnode->Buffer;
    116     Descriptor->EndDpf.DescriptorType =
    117         ACPI_RESOURCE_NAME_END_DEPENDENT | ASL_RDESC_END_DEPEND_SIZE;
    118     return (Rnode);
    119 }
    120 
    121 
    122 /*******************************************************************************
    123  *
    124  * FUNCTION:    RsDoMemory24Descriptor
    125  *
    126  * PARAMETERS:  Info                - Parse Op and resource template offset
    127  *
    128  * RETURN:      Completed resource node
    129  *
    130  * DESCRIPTION: Construct a short "Memory24" descriptor
    131  *
    132  ******************************************************************************/
    133 
    134 ASL_RESOURCE_NODE *
    135 RsDoMemory24Descriptor (
    136     ASL_RESOURCE_INFO       *Info)
    137 {
    138     AML_RESOURCE            *Descriptor;
    139     ACPI_PARSE_OBJECT       *InitializerOp;
    140     ACPI_PARSE_OBJECT       *MinOp = NULL;
    141     ACPI_PARSE_OBJECT       *MaxOp = NULL;
    142     ACPI_PARSE_OBJECT       *LengthOp = NULL;
    143     ASL_RESOURCE_NODE       *Rnode;
    144     UINT32                  CurrentByteOffset;
    145     UINT32                  i;
    146 
    147 
    148     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
    149     CurrentByteOffset = Info->CurrentByteOffset;
    150     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY24));
    151 
    152     Descriptor = Rnode->Buffer;
    153     Descriptor->Memory24.DescriptorType = ACPI_RESOURCE_NAME_MEMORY24;
    154     Descriptor->Memory24.ResourceLength = 9;
    155 
    156     /* Process all child initialization nodes */
    157 
    158     for (i = 0; InitializerOp; i++)
    159     {
    160         switch (i)
    161         {
    162         case 0: /* Read/Write type */
    163 
    164             RsSetFlagBits (&Descriptor->Memory24.Flags, InitializerOp, 0, 1);
    165             RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
    166                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Flags), 0);
    167             break;
    168 
    169         case 1: /* Min Address */
    170 
    171             Descriptor->Memory24.Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
    172             RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR,
    173                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Minimum));
    174             MinOp = InitializerOp;
    175             break;
    176 
    177         case 2: /* Max Address */
    178 
    179             Descriptor->Memory24.Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
    180             RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR,
    181                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Maximum));
    182             MaxOp = InitializerOp;
    183             break;
    184 
    185         case 3: /* Alignment */
    186 
    187             Descriptor->Memory24.Alignment = (UINT16) InitializerOp->Asl.Value.Integer;
    188             RsCreateWordField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
    189                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Alignment));
    190             break;
    191 
    192         case 4: /* Length */
    193 
    194             Descriptor->Memory24.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
    195             RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH,
    196                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.AddressLength));
    197             LengthOp = InitializerOp;
    198             break;
    199 
    200         case 5: /* Name */
    201 
    202             UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
    203             break;
    204 
    205         default:
    206 
    207             AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
    208             break;
    209         }
    210 
    211         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
    212     }
    213 
    214     /* Validate the Min/Max/Len/Align values (Alignment==0 means 64K) */
    215 
    216     RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY24,
    217         Descriptor->Memory24.Minimum,
    218         Descriptor->Memory24.Maximum,
    219         Descriptor->Memory24.AddressLength,
    220         Descriptor->Memory24.Alignment,
    221         MinOp, MaxOp, LengthOp, NULL, Info->DescriptorTypeOp);
    222 
    223     return (Rnode);
    224 }
    225 
    226 
    227 /*******************************************************************************
    228  *
    229  * FUNCTION:    RsDoMemory32Descriptor
    230  *
    231  * PARAMETERS:  Info                - Parse Op and resource template offset
    232  *
    233  * RETURN:      Completed resource node
    234  *
    235  * DESCRIPTION: Construct a short "Memory32" descriptor
    236  *
    237  ******************************************************************************/
    238 
    239 ASL_RESOURCE_NODE *
    240 RsDoMemory32Descriptor (
    241     ASL_RESOURCE_INFO       *Info)
    242 {
    243     AML_RESOURCE            *Descriptor;
    244     ACPI_PARSE_OBJECT       *InitializerOp;
    245     ACPI_PARSE_OBJECT       *MinOp = NULL;
    246     ACPI_PARSE_OBJECT       *MaxOp = NULL;
    247     ACPI_PARSE_OBJECT       *LengthOp = NULL;
    248     ACPI_PARSE_OBJECT       *AlignOp = NULL;
    249     ASL_RESOURCE_NODE       *Rnode;
    250     UINT32                  CurrentByteOffset;
    251     UINT32                  i;
    252 
    253 
    254     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
    255     CurrentByteOffset = Info->CurrentByteOffset;
    256     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY32));
    257 
    258     Descriptor = Rnode->Buffer;
    259     Descriptor->Memory32.DescriptorType = ACPI_RESOURCE_NAME_MEMORY32;
    260     Descriptor->Memory32.ResourceLength = 17;
    261 
    262     /* Process all child initialization nodes */
    263 
    264     for (i = 0; InitializerOp; i++)
    265     {
    266         switch (i)
    267         {
    268         case 0: /* Read/Write type */
    269 
    270             RsSetFlagBits (&Descriptor->Memory32.Flags, InitializerOp, 0, 1);
    271             RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
    272                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Flags), 0);
    273             break;
    274 
    275         case 1:  /* Min Address */
    276 
    277             Descriptor->Memory32.Minimum = (UINT32) InitializerOp->Asl.Value.Integer;
    278             RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR,
    279                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Minimum));
    280             MinOp = InitializerOp;
    281             break;
    282 
    283         case 2: /* Max Address */
    284 
    285             Descriptor->Memory32.Maximum = (UINT32) InitializerOp->Asl.Value.Integer;
    286             RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
    287                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Maximum));
    288             MaxOp = InitializerOp;
    289             break;
    290 
    291         case 3: /* Alignment */
    292 
    293             Descriptor->Memory32.Alignment = (UINT32) InitializerOp->Asl.Value.Integer;
    294             RsCreateDwordField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
    295                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Alignment));
    296             AlignOp = InitializerOp;
    297             break;
    298 
    299         case 4: /* Length */
    300 
    301             Descriptor->Memory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
    302             RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
    303                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.AddressLength));
    304             LengthOp = InitializerOp;
    305             break;
    306 
    307         case 5: /* Name */
    308 
    309             UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
    310             break;
    311 
    312         default:
    313 
    314             AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
    315             break;
    316         }
    317 
    318         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
    319     }
    320 
    321     /* Validate the Min/Max/Len/Align values */
    322 
    323     RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY32,
    324         Descriptor->Memory32.Minimum,
    325         Descriptor->Memory32.Maximum,
    326         Descriptor->Memory32.AddressLength,
    327         Descriptor->Memory32.Alignment,
    328         MinOp, MaxOp, LengthOp, AlignOp, Info->DescriptorTypeOp);
    329 
    330     return (Rnode);
    331 }
    332 
    333 
    334 /*******************************************************************************
    335  *
    336  * FUNCTION:    RsDoMemory32FixedDescriptor
    337  *
    338  * PARAMETERS:  Info                - Parse Op and resource template offset
    339  *
    340  * RETURN:      Completed resource node
    341  *
    342  * DESCRIPTION: Construct a short "Memory32Fixed" descriptor
    343  *
    344  ******************************************************************************/
    345 
    346 ASL_RESOURCE_NODE *
    347 RsDoMemory32FixedDescriptor (
    348     ASL_RESOURCE_INFO       *Info)
    349 {
    350     AML_RESOURCE            *Descriptor;
    351     ACPI_PARSE_OBJECT       *InitializerOp;
    352     ASL_RESOURCE_NODE       *Rnode;
    353     UINT32                  CurrentByteOffset;
    354     UINT32                  i;
    355 
    356 
    357     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
    358     CurrentByteOffset = Info->CurrentByteOffset;
    359     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_MEMORY32));
    360 
    361     Descriptor = Rnode->Buffer;
    362     Descriptor->FixedMemory32.DescriptorType = ACPI_RESOURCE_NAME_FIXED_MEMORY32;
    363     Descriptor->FixedMemory32.ResourceLength = 9;
    364 
    365     /* Process all child initialization nodes */
    366 
    367     for (i = 0; InitializerOp; i++)
    368     {
    369         switch (i)
    370         {
    371         case 0: /* Read/Write type */
    372 
    373             RsSetFlagBits (&Descriptor->FixedMemory32.Flags, InitializerOp, 0, 1);
    374             RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
    375                 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Flags), 0);
    376             break;
    377 
    378         case 1: /* Address */
    379 
    380             Descriptor->FixedMemory32.Address = (UINT32) InitializerOp->Asl.Value.Integer;
    381             RsCreateDwordField (InitializerOp, ACPI_RESTAG_BASEADDRESS,
    382                 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Address));
    383             break;
    384 
    385         case 2: /* Length */
    386 
    387             Descriptor->FixedMemory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
    388             RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
    389                 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.AddressLength));
    390             break;
    391 
    392         case 3: /* Name */
    393 
    394             UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
    395             break;
    396 
    397         default:
    398 
    399             AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
    400             break;
    401         }
    402 
    403         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
    404     }
    405 
    406     return (Rnode);
    407 }
    408 
    409 
    410 /*******************************************************************************
    411  *
    412  * FUNCTION:    RsDoStartDependentDescriptor
    413  *
    414  * PARAMETERS:  Info                - Parse Op and resource template offset
    415  *
    416  * RETURN:      Completed resource node
    417  *
    418  * DESCRIPTION: Construct a short "StartDependentFn" descriptor
    419  *
    420  ******************************************************************************/
    421 
    422 ASL_RESOURCE_NODE *
    423 RsDoStartDependentDescriptor (
    424     ASL_RESOURCE_INFO       *Info)
    425 {
    426     AML_RESOURCE            *Descriptor;
    427     ACPI_PARSE_OBJECT       *InitializerOp;
    428     ASL_RESOURCE_NODE       *Rnode;
    429     ASL_RESOURCE_NODE       *PreviousRnode;
    430     ASL_RESOURCE_NODE       *NextRnode;
    431     ASL_RESOURCE_INFO       NextInfo;
    432     UINT32                  CurrentByteOffset;
    433     UINT32                  i;
    434     UINT8                   State;
    435 
    436 
    437     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
    438     CurrentByteOffset = Info->CurrentByteOffset;
    439     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT));
    440 
    441     PreviousRnode = Rnode;
    442     Descriptor = Rnode->Buffer;
    443 
    444     /* Increment offset past StartDependent descriptor */
    445 
    446     CurrentByteOffset += sizeof (AML_RESOURCE_START_DEPENDENT);
    447 
    448     /* Descriptor has priority byte */
    449 
    450     Descriptor->StartDpf.DescriptorType =
    451         ACPI_RESOURCE_NAME_START_DEPENDENT | (ASL_RDESC_ST_DEPEND_SIZE + 0x01);
    452 
    453     /* Process all child initialization nodes */
    454 
    455     State = ACPI_RSTATE_START_DEPENDENT;
    456     for (i = 0; InitializerOp; i++)
    457     {
    458         switch (i)
    459         {
    460         case 0: /* Compatibility Priority */
    461 
    462             if ((UINT8) InitializerOp->Asl.Value.Integer > 2)
    463             {
    464                 AslError (ASL_ERROR, ASL_MSG_INVALID_PRIORITY,
    465                     InitializerOp, NULL);
    466             }
    467 
    468             RsSetFlagBits (&Descriptor->StartDpf.Flags, InitializerOp, 0, 0);
    469             break;
    470 
    471         case 1: /* Performance/Robustness Priority */
    472 
    473             if ((UINT8) InitializerOp->Asl.Value.Integer > 2)
    474             {
    475                 AslError (ASL_ERROR, ASL_MSG_INVALID_PERFORMANCE,
    476                     InitializerOp, NULL);
    477             }
    478 
    479             RsSetFlagBits (&Descriptor->StartDpf.Flags, InitializerOp, 2, 0);
    480             break;
    481 
    482         default:
    483 
    484             NextInfo.CurrentByteOffset = CurrentByteOffset;
    485             NextInfo.DescriptorTypeOp = InitializerOp;
    486 
    487             NextRnode = RsDoOneResourceDescriptor (&NextInfo, &State);
    488 
    489             /*
    490              * Update current byte offset to indicate the number of bytes from the
    491              * start of the buffer. Buffer can include multiple descriptors, we
    492              * must keep track of the offset of not only each descriptor, but each
    493              * element (field) within each descriptor as well.
    494              */
    495             CurrentByteOffset += RsLinkDescriptorChain (
    496                 &PreviousRnode, NextRnode);
    497             break;
    498         }
    499 
    500         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
    501     }
    502 
    503     return (Rnode);
    504 }
    505 
    506 
    507 /*******************************************************************************
    508  *
    509  * FUNCTION:    RsDoStartDependentNoPriDescriptor
    510  *
    511  * PARAMETERS:  Info                - Parse Op and resource template offset
    512  *
    513  * RETURN:      Completed resource node
    514  *
    515  * DESCRIPTION: Construct a short "StartDependentNoPri" descriptor
    516  *
    517  ******************************************************************************/
    518 
    519 ASL_RESOURCE_NODE *
    520 RsDoStartDependentNoPriDescriptor (
    521     ASL_RESOURCE_INFO       *Info)
    522 {
    523     AML_RESOURCE            *Descriptor;
    524     ACPI_PARSE_OBJECT       *InitializerOp;
    525     ASL_RESOURCE_NODE       *Rnode;
    526     ASL_RESOURCE_NODE       *PreviousRnode;
    527     ASL_RESOURCE_NODE       *NextRnode;
    528     ASL_RESOURCE_INFO       NextInfo;
    529     UINT32                  CurrentByteOffset;
    530     UINT8                   State;
    531 
    532 
    533     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
    534     CurrentByteOffset = Info->CurrentByteOffset;
    535     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO));
    536 
    537     Descriptor = Rnode->Buffer;
    538     Descriptor->StartDpf.DescriptorType =
    539         ACPI_RESOURCE_NAME_START_DEPENDENT | ASL_RDESC_ST_DEPEND_SIZE;
    540     PreviousRnode = Rnode;
    541 
    542     /* Increment offset past StartDependentNoPri descriptor */
    543 
    544     CurrentByteOffset += sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO);
    545 
    546     /* Process all child initialization nodes */
    547 
    548     State = ACPI_RSTATE_START_DEPENDENT;
    549     while (InitializerOp)
    550     {
    551         NextInfo.CurrentByteOffset = CurrentByteOffset;
    552         NextInfo.DescriptorTypeOp = InitializerOp;
    553 
    554         NextRnode = RsDoOneResourceDescriptor (&NextInfo, &State);
    555 
    556         /*
    557          * Update current byte offset to indicate the number of bytes from the
    558          * start of the buffer. Buffer can include multiple descriptors, we
    559          * must keep track of the offset of not only each descriptor, but each
    560          * element (field) within each descriptor as well.
    561          */
    562         CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, NextRnode);
    563 
    564         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
    565     }
    566 
    567     return (Rnode);
    568 }
    569 
    570 
    571 /*******************************************************************************
    572  *
    573  * FUNCTION:    RsDoVendorSmallDescriptor
    574  *
    575  * PARAMETERS:  Info                - Parse Op and resource template offset
    576  *
    577  * RETURN:      Completed resource node
    578  *
    579  * DESCRIPTION: Construct a short "VendorShort" descriptor
    580  *
    581  ******************************************************************************/
    582 
    583 ASL_RESOURCE_NODE *
    584 RsDoVendorSmallDescriptor (
    585     ASL_RESOURCE_INFO       *Info)
    586 {
    587     AML_RESOURCE            *Descriptor;
    588     ACPI_PARSE_OBJECT       *InitializerOp;
    589     ASL_RESOURCE_NODE       *Rnode;
    590     UINT8                   *VendorData;
    591     UINT32                  i;
    592 
    593 
    594     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
    595 
    596     /* Allocate worst case - 7 vendor bytes */
    597 
    598     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_VENDOR_SMALL) + 7);
    599 
    600     Descriptor = Rnode->Buffer;
    601     Descriptor->VendorSmall.DescriptorType = ACPI_RESOURCE_NAME_VENDOR_SMALL;
    602     VendorData = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_SMALL_HEADER);
    603 
    604     /* Process all child initialization nodes */
    605 
    606     InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
    607     for (i = 0; InitializerOp; i++)
    608     {
    609         if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
    610         {
    611             break;
    612         }
    613 
    614         /* Maximum 7 vendor data bytes allowed (0-6) */
    615 
    616         if (i >= 7)
    617         {
    618             AslError (ASL_ERROR, ASL_MSG_VENDOR_LIST, InitializerOp, NULL);
    619 
    620             /* Eat the excess initializers */
    621 
    622             while (InitializerOp)
    623             {
    624                 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
    625             }
    626             break;
    627         }
    628 
    629         VendorData[i] = (UINT8) InitializerOp->Asl.Value.Integer;
    630         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
    631     }
    632 
    633     /* Adjust the Rnode buffer size, so correct number of bytes are emitted */
    634 
    635     Rnode->BufferLength -= (7 - i);
    636 
    637     /* Set the length in the Type Tag */
    638 
    639     Descriptor->VendorSmall.DescriptorType |= (UINT8) i;
    640     return (Rnode);
    641 }
    642