actypes.h revision 92388
1/****************************************************************************** 2 * 3 * Name: actypes.h - Common data types for the entire ACPI subsystem 4 * $Revision: 224 $ 5 * 6 *****************************************************************************/ 7 8/****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * 12 * Some or all of this work - Copyright (c) 1999 - 2002, 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 * Data types - Fixed across all compilation models 124 * 125 * BOOLEAN Logical Boolean. 126 * 1 byte value containing a 0 for FALSE or a 1 for TRUE. 127 * Other values are undefined. 128 * 129 * INT8 8-bit (1 byte) signed value 130 * UINT8 8-bit (1 byte) unsigned value 131 * INT16 16-bit (2 byte) signed value 132 * UINT16 16-bit (2 byte) unsigned value 133 * INT32 32-bit (4 byte) signed value 134 * UINT32 32-bit (4 byte) unsigned value 135 * INT64 64-bit (8 byte) signed value 136 * UINT64 64-bit (8 byte) unsigned value 137 * NATIVE_INT 32-bit on IA-32, 64-bit on IA-64 signed value 138 * NATIVE_UINT 32-bit on IA-32, 64-bit on IA-64 unsigned value 139 */ 140 141 142#ifdef _IA64 143/* 144 * 64-bit type definitions 145 */ 146typedef unsigned char UINT8; 147typedef unsigned char BOOLEAN; 148typedef unsigned short UINT16; 149typedef int INT32; 150typedef unsigned int UINT32; 151typedef COMPILER_DEPENDENT_UINT64 UINT64; 152 153typedef UINT64 NATIVE_UINT; 154typedef UINT64 NATIVE_INT; 155 156typedef NATIVE_UINT ACPI_TBLPTR; 157typedef UINT64 ACPI_IO_ADDRESS; 158typedef UINT64 ACPI_PHYSICAL_ADDRESS; 159typedef UINT64 ACPI_SIZE; 160 161#define ALIGNED_ADDRESS_BOUNDARY 0x00000008 /* No hardware alignment support in IA64 */ 162#define ACPI_USE_NATIVE_DIVIDE /* Native 64-bit integer support */ 163#define ACPI_MAX_PTR 0xFFFFFFFFFFFFFFFF 164 165 166#elif _IA16 167/* 168 * 16-bit type definitions 169 */ 170typedef unsigned char UINT8; 171typedef unsigned char BOOLEAN; 172typedef unsigned int UINT16; 173typedef long INT32; 174typedef int INT16; 175typedef unsigned long UINT32; 176 177typedef struct 178{ 179 UINT32 Lo; 180 UINT32 Hi; 181 182} UINT64; 183 184typedef UINT16 NATIVE_UINT; 185typedef INT16 NATIVE_INT; 186 187typedef UINT32 ACPI_TBLPTR; 188typedef UINT32 ACPI_IO_ADDRESS; 189typedef char *ACPI_PHYSICAL_ADDRESS; 190typedef UINT32 ACPI_SIZE; 191 192#define ALIGNED_ADDRESS_BOUNDARY 0x00000002 193#define _HW_ALIGNMENT_SUPPORT 194#define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ 195#define ACPI_MAX_PTR 0xFFFF 196 197/* 198 * (16-bit only) internal integers must be 32-bits, so 199 * 64-bit integers cannot be supported 200 */ 201#define ACPI_NO_INTEGER64_SUPPORT 202 203 204#else 205/* 206 * 32-bit type definitions (default) 207 */ 208typedef unsigned char UINT8; 209typedef unsigned char BOOLEAN; 210typedef unsigned short UINT16; 211typedef int INT32; 212typedef unsigned int UINT32; 213typedef COMPILER_DEPENDENT_UINT64 UINT64; 214 215typedef UINT32 NATIVE_UINT; 216typedef INT32 NATIVE_INT; 217 218typedef NATIVE_UINT ACPI_TBLPTR; 219typedef UINT32 ACPI_IO_ADDRESS; 220typedef UINT64 ACPI_PHYSICAL_ADDRESS; 221typedef UINT32 ACPI_SIZE; 222 223#define ALIGNED_ADDRESS_BOUNDARY 0x00000004 224#define _HW_ALIGNMENT_SUPPORT 225#define ACPI_MAX_PTR 0xFFFFFFFF 226#endif 227 228 229 230/* 231 * Miscellaneous common types 232 */ 233 234typedef UINT32 UINT32_BIT; 235typedef NATIVE_UINT ACPI_PTRDIFF; 236typedef char NATIVE_CHAR; 237 238 239/* 240 * Data type ranges 241 */ 242 243#define ACPI_UINT8_MAX (UINT8) 0xFF 244#define ACPI_UINT16_MAX (UINT16) 0xFFFF 245#define ACPI_UINT32_MAX (UINT32) 0xFFFFFFFF 246#define ACPI_UINT64_MAX (UINT64) 0xFFFFFFFFFFFFFFFF 247#define ACPI_ASCII_MAX 0x7F 248 249 250#ifdef DEFINE_ALTERNATE_TYPES 251/* 252 * Types used only in translated source, defined here to enable 253 * cross-platform compilation only. 254 */ 255typedef INT32 s32; 256typedef UINT8 u8; 257typedef UINT16 u16; 258typedef UINT32 u32; 259typedef UINT64 u64; 260#endif 261/*! [End] no source code translation !*/ 262 263 264/* 265 * Useful defines 266 */ 267 268#ifdef FALSE 269#undef FALSE 270#endif 271#define FALSE (1 == 0) 272 273#ifdef TRUE 274#undef TRUE 275#endif 276#define TRUE (1 == 1) 277 278#ifndef NULL 279#define NULL (void *) 0 280#endif 281 282 283/* 284 * Local datatypes 285 */ 286 287typedef UINT32 ACPI_STATUS; /* All ACPI Exceptions */ 288typedef UINT32 ACPI_NAME; /* 4-byte ACPI name */ 289typedef char* ACPI_STRING; /* Null terminated ASCII string */ 290typedef void* ACPI_HANDLE; /* Actually a ptr to an Node */ 291 292typedef struct 293{ 294 UINT32 Lo; 295 UINT32 Hi; 296 297} UINT64_STRUCT; 298 299typedef union 300{ 301 UINT64 Full; 302 UINT64_STRUCT Part; 303 304} UINT64_OVERLAY; 305 306 307/* 308 * Acpi integer width. In ACPI version 1, integers are 309 * 32 bits. In ACPI version 2, integers are 64 bits. 310 * Note that this pertains to the ACPI integer type only, not 311 * other integers used in the implementation of the ACPI CA 312 * subsystem. 313 */ 314#ifdef ACPI_NO_INTEGER64_SUPPORT 315 316/* 32-bit integers only, no 64-bit support */ 317 318typedef UINT32 ACPI_INTEGER; 319#define ACPI_INTEGER_MAX ACPI_UINT32_MAX 320#define ACPI_INTEGER_BIT_SIZE 32 321#define ACPI_MAX_BCD_VALUE 99999999 322#define ACPI_MAX_BCD_DIGITS 8 323#define ACPI_MAX_DECIMAL_DIGITS 10 324 325#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 32-bit divide */ 326 327 328#else 329 330/* 64-bit integers */ 331 332typedef UINT64 ACPI_INTEGER; 333#define ACPI_INTEGER_MAX ACPI_UINT64_MAX 334#define ACPI_INTEGER_BIT_SIZE 64 335#define ACPI_MAX_BCD_VALUE 9999999999999999 336#define ACPI_MAX_BCD_DIGITS 16 337#define ACPI_MAX_DECIMAL_DIGITS 19 338 339#ifdef _IA64 340#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 64-bit divide */ 341#endif 342#endif 343 344 345/* 346 * Constants with special meanings 347 */ 348 349#define ACPI_ROOT_OBJECT (ACPI_HANDLE) ACPI_PTR_ADD (char, NULL, ACPI_UINT32_MAX) 350 351 352/* 353 * Initialization sequence 354 */ 355#define ACPI_FULL_INITIALIZATION 0x00 356#define ACPI_NO_ADDRESS_SPACE_INIT 0x01 357#define ACPI_NO_HARDWARE_INIT 0x02 358#define ACPI_NO_EVENT_INIT 0x04 359#define ACPI_NO_HANDLER_INIT 0x08 360#define ACPI_NO_ACPI_ENABLE 0x10 361#define ACPI_NO_DEVICE_INIT 0x20 362#define ACPI_NO_OBJECT_INIT 0x40 363 364/* 365 * Initialization state 366 */ 367#define ACPI_INITIALIZED_OK 0x01 368 369/* 370 * Power state values 371 */ 372 373#define ACPI_STATE_UNKNOWN (UINT8) 0xFF 374 375#define ACPI_STATE_S0 (UINT8) 0 376#define ACPI_STATE_S1 (UINT8) 1 377#define ACPI_STATE_S2 (UINT8) 2 378#define ACPI_STATE_S3 (UINT8) 3 379#define ACPI_STATE_S4 (UINT8) 4 380#define ACPI_STATE_S5 (UINT8) 5 381#define ACPI_S_STATES_MAX ACPI_STATE_S5 382#define ACPI_S_STATE_COUNT 6 383 384#define ACPI_STATE_D0 (UINT8) 0 385#define ACPI_STATE_D1 (UINT8) 1 386#define ACPI_STATE_D2 (UINT8) 2 387#define ACPI_STATE_D3 (UINT8) 3 388#define ACPI_D_STATES_MAX ACPI_STATE_D3 389#define ACPI_D_STATE_COUNT 4 390 391#define ACPI_STATE_C0 (UINT8) 0 392#define ACPI_STATE_C1 (UINT8) 1 393#define ACPI_STATE_C2 (UINT8) 2 394#define ACPI_STATE_C3 (UINT8) 3 395#define ACPI_C_STATES_MAX ACPI_STATE_C3 396#define ACPI_C_STATE_COUNT 4 397 398/* 399 * Sleep type invalid value 400 */ 401#define ACPI_SLEEP_TYPE_MAX 0x7 402#define ACPI_SLEEP_TYPE_INVALID 0xFF 403 404/* 405 * Standard notify values 406 */ 407#define ACPI_NOTIFY_BUS_CHECK (UINT8) 0 408#define ACPI_NOTIFY_DEVICE_CHECK (UINT8) 1 409#define ACPI_NOTIFY_DEVICE_WAKE (UINT8) 2 410#define ACPI_NOTIFY_EJECT_REQUEST (UINT8) 3 411#define ACPI_NOTIFY_DEVICE_CHECK_LIGHT (UINT8) 4 412#define ACPI_NOTIFY_FREQUENCY_MISMATCH (UINT8) 5 413#define ACPI_NOTIFY_BUS_MODE_MISMATCH (UINT8) 6 414#define ACPI_NOTIFY_POWER_FAULT (UINT8) 7 415 416 417/* 418 * Table types. These values are passed to the table related APIs 419 */ 420 421typedef UINT32 ACPI_TABLE_TYPE; 422 423#define ACPI_TABLE_RSDP (ACPI_TABLE_TYPE) 0 424#define ACPI_TABLE_DSDT (ACPI_TABLE_TYPE) 1 425#define ACPI_TABLE_FADT (ACPI_TABLE_TYPE) 2 426#define ACPI_TABLE_FACS (ACPI_TABLE_TYPE) 3 427#define ACPI_TABLE_PSDT (ACPI_TABLE_TYPE) 4 428#define ACPI_TABLE_SSDT (ACPI_TABLE_TYPE) 5 429#define ACPI_TABLE_XSDT (ACPI_TABLE_TYPE) 6 430#define ACPI_TABLE_MAX 6 431#define NUM_ACPI_TABLES (ACPI_TABLE_MAX+1) 432 433 434/* 435 * Types associated with names. The first group of 436 * values correspond to the definition of the ACPI 437 * ObjectType operator (See the ACPI Spec). Therefore, 438 * only add to the first group if the spec changes. 439 * 440 * Types must be kept in sync with the AcpiNsProperties 441 * and AcpiNsTypeNames arrays 442 */ 443 444typedef UINT32 ACPI_OBJECT_TYPE; 445 446#define ACPI_TYPE_ANY 0x00 447#define ACPI_TYPE_INTEGER 0x01 /* Byte/Word/Dword/Zero/One/Ones */ 448#define ACPI_TYPE_STRING 0x02 449#define ACPI_TYPE_BUFFER 0x03 450#define ACPI_TYPE_PACKAGE 0x04 /* ByteConst, multiple DataTerm/Constant/SuperName */ 451#define ACPI_TYPE_FIELD_UNIT 0x05 452#define ACPI_TYPE_DEVICE 0x06 /* Name, multiple Node */ 453#define ACPI_TYPE_EVENT 0x07 454#define ACPI_TYPE_METHOD 0x08 /* Name, ByteConst, multiple Code */ 455#define ACPI_TYPE_MUTEX 0x09 456#define ACPI_TYPE_REGION 0x0A 457#define ACPI_TYPE_POWER 0x0B /* Name,ByteConst,WordConst,multi Node */ 458#define ACPI_TYPE_PROCESSOR 0x0C /* Name,ByteConst,DWordConst,ByteConst,multi NmO */ 459#define ACPI_TYPE_THERMAL 0x0D /* Name, multiple Node */ 460#define ACPI_TYPE_BUFFER_FIELD 0x0E 461#define ACPI_TYPE_DDB_HANDLE 0x0F 462#define ACPI_TYPE_DEBUG_OBJECT 0x10 463 464#define ACPI_TYPE_MAX 0x10 465 466/* 467 * This section contains object types that do not relate to the ACPI ObjectType operator. 468 * They are used for various internal purposes only. If new predefined ACPI_TYPEs are 469 * added (via the ACPI specification), these internal types must move upwards. 470 * Also, values exceeding the largest official ACPI ObjectType must not overlap with 471 * defined AML opcodes. 472 */ 473#define INTERNAL_TYPE_BEGIN 0x11 474 475#define INTERNAL_TYPE_REGION_FIELD 0x11 476#define INTERNAL_TYPE_BANK_FIELD 0x12 477#define INTERNAL_TYPE_INDEX_FIELD 0x13 478#define INTERNAL_TYPE_REFERENCE 0x14 /* Arg#, Local#, Name, Debug; used only in descriptors */ 479#define INTERNAL_TYPE_ALIAS 0x15 480#define INTERNAL_TYPE_NOTIFY 0x16 481#define INTERNAL_TYPE_ADDRESS_HANDLER 0x17 482#define INTERNAL_TYPE_RESOURCE 0x18 483#define INTERNAL_TYPE_RESOURCE_FIELD 0x19 484 485 486#define INTERNAL_TYPE_NODE_MAX 0x19 487 488/* These are pseudo-types because there are never any namespace nodes with these types */ 489 490#define INTERNAL_TYPE_FIELD_DEFN 0x1A /* Name, ByteConst, multiple FieldElement */ 491#define INTERNAL_TYPE_BANK_FIELD_DEFN 0x1B /* 2 Name,DWordConst,ByteConst,multi FieldElement */ 492#define INTERNAL_TYPE_INDEX_FIELD_DEFN 0x1C /* 2 Name, ByteConst, multiple FieldElement */ 493#define INTERNAL_TYPE_IF 0x1D 494#define INTERNAL_TYPE_ELSE 0x1E 495#define INTERNAL_TYPE_WHILE 0x1F 496#define INTERNAL_TYPE_SCOPE 0x20 /* Name, multiple Node */ 497#define INTERNAL_TYPE_DEF_ANY 0x21 /* type is Any, suppress search of enclosing scopes */ 498#define INTERNAL_TYPE_EXTRA 0x22 499#define INTERNAL_TYPE_DATA 0x23 500 501#define INTERNAL_TYPE_MAX 0x23 502 503#define INTERNAL_TYPE_INVALID 0x24 504#define ACPI_TYPE_NOT_FOUND 0xFF 505 506 507/* 508 * Bitmapped ACPI types 509 * Used internally only 510 */ 511#define ACPI_BTYPE_ANY 0x00000000 512#define ACPI_BTYPE_INTEGER 0x00000001 513#define ACPI_BTYPE_STRING 0x00000002 514#define ACPI_BTYPE_BUFFER 0x00000004 515#define ACPI_BTYPE_PACKAGE 0x00000008 516#define ACPI_BTYPE_FIELD_UNIT 0x00000010 517#define ACPI_BTYPE_DEVICE 0x00000020 518#define ACPI_BTYPE_EVENT 0x00000040 519#define ACPI_BTYPE_METHOD 0x00000080 520#define ACPI_BTYPE_MUTEX 0x00000100 521#define ACPI_BTYPE_REGION 0x00000200 522#define ACPI_BTYPE_POWER 0x00000400 523#define ACPI_BTYPE_PROCESSOR 0x00000800 524#define ACPI_BTYPE_THERMAL 0x00001000 525#define ACPI_BTYPE_BUFFER_FIELD 0x00002000 526#define ACPI_BTYPE_DDB_HANDLE 0x00004000 527#define ACPI_BTYPE_DEBUG_OBJECT 0x00008000 528#define ACPI_BTYPE_REFERENCE 0x00010000 529#define ACPI_BTYPE_RESOURCE 0x00020000 530 531#define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER) 532 533#define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE) 534#define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE) 535#define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR) 536#define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */ 537#define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF 538 539/* 540 * All I/O 541 */ 542#define ACPI_READ 0 543#define ACPI_WRITE 1 544 545 546/* 547 * AcpiEvent Types: Fixed & General Purpose 548 */ 549 550typedef UINT32 ACPI_EVENT_TYPE; 551 552#define ACPI_EVENT_FIXED 0 553#define ACPI_EVENT_GPE 1 554 555/* 556 * Fixed events 557 */ 558 559#define ACPI_EVENT_PMTIMER 0 560#define ACPI_EVENT_GLOBAL 1 561#define ACPI_EVENT_POWER_BUTTON 2 562#define ACPI_EVENT_SLEEP_BUTTON 3 563#define ACPI_EVENT_RTC 4 564#define ACPI_EVENT_MAX 4 565#define ACPI_NUM_FIXED_EVENTS ACPI_EVENT_MAX + 1 566 567#define ACPI_GPE_INVALID 0xFF 568#define ACPI_GPE_MAX 0xFF 569#define ACPI_NUM_GPE 256 570 571#define ACPI_EVENT_LEVEL_TRIGGERED 1 572#define ACPI_EVENT_EDGE_TRIGGERED 2 573 574/* 575 * GPEs 576 */ 577 578#define ACPI_EVENT_WAKE_ENABLE 0x1 579 580#define ACPI_EVENT_WAKE_DISABLE 0x1 581 582 583/* 584 * AcpiEvent Status: 585 * ------------- 586 * The encoding of ACPI_EVENT_STATUS is illustrated below. 587 * Note that a set bit (1) indicates the property is TRUE 588 * (e.g. if bit 0 is set then the event is enabled). 589 * +-------------+-+-+-+ 590 * | Bits 31:3 |2|1|0| 591 * +-------------+-+-+-+ 592 * | | | | 593 * | | | +- Enabled? 594 * | | +--- Enabled for wake? 595 * | +----- Set? 596 * +----------- <Reserved> 597 */ 598typedef UINT32 ACPI_EVENT_STATUS; 599 600#define ACPI_EVENT_FLAG_DISABLED (ACPI_EVENT_STATUS) 0x00 601#define ACPI_EVENT_FLAG_ENABLED (ACPI_EVENT_STATUS) 0x01 602#define ACPI_EVENT_FLAG_WAKE_ENABLED (ACPI_EVENT_STATUS) 0x02 603#define ACPI_EVENT_FLAG_SET (ACPI_EVENT_STATUS) 0x04 604 605 606/* Notify types */ 607 608#define ACPI_SYSTEM_NOTIFY 0 609#define ACPI_DEVICE_NOTIFY 1 610#define ACPI_MAX_NOTIFY_HANDLER_TYPE 1 611 612#define ACPI_MAX_SYS_NOTIFY 0x7f 613 614 615/* Address Space (Operation Region) Types */ 616 617typedef UINT8 ACPI_ADR_SPACE_TYPE; 618 619#define ACPI_ADR_SPACE_SYSTEM_MEMORY (ACPI_ADR_SPACE_TYPE) 0 620#define ACPI_ADR_SPACE_SYSTEM_IO (ACPI_ADR_SPACE_TYPE) 1 621#define ACPI_ADR_SPACE_PCI_CONFIG (ACPI_ADR_SPACE_TYPE) 2 622#define ACPI_ADR_SPACE_EC (ACPI_ADR_SPACE_TYPE) 3 623#define ACPI_ADR_SPACE_SMBUS (ACPI_ADR_SPACE_TYPE) 4 624#define ACPI_ADR_SPACE_CMOS (ACPI_ADR_SPACE_TYPE) 5 625#define ACPI_ADR_SPACE_PCI_BAR_TARGET (ACPI_ADR_SPACE_TYPE) 6 626#define ACPI_ADR_SPACE_DATA_TABLE (ACPI_ADR_SPACE_TYPE) 7 627 628 629/* 630 * External ACPI object definition 631 */ 632 633typedef union AcpiObj 634{ 635 ACPI_OBJECT_TYPE Type; /* See definition of AcpiNsType for values */ 636 struct 637 { 638 ACPI_OBJECT_TYPE Type; 639 ACPI_INTEGER Value; /* The actual number */ 640 } Integer; 641 642 struct 643 { 644 ACPI_OBJECT_TYPE Type; 645 UINT32 Length; /* # of bytes in string, excluding trailing null */ 646 NATIVE_CHAR *Pointer; /* points to the string value */ 647 } String; 648 649 struct 650 { 651 ACPI_OBJECT_TYPE Type; 652 UINT32 Length; /* # of bytes in buffer */ 653 UINT8 *Pointer; /* points to the buffer */ 654 } Buffer; 655 656 struct 657 { 658 ACPI_OBJECT_TYPE Type; 659 UINT32 Fill1; 660 ACPI_HANDLE Handle; /* object reference */ 661 } Reference; 662 663 struct 664 { 665 ACPI_OBJECT_TYPE Type; 666 UINT32 Count; /* # of elements in package */ 667 union AcpiObj *Elements; /* Pointer to an array of ACPI_OBJECTs */ 668 } Package; 669 670 struct 671 { 672 ACPI_OBJECT_TYPE Type; 673 UINT32 ProcId; 674 ACPI_IO_ADDRESS PblkAddress; 675 UINT32 PblkLength; 676 } Processor; 677 678 struct 679 { 680 ACPI_OBJECT_TYPE Type; 681 UINT32 SystemLevel; 682 UINT32 ResourceOrder; 683 } PowerResource; 684 685} ACPI_OBJECT; 686 687 688/* 689 * List of objects, used as a parameter list for control method evaluation 690 */ 691 692typedef struct AcpiObjList 693{ 694 UINT32 Count; 695 ACPI_OBJECT *Pointer; 696 697} ACPI_OBJECT_LIST; 698 699 700/* 701 * Miscellaneous common Data Structures used by the interfaces 702 */ 703 704#define ACPI_NO_BUFFER 0 705#define ACPI_ALLOCATE_BUFFER (ACPI_SIZE) (-1) 706#define ACPI_ALLOCATE_LOCAL_BUFFER (ACPI_SIZE) (-2) 707 708typedef struct 709{ 710 ACPI_SIZE Length; /* Length in bytes of the buffer */ 711 void *Pointer; /* pointer to buffer */ 712 713} ACPI_BUFFER; 714 715 716/* 717 * NameType for AcpiGetName 718 */ 719 720#define ACPI_FULL_PATHNAME 0 721#define ACPI_SINGLE_NAME 1 722#define ACPI_NAME_TYPE_MAX 1 723 724 725/* 726 * Structure and flags for AcpiGetSystemInfo 727 */ 728 729#define ACPI_SYS_MODE_UNKNOWN 0x0000 730#define ACPI_SYS_MODE_ACPI 0x0001 731#define ACPI_SYS_MODE_LEGACY 0x0002 732#define ACPI_SYS_MODES_MASK 0x0003 733 734 735/* 736 * ACPI Table Info. One per ACPI table _type_ 737 */ 738typedef struct AcpiTableInfo 739{ 740 UINT32 Count; 741 742} ACPI_TABLE_INFO; 743 744 745/* 746 * System info returned by AcpiGetSystemInfo() 747 */ 748 749typedef struct _AcpiSysInfo 750{ 751 UINT32 AcpiCaVersion; 752 UINT32 Flags; 753 UINT32 TimerResolution; 754 UINT32 Reserved1; 755 UINT32 Reserved2; 756 UINT32 DebugLevel; 757 UINT32 DebugLayer; 758 UINT32 NumTableTypes; 759 ACPI_TABLE_INFO TableInfo [NUM_ACPI_TABLES]; 760 761} ACPI_SYSTEM_INFO; 762 763 764/* 765 * Various handlers and callback procedures 766 */ 767 768typedef 769UINT32 (*ACPI_EVENT_HANDLER) ( 770 void *Context); 771 772typedef 773void (*ACPI_GPE_HANDLER) ( 774 void *Context); 775 776typedef 777void (*ACPI_NOTIFY_HANDLER) ( 778 ACPI_HANDLE Device, 779 UINT32 Value, 780 void *Context); 781 782typedef 783void (*ACPI_OBJECT_HANDLER) ( 784 ACPI_HANDLE Object, 785 UINT32 Function, 786 void *Data); 787 788 789/* Address Spaces (Operation Regions */ 790 791typedef 792ACPI_STATUS (*ACPI_ADR_SPACE_HANDLER) ( 793 UINT32 Function, 794 ACPI_PHYSICAL_ADDRESS Address, 795 UINT32 BitWidth, 796 ACPI_INTEGER *Value, 797 void *HandlerContext, 798 void *RegionContext); 799 800#define ACPI_DEFAULT_HANDLER ((ACPI_ADR_SPACE_HANDLER) NULL) 801 802 803typedef 804ACPI_STATUS (*ACPI_ADR_SPACE_SETUP) ( 805 ACPI_HANDLE RegionHandle, 806 UINT32 Function, 807 void *HandlerContext, 808 void **RegionContext); 809 810#define ACPI_REGION_ACTIVATE 0 811#define ACPI_REGION_DEACTIVATE 1 812 813typedef 814ACPI_STATUS (*ACPI_WALK_CALLBACK) ( 815 ACPI_HANDLE ObjHandle, 816 UINT32 NestingLevel, 817 void *Context, 818 void **ReturnValue); 819 820 821/* Interrupt handler return values */ 822 823#define ACPI_INTERRUPT_NOT_HANDLED 0x00 824#define ACPI_INTERRUPT_HANDLED 0x01 825 826 827/* Structure and flags for AcpiGetDeviceInfo */ 828 829#define ACPI_VALID_HID 0x1 830#define ACPI_VALID_UID 0x2 831#define ACPI_VALID_ADR 0x4 832#define ACPI_VALID_STA 0x8 833 834 835#define ACPI_COMMON_OBJ_INFO \ 836 ACPI_OBJECT_TYPE Type; /* ACPI object type */ \ 837 ACPI_NAME Name /* ACPI object Name */ 838 839 840typedef struct 841{ 842 ACPI_COMMON_OBJ_INFO; 843} ACPI_OBJ_INFO_HEADER; 844 845 846typedef struct 847{ 848 ACPI_COMMON_OBJ_INFO; 849 850 UINT32 Valid; /* Are the next bits legit? */ 851 NATIVE_CHAR HardwareId[9]; /* _HID value if any */ 852 NATIVE_CHAR UniqueId[9]; /* _UID value if any */ 853 ACPI_INTEGER Address; /* _ADR value if any */ 854 UINT32 CurrentStatus; /* _STA value */ 855} ACPI_DEVICE_INFO; 856 857 858/* Context structs for address space handlers */ 859 860typedef struct 861{ 862 UINT16 Segment; 863 UINT16 Bus; 864 UINT16 Device; 865 UINT16 Function; 866} ACPI_PCI_ID; 867 868 869typedef struct 870{ 871 UINT32 Length; 872 ACPI_PHYSICAL_ADDRESS Address; 873 ACPI_PHYSICAL_ADDRESS MappedPhysicalAddress; 874 UINT8 *MappedLogicalAddress; 875 UINT32 MappedLength; 876} ACPI_MEM_SPACE_CONTEXT; 877 878 879/* Sleep states */ 880 881#define ACPI_NUM_SLEEP_STATES 7 882 883 884/* 885 * Definitions for Resource Attributes 886 */ 887 888/* 889 * Memory Attributes 890 */ 891#define ACPI_READ_ONLY_MEMORY (UINT8) 0x00 892#define ACPI_READ_WRITE_MEMORY (UINT8) 0x01 893 894#define ACPI_NON_CACHEABLE_MEMORY (UINT8) 0x00 895#define ACPI_CACHABLE_MEMORY (UINT8) 0x01 896#define ACPI_WRITE_COMBINING_MEMORY (UINT8) 0x02 897#define ACPI_PREFETCHABLE_MEMORY (UINT8) 0x03 898 899/* 900 * IO Attributes 901 * The ISA IO ranges are: n000-n0FFh, n400-n4FFh, n800-n8FFh, nC00-nCFFh. 902 * The non-ISA IO ranges are: n100-n3FFh, n500-n7FFh, n900-nBFFh, nCD0-nFFFh. 903 */ 904#define ACPI_NON_ISA_ONLY_RANGES (UINT8) 0x01 905#define ACPI_ISA_ONLY_RANGES (UINT8) 0x02 906#define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES) 907 908/* 909 * IO Port Descriptor Decode 910 */ 911#define ACPI_DECODE_10 (UINT8) 0x00 /* 10-bit IO address decode */ 912#define ACPI_DECODE_16 (UINT8) 0x01 /* 16-bit IO address decode */ 913 914/* 915 * IRQ Attributes 916 */ 917#define ACPI_EDGE_SENSITIVE (UINT8) 0x00 918#define ACPI_LEVEL_SENSITIVE (UINT8) 0x01 919 920#define ACPI_ACTIVE_HIGH (UINT8) 0x00 921#define ACPI_ACTIVE_LOW (UINT8) 0x01 922 923#define ACPI_EXCLUSIVE (UINT8) 0x00 924#define ACPI_SHARED (UINT8) 0x01 925 926/* 927 * DMA Attributes 928 */ 929#define ACPI_COMPATIBILITY (UINT8) 0x00 930#define ACPI_TYPE_A (UINT8) 0x01 931#define ACPI_TYPE_B (UINT8) 0x02 932#define ACPI_TYPE_F (UINT8) 0x03 933 934#define ACPI_NOT_BUS_MASTER (UINT8) 0x00 935#define ACPI_BUS_MASTER (UINT8) 0x01 936 937#define ACPI_TRANSFER_8 (UINT8) 0x00 938#define ACPI_TRANSFER_8_16 (UINT8) 0x01 939#define ACPI_TRANSFER_16 (UINT8) 0x02 940 941/* 942 * Start Dependent Functions Priority definitions 943 */ 944#define ACPI_GOOD_CONFIGURATION (UINT8) 0x00 945#define ACPI_ACCEPTABLE_CONFIGURATION (UINT8) 0x01 946#define ACPI_SUB_OPTIMAL_CONFIGURATION (UINT8) 0x02 947 948/* 949 * 16, 32 and 64-bit Address Descriptor resource types 950 */ 951#define ACPI_MEMORY_RANGE (UINT8) 0x00 952#define ACPI_IO_RANGE (UINT8) 0x01 953#define ACPI_BUS_NUMBER_RANGE (UINT8) 0x02 954 955#define ACPI_ADDRESS_NOT_FIXED (UINT8) 0x00 956#define ACPI_ADDRESS_FIXED (UINT8) 0x01 957 958#define ACPI_POS_DECODE (UINT8) 0x00 959#define ACPI_SUB_DECODE (UINT8) 0x01 960 961#define ACPI_PRODUCER (UINT8) 0x00 962#define ACPI_CONSUMER (UINT8) 0x01 963 964 965/* 966 * Structures used to describe device resources 967 */ 968typedef struct 969{ 970 UINT32 EdgeLevel; 971 UINT32 ActiveHighLow; 972 UINT32 SharedExclusive; 973 UINT32 NumberOfInterrupts; 974 UINT32 Interrupts[1]; 975 976} ACPI_RESOURCE_IRQ; 977 978typedef struct 979{ 980 UINT32 Type; 981 UINT32 BusMaster; 982 UINT32 Transfer; 983 UINT32 NumberOfChannels; 984 UINT32 Channels[1]; 985 986} ACPI_RESOURCE_DMA; 987 988typedef struct 989{ 990 UINT32 CompatibilityPriority; 991 UINT32 PerformanceRobustness; 992 993} ACPI_RESOURCE_START_DPF; 994 995/* 996 * END_DEPENDENT_FUNCTIONS_RESOURCE struct is not 997 * needed because it has no fields 998 */ 999 1000typedef struct 1001{ 1002 UINT32 IoDecode; 1003 UINT32 MinBaseAddress; 1004 UINT32 MaxBaseAddress; 1005 UINT32 Alignment; 1006 UINT32 RangeLength; 1007 1008} ACPI_RESOURCE_IO; 1009 1010typedef struct 1011{ 1012 UINT32 BaseAddress; 1013 UINT32 RangeLength; 1014 1015} ACPI_RESOURCE_FIXED_IO; 1016 1017typedef struct 1018{ 1019 UINT32 Length; 1020 UINT8 Reserved[1]; 1021 1022} ACPI_RESOURCE_VENDOR; 1023 1024typedef struct 1025{ 1026 UINT8 Checksum; 1027 1028} ACPI_RESOURCE_END_TAG; 1029 1030typedef struct 1031{ 1032 UINT32 ReadWriteAttribute; 1033 UINT32 MinBaseAddress; 1034 UINT32 MaxBaseAddress; 1035 UINT32 Alignment; 1036 UINT32 RangeLength; 1037 1038} ACPI_RESOURCE_MEM24; 1039 1040typedef struct 1041{ 1042 UINT32 ReadWriteAttribute; 1043 UINT32 MinBaseAddress; 1044 UINT32 MaxBaseAddress; 1045 UINT32 Alignment; 1046 UINT32 RangeLength; 1047 1048} ACPI_RESOURCE_MEM32; 1049 1050typedef struct 1051{ 1052 UINT32 ReadWriteAttribute; 1053 UINT32 RangeBaseAddress; 1054 UINT32 RangeLength; 1055 1056} ACPI_RESOURCE_FIXED_MEM32; 1057 1058typedef struct 1059{ 1060 UINT16 CacheAttribute; 1061 UINT16 ReadWriteAttribute; 1062 1063} ACPI_MEMORY_ATTRIBUTE; 1064 1065typedef struct 1066{ 1067 UINT16 RangeAttribute; 1068 UINT16 Reserved; 1069 1070} ACPI_IO_ATTRIBUTE; 1071 1072typedef struct 1073{ 1074 UINT16 Reserved1; 1075 UINT16 Reserved2; 1076 1077} ACPI_BUS_ATTRIBUTE; 1078 1079typedef union 1080{ 1081 ACPI_MEMORY_ATTRIBUTE Memory; 1082 ACPI_IO_ATTRIBUTE Io; 1083 ACPI_BUS_ATTRIBUTE Bus; 1084 1085} ACPI_RESOURCE_ATTRIBUTE; 1086 1087typedef struct 1088{ 1089 UINT32 Index; 1090 UINT32 StringLength; 1091 NATIVE_CHAR *StringPtr; 1092 1093} ACPI_RESOURCE_SOURCE; 1094 1095typedef struct 1096{ 1097 UINT32 ResourceType; 1098 UINT32 ProducerConsumer; 1099 UINT32 Decode; 1100 UINT32 MinAddressFixed; 1101 UINT32 MaxAddressFixed; 1102 ACPI_RESOURCE_ATTRIBUTE Attribute; 1103 UINT32 Granularity; 1104 UINT32 MinAddressRange; 1105 UINT32 MaxAddressRange; 1106 UINT32 AddressTranslationOffset; 1107 UINT32 AddressLength; 1108 ACPI_RESOURCE_SOURCE ResourceSource; 1109 1110} ACPI_RESOURCE_ADDRESS16; 1111 1112typedef struct 1113{ 1114 UINT32 ResourceType; 1115 UINT32 ProducerConsumer; 1116 UINT32 Decode; 1117 UINT32 MinAddressFixed; 1118 UINT32 MaxAddressFixed; 1119 ACPI_RESOURCE_ATTRIBUTE Attribute; 1120 UINT32 Granularity; 1121 UINT32 MinAddressRange; 1122 UINT32 MaxAddressRange; 1123 UINT32 AddressTranslationOffset; 1124 UINT32 AddressLength; 1125 ACPI_RESOURCE_SOURCE ResourceSource; 1126 1127} ACPI_RESOURCE_ADDRESS32; 1128 1129typedef struct 1130{ 1131 UINT32 ResourceType; 1132 UINT32 ProducerConsumer; 1133 UINT32 Decode; 1134 UINT32 MinAddressFixed; 1135 UINT32 MaxAddressFixed; 1136 ACPI_RESOURCE_ATTRIBUTE Attribute; 1137 UINT64 Granularity; 1138 UINT64 MinAddressRange; 1139 UINT64 MaxAddressRange; 1140 UINT64 AddressTranslationOffset; 1141 UINT64 AddressLength; 1142 ACPI_RESOURCE_SOURCE ResourceSource; 1143 1144} ACPI_RESOURCE_ADDRESS64; 1145 1146typedef struct 1147{ 1148 UINT32 ProducerConsumer; 1149 UINT32 EdgeLevel; 1150 UINT32 ActiveHighLow; 1151 UINT32 SharedExclusive; 1152 UINT32 NumberOfInterrupts; 1153 ACPI_RESOURCE_SOURCE ResourceSource; 1154 UINT32 Interrupts[1]; 1155 1156} ACPI_RESOURCE_EXT_IRQ; 1157 1158 1159/* ACPI_RESOURCE_TYPEs */ 1160 1161#define ACPI_RSTYPE_IRQ 0 1162#define ACPI_RSTYPE_DMA 1 1163#define ACPI_RSTYPE_START_DPF 2 1164#define ACPI_RSTYPE_END_DPF 3 1165#define ACPI_RSTYPE_IO 4 1166#define ACPI_RSTYPE_FIXED_IO 5 1167#define ACPI_RSTYPE_VENDOR 6 1168#define ACPI_RSTYPE_END_TAG 7 1169#define ACPI_RSTYPE_MEM24 8 1170#define ACPI_RSTYPE_MEM32 9 1171#define ACPI_RSTYPE_FIXED_MEM32 10 1172#define ACPI_RSTYPE_ADDRESS16 11 1173#define ACPI_RSTYPE_ADDRESS32 12 1174#define ACPI_RSTYPE_ADDRESS64 13 1175#define ACPI_RSTYPE_EXT_IRQ 14 1176 1177typedef UINT32 ACPI_RESOURCE_TYPE; 1178 1179typedef union 1180{ 1181 ACPI_RESOURCE_IRQ Irq; 1182 ACPI_RESOURCE_DMA Dma; 1183 ACPI_RESOURCE_START_DPF StartDpf; 1184 ACPI_RESOURCE_IO Io; 1185 ACPI_RESOURCE_FIXED_IO FixedIo; 1186 ACPI_RESOURCE_VENDOR VendorSpecific; 1187 ACPI_RESOURCE_END_TAG EndTag; 1188 ACPI_RESOURCE_MEM24 Memory24; 1189 ACPI_RESOURCE_MEM32 Memory32; 1190 ACPI_RESOURCE_FIXED_MEM32 FixedMemory32; 1191 ACPI_RESOURCE_ADDRESS16 Address16; 1192 ACPI_RESOURCE_ADDRESS32 Address32; 1193 ACPI_RESOURCE_ADDRESS64 Address64; 1194 ACPI_RESOURCE_EXT_IRQ ExtendedIrq; 1195 1196} ACPI_RESOURCE_DATA; 1197 1198typedef struct AcpiResource 1199{ 1200 ACPI_RESOURCE_TYPE Id; 1201 UINT32 Length; 1202 ACPI_RESOURCE_DATA Data; 1203 1204} ACPI_RESOURCE; 1205 1206#define ACPI_RESOURCE_LENGTH 12 1207#define ACPI_RESOURCE_LENGTH_NO_DATA 8 /* Id + Length fields */ 1208 1209#define ACPI_SIZEOF_RESOURCE(Type) (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (Type)) 1210 1211#define ACPI_NEXT_RESOURCE(Res) (ACPI_RESOURCE *)((UINT8 *) Res + Res->length) 1212 1213#ifdef _HW_ALIGNMENT_SUPPORT 1214#define ACPI_ALIGN_RESOURCE_SIZE(Length) (Length) 1215#else 1216#define ACPI_ALIGN_RESOURCE_SIZE(Length) ACPI_ROUND_UP_TO_NATIVE_WORD(Length) 1217#endif 1218 1219/* 1220 * END: of definitions for Resource Attributes 1221 */ 1222 1223 1224typedef struct acpi_pci_routing_table 1225{ 1226 UINT32 Length; 1227 UINT32 Pin; 1228 ACPI_INTEGER Address; /* here for 64-bit alignment */ 1229 UINT32 SourceIndex; 1230 NATIVE_CHAR Source[4]; /* pad to 64 bits so sizeof() works in all cases */ 1231 1232} ACPI_PCI_ROUTING_TABLE; 1233 1234/* 1235 * END: of definitions for PCI Routing tables 1236 */ 1237 1238 1239#endif /* __ACTYPES_H__ */ 1240