1 /******************************************************************************
   2  *
   3  * Module Name: aslrestype1 - Miscellaneous small resource descriptors
   4  *
   5  *****************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2014, 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 MERCHANTIBILITY 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 
  45 #include "aslcompiler.h"
  46 #include "aslcompiler.y.h"
  47 
  48 #define _COMPONENT          ACPI_COMPILER
  49         ACPI_MODULE_NAME    ("aslrestype1")
  50 
  51 /*
  52  * This module contains miscellaneous small resource descriptors:
  53  *
  54  * EndTag
  55  * EndDependentFn
  56  * Memory24
  57  * Memory32
  58  * Memory32Fixed
  59  * StartDependentFn
  60  * StartDependentFnNoPri
  61  * VendorShort
  62  */
  63 
  64 /*******************************************************************************
  65  *
  66  * FUNCTION:    RsDoEndTagDescriptor
  67  *
  68  * PARAMETERS:  Op                  - Parent resource descriptor parse node
  69  *              CurrentByteOffset   - Offset into the resource template AML
  70  *                                    buffer (to track references to the desc)
  71  *
  72  * RETURN:      Completed resource node
  73  *
  74  * DESCRIPTION: Construct a short "EndDependentFn" descriptor
  75  *
  76  ******************************************************************************/
  77 
  78 ASL_RESOURCE_NODE *
  79 RsDoEndTagDescriptor (
  80     ACPI_PARSE_OBJECT       *Op,
  81     UINT32                  CurrentByteOffset)
  82 {
  83     AML_RESOURCE            *Descriptor;
  84     ASL_RESOURCE_NODE       *Rnode;
  85 
  86 
  87     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_END_TAG));
  88 
  89     Descriptor = Rnode->Buffer;
  90     Descriptor->EndTag.DescriptorType = ACPI_RESOURCE_NAME_END_TAG |
  91                                         ASL_RDESC_END_TAG_SIZE;
  92     Descriptor->EndTag.Checksum = 0;
  93 
  94     return (Rnode);
  95 }
  96 
  97 
  98 /*******************************************************************************
  99  *
 100  * FUNCTION:    RsDoEndDependentDescriptor
 101  *
 102  * PARAMETERS:  Op                  - Parent resource descriptor parse node
 103  *              CurrentByteOffset   - Offset into the resource template AML
 104  *                                    buffer (to track references to the desc)
 105  *
 106  * RETURN:      Completed resource node
 107  *
 108  * DESCRIPTION: Construct a short "EndDependentFn" descriptor
 109  *
 110  ******************************************************************************/
 111 
 112 ASL_RESOURCE_NODE *
 113 RsDoEndDependentDescriptor (
 114     ACPI_PARSE_OBJECT       *Op,
 115     UINT32                  CurrentByteOffset)
 116 {
 117     AML_RESOURCE            *Descriptor;
 118     ASL_RESOURCE_NODE       *Rnode;
 119 
 120 
 121     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_END_DEPENDENT));
 122 
 123     Descriptor = Rnode->Buffer;
 124     Descriptor->EndDpf.DescriptorType  = ACPI_RESOURCE_NAME_END_DEPENDENT |
 125                                       ASL_RDESC_END_DEPEND_SIZE;
 126     return (Rnode);
 127 }
 128 
 129 
 130 /*******************************************************************************
 131  *
 132  * FUNCTION:    RsDoMemory24Descriptor
 133  *
 134  * PARAMETERS:  Op                  - Parent resource descriptor parse node
 135  *              CurrentByteOffset   - Offset into the resource template AML
 136  *                                    buffer (to track references to the desc)
 137  *
 138  * RETURN:      Completed resource node
 139  *
 140  * DESCRIPTION: Construct a short "Memory24" descriptor
 141  *
 142  ******************************************************************************/
 143 
 144 ASL_RESOURCE_NODE *
 145 RsDoMemory24Descriptor (
 146     ACPI_PARSE_OBJECT       *Op,
 147     UINT32                  CurrentByteOffset)
 148 {
 149     AML_RESOURCE            *Descriptor;
 150     ACPI_PARSE_OBJECT       *InitializerOp;
 151     ACPI_PARSE_OBJECT       *MinOp = NULL;
 152     ACPI_PARSE_OBJECT       *MaxOp = NULL;
 153     ACPI_PARSE_OBJECT       *LengthOp = NULL;
 154     ASL_RESOURCE_NODE       *Rnode;
 155     UINT32                  i;
 156 
 157 
 158     InitializerOp = Op->Asl.Child;
 159     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY24));
 160 
 161     Descriptor = Rnode->Buffer;
 162     Descriptor->Memory24.DescriptorType  = ACPI_RESOURCE_NAME_MEMORY24;
 163     Descriptor->Memory24.ResourceLength = 9;
 164 
 165     /* Process all child initialization nodes */
 166 
 167     for (i = 0; InitializerOp; i++)
 168     {
 169         switch (i)
 170         {
 171         case 0: /* Read/Write type */
 172 
 173             RsSetFlagBits (&Descriptor->Memory24.Flags, InitializerOp, 0, 1);
 174             RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
 175                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Flags), 0);
 176             break;
 177 
 178         case 1: /* Min Address */
 179 
 180             Descriptor->Memory24.Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
 181             RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR,
 182                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Minimum));
 183             MinOp = InitializerOp;
 184             break;
 185 
 186         case 2: /* Max Address */
 187 
 188             Descriptor->Memory24.Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
 189             RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR,
 190                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Maximum));
 191             MaxOp = InitializerOp;
 192             break;
 193 
 194         case 3: /* Alignment */
 195 
 196             Descriptor->Memory24.Alignment = (UINT16) InitializerOp->Asl.Value.Integer;
 197             RsCreateWordField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
 198                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Alignment));
 199             break;
 200 
 201         case 4: /* Length */
 202 
 203             Descriptor->Memory24.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
 204             RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH,
 205                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.AddressLength));
 206             LengthOp = InitializerOp;
 207             break;
 208 
 209         case 5: /* Name */
 210 
 211             UtAttachNamepathToOwner (Op, InitializerOp);
 212             break;
 213 
 214         default:
 215 
 216             AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
 217             break;
 218         }
 219 
 220         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
 221     }
 222 
 223     /* Validate the Min/Max/Len/Align values (Alignment==0 means 64K) */
 224 
 225     RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY24,
 226         Descriptor->Memory24.Minimum,
 227         Descriptor->Memory24.Maximum,
 228         Descriptor->Memory24.AddressLength,
 229         Descriptor->Memory24.Alignment,
 230         MinOp, MaxOp, LengthOp, NULL, Op);
 231 
 232     return (Rnode);
 233 }
 234 
 235 
 236 /*******************************************************************************
 237  *
 238  * FUNCTION:    RsDoMemory32Descriptor
 239  *
 240  * PARAMETERS:  Op                  - Parent resource descriptor parse node
 241  *              CurrentByteOffset   - Offset into the resource template AML
 242  *                                    buffer (to track references to the desc)
 243  *
 244  * RETURN:      Completed resource node
 245  *
 246  * DESCRIPTION: Construct a short "Memory32" descriptor
 247  *
 248  ******************************************************************************/
 249 
 250 ASL_RESOURCE_NODE *
 251 RsDoMemory32Descriptor (
 252     ACPI_PARSE_OBJECT       *Op,
 253     UINT32                  CurrentByteOffset)
 254 {
 255     AML_RESOURCE            *Descriptor;
 256     ACPI_PARSE_OBJECT       *InitializerOp;
 257     ACPI_PARSE_OBJECT       *MinOp = NULL;
 258     ACPI_PARSE_OBJECT       *MaxOp = NULL;
 259     ACPI_PARSE_OBJECT       *LengthOp = NULL;
 260     ACPI_PARSE_OBJECT       *AlignOp = NULL;
 261     ASL_RESOURCE_NODE       *Rnode;
 262     UINT32                  i;
 263 
 264 
 265     InitializerOp = Op->Asl.Child;
 266     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY32));
 267 
 268     Descriptor = Rnode->Buffer;
 269     Descriptor->Memory32.DescriptorType  = ACPI_RESOURCE_NAME_MEMORY32;
 270     Descriptor->Memory32.ResourceLength = 17;
 271 
 272     /* Process all child initialization nodes */
 273 
 274     for (i = 0; InitializerOp; i++)
 275     {
 276         switch (i)
 277         {
 278         case 0: /* Read/Write type */
 279 
 280             RsSetFlagBits (&Descriptor->Memory32.Flags, InitializerOp, 0, 1);
 281             RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
 282                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Flags), 0);
 283             break;
 284 
 285         case 1:  /* Min Address */
 286 
 287             Descriptor->Memory32.Minimum = (UINT32) InitializerOp->Asl.Value.Integer;
 288             RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR,
 289                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Minimum));
 290             MinOp = InitializerOp;
 291             break;
 292 
 293         case 2: /* Max Address */
 294 
 295             Descriptor->Memory32.Maximum = (UINT32) InitializerOp->Asl.Value.Integer;
 296             RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
 297                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Maximum));
 298             MaxOp = InitializerOp;
 299             break;
 300 
 301         case 3: /* Alignment */
 302 
 303             Descriptor->Memory32.Alignment = (UINT32) InitializerOp->Asl.Value.Integer;
 304             RsCreateDwordField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
 305                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Alignment));
 306             AlignOp = InitializerOp;
 307             break;
 308 
 309         case 4: /* Length */
 310 
 311             Descriptor->Memory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
 312             RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
 313                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.AddressLength));
 314             LengthOp = InitializerOp;
 315             break;
 316 
 317         case 5: /* Name */
 318 
 319             UtAttachNamepathToOwner (Op, InitializerOp);
 320             break;
 321 
 322         default:
 323 
 324             AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
 325             break;
 326         }
 327 
 328         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
 329     }
 330 
 331     /* Validate the Min/Max/Len/Align values */
 332 
 333     RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY32,
 334         Descriptor->Memory32.Minimum,
 335         Descriptor->Memory32.Maximum,
 336         Descriptor->Memory32.AddressLength,
 337         Descriptor->Memory32.Alignment,
 338         MinOp, MaxOp, LengthOp, AlignOp, Op);
 339 
 340     return (Rnode);
 341 }
 342 
 343 
 344 /*******************************************************************************
 345  *
 346  * FUNCTION:    RsDoMemory32FixedDescriptor
 347  *
 348  * PARAMETERS:  Op                  - Parent resource descriptor parse node
 349  *              CurrentByteOffset   - Offset into the resource template AML
 350  *                                    buffer (to track references to the desc)
 351  *
 352  * RETURN:      Completed resource node
 353  *
 354  * DESCRIPTION: Construct a short "Memory32Fixed" descriptor
 355  *
 356  ******************************************************************************/
 357 
 358 ASL_RESOURCE_NODE *
 359 RsDoMemory32FixedDescriptor (
 360     ACPI_PARSE_OBJECT       *Op,
 361     UINT32                  CurrentByteOffset)
 362 {
 363     AML_RESOURCE            *Descriptor;
 364     ACPI_PARSE_OBJECT       *InitializerOp;
 365     ASL_RESOURCE_NODE       *Rnode;
 366     UINT32                  i;
 367 
 368 
 369     InitializerOp = Op->Asl.Child;
 370     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_MEMORY32));
 371 
 372     Descriptor = Rnode->Buffer;
 373     Descriptor->FixedMemory32.DescriptorType  = ACPI_RESOURCE_NAME_FIXED_MEMORY32;
 374     Descriptor->FixedMemory32.ResourceLength = 9;
 375 
 376     /* Process all child initialization nodes */
 377 
 378     for (i = 0; InitializerOp; i++)
 379     {
 380         switch (i)
 381         {
 382         case 0: /* Read/Write type */
 383 
 384             RsSetFlagBits (&Descriptor->FixedMemory32.Flags, InitializerOp, 0, 1);
 385             RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
 386                 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Flags), 0);
 387             break;
 388 
 389         case 1: /* Address */
 390 
 391             Descriptor->FixedMemory32.Address = (UINT32) InitializerOp->Asl.Value.Integer;
 392             RsCreateDwordField (InitializerOp, ACPI_RESTAG_BASEADDRESS,
 393                 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Address));
 394             break;
 395 
 396         case 2: /* Length */
 397 
 398             Descriptor->FixedMemory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
 399             RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
 400                 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.AddressLength));
 401             break;
 402 
 403         case 3: /* Name */
 404 
 405             UtAttachNamepathToOwner (Op, InitializerOp);
 406             break;
 407 
 408         default:
 409 
 410             AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
 411             break;
 412         }
 413 
 414         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
 415     }
 416 
 417     return (Rnode);
 418 }
 419 
 420 
 421 /*******************************************************************************
 422  *
 423  * FUNCTION:    RsDoStartDependentDescriptor
 424  *
 425  * PARAMETERS:  Op                  - Parent resource descriptor parse node
 426  *              CurrentByteOffset   - Offset into the resource template AML
 427  *                                    buffer (to track references to the desc)
 428  *
 429  * RETURN:      Completed resource node
 430  *
 431  * DESCRIPTION: Construct a short "StartDependentFn" descriptor
 432  *
 433  ******************************************************************************/
 434 
 435 ASL_RESOURCE_NODE *
 436 RsDoStartDependentDescriptor (
 437     ACPI_PARSE_OBJECT       *Op,
 438     UINT32                  CurrentByteOffset)
 439 {
 440     AML_RESOURCE            *Descriptor;
 441     ACPI_PARSE_OBJECT       *InitializerOp;
 442     ASL_RESOURCE_NODE       *Rnode;
 443     ASL_RESOURCE_NODE       *PreviousRnode;
 444     ASL_RESOURCE_NODE       *NextRnode;
 445     UINT32                  i;
 446     UINT8                   State;
 447 
 448 
 449     InitializerOp = Op->Asl.Child;
 450     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT));
 451 
 452     PreviousRnode = Rnode;
 453     Descriptor = Rnode->Buffer;
 454 
 455     /* Increment offset past StartDependent descriptor */
 456 
 457     CurrentByteOffset += sizeof (AML_RESOURCE_START_DEPENDENT);
 458 
 459     /* Descriptor has priority byte */
 460 
 461     Descriptor->StartDpf.DescriptorType  = ACPI_RESOURCE_NAME_START_DEPENDENT |
 462                                       (ASL_RDESC_ST_DEPEND_SIZE + 0x01);
 463 
 464     /* Process all child initialization nodes */
 465 
 466     State = ACPI_RSTATE_START_DEPENDENT;
 467     for (i = 0; InitializerOp; i++)
 468     {
 469         switch (i)
 470         {
 471         case 0: /* Compatibility Priority */
 472 
 473             if ((UINT8) InitializerOp->Asl.Value.Integer > 2)
 474             {
 475                 AslError (ASL_ERROR, ASL_MSG_INVALID_PRIORITY,
 476                     InitializerOp, NULL);
 477             }
 478 
 479             RsSetFlagBits (&Descriptor->StartDpf.Flags, InitializerOp, 0, 0);
 480             break;
 481 
 482         case 1: /* Performance/Robustness Priority */
 483 
 484             if ((UINT8) InitializerOp->Asl.Value.Integer > 2)
 485             {
 486                 AslError (ASL_ERROR, ASL_MSG_INVALID_PERFORMANCE,
 487                     InitializerOp, NULL);
 488             }
 489 
 490             RsSetFlagBits (&Descriptor->StartDpf.Flags, InitializerOp, 2, 0);
 491             break;
 492 
 493         default:
 494 
 495             NextRnode = RsDoOneResourceDescriptor  (InitializerOp,
 496                         CurrentByteOffset, &State);
 497 
 498             /*
 499              * Update current byte offset to indicate the number of bytes from the
 500              * start of the buffer. Buffer can include multiple descriptors, we
 501              * must keep track of the offset of not only each descriptor, but each
 502              * element (field) within each descriptor as well.
 503              */
 504             CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode,
 505                                     NextRnode);
 506             break;
 507         }
 508 
 509         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
 510     }
 511 
 512     return (Rnode);
 513 }
 514 
 515 
 516 /*******************************************************************************
 517  *
 518  * FUNCTION:    RsDoStartDependentNoPriDescriptor
 519  *
 520  * PARAMETERS:  Op                  - Parent resource descriptor parse node
 521  *              CurrentByteOffset   - Offset into the resource template AML
 522  *                                    buffer (to track references to the desc)
 523  *
 524  * RETURN:      Completed resource node
 525  *
 526  * DESCRIPTION: Construct a short "StartDependentNoPri" descriptor
 527  *
 528  ******************************************************************************/
 529 
 530 ASL_RESOURCE_NODE *
 531 RsDoStartDependentNoPriDescriptor (
 532     ACPI_PARSE_OBJECT       *Op,
 533     UINT32                  CurrentByteOffset)
 534 {
 535     AML_RESOURCE            *Descriptor;
 536     ACPI_PARSE_OBJECT       *InitializerOp;
 537     ASL_RESOURCE_NODE       *Rnode;
 538     ASL_RESOURCE_NODE       *PreviousRnode;
 539     ASL_RESOURCE_NODE       *NextRnode;
 540     UINT8                   State;
 541 
 542 
 543     InitializerOp = Op->Asl.Child;
 544     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO));
 545 
 546     Descriptor = Rnode->Buffer;
 547     Descriptor->StartDpf.DescriptorType  = ACPI_RESOURCE_NAME_START_DEPENDENT |
 548                                       ASL_RDESC_ST_DEPEND_SIZE;
 549     PreviousRnode = Rnode;
 550 
 551     /* Increment offset past StartDependentNoPri descriptor */
 552 
 553     CurrentByteOffset += sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO);
 554 
 555     /* Process all child initialization nodes */
 556 
 557     State = ACPI_RSTATE_START_DEPENDENT;
 558     while (InitializerOp)
 559     {
 560         NextRnode = RsDoOneResourceDescriptor  (InitializerOp,
 561                         CurrentByteOffset, &State);
 562 
 563         /*
 564          * Update current byte offset to indicate the number of bytes from the
 565          * start of the buffer. Buffer can include multiple descriptors, we
 566          * must keep track of the offset of not only each descriptor, but each
 567          * element (field) within each descriptor as well.
 568          */
 569         CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, NextRnode);
 570 
 571         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
 572     }
 573 
 574     return (Rnode);
 575 }
 576 
 577 
 578 /*******************************************************************************
 579  *
 580  * FUNCTION:    RsDoVendorSmallDescriptor
 581  *
 582  * PARAMETERS:  Op                  - Parent resource descriptor parse node
 583  *              CurrentByteOffset   - Offset into the resource template AML
 584  *                                    buffer (to track references to the desc)
 585  *
 586  * RETURN:      Completed resource node
 587  *
 588  * DESCRIPTION: Construct a short "VendorShort" descriptor
 589  *
 590  ******************************************************************************/
 591 
 592 ASL_RESOURCE_NODE *
 593 RsDoVendorSmallDescriptor (
 594     ACPI_PARSE_OBJECT       *Op,
 595     UINT32                  CurrentByteOffset)
 596 {
 597     AML_RESOURCE            *Descriptor;
 598     ACPI_PARSE_OBJECT       *InitializerOp;
 599     ASL_RESOURCE_NODE       *Rnode;
 600     UINT8                   *VendorData;
 601     UINT32                  i;
 602 
 603 
 604     InitializerOp = Op->Asl.Child;
 605 
 606     /* Allocate worst case - 7 vendor bytes */
 607 
 608     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_VENDOR_SMALL) + 7);
 609 
 610     Descriptor = Rnode->Buffer;
 611     Descriptor->VendorSmall.DescriptorType  = ACPI_RESOURCE_NAME_VENDOR_SMALL;
 612     VendorData = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_SMALL_HEADER);
 613 
 614     /* Process all child initialization nodes */
 615 
 616     InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
 617     for (i = 0; InitializerOp; i++)
 618     {
 619         if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
 620         {
 621             break;
 622         }
 623 
 624         /* Maximum 7 vendor data bytes allowed (0-6) */
 625 
 626         if (i >= 7)
 627         {
 628             AslError (ASL_ERROR, ASL_MSG_VENDOR_LIST, InitializerOp, NULL);
 629 
 630             /* Eat the excess initializers */
 631 
 632             while (InitializerOp)
 633             {
 634                 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
 635             }
 636             break;
 637         }
 638 
 639         VendorData[i] = (UINT8) InitializerOp->Asl.Value.Integer;
 640         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
 641     }
 642 
 643     /* Adjust the Rnode buffer size, so correct number of bytes are emitted */
 644 
 645     Rnode->BufferLength -= (7 - i);
 646 
 647     /* Set the length in the Type Tag */
 648 
 649     Descriptor->VendorSmall.DescriptorType |= (UINT8) i;
 650     return (Rnode);
 651 }