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