acdispat.h revision 245582
1300113Sscottl/****************************************************************************** 2300113Sscottl * 3300113Sscottl * Name: acdispat.h - dispatcher (parser to interpreter interface) 4300113Sscottl * 5300113Sscottl *****************************************************************************/ 6300113Sscottl 7300113Sscottl/* 8300113Sscottl * Copyright (C) 2000 - 2013, Intel Corp. 9300113Sscottl * All rights reserved. 10300113Sscottl * 11300113Sscottl * Redistribution and use in source and binary forms, with or without 12300113Sscottl * modification, are permitted provided that the following conditions 13300113Sscottl * are met: 14300113Sscottl * 1. Redistributions of source code must retain the above copyright 15300113Sscottl * notice, this list of conditions, and the following disclaimer, 16300113Sscottl * without modification. 17300113Sscottl * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18300113Sscottl * substantially similar to the "NO WARRANTY" disclaimer below 19300113Sscottl * ("Disclaimer") and any redistribution must be conditioned upon 20300113Sscottl * including a substantially similar Disclaimer requirement for further 21300113Sscottl * binary redistribution. 22300113Sscottl * 3. Neither the names of the above-listed copyright holders nor the names 23300113Sscottl * of any contributors may be used to endorse or promote products derived 24300113Sscottl * from this software without specific prior written permission. 25300113Sscottl * 26300113Sscottl * Alternatively, this software may be distributed under the terms of the 27300113Sscottl * GNU General Public License ("GPL") version 2 as published by the Free 28300113Sscottl * Software Foundation. 29300113Sscottl * 30300113Sscottl * NO WARRANTY 31300113Sscottl * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32300113Sscottl * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33300113Sscottl * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 34300113Sscottl * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35300113Sscottl * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36300113Sscottl * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37300113Sscottl * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38300113Sscottl * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39300113Sscottl * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40300113Sscottl * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41300113Sscottl * POSSIBILITY OF SUCH DAMAGES. 42300113Sscottl */ 43300113Sscottl 44300113Sscottl 45300154Sscottl#ifndef _ACDISPAT_H_ 46300154Sscottl#define _ACDISPAT_H_ 47300113Sscottl 48300113Sscottl 49300113Sscottl#define NAMEOF_LOCAL_NTE "__L0" 50300113Sscottl#define NAMEOF_ARG_NTE "__A0" 51300113Sscottl 52300113Sscottl 53300113Sscottl/* 54300113Sscottl * dsargs - execution of dynamic arguments for static objects 55300113Sscottl */ 56300113SscottlACPI_STATUS 57300113SscottlAcpiDsGetBufferFieldArguments ( 58300113Sscottl ACPI_OPERAND_OBJECT *ObjDesc); 59300113Sscottl 60300113SscottlACPI_STATUS 61300113SscottlAcpiDsGetBankFieldArguments ( 62300113Sscottl ACPI_OPERAND_OBJECT *ObjDesc); 63300113Sscottl 64300113SscottlACPI_STATUS 65300113SscottlAcpiDsGetRegionArguments ( 66300113Sscottl ACPI_OPERAND_OBJECT *RgnDesc); 67300113Sscottl 68300113SscottlACPI_STATUS 69300113SscottlAcpiDsGetBufferArguments ( 70300113Sscottl ACPI_OPERAND_OBJECT *ObjDesc); 71300113Sscottl 72300113SscottlACPI_STATUS 73300113SscottlAcpiDsGetPackageArguments ( 74300113Sscottl ACPI_OPERAND_OBJECT *ObjDesc); 75300113Sscottl 76300113Sscottl 77300113Sscottl/* 78300113Sscottl * dscontrol - support for execution control opcodes 79300113Sscottl */ 80300113SscottlACPI_STATUS 81300113SscottlAcpiDsExecBeginControlOp ( 82300113Sscottl ACPI_WALK_STATE *WalkState, 83300113Sscottl ACPI_PARSE_OBJECT *Op); 84300113Sscottl 85300113SscottlACPI_STATUS 86300113SscottlAcpiDsExecEndControlOp ( 87300113Sscottl ACPI_WALK_STATE *WalkState, 88300113Sscottl ACPI_PARSE_OBJECT *Op); 89300113Sscottl 90300113Sscottl 91300113Sscottl/* 92300113Sscottl * dsopcode - support for late operand evaluation 93300113Sscottl */ 94300113SscottlACPI_STATUS 95300113SscottlAcpiDsEvalBufferFieldOperands ( 96300113Sscottl ACPI_WALK_STATE *WalkState, 97300113Sscottl ACPI_PARSE_OBJECT *Op); 98300113Sscottl 99300113SscottlACPI_STATUS 100344093SmariusAcpiDsEvalRegionOperands ( 101300113Sscottl ACPI_WALK_STATE *WalkState, 102300113Sscottl ACPI_PARSE_OBJECT *Op); 103300113Sscottl 104300113SscottlACPI_STATUS 105300113SscottlAcpiDsEvalTableRegionOperands ( 106300113Sscottl ACPI_WALK_STATE *WalkState, 107300113Sscottl ACPI_PARSE_OBJECT *Op); 108300113Sscottl 109300113SscottlACPI_STATUS 110300113SscottlAcpiDsEvalDataObjectOperands ( 111300113Sscottl ACPI_WALK_STATE *WalkState, 112300113Sscottl ACPI_PARSE_OBJECT *Op, 113300113Sscottl ACPI_OPERAND_OBJECT *ObjDesc); 114300113Sscottl 115300113SscottlACPI_STATUS 116300113SscottlAcpiDsEvalBankFieldOperands ( 117300113Sscottl ACPI_WALK_STATE *WalkState, 118300113Sscottl ACPI_PARSE_OBJECT *Op); 119300113Sscottl 120300113SscottlACPI_STATUS 121300113SscottlAcpiDsInitializeRegion ( 122300113Sscottl ACPI_HANDLE ObjHandle); 123300113Sscottl 124300113Sscottl 125300113Sscottl/* 126300113Sscottl * dsexec - Parser/Interpreter interface, method execution callbacks 127300113Sscottl */ 128300113SscottlACPI_STATUS 129300113SscottlAcpiDsGetPredicateValue ( 130300113Sscottl ACPI_WALK_STATE *WalkState, 131300113Sscottl ACPI_OPERAND_OBJECT *ResultObj); 132300113Sscottl 133300113SscottlACPI_STATUS 134300113SscottlAcpiDsExecBeginOp ( 135300113Sscottl ACPI_WALK_STATE *WalkState, 136300113Sscottl ACPI_PARSE_OBJECT **OutOp); 137300113Sscottl 138300113SscottlACPI_STATUS 139300113SscottlAcpiDsExecEndOp ( 140300113Sscottl ACPI_WALK_STATE *State); 141300113Sscottl 142300113Sscottl 143300113Sscottl/* 144300113Sscottl * dsfield - Parser/Interpreter interface for AML fields 145300113Sscottl */ 146300113SscottlACPI_STATUS 147300113SscottlAcpiDsCreateField ( 148300113Sscottl ACPI_PARSE_OBJECT *Op, 149300113Sscottl ACPI_NAMESPACE_NODE *RegionNode, 150300113Sscottl ACPI_WALK_STATE *WalkState); 151300113Sscottl 152300113SscottlACPI_STATUS 153300113SscottlAcpiDsCreateBankField ( 154300113Sscottl ACPI_PARSE_OBJECT *Op, 155300113Sscottl ACPI_NAMESPACE_NODE *RegionNode, 156300113Sscottl ACPI_WALK_STATE *WalkState); 157300113Sscottl 158300113SscottlACPI_STATUS 159300113SscottlAcpiDsCreateIndexField ( 160300113Sscottl ACPI_PARSE_OBJECT *Op, 161300113Sscottl ACPI_NAMESPACE_NODE *RegionNode, 162300113Sscottl ACPI_WALK_STATE *WalkState); 163300113Sscottl 164300113SscottlACPI_STATUS 165300113SscottlAcpiDsCreateBufferField ( 166300113Sscottl ACPI_PARSE_OBJECT *Op, 167300113Sscottl ACPI_WALK_STATE *WalkState); 168300113Sscottl 169300113SscottlACPI_STATUS 170300113SscottlAcpiDsInitFieldObjects ( 171300113Sscottl ACPI_PARSE_OBJECT *Op, 172300113Sscottl ACPI_WALK_STATE *WalkState); 173300113Sscottl 174300113Sscottl 175300113Sscottl/* 176300113Sscottl * dsload - Parser/Interpreter interface, pass 1 namespace load callbacks 177300113Sscottl */ 178300113SscottlACPI_STATUS 179300113SscottlAcpiDsInitCallbacks ( 180300113Sscottl ACPI_WALK_STATE *WalkState, 181300113Sscottl UINT32 PassNumber); 182300113Sscottl 183300113SscottlACPI_STATUS 184300113SscottlAcpiDsLoad1BeginOp ( 185300113Sscottl ACPI_WALK_STATE *WalkState, 186300113Sscottl ACPI_PARSE_OBJECT **OutOp); 187300113Sscottl 188300113SscottlACPI_STATUS 189300113SscottlAcpiDsLoad1EndOp ( 190300113Sscottl ACPI_WALK_STATE *WalkState); 191300113Sscottl 192300113Sscottl 193300113Sscottl/* 194300113Sscottl * dsload - Parser/Interpreter interface, pass 2 namespace load callbacks 195300113Sscottl */ 196300113SscottlACPI_STATUS 197300113SscottlAcpiDsLoad2BeginOp ( 198300113Sscottl ACPI_WALK_STATE *WalkState, 199300113Sscottl ACPI_PARSE_OBJECT **OutOp); 200300113Sscottl 201300113SscottlACPI_STATUS 202300113SscottlAcpiDsLoad2EndOp ( 203300113Sscottl ACPI_WALK_STATE *WalkState); 204300113Sscottl 205300113Sscottl 206300113Sscottl/* 207300113Sscottl * dsmthdat - method data (locals/args) 208300113Sscottl */ 209300113SscottlACPI_STATUS 210300113SscottlAcpiDsStoreObjectToLocal ( 211300113Sscottl UINT8 Type, 212300113Sscottl UINT32 Index, 213300113Sscottl ACPI_OPERAND_OBJECT *SrcDesc, 214300113Sscottl ACPI_WALK_STATE *WalkState); 215300113Sscottl 216300113SscottlACPI_STATUS 217300113SscottlAcpiDsMethodDataGetEntry ( 218300113Sscottl UINT16 Opcode, 219300113Sscottl UINT32 Index, 220300113Sscottl ACPI_WALK_STATE *WalkState, 221300113Sscottl ACPI_OPERAND_OBJECT ***Node); 222300113Sscottl 223300113Sscottlvoid 224300113SscottlAcpiDsMethodDataDeleteAll ( 225300113Sscottl ACPI_WALK_STATE *WalkState); 226300113Sscottl 227300113SscottlBOOLEAN 228300113SscottlAcpiDsIsMethodValue ( 229300113Sscottl ACPI_OPERAND_OBJECT *ObjDesc); 230300113Sscottl 231300113SscottlACPI_STATUS 232300113SscottlAcpiDsMethodDataGetValue ( 233300113Sscottl UINT8 Type, 234300113Sscottl UINT32 Index, 235300113Sscottl ACPI_WALK_STATE *WalkState, 236300113Sscottl ACPI_OPERAND_OBJECT **DestDesc); 237300113Sscottl 238300113SscottlACPI_STATUS 239300113SscottlAcpiDsMethodDataInitArgs ( 240300113Sscottl ACPI_OPERAND_OBJECT **Params, 241300113Sscottl UINT32 MaxParamCount, 242300113Sscottl ACPI_WALK_STATE *WalkState); 243300113Sscottl 244300113SscottlACPI_STATUS 245300113SscottlAcpiDsMethodDataGetNode ( 246300113Sscottl UINT8 Type, 247300113Sscottl UINT32 Index, 248300113Sscottl ACPI_WALK_STATE *WalkState, 249300113Sscottl ACPI_NAMESPACE_NODE **Node); 250300113Sscottl 251300113Sscottlvoid 252300113SscottlAcpiDsMethodDataInit ( 253300113Sscottl ACPI_WALK_STATE *WalkState); 254300113Sscottl 255300113Sscottl 256300113Sscottl/* 257300113Sscottl * dsmethod - Parser/Interpreter interface - control method parsing 258300113Sscottl */ 259300113SscottlACPI_STATUS 260300113SscottlAcpiDsParseMethod ( 261300113Sscottl ACPI_NAMESPACE_NODE *Node); 262300113Sscottl 263300113SscottlACPI_STATUS 264300113SscottlAcpiDsCallControlMethod ( 265300113Sscottl ACPI_THREAD_STATE *Thread, 266300113Sscottl ACPI_WALK_STATE *WalkState, 267300113Sscottl ACPI_PARSE_OBJECT *Op); 268300113Sscottl 269300113SscottlACPI_STATUS 270300113SscottlAcpiDsRestartControlMethod ( 271300113Sscottl ACPI_WALK_STATE *WalkState, 272300113Sscottl ACPI_OPERAND_OBJECT *ReturnDesc); 273300113Sscottl 274300113Sscottlvoid 275300113SscottlAcpiDsTerminateControlMethod ( 276300113Sscottl ACPI_OPERAND_OBJECT *MethodDesc, 277300113Sscottl ACPI_WALK_STATE *WalkState); 278300113Sscottl 279300113SscottlACPI_STATUS 280300113SscottlAcpiDsBeginMethodExecution ( 281300113Sscottl ACPI_NAMESPACE_NODE *MethodNode, 282300113Sscottl ACPI_OPERAND_OBJECT *ObjDesc, 283300113Sscottl ACPI_WALK_STATE *WalkState); 284300113Sscottl 285300113SscottlACPI_STATUS 286300113SscottlAcpiDsMethodError ( 287300113Sscottl ACPI_STATUS Status, 288300113Sscottl ACPI_WALK_STATE *WalkState); 289300113Sscottl 290344093Smarius/* 291300113Sscottl * dsinit 292300113Sscottl */ 293300113SscottlACPI_STATUS 294300113SscottlAcpiDsInitializeObjects ( 295300113Sscottl UINT32 TableIndex, 296300113Sscottl ACPI_NAMESPACE_NODE *StartNode); 297300113Sscottl 298300113Sscottl 299300113Sscottl/* 300300113Sscottl * dsobject - Parser/Interpreter interface - object initialization and conversion 301300113Sscottl */ 302300113SscottlACPI_STATUS 303300113SscottlAcpiDsBuildInternalBufferObj ( 304300113Sscottl ACPI_WALK_STATE *WalkState, 305300113Sscottl ACPI_PARSE_OBJECT *Op, 306300113Sscottl UINT32 BufferLength, 307300113Sscottl ACPI_OPERAND_OBJECT **ObjDescPtr); 308300113Sscottl 309300113SscottlACPI_STATUS 310300113SscottlAcpiDsBuildInternalPackageObj ( 311300113Sscottl ACPI_WALK_STATE *WalkState, 312300113Sscottl ACPI_PARSE_OBJECT *op, 313300113Sscottl UINT32 PackageLength, 314300113Sscottl ACPI_OPERAND_OBJECT **ObjDesc); 315300113Sscottl 316300113SscottlACPI_STATUS 317300113SscottlAcpiDsInitObjectFromOp ( 318300113Sscottl ACPI_WALK_STATE *WalkState, 319300113Sscottl ACPI_PARSE_OBJECT *Op, 320300113Sscottl UINT16 Opcode, 321300113Sscottl ACPI_OPERAND_OBJECT **ObjDesc); 322300113Sscottl 323300113SscottlACPI_STATUS 324344093SmariusAcpiDsCreateNode ( 325300113Sscottl ACPI_WALK_STATE *WalkState, 326300113Sscottl ACPI_NAMESPACE_NODE *Node, 327300113Sscottl ACPI_PARSE_OBJECT *Op); 328300113Sscottl 329300113Sscottl 330300113Sscottl/* 331300113Sscottl * dsutils - Parser/Interpreter interface utility routines 332300113Sscottl */ 333300113Sscottlvoid 334300113SscottlAcpiDsClearImplicitReturn ( 335300113Sscottl ACPI_WALK_STATE *WalkState); 336300113Sscottl 337300113SscottlBOOLEAN 338300113SscottlAcpiDsDoImplicitReturn ( 339300113Sscottl ACPI_OPERAND_OBJECT *ReturnDesc, 340300113Sscottl ACPI_WALK_STATE *WalkState, 341300113Sscottl BOOLEAN AddReference); 342300113Sscottl 343300113SscottlBOOLEAN 344344093SmariusAcpiDsIsResultUsed ( 345300113Sscottl ACPI_PARSE_OBJECT *Op, 346300113Sscottl ACPI_WALK_STATE *WalkState); 347300113Sscottl 348300113Sscottlvoid 349300113SscottlAcpiDsDeleteResultIfNotUsed ( 350300113Sscottl ACPI_PARSE_OBJECT *Op, 351300113Sscottl ACPI_OPERAND_OBJECT *ResultObj, 352300113Sscottl ACPI_WALK_STATE *WalkState); 353300113Sscottl 354300113SscottlACPI_STATUS 355300113SscottlAcpiDsCreateOperand ( 356300113Sscottl ACPI_WALK_STATE *WalkState, 357300113Sscottl ACPI_PARSE_OBJECT *Arg, 358300215Spfg UINT32 ArgsRemaining); 359300113Sscottl 360300113SscottlACPI_STATUS 361300113SscottlAcpiDsCreateOperands ( 362300113Sscottl ACPI_WALK_STATE *WalkState, 363300113Sscottl ACPI_PARSE_OBJECT *FirstArg); 364300113Sscottl 365300113SscottlACPI_STATUS 366300113SscottlAcpiDsResolveOperands ( 367300113Sscottl ACPI_WALK_STATE *WalkState); 368300113Sscottl 369300113Sscottlvoid 370300113SscottlAcpiDsClearOperands ( 371300113Sscottl ACPI_WALK_STATE *WalkState); 372300113Sscottl 373300113SscottlACPI_STATUS 374300113SscottlAcpiDsEvaluateNamePath ( 375300113Sscottl ACPI_WALK_STATE *WalkState); 376300113Sscottl 377300113Sscottl 378300113Sscottl/* 379300113Sscottl * dswscope - Scope Stack manipulation 380300113Sscottl */ 381300113SscottlACPI_STATUS 382300113SscottlAcpiDsScopeStackPush ( 383300113Sscottl ACPI_NAMESPACE_NODE *Node, 384300113Sscottl ACPI_OBJECT_TYPE Type, 385300113Sscottl ACPI_WALK_STATE *WalkState); 386300113Sscottl 387300113Sscottl 388300113SscottlACPI_STATUS 389300113SscottlAcpiDsScopeStackPop ( 390300113Sscottl ACPI_WALK_STATE *WalkState); 391300113Sscottl 392300113Sscottlvoid 393300113SscottlAcpiDsScopeStackClear ( 394300113Sscottl ACPI_WALK_STATE *WalkState); 395300113Sscottl 396300113Sscottl 397300113Sscottl/* 398300113Sscottl * dswstate - parser WALK_STATE management routines 399300113Sscottl */ 400300113SscottlACPI_STATUS 401300113SscottlAcpiDsObjStackPush ( 402300113Sscottl void *Object, 403300113Sscottl ACPI_WALK_STATE *WalkState); 404300113Sscottl 405300113SscottlACPI_STATUS 406300113SscottlAcpiDsObjStackPop ( 407300113Sscottl UINT32 PopCount, 408300113Sscottl ACPI_WALK_STATE *WalkState); 409300113Sscottl 410300113SscottlACPI_WALK_STATE * 411300113SscottlAcpiDsCreateWalkState ( 412300113Sscottl ACPI_OWNER_ID OwnerId, 413300113Sscottl ACPI_PARSE_OBJECT *Origin, 414300113Sscottl ACPI_OPERAND_OBJECT *MthDesc, 415300113Sscottl ACPI_THREAD_STATE *Thread); 416300113Sscottl 417300113SscottlACPI_STATUS 418300113SscottlAcpiDsInitAmlWalk ( 419300113Sscottl ACPI_WALK_STATE *WalkState, 420300113Sscottl ACPI_PARSE_OBJECT *Op, 421300113Sscottl ACPI_NAMESPACE_NODE *MethodNode, 422300113Sscottl UINT8 *AmlStart, 423300113Sscottl UINT32 AmlLength, 424300113Sscottl ACPI_EVALUATE_INFO *Info, 425300113Sscottl UINT8 PassNumber); 426300113Sscottl 427300113Sscottlvoid 428300113SscottlAcpiDsObjStackPopAndDelete ( 429300113Sscottl UINT32 PopCount, 430300113Sscottl ACPI_WALK_STATE *WalkState); 431300113Sscottl 432300215Spfgvoid 433300113SscottlAcpiDsDeleteWalkState ( 434300113Sscottl ACPI_WALK_STATE *WalkState); 435300113Sscottl 436300113SscottlACPI_WALK_STATE * 437300113SscottlAcpiDsPopWalkState ( 438300113Sscottl ACPI_THREAD_STATE *Thread); 439300113Sscottl 440300113Sscottlvoid 441300113SscottlAcpiDsPushWalkState ( 442300113Sscottl ACPI_WALK_STATE *WalkState, 443300113Sscottl ACPI_THREAD_STATE *Thread); 444300113Sscottl 445300113SscottlACPI_STATUS 446300113SscottlAcpiDsResultStackClear ( 447300113Sscottl ACPI_WALK_STATE *WalkState); 448300113Sscottl 449300113SscottlACPI_WALK_STATE * 450300113SscottlAcpiDsGetCurrentWalkState ( 451300113Sscottl ACPI_THREAD_STATE *Thread); 452300113Sscottl 453300113SscottlACPI_STATUS 454333338SshurdAcpiDsResultPop ( 455333338Sshurd ACPI_OPERAND_OBJECT **Object, 456300113Sscottl ACPI_WALK_STATE *WalkState); 457300113Sscottl 458300113SscottlACPI_STATUS 459300113SscottlAcpiDsResultPush ( 460300113Sscottl ACPI_OPERAND_OBJECT *Object, 461300113Sscottl ACPI_WALK_STATE *WalkState); 462300113Sscottl 463300113Sscottl#endif /* _ACDISPAT_H_ */ 464300113Sscottl