acinterp.h revision 69746
1/****************************************************************************** 2 * 3 * Name: acinterp.h - Interpreter subcomponent prototypes and defines 4 * $Revision: 86 $ 5 * 6 *****************************************************************************/ 7 8/****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * 12 * Some or all of this work - Copyright (c) 1999, Intel Corp. All rights 13 * reserved. 14 * 15 * 2. License 16 * 17 * 2.1. This is your license from Intel Corp. under its intellectual property 18 * rights. You may have additional license terms from the party that provided 19 * you this software, covering your right to use that party's intellectual 20 * property rights. 21 * 22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 23 * copy of the source code appearing in this file ("Covered Code") an 24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 25 * base code distributed originally by Intel ("Original Intel Code") to copy, 26 * make derivatives, distribute, use and display any portion of the Covered 27 * Code in any form, with the right to sublicense such rights; and 28 * 29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 30 * license (with the right to sublicense), under only those claims of Intel 31 * patents that are infringed by the Original Intel Code, to make, use, sell, 32 * offer to sell, and import the Covered Code and derivative works thereof 33 * solely to the minimum extent necessary to exercise the above copyright 34 * license, and in no event shall the patent license extend to any additions 35 * to or modifications of the Original Intel Code. No other license or right 36 * is granted directly or by implication, estoppel or otherwise; 37 * 38 * The above copyright and patent license is granted only if the following 39 * conditions are met: 40 * 41 * 3. Conditions 42 * 43 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 44 * Redistribution of source code of any substantial portion of the Covered 45 * Code or modification with rights to further distribute source must include 46 * the above Copyright Notice, the above License, this list of Conditions, 47 * and the following Disclaimer and Export Compliance provision. In addition, 48 * Licensee must cause all Covered Code to which Licensee contributes to 49 * contain a file documenting the changes Licensee made to create that Covered 50 * Code and the date of any change. Licensee must include in that file the 51 * documentation of any changes made by any predecessor Licensee. Licensee 52 * must include a prominent statement that the modification is derived, 53 * directly or indirectly, from Original Intel Code. 54 * 55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 56 * Redistribution of source code of any substantial portion of the Covered 57 * Code or modification without rights to further distribute source must 58 * include the following Disclaimer and Export Compliance provision in the 59 * documentation and/or other materials provided with distribution. In 60 * addition, Licensee may not authorize further sublicense of source of any 61 * portion of the Covered Code, and must include terms to the effect that the 62 * license from Licensee to its licensee is limited to the intellectual 63 * property embodied in the software Licensee provides to its licensee, and 64 * not to intellectual property embodied in modifications its licensee may 65 * make. 66 * 67 * 3.3. Redistribution of Executable. Redistribution in executable form of any 68 * substantial portion of the Covered Code or modification must reproduce the 69 * above Copyright Notice, and the following Disclaimer and Export Compliance 70 * provision in the documentation and/or other materials provided with the 71 * distribution. 72 * 73 * 3.4. Intel retains all right, title, and interest in and to the Original 74 * Intel Code. 75 * 76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 77 * Intel shall be used in advertising or otherwise to promote the sale, use or 78 * other dealings in products derived from or relating to the Covered Code 79 * without prior written authorization from Intel. 80 * 81 * 4. Disclaimer and Export Compliance 82 * 83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 84 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 86 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 87 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 88 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 89 * PARTICULAR PURPOSE. 90 * 91 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 92 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 93 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 94 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 95 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 96 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 97 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 98 * LIMITED REMEDY. 99 * 100 * 4.3. Licensee shall not export, either directly or indirectly, any of this 101 * software or system incorporating such software without first obtaining any 102 * required license or other approval from the U. S. Department of Commerce or 103 * any other agency or department of the United States Government. In the 104 * event Licensee exports any such software from the United States or 105 * re-exports any such software from a foreign destination, Licensee shall 106 * ensure that the distribution and export/re-export of the software is in 107 * compliance with all laws, regulations, orders, or other restrictions of the 108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 109 * any of its subsidiaries will export/re-export any technical data, process, 110 * software, or service, directly or indirectly, to any country for which the 111 * United States government or any agency thereof requires an export license, 112 * other governmental approval, or letter of assurance, without first obtaining 113 * such license, approval or letter. 114 * 115 *****************************************************************************/ 116 117#ifndef __ACINTERP_H__ 118#define __ACINTERP_H__ 119 120 121#define WALK_OPERANDS &(WalkState->Operands [WalkState->NumOperands -1]) 122 123 124/* Interpreter constants */ 125 126#define AML_END_OF_BLOCK -1 127#define PUSH_PKG_LENGTH 1 128#define DO_NOT_PUSH_PKG_LENGTH 0 129 130 131#define STACK_TOP 0 132#define STACK_BOTTOM (UINT32) -1 133 134/* Constants for global "WhenToParseMethods" */ 135 136#define METHOD_PARSE_AT_INIT 0x0 137#define METHOD_PARSE_JUST_IN_TIME 0x1 138#define METHOD_DELETE_AT_COMPLETION 0x2 139 140 141ACPI_STATUS 142AcpiAmlResolveOperands ( 143 UINT16 Opcode, 144 ACPI_OPERAND_OBJECT **StackPtr, 145 ACPI_WALK_STATE *WalkState); 146 147 148/* 149 * amxface - External interpreter interfaces 150 */ 151 152ACPI_STATUS 153AcpiAmlLoadTable ( 154 ACPI_TABLE_TYPE TableId); 155 156ACPI_STATUS 157AcpiAmlExecuteMethod ( 158 ACPI_NAMESPACE_NODE *MethodNode, 159 ACPI_OPERAND_OBJECT **Params, 160 ACPI_OPERAND_OBJECT **ReturnObjDesc); 161 162 163/* 164 * amfield - ACPI AML (p-code) execution - field manipulation 165 */ 166 167 168ACPI_STATUS 169AcpiAmlReadField ( 170 ACPI_OPERAND_OBJECT *ObjDesc, 171 void *Buffer, 172 UINT32 BufferLength, 173 UINT32 ByteLength, 174 UINT32 DatumLength, 175 UINT32 BitGranularity, 176 UINT32 ByteGranularity); 177 178ACPI_STATUS 179AcpiAmlWriteField ( 180 ACPI_OPERAND_OBJECT *ObjDesc, 181 void *Buffer, 182 UINT32 BufferLength, 183 UINT32 ByteLength, 184 UINT32 DatumLength, 185 UINT32 BitGranularity, 186 UINT32 ByteGranularity); 187 188ACPI_STATUS 189AcpiAmlSetupField ( 190 ACPI_OPERAND_OBJECT *ObjDesc, 191 ACPI_OPERAND_OBJECT *RgnDesc, 192 UINT32 FieldBitWidth); 193 194ACPI_STATUS 195AcpiAmlReadFieldData ( 196 ACPI_OPERAND_OBJECT *ObjDesc, 197 UINT32 FieldByteOffset, 198 UINT32 FieldBitWidth, 199 UINT32 *Value); 200 201ACPI_STATUS 202AcpiAmlAccessNamedField ( 203 UINT32 Mode, 204 ACPI_HANDLE NamedField, 205 void *Buffer, 206 UINT32 Length); 207 208/* 209 * ammisc - ACPI AML (p-code) execution - specific opcodes 210 */ 211 212ACPI_STATUS 213AcpiAmlExecCreateField ( 214 UINT8 *AmlPtr, 215 UINT32 AmlLength, 216 ACPI_NAMESPACE_NODE *Node, 217 ACPI_WALK_STATE *WalkState); 218 219ACPI_STATUS 220AcpiAmlExecReconfiguration ( 221 UINT16 Opcode, 222 ACPI_WALK_STATE *WalkState); 223 224ACPI_STATUS 225AcpiAmlExecFatal ( 226 ACPI_WALK_STATE *WalkState); 227 228ACPI_STATUS 229AcpiAmlExecIndex ( 230 ACPI_WALK_STATE *WalkState, 231 ACPI_OPERAND_OBJECT **ReturnDesc); 232 233ACPI_STATUS 234AcpiAmlExecMatch ( 235 ACPI_WALK_STATE *WalkState, 236 ACPI_OPERAND_OBJECT **ReturnDesc); 237 238ACPI_STATUS 239AcpiAmlExecCreateMutex ( 240 ACPI_WALK_STATE *WalkState); 241 242ACPI_STATUS 243AcpiAmlExecCreateProcessor ( 244 ACPI_PARSE_OBJECT *Op, 245 ACPI_HANDLE ProcessorNTE); 246 247ACPI_STATUS 248AcpiAmlExecCreatePowerResource ( 249 ACPI_PARSE_OBJECT *Op, 250 ACPI_HANDLE ProcessorNTE); 251 252ACPI_STATUS 253AcpiAmlExecCreateRegion ( 254 UINT8 *AmlPtr, 255 UINT32 AcpiAmlLength, 256 UINT8 RegionSpace, 257 ACPI_WALK_STATE *WalkState); 258 259ACPI_STATUS 260AcpiAmlExecCreateEvent ( 261 ACPI_WALK_STATE *WalkState); 262 263ACPI_STATUS 264AcpiAmlExecCreateAlias ( 265 ACPI_WALK_STATE *WalkState); 266 267ACPI_STATUS 268AcpiAmlExecCreateMethod ( 269 UINT8 *AmlPtr, 270 UINT32 AcpiAmlLength, 271 UINT32 MethodFlags, 272 ACPI_HANDLE Method); 273 274 275/* 276 * amprep - ACPI AML (p-code) execution - prep utilities 277 */ 278 279ACPI_STATUS 280AcpiAmlPrepDefFieldValue ( 281 ACPI_NAMESPACE_NODE *Node, 282 ACPI_HANDLE Region, 283 UINT8 FieldFlags, 284 UINT8 FieldAttribute, 285 UINT32 FieldPosition, 286 UINT32 FieldLength); 287 288ACPI_STATUS 289AcpiAmlPrepBankFieldValue ( 290 ACPI_NAMESPACE_NODE *Node, 291 ACPI_HANDLE Region, 292 ACPI_HANDLE BankReg, 293 UINT32 BankVal, 294 UINT8 FieldFlags, 295 UINT8 FieldAttribute, 296 UINT32 FieldPosition, 297 UINT32 FieldLength); 298 299ACPI_STATUS 300AcpiAmlPrepIndexFieldValue ( 301 ACPI_NAMESPACE_NODE *Node, 302 ACPI_HANDLE IndexReg, 303 ACPI_HANDLE DataReg, 304 UINT8 FieldFlags, 305 UINT8 FieldAttribute, 306 UINT32 FieldPosition, 307 UINT32 FieldLength); 308 309 310/* 311 * amsystem - Interface to OS services 312 */ 313 314UINT16 315AcpiAmlSystemThreadId ( 316 void); 317 318ACPI_STATUS 319AcpiAmlSystemDoNotifyOp ( 320 ACPI_OPERAND_OBJECT *Value, 321 ACPI_OPERAND_OBJECT *ObjDesc); 322 323void 324AcpiAmlSystemDoSuspend( 325 UINT32 Time); 326 327void 328AcpiAmlSystemDoStall ( 329 UINT32 Time); 330 331ACPI_STATUS 332AcpiAmlSystemAcquireMutex( 333 ACPI_OPERAND_OBJECT *Time, 334 ACPI_OPERAND_OBJECT *ObjDesc); 335 336ACPI_STATUS 337AcpiAmlSystemReleaseMutex( 338 ACPI_OPERAND_OBJECT *ObjDesc); 339 340ACPI_STATUS 341AcpiAmlSystemSignalEvent( 342 ACPI_OPERAND_OBJECT *ObjDesc); 343 344ACPI_STATUS 345AcpiAmlSystemWaitEvent( 346 ACPI_OPERAND_OBJECT *Time, 347 ACPI_OPERAND_OBJECT *ObjDesc); 348 349ACPI_STATUS 350AcpiAmlSystemResetEvent( 351 ACPI_OPERAND_OBJECT *ObjDesc); 352 353ACPI_STATUS 354AcpiAmlSystemWaitSemaphore ( 355 ACPI_HANDLE Semaphore, 356 UINT32 Timeout); 357 358 359/* 360 * ammonadic - ACPI AML (p-code) execution, monadic operators 361 */ 362 363ACPI_STATUS 364AcpiAmlExecMonadic1 ( 365 UINT16 Opcode, 366 ACPI_WALK_STATE *WalkState); 367 368ACPI_STATUS 369AcpiAmlExecMonadic2 ( 370 UINT16 Opcode, 371 ACPI_WALK_STATE *WalkState, 372 ACPI_OPERAND_OBJECT **ReturnDesc); 373 374ACPI_STATUS 375AcpiAmlExecMonadic2R ( 376 UINT16 Opcode, 377 ACPI_WALK_STATE *WalkState, 378 ACPI_OPERAND_OBJECT **ReturnDesc); 379 380 381/* 382 * amdyadic - ACPI AML (p-code) execution, dyadic operators 383 */ 384 385ACPI_STATUS 386AcpiAmlExecDyadic1 ( 387 UINT16 Opcode, 388 ACPI_WALK_STATE *WalkState); 389 390ACPI_STATUS 391AcpiAmlExecDyadic2 ( 392 UINT16 Opcode, 393 ACPI_WALK_STATE *WalkState, 394 ACPI_OPERAND_OBJECT **ReturnDesc); 395 396ACPI_STATUS 397AcpiAmlExecDyadic2R ( 398 UINT16 Opcode, 399 ACPI_WALK_STATE *WalkState, 400 ACPI_OPERAND_OBJECT **ReturnDesc); 401 402ACPI_STATUS 403AcpiAmlExecDyadic2S ( 404 UINT16 Opcode, 405 ACPI_WALK_STATE *WalkState, 406 ACPI_OPERAND_OBJECT **ReturnDesc); 407 408 409/* 410 * amresolv - Object resolution and get value functions 411 */ 412 413ACPI_STATUS 414AcpiAmlResolveToValue ( 415 ACPI_OPERAND_OBJECT **StackPtr, 416 ACPI_WALK_STATE *WalkState); 417 418ACPI_STATUS 419AcpiAmlResolveNodeToValue ( 420 ACPI_NAMESPACE_NODE **StackPtr, 421 ACPI_WALK_STATE *WalkState); 422 423ACPI_STATUS 424AcpiAmlResolveObjectToValue ( 425 ACPI_OPERAND_OBJECT **StackPtr, 426 ACPI_WALK_STATE *WalkState); 427 428ACPI_STATUS 429AcpiAmlGetFieldUnitValue ( 430 ACPI_OPERAND_OBJECT *FieldDesc, 431 ACPI_OPERAND_OBJECT *ResultDesc); 432 433 434/* 435 * amdump - Scanner debug output routines 436 */ 437 438void 439AcpiAmlShowHexValue ( 440 UINT32 ByteCount, 441 UINT8 *AmlPtr, 442 UINT32 LeadSpace); 443 444 445ACPI_STATUS 446AcpiAmlDumpOperand ( 447 ACPI_OPERAND_OBJECT *EntryDesc); 448 449void 450AcpiAmlDumpOperands ( 451 ACPI_OPERAND_OBJECT **Operands, 452 OPERATING_MODE InterpreterMode, 453 NATIVE_CHAR *Ident, 454 UINT32 NumLevels, 455 NATIVE_CHAR *Note, 456 NATIVE_CHAR *ModuleName, 457 UINT32 LineNumber); 458 459void 460AcpiAmlDumpObjectDescriptor ( 461 ACPI_OPERAND_OBJECT *Object, 462 UINT32 Flags); 463 464 465void 466AcpiAmlDumpNode ( 467 ACPI_NAMESPACE_NODE *Node, 468 UINT32 Flags); 469 470 471/* 472 * amnames - interpreter/scanner name load/execute 473 */ 474 475NATIVE_CHAR * 476AcpiAmlAllocateNameString ( 477 UINT32 PrefixCount, 478 UINT32 NumNameSegs); 479 480UINT32 481AcpiAmlGoodChar ( 482 UINT32 Character); 483 484ACPI_STATUS 485AcpiAmlExecNameSegment ( 486 UINT8 **InAmlAddress, 487 NATIVE_CHAR *NameString); 488 489ACPI_STATUS 490AcpiAmlGetNameString ( 491 OBJECT_TYPE_INTERNAL DataType, 492 UINT8 *InAmlAddress, 493 NATIVE_CHAR **OutNameString, 494 UINT32 *OutNameLength); 495 496ACPI_STATUS 497AcpiAmlDoName ( 498 ACPI_OBJECT_TYPE DataType, 499 OPERATING_MODE LoadExecMode); 500 501 502/* 503 * amstore - Object store support 504 */ 505 506ACPI_STATUS 507AcpiAmlExecStore ( 508 ACPI_OPERAND_OBJECT *ValDesc, 509 ACPI_OPERAND_OBJECT *DestDesc, 510 ACPI_WALK_STATE *WalkState); 511 512ACPI_STATUS 513AcpiAmlStoreObjectToObject ( 514 ACPI_OPERAND_OBJECT *ValDesc, 515 ACPI_OPERAND_OBJECT *DestDesc, 516 ACPI_WALK_STATE *WalkState); 517 518ACPI_STATUS 519AcpiAmlStoreObjectToNode ( 520 ACPI_OPERAND_OBJECT *ValDesc, 521 ACPI_NAMESPACE_NODE *Node, 522 ACPI_WALK_STATE *WalkState); 523 524 525/* 526 * amutils - interpreter/scanner utilities 527 */ 528 529void 530AcpiAmlEnterInterpreter ( 531 void); 532 533void 534AcpiAmlExitInterpreter ( 535 void); 536 537void 538AcpiAmlTruncateFor32bitTable ( 539 ACPI_OPERAND_OBJECT *ObjDesc, 540 ACPI_WALK_STATE *WalkState); 541 542BOOLEAN 543AcpiAmlValidateObjectType ( 544 ACPI_OBJECT_TYPE Type); 545 546BOOLEAN 547AcpiAmlAcquireGlobalLock ( 548 UINT32 Rule); 549 550ACPI_STATUS 551AcpiAmlReleaseGlobalLock ( 552 BOOLEAN Locked); 553 554UINT32 555AcpiAmlDigitsNeeded ( 556 ACPI_INTEGER Value, 557 UINT32 Base); 558 559ACPI_STATUS 560AcpiAmlEisaIdToString ( 561 UINT32 NumericId, 562 NATIVE_CHAR *OutString); 563 564ACPI_STATUS 565AcpiAmlUnsignedIntegerToString ( 566 ACPI_INTEGER Value, 567 NATIVE_CHAR *OutString); 568 569ACPI_STATUS 570AcpiAmlBuildCopyInternalPackageObject ( 571 ACPI_OPERAND_OBJECT *SourceObj, 572 ACPI_OPERAND_OBJECT *DestObj, 573 ACPI_WALK_STATE *WalkState); 574 575 576/* 577 * amregion - default OpRegion handlers 578 */ 579 580ACPI_STATUS 581AcpiAmlSystemMemorySpaceHandler ( 582 UINT32 Function, 583 ACPI_PHYSICAL_ADDRESS Address, 584 UINT32 BitWidth, 585 UINT32 *Value, 586 void *HandlerContext, 587 void *RegionContext); 588 589ACPI_STATUS 590AcpiAmlSystemIoSpaceHandler ( 591 UINT32 Function, 592 ACPI_PHYSICAL_ADDRESS Address, 593 UINT32 BitWidth, 594 UINT32 *Value, 595 void *HandlerContext, 596 void *RegionContext); 597 598ACPI_STATUS 599AcpiAmlPciConfigSpaceHandler ( 600 UINT32 Function, 601 ACPI_PHYSICAL_ADDRESS Address, 602 UINT32 BitWidth, 603 UINT32 *Value, 604 void *HandlerContext, 605 void *RegionContext); 606 607ACPI_STATUS 608AcpiAmlEmbeddedControllerSpaceHandler ( 609 UINT32 Function, 610 ACPI_PHYSICAL_ADDRESS Address, 611 UINT32 BitWidth, 612 UINT32 *Value, 613 void *HandlerContext, 614 void *RegionContext); 615 616ACPI_STATUS 617AcpiAmlSmBusSpaceHandler ( 618 UINT32 Function, 619 ACPI_PHYSICAL_ADDRESS Address, 620 UINT32 BitWidth, 621 UINT32 *Value, 622 void *HandlerContext, 623 void *RegionContext); 624 625 626#endif /* __INTERP_H__ */ 627