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