1 /****************************************************************************** 2 * 3 * Name: aclocal.h - Internal data types used across the ACPI subsystem 4 * 5 *****************************************************************************/ 6 7 /* 8 * Copyright (C) 2000 - 2015, Intel Corp. 9 * All rights reserved. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions, and the following disclaimer, 16 * without modification. 17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18 * substantially similar to the "NO WARRANTY" disclaimer below 19 * ("Disclaimer") and any redistribution must be conditioned upon 20 * including a substantially similar Disclaimer requirement for further 21 * binary redistribution. 22 * 3. Neither the names of the above-listed copyright holders nor the names 23 * of any contributors may be used to endorse or promote products derived 24 * from this software without specific prior written permission. 25 * 26 * Alternatively, this software may be distributed under the terms of the 27 * GNU General Public License ("GPL") version 2 as published by the Free 28 * Software Foundation. 29 * 30 * NO WARRANTY 31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41 * POSSIBILITY OF SUCH DAMAGES. 42 */ 43 44 #ifndef __ACLOCAL_H__ 45 #define __ACLOCAL_H__ 46 47 48 /* acpisrc:StructDefs -- for acpisrc conversion */ 49 50 #define ACPI_SERIALIZED 0xFF 51 52 typedef UINT32 ACPI_MUTEX_HANDLE; 53 #define ACPI_GLOBAL_LOCK (ACPI_SEMAPHORE) (-1) 54 55 /* Total number of aml opcodes defined */ 56 57 #define AML_NUM_OPCODES 0x82 58 59 60 /* Forward declarations */ 61 62 struct acpi_walk_state; 63 struct acpi_obj_mutex; 64 union acpi_parse_object; 65 66 67 /***************************************************************************** 68 * 69 * Mutex typedefs and structs 70 * 71 ****************************************************************************/ 72 73 74 /* 75 * Predefined handles for the mutex objects used within the subsystem 76 * All mutex objects are automatically created by AcpiUtMutexInitialize. 77 * 78 * The acquire/release ordering protocol is implied via this list. Mutexes 79 * with a lower value must be acquired before mutexes with a higher value. 80 * 81 * NOTE: any changes here must be reflected in the AcpiGbl_MutexNames 82 * table below also! 83 */ 84 #define ACPI_MTX_INTERPRETER 0 /* AML Interpreter, main lock */ 85 #define ACPI_MTX_NAMESPACE 1 /* ACPI Namespace */ 86 #define ACPI_MTX_TABLES 2 /* Data for ACPI tables */ 87 #define ACPI_MTX_EVENTS 3 /* Data for ACPI events */ 88 #define ACPI_MTX_CACHES 4 /* Internal caches, general purposes */ 89 #define ACPI_MTX_MEMORY 5 /* Debug memory tracking lists */ 90 #define ACPI_MTX_DEBUG_CMD_COMPLETE 6 /* AML debugger */ 91 #define ACPI_MTX_DEBUG_CMD_READY 7 /* AML debugger */ 92 93 #define ACPI_MAX_MUTEX 7 94 #define ACPI_NUM_MUTEX ACPI_MAX_MUTEX+1 95 96 97 /* Lock structure for reader/writer interfaces */ 98 99 typedef struct acpi_rw_lock 100 { 101 ACPI_MUTEX WriterMutex; 102 ACPI_MUTEX ReaderMutex; 103 UINT32 NumReaders; 104 105 } ACPI_RW_LOCK; 106 107 108 /* 109 * Predefined handles for spinlocks used within the subsystem. 110 * These spinlocks are created by AcpiUtMutexInitialize 111 */ 112 #define ACPI_LOCK_GPES 0 113 #define ACPI_LOCK_HARDWARE 1 114 115 #define ACPI_MAX_LOCK 1 116 #define ACPI_NUM_LOCK ACPI_MAX_LOCK+1 117 118 119 /* This Thread ID means that the mutex is not in use (unlocked) */ 120 121 #define ACPI_MUTEX_NOT_ACQUIRED (ACPI_THREAD_ID) -1 122 123 /* Table for the global mutexes */ 124 125 typedef struct acpi_mutex_info 126 { 127 ACPI_MUTEX Mutex; 128 UINT32 UseCount; 129 ACPI_THREAD_ID ThreadId; 130 131 } ACPI_MUTEX_INFO; 132 133 134 /* Lock flag parameter for various interfaces */ 135 136 #define ACPI_MTX_DO_NOT_LOCK 0 137 #define ACPI_MTX_LOCK 1 138 139 140 /* Field access granularities */ 141 142 #define ACPI_FIELD_BYTE_GRANULARITY 1 143 #define ACPI_FIELD_WORD_GRANULARITY 2 144 #define ACPI_FIELD_DWORD_GRANULARITY 4 145 #define ACPI_FIELD_QWORD_GRANULARITY 8 146 147 148 #define ACPI_ENTRY_NOT_FOUND NULL 149 150 151 /***************************************************************************** 152 * 153 * Namespace typedefs and structs 154 * 155 ****************************************************************************/ 156 157 /* Operational modes of the AML interpreter/scanner */ 158 159 typedef enum 160 { 161 ACPI_IMODE_LOAD_PASS1 = 0x01, 162 ACPI_IMODE_LOAD_PASS2 = 0x02, 163 ACPI_IMODE_EXECUTE = 0x03 164 165 } ACPI_INTERPRETER_MODE; 166 167 168 /* 169 * The Namespace Node describes a named object that appears in the AML. 170 * DescriptorType is used to differentiate between internal descriptors. 171 * 172 * The node is optimized for both 32-bit and 64-bit platforms: 173 * 20 bytes for the 32-bit case, 32 bytes for the 64-bit case. 174 * 175 * Note: The DescriptorType and Type fields must appear in the identical 176 * position in both the ACPI_NAMESPACE_NODE and ACPI_OPERAND_OBJECT 177 * structures. 178 */ 179 typedef struct acpi_namespace_node 180 { 181 union acpi_operand_object *Object; /* Interpreter object */ 182 UINT8 DescriptorType; /* Differentiate object descriptor types */ 183 UINT8 Type; /* ACPI Type associated with this name */ 184 UINT8 Flags; /* Miscellaneous flags */ 185 ACPI_OWNER_ID OwnerId; /* Node creator */ 186 ACPI_NAME_UNION Name; /* ACPI Name, always 4 chars per ACPI spec */ 187 struct acpi_namespace_node *Parent; /* Parent node */ 188 struct acpi_namespace_node *Child; /* First child */ 189 struct acpi_namespace_node *Peer; /* First peer */ 190 191 /* 192 * The following fields are used by the ASL compiler and disassembler only 193 */ 194 #ifdef ACPI_LARGE_NAMESPACE_NODE 195 union acpi_parse_object *Op; 196 void *MethodLocals; 197 void *MethodArgs; 198 UINT32 Value; 199 UINT32 Length; 200 UINT8 ArgCount; 201 202 #endif 203 204 } ACPI_NAMESPACE_NODE; 205 206 207 /* Namespace Node flags */ 208 209 #define ANOBJ_RESERVED 0x01 /* Available for use */ 210 #define ANOBJ_TEMPORARY 0x02 /* Node is create by a method and is temporary */ 211 #define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */ 212 #define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */ 213 #define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */ 214 #define ANOBJ_EVALUATED 0x20 /* Set on first evaluation of node */ 215 #define ANOBJ_ALLOCATED_BUFFER 0x40 /* Method AML buffer is dynamic (InstallMethod) */ 216 217 #define ANOBJ_IS_EXTERNAL 0x08 /* iASL only: This object created via External() */ 218 #define ANOBJ_METHOD_NO_RETVAL 0x10 /* iASL only: Method has no return value */ 219 #define ANOBJ_METHOD_SOME_NO_RETVAL 0x20 /* iASL only: Method has at least one return value */ 220 #define ANOBJ_IS_REFERENCED 0x80 /* iASL only: Object was referenced */ 221 222 223 /* Internal ACPI table management - master table list */ 224 225 typedef struct acpi_table_list 226 { 227 ACPI_TABLE_DESC *Tables; /* Table descriptor array */ 228 UINT32 CurrentTableCount; /* Tables currently in the array */ 229 UINT32 MaxTableCount; /* Max tables array will hold */ 230 UINT8 Flags; 231 232 } ACPI_TABLE_LIST; 233 234 /* Flags for above */ 235 236 #define ACPI_ROOT_ORIGIN_UNKNOWN (0) /* ~ORIGIN_ALLOCATED */ 237 #define ACPI_ROOT_ORIGIN_ALLOCATED (1) 238 #define ACPI_ROOT_ALLOW_RESIZE (2) 239 240 241 /* Predefined table indexes */ 242 243 #define ACPI_INVALID_TABLE_INDEX (0xFFFFFFFF) 244 245 246 typedef struct acpi_find_context 247 { 248 char *SearchFor; 249 ACPI_HANDLE *List; 250 UINT32 *Count; 251 252 } ACPI_FIND_CONTEXT; 253 254 255 typedef struct acpi_ns_search_data 256 { 257 ACPI_NAMESPACE_NODE *Node; 258 259 } ACPI_NS_SEARCH_DATA; 260 261 262 /* Object types used during package copies */ 263 264 #define ACPI_COPY_TYPE_SIMPLE 0 265 #define ACPI_COPY_TYPE_PACKAGE 1 266 267 268 /* Info structure used to convert external<->internal namestrings */ 269 270 typedef struct acpi_namestring_info 271 { 272 const char *ExternalName; 273 const char *NextExternalChar; 274 char *InternalName; 275 UINT32 Length; 276 UINT32 NumSegments; 277 UINT32 NumCarats; 278 BOOLEAN FullyQualified; 279 280 } ACPI_NAMESTRING_INFO; 281 282 283 /* Field creation info */ 284 285 typedef struct acpi_create_field_info 286 { 287 ACPI_NAMESPACE_NODE *RegionNode; 288 ACPI_NAMESPACE_NODE *FieldNode; 289 ACPI_NAMESPACE_NODE *RegisterNode; 290 ACPI_NAMESPACE_NODE *DataRegisterNode; 291 ACPI_NAMESPACE_NODE *ConnectionNode; 292 UINT8 *ResourceBuffer; 293 UINT32 BankValue; 294 UINT32 FieldBitPosition; 295 UINT32 FieldBitLength; 296 UINT16 ResourceLength; 297 UINT16 PinNumberIndex; 298 UINT8 FieldFlags; 299 UINT8 Attribute; 300 UINT8 FieldType; 301 UINT8 AccessLength; 302 303 } ACPI_CREATE_FIELD_INFO; 304 305 306 typedef 307 ACPI_STATUS (*ACPI_INTERNAL_METHOD) ( 308 struct acpi_walk_state *WalkState); 309 310 311 /* 312 * Bitmapped ACPI types. Used internally only 313 */ 314 #define ACPI_BTYPE_ANY 0x00000000 315 #define ACPI_BTYPE_INTEGER 0x00000001 316 #define ACPI_BTYPE_STRING 0x00000002 317 #define ACPI_BTYPE_BUFFER 0x00000004 318 #define ACPI_BTYPE_PACKAGE 0x00000008 319 #define ACPI_BTYPE_FIELD_UNIT 0x00000010 320 #define ACPI_BTYPE_DEVICE 0x00000020 321 #define ACPI_BTYPE_EVENT 0x00000040 322 #define ACPI_BTYPE_METHOD 0x00000080 323 #define ACPI_BTYPE_MUTEX 0x00000100 324 #define ACPI_BTYPE_REGION 0x00000200 325 #define ACPI_BTYPE_POWER 0x00000400 326 #define ACPI_BTYPE_PROCESSOR 0x00000800 327 #define ACPI_BTYPE_THERMAL 0x00001000 328 #define ACPI_BTYPE_BUFFER_FIELD 0x00002000 329 #define ACPI_BTYPE_DDB_HANDLE 0x00004000 330 #define ACPI_BTYPE_DEBUG_OBJECT 0x00008000 331 #define ACPI_BTYPE_REFERENCE 0x00010000 332 #define ACPI_BTYPE_RESOURCE 0x00020000 333 334 #define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER) 335 336 #define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE) 337 #define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE) 338 #define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR) 339 #define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */ 340 #define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF 341 342 #pragma pack(1) 343 344 /* 345 * Information structure for ACPI predefined names. 346 * Each entry in the table contains the following items: 347 * 348 * Name - The ACPI reserved name 349 * ParamCount - Number of arguments to the method 350 * ExpectedReturnBtypes - Allowed type(s) for the return value 351 */ 352 typedef struct acpi_name_info 353 { 354 char Name[ACPI_NAME_SIZE]; 355 UINT16 ArgumentList; 356 UINT8 ExpectedBtypes; 357 358 } ACPI_NAME_INFO; 359 360 /* 361 * Secondary information structures for ACPI predefined objects that return 362 * package objects. This structure appears as the next entry in the table 363 * after the NAME_INFO structure above. 364 * 365 * The reason for this is to minimize the size of the predefined name table. 366 */ 367 368 /* 369 * Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2, 370 * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT, 371 * ACPI_PTYPE2_FIX_VAR 372 */ 373 typedef struct acpi_package_info 374 { 375 UINT8 Type; 376 UINT8 ObjectType1; 377 UINT8 Count1; 378 UINT8 ObjectType2; 379 UINT8 Count2; 380 UINT16 Reserved; 381 382 } ACPI_PACKAGE_INFO; 383 384 /* Used for ACPI_PTYPE2_FIXED */ 385 386 typedef struct acpi_package_info2 387 { 388 UINT8 Type; 389 UINT8 Count; 390 UINT8 ObjectType[4]; 391 UINT8 Reserved; 392 393 } ACPI_PACKAGE_INFO2; 394 395 /* Used for ACPI_PTYPE1_OPTION */ 396 397 typedef struct acpi_package_info3 398 { 399 UINT8 Type; 400 UINT8 Count; 401 UINT8 ObjectType[2]; 402 UINT8 TailObjectType; 403 UINT16 Reserved; 404 405 } ACPI_PACKAGE_INFO3; 406 407 typedef struct acpi_package_info4 408 { 409 UINT8 Type; 410 UINT8 ObjectType1; 411 UINT8 Count1; 412 UINT8 SubObjectTypes; 413 UINT8 PkgCount; 414 UINT16 Reserved; 415 416 } ACPI_PACKAGE_INFO4; 417 418 typedef union acpi_predefined_info 419 { 420 ACPI_NAME_INFO Info; 421 ACPI_PACKAGE_INFO RetInfo; 422 ACPI_PACKAGE_INFO2 RetInfo2; 423 ACPI_PACKAGE_INFO3 RetInfo3; 424 ACPI_PACKAGE_INFO4 RetInfo4; 425 426 } ACPI_PREDEFINED_INFO; 427 428 /* Reset to default packing */ 429 430 #pragma pack() 431 432 433 /* Return object auto-repair info */ 434 435 typedef ACPI_STATUS (*ACPI_OBJECT_CONVERTER) ( 436 union acpi_operand_object *OriginalObject, 437 union acpi_operand_object **ConvertedObject); 438 439 typedef struct acpi_simple_repair_info 440 { 441 char Name[ACPI_NAME_SIZE]; 442 UINT32 UnexpectedBtypes; 443 UINT32 PackageIndex; 444 ACPI_OBJECT_CONVERTER ObjectConverter; 445 446 } ACPI_SIMPLE_REPAIR_INFO; 447 448 449 /* 450 * Bitmapped return value types 451 * Note: the actual data types must be contiguous, a loop in nspredef.c 452 * depends on this. 453 */ 454 #define ACPI_RTYPE_ANY 0x00 455 #define ACPI_RTYPE_NONE 0x01 456 #define ACPI_RTYPE_INTEGER 0x02 457 #define ACPI_RTYPE_STRING 0x04 458 #define ACPI_RTYPE_BUFFER 0x08 459 #define ACPI_RTYPE_PACKAGE 0x10 460 #define ACPI_RTYPE_REFERENCE 0x20 461 #define ACPI_RTYPE_ALL 0x3F 462 463 #define ACPI_NUM_RTYPES 5 /* Number of actual object types */ 464 465 466 /* Info for running the _REG methods */ 467 468 typedef struct acpi_reg_walk_info 469 { 470 ACPI_ADR_SPACE_TYPE SpaceId; 471 UINT32 RegRunCount; 472 473 } ACPI_REG_WALK_INFO; 474 475 476 /***************************************************************************** 477 * 478 * Event typedefs and structs 479 * 480 ****************************************************************************/ 481 482 /* Dispatch info for each host-installed SCI handler */ 483 484 typedef struct acpi_sci_handler_info 485 { 486 struct acpi_sci_handler_info *Next; 487 ACPI_SCI_HANDLER Address; /* Address of handler */ 488 void *Context; /* Context to be passed to handler */ 489 490 } ACPI_SCI_HANDLER_INFO; 491 492 /* Dispatch info for each GPE -- either a method or handler, cannot be both */ 493 494 typedef struct acpi_gpe_handler_info 495 { 496 ACPI_GPE_HANDLER Address; /* Address of handler, if any */ 497 void *Context; /* Context to be passed to handler */ 498 ACPI_NAMESPACE_NODE *MethodNode; /* Method node for this GPE level (saved) */ 499 UINT8 OriginalFlags; /* Original (pre-handler) GPE info */ 500 BOOLEAN OriginallyEnabled; /* True if GPE was originally enabled */ 501 502 } ACPI_GPE_HANDLER_INFO; 503 504 /* Notify info for implicit notify, multiple device objects */ 505 506 typedef struct acpi_gpe_notify_info 507 { 508 ACPI_NAMESPACE_NODE *DeviceNode; /* Device to be notified */ 509 struct acpi_gpe_notify_info *Next; 510 511 } ACPI_GPE_NOTIFY_INFO; 512 513 /* 514 * GPE dispatch info. At any time, the GPE can have at most one type 515 * of dispatch - Method, Handler, or Implicit Notify. 516 */ 517 typedef union acpi_gpe_dispatch_info 518 { 519 ACPI_NAMESPACE_NODE *MethodNode; /* Method node for this GPE level */ 520 ACPI_GPE_HANDLER_INFO *Handler; /* Installed GPE handler */ 521 ACPI_GPE_NOTIFY_INFO *NotifyList; /* List of _PRW devices for implicit notifies */ 522 523 } ACPI_GPE_DISPATCH_INFO; 524 525 /* 526 * Information about a GPE, one per each GPE in an array. 527 * NOTE: Important to keep this struct as small as possible. 528 */ 529 typedef struct acpi_gpe_event_info 530 { 531 union acpi_gpe_dispatch_info Dispatch; /* Either Method, Handler, or NotifyList */ 532 struct acpi_gpe_register_info *RegisterInfo; /* Backpointer to register info */ 533 UINT8 Flags; /* Misc info about this GPE */ 534 UINT8 GpeNumber; /* This GPE */ 535 UINT8 RuntimeCount; /* References to a run GPE */ 536 537 } ACPI_GPE_EVENT_INFO; 538 539 /* Information about a GPE register pair, one per each status/enable pair in an array */ 540 541 typedef struct acpi_gpe_register_info 542 { 543 ACPI_GENERIC_ADDRESS StatusAddress; /* Address of status reg */ 544 ACPI_GENERIC_ADDRESS EnableAddress; /* Address of enable reg */ 545 UINT16 BaseGpeNumber; /* Base GPE number for this register */ 546 UINT8 EnableForWake; /* GPEs to keep enabled when sleeping */ 547 UINT8 EnableForRun; /* GPEs to keep enabled when running */ 548 UINT8 EnableMask; /* Current mask of enabled GPEs */ 549 550 } ACPI_GPE_REGISTER_INFO; 551 552 /* 553 * Information about a GPE register block, one per each installed block -- 554 * GPE0, GPE1, and one per each installed GPE Block Device. 555 */ 556 typedef struct acpi_gpe_block_info 557 { 558 ACPI_NAMESPACE_NODE *Node; 559 struct acpi_gpe_block_info *Previous; 560 struct acpi_gpe_block_info *Next; 561 struct acpi_gpe_xrupt_info *XruptBlock; /* Backpointer to interrupt block */ 562 ACPI_GPE_REGISTER_INFO *RegisterInfo; /* One per GPE register pair */ 563 ACPI_GPE_EVENT_INFO *EventInfo; /* One for each GPE */ 564 UINT64 Address; /* Base address of the block */ 565 UINT32 RegisterCount; /* Number of register pairs in block */ 566 UINT16 GpeCount; /* Number of individual GPEs in block */ 567 UINT16 BlockBaseNumber;/* Base GPE number for this block */ 568 UINT8 SpaceId; 569 BOOLEAN Initialized; /* TRUE if this block is initialized */ 570 571 } ACPI_GPE_BLOCK_INFO; 572 573 /* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */ 574 575 typedef struct acpi_gpe_xrupt_info 576 { 577 struct acpi_gpe_xrupt_info *Previous; 578 struct acpi_gpe_xrupt_info *Next; 579 ACPI_GPE_BLOCK_INFO *GpeBlockListHead; /* List of GPE blocks for this xrupt */ 580 UINT32 InterruptNumber; /* System interrupt number */ 581 582 } ACPI_GPE_XRUPT_INFO; 583 584 typedef struct acpi_gpe_walk_info 585 { 586 ACPI_NAMESPACE_NODE *GpeDevice; 587 ACPI_GPE_BLOCK_INFO *GpeBlock; 588 UINT16 Count; 589 ACPI_OWNER_ID OwnerId; 590 BOOLEAN ExecuteByOwnerId; 591 592 } ACPI_GPE_WALK_INFO; 593 594 typedef struct acpi_gpe_device_info 595 { 596 UINT32 Index; 597 UINT32 NextBlockBaseIndex; 598 ACPI_STATUS Status; 599 ACPI_NAMESPACE_NODE *GpeDevice; 600 601 } ACPI_GPE_DEVICE_INFO; 602 603 typedef ACPI_STATUS (*ACPI_GPE_CALLBACK) ( 604 ACPI_GPE_XRUPT_INFO *GpeXruptInfo, 605 ACPI_GPE_BLOCK_INFO *GpeBlock, 606 void *Context); 607 608 609 /* Information about each particular fixed event */ 610 611 typedef struct acpi_fixed_event_handler 612 { 613 ACPI_EVENT_HANDLER Handler; /* Address of handler. */ 614 void *Context; /* Context to be passed to handler */ 615 616 } ACPI_FIXED_EVENT_HANDLER; 617 618 typedef struct acpi_fixed_event_info 619 { 620 UINT8 StatusRegisterId; 621 UINT8 EnableRegisterId; 622 UINT16 StatusBitMask; 623 UINT16 EnableBitMask; 624 625 } ACPI_FIXED_EVENT_INFO; 626 627 /* Information used during field processing */ 628 629 typedef struct acpi_field_info 630 { 631 UINT8 SkipField; 632 UINT8 FieldFlag; 633 UINT32 PkgLength; 634 635 } ACPI_FIELD_INFO; 636 637 638 /***************************************************************************** 639 * 640 * Generic "state" object for stacks 641 * 642 ****************************************************************************/ 643 644 #define ACPI_CONTROL_NORMAL 0xC0 645 #define ACPI_CONTROL_CONDITIONAL_EXECUTING 0xC1 646 #define ACPI_CONTROL_PREDICATE_EXECUTING 0xC2 647 #define ACPI_CONTROL_PREDICATE_FALSE 0xC3 648 #define ACPI_CONTROL_PREDICATE_TRUE 0xC4 649 650 651 #define ACPI_STATE_COMMON \ 652 void *Next; \ 653 UINT8 DescriptorType; /* To differentiate various internal objs */\ 654 UINT8 Flags; \ 655 UINT16 Value; \ 656 UINT16 State; 657 658 /* There are 2 bytes available here until the next natural alignment boundary */ 659 660 typedef struct acpi_common_state 661 { 662 ACPI_STATE_COMMON 663 } ACPI_COMMON_STATE; 664 665 666 /* 667 * Update state - used to traverse complex objects such as packages 668 */ 669 typedef struct acpi_update_state 670 { 671 ACPI_STATE_COMMON 672 union acpi_operand_object *Object; 673 674 } ACPI_UPDATE_STATE; 675 676 677 /* 678 * Pkg state - used to traverse nested package structures 679 */ 680 typedef struct acpi_pkg_state 681 { 682 ACPI_STATE_COMMON 683 UINT16 Index; 684 union acpi_operand_object *SourceObject; 685 union acpi_operand_object *DestObject; 686 struct acpi_walk_state *WalkState; 687 void *ThisTargetObj; 688 UINT32 NumPackages; 689 690 } ACPI_PKG_STATE; 691 692 693 /* 694 * Control state - one per if/else and while constructs. 695 * Allows nesting of these constructs 696 */ 697 typedef struct acpi_control_state 698 { 699 ACPI_STATE_COMMON 700 UINT16 Opcode; 701 union acpi_parse_object *PredicateOp; 702 UINT8 *AmlPredicateStart; /* Start of if/while predicate */ 703 UINT8 *PackageEnd; /* End of if/while block */ 704 UINT32 LoopCount; /* While() loop counter */ 705 706 } ACPI_CONTROL_STATE; 707 708 709 /* 710 * Scope state - current scope during namespace lookups 711 */ 712 typedef struct acpi_scope_state 713 { 714 ACPI_STATE_COMMON 715 ACPI_NAMESPACE_NODE *Node; 716 717 } ACPI_SCOPE_STATE; 718 719 720 typedef struct acpi_pscope_state 721 { 722 ACPI_STATE_COMMON 723 UINT32 ArgCount; /* Number of fixed arguments */ 724 union acpi_parse_object *Op; /* Current op being parsed */ 725 UINT8 *ArgEnd; /* Current argument end */ 726 UINT8 *PkgEnd; /* Current package end */ 727 UINT32 ArgList; /* Next argument to parse */ 728 729 } ACPI_PSCOPE_STATE; 730 731 732 /* 733 * Thread state - one per thread across multiple walk states. Multiple walk 734 * states are created when there are nested control methods executing. 735 */ 736 typedef struct acpi_thread_state 737 { 738 ACPI_STATE_COMMON 739 UINT8 CurrentSyncLevel; /* Mutex Sync (nested acquire) level */ 740 struct acpi_walk_state *WalkStateList; /* Head of list of WalkStates for this thread */ 741 union acpi_operand_object *AcquiredMutexList; /* List of all currently acquired mutexes */ 742 ACPI_THREAD_ID ThreadId; /* Running thread ID */ 743 744 } ACPI_THREAD_STATE; 745 746 747 /* 748 * Result values - used to accumulate the results of nested 749 * AML arguments 750 */ 751 typedef struct acpi_result_values 752 { 753 ACPI_STATE_COMMON 754 union acpi_operand_object *ObjDesc [ACPI_RESULTS_FRAME_OBJ_NUM]; 755 756 } ACPI_RESULT_VALUES; 757 758 759 typedef 760 ACPI_STATUS (*ACPI_PARSE_DOWNWARDS) ( 761 struct acpi_walk_state *WalkState, 762 union acpi_parse_object **OutOp); 763 764 typedef 765 ACPI_STATUS (*ACPI_PARSE_UPWARDS) ( 766 struct acpi_walk_state *WalkState); 767 768 769 /* Global handlers for AML Notifies */ 770 771 typedef struct acpi_global_notify_handler 772 { 773 ACPI_NOTIFY_HANDLER Handler; 774 void *Context; 775 776 } ACPI_GLOBAL_NOTIFY_HANDLER; 777 778 /* 779 * Notify info - used to pass info to the deferred notify 780 * handler/dispatcher. 781 */ 782 typedef struct acpi_notify_info 783 { 784 ACPI_STATE_COMMON 785 UINT8 HandlerListId; 786 ACPI_NAMESPACE_NODE *Node; 787 union acpi_operand_object *HandlerListHead; 788 ACPI_GLOBAL_NOTIFY_HANDLER *Global; 789 790 } ACPI_NOTIFY_INFO; 791 792 793 /* Generic state is union of structs above */ 794 795 typedef union acpi_generic_state 796 { 797 ACPI_COMMON_STATE Common; 798 ACPI_CONTROL_STATE Control; 799 ACPI_UPDATE_STATE Update; 800 ACPI_SCOPE_STATE Scope; 801 ACPI_PSCOPE_STATE ParseScope; 802 ACPI_PKG_STATE Pkg; 803 ACPI_THREAD_STATE Thread; 804 ACPI_RESULT_VALUES Results; 805 ACPI_NOTIFY_INFO Notify; 806 807 } ACPI_GENERIC_STATE; 808 809 810 /***************************************************************************** 811 * 812 * Interpreter typedefs and structs 813 * 814 ****************************************************************************/ 815 816 typedef 817 ACPI_STATUS (*ACPI_EXECUTE_OP) ( 818 struct acpi_walk_state *WalkState); 819 820 /* Address Range info block */ 821 822 typedef struct acpi_address_range 823 { 824 struct acpi_address_range *Next; 825 ACPI_NAMESPACE_NODE *RegionNode; 826 ACPI_PHYSICAL_ADDRESS StartAddress; 827 ACPI_PHYSICAL_ADDRESS EndAddress; 828 829 } ACPI_ADDRESS_RANGE; 830 831 832 /***************************************************************************** 833 * 834 * Parser typedefs and structs 835 * 836 ****************************************************************************/ 837 838 /* 839 * AML opcode, name, and argument layout 840 */ 841 typedef struct acpi_opcode_info 842 { 843 #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT) 844 char *Name; /* Opcode name (disassembler/debug only) */ 845 #endif 846 UINT32 ParseArgs; /* Grammar/Parse time arguments */ 847 UINT32 RuntimeArgs; /* Interpret time arguments */ 848 UINT16 Flags; /* Misc flags */ 849 UINT8 ObjectType; /* Corresponding internal object type */ 850 UINT8 Class; /* Opcode class */ 851 UINT8 Type; /* Opcode type */ 852 853 } ACPI_OPCODE_INFO; 854 855 /* Structure for Resource Tag information */ 856 857 typedef struct acpi_tag_info 858 { 859 UINT32 BitOffset; 860 UINT32 BitLength; 861 862 } ACPI_TAG_INFO; 863 864 /* Value associated with the parse object */ 865 866 typedef union acpi_parse_value 867 { 868 UINT64 Integer; /* Integer constant (Up to 64 bits) */ 869 UINT32 Size; /* bytelist or field size */ 870 char *String; /* NULL terminated string */ 871 UINT8 *Buffer; /* buffer or string */ 872 char *Name; /* NULL terminated string */ 873 union acpi_parse_object *Arg; /* arguments and contained ops */ 874 ACPI_TAG_INFO Tag; /* Resource descriptor tag info */ 875 876 } ACPI_PARSE_VALUE; 877 878 879 #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT) 880 #define ACPI_DISASM_ONLY_MEMBERS(a) a; 881 #else 882 #define ACPI_DISASM_ONLY_MEMBERS(a) 883 #endif 884 885 #define ACPI_PARSE_COMMON \ 886 union acpi_parse_object *Parent; /* Parent op */\ 887 UINT8 DescriptorType; /* To differentiate various internal objs */\ 888 UINT8 Flags; /* Type of Op */\ 889 UINT16 AmlOpcode; /* AML opcode */\ 890 UINT8 *Aml; /* Address of declaration in AML */\ 891 union acpi_parse_object *Next; /* Next op */\ 892 ACPI_NAMESPACE_NODE *Node; /* For use by interpreter */\ 893 ACPI_PARSE_VALUE Value; /* Value or args associated with the opcode */\ 894 UINT8 ArgListLength; /* Number of elements in the arg list */\ 895 ACPI_DISASM_ONLY_MEMBERS (\ 896 UINT8 DisasmFlags; /* Used during AML disassembly */\ 897 UINT8 DisasmOpcode; /* Subtype used for disassembly */\ 898 char *OperatorSymbol;/* Used for C-style operator name strings */\ 899 char AmlOpName[16]) /* Op name (debug only) */ 900 901 902 /* Flags for DisasmFlags field above */ 903 904 #define ACPI_DASM_BUFFER 0x00 /* Buffer is a simple data buffer */ 905 #define ACPI_DASM_RESOURCE 0x01 /* Buffer is a Resource Descriptor */ 906 #define ACPI_DASM_STRING 0x02 /* Buffer is a ASCII string */ 907 #define ACPI_DASM_UNICODE 0x03 /* Buffer is a Unicode string */ 908 #define ACPI_DASM_PLD_METHOD 0x04 /* Buffer is a _PLD method bit-packed buffer */ 909 #define ACPI_DASM_UUID 0x05 /* Buffer is a UUID/GUID */ 910 #define ACPI_DASM_EISAID 0x06 /* Integer is an EISAID */ 911 #define ACPI_DASM_MATCHOP 0x07 /* Parent opcode is a Match() operator */ 912 #define ACPI_DASM_LNOT_PREFIX 0x08 /* Start of a LNotEqual (etc.) pair of opcodes */ 913 #define ACPI_DASM_LNOT_SUFFIX 0x09 /* End of a LNotEqual (etc.) pair of opcodes */ 914 #define ACPI_DASM_HID_STRING 0x0A /* String is a _HID or _CID */ 915 #define ACPI_DASM_IGNORE 0x0B /* Not used at this time */ 916 917 /* 918 * Generic operation (for example: If, While, Store) 919 */ 920 typedef struct acpi_parse_obj_common 921 { 922 ACPI_PARSE_COMMON 923 } ACPI_PARSE_OBJ_COMMON; 924 925 926 /* 927 * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and OpRegions), 928 * and bytelists. 929 */ 930 typedef struct acpi_parse_obj_named 931 { 932 ACPI_PARSE_COMMON 933 UINT8 *Path; 934 UINT8 *Data; /* AML body or bytelist data */ 935 UINT32 Length; /* AML length */ 936 UINT32 Name; /* 4-byte name or zero if no name */ 937 938 } ACPI_PARSE_OBJ_NAMED; 939 940 941 /* This version is used by the iASL compiler only */ 942 943 #define ACPI_MAX_PARSEOP_NAME 20 944 945 typedef struct acpi_parse_obj_asl 946 { 947 ACPI_PARSE_COMMON 948 union acpi_parse_object *Child; 949 union acpi_parse_object *ParentMethod; 950 char *Filename; 951 char *ExternalName; 952 char *Namepath; 953 char NameSeg[4]; 954 UINT32 ExtraValue; 955 UINT32 Column; 956 UINT32 LineNumber; 957 UINT32 LogicalLineNumber; 958 UINT32 LogicalByteOffset; 959 UINT32 EndLine; 960 UINT32 EndLogicalLine; 961 UINT32 AcpiBtype; 962 UINT32 AmlLength; 963 UINT32 AmlSubtreeLength; 964 UINT32 FinalAmlLength; 965 UINT32 FinalAmlOffset; 966 UINT32 CompileFlags; 967 UINT16 ParseOpcode; 968 UINT8 AmlOpcodeLength; 969 UINT8 AmlPkgLenBytes; 970 UINT8 Extra; 971 char ParseOpName[ACPI_MAX_PARSEOP_NAME]; 972 973 } ACPI_PARSE_OBJ_ASL; 974 975 typedef union acpi_parse_object 976 { 977 ACPI_PARSE_OBJ_COMMON Common; 978 ACPI_PARSE_OBJ_NAMED Named; 979 ACPI_PARSE_OBJ_ASL Asl; 980 981 } ACPI_PARSE_OBJECT; 982 983 984 /* 985 * Parse state - one state per parser invocation and each control 986 * method. 987 */ 988 typedef struct acpi_parse_state 989 { 990 UINT8 *AmlStart; /* First AML byte */ 991 UINT8 *Aml; /* Next AML byte */ 992 UINT8 *AmlEnd; /* (last + 1) AML byte */ 993 UINT8 *PkgStart; /* Current package begin */ 994 UINT8 *PkgEnd; /* Current package end */ 995 union acpi_parse_object *StartOp; /* Root of parse tree */ 996 struct acpi_namespace_node *StartNode; 997 union acpi_generic_state *Scope; /* Current scope */ 998 union acpi_parse_object *StartScope; 999 UINT32 AmlSize; 1000 1001 } ACPI_PARSE_STATE; 1002 1003 1004 /* Parse object flags */ 1005 1006 #define ACPI_PARSEOP_GENERIC 0x01 1007 #define ACPI_PARSEOP_NAMED 0x02 1008 #define ACPI_PARSEOP_DEFERRED 0x04 1009 #define ACPI_PARSEOP_BYTELIST 0x08 1010 #define ACPI_PARSEOP_IN_STACK 0x10 1011 #define ACPI_PARSEOP_TARGET 0x20 1012 #define ACPI_PARSEOP_IN_CACHE 0x80 1013 1014 /* Parse object DisasmFlags */ 1015 1016 #define ACPI_PARSEOP_IGNORE 0x01 1017 #define ACPI_PARSEOP_PARAMLIST 0x02 1018 #define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 1019 #define ACPI_PARSEOP_PREDEF_CHECKED 0x08 1020 #define ACPI_PARSEOP_SPECIAL 0x10 1021 #define ACPI_PARSEOP_COMPOUND 0x20 1022 #define ACPI_PARSEOP_ASSIGNMENT 0x40 1023 1024 1025 /***************************************************************************** 1026 * 1027 * Hardware (ACPI registers) and PNP 1028 * 1029 ****************************************************************************/ 1030 1031 typedef struct acpi_bit_register_info 1032 { 1033 UINT8 ParentRegister; 1034 UINT8 BitPosition; 1035 UINT16 AccessBitMask; 1036 1037 } ACPI_BIT_REGISTER_INFO; 1038 1039 1040 /* 1041 * Some ACPI registers have bits that must be ignored -- meaning that they 1042 * must be preserved. 1043 */ 1044 #define ACPI_PM1_STATUS_PRESERVED_BITS 0x0800 /* Bit 11 */ 1045 1046 /* Write-only bits must be zeroed by software */ 1047 1048 #define ACPI_PM1_CONTROL_WRITEONLY_BITS 0x2004 /* Bits 13, 2 */ 1049 1050 /* For control registers, both ignored and reserved bits must be preserved */ 1051 1052 /* 1053 * For PM1 control, the SCI enable bit (bit 0, SCI_EN) is defined by the 1054 * ACPI specification to be a "preserved" bit - "OSPM always preserves this 1055 * bit position", section 4.7.3.2.1. However, on some machines the OS must 1056 * write a one to this bit after resume for the machine to work properly. 1057 * To enable this, we no longer attempt to preserve this bit. No machines 1058 * are known to fail if the bit is not preserved. (May 2009) 1059 */ 1060 #define ACPI_PM1_CONTROL_IGNORED_BITS 0x0200 /* Bit 9 */ 1061 #define ACPI_PM1_CONTROL_RESERVED_BITS 0xC1F8 /* Bits 14-15, 3-8 */ 1062 #define ACPI_PM1_CONTROL_PRESERVED_BITS \ 1063 (ACPI_PM1_CONTROL_IGNORED_BITS | ACPI_PM1_CONTROL_RESERVED_BITS) 1064 1065 #define ACPI_PM2_CONTROL_PRESERVED_BITS 0xFFFFFFFE /* All except bit 0 */ 1066 1067 /* 1068 * Register IDs 1069 * These are the full ACPI registers 1070 */ 1071 #define ACPI_REGISTER_PM1_STATUS 0x01 1072 #define ACPI_REGISTER_PM1_ENABLE 0x02 1073 #define ACPI_REGISTER_PM1_CONTROL 0x03 1074 #define ACPI_REGISTER_PM2_CONTROL 0x04 1075 #define ACPI_REGISTER_PM_TIMER 0x05 1076 #define ACPI_REGISTER_PROCESSOR_BLOCK 0x06 1077 #define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x07 1078 1079 1080 /* Masks used to access the BitRegisters */ 1081 1082 #define ACPI_BITMASK_TIMER_STATUS 0x0001 1083 #define ACPI_BITMASK_BUS_MASTER_STATUS 0x0010 1084 #define ACPI_BITMASK_GLOBAL_LOCK_STATUS 0x0020 1085 #define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100 1086 #define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200 1087 #define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400 1088 #define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */ 1089 #define ACPI_BITMASK_WAKE_STATUS 0x8000 1090 1091 #define ACPI_BITMASK_ALL_FIXED_STATUS (\ 1092 ACPI_BITMASK_TIMER_STATUS | \ 1093 ACPI_BITMASK_BUS_MASTER_STATUS | \ 1094 ACPI_BITMASK_GLOBAL_LOCK_STATUS | \ 1095 ACPI_BITMASK_POWER_BUTTON_STATUS | \ 1096 ACPI_BITMASK_SLEEP_BUTTON_STATUS | \ 1097 ACPI_BITMASK_RT_CLOCK_STATUS | \ 1098 ACPI_BITMASK_PCIEXP_WAKE_STATUS | \ 1099 ACPI_BITMASK_WAKE_STATUS) 1100 1101 #define ACPI_BITMASK_TIMER_ENABLE 0x0001 1102 #define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020 1103 #define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100 1104 #define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200 1105 #define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400 1106 #define ACPI_BITMASK_PCIEXP_WAKE_DISABLE 0x4000 /* ACPI 3.0 */ 1107 1108 #define ACPI_BITMASK_SCI_ENABLE 0x0001 1109 #define ACPI_BITMASK_BUS_MASTER_RLD 0x0002 1110 #define ACPI_BITMASK_GLOBAL_LOCK_RELEASE 0x0004 1111 #define ACPI_BITMASK_SLEEP_TYPE 0x1C00 1112 #define ACPI_BITMASK_SLEEP_ENABLE 0x2000 1113 1114 #define ACPI_BITMASK_ARB_DISABLE 0x0001 1115 1116 1117 /* Raw bit position of each BitRegister */ 1118 1119 #define ACPI_BITPOSITION_TIMER_STATUS 0x00 1120 #define ACPI_BITPOSITION_BUS_MASTER_STATUS 0x04 1121 #define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS 0x05 1122 #define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x08 1123 #define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x09 1124 #define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A 1125 #define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS 0x0E /* ACPI 3.0 */ 1126 #define ACPI_BITPOSITION_WAKE_STATUS 0x0F 1127 1128 #define ACPI_BITPOSITION_TIMER_ENABLE 0x00 1129 #define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE 0x05 1130 #define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x08 1131 #define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x09 1132 #define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A 1133 #define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE 0x0E /* ACPI 3.0 */ 1134 1135 #define ACPI_BITPOSITION_SCI_ENABLE 0x00 1136 #define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01 1137 #define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE 0x02 1138 #define ACPI_BITPOSITION_SLEEP_TYPE 0x0A 1139 #define ACPI_BITPOSITION_SLEEP_ENABLE 0x0D 1140 1141 #define ACPI_BITPOSITION_ARB_DISABLE 0x00 1142 1143 1144 /* Structs and definitions for _OSI support and I/O port validation */ 1145 1146 #define ACPI_ALWAYS_ILLEGAL 0x00 1147 1148 typedef struct acpi_interface_info 1149 { 1150 char *Name; 1151 struct acpi_interface_info *Next; 1152 UINT8 Flags; 1153 UINT8 Value; 1154 1155 } ACPI_INTERFACE_INFO; 1156 1157 #define ACPI_OSI_INVALID 0x01 1158 #define ACPI_OSI_DYNAMIC 0x02 1159 #define ACPI_OSI_FEATURE 0x04 1160 #define ACPI_OSI_DEFAULT_INVALID 0x08 1161 #define ACPI_OSI_OPTIONAL_FEATURE (ACPI_OSI_FEATURE | ACPI_OSI_DEFAULT_INVALID | ACPI_OSI_INVALID) 1162 1163 typedef struct acpi_port_info 1164 { 1165 char *Name; 1166 UINT16 Start; 1167 UINT16 End; 1168 UINT8 OsiDependency; 1169 1170 } ACPI_PORT_INFO; 1171 1172 1173 /***************************************************************************** 1174 * 1175 * Resource descriptors 1176 * 1177 ****************************************************************************/ 1178 1179 /* ResourceType values */ 1180 1181 #define ACPI_ADDRESS_TYPE_MEMORY_RANGE 0 1182 #define ACPI_ADDRESS_TYPE_IO_RANGE 1 1183 #define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE 2 1184 1185 /* Resource descriptor types and masks */ 1186 1187 #define ACPI_RESOURCE_NAME_LARGE 0x80 1188 #define ACPI_RESOURCE_NAME_SMALL 0x00 1189 1190 #define ACPI_RESOURCE_NAME_SMALL_MASK 0x78 /* Bits 6:3 contain the type */ 1191 #define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK 0x07 /* Bits 2:0 contain the length */ 1192 #define ACPI_RESOURCE_NAME_LARGE_MASK 0x7F /* Bits 6:0 contain the type */ 1193 1194 1195 /* 1196 * Small resource descriptor "names" as defined by the ACPI specification. 1197 * Note: Bits 2:0 are used for the descriptor length 1198 */ 1199 #define ACPI_RESOURCE_NAME_IRQ 0x20 1200 #define ACPI_RESOURCE_NAME_DMA 0x28 1201 #define ACPI_RESOURCE_NAME_START_DEPENDENT 0x30 1202 #define ACPI_RESOURCE_NAME_END_DEPENDENT 0x38 1203 #define ACPI_RESOURCE_NAME_IO 0x40 1204 #define ACPI_RESOURCE_NAME_FIXED_IO 0x48 1205 #define ACPI_RESOURCE_NAME_FIXED_DMA 0x50 1206 #define ACPI_RESOURCE_NAME_RESERVED_S2 0x58 1207 #define ACPI_RESOURCE_NAME_RESERVED_S3 0x60 1208 #define ACPI_RESOURCE_NAME_RESERVED_S4 0x68 1209 #define ACPI_RESOURCE_NAME_VENDOR_SMALL 0x70 1210 #define ACPI_RESOURCE_NAME_END_TAG 0x78 1211 1212 /* 1213 * Large resource descriptor "names" as defined by the ACPI specification. 1214 * Note: includes the Large Descriptor bit in bit[7] 1215 */ 1216 #define ACPI_RESOURCE_NAME_MEMORY24 0x81 1217 #define ACPI_RESOURCE_NAME_GENERIC_REGISTER 0x82 1218 #define ACPI_RESOURCE_NAME_RESERVED_L1 0x83 1219 #define ACPI_RESOURCE_NAME_VENDOR_LARGE 0x84 1220 #define ACPI_RESOURCE_NAME_MEMORY32 0x85 1221 #define ACPI_RESOURCE_NAME_FIXED_MEMORY32 0x86 1222 #define ACPI_RESOURCE_NAME_ADDRESS32 0x87 1223 #define ACPI_RESOURCE_NAME_ADDRESS16 0x88 1224 #define ACPI_RESOURCE_NAME_EXTENDED_IRQ 0x89 1225 #define ACPI_RESOURCE_NAME_ADDRESS64 0x8A 1226 #define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 0x8B 1227 #define ACPI_RESOURCE_NAME_GPIO 0x8C 1228 #define ACPI_RESOURCE_NAME_SERIAL_BUS 0x8E 1229 #define ACPI_RESOURCE_NAME_LARGE_MAX 0x8E 1230 1231 1232 /***************************************************************************** 1233 * 1234 * Miscellaneous 1235 * 1236 ****************************************************************************/ 1237 1238 #define ACPI_ASCII_ZERO 0x30 1239 1240 1241 /***************************************************************************** 1242 * 1243 * Disassembler 1244 * 1245 ****************************************************************************/ 1246 1247 typedef struct acpi_external_list 1248 { 1249 char *Path; 1250 char *InternalPath; 1251 struct acpi_external_list *Next; 1252 UINT32 Value; 1253 UINT16 Length; 1254 UINT16 Flags; 1255 UINT8 Type; 1256 1257 } ACPI_EXTERNAL_LIST; 1258 1259 /* Values for Flags field above */ 1260 1261 #define ACPI_EXT_RESOLVED_REFERENCE 0x01 /* Object was resolved during cross ref */ 1262 #define ACPI_EXT_ORIGIN_FROM_FILE 0x02 /* External came from a file */ 1263 #define ACPI_EXT_INTERNAL_PATH_ALLOCATED 0x04 /* Deallocate internal path on completion */ 1264 #define ACPI_EXT_EXTERNAL_EMITTED 0x08 /* External() statement has been emitted */ 1265 1266 1267 typedef struct acpi_external_file 1268 { 1269 char *Path; 1270 struct acpi_external_file *Next; 1271 1272 } ACPI_EXTERNAL_FILE; 1273 1274 1275 /***************************************************************************** 1276 * 1277 * Debugger 1278 * 1279 ****************************************************************************/ 1280 1281 typedef struct acpi_db_method_info 1282 { 1283 ACPI_HANDLE Method; 1284 ACPI_HANDLE MainThreadGate; 1285 ACPI_HANDLE ThreadCompleteGate; 1286 ACPI_HANDLE InfoGate; 1287 ACPI_THREAD_ID *Threads; 1288 UINT32 NumThreads; 1289 UINT32 NumCreated; 1290 UINT32 NumCompleted; 1291 1292 char *Name; 1293 UINT32 Flags; 1294 UINT32 NumLoops; 1295 char Pathname[ACPI_DB_LINE_BUFFER_SIZE]; 1296 char **Args; 1297 ACPI_OBJECT_TYPE *Types; 1298 1299 /* 1300 * Arguments to be passed to method for the command 1301 * Threads - 1302 * the Number of threads, ID of current thread and 1303 * Index of current thread inside all them created. 1304 */ 1305 char InitArgs; 1306 #ifdef ACPI_DEBUGGER 1307 ACPI_OBJECT_TYPE ArgTypes[4]; 1308 #endif 1309 char *Arguments[4]; 1310 char NumThreadsStr[11]; 1311 char IdOfThreadStr[11]; 1312 char IndexOfThreadStr[11]; 1313 1314 } ACPI_DB_METHOD_INFO; 1315 1316 typedef struct acpi_integrity_info 1317 { 1318 UINT32 Nodes; 1319 UINT32 Objects; 1320 1321 } ACPI_INTEGRITY_INFO; 1322 1323 1324 #define ACPI_DB_DISABLE_OUTPUT 0x00 1325 #define ACPI_DB_REDIRECTABLE_OUTPUT 0x01 1326 #define ACPI_DB_CONSOLE_OUTPUT 0x02 1327 #define ACPI_DB_DUPLICATE_OUTPUT 0x03 1328 1329 1330 typedef struct acpi_object_info 1331 { 1332 UINT32 Types[ACPI_TOTAL_TYPES]; 1333 1334 } ACPI_OBJECT_INFO; 1335 1336 1337 /***************************************************************************** 1338 * 1339 * Debug 1340 * 1341 ****************************************************************************/ 1342 1343 /* Entry for a memory allocation (debug only) */ 1344 1345 #define ACPI_MEM_MALLOC 0 1346 #define ACPI_MEM_CALLOC 1 1347 #define ACPI_MAX_MODULE_NAME 16 1348 1349 #define ACPI_COMMON_DEBUG_MEM_HEADER \ 1350 struct acpi_debug_mem_block *Previous; \ 1351 struct acpi_debug_mem_block *Next; \ 1352 UINT32 Size; \ 1353 UINT32 Component; \ 1354 UINT32 Line; \ 1355 char Module[ACPI_MAX_MODULE_NAME]; \ 1356 UINT8 AllocType; 1357 1358 typedef struct acpi_debug_mem_header 1359 { 1360 ACPI_COMMON_DEBUG_MEM_HEADER 1361 1362 } ACPI_DEBUG_MEM_HEADER; 1363 1364 typedef struct acpi_debug_mem_block 1365 { 1366 ACPI_COMMON_DEBUG_MEM_HEADER 1367 UINT64 UserSpace; 1368 1369 } ACPI_DEBUG_MEM_BLOCK; 1370 1371 1372 #define ACPI_MEM_LIST_GLOBAL 0 1373 #define ACPI_MEM_LIST_NSNODE 1 1374 #define ACPI_MEM_LIST_MAX 1 1375 #define ACPI_NUM_MEM_LISTS 2 1376 1377 1378 /***************************************************************************** 1379 * 1380 * Info/help support 1381 * 1382 ****************************************************************************/ 1383 1384 typedef struct ah_predefined_name 1385 { 1386 char *Name; 1387 char *Description; 1388 #ifndef ACPI_ASL_COMPILER 1389 char *Action; 1390 #endif 1391 1392 } AH_PREDEFINED_NAME; 1393 1394 typedef struct ah_device_id 1395 { 1396 char *Name; 1397 char *Description; 1398 1399 } AH_DEVICE_ID; 1400 1401 typedef struct ah_uuid 1402 { 1403 char *Description; 1404 char *String; 1405 1406 } AH_UUID; 1407 1408 typedef struct ah_table 1409 { 1410 char *Signature; 1411 char *Description; 1412 1413 } AH_TABLE; 1414 1415 #endif /* __ACLOCAL_H__ */ 1416