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