aslrestype1.c revision 151937
1118611Snjl 2118611Snjl/****************************************************************************** 3118611Snjl * 4118611Snjl * Module Name: aslrestype1 - Short (type1) resource templates and descriptors 5151937Sjkim * $Revision: 1.35 $ 6118611Snjl * 7118611Snjl *****************************************************************************/ 8118611Snjl 9118611Snjl/****************************************************************************** 10118611Snjl * 11118611Snjl * 1. Copyright Notice 12118611Snjl * 13151937Sjkim * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. 14118611Snjl * All rights reserved. 15118611Snjl * 16118611Snjl * 2. License 17118611Snjl * 18118611Snjl * 2.1. This is your license from Intel Corp. under its intellectual property 19118611Snjl * rights. You may have additional license terms from the party that provided 20118611Snjl * you this software, covering your right to use that party's intellectual 21118611Snjl * property rights. 22118611Snjl * 23118611Snjl * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 24118611Snjl * copy of the source code appearing in this file ("Covered Code") an 25118611Snjl * irrevocable, perpetual, worldwide license under Intel's copyrights in the 26118611Snjl * base code distributed originally by Intel ("Original Intel Code") to copy, 27118611Snjl * make derivatives, distribute, use and display any portion of the Covered 28118611Snjl * Code in any form, with the right to sublicense such rights; and 29118611Snjl * 30118611Snjl * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 31118611Snjl * license (with the right to sublicense), under only those claims of Intel 32118611Snjl * patents that are infringed by the Original Intel Code, to make, use, sell, 33118611Snjl * offer to sell, and import the Covered Code and derivative works thereof 34118611Snjl * solely to the minimum extent necessary to exercise the above copyright 35118611Snjl * license, and in no event shall the patent license extend to any additions 36118611Snjl * to or modifications of the Original Intel Code. No other license or right 37118611Snjl * is granted directly or by implication, estoppel or otherwise; 38118611Snjl * 39118611Snjl * The above copyright and patent license is granted only if the following 40118611Snjl * conditions are met: 41118611Snjl * 42118611Snjl * 3. Conditions 43118611Snjl * 44118611Snjl * 3.1. Redistribution of Source with Rights to Further Distribute Source. 45118611Snjl * Redistribution of source code of any substantial portion of the Covered 46118611Snjl * Code or modification with rights to further distribute source must include 47118611Snjl * the above Copyright Notice, the above License, this list of Conditions, 48118611Snjl * and the following Disclaimer and Export Compliance provision. In addition, 49118611Snjl * Licensee must cause all Covered Code to which Licensee contributes to 50118611Snjl * contain a file documenting the changes Licensee made to create that Covered 51118611Snjl * Code and the date of any change. Licensee must include in that file the 52118611Snjl * documentation of any changes made by any predecessor Licensee. Licensee 53118611Snjl * must include a prominent statement that the modification is derived, 54118611Snjl * directly or indirectly, from Original Intel Code. 55118611Snjl * 56118611Snjl * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 57118611Snjl * Redistribution of source code of any substantial portion of the Covered 58118611Snjl * Code or modification without rights to further distribute source must 59118611Snjl * include the following Disclaimer and Export Compliance provision in the 60118611Snjl * documentation and/or other materials provided with distribution. In 61118611Snjl * addition, Licensee may not authorize further sublicense of source of any 62118611Snjl * portion of the Covered Code, and must include terms to the effect that the 63118611Snjl * license from Licensee to its licensee is limited to the intellectual 64118611Snjl * property embodied in the software Licensee provides to its licensee, and 65118611Snjl * not to intellectual property embodied in modifications its licensee may 66118611Snjl * make. 67118611Snjl * 68118611Snjl * 3.3. Redistribution of Executable. Redistribution in executable form of any 69118611Snjl * substantial portion of the Covered Code or modification must reproduce the 70118611Snjl * above Copyright Notice, and the following Disclaimer and Export Compliance 71118611Snjl * provision in the documentation and/or other materials provided with the 72118611Snjl * distribution. 73118611Snjl * 74118611Snjl * 3.4. Intel retains all right, title, and interest in and to the Original 75118611Snjl * Intel Code. 76118611Snjl * 77118611Snjl * 3.5. Neither the name Intel nor any other trademark owned or controlled by 78118611Snjl * Intel shall be used in advertising or otherwise to promote the sale, use or 79118611Snjl * other dealings in products derived from or relating to the Covered Code 80118611Snjl * without prior written authorization from Intel. 81118611Snjl * 82118611Snjl * 4. Disclaimer and Export Compliance 83118611Snjl * 84118611Snjl * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 85118611Snjl * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 86118611Snjl * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 87118611Snjl * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 88118611Snjl * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 89118611Snjl * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 90118611Snjl * PARTICULAR PURPOSE. 91118611Snjl * 92118611Snjl * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 93118611Snjl * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 94118611Snjl * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 95118611Snjl * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 96118611Snjl * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 97118611Snjl * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 98118611Snjl * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 99118611Snjl * LIMITED REMEDY. 100118611Snjl * 101118611Snjl * 4.3. Licensee shall not export, either directly or indirectly, any of this 102118611Snjl * software or system incorporating such software without first obtaining any 103118611Snjl * required license or other approval from the U. S. Department of Commerce or 104118611Snjl * any other agency or department of the United States Government. In the 105118611Snjl * event Licensee exports any such software from the United States or 106118611Snjl * re-exports any such software from a foreign destination, Licensee shall 107118611Snjl * ensure that the distribution and export/re-export of the software is in 108118611Snjl * compliance with all laws, regulations, orders, or other restrictions of the 109118611Snjl * U.S. Export Administration Regulations. Licensee agrees that neither it nor 110118611Snjl * any of its subsidiaries will export/re-export any technical data, process, 111118611Snjl * software, or service, directly or indirectly, to any country for which the 112118611Snjl * United States government or any agency thereof requires an export license, 113118611Snjl * other governmental approval, or letter of assurance, without first obtaining 114118611Snjl * such license, approval or letter. 115118611Snjl * 116118611Snjl *****************************************************************************/ 117118611Snjl 118118611Snjl 119151937Sjkim#include <contrib/dev/acpica/compiler/aslcompiler.h> 120118611Snjl#include "aslcompiler.y.h" 121118611Snjl 122118611Snjl#define _COMPONENT ACPI_COMPILER 123118611Snjl ACPI_MODULE_NAME ("aslrestype1") 124118611Snjl 125118611Snjl 126118611Snjl/******************************************************************************* 127118611Snjl * 128118611Snjl * FUNCTION: RsDoDmaDescriptor 129118611Snjl * 130118611Snjl * PARAMETERS: Op - Parent resource descriptor parse node 131118611Snjl * CurrentByteOffset - Offset into the resource template AML 132118611Snjl * buffer (to track references to the desc) 133118611Snjl * 134118611Snjl * RETURN: Completed resource node 135118611Snjl * 136118611Snjl * DESCRIPTION: Construct a short "DMA" descriptor 137118611Snjl * 138118611Snjl ******************************************************************************/ 139118611Snjl 140118611SnjlASL_RESOURCE_NODE * 141118611SnjlRsDoDmaDescriptor ( 142118611Snjl ACPI_PARSE_OBJECT *Op, 143118611Snjl UINT32 CurrentByteOffset) 144118611Snjl{ 145151937Sjkim AML_RESOURCE *Descriptor; 146118611Snjl ACPI_PARSE_OBJECT *InitializerOp; 147118611Snjl ASL_RESOURCE_NODE *Rnode; 148118611Snjl UINT32 i; 149118611Snjl UINT8 DmaChannelMask = 0; 150151937Sjkim UINT8 DmaChannels = 0; 151118611Snjl 152118611Snjl 153118611Snjl InitializerOp = Op->Asl.Child; 154151937Sjkim Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_DMA)); 155118611Snjl 156118611Snjl Descriptor = Rnode->Buffer; 157151937Sjkim Descriptor->Dma.DescriptorType = ACPI_RESOURCE_NAME_DMA | 158118611Snjl ASL_RDESC_DMA_SIZE; 159118611Snjl 160151937Sjkim /* Process all child initialization nodes */ 161151937Sjkim 162118611Snjl for (i = 0; InitializerOp; i++) 163118611Snjl { 164118611Snjl switch (i) 165118611Snjl { 166118611Snjl case 0: /* DMA type */ 167118611Snjl 168118611Snjl RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 5, 0); 169118611Snjl RsCreateBitField (InitializerOp, ASL_RESNAME_DMATYPE, 170151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 5); 171118611Snjl break; 172118611Snjl 173118611Snjl case 1: /* Bus Master */ 174118611Snjl 175118611Snjl RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 2, 0); 176118611Snjl RsCreateBitField (InitializerOp, ASL_RESNAME_BUSMASTER, 177151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 2); 178118611Snjl break; 179118611Snjl 180118611Snjl case 2: /* Xfer Type (transfer width) */ 181118611Snjl 182118611Snjl RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 0, 0); 183118611Snjl RsCreateBitField (InitializerOp, ASL_RESNAME_XFERTYPE, 184151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 0); 185118611Snjl break; 186118611Snjl 187118611Snjl case 3: /* Name */ 188118611Snjl 189118611Snjl UtAttachNamepathToOwner (Op, InitializerOp); 190118611Snjl break; 191118611Snjl 192118611Snjl default: 193118611Snjl 194151937Sjkim /* All DMA channel bytes are handled here, after flags and name */ 195118611Snjl 196118611Snjl if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) 197118611Snjl { 198151937Sjkim /* Up to 8 channels can be specified in the list */ 199151937Sjkim 200151937Sjkim DmaChannels++; 201151937Sjkim if (DmaChannels > 8) 202151937Sjkim { 203151937Sjkim AslError (ASL_ERROR, ASL_MSG_DMA_LIST, 204151937Sjkim InitializerOp, NULL); 205151937Sjkim return (Rnode); 206151937Sjkim } 207151937Sjkim 208151937Sjkim /* Only DMA channels 0-7 are allowed (mask is 8 bits) */ 209151937Sjkim 210151937Sjkim if (InitializerOp->Asl.Value.Integer > 7) 211151937Sjkim { 212151937Sjkim AslError (ASL_ERROR, ASL_MSG_DMA_CHANNEL, 213151937Sjkim InitializerOp, NULL); 214151937Sjkim } 215151937Sjkim 216151937Sjkim /* Build the mask */ 217151937Sjkim 218151937Sjkim DmaChannelMask |= 219151937Sjkim (1 << ((UINT8) InitializerOp->Asl.Value.Integer)); 220118611Snjl } 221118611Snjl 222118611Snjl if (i == 4) /* case 4: First DMA byte */ 223118611Snjl { 224151937Sjkim /* Check now for duplicates in list */ 225151937Sjkim 226151937Sjkim RsCheckListForDuplicates (InitializerOp); 227151937Sjkim 228151937Sjkim /* Create a named field at the start of the list */ 229151937Sjkim 230118611Snjl RsCreateByteField (InitializerOp, ASL_RESNAME_DMA, 231151937Sjkim CurrentByteOffset + 232151937Sjkim ASL_RESDESC_OFFSET (Dma.DmaChannelMask)); 233118611Snjl } 234118611Snjl break; 235118611Snjl } 236118611Snjl 237118611Snjl InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); 238118611Snjl } 239118611Snjl 240118611Snjl /* Now we can set the channel mask */ 241118611Snjl 242118611Snjl Descriptor->Dma.DmaChannelMask = DmaChannelMask; 243118611Snjl return (Rnode); 244118611Snjl} 245118611Snjl 246118611Snjl 247118611Snjl/******************************************************************************* 248118611Snjl * 249118611Snjl * FUNCTION: RsDoEndDependentDescriptor 250118611Snjl * 251118611Snjl * PARAMETERS: Op - Parent resource descriptor parse node 252118611Snjl * CurrentByteOffset - Offset into the resource template AML 253118611Snjl * buffer (to track references to the desc) 254118611Snjl * 255118611Snjl * RETURN: Completed resource node 256118611Snjl * 257118611Snjl * DESCRIPTION: Construct a short "EndDependentFn" descriptor 258118611Snjl * 259118611Snjl ******************************************************************************/ 260118611Snjl 261118611SnjlASL_RESOURCE_NODE * 262118611SnjlRsDoEndDependentDescriptor ( 263118611Snjl ACPI_PARSE_OBJECT *Op, 264118611Snjl UINT32 CurrentByteOffset) 265118611Snjl{ 266151937Sjkim AML_RESOURCE *Descriptor; 267118611Snjl ASL_RESOURCE_NODE *Rnode; 268118611Snjl 269118611Snjl 270151937Sjkim Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_END_DEPENDENT)); 271118611Snjl 272118611Snjl Descriptor = Rnode->Buffer; 273151937Sjkim Descriptor->EndDpf.DescriptorType = ACPI_RESOURCE_NAME_END_DEPENDENT | 274151937Sjkim ASL_RDESC_END_DEPEND_SIZE; 275118611Snjl return (Rnode); 276118611Snjl} 277118611Snjl 278118611Snjl 279118611Snjl/******************************************************************************* 280118611Snjl * 281118611Snjl * FUNCTION: RsDoFixedIoDescriptor 282118611Snjl * 283118611Snjl * PARAMETERS: Op - Parent resource descriptor parse node 284118611Snjl * CurrentByteOffset - Offset into the resource template AML 285118611Snjl * buffer (to track references to the desc) 286118611Snjl * 287118611Snjl * RETURN: Completed resource node 288118611Snjl * 289118611Snjl * DESCRIPTION: Construct a short "FixedIO" descriptor 290118611Snjl * 291118611Snjl ******************************************************************************/ 292118611Snjl 293118611SnjlASL_RESOURCE_NODE * 294118611SnjlRsDoFixedIoDescriptor ( 295118611Snjl ACPI_PARSE_OBJECT *Op, 296118611Snjl UINT32 CurrentByteOffset) 297118611Snjl{ 298151937Sjkim AML_RESOURCE *Descriptor; 299118611Snjl ACPI_PARSE_OBJECT *InitializerOp; 300118611Snjl ASL_RESOURCE_NODE *Rnode; 301118611Snjl UINT32 i; 302118611Snjl 303118611Snjl 304118611Snjl InitializerOp = Op->Asl.Child; 305151937Sjkim Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_IO)); 306118611Snjl 307118611Snjl Descriptor = Rnode->Buffer; 308151937Sjkim Descriptor->Io.DescriptorType = ACPI_RESOURCE_NAME_FIXED_IO | 309151937Sjkim ASL_RDESC_FIXED_IO_SIZE; 310118611Snjl 311151937Sjkim /* Process all child initialization nodes */ 312151937Sjkim 313118611Snjl for (i = 0; InitializerOp; i++) 314118611Snjl { 315118611Snjl switch (i) 316118611Snjl { 317118611Snjl case 0: /* Base Address */ 318118611Snjl 319151937Sjkim Descriptor->FixedIo.Address = 320151937Sjkim (UINT16) InitializerOp->Asl.Value.Integer; 321118611Snjl RsCreateByteField (InitializerOp, ASL_RESNAME_BASEADDRESS, 322151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.Address)); 323118611Snjl break; 324118611Snjl 325118611Snjl case 1: /* Length */ 326118611Snjl 327151937Sjkim Descriptor->FixedIo.AddressLength = 328151937Sjkim (UINT8) InitializerOp->Asl.Value.Integer; 329118611Snjl RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH, 330151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.AddressLength)); 331118611Snjl break; 332118611Snjl 333118611Snjl case 2: /* Name */ 334118611Snjl 335118611Snjl UtAttachNamepathToOwner (Op, InitializerOp); 336118611Snjl break; 337118611Snjl 338118611Snjl default: 339118611Snjl 340118611Snjl AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); 341118611Snjl break; 342118611Snjl } 343118611Snjl 344118611Snjl InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); 345118611Snjl } 346118611Snjl 347118611Snjl return (Rnode); 348118611Snjl} 349118611Snjl 350118611Snjl 351118611Snjl/******************************************************************************* 352118611Snjl * 353118611Snjl * FUNCTION: RsDoIoDescriptor 354118611Snjl * 355118611Snjl * PARAMETERS: Op - Parent resource descriptor parse node 356118611Snjl * CurrentByteOffset - Offset into the resource template AML 357118611Snjl * buffer (to track references to the desc) 358118611Snjl * 359118611Snjl * RETURN: Completed resource node 360118611Snjl * 361118611Snjl * DESCRIPTION: Construct a short "IO" descriptor 362118611Snjl * 363118611Snjl ******************************************************************************/ 364118611Snjl 365118611SnjlASL_RESOURCE_NODE * 366118611SnjlRsDoIoDescriptor ( 367118611Snjl ACPI_PARSE_OBJECT *Op, 368118611Snjl UINT32 CurrentByteOffset) 369118611Snjl{ 370151937Sjkim AML_RESOURCE *Descriptor; 371118611Snjl ACPI_PARSE_OBJECT *InitializerOp; 372118611Snjl ASL_RESOURCE_NODE *Rnode; 373118611Snjl UINT32 i; 374118611Snjl 375118611Snjl 376118611Snjl InitializerOp = Op->Asl.Child; 377151937Sjkim Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IO)); 378118611Snjl 379118611Snjl Descriptor = Rnode->Buffer; 380151937Sjkim Descriptor->Io.DescriptorType = ACPI_RESOURCE_NAME_IO | 381151937Sjkim ASL_RDESC_IO_SIZE; 382118611Snjl 383151937Sjkim /* Process all child initialization nodes */ 384151937Sjkim 385118611Snjl for (i = 0; InitializerOp; i++) 386118611Snjl { 387118611Snjl switch (i) 388118611Snjl { 389118611Snjl case 0: /* Decode size */ 390118611Snjl 391151937Sjkim RsSetFlagBits (&Descriptor->Io.Flags, InitializerOp, 0, 1); 392118611Snjl RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE, 393151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Flags), 0); 394118611Snjl break; 395118611Snjl 396118611Snjl case 1: /* Min Address */ 397118611Snjl 398151937Sjkim Descriptor->Io.Minimum = 399151937Sjkim (UINT16) InitializerOp->Asl.Value.Integer; 400118611Snjl RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR, 401151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Minimum)); 402118611Snjl break; 403118611Snjl 404118611Snjl case 2: /* Max Address */ 405118611Snjl 406151937Sjkim Descriptor->Io.Maximum = 407151937Sjkim (UINT16) InitializerOp->Asl.Value.Integer; 408118611Snjl RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR, 409151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Maximum)); 410118611Snjl break; 411118611Snjl 412118611Snjl case 3: /* Alignment */ 413118611Snjl 414151937Sjkim Descriptor->Io.Alignment = 415151937Sjkim (UINT8) InitializerOp->Asl.Value.Integer; 416118611Snjl RsCreateByteField (InitializerOp, ASL_RESNAME_ALIGNMENT, 417151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Alignment)); 418118611Snjl break; 419118611Snjl 420118611Snjl case 4: /* Length */ 421118611Snjl 422151937Sjkim Descriptor->Io.AddressLength = 423151937Sjkim (UINT8) InitializerOp->Asl.Value.Integer; 424118611Snjl RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH, 425151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (Io.AddressLength)); 426118611Snjl break; 427118611Snjl 428118611Snjl case 5: /* Name */ 429118611Snjl 430118611Snjl UtAttachNamepathToOwner (Op, InitializerOp); 431118611Snjl break; 432118611Snjl 433118611Snjl default: 434118611Snjl 435118611Snjl AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); 436118611Snjl break; 437118611Snjl } 438118611Snjl 439118611Snjl InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); 440118611Snjl } 441118611Snjl 442118611Snjl return (Rnode); 443118611Snjl} 444118611Snjl 445118611Snjl 446118611Snjl/******************************************************************************* 447118611Snjl * 448118611Snjl * FUNCTION: RsDoIrqDescriptor 449118611Snjl * 450118611Snjl * PARAMETERS: Op - Parent resource descriptor parse node 451118611Snjl * CurrentByteOffset - Offset into the resource template AML 452118611Snjl * buffer (to track references to the desc) 453118611Snjl * 454118611Snjl * RETURN: Completed resource node 455118611Snjl * 456118611Snjl * DESCRIPTION: Construct a short "IRQ" descriptor 457118611Snjl * 458118611Snjl ******************************************************************************/ 459118611Snjl 460118611SnjlASL_RESOURCE_NODE * 461118611SnjlRsDoIrqDescriptor ( 462118611Snjl ACPI_PARSE_OBJECT *Op, 463118611Snjl UINT32 CurrentByteOffset) 464118611Snjl{ 465151937Sjkim AML_RESOURCE *Descriptor; 466118611Snjl ACPI_PARSE_OBJECT *InitializerOp; 467118611Snjl ASL_RESOURCE_NODE *Rnode; 468151937Sjkim UINT32 Interrupts = 0; 469151937Sjkim UINT16 IrqMask = 0; 470118611Snjl UINT32 i; 471118611Snjl 472118611Snjl 473118611Snjl InitializerOp = Op->Asl.Child; 474151937Sjkim Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ)); 475118611Snjl 476118611Snjl /* Length = 3 (with flag byte) */ 477118611Snjl 478118611Snjl Descriptor = Rnode->Buffer; 479151937Sjkim Descriptor->Irq.DescriptorType = ACPI_RESOURCE_NAME_IRQ | 480151937Sjkim (ASL_RDESC_IRQ_SIZE + 0x01); 481118611Snjl 482151937Sjkim /* Process all child initialization nodes */ 483151937Sjkim 484118611Snjl for (i = 0; InitializerOp; i++) 485118611Snjl { 486118611Snjl switch (i) 487118611Snjl { 488118611Snjl case 0: /* Interrupt Type (or Mode - edge/level) */ 489118611Snjl 490118611Snjl RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 0, 1); 491118611Snjl RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTTYPE, 492151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 0); 493118611Snjl break; 494118611Snjl 495118611Snjl case 1: /* Interrupt Level (or Polarity - Active high/low) */ 496118611Snjl 497118611Snjl RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 3, 0); 498118611Snjl RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTLEVEL, 499151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 3); 500118611Snjl break; 501118611Snjl 502118611Snjl case 2: /* Share Type - Default: exclusive (0) */ 503118611Snjl 504118611Snjl RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 4, 0); 505118611Snjl RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTSHARE, 506151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 4); 507118611Snjl break; 508118611Snjl 509118611Snjl case 3: /* Name */ 510118611Snjl 511118611Snjl UtAttachNamepathToOwner (Op, InitializerOp); 512118611Snjl break; 513118611Snjl 514118611Snjl default: 515118611Snjl 516118611Snjl /* All IRQ bytes are handled here, after the flags and name */ 517118611Snjl 518118611Snjl if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) 519118611Snjl { 520151937Sjkim /* Up to 16 interrupts can be specified in the list */ 521151937Sjkim 522151937Sjkim Interrupts++; 523151937Sjkim if (Interrupts > 16) 524151937Sjkim { 525151937Sjkim AslError (ASL_ERROR, ASL_MSG_INTERRUPT_LIST, 526151937Sjkim InitializerOp, NULL); 527151937Sjkim return (Rnode); 528151937Sjkim } 529151937Sjkim 530151937Sjkim /* Only interrupts 0-15 are allowed (mask is 16 bits) */ 531151937Sjkim 532151937Sjkim if (InitializerOp->Asl.Value.Integer > 15) 533151937Sjkim { 534151937Sjkim AslError (ASL_ERROR, ASL_MSG_INTERRUPT_NUMBER, 535151937Sjkim InitializerOp, NULL); 536151937Sjkim } 537151937Sjkim else 538151937Sjkim { 539151937Sjkim IrqMask |= (1 << (UINT8) InitializerOp->Asl.Value.Integer); 540151937Sjkim } 541118611Snjl } 542118611Snjl 543151937Sjkim /* Case 4: First IRQ value in list */ 544151937Sjkim 545151937Sjkim if (i == 4) 546118611Snjl { 547151937Sjkim /* Check now for duplicates in list */ 548151937Sjkim 549151937Sjkim RsCheckListForDuplicates (InitializerOp); 550151937Sjkim 551151937Sjkim /* Create a named field at the start of the list */ 552151937Sjkim 553118611Snjl RsCreateByteField (InitializerOp, ASL_RESNAME_INTERRUPT, 554151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask)); 555118611Snjl } 556118611Snjl break; 557118611Snjl } 558118611Snjl 559118611Snjl InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); 560118611Snjl } 561118611Snjl 562118611Snjl /* Now we can set the channel mask */ 563118611Snjl 564118611Snjl Descriptor->Irq.IrqMask = IrqMask; 565118611Snjl return (Rnode); 566118611Snjl} 567118611Snjl 568118611Snjl 569118611Snjl/******************************************************************************* 570118611Snjl * 571118611Snjl * FUNCTION: RsDoIrqNoFlagsDescriptor 572118611Snjl * 573118611Snjl * PARAMETERS: Op - Parent resource descriptor parse node 574118611Snjl * CurrentByteOffset - Offset into the resource template AML 575118611Snjl * buffer (to track references to the desc) 576118611Snjl * 577118611Snjl * RETURN: Completed resource node 578118611Snjl * 579118611Snjl * DESCRIPTION: Construct a short "IRQNoFlags" descriptor 580118611Snjl * 581118611Snjl ******************************************************************************/ 582118611Snjl 583118611SnjlASL_RESOURCE_NODE * 584118611SnjlRsDoIrqNoFlagsDescriptor ( 585118611Snjl ACPI_PARSE_OBJECT *Op, 586118611Snjl UINT32 CurrentByteOffset) 587118611Snjl{ 588151937Sjkim AML_RESOURCE *Descriptor; 589118611Snjl ACPI_PARSE_OBJECT *InitializerOp; 590118611Snjl ASL_RESOURCE_NODE *Rnode; 591151937Sjkim UINT16 IrqMask = 0; 592151937Sjkim UINT32 Interrupts = 0; 593118611Snjl UINT32 i; 594118611Snjl 595118611Snjl 596118611Snjl InitializerOp = Op->Asl.Child; 597151937Sjkim Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ_NOFLAGS)); 598118611Snjl 599118611Snjl Descriptor = Rnode->Buffer; 600151937Sjkim Descriptor->Irq.DescriptorType = ACPI_RESOURCE_NAME_IRQ | 601151937Sjkim ASL_RDESC_IRQ_SIZE; 602118611Snjl 603151937Sjkim /* Process all child initialization nodes */ 604151937Sjkim 605118611Snjl for (i = 0; InitializerOp; i++) 606118611Snjl { 607118611Snjl switch (i) 608118611Snjl { 609118611Snjl case 0: /* Name */ 610118611Snjl 611118611Snjl UtAttachNamepathToOwner (Op, InitializerOp); 612118611Snjl break; 613118611Snjl 614118611Snjl default: 615118611Snjl 616118611Snjl /* IRQ bytes are handled here, after the flags and name */ 617118611Snjl 618118611Snjl if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) 619118611Snjl { 620151937Sjkim /* Up to 16 interrupts can be specified in the list */ 621151937Sjkim 622151937Sjkim Interrupts++; 623151937Sjkim if (Interrupts > 16) 624151937Sjkim { 625151937Sjkim AslError (ASL_ERROR, ASL_MSG_INTERRUPT_LIST, 626151937Sjkim InitializerOp, NULL); 627151937Sjkim return (Rnode); 628151937Sjkim } 629151937Sjkim 630151937Sjkim /* Only interrupts 0-15 are allowed (mask is 16 bits) */ 631151937Sjkim 632151937Sjkim if (InitializerOp->Asl.Value.Integer > 15) 633151937Sjkim { 634151937Sjkim AslError (ASL_ERROR, ASL_MSG_INTERRUPT_NUMBER, 635151937Sjkim InitializerOp, NULL); 636151937Sjkim } 637151937Sjkim else 638151937Sjkim { 639151937Sjkim IrqMask |= (1 << ((UINT8) InitializerOp->Asl.Value.Integer)); 640151937Sjkim } 641118611Snjl } 642118611Snjl 643151937Sjkim /* Case 1: First IRQ value in list */ 644151937Sjkim 645151937Sjkim if (i == 1) 646118611Snjl { 647151937Sjkim /* Check now for duplicates in list */ 648151937Sjkim 649151937Sjkim RsCheckListForDuplicates (InitializerOp); 650151937Sjkim 651151937Sjkim /* Create a named field at the start of the list */ 652151937Sjkim 653118611Snjl RsCreateByteField (InitializerOp, ASL_RESNAME_INTERRUPT, 654151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask)); 655118611Snjl } 656118611Snjl break; 657118611Snjl } 658118611Snjl 659118611Snjl InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); 660118611Snjl } 661118611Snjl 662118611Snjl /* Now we can set the interrupt mask */ 663118611Snjl 664118611Snjl Descriptor->Irq.IrqMask = IrqMask; 665118611Snjl return (Rnode); 666118611Snjl} 667118611Snjl 668118611Snjl 669118611Snjl/******************************************************************************* 670118611Snjl * 671118611Snjl * FUNCTION: RsDoMemory24Descriptor 672118611Snjl * 673118611Snjl * PARAMETERS: Op - Parent resource descriptor parse node 674118611Snjl * CurrentByteOffset - Offset into the resource template AML 675118611Snjl * buffer (to track references to the desc) 676118611Snjl * 677118611Snjl * RETURN: Completed resource node 678118611Snjl * 679118611Snjl * DESCRIPTION: Construct a short "Memory24" descriptor 680118611Snjl * 681118611Snjl ******************************************************************************/ 682118611Snjl 683118611SnjlASL_RESOURCE_NODE * 684118611SnjlRsDoMemory24Descriptor ( 685118611Snjl ACPI_PARSE_OBJECT *Op, 686118611Snjl UINT32 CurrentByteOffset) 687118611Snjl{ 688151937Sjkim AML_RESOURCE *Descriptor; 689118611Snjl ACPI_PARSE_OBJECT *InitializerOp; 690118611Snjl ASL_RESOURCE_NODE *Rnode; 691118611Snjl UINT32 i; 692118611Snjl 693118611Snjl 694118611Snjl InitializerOp = Op->Asl.Child; 695151937Sjkim Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY24)); 696118611Snjl 697118611Snjl Descriptor = Rnode->Buffer; 698151937Sjkim Descriptor->Memory24.DescriptorType = ACPI_RESOURCE_NAME_MEMORY24; 699151937Sjkim Descriptor->Memory24.ResourceLength = 9; 700118611Snjl 701151937Sjkim /* Process all child initialization nodes */ 702151937Sjkim 703118611Snjl for (i = 0; InitializerOp; i++) 704118611Snjl { 705118611Snjl switch (i) 706118611Snjl { 707118611Snjl case 0: /* Read/Write type */ 708118611Snjl 709151937Sjkim RsSetFlagBits (&Descriptor->Memory24.Flags, InitializerOp, 0, 1); 710118611Snjl RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE, 711151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Flags), 0); 712118611Snjl break; 713118611Snjl 714118611Snjl case 1: /* Min Address */ 715118611Snjl 716151937Sjkim Descriptor->Memory24.Minimum = (UINT16) InitializerOp->Asl.Value.Integer; 717118611Snjl RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR, 718151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Minimum)); 719118611Snjl break; 720118611Snjl 721118611Snjl case 2: /* Max Address */ 722118611Snjl 723151937Sjkim Descriptor->Memory24.Maximum = (UINT16) InitializerOp->Asl.Value.Integer; 724118611Snjl RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR, 725151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Maximum)); 726118611Snjl break; 727118611Snjl 728118611Snjl case 3: /* Alignment */ 729118611Snjl 730151937Sjkim Descriptor->Memory24.Alignment = (UINT16) InitializerOp->Asl.Value.Integer; 731118611Snjl RsCreateByteField (InitializerOp, ASL_RESNAME_ALIGNMENT, 732151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Alignment)); 733118611Snjl break; 734118611Snjl 735118611Snjl case 4: /* Length */ 736118611Snjl 737151937Sjkim Descriptor->Memory24.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer; 738118611Snjl RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH, 739151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.AddressLength)); 740118611Snjl break; 741118611Snjl 742118611Snjl case 5: /* Name */ 743118611Snjl 744118611Snjl UtAttachNamepathToOwner (Op, InitializerOp); 745118611Snjl break; 746118611Snjl 747118611Snjl default: 748118611Snjl 749118611Snjl AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); 750118611Snjl break; 751118611Snjl } 752118611Snjl 753118611Snjl InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); 754118611Snjl } 755118611Snjl 756118611Snjl return (Rnode); 757118611Snjl} 758118611Snjl 759118611Snjl 760118611Snjl/******************************************************************************* 761118611Snjl * 762118611Snjl * FUNCTION: RsDoMemory32Descriptor 763118611Snjl * 764118611Snjl * PARAMETERS: Op - Parent resource descriptor parse node 765118611Snjl * CurrentByteOffset - Offset into the resource template AML 766118611Snjl * buffer (to track references to the desc) 767118611Snjl * 768118611Snjl * RETURN: Completed resource node 769118611Snjl * 770118611Snjl * DESCRIPTION: Construct a short "Memory32" descriptor 771118611Snjl * 772118611Snjl ******************************************************************************/ 773118611Snjl 774118611SnjlASL_RESOURCE_NODE * 775118611SnjlRsDoMemory32Descriptor ( 776118611Snjl ACPI_PARSE_OBJECT *Op, 777118611Snjl UINT32 CurrentByteOffset) 778118611Snjl{ 779151937Sjkim AML_RESOURCE *Descriptor; 780118611Snjl ACPI_PARSE_OBJECT *InitializerOp; 781118611Snjl ASL_RESOURCE_NODE *Rnode; 782118611Snjl UINT32 i; 783118611Snjl 784118611Snjl 785118611Snjl InitializerOp = Op->Asl.Child; 786151937Sjkim Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY32)); 787118611Snjl 788118611Snjl Descriptor = Rnode->Buffer; 789151937Sjkim Descriptor->Memory32.DescriptorType = ACPI_RESOURCE_NAME_MEMORY32; 790151937Sjkim Descriptor->Memory32.ResourceLength = 17; 791118611Snjl 792151937Sjkim /* Process all child initialization nodes */ 793151937Sjkim 794118611Snjl for (i = 0; InitializerOp; i++) 795118611Snjl { 796118611Snjl switch (i) 797118611Snjl { 798118611Snjl case 0: /* Read/Write type */ 799118611Snjl 800151937Sjkim RsSetFlagBits (&Descriptor->Memory32.Flags, InitializerOp, 0, 1); 801118611Snjl RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE, 802151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Flags), 0); 803118611Snjl break; 804118611Snjl 805118611Snjl case 1: /* Min Address */ 806118611Snjl 807151937Sjkim Descriptor->Memory32.Minimum = (UINT32) InitializerOp->Asl.Value.Integer; 808118611Snjl RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR, 809151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Minimum)); 810118611Snjl break; 811118611Snjl 812118611Snjl case 2: /* Max Address */ 813118611Snjl 814151937Sjkim Descriptor->Memory32.Maximum = (UINT32) InitializerOp->Asl.Value.Integer; 815118611Snjl RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR, 816151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Maximum)); 817118611Snjl break; 818118611Snjl 819118611Snjl case 3: /* Alignment */ 820118611Snjl 821151937Sjkim Descriptor->Memory32.Alignment = (UINT32) InitializerOp->Asl.Value.Integer; 822118611Snjl RsCreateByteField (InitializerOp, ASL_RESNAME_ALIGNMENT, 823151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Alignment)); 824118611Snjl break; 825118611Snjl 826118611Snjl case 4: /* Length */ 827118611Snjl 828151937Sjkim Descriptor->Memory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer; 829118611Snjl RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH, 830151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.AddressLength)); 831118611Snjl break; 832118611Snjl 833118611Snjl case 5: /* Name */ 834118611Snjl 835118611Snjl UtAttachNamepathToOwner (Op, InitializerOp); 836118611Snjl break; 837118611Snjl 838118611Snjl default: 839118611Snjl 840118611Snjl AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); 841118611Snjl break; 842118611Snjl } 843118611Snjl 844118611Snjl InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); 845118611Snjl } 846118611Snjl 847118611Snjl return (Rnode); 848118611Snjl} 849118611Snjl 850118611Snjl 851118611Snjl/******************************************************************************* 852118611Snjl * 853118611Snjl * FUNCTION: RsDoMemory32FixedDescriptor 854118611Snjl * 855118611Snjl * PARAMETERS: Op - Parent resource descriptor parse node 856118611Snjl * CurrentByteOffset - Offset into the resource template AML 857118611Snjl * buffer (to track references to the desc) 858118611Snjl * 859118611Snjl * RETURN: Completed resource node 860118611Snjl * 861118611Snjl * DESCRIPTION: Construct a short "Memory32Fixed" descriptor 862118611Snjl * 863118611Snjl ******************************************************************************/ 864118611Snjl 865118611SnjlASL_RESOURCE_NODE * 866118611SnjlRsDoMemory32FixedDescriptor ( 867118611Snjl ACPI_PARSE_OBJECT *Op, 868118611Snjl UINT32 CurrentByteOffset) 869118611Snjl{ 870151937Sjkim AML_RESOURCE *Descriptor; 871118611Snjl ACPI_PARSE_OBJECT *InitializerOp; 872118611Snjl ASL_RESOURCE_NODE *Rnode; 873118611Snjl UINT32 i; 874118611Snjl 875118611Snjl 876118611Snjl InitializerOp = Op->Asl.Child; 877151937Sjkim Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_MEMORY32)); 878118611Snjl 879118611Snjl Descriptor = Rnode->Buffer; 880151937Sjkim Descriptor->FixedMemory32.DescriptorType = ACPI_RESOURCE_NAME_FIXED_MEMORY32; 881151937Sjkim Descriptor->FixedMemory32.ResourceLength = 9; 882118611Snjl 883151937Sjkim /* Process all child initialization nodes */ 884151937Sjkim 885118611Snjl for (i = 0; InitializerOp; i++) 886118611Snjl { 887118611Snjl switch (i) 888118611Snjl { 889118611Snjl case 0: /* Read/Write type */ 890118611Snjl 891151937Sjkim RsSetFlagBits (&Descriptor->FixedMemory32.Flags, InitializerOp, 0, 1); 892118611Snjl RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE, 893151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Flags), 0); 894118611Snjl break; 895118611Snjl 896118611Snjl case 1: /* Address */ 897118611Snjl 898151937Sjkim Descriptor->FixedMemory32.Address = (UINT32) InitializerOp->Asl.Value.Integer; 899118611Snjl RsCreateByteField (InitializerOp, ASL_RESNAME_BASEADDRESS, 900151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Address)); 901118611Snjl break; 902118611Snjl 903118611Snjl case 2: /* Length */ 904118611Snjl 905151937Sjkim Descriptor->FixedMemory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer; 906118611Snjl RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH, 907151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.AddressLength)); 908118611Snjl break; 909118611Snjl 910118611Snjl case 3: /* Name */ 911118611Snjl 912118611Snjl UtAttachNamepathToOwner (Op, InitializerOp); 913118611Snjl break; 914118611Snjl 915118611Snjl default: 916118611Snjl 917118611Snjl AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); 918118611Snjl break; 919118611Snjl } 920118611Snjl 921118611Snjl InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); 922118611Snjl } 923118611Snjl 924118611Snjl return (Rnode); 925118611Snjl} 926118611Snjl 927118611Snjl 928118611Snjl/******************************************************************************* 929118611Snjl * 930118611Snjl * FUNCTION: RsDoStartDependentDescriptor 931118611Snjl * 932118611Snjl * PARAMETERS: Op - Parent resource descriptor parse node 933118611Snjl * CurrentByteOffset - Offset into the resource template AML 934118611Snjl * buffer (to track references to the desc) 935118611Snjl * 936118611Snjl * RETURN: Completed resource node 937118611Snjl * 938118611Snjl * DESCRIPTION: Construct a short "StartDependentFn" descriptor 939118611Snjl * 940118611Snjl ******************************************************************************/ 941118611Snjl 942118611SnjlASL_RESOURCE_NODE * 943118611SnjlRsDoStartDependentDescriptor ( 944118611Snjl ACPI_PARSE_OBJECT *Op, 945118611Snjl UINT32 CurrentByteOffset) 946118611Snjl{ 947151937Sjkim AML_RESOURCE *Descriptor; 948118611Snjl ACPI_PARSE_OBJECT *InitializerOp; 949118611Snjl ASL_RESOURCE_NODE *Rnode; 950118611Snjl ASL_RESOURCE_NODE *PreviousRnode; 951118611Snjl ASL_RESOURCE_NODE *NextRnode; 952118611Snjl UINT32 i; 953118611Snjl UINT8 State; 954118611Snjl 955118611Snjl 956118611Snjl InitializerOp = Op->Asl.Child; 957151937Sjkim Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT)); 958118611Snjl 959118611Snjl PreviousRnode = Rnode; 960118611Snjl Descriptor = Rnode->Buffer; 961118611Snjl 962118611Snjl /* Descriptor has priority byte */ 963118611Snjl 964151937Sjkim Descriptor->StartDpf.DescriptorType = ACPI_RESOURCE_NAME_START_DEPENDENT | 965151937Sjkim (ASL_RDESC_ST_DEPEND_SIZE + 0x01); 966118611Snjl 967151937Sjkim /* Process all child initialization nodes */ 968151937Sjkim 969118611Snjl State = ACPI_RSTATE_START_DEPENDENT; 970118611Snjl for (i = 0; InitializerOp; i++) 971118611Snjl { 972118611Snjl switch (i) 973118611Snjl { 974118611Snjl case 0: /* Compatibility Priority */ 975118611Snjl 976118611Snjl if ((UINT8) InitializerOp->Asl.Value.Integer > 2) 977118611Snjl { 978151937Sjkim AslError (ASL_ERROR, ASL_MSG_INVALID_PRIORITY, 979151937Sjkim InitializerOp, NULL); 980118611Snjl } 981118611Snjl 982151937Sjkim RsSetFlagBits (&Descriptor->StartDpf.Flags, InitializerOp, 0, 0); 983118611Snjl break; 984118611Snjl 985118611Snjl case 1: /* Performance/Robustness Priority */ 986118611Snjl 987118611Snjl if ((UINT8) InitializerOp->Asl.Value.Integer > 2) 988118611Snjl { 989151937Sjkim AslError (ASL_ERROR, ASL_MSG_INVALID_PERFORMANCE, 990151937Sjkim InitializerOp, NULL); 991118611Snjl } 992118611Snjl 993151937Sjkim RsSetFlagBits (&Descriptor->StartDpf.Flags, InitializerOp, 2, 0); 994118611Snjl break; 995118611Snjl 996118611Snjl default: 997151937Sjkim NextRnode = RsDoOneResourceDescriptor (InitializerOp, 998151937Sjkim CurrentByteOffset, &State); 999118611Snjl 1000118611Snjl /* 1001118611Snjl * Update current byte offset to indicate the number of bytes from the 1002118611Snjl * start of the buffer. Buffer can include multiple descriptors, we 1003118611Snjl * must keep track of the offset of not only each descriptor, but each 1004118611Snjl * element (field) within each descriptor as well. 1005118611Snjl */ 1006118611Snjl 1007151937Sjkim CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, 1008151937Sjkim NextRnode); 1009118611Snjl break; 1010118611Snjl } 1011118611Snjl 1012118611Snjl InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); 1013118611Snjl } 1014118611Snjl 1015118611Snjl return (Rnode); 1016118611Snjl} 1017118611Snjl 1018118611Snjl 1019118611Snjl/******************************************************************************* 1020118611Snjl * 1021118611Snjl * FUNCTION: RsDoStartDependentNoPriDescriptor 1022118611Snjl * 1023118611Snjl * PARAMETERS: Op - Parent resource descriptor parse node 1024118611Snjl * CurrentByteOffset - Offset into the resource template AML 1025118611Snjl * buffer (to track references to the desc) 1026118611Snjl * 1027118611Snjl * RETURN: Completed resource node 1028118611Snjl * 1029118611Snjl * DESCRIPTION: Construct a short "StartDependentNoPri" descriptor 1030118611Snjl * 1031118611Snjl ******************************************************************************/ 1032118611Snjl 1033118611SnjlASL_RESOURCE_NODE * 1034118611SnjlRsDoStartDependentNoPriDescriptor ( 1035118611Snjl ACPI_PARSE_OBJECT *Op, 1036118611Snjl UINT32 CurrentByteOffset) 1037118611Snjl{ 1038151937Sjkim AML_RESOURCE *Descriptor; 1039118611Snjl ACPI_PARSE_OBJECT *InitializerOp; 1040118611Snjl ASL_RESOURCE_NODE *Rnode; 1041118611Snjl ASL_RESOURCE_NODE *PreviousRnode; 1042118611Snjl ASL_RESOURCE_NODE *NextRnode; 1043118611Snjl UINT8 State; 1044118611Snjl 1045118611Snjl 1046118611Snjl InitializerOp = Op->Asl.Child; 1047151937Sjkim Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO)); 1048118611Snjl 1049118611Snjl Descriptor = Rnode->Buffer; 1050151937Sjkim Descriptor->StartDpf.DescriptorType = ACPI_RESOURCE_NAME_START_DEPENDENT | 1051151937Sjkim ASL_RDESC_ST_DEPEND_SIZE; 1052118611Snjl PreviousRnode = Rnode; 1053118611Snjl 1054151937Sjkim /* Process all child initialization nodes */ 1055151937Sjkim 1056118611Snjl State = ACPI_RSTATE_START_DEPENDENT; 1057118611Snjl while (InitializerOp) 1058118611Snjl { 1059151937Sjkim NextRnode = RsDoOneResourceDescriptor (InitializerOp, 1060151937Sjkim CurrentByteOffset, &State); 1061118611Snjl 1062118611Snjl /* 1063118611Snjl * Update current byte offset to indicate the number of bytes from the 1064118611Snjl * start of the buffer. Buffer can include multiple descriptors, we 1065118611Snjl * must keep track of the offset of not only each descriptor, but each 1066118611Snjl * element (field) within each descriptor as well. 1067118611Snjl */ 1068118611Snjl CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, NextRnode); 1069118611Snjl 1070118611Snjl InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); 1071118611Snjl } 1072118611Snjl 1073118611Snjl return (Rnode); 1074118611Snjl} 1075118611Snjl 1076118611Snjl 1077118611Snjl/******************************************************************************* 1078118611Snjl * 1079118611Snjl * FUNCTION: RsDoVendorSmallDescriptor 1080118611Snjl * 1081118611Snjl * PARAMETERS: Op - Parent resource descriptor parse node 1082118611Snjl * CurrentByteOffset - Offset into the resource template AML 1083118611Snjl * buffer (to track references to the desc) 1084118611Snjl * 1085118611Snjl * RETURN: Completed resource node 1086118611Snjl * 1087118611Snjl * DESCRIPTION: Construct a short "VendorShort" descriptor 1088118611Snjl * 1089118611Snjl ******************************************************************************/ 1090118611Snjl 1091118611SnjlASL_RESOURCE_NODE * 1092118611SnjlRsDoVendorSmallDescriptor ( 1093118611Snjl ACPI_PARSE_OBJECT *Op, 1094118611Snjl UINT32 CurrentByteOffset) 1095118611Snjl{ 1096151937Sjkim AML_RESOURCE *Descriptor; 1097118611Snjl ACPI_PARSE_OBJECT *InitializerOp; 1098118611Snjl ASL_RESOURCE_NODE *Rnode; 1099151937Sjkim UINT8 *VendorData; 1100118611Snjl UINT32 i; 1101118611Snjl 1102118611Snjl 1103118611Snjl InitializerOp = Op->Asl.Child; 1104118611Snjl 1105151937Sjkim /* Allocate worst case - 7 vendor bytes */ 1106151937Sjkim 1107151937Sjkim Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_VENDOR_SMALL) + 7); 1108151937Sjkim 1109118611Snjl Descriptor = Rnode->Buffer; 1110151937Sjkim Descriptor->VendorSmall.DescriptorType = ACPI_RESOURCE_NAME_VENDOR_SMALL; 1111151937Sjkim VendorData = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_SMALL_HEADER); 1112118611Snjl 1113151937Sjkim /* Process all child initialization nodes */ 1114151937Sjkim 1115118611Snjl InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); 1116151937Sjkim for (i = 0; InitializerOp; i++) 1117118611Snjl { 1118151937Sjkim /* Maximum 7 vendor data bytes allowed (0-6) */ 1119151937Sjkim 1120151937Sjkim if (i >= 7) 1121151937Sjkim { 1122151937Sjkim AslError (ASL_ERROR, ASL_MSG_VENDOR_LIST, InitializerOp, NULL); 1123151937Sjkim 1124151937Sjkim /* Eat the excess initializers */ 1125151937Sjkim 1126151937Sjkim while (InitializerOp) 1127151937Sjkim { 1128151937Sjkim InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); 1129151937Sjkim } 1130151937Sjkim break; 1131151937Sjkim } 1132151937Sjkim 1133151937Sjkim VendorData[i] = (UINT8) InitializerOp->Asl.Value.Integer; 1134118611Snjl InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); 1135118611Snjl } 1136118611Snjl 1137118611Snjl /* Adjust the Rnode buffer size, so correct number of bytes are emitted */ 1138118611Snjl 1139118611Snjl Rnode->BufferLength -= (7 - i); 1140118611Snjl 1141118611Snjl /* Set the length in the Type Tag */ 1142118611Snjl 1143151937Sjkim Descriptor->VendorSmall.DescriptorType |= (UINT8) i; 1144118611Snjl return (Rnode); 1145118611Snjl} 1146118611Snjl 1147118611Snjl 1148