1 /****************************************************************************** 2 * 3 * Name: actypes.h - Common data types for the entire ACPI subsystem 4 * $Revision: 1.308 $ 5 * 6 *****************************************************************************/ 7 8 /****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * 12 * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. 13 * All rights 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 __ACTYPES_H__ 118 #define __ACTYPES_H__ 119 120 /* acpisrc:StructDefs -- for acpisrc conversion */ 121 122 /* 123 * ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent header 124 * and must be either 16, 32, or 64 125 */ 126 #ifndef ACPI_MACHINE_WIDTH 127 #error ACPI_MACHINE_WIDTH not defined 128 #endif 129 130 /*! [Begin] no source code translation */ 131 132 /* 133 * Data type ranges 134 * Note: These macros are designed to be compiler independent as well as 135 * working around problems that some 32-bit compilers have with 64-bit 136 * constants. 137 */ 138 #define ACPI_UINT8_MAX (UINT8) (~((UINT8) 0)) /* 0xFF */ 139 #define ACPI_UINT16_MAX (UINT16)(~((UINT16) 0)) /* 0xFFFF */ 140 #define ACPI_UINT32_MAX (UINT32)(~((UINT32) 0)) /* 0xFFFFFFFF */ 141 #define ACPI_UINT64_MAX (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */ 142 #define ACPI_ASCII_MAX 0x7F 143 144 145 /* 146 * Architecture-specific ACPICA Subsystem Data Types 147 * 148 * The goal of these types is to provide source code portability across 149 * 16-bit, 32-bit, and 64-bit targets. 150 * 151 * 1) The following types are of fixed size for all targets (16/32/64): 152 * 153 * BOOLEAN Logical boolean 154 * 155 * UINT8 8-bit (1 byte) unsigned value 156 * UINT16 16-bit (2 byte) unsigned value 157 * UINT32 32-bit (4 byte) unsigned value 158 * UINT64 64-bit (8 byte) unsigned value 159 * 160 * INT16 16-bit (2 byte) signed value 161 * INT32 32-bit (4 byte) signed value 162 * INT64 64-bit (8 byte) signed value 163 * 164 * COMPILER_DEPENDENT_UINT64/INT64 - These types are defined in the 165 * compiler-dependent header(s) and were introduced because there is no common 166 * 64-bit integer type across the various compilation models, as shown in 167 * the table below. 168 * 169 * Datatype LP64 ILP64 LLP64 ILP32 LP32 16bit 170 * char 8 8 8 8 8 8 171 * short 16 16 16 16 16 16 172 * _int32 32 173 * int 32 64 32 32 16 16 174 * long 64 64 32 32 32 32 175 * long long 64 64 176 * pointer 64 64 64 32 32 32 177 * 178 * Note: ILP64 and LP32 are currently not supported. 179 * 180 * 181 * 2) These types represent the native word size of the target mode of the 182 * processor, and may be 16-bit, 32-bit, or 64-bit as required. They are 183 * usually used for memory allocation, efficient loop counters, and array 184 * indexes. The types are similar to the size_t type in the C library and are 185 * required because there is no C type that consistently represents the native 186 * data width. 187 * 188 * ACPI_SIZE 16/32/64-bit unsigned value 189 * ACPI_NATIVE_UINT 16/32/64-bit unsigned value 190 * ACPI_NATIVE_INT 16/32/64-bit signed value 191 * 192 */ 193 194 /******************************************************************************* 195 * 196 * Common types for all compilers, all targets 197 * 198 ******************************************************************************/ 199 200 typedef unsigned char BOOLEAN; 201 typedef unsigned char UINT8; 202 typedef unsigned short UINT16; 203 typedef COMPILER_DEPENDENT_UINT64 UINT64; 204 typedef COMPILER_DEPENDENT_INT64 INT64; 205 206 /*! [End] no source code translation !*/ 207 208 209 /******************************************************************************* 210 * 211 * Types specific to 64-bit targets 212 * 213 ******************************************************************************/ 214 215 #if ACPI_MACHINE_WIDTH == 64 216 217 /*! [Begin] no source code translation (keep the typedefs as-is) */ 218 219 typedef unsigned int UINT32; 220 typedef int INT32; 221 222 /*! [End] no source code translation !*/ 223 224 225 typedef UINT64 ACPI_NATIVE_UINT; 226 typedef INT64 ACPI_NATIVE_INT; 227 228 typedef UINT64 ACPI_TABLE_PTR; 229 typedef UINT64 ACPI_IO_ADDRESS; 230 typedef UINT64 ACPI_PHYSICAL_ADDRESS; 231 232 #define ACPI_MAX_PTR ACPI_UINT64_MAX 233 #define ACPI_SIZE_MAX ACPI_UINT64_MAX 234 235 #define ACPI_USE_NATIVE_DIVIDE /* Has native 64-bit integer support */ 236 237 /* 238 * In the case of the Itanium Processor Family (IPF), the hardware does not 239 * support misaligned memory transfers. Set the MISALIGNMENT_NOT_SUPPORTED flag 240 * to indicate that special precautions must be taken to avoid alignment faults. 241 * (IA64 or ia64 is currently used by existing compilers to indicate IPF.) 242 * 243 * Note: EM64T and other X86-64 processors support misaligned transfers, 244 * so there is no need to define this flag. 245 */ 246 #if defined (__IA64__) || defined (__ia64__) 247 #define ACPI_MISALIGNMENT_NOT_SUPPORTED 248 #endif 249 250 251 /******************************************************************************* 252 * 253 * Types specific to 32-bit targets 254 * 255 ******************************************************************************/ 256 257 #elif ACPI_MACHINE_WIDTH == 32 258 259 /*! [Begin] no source code translation (keep the typedefs as-is) */ 260 261 typedef unsigned int UINT32; 262 typedef int INT32; 263 264 /*! [End] no source code translation !*/ 265 266 267 typedef UINT32 ACPI_NATIVE_UINT; 268 typedef INT32 ACPI_NATIVE_INT; 269 270 typedef UINT64 ACPI_TABLE_PTR; 271 typedef UINT32 ACPI_IO_ADDRESS; 272 typedef UINT64 ACPI_PHYSICAL_ADDRESS; 273 274 #define ACPI_MAX_PTR ACPI_UINT32_MAX 275 #define ACPI_SIZE_MAX ACPI_UINT32_MAX 276 277 278 /******************************************************************************* 279 * 280 * Types specific to 16-bit targets 281 * 282 ******************************************************************************/ 283 284 #elif ACPI_MACHINE_WIDTH == 16 285 286 /*! [Begin] no source code translation (keep the typedefs as-is) */ 287 288 typedef unsigned long UINT32; 289 typedef short INT16; 290 typedef long INT32; 291 292 /*! [End] no source code translation !*/ 293 294 295 typedef UINT16 ACPI_NATIVE_UINT; 296 typedef INT16 ACPI_NATIVE_INT; 297 298 typedef UINT32 ACPI_TABLE_PTR; 299 typedef UINT32 ACPI_IO_ADDRESS; 300 typedef char *ACPI_PHYSICAL_ADDRESS; 301 302 #define ACPI_MAX_PTR ACPI_UINT16_MAX 303 #define ACPI_SIZE_MAX ACPI_UINT16_MAX 304 305 #define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ 306 307 /* 64-bit integers cannot be supported */ 308 309 #define ACPI_NO_INTEGER64_SUPPORT 310 311 312 #else 313 314 /* ACPI_MACHINE_WIDTH must be either 64, 32, or 16 */ 315 316 #error unknown ACPI_MACHINE_WIDTH 317 #endif 318 319 320 /* Variable-width type, used instead of clib size_t */ 321 322 typedef ACPI_NATIVE_UINT ACPI_SIZE; 323 324 325 /******************************************************************************* 326 * 327 * OS-dependent and compiler-dependent types 328 * 329 * If the defaults below are not appropriate for the host system, they can 330 * be defined in the compiler-specific or OS-specific header, and this will 331 * take precedence. 332 * 333 ******************************************************************************/ 334 335 336 /* Value returned by AcpiOsGetThreadId */ 337 338 #ifndef ACPI_THREAD_ID 339 #define ACPI_THREAD_ID ACPI_NATIVE_UINT 340 #endif 341 342 /* Object returned from AcpiOsCreateLock */ 343 344 #ifndef ACPI_SPINLOCK 345 #define ACPI_SPINLOCK void * 346 #endif 347 348 /* Flags for AcpiOsAcquireLock/AcpiOsReleaseLock */ 349 350 #ifndef ACPI_CPU_FLAGS 351 #define ACPI_CPU_FLAGS ACPI_NATIVE_UINT 352 #endif 353 354 /* Object returned from AcpiOsCreateCache */ 355 356 #ifndef ACPI_CACHE_T 357 #define ACPI_CACHE_T ACPI_MEMORY_LIST 358 #endif 359 360 /* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */ 361 362 #ifndef ACPI_UINTPTR_T 363 #define ACPI_UINTPTR_T void * 364 #endif 365 366 /* 367 * ACPI_PRINTF_LIKE is used to tag functions as "printf-like" because 368 * some compilers can catch printf format string problems 369 */ 370 #ifndef ACPI_PRINTF_LIKE 371 #define ACPI_PRINTF_LIKE(c) 372 #endif 373 374 /* 375 * Some compilers complain about unused variables. Sometimes we don't want to 376 * use all the variables (for example, _AcpiModuleName). This allows us 377 * to to tell the compiler in a per-variable manner that a variable 378 * is unused 379 */ 380 #ifndef ACPI_UNUSED_VAR 381 #define ACPI_UNUSED_VAR 382 #endif 383 384 /* 385 * All ACPICA functions that are available to the rest of the kernel are 386 * tagged with this macro which can be defined as appropriate for the host. 387 */ 388 #ifndef ACPI_EXPORT_SYMBOL 389 #define ACPI_EXPORT_SYMBOL(Symbol) 390 #endif 391 392 393 /******************************************************************************* 394 * 395 * Independent types 396 * 397 ******************************************************************************/ 398 399 /* 400 * Pointer overlays to avoid lots of typecasting for 401 * code that accepts both physical and logical pointers. 402 */ 403 typedef union acpi_pointers 404 { 405 ACPI_PHYSICAL_ADDRESS Physical; 406 void *Logical; 407 ACPI_TABLE_PTR Value; 408 409 } ACPI_POINTERS; 410 411 typedef struct acpi_pointer 412 { 413 UINT32 PointerType; 414 union acpi_pointers Pointer; 415 416 } ACPI_POINTER; 417 418 /* PointerTypes for above */ 419 420 #define ACPI_PHYSICAL_POINTER 0x01 421 #define ACPI_LOGICAL_POINTER 0x02 422 423 /* Processor mode */ 424 425 #define ACPI_PHYSICAL_ADDRESSING 0x04 426 #define ACPI_LOGICAL_ADDRESSING 0x08 427 #define ACPI_MEMORY_MODE 0x0C 428 429 #define ACPI_PHYSMODE_PHYSPTR ACPI_PHYSICAL_ADDRESSING | ACPI_PHYSICAL_POINTER 430 #define ACPI_LOGMODE_PHYSPTR ACPI_LOGICAL_ADDRESSING | ACPI_PHYSICAL_POINTER 431 #define ACPI_LOGMODE_LOGPTR ACPI_LOGICAL_ADDRESSING | ACPI_LOGICAL_POINTER 432 433 434 /* Logical defines and NULL */ 435 436 #ifdef FALSE 437 #undef FALSE 438 #endif 439 #define FALSE (1 == 0) 440 441 #ifdef TRUE 442 #undef TRUE 443 #endif 444 #define TRUE (1 == 1) 445 446 #ifndef NULL 447 #define NULL (void *) 0 448 #endif 449 450 451 /* 452 * Mescellaneous types 453 */ 454 typedef UINT32 ACPI_STATUS; /* All ACPI Exceptions */ 455 typedef UINT32 ACPI_NAME; /* 4-byte ACPI name */ 456 typedef char * ACPI_STRING; /* Null terminated ASCII string */ 457 typedef void * ACPI_HANDLE; /* Actually a ptr to a NS Node */ 458 459 typedef struct uint64_struct 460 { 461 UINT32 Lo; 462 UINT32 Hi; 463 464 } UINT64_STRUCT; 465 466 typedef union uint64_overlay 467 { 468 UINT64 Full; 469 UINT64_STRUCT Part; 470 471 } UINT64_OVERLAY; 472 473 typedef struct uint32_struct 474 { 475 UINT32 Lo; 476 UINT32 Hi; 477 478 } UINT32_STRUCT; 479 480 481 /* Synchronization objects */ 482 483 #define ACPI_MUTEX void * 484 #define ACPI_SEMAPHORE void * 485 486 487 /* 488 * Acpi integer width. In ACPI version 1, integers are 489 * 32 bits. In ACPI version 2, integers are 64 bits. 490 * Note that this pertains to the ACPI integer type only, not 491 * other integers used in the implementation of the ACPI CA 492 * subsystem. 493 */ 494 #ifdef ACPI_NO_INTEGER64_SUPPORT 495 496 /* 32-bit integers only, no 64-bit support */ 497 498 typedef UINT32 ACPI_INTEGER; 499 #define ACPI_INTEGER_MAX ACPI_UINT32_MAX 500 #define ACPI_INTEGER_BIT_SIZE 32 501 #define ACPI_MAX_DECIMAL_DIGITS 10 /* 2^32 = 4,294,967,296 */ 502 503 #define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 32-bit divide */ 504 505 506 #else 507 508 /* 64-bit integers */ 509 510 typedef UINT64 ACPI_INTEGER; 511 #define ACPI_INTEGER_MAX ACPI_UINT64_MAX 512 #define ACPI_INTEGER_BIT_SIZE 64 513 #define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */ 514 515 516 #if ACPI_MACHINE_WIDTH == 64 517 #define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 64-bit divide */ 518 #endif 519 #endif 520 521 #define ACPI_MAX64_DECIMAL_DIGITS 20 522 #define ACPI_MAX32_DECIMAL_DIGITS 10 523 #define ACPI_MAX16_DECIMAL_DIGITS 5 524 #define ACPI_MAX8_DECIMAL_DIGITS 3 525 526 /* 527 * Constants with special meanings 528 */ 529 #define ACPI_ROOT_OBJECT ACPI_ADD_PTR (ACPI_HANDLE, NULL, ACPI_MAX_PTR) 530 531 532 /* 533 * Initialization sequence 534 */ 535 #define ACPI_FULL_INITIALIZATION 0x00 536 #define ACPI_NO_ADDRESS_SPACE_INIT 0x01 537 #define ACPI_NO_HARDWARE_INIT 0x02 538 #define ACPI_NO_EVENT_INIT 0x04 539 #define ACPI_NO_HANDLER_INIT 0x08 540 #define ACPI_NO_ACPI_ENABLE 0x10 541 #define ACPI_NO_DEVICE_INIT 0x20 542 #define ACPI_NO_OBJECT_INIT 0x40 543 544 /* 545 * Initialization state 546 */ 547 #define ACPI_INITIALIZED_OK 0x01 548 549 /* 550 * Power state values 551 */ 552 #define ACPI_STATE_UNKNOWN (UINT8) 0xFF 553 554 #define ACPI_STATE_S0 (UINT8) 0 555 #define ACPI_STATE_S1 (UINT8) 1 556 #define ACPI_STATE_S2 (UINT8) 2 557 #define ACPI_STATE_S3 (UINT8) 3 558 #define ACPI_STATE_S4 (UINT8) 4 559 #define ACPI_STATE_S5 (UINT8) 5 560 #define ACPI_S_STATES_MAX ACPI_STATE_S5 561 #define ACPI_S_STATE_COUNT 6 562 563 #define ACPI_STATE_D0 (UINT8) 0 564 #define ACPI_STATE_D1 (UINT8) 1 565 #define ACPI_STATE_D2 (UINT8) 2 566 #define ACPI_STATE_D3 (UINT8) 3 567 #define ACPI_D_STATES_MAX ACPI_STATE_D3 568 #define ACPI_D_STATE_COUNT 4 569 570 #define ACPI_STATE_C0 (UINT8) 0 571 #define ACPI_STATE_C1 (UINT8) 1 572 #define ACPI_STATE_C2 (UINT8) 2 573 #define ACPI_STATE_C3 (UINT8) 3 574 #define ACPI_C_STATES_MAX ACPI_STATE_C3 575 #define ACPI_C_STATE_COUNT 4 576 577 /* 578 * Sleep type invalid value 579 */ 580 #define ACPI_SLEEP_TYPE_MAX 0x7 581 #define ACPI_SLEEP_TYPE_INVALID 0xFF 582 583 /* 584 * Standard notify values 585 */ 586 #define ACPI_NOTIFY_BUS_CHECK (UINT8) 0 587 #define ACPI_NOTIFY_DEVICE_CHECK (UINT8) 1 588 #define ACPI_NOTIFY_DEVICE_WAKE (UINT8) 2 589 #define ACPI_NOTIFY_EJECT_REQUEST (UINT8) 3 590 #define ACPI_NOTIFY_DEVICE_CHECK_LIGHT (UINT8) 4 591 #define ACPI_NOTIFY_FREQUENCY_MISMATCH (UINT8) 5 592 #define ACPI_NOTIFY_BUS_MODE_MISMATCH (UINT8) 6 593 #define ACPI_NOTIFY_POWER_FAULT (UINT8) 7 594 595 /* 596 * Table types. These values are passed to the table related APIs 597 */ 598 typedef UINT32 ACPI_TABLE_TYPE; 599 600 #define ACPI_TABLE_ID_RSDP (ACPI_TABLE_TYPE) 0 601 #define ACPI_TABLE_ID_DSDT (ACPI_TABLE_TYPE) 1 602 #define ACPI_TABLE_ID_FADT (ACPI_TABLE_TYPE) 2 603 #define ACPI_TABLE_ID_FACS (ACPI_TABLE_TYPE) 3 604 #define ACPI_TABLE_ID_PSDT (ACPI_TABLE_TYPE) 4 605 #define ACPI_TABLE_ID_SSDT (ACPI_TABLE_TYPE) 5 606 #define ACPI_TABLE_ID_XSDT (ACPI_TABLE_TYPE) 6 607 #define ACPI_TABLE_ID_MAX 6 608 #define ACPI_NUM_TABLE_TYPES (ACPI_TABLE_ID_MAX+1) 609 610 /* 611 * Types associated with ACPI names and objects. The first group of 612 * values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition 613 * of the ACPI ObjectType() operator (See the ACPI Spec). Therefore, 614 * only add to the first group if the spec changes. 615 * 616 * NOTE: Types must be kept in sync with the global AcpiNsProperties 617 * and AcpiNsTypeNames arrays. 618 */ 619 typedef UINT32 ACPI_OBJECT_TYPE; 620 621 #define ACPI_TYPE_ANY 0x00 622 #define ACPI_TYPE_INTEGER 0x01 /* Byte/Word/Dword/Zero/One/Ones */ 623 #define ACPI_TYPE_STRING 0x02 624 #define ACPI_TYPE_BUFFER 0x03 625 #define ACPI_TYPE_PACKAGE 0x04 /* ByteConst, multiple DataTerm/Constant/SuperName */ 626 #define ACPI_TYPE_FIELD_UNIT 0x05 627 #define ACPI_TYPE_DEVICE 0x06 /* Name, multiple Node */ 628 #define ACPI_TYPE_EVENT 0x07 629 #define ACPI_TYPE_METHOD 0x08 /* Name, ByteConst, multiple Code */ 630 #define ACPI_TYPE_MUTEX 0x09 631 #define ACPI_TYPE_REGION 0x0A 632 #define ACPI_TYPE_POWER 0x0B /* Name,ByteConst,WordConst,multi Node */ 633 #define ACPI_TYPE_PROCESSOR 0x0C /* Name,ByteConst,DWordConst,ByteConst,multi NmO */ 634 #define ACPI_TYPE_THERMAL 0x0D /* Name, multiple Node */ 635 #define ACPI_TYPE_BUFFER_FIELD 0x0E 636 #define ACPI_TYPE_DDB_HANDLE 0x0F 637 #define ACPI_TYPE_DEBUG_OBJECT 0x10 638 639 #define ACPI_TYPE_EXTERNAL_MAX 0x10 640 641 /* 642 * These are object types that do not map directly to the ACPI 643 * ObjectType() operator. They are used for various internal purposes only. 644 * If new predefined ACPI_TYPEs are added (via the ACPI specification), these 645 * internal types must move upwards. (There is code that depends on these 646 * values being contiguous with the external types above.) 647 */ 648 #define ACPI_TYPE_LOCAL_REGION_FIELD 0x11 649 #define ACPI_TYPE_LOCAL_BANK_FIELD 0x12 650 #define ACPI_TYPE_LOCAL_INDEX_FIELD 0x13 651 #define ACPI_TYPE_LOCAL_REFERENCE 0x14 /* Arg#, Local#, Name, Debug, RefOf, Index */ 652 #define ACPI_TYPE_LOCAL_ALIAS 0x15 653 #define ACPI_TYPE_LOCAL_METHOD_ALIAS 0x16 654 #define ACPI_TYPE_LOCAL_NOTIFY 0x17 655 #define ACPI_TYPE_LOCAL_ADDRESS_HANDLER 0x18 656 #define ACPI_TYPE_LOCAL_RESOURCE 0x19 657 #define ACPI_TYPE_LOCAL_RESOURCE_FIELD 0x1A 658 #define ACPI_TYPE_LOCAL_SCOPE 0x1B /* 1 Name, multiple ObjectList Nodes */ 659 660 #define ACPI_TYPE_NS_NODE_MAX 0x1B /* Last typecode used within a NS Node */ 661 662 /* 663 * These are special object types that never appear in 664 * a Namespace node, only in an ACPI_OPERAND_OBJECT 665 */ 666 #define ACPI_TYPE_LOCAL_EXTRA 0x1C 667 #define ACPI_TYPE_LOCAL_DATA 0x1D 668 669 #define ACPI_TYPE_LOCAL_MAX 0x1D 670 671 /* All types above here are invalid */ 672 673 #define ACPI_TYPE_INVALID 0x1E 674 #define ACPI_TYPE_NOT_FOUND 0xFF 675 676 /* 677 * All I/O 678 */ 679 #define ACPI_READ 0 680 #define ACPI_WRITE 1 681 #define ACPI_IO_MASK 1 682 683 /* 684 * Event Types: Fixed & General Purpose 685 */ 686 typedef UINT32 ACPI_EVENT_TYPE; 687 688 /* 689 * Fixed events 690 */ 691 #define ACPI_EVENT_PMTIMER 0 692 #define ACPI_EVENT_GLOBAL 1 693 #define ACPI_EVENT_POWER_BUTTON 2 694 #define ACPI_EVENT_SLEEP_BUTTON 3 695 #define ACPI_EVENT_RTC 4 696 #define ACPI_EVENT_MAX 4 697 #define ACPI_NUM_FIXED_EVENTS ACPI_EVENT_MAX + 1 698 699 /* 700 * Event Status - Per event 701 * ------------- 702 * The encoding of ACPI_EVENT_STATUS is illustrated below. 703 * Note that a set bit (1) indicates the property is TRUE 704 * (e.g. if bit 0 is set then the event is enabled). 705 * +-------------+-+-+-+ 706 * | Bits 31:3 |2|1|0| 707 * +-------------+-+-+-+ 708 * | | | | 709 * | | | +- Enabled? 710 * | | +--- Enabled for wake? 711 * | +----- Set? 712 * +----------- <Reserved> 713 */ 714 typedef UINT32 ACPI_EVENT_STATUS; 715 716 #define ACPI_EVENT_FLAG_DISABLED (ACPI_EVENT_STATUS) 0x00 717 #define ACPI_EVENT_FLAG_ENABLED (ACPI_EVENT_STATUS) 0x01 718 #define ACPI_EVENT_FLAG_WAKE_ENABLED (ACPI_EVENT_STATUS) 0x02 719 #define ACPI_EVENT_FLAG_SET (ACPI_EVENT_STATUS) 0x04 720 721 /* 722 * General Purpose Events (GPE) 723 */ 724 #define ACPI_GPE_INVALID 0xFF 725 #define ACPI_GPE_MAX 0xFF 726 #define ACPI_NUM_GPE 256 727 728 #define ACPI_GPE_ENABLE 0 729 #define ACPI_GPE_DISABLE 1 730 731 732 /* 733 * GPE info flags - Per GPE 734 * +-+-+-+---+---+-+ 735 * |7|6|5|4:3|2:1|0| 736 * +-+-+-+---+---+-+ 737 * | | | | | | 738 * | | | | | +--- Interrupt type: Edge or Level Triggered 739 * | | | | +--- Type: Wake-only, Runtime-only, or wake/runtime 740 * | | | +--- Type of dispatch -- to method, handler, or none 741 * | | +--- Enabled for runtime? 742 * | +--- Enabled for wake? 743 * +--- System state when GPE ocurred (running/waking) 744 */ 745 #define ACPI_GPE_XRUPT_TYPE_MASK (UINT8) 0x01 746 #define ACPI_GPE_LEVEL_TRIGGERED (UINT8) 0x01 747 #define ACPI_GPE_EDGE_TRIGGERED (UINT8) 0x00 748 749 #define ACPI_GPE_TYPE_MASK (UINT8) 0x06 750 #define ACPI_GPE_TYPE_WAKE_RUN (UINT8) 0x06 751 #define ACPI_GPE_TYPE_WAKE (UINT8) 0x02 752 #define ACPI_GPE_TYPE_RUNTIME (UINT8) 0x04 /* Default */ 753 754 #define ACPI_GPE_DISPATCH_MASK (UINT8) 0x18 755 #define ACPI_GPE_DISPATCH_HANDLER (UINT8) 0x08 756 #define ACPI_GPE_DISPATCH_METHOD (UINT8) 0x10 757 #define ACPI_GPE_DISPATCH_NOT_USED (UINT8) 0x00 /* Default */ 758 759 #define ACPI_GPE_RUN_ENABLE_MASK (UINT8) 0x20 760 #define ACPI_GPE_RUN_ENABLED (UINT8) 0x20 761 #define ACPI_GPE_RUN_DISABLED (UINT8) 0x00 /* Default */ 762 763 #define ACPI_GPE_WAKE_ENABLE_MASK (UINT8) 0x40 764 #define ACPI_GPE_WAKE_ENABLED (UINT8) 0x40 765 #define ACPI_GPE_WAKE_DISABLED (UINT8) 0x00 /* Default */ 766 767 #define ACPI_GPE_ENABLE_MASK (UINT8) 0x60 /* Both run/wake */ 768 769 #define ACPI_GPE_SYSTEM_MASK (UINT8) 0x80 770 #define ACPI_GPE_SYSTEM_RUNNING (UINT8) 0x80 771 #define ACPI_GPE_SYSTEM_WAKING (UINT8) 0x00 772 773 /* 774 * Flags for GPE and Lock interfaces 775 */ 776 #define ACPI_EVENT_WAKE_ENABLE 0x2 /* AcpiGpeEnable */ 777 #define ACPI_EVENT_WAKE_DISABLE 0x2 /* AcpiGpeDisable */ 778 779 #define ACPI_NOT_ISR 0x1 780 #define ACPI_ISR 0x0 781 782 783 /* Notify types */ 784 785 #define ACPI_SYSTEM_NOTIFY 0x1 786 #define ACPI_DEVICE_NOTIFY 0x2 787 #define ACPI_ALL_NOTIFY 0x3 788 #define ACPI_MAX_NOTIFY_HANDLER_TYPE 0x3 789 790 #define ACPI_MAX_SYS_NOTIFY 0x7f 791 792 793 /* Address Space (Operation Region) Types */ 794 795 typedef UINT8 ACPI_ADR_SPACE_TYPE; 796 797 #define ACPI_ADR_SPACE_SYSTEM_MEMORY (ACPI_ADR_SPACE_TYPE) 0 798 #define ACPI_ADR_SPACE_SYSTEM_IO (ACPI_ADR_SPACE_TYPE) 1 799 #define ACPI_ADR_SPACE_PCI_CONFIG (ACPI_ADR_SPACE_TYPE) 2 800 #define ACPI_ADR_SPACE_EC (ACPI_ADR_SPACE_TYPE) 3 801 #define ACPI_ADR_SPACE_SMBUS (ACPI_ADR_SPACE_TYPE) 4 802 #define ACPI_ADR_SPACE_CMOS (ACPI_ADR_SPACE_TYPE) 5 803 #define ACPI_ADR_SPACE_PCI_BAR_TARGET (ACPI_ADR_SPACE_TYPE) 6 804 #define ACPI_ADR_SPACE_DATA_TABLE (ACPI_ADR_SPACE_TYPE) 7 805 #define ACPI_ADR_SPACE_FIXED_HARDWARE (ACPI_ADR_SPACE_TYPE) 127 806 807 808 /* 809 * BitRegister IDs 810 * These are bitfields defined within the full ACPI registers 811 */ 812 #define ACPI_BITREG_TIMER_STATUS 0x00 813 #define ACPI_BITREG_BUS_MASTER_STATUS 0x01 814 #define ACPI_BITREG_GLOBAL_LOCK_STATUS 0x02 815 #define ACPI_BITREG_POWER_BUTTON_STATUS 0x03 816 #define ACPI_BITREG_SLEEP_BUTTON_STATUS 0x04 817 #define ACPI_BITREG_RT_CLOCK_STATUS 0x05 818 #define ACPI_BITREG_WAKE_STATUS 0x06 819 #define ACPI_BITREG_PCIEXP_WAKE_STATUS 0x07 820 821 #define ACPI_BITREG_TIMER_ENABLE 0x08 822 #define ACPI_BITREG_GLOBAL_LOCK_ENABLE 0x09 823 #define ACPI_BITREG_POWER_BUTTON_ENABLE 0x0A 824 #define ACPI_BITREG_SLEEP_BUTTON_ENABLE 0x0B 825 #define ACPI_BITREG_RT_CLOCK_ENABLE 0x0C 826 #define ACPI_BITREG_WAKE_ENABLE 0x0D 827 #define ACPI_BITREG_PCIEXP_WAKE_DISABLE 0x0E 828 829 #define ACPI_BITREG_SCI_ENABLE 0x0F 830 #define ACPI_BITREG_BUS_MASTER_RLD 0x10 831 #define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x11 832 #define ACPI_BITREG_SLEEP_TYPE_A 0x12 833 #define ACPI_BITREG_SLEEP_TYPE_B 0x13 834 #define ACPI_BITREG_SLEEP_ENABLE 0x14 835 836 #define ACPI_BITREG_ARB_DISABLE 0x15 837 838 #define ACPI_BITREG_MAX 0x15 839 #define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1 840 841 842 /* 843 * External ACPI object definition 844 */ 845 typedef union acpi_object 846 { 847 ACPI_OBJECT_TYPE Type; /* See definition of AcpiNsType for values */ 848 struct 849 { 850 ACPI_OBJECT_TYPE Type; 851 ACPI_INTEGER Value; /* The actual number */ 852 } Integer; 853 854 struct 855 { 856 ACPI_OBJECT_TYPE Type; 857 UINT32 Length; /* # of bytes in string, excluding trailing null */ 858 char *Pointer; /* points to the string value */ 859 } String; 860 861 struct 862 { 863 ACPI_OBJECT_TYPE Type; 864 UINT32 Length; /* # of bytes in buffer */ 865 UINT8 *Pointer; /* points to the buffer */ 866 } Buffer; 867 868 struct 869 { 870 ACPI_OBJECT_TYPE Type; 871 UINT32 Fill1; 872 ACPI_HANDLE Handle; /* object reference */ 873 } Reference; 874 875 struct 876 { 877 ACPI_OBJECT_TYPE Type; 878 UINT32 Count; /* # of elements in package */ 879 union acpi_object *Elements; /* Pointer to an array of ACPI_OBJECTs */ 880 } Package; 881 882 struct 883 { 884 ACPI_OBJECT_TYPE Type; 885 UINT32 ProcId; 886 ACPI_IO_ADDRESS PblkAddress; 887 UINT32 PblkLength; 888 } Processor; 889 890 struct 891 { 892 ACPI_OBJECT_TYPE Type; 893 UINT32 SystemLevel; 894 UINT32 ResourceOrder; 895 } PowerResource; 896 897 } ACPI_OBJECT; 898 899 900 /* 901 * List of objects, used as a parameter list for control method evaluation 902 */ 903 typedef struct acpi_object_list 904 { 905 UINT32 Count; 906 ACPI_OBJECT *Pointer; 907 908 } ACPI_OBJECT_LIST; 909 910 911 /* 912 * Miscellaneous common Data Structures used by the interfaces 913 */ 914 #define ACPI_NO_BUFFER 0 915 #define ACPI_ALLOCATE_BUFFER (ACPI_SIZE) (-1) 916 #define ACPI_ALLOCATE_LOCAL_BUFFER (ACPI_SIZE) (-2) 917 918 typedef struct acpi_buffer 919 { 920 ACPI_SIZE Length; /* Length in bytes of the buffer */ 921 void *Pointer; /* pointer to buffer */ 922 923 } ACPI_BUFFER; 924 925 926 /* 927 * NameType for AcpiGetName 928 */ 929 #define ACPI_FULL_PATHNAME 0 930 #define ACPI_SINGLE_NAME 1 931 #define ACPI_NAME_TYPE_MAX 1 932 933 934 /* 935 * Structure and flags for AcpiGetSystemInfo 936 */ 937 #define ACPI_SYS_MODE_UNKNOWN 0x0000 938 #define ACPI_SYS_MODE_ACPI 0x0001 939 #define ACPI_SYS_MODE_LEGACY 0x0002 940 #define ACPI_SYS_MODES_MASK 0x0003 941 942 943 /* 944 * ACPI Table Info. One per ACPI table _type_ 945 */ 946 typedef struct acpi_table_info 947 { 948 UINT32 Count; 949 950 } ACPI_TABLE_INFO; 951 952 953 /* 954 * System info returned by AcpiGetSystemInfo() 955 */ 956 typedef struct acpi_system_info 957 { 958 UINT32 AcpiCaVersion; 959 UINT32 Flags; 960 UINT32 TimerResolution; 961 UINT32 Reserved1; 962 UINT32 Reserved2; 963 UINT32 DebugLevel; 964 UINT32 DebugLayer; 965 UINT32 NumTableTypes; 966 ACPI_TABLE_INFO TableInfo [ACPI_TABLE_ID_MAX+1]; 967 968 } ACPI_SYSTEM_INFO; 969 970 971 /* 972 * Types specific to the OS service interfaces 973 */ 974 typedef UINT32 975 (ACPI_SYSTEM_XFACE *ACPI_OSD_HANDLER) ( 976 void *Context); 977 978 typedef void 979 (ACPI_SYSTEM_XFACE *ACPI_OSD_EXEC_CALLBACK) ( 980 void *Context); 981 982 /* 983 * Various handlers and callback procedures 984 */ 985 typedef 986 UINT32 (*ACPI_EVENT_HANDLER) ( 987 void *Context); 988 989 typedef 990 void (*ACPI_NOTIFY_HANDLER) ( 991 ACPI_HANDLE Device, 992 UINT32 Value, 993 void *Context); 994 995 typedef 996 void (*ACPI_OBJECT_HANDLER) ( 997 ACPI_HANDLE Object, 998 UINT32 Function, 999 void *Data); 1000 1001 typedef 1002 ACPI_STATUS (*ACPI_INIT_HANDLER) ( 1003 ACPI_HANDLE Object, 1004 UINT32 Function); 1005 1006 #define ACPI_INIT_DEVICE_INI 1 1007 1008 typedef 1009 ACPI_STATUS (*ACPI_EXCEPTION_HANDLER) ( 1010 ACPI_STATUS AmlStatus, 1011 ACPI_NAME Name, 1012 UINT16 Opcode, 1013 UINT32 AmlOffset, 1014 void *Context); 1015 1016 1017 /* Address Spaces (For Operation Regions) */ 1018 1019 typedef 1020 ACPI_STATUS (*ACPI_ADR_SPACE_HANDLER) ( 1021 UINT32 Function, 1022 ACPI_PHYSICAL_ADDRESS Address, 1023 UINT32 BitWidth, 1024 ACPI_INTEGER *Value, 1025 void *HandlerContext, 1026 void *RegionContext); 1027 1028 #define ACPI_DEFAULT_HANDLER NULL 1029 1030 1031 typedef 1032 ACPI_STATUS (*ACPI_ADR_SPACE_SETUP) ( 1033 ACPI_HANDLE RegionHandle, 1034 UINT32 Function, 1035 void *HandlerContext, 1036 void **RegionContext); 1037 1038 #define ACPI_REGION_ACTIVATE 0 1039 #define ACPI_REGION_DEACTIVATE 1 1040 1041 typedef 1042 ACPI_STATUS (*ACPI_WALK_CALLBACK) ( 1043 ACPI_HANDLE ObjHandle, 1044 UINT32 NestingLevel, 1045 void *Context, 1046 void **ReturnValue); 1047 1048 1049 /* Interrupt handler return values */ 1050 1051 #define ACPI_INTERRUPT_NOT_HANDLED 0x00 1052 #define ACPI_INTERRUPT_HANDLED 0x01 1053 1054 1055 /* Common string version of device HIDs and UIDs */ 1056 1057 typedef struct acpi_device_id 1058 { 1059 char Value[ACPI_DEVICE_ID_LENGTH]; 1060 1061 } ACPI_DEVICE_ID; 1062 1063 /* Common string version of device CIDs */ 1064 1065 typedef struct acpi_compatible_id 1066 { 1067 char Value[ACPI_MAX_CID_LENGTH]; 1068 1069 } ACPI_COMPATIBLE_ID; 1070 1071 typedef struct acpi_compatible_id_list 1072 { 1073 UINT32 Count; 1074 UINT32 Size; 1075 ACPI_COMPATIBLE_ID Id[1]; 1076 1077 } ACPI_COMPATIBLE_ID_LIST; 1078 1079 1080 /* Structure and flags for AcpiGetObjectInfo */ 1081 1082 #define ACPI_VALID_STA 0x0001 1083 #define ACPI_VALID_ADR 0x0002 1084 #define ACPI_VALID_HID 0x0004 1085 #define ACPI_VALID_UID 0x0008 1086 #define ACPI_VALID_CID 0x0010 1087 #define ACPI_VALID_SXDS 0x0020 1088 1089 /* Flags for _STA method */ 1090 1091 #define ACPI_STA_DEVICE_PRESENT 0x01 1092 #define ACPI_STA_DEVICE_ENABLED 0x02 1093 #define ACPI_STA_DEVICE_UI 0x04 1094 #define ACPI_STA_DEVICE_FUNCTIONING 0x08 1095 #define ACPI_STA_DEVICE_OK 0x08 /* Synonym */ 1096 #define ACPI_STA_BATTERY_PRESENT 0x10 1097 1098 1099 #define ACPI_COMMON_OBJ_INFO \ 1100 ACPI_OBJECT_TYPE Type; /* ACPI object type */ \ 1101 ACPI_NAME Name /* ACPI object Name */ 1102 1103 1104 typedef struct acpi_obj_info_header 1105 { 1106 ACPI_COMMON_OBJ_INFO; 1107 1108 } ACPI_OBJ_INFO_HEADER; 1109 1110 1111 /* Structure returned from Get Object Info */ 1112 1113 typedef struct acpi_device_info 1114 { 1115 ACPI_COMMON_OBJ_INFO; 1116 1117 UINT32 Valid; /* Indicates which fields below are valid */ 1118 UINT32 CurrentStatus; /* _STA value */ 1119 ACPI_INTEGER Address; /* _ADR value if any */ 1120 ACPI_DEVICE_ID HardwareId; /* _HID value if any */ 1121 ACPI_DEVICE_ID UniqueId; /* _UID value if any */ 1122 UINT8 HighestDstates[4]; /* _SxD values: 0xFF indicates not valid */ 1123 ACPI_COMPATIBLE_ID_LIST CompatibilityId; /* List of _CIDs if any */ 1124 1125 } ACPI_DEVICE_INFO; 1126 1127 1128 /* Context structs for address space handlers */ 1129 1130 typedef struct acpi_pci_id 1131 { 1132 UINT16 Segment; 1133 UINT16 Bus; 1134 UINT16 Device; 1135 UINT16 Function; 1136 1137 } ACPI_PCI_ID; 1138 1139 1140 typedef struct acpi_mem_space_context 1141 { 1142 UINT32 Length; 1143 ACPI_PHYSICAL_ADDRESS Address; 1144 ACPI_PHYSICAL_ADDRESS MappedPhysicalAddress; 1145 UINT8 *MappedLogicalAddress; 1146 ACPI_SIZE MappedLength; 1147 1148 } ACPI_MEM_SPACE_CONTEXT; 1149 1150 1151 /* 1152 * Definitions for Resource Attributes 1153 */ 1154 typedef UINT16 ACPI_RS_LENGTH; /* Resource Length field is fixed at 16 bits */ 1155 typedef UINT32 ACPI_RSDESC_SIZE; /* Max Resource Descriptor size is (Length+3) = (64K-1)+3 */ 1156 1157 /* 1158 * Memory Attributes 1159 */ 1160 #define ACPI_READ_ONLY_MEMORY (UINT8) 0x00 1161 #define ACPI_READ_WRITE_MEMORY (UINT8) 0x01 1162 1163 #define ACPI_NON_CACHEABLE_MEMORY (UINT8) 0x00 1164 #define ACPI_CACHABLE_MEMORY (UINT8) 0x01 1165 #define ACPI_WRITE_COMBINING_MEMORY (UINT8) 0x02 1166 #define ACPI_PREFETCHABLE_MEMORY (UINT8) 0x03 1167 1168 /* 1169 * IO Attributes 1170 * The ISA IO ranges are: n000-n0FFh, n400-n4FFh, n800-n8FFh, nC00-nCFFh. 1171 * The non-ISA IO ranges are: n100-n3FFh, n500-n7FFh, n900-nBFFh, nCD0-nFFFh. 1172 */ 1173 #define ACPI_NON_ISA_ONLY_RANGES (UINT8) 0x01 1174 #define ACPI_ISA_ONLY_RANGES (UINT8) 0x02 1175 #define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES) 1176 1177 /* Type of translation - 1=Sparse, 0=Dense */ 1178 1179 #define ACPI_SPARSE_TRANSLATION (UINT8) 0x01 1180 1181 /* 1182 * IO Port Descriptor Decode 1183 */ 1184 #define ACPI_DECODE_10 (UINT8) 0x00 /* 10-bit IO address decode */ 1185 #define ACPI_DECODE_16 (UINT8) 0x01 /* 16-bit IO address decode */ 1186 1187 /* 1188 * IRQ Attributes 1189 */ 1190 #define ACPI_LEVEL_SENSITIVE (UINT8) 0x00 1191 #define ACPI_EDGE_SENSITIVE (UINT8) 0x01 1192 1193 #define ACPI_ACTIVE_HIGH (UINT8) 0x00 1194 #define ACPI_ACTIVE_LOW (UINT8) 0x01 1195 1196 #define ACPI_EXCLUSIVE (UINT8) 0x00 1197 #define ACPI_SHARED (UINT8) 0x01 1198 1199 /* 1200 * DMA Attributes 1201 */ 1202 #define ACPI_COMPATIBILITY (UINT8) 0x00 1203 #define ACPI_TYPE_A (UINT8) 0x01 1204 #define ACPI_TYPE_B (UINT8) 0x02 1205 #define ACPI_TYPE_F (UINT8) 0x03 1206 1207 #define ACPI_NOT_BUS_MASTER (UINT8) 0x00 1208 #define ACPI_BUS_MASTER (UINT8) 0x01 1209 1210 #define ACPI_TRANSFER_8 (UINT8) 0x00 1211 #define ACPI_TRANSFER_8_16 (UINT8) 0x01 1212 #define ACPI_TRANSFER_16 (UINT8) 0x02 1213 1214 /* 1215 * Start Dependent Functions Priority definitions 1216 */ 1217 #define ACPI_GOOD_CONFIGURATION (UINT8) 0x00 1218 #define ACPI_ACCEPTABLE_CONFIGURATION (UINT8) 0x01 1219 #define ACPI_SUB_OPTIMAL_CONFIGURATION (UINT8) 0x02 1220 1221 /* 1222 * 16, 32 and 64-bit Address Descriptor resource types 1223 */ 1224 #define ACPI_MEMORY_RANGE (UINT8) 0x00 1225 #define ACPI_IO_RANGE (UINT8) 0x01 1226 #define ACPI_BUS_NUMBER_RANGE (UINT8) 0x02 1227 1228 #define ACPI_ADDRESS_NOT_FIXED (UINT8) 0x00 1229 #define ACPI_ADDRESS_FIXED (UINT8) 0x01 1230 1231 #define ACPI_POS_DECODE (UINT8) 0x00 1232 #define ACPI_SUB_DECODE (UINT8) 0x01 1233 1234 #define ACPI_PRODUCER (UINT8) 0x00 1235 #define ACPI_CONSUMER (UINT8) 0x01 1236 1237 1238 /* 1239 * If possible, pack the following structures to byte alignment 1240 */ 1241 #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED 1242 #pragma pack(1) 1243 #endif 1244 1245 /* UUID data structures for use in vendor-defined resource descriptors */ 1246 1247 typedef struct acpi_uuid 1248 { 1249 UINT8 Data[ACPI_UUID_LENGTH]; 1250 } ACPI_UUID; 1251 1252 typedef struct acpi_vendor_uuid 1253 { 1254 UINT8 Subtype; 1255 UINT8 Data[ACPI_UUID_LENGTH]; 1256 1257 } ACPI_VENDOR_UUID; 1258 1259 /* 1260 * Structures used to describe device resources 1261 */ 1262 typedef struct acpi_resource_irq 1263 { 1264 UINT8 Triggering; 1265 UINT8 Polarity; 1266 UINT8 Sharable; 1267 UINT8 InterruptCount; 1268 UINT8 Interrupts[1]; 1269 1270 } ACPI_RESOURCE_IRQ; 1271 1272 1273 typedef struct ACPI_RESOURCE_DMA 1274 { 1275 UINT8 Type; 1276 UINT8 BusMaster; 1277 UINT8 Transfer; 1278 UINT8 ChannelCount; 1279 UINT8 Channels[1]; 1280 1281 } ACPI_RESOURCE_DMA; 1282 1283 1284 typedef struct acpi_resource_start_dependent 1285 { 1286 UINT8 CompatibilityPriority; 1287 UINT8 PerformanceRobustness; 1288 1289 } ACPI_RESOURCE_START_DEPENDENT; 1290 1291 1292 /* 1293 * END_DEPENDENT_FUNCTIONS_RESOURCE struct is not 1294 * needed because it has no fields 1295 */ 1296 1297 1298 typedef struct acpi_resource_io 1299 { 1300 UINT8 IoDecode; 1301 UINT8 Alignment; 1302 UINT8 AddressLength; 1303 UINT16 Minimum; 1304 UINT16 Maximum; 1305 1306 } ACPI_RESOURCE_IO; 1307 1308 typedef struct acpi_resource_fixed_io 1309 { 1310 UINT16 Address; 1311 UINT8 AddressLength; 1312 1313 } ACPI_RESOURCE_FIXED_IO; 1314 1315 typedef struct acpi_resource_vendor 1316 { 1317 UINT16 ByteLength; 1318 UINT8 ByteData[1]; 1319 1320 } ACPI_RESOURCE_VENDOR; 1321 1322 /* Vendor resource with UUID info (introduced in ACPI 3.0) */ 1323 1324 typedef struct acpi_resource_vendor_typed 1325 { 1326 UINT16 ByteLength; 1327 UINT8 UuidSubtype; 1328 UINT8 Uuid[ACPI_UUID_LENGTH]; 1329 UINT8 ByteData[1]; 1330 1331 } ACPI_RESOURCE_VENDOR_TYPED; 1332 1333 typedef struct acpi_resource_end_tag 1334 { 1335 UINT8 Checksum; 1336 1337 } ACPI_RESOURCE_END_TAG; 1338 1339 typedef struct acpi_resource_memory24 1340 { 1341 UINT8 WriteProtect; 1342 UINT16 Minimum; 1343 UINT16 Maximum; 1344 UINT16 Alignment; 1345 UINT16 AddressLength; 1346 1347 } ACPI_RESOURCE_MEMORY24; 1348 1349 typedef struct acpi_resource_memory32 1350 { 1351 UINT8 WriteProtect; 1352 UINT32 Minimum; 1353 UINT32 Maximum; 1354 UINT32 Alignment; 1355 UINT32 AddressLength; 1356 1357 } ACPI_RESOURCE_MEMORY32; 1358 1359 typedef struct acpi_resource_fixed_memory32 1360 { 1361 UINT8 WriteProtect; 1362 UINT32 Address; 1363 UINT32 AddressLength; 1364 1365 } ACPI_RESOURCE_FIXED_MEMORY32; 1366 1367 typedef struct acpi_memory_attribute 1368 { 1369 UINT8 WriteProtect; 1370 UINT8 Caching; 1371 UINT8 RangeType; 1372 UINT8 Translation; 1373 1374 } ACPI_MEMORY_ATTRIBUTE; 1375 1376 typedef struct acpi_io_attribute 1377 { 1378 UINT8 RangeType; 1379 UINT8 Translation; 1380 UINT8 TranslationType; 1381 UINT8 Reserved1; 1382 1383 } ACPI_IO_ATTRIBUTE; 1384 1385 typedef union acpi_resource_attribute 1386 { 1387 ACPI_MEMORY_ATTRIBUTE Mem; 1388 ACPI_IO_ATTRIBUTE Io; 1389 1390 /* Used for the *WordSpace macros */ 1391 1392 UINT8 TypeSpecific; 1393 1394 } ACPI_RESOURCE_ATTRIBUTE; 1395 1396 typedef struct acpi_resource_source 1397 { 1398 UINT8 Index; 1399 UINT16 StringLength; 1400 char *StringPtr; 1401 1402 } ACPI_RESOURCE_SOURCE; 1403 1404 /* Fields common to all address descriptors, 16/32/64 bit */ 1405 1406 #define ACPI_RESOURCE_ADDRESS_COMMON \ 1407 UINT8 ResourceType; \ 1408 UINT8 ProducerConsumer; \ 1409 UINT8 Decode; \ 1410 UINT8 MinAddressFixed; \ 1411 UINT8 MaxAddressFixed; \ 1412 ACPI_RESOURCE_ATTRIBUTE Info; 1413 1414 typedef struct acpi_resource_address 1415 { 1416 ACPI_RESOURCE_ADDRESS_COMMON 1417 1418 } ACPI_RESOURCE_ADDRESS; 1419 1420 typedef struct acpi_resource_address16 1421 { 1422 ACPI_RESOURCE_ADDRESS_COMMON 1423 UINT16 Granularity; 1424 UINT16 Minimum; 1425 UINT16 Maximum; 1426 UINT16 TranslationOffset; 1427 UINT16 AddressLength; 1428 ACPI_RESOURCE_SOURCE ResourceSource; 1429 1430 } ACPI_RESOURCE_ADDRESS16; 1431 1432 typedef struct acpi_resource_address32 1433 { 1434 ACPI_RESOURCE_ADDRESS_COMMON 1435 UINT32 Granularity; 1436 UINT32 Minimum; 1437 UINT32 Maximum; 1438 UINT32 TranslationOffset; 1439 UINT32 AddressLength; 1440 ACPI_RESOURCE_SOURCE ResourceSource; 1441 1442 } ACPI_RESOURCE_ADDRESS32; 1443 1444 typedef struct acpi_resource_address64 1445 { 1446 ACPI_RESOURCE_ADDRESS_COMMON 1447 UINT64 Granularity; 1448 UINT64 Minimum; 1449 UINT64 Maximum; 1450 UINT64 TranslationOffset; 1451 UINT64 AddressLength; 1452 ACPI_RESOURCE_SOURCE ResourceSource; 1453 1454 } ACPI_RESOURCE_ADDRESS64; 1455 1456 typedef struct acpi_resource_extended_address64 1457 { 1458 ACPI_RESOURCE_ADDRESS_COMMON 1459 UINT8 RevisionID; 1460 UINT64 Granularity; 1461 UINT64 Minimum; 1462 UINT64 Maximum; 1463 UINT64 TranslationOffset; 1464 UINT64 AddressLength; 1465 UINT64 TypeSpecific; 1466 1467 } ACPI_RESOURCE_EXTENDED_ADDRESS64; 1468 1469 typedef struct acpi_resource_extended_irq 1470 { 1471 UINT8 ProducerConsumer; 1472 UINT8 Triggering; 1473 UINT8 Polarity; 1474 UINT8 Sharable; 1475 UINT8 InterruptCount; 1476 ACPI_RESOURCE_SOURCE ResourceSource; 1477 UINT32 Interrupts[1]; 1478 1479 } ACPI_RESOURCE_EXTENDED_IRQ; 1480 1481 typedef struct acpi_resource_generic_register 1482 { 1483 UINT8 SpaceId; 1484 UINT8 BitWidth; 1485 UINT8 BitOffset; 1486 UINT8 AccessSize; 1487 UINT64 Address; 1488 1489 } ACPI_RESOURCE_GENERIC_REGISTER; 1490 1491 1492 /* ACPI_RESOURCE_TYPEs */ 1493 1494 #define ACPI_RESOURCE_TYPE_IRQ 0 1495 #define ACPI_RESOURCE_TYPE_DMA 1 1496 #define ACPI_RESOURCE_TYPE_START_DEPENDENT 2 1497 #define ACPI_RESOURCE_TYPE_END_DEPENDENT 3 1498 #define ACPI_RESOURCE_TYPE_IO 4 1499 #define ACPI_RESOURCE_TYPE_FIXED_IO 5 1500 #define ACPI_RESOURCE_TYPE_VENDOR 6 1501 #define ACPI_RESOURCE_TYPE_END_TAG 7 1502 #define ACPI_RESOURCE_TYPE_MEMORY24 8 1503 #define ACPI_RESOURCE_TYPE_MEMORY32 9 1504 #define ACPI_RESOURCE_TYPE_FIXED_MEMORY32 10 1505 #define ACPI_RESOURCE_TYPE_ADDRESS16 11 1506 #define ACPI_RESOURCE_TYPE_ADDRESS32 12 1507 #define ACPI_RESOURCE_TYPE_ADDRESS64 13 1508 #define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */ 1509 #define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15 1510 #define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16 1511 #define ACPI_RESOURCE_TYPE_MAX 16 1512 1513 1514 typedef union acpi_resource_data 1515 { 1516 ACPI_RESOURCE_IRQ Irq; 1517 ACPI_RESOURCE_DMA Dma; 1518 ACPI_RESOURCE_START_DEPENDENT StartDpf; 1519 ACPI_RESOURCE_IO Io; 1520 ACPI_RESOURCE_FIXED_IO FixedIo; 1521 ACPI_RESOURCE_VENDOR Vendor; 1522 ACPI_RESOURCE_VENDOR_TYPED VendorTyped; 1523 ACPI_RESOURCE_END_TAG EndTag; 1524 ACPI_RESOURCE_MEMORY24 Memory24; 1525 ACPI_RESOURCE_MEMORY32 Memory32; 1526 ACPI_RESOURCE_FIXED_MEMORY32 FixedMemory32; 1527 ACPI_RESOURCE_ADDRESS16 Address16; 1528 ACPI_RESOURCE_ADDRESS32 Address32; 1529 ACPI_RESOURCE_ADDRESS64 Address64; 1530 ACPI_RESOURCE_EXTENDED_ADDRESS64 ExtAddress64; 1531 ACPI_RESOURCE_EXTENDED_IRQ ExtendedIrq; 1532 ACPI_RESOURCE_GENERIC_REGISTER GenericReg; 1533 1534 /* Common fields */ 1535 1536 ACPI_RESOURCE_ADDRESS Address; /* Common 16/32/64 address fields */ 1537 1538 } ACPI_RESOURCE_DATA; 1539 1540 1541 typedef struct acpi_resource 1542 { 1543 UINT32 Type; 1544 UINT32 Length; 1545 ACPI_RESOURCE_DATA Data; 1546 1547 } ACPI_RESOURCE; 1548 1549 /* restore default alignment */ 1550 1551 #pragma pack() 1552 1553 1554 #define ACPI_RS_SIZE_MIN 12 1555 #define ACPI_RS_SIZE_NO_DATA 8 /* Id + Length fields */ 1556 #define ACPI_RS_SIZE(Type) (UINT32) (ACPI_RS_SIZE_NO_DATA + sizeof (Type)) 1557 1558 #define ACPI_NEXT_RESOURCE(Res) (ACPI_RESOURCE *)((UINT8 *) Res + Res->Length) 1559 1560 1561 typedef struct acpi_pci_routing_table 1562 { 1563 UINT32 Length; 1564 UINT32 Pin; 1565 ACPI_INTEGER Address; /* here for 64-bit alignment */ 1566 UINT32 SourceIndex; 1567 char Source[4]; /* pad to 64 bits so sizeof() works in all cases */ 1568 1569 } ACPI_PCI_ROUTING_TABLE; 1570 1571 1572 #endif /* __ACTYPES_H__ */ 1573