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