aslrestype1.c revision 213806
1118611Snjl 2118611Snjl/****************************************************************************** 3118611Snjl * 4207344Sjkim * Module Name: aslrestype1 - Miscellaneous small resource descriptors 5118611Snjl * 6118611Snjl *****************************************************************************/ 7118611Snjl 8118611Snjl/****************************************************************************** 9118611Snjl * 10118611Snjl * 1. Copyright Notice 11118611Snjl * 12202771Sjkim * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. 13118611Snjl * All rights reserved. 14118611Snjl * 15118611Snjl * 2. License 16118611Snjl * 17118611Snjl * 2.1. This is your license from Intel Corp. under its intellectual property 18118611Snjl * rights. You may have additional license terms from the party that provided 19118611Snjl * you this software, covering your right to use that party's intellectual 20118611Snjl * property rights. 21118611Snjl * 22118611Snjl * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 23118611Snjl * copy of the source code appearing in this file ("Covered Code") an 24118611Snjl * irrevocable, perpetual, worldwide license under Intel's copyrights in the 25118611Snjl * base code distributed originally by Intel ("Original Intel Code") to copy, 26118611Snjl * make derivatives, distribute, use and display any portion of the Covered 27118611Snjl * Code in any form, with the right to sublicense such rights; and 28118611Snjl * 29118611Snjl * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 30118611Snjl * license (with the right to sublicense), under only those claims of Intel 31118611Snjl * patents that are infringed by the Original Intel Code, to make, use, sell, 32118611Snjl * offer to sell, and import the Covered Code and derivative works thereof 33118611Snjl * solely to the minimum extent necessary to exercise the above copyright 34118611Snjl * license, and in no event shall the patent license extend to any additions 35118611Snjl * to or modifications of the Original Intel Code. No other license or right 36118611Snjl * is granted directly or by implication, estoppel or otherwise; 37118611Snjl * 38118611Snjl * The above copyright and patent license is granted only if the following 39118611Snjl * conditions are met: 40118611Snjl * 41118611Snjl * 3. Conditions 42118611Snjl * 43118611Snjl * 3.1. Redistribution of Source with Rights to Further Distribute Source. 44118611Snjl * Redistribution of source code of any substantial portion of the Covered 45118611Snjl * Code or modification with rights to further distribute source must include 46118611Snjl * the above Copyright Notice, the above License, this list of Conditions, 47118611Snjl * and the following Disclaimer and Export Compliance provision. In addition, 48118611Snjl * Licensee must cause all Covered Code to which Licensee contributes to 49118611Snjl * contain a file documenting the changes Licensee made to create that Covered 50118611Snjl * Code and the date of any change. Licensee must include in that file the 51118611Snjl * documentation of any changes made by any predecessor Licensee. Licensee 52118611Snjl * must include a prominent statement that the modification is derived, 53118611Snjl * directly or indirectly, from Original Intel Code. 54118611Snjl * 55118611Snjl * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 56118611Snjl * Redistribution of source code of any substantial portion of the Covered 57118611Snjl * Code or modification without rights to further distribute source must 58118611Snjl * include the following Disclaimer and Export Compliance provision in the 59118611Snjl * documentation and/or other materials provided with distribution. In 60118611Snjl * addition, Licensee may not authorize further sublicense of source of any 61118611Snjl * portion of the Covered Code, and must include terms to the effect that the 62118611Snjl * license from Licensee to its licensee is limited to the intellectual 63118611Snjl * property embodied in the software Licensee provides to its licensee, and 64118611Snjl * not to intellectual property embodied in modifications its licensee may 65118611Snjl * make. 66118611Snjl * 67118611Snjl * 3.3. Redistribution of Executable. Redistribution in executable form of any 68118611Snjl * substantial portion of the Covered Code or modification must reproduce the 69118611Snjl * above Copyright Notice, and the following Disclaimer and Export Compliance 70118611Snjl * provision in the documentation and/or other materials provided with the 71118611Snjl * distribution. 72118611Snjl * 73118611Snjl * 3.4. Intel retains all right, title, and interest in and to the Original 74118611Snjl * Intel Code. 75118611Snjl * 76118611Snjl * 3.5. Neither the name Intel nor any other trademark owned or controlled by 77118611Snjl * Intel shall be used in advertising or otherwise to promote the sale, use or 78118611Snjl * other dealings in products derived from or relating to the Covered Code 79118611Snjl * without prior written authorization from Intel. 80118611Snjl * 81118611Snjl * 4. Disclaimer and Export Compliance 82118611Snjl * 83118611Snjl * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 84118611Snjl * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 85118611Snjl * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 86118611Snjl * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 87118611Snjl * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 88118611Snjl * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 89118611Snjl * PARTICULAR PURPOSE. 90118611Snjl * 91118611Snjl * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 92118611Snjl * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 93118611Snjl * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 94118611Snjl * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 95118611Snjl * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 96118611Snjl * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 97118611Snjl * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 98118611Snjl * LIMITED REMEDY. 99118611Snjl * 100118611Snjl * 4.3. Licensee shall not export, either directly or indirectly, any of this 101118611Snjl * software or system incorporating such software without first obtaining any 102118611Snjl * required license or other approval from the U. S. Department of Commerce or 103118611Snjl * any other agency or department of the United States Government. In the 104118611Snjl * event Licensee exports any such software from the United States or 105118611Snjl * re-exports any such software from a foreign destination, Licensee shall 106118611Snjl * ensure that the distribution and export/re-export of the software is in 107118611Snjl * compliance with all laws, regulations, orders, or other restrictions of the 108118611Snjl * U.S. Export Administration Regulations. Licensee agrees that neither it nor 109118611Snjl * any of its subsidiaries will export/re-export any technical data, process, 110118611Snjl * software, or service, directly or indirectly, to any country for which the 111118611Snjl * United States government or any agency thereof requires an export license, 112118611Snjl * other governmental approval, or letter of assurance, without first obtaining 113118611Snjl * such license, approval or letter. 114118611Snjl * 115118611Snjl *****************************************************************************/ 116118611Snjl 117118611Snjl 118151937Sjkim#include <contrib/dev/acpica/compiler/aslcompiler.h> 119118611Snjl#include "aslcompiler.y.h" 120118611Snjl 121118611Snjl#define _COMPONENT ACPI_COMPILER 122118611Snjl ACPI_MODULE_NAME ("aslrestype1") 123118611Snjl 124207344Sjkim/* 125207344Sjkim * This module contains miscellaneous small resource descriptors: 126207344Sjkim * 127207344Sjkim * EndTag 128207344Sjkim * EndDependentFn 129207344Sjkim * Memory24 130207344Sjkim * Memory32 131207344Sjkim * Memory32Fixed 132207344Sjkim * StartDependentFn 133207344Sjkim * StartDependentFnNoPri 134207344Sjkim * VendorShort 135207344Sjkim */ 136118611Snjl 137118611Snjl/******************************************************************************* 138118611Snjl * 139167802Sjkim * FUNCTION: RsDoEndTagDescriptor 140167802Sjkim * 141167802Sjkim * PARAMETERS: Op - Parent resource descriptor parse node 142167802Sjkim * CurrentByteOffset - Offset into the resource template AML 143167802Sjkim * buffer (to track references to the desc) 144167802Sjkim * 145167802Sjkim * RETURN: Completed resource node 146167802Sjkim * 147167802Sjkim * DESCRIPTION: Construct a short "EndDependentFn" descriptor 148167802Sjkim * 149167802Sjkim ******************************************************************************/ 150167802Sjkim 151167802SjkimASL_RESOURCE_NODE * 152167802SjkimRsDoEndTagDescriptor ( 153167802Sjkim ACPI_PARSE_OBJECT *Op, 154167802Sjkim UINT32 CurrentByteOffset) 155167802Sjkim{ 156167802Sjkim AML_RESOURCE *Descriptor; 157167802Sjkim ASL_RESOURCE_NODE *Rnode; 158167802Sjkim 159167802Sjkim 160167802Sjkim Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_END_TAG)); 161167802Sjkim 162167802Sjkim Descriptor = Rnode->Buffer; 163167802Sjkim Descriptor->EndTag.DescriptorType = ACPI_RESOURCE_NAME_END_TAG | 164167802Sjkim ASL_RDESC_END_TAG_SIZE; 165167802Sjkim Descriptor->EndTag.Checksum = 0; 166167802Sjkim 167167802Sjkim return (Rnode); 168167802Sjkim} 169167802Sjkim 170167802Sjkim 171167802Sjkim/******************************************************************************* 172167802Sjkim * 173118611Snjl * FUNCTION: RsDoEndDependentDescriptor 174118611Snjl * 175118611Snjl * PARAMETERS: Op - Parent resource descriptor parse node 176118611Snjl * CurrentByteOffset - Offset into the resource template AML 177118611Snjl * buffer (to track references to the desc) 178118611Snjl * 179118611Snjl * RETURN: Completed resource node 180118611Snjl * 181118611Snjl * DESCRIPTION: Construct a short "EndDependentFn" descriptor 182118611Snjl * 183118611Snjl ******************************************************************************/ 184118611Snjl 185118611SnjlASL_RESOURCE_NODE * 186118611SnjlRsDoEndDependentDescriptor ( 187118611Snjl ACPI_PARSE_OBJECT *Op, 188118611Snjl UINT32 CurrentByteOffset) 189118611Snjl{ 190151937Sjkim AML_RESOURCE *Descriptor; 191118611Snjl ASL_RESOURCE_NODE *Rnode; 192118611Snjl 193118611Snjl 194151937Sjkim Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_END_DEPENDENT)); 195118611Snjl 196118611Snjl Descriptor = Rnode->Buffer; 197151937Sjkim Descriptor->EndDpf.DescriptorType = ACPI_RESOURCE_NAME_END_DEPENDENT | 198151937Sjkim ASL_RDESC_END_DEPEND_SIZE; 199118611Snjl return (Rnode); 200118611Snjl} 201118611Snjl 202118611Snjl 203118611Snjl/******************************************************************************* 204118611Snjl * 205118611Snjl * FUNCTION: RsDoMemory24Descriptor 206118611Snjl * 207118611Snjl * PARAMETERS: Op - Parent resource descriptor parse node 208118611Snjl * CurrentByteOffset - Offset into the resource template AML 209118611Snjl * buffer (to track references to the desc) 210118611Snjl * 211118611Snjl * RETURN: Completed resource node 212118611Snjl * 213118611Snjl * DESCRIPTION: Construct a short "Memory24" descriptor 214118611Snjl * 215118611Snjl ******************************************************************************/ 216118611Snjl 217118611SnjlASL_RESOURCE_NODE * 218118611SnjlRsDoMemory24Descriptor ( 219118611Snjl ACPI_PARSE_OBJECT *Op, 220118611Snjl UINT32 CurrentByteOffset) 221118611Snjl{ 222151937Sjkim AML_RESOURCE *Descriptor; 223118611Snjl ACPI_PARSE_OBJECT *InitializerOp; 224207344Sjkim ACPI_PARSE_OBJECT *MinOp = NULL; 225207344Sjkim ACPI_PARSE_OBJECT *MaxOp = NULL; 226207344Sjkim ACPI_PARSE_OBJECT *LengthOp = NULL; 227118611Snjl ASL_RESOURCE_NODE *Rnode; 228118611Snjl UINT32 i; 229118611Snjl 230118611Snjl 231118611Snjl InitializerOp = Op->Asl.Child; 232151937Sjkim Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY24)); 233118611Snjl 234118611Snjl Descriptor = Rnode->Buffer; 235151937Sjkim Descriptor->Memory24.DescriptorType = ACPI_RESOURCE_NAME_MEMORY24; 236151937Sjkim Descriptor->Memory24.ResourceLength = 9; 237118611Snjl 238151937Sjkim /* Process all child initialization nodes */ 239151937Sjkim 240118611Snjl for (i = 0; InitializerOp; i++) 241118611Snjl { 242118611Snjl switch (i) 243118611Snjl { 244118611Snjl case 0: /* Read/Write type */ 245118611Snjl 246151937Sjkim RsSetFlagBits (&Descriptor->Memory24.Flags, InitializerOp, 0, 1); 247167802Sjkim RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE, 248151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Flags), 0); 249118611Snjl break; 250118611Snjl 251118611Snjl case 1: /* Min Address */ 252118611Snjl 253151937Sjkim Descriptor->Memory24.Minimum = (UINT16) InitializerOp->Asl.Value.Integer; 254167802Sjkim RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, 255151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Minimum)); 256207344Sjkim MinOp = InitializerOp; 257118611Snjl break; 258118611Snjl 259118611Snjl case 2: /* Max Address */ 260118611Snjl 261151937Sjkim Descriptor->Memory24.Maximum = (UINT16) InitializerOp->Asl.Value.Integer; 262167802Sjkim RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, 263151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Maximum)); 264207344Sjkim MaxOp = InitializerOp; 265118611Snjl break; 266118611Snjl 267118611Snjl case 3: /* Alignment */ 268118611Snjl 269151937Sjkim Descriptor->Memory24.Alignment = (UINT16) InitializerOp->Asl.Value.Integer; 270167802Sjkim RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT, 271151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Alignment)); 272118611Snjl break; 273118611Snjl 274118611Snjl case 4: /* Length */ 275118611Snjl 276151937Sjkim Descriptor->Memory24.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer; 277167802Sjkim RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, 278151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.AddressLength)); 279207344Sjkim LengthOp = InitializerOp; 280118611Snjl break; 281118611Snjl 282118611Snjl case 5: /* Name */ 283118611Snjl 284118611Snjl UtAttachNamepathToOwner (Op, InitializerOp); 285118611Snjl break; 286118611Snjl 287118611Snjl default: 288118611Snjl 289118611Snjl AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); 290118611Snjl break; 291118611Snjl } 292118611Snjl 293118611Snjl InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); 294118611Snjl } 295118611Snjl 296207344Sjkim /* Validate the Min/Max/Len/Align values (Alignment==0 means 64K) */ 297207344Sjkim 298207344Sjkim RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY24, 299207344Sjkim Descriptor->Memory24.Minimum, 300207344Sjkim Descriptor->Memory24.Maximum, 301207344Sjkim Descriptor->Memory24.AddressLength, 302207344Sjkim Descriptor->Memory24.Alignment, 303213806Sjkim MinOp, MaxOp, LengthOp, NULL, Op); 304207344Sjkim 305118611Snjl return (Rnode); 306118611Snjl} 307118611Snjl 308118611Snjl 309118611Snjl/******************************************************************************* 310118611Snjl * 311118611Snjl * FUNCTION: RsDoMemory32Descriptor 312118611Snjl * 313118611Snjl * PARAMETERS: Op - Parent resource descriptor parse node 314118611Snjl * CurrentByteOffset - Offset into the resource template AML 315118611Snjl * buffer (to track references to the desc) 316118611Snjl * 317118611Snjl * RETURN: Completed resource node 318118611Snjl * 319118611Snjl * DESCRIPTION: Construct a short "Memory32" descriptor 320118611Snjl * 321118611Snjl ******************************************************************************/ 322118611Snjl 323118611SnjlASL_RESOURCE_NODE * 324118611SnjlRsDoMemory32Descriptor ( 325118611Snjl ACPI_PARSE_OBJECT *Op, 326118611Snjl UINT32 CurrentByteOffset) 327118611Snjl{ 328151937Sjkim AML_RESOURCE *Descriptor; 329118611Snjl ACPI_PARSE_OBJECT *InitializerOp; 330207344Sjkim ACPI_PARSE_OBJECT *MinOp = NULL; 331207344Sjkim ACPI_PARSE_OBJECT *MaxOp = NULL; 332207344Sjkim ACPI_PARSE_OBJECT *LengthOp = NULL; 333207344Sjkim ACPI_PARSE_OBJECT *AlignOp = NULL; 334118611Snjl ASL_RESOURCE_NODE *Rnode; 335118611Snjl UINT32 i; 336118611Snjl 337118611Snjl 338118611Snjl InitializerOp = Op->Asl.Child; 339151937Sjkim Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY32)); 340118611Snjl 341118611Snjl Descriptor = Rnode->Buffer; 342151937Sjkim Descriptor->Memory32.DescriptorType = ACPI_RESOURCE_NAME_MEMORY32; 343151937Sjkim Descriptor->Memory32.ResourceLength = 17; 344118611Snjl 345151937Sjkim /* Process all child initialization nodes */ 346151937Sjkim 347118611Snjl for (i = 0; InitializerOp; i++) 348118611Snjl { 349118611Snjl switch (i) 350118611Snjl { 351118611Snjl case 0: /* Read/Write type */ 352118611Snjl 353151937Sjkim RsSetFlagBits (&Descriptor->Memory32.Flags, InitializerOp, 0, 1); 354167802Sjkim RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE, 355151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Flags), 0); 356118611Snjl break; 357118611Snjl 358118611Snjl case 1: /* Min Address */ 359118611Snjl 360151937Sjkim Descriptor->Memory32.Minimum = (UINT32) InitializerOp->Asl.Value.Integer; 361167802Sjkim RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, 362151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Minimum)); 363207344Sjkim MinOp = InitializerOp; 364118611Snjl break; 365118611Snjl 366118611Snjl case 2: /* Max Address */ 367118611Snjl 368151937Sjkim Descriptor->Memory32.Maximum = (UINT32) InitializerOp->Asl.Value.Integer; 369167802Sjkim RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, 370151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Maximum)); 371207344Sjkim MaxOp = InitializerOp; 372118611Snjl break; 373118611Snjl 374118611Snjl case 3: /* Alignment */ 375118611Snjl 376151937Sjkim Descriptor->Memory32.Alignment = (UINT32) InitializerOp->Asl.Value.Integer; 377167802Sjkim RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT, 378151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Alignment)); 379207344Sjkim AlignOp = InitializerOp; 380118611Snjl break; 381118611Snjl 382118611Snjl case 4: /* Length */ 383118611Snjl 384151937Sjkim Descriptor->Memory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer; 385167802Sjkim RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, 386151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.AddressLength)); 387207344Sjkim LengthOp = InitializerOp; 388118611Snjl break; 389118611Snjl 390118611Snjl case 5: /* Name */ 391118611Snjl 392118611Snjl UtAttachNamepathToOwner (Op, InitializerOp); 393118611Snjl break; 394118611Snjl 395118611Snjl default: 396118611Snjl 397118611Snjl AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); 398118611Snjl break; 399118611Snjl } 400118611Snjl 401118611Snjl InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); 402118611Snjl } 403118611Snjl 404207344Sjkim /* Validate the Min/Max/Len/Align values */ 405207344Sjkim 406207344Sjkim RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY32, 407207344Sjkim Descriptor->Memory32.Minimum, 408207344Sjkim Descriptor->Memory32.Maximum, 409207344Sjkim Descriptor->Memory32.AddressLength, 410207344Sjkim Descriptor->Memory32.Alignment, 411213806Sjkim MinOp, MaxOp, LengthOp, AlignOp, Op); 412207344Sjkim 413118611Snjl return (Rnode); 414118611Snjl} 415118611Snjl 416118611Snjl 417118611Snjl/******************************************************************************* 418118611Snjl * 419118611Snjl * FUNCTION: RsDoMemory32FixedDescriptor 420118611Snjl * 421118611Snjl * PARAMETERS: Op - Parent resource descriptor parse node 422118611Snjl * CurrentByteOffset - Offset into the resource template AML 423118611Snjl * buffer (to track references to the desc) 424118611Snjl * 425118611Snjl * RETURN: Completed resource node 426118611Snjl * 427118611Snjl * DESCRIPTION: Construct a short "Memory32Fixed" descriptor 428118611Snjl * 429118611Snjl ******************************************************************************/ 430118611Snjl 431118611SnjlASL_RESOURCE_NODE * 432118611SnjlRsDoMemory32FixedDescriptor ( 433118611Snjl ACPI_PARSE_OBJECT *Op, 434118611Snjl UINT32 CurrentByteOffset) 435118611Snjl{ 436151937Sjkim AML_RESOURCE *Descriptor; 437118611Snjl ACPI_PARSE_OBJECT *InitializerOp; 438118611Snjl ASL_RESOURCE_NODE *Rnode; 439118611Snjl UINT32 i; 440118611Snjl 441118611Snjl 442118611Snjl InitializerOp = Op->Asl.Child; 443151937Sjkim Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_MEMORY32)); 444118611Snjl 445118611Snjl Descriptor = Rnode->Buffer; 446151937Sjkim Descriptor->FixedMemory32.DescriptorType = ACPI_RESOURCE_NAME_FIXED_MEMORY32; 447151937Sjkim Descriptor->FixedMemory32.ResourceLength = 9; 448118611Snjl 449151937Sjkim /* Process all child initialization nodes */ 450151937Sjkim 451118611Snjl for (i = 0; InitializerOp; i++) 452118611Snjl { 453118611Snjl switch (i) 454118611Snjl { 455118611Snjl case 0: /* Read/Write type */ 456118611Snjl 457151937Sjkim RsSetFlagBits (&Descriptor->FixedMemory32.Flags, InitializerOp, 0, 1); 458167802Sjkim RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE, 459151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Flags), 0); 460118611Snjl break; 461118611Snjl 462118611Snjl case 1: /* Address */ 463118611Snjl 464151937Sjkim Descriptor->FixedMemory32.Address = (UINT32) InitializerOp->Asl.Value.Integer; 465167802Sjkim RsCreateByteField (InitializerOp, ACPI_RESTAG_BASEADDRESS, 466151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Address)); 467118611Snjl break; 468118611Snjl 469118611Snjl case 2: /* Length */ 470118611Snjl 471151937Sjkim Descriptor->FixedMemory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer; 472167802Sjkim RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, 473151937Sjkim CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.AddressLength)); 474118611Snjl break; 475118611Snjl 476118611Snjl case 3: /* Name */ 477118611Snjl 478118611Snjl UtAttachNamepathToOwner (Op, InitializerOp); 479118611Snjl break; 480118611Snjl 481118611Snjl default: 482118611Snjl 483118611Snjl AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); 484118611Snjl break; 485118611Snjl } 486118611Snjl 487118611Snjl InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); 488118611Snjl } 489118611Snjl 490118611Snjl return (Rnode); 491118611Snjl} 492118611Snjl 493118611Snjl 494118611Snjl/******************************************************************************* 495118611Snjl * 496118611Snjl * FUNCTION: RsDoStartDependentDescriptor 497118611Snjl * 498118611Snjl * PARAMETERS: Op - Parent resource descriptor parse node 499118611Snjl * CurrentByteOffset - Offset into the resource template AML 500118611Snjl * buffer (to track references to the desc) 501118611Snjl * 502118611Snjl * RETURN: Completed resource node 503118611Snjl * 504118611Snjl * DESCRIPTION: Construct a short "StartDependentFn" descriptor 505118611Snjl * 506118611Snjl ******************************************************************************/ 507118611Snjl 508118611SnjlASL_RESOURCE_NODE * 509118611SnjlRsDoStartDependentDescriptor ( 510118611Snjl ACPI_PARSE_OBJECT *Op, 511118611Snjl UINT32 CurrentByteOffset) 512118611Snjl{ 513151937Sjkim AML_RESOURCE *Descriptor; 514118611Snjl ACPI_PARSE_OBJECT *InitializerOp; 515118611Snjl ASL_RESOURCE_NODE *Rnode; 516118611Snjl ASL_RESOURCE_NODE *PreviousRnode; 517118611Snjl ASL_RESOURCE_NODE *NextRnode; 518118611Snjl UINT32 i; 519118611Snjl UINT8 State; 520118611Snjl 521118611Snjl 522118611Snjl InitializerOp = Op->Asl.Child; 523151937Sjkim Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT)); 524118611Snjl 525118611Snjl PreviousRnode = Rnode; 526118611Snjl Descriptor = Rnode->Buffer; 527118611Snjl 528118611Snjl /* Descriptor has priority byte */ 529118611Snjl 530151937Sjkim Descriptor->StartDpf.DescriptorType = ACPI_RESOURCE_NAME_START_DEPENDENT | 531151937Sjkim (ASL_RDESC_ST_DEPEND_SIZE + 0x01); 532118611Snjl 533151937Sjkim /* Process all child initialization nodes */ 534151937Sjkim 535118611Snjl State = ACPI_RSTATE_START_DEPENDENT; 536118611Snjl for (i = 0; InitializerOp; i++) 537118611Snjl { 538118611Snjl switch (i) 539118611Snjl { 540118611Snjl case 0: /* Compatibility Priority */ 541118611Snjl 542118611Snjl if ((UINT8) InitializerOp->Asl.Value.Integer > 2) 543118611Snjl { 544151937Sjkim AslError (ASL_ERROR, ASL_MSG_INVALID_PRIORITY, 545151937Sjkim InitializerOp, NULL); 546118611Snjl } 547118611Snjl 548151937Sjkim RsSetFlagBits (&Descriptor->StartDpf.Flags, InitializerOp, 0, 0); 549118611Snjl break; 550118611Snjl 551118611Snjl case 1: /* Performance/Robustness Priority */ 552118611Snjl 553118611Snjl if ((UINT8) InitializerOp->Asl.Value.Integer > 2) 554118611Snjl { 555151937Sjkim AslError (ASL_ERROR, ASL_MSG_INVALID_PERFORMANCE, 556151937Sjkim InitializerOp, NULL); 557118611Snjl } 558118611Snjl 559151937Sjkim RsSetFlagBits (&Descriptor->StartDpf.Flags, InitializerOp, 2, 0); 560118611Snjl break; 561118611Snjl 562118611Snjl default: 563207344Sjkim 564151937Sjkim NextRnode = RsDoOneResourceDescriptor (InitializerOp, 565151937Sjkim CurrentByteOffset, &State); 566118611Snjl 567118611Snjl /* 568118611Snjl * Update current byte offset to indicate the number of bytes from the 569118611Snjl * start of the buffer. Buffer can include multiple descriptors, we 570118611Snjl * must keep track of the offset of not only each descriptor, but each 571118611Snjl * element (field) within each descriptor as well. 572118611Snjl */ 573151937Sjkim CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, 574151937Sjkim NextRnode); 575118611Snjl break; 576118611Snjl } 577118611Snjl 578118611Snjl InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); 579118611Snjl } 580118611Snjl 581118611Snjl return (Rnode); 582118611Snjl} 583118611Snjl 584118611Snjl 585118611Snjl/******************************************************************************* 586118611Snjl * 587118611Snjl * FUNCTION: RsDoStartDependentNoPriDescriptor 588118611Snjl * 589118611Snjl * PARAMETERS: Op - Parent resource descriptor parse node 590118611Snjl * CurrentByteOffset - Offset into the resource template AML 591118611Snjl * buffer (to track references to the desc) 592118611Snjl * 593118611Snjl * RETURN: Completed resource node 594118611Snjl * 595118611Snjl * DESCRIPTION: Construct a short "StartDependentNoPri" descriptor 596118611Snjl * 597118611Snjl ******************************************************************************/ 598118611Snjl 599118611SnjlASL_RESOURCE_NODE * 600118611SnjlRsDoStartDependentNoPriDescriptor ( 601118611Snjl ACPI_PARSE_OBJECT *Op, 602118611Snjl UINT32 CurrentByteOffset) 603118611Snjl{ 604151937Sjkim AML_RESOURCE *Descriptor; 605118611Snjl ACPI_PARSE_OBJECT *InitializerOp; 606118611Snjl ASL_RESOURCE_NODE *Rnode; 607118611Snjl ASL_RESOURCE_NODE *PreviousRnode; 608118611Snjl ASL_RESOURCE_NODE *NextRnode; 609118611Snjl UINT8 State; 610118611Snjl 611118611Snjl 612118611Snjl InitializerOp = Op->Asl.Child; 613151937Sjkim Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO)); 614118611Snjl 615118611Snjl Descriptor = Rnode->Buffer; 616151937Sjkim Descriptor->StartDpf.DescriptorType = ACPI_RESOURCE_NAME_START_DEPENDENT | 617151937Sjkim ASL_RDESC_ST_DEPEND_SIZE; 618118611Snjl PreviousRnode = Rnode; 619118611Snjl 620151937Sjkim /* Process all child initialization nodes */ 621151937Sjkim 622118611Snjl State = ACPI_RSTATE_START_DEPENDENT; 623118611Snjl while (InitializerOp) 624118611Snjl { 625151937Sjkim NextRnode = RsDoOneResourceDescriptor (InitializerOp, 626151937Sjkim CurrentByteOffset, &State); 627118611Snjl 628118611Snjl /* 629118611Snjl * Update current byte offset to indicate the number of bytes from the 630118611Snjl * start of the buffer. Buffer can include multiple descriptors, we 631118611Snjl * must keep track of the offset of not only each descriptor, but each 632118611Snjl * element (field) within each descriptor as well. 633118611Snjl */ 634118611Snjl CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, NextRnode); 635118611Snjl 636118611Snjl InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); 637118611Snjl } 638118611Snjl 639118611Snjl return (Rnode); 640118611Snjl} 641118611Snjl 642118611Snjl 643118611Snjl/******************************************************************************* 644118611Snjl * 645118611Snjl * FUNCTION: RsDoVendorSmallDescriptor 646118611Snjl * 647118611Snjl * PARAMETERS: Op - Parent resource descriptor parse node 648118611Snjl * CurrentByteOffset - Offset into the resource template AML 649118611Snjl * buffer (to track references to the desc) 650118611Snjl * 651118611Snjl * RETURN: Completed resource node 652118611Snjl * 653118611Snjl * DESCRIPTION: Construct a short "VendorShort" descriptor 654118611Snjl * 655118611Snjl ******************************************************************************/ 656118611Snjl 657118611SnjlASL_RESOURCE_NODE * 658118611SnjlRsDoVendorSmallDescriptor ( 659118611Snjl ACPI_PARSE_OBJECT *Op, 660118611Snjl UINT32 CurrentByteOffset) 661118611Snjl{ 662151937Sjkim AML_RESOURCE *Descriptor; 663118611Snjl ACPI_PARSE_OBJECT *InitializerOp; 664118611Snjl ASL_RESOURCE_NODE *Rnode; 665151937Sjkim UINT8 *VendorData; 666118611Snjl UINT32 i; 667118611Snjl 668118611Snjl 669118611Snjl InitializerOp = Op->Asl.Child; 670118611Snjl 671151937Sjkim /* Allocate worst case - 7 vendor bytes */ 672151937Sjkim 673151937Sjkim Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_VENDOR_SMALL) + 7); 674151937Sjkim 675118611Snjl Descriptor = Rnode->Buffer; 676151937Sjkim Descriptor->VendorSmall.DescriptorType = ACPI_RESOURCE_NAME_VENDOR_SMALL; 677151937Sjkim VendorData = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_SMALL_HEADER); 678118611Snjl 679151937Sjkim /* Process all child initialization nodes */ 680151937Sjkim 681118611Snjl InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); 682151937Sjkim for (i = 0; InitializerOp; i++) 683118611Snjl { 684167802Sjkim if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) 685167802Sjkim { 686167802Sjkim break; 687167802Sjkim } 688167802Sjkim 689151937Sjkim /* Maximum 7 vendor data bytes allowed (0-6) */ 690151937Sjkim 691151937Sjkim if (i >= 7) 692151937Sjkim { 693151937Sjkim AslError (ASL_ERROR, ASL_MSG_VENDOR_LIST, InitializerOp, NULL); 694151937Sjkim 695151937Sjkim /* Eat the excess initializers */ 696151937Sjkim 697151937Sjkim while (InitializerOp) 698151937Sjkim { 699151937Sjkim InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); 700151937Sjkim } 701151937Sjkim break; 702151937Sjkim } 703151937Sjkim 704151937Sjkim VendorData[i] = (UINT8) InitializerOp->Asl.Value.Integer; 705118611Snjl InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); 706118611Snjl } 707118611Snjl 708118611Snjl /* Adjust the Rnode buffer size, so correct number of bytes are emitted */ 709118611Snjl 710118611Snjl Rnode->BufferLength -= (7 - i); 711118611Snjl 712118611Snjl /* Set the length in the Type Tag */ 713118611Snjl 714151937Sjkim Descriptor->VendorSmall.DescriptorType |= (UINT8) i; 715118611Snjl return (Rnode); 716118611Snjl} 717118611Snjl 718