at v2.6.13-rc7 1302 lines 43 kB view raw
1/****************************************************************************** 2 * 3 * Name: actypes.h - Common data types for the entire ACPI subsystem 4 * 5 *****************************************************************************/ 6 7/* 8 * Copyright (C) 2000 - 2005, R. Byron Moore 9 * All rights reserved. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions, and the following disclaimer, 16 * without modification. 17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18 * substantially similar to the "NO WARRANTY" disclaimer below 19 * ("Disclaimer") and any redistribution must be conditioned upon 20 * including a substantially similar Disclaimer requirement for further 21 * binary redistribution. 22 * 3. Neither the names of the above-listed copyright holders nor the names 23 * of any contributors may be used to endorse or promote products derived 24 * from this software without specific prior written permission. 25 * 26 * Alternatively, this software may be distributed under the terms of the 27 * GNU General Public License ("GPL") version 2 as published by the Free 28 * Software Foundation. 29 * 30 * NO WARRANTY 31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41 * POSSIBILITY OF SUCH DAMAGES. 42 */ 43 44#ifndef __ACTYPES_H__ 45#define __ACTYPES_H__ 46 47/*! [Begin] no source code translation (keep the typedefs) */ 48 49 50 51/* 52 * Data type ranges 53 * Note: These macros are designed to be compiler independent as well as 54 * working around problems that some 32-bit compilers have with 64-bit 55 * constants. 56 */ 57#define ACPI_UINT8_MAX (UINT8) (~((UINT8) 0)) /* 0xFF */ 58#define ACPI_UINT16_MAX (UINT16)(~((UINT16) 0)) /* 0xFFFF */ 59#define ACPI_UINT32_MAX (UINT32)(~((UINT32) 0)) /* 0xFFFFFFFF */ 60#define ACPI_UINT64_MAX (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */ 61#define ACPI_ASCII_MAX 0x7F 62 63 64#ifdef DEFINE_ALTERNATE_TYPES 65/* 66 * Types used only in translated source, defined here to enable 67 * cross-platform compilation only. 68 */ 69typedef int s32; 70typedef unsigned char u8; 71typedef unsigned short u16; 72typedef unsigned int u32; 73typedef COMPILER_DEPENDENT_UINT64 u64; 74 75#endif 76 77 78/* 79 * Data types - Fixed across all compilation models (16/32/64) 80 * 81 * BOOLEAN Logical Boolean. 82 * INT8 8-bit (1 byte) signed value 83 * UINT8 8-bit (1 byte) unsigned value 84 * INT16 16-bit (2 byte) signed value 85 * UINT16 16-bit (2 byte) unsigned value 86 * INT32 32-bit (4 byte) signed value 87 * UINT32 32-bit (4 byte) unsigned value 88 * INT64 64-bit (8 byte) signed value 89 * UINT64 64-bit (8 byte) unsigned value 90 * ACPI_NATIVE_INT 32-bit on IA-32, 64-bit on IA-64 signed value 91 * ACPI_NATIVE_UINT 32-bit on IA-32, 64-bit on IA-64 unsigned value 92 */ 93 94#ifndef ACPI_MACHINE_WIDTH 95#error ACPI_MACHINE_WIDTH not defined 96#endif 97 98#if ACPI_MACHINE_WIDTH == 64 99 100/*! [Begin] no source code translation (keep the typedefs) */ 101 102/* 103 * 64-bit type definitions 104 */ 105typedef unsigned char UINT8; 106typedef unsigned char BOOLEAN; 107typedef unsigned short UINT16; 108typedef int INT32; 109typedef unsigned int UINT32; 110typedef COMPILER_DEPENDENT_INT64 INT64; 111typedef COMPILER_DEPENDENT_UINT64 UINT64; 112 113/*! [End] no source code translation !*/ 114 115typedef s64 acpi_native_int; 116typedef u64 acpi_native_uint; 117 118typedef u64 acpi_table_ptr; 119typedef u64 acpi_io_address; 120typedef u64 acpi_physical_address; 121typedef u64 acpi_size; 122 123#define ALIGNED_ADDRESS_BOUNDARY 0x00000008 /* No hardware alignment support in IA64 */ 124#define ACPI_USE_NATIVE_DIVIDE /* Native 64-bit integer support */ 125#define ACPI_MAX_PTR ACPI_UINT64_MAX 126#define ACPI_SIZE_MAX ACPI_UINT64_MAX 127 128 129#elif ACPI_MACHINE_WIDTH == 16 130 131/*! [Begin] no source code translation (keep the typedefs) */ 132 133/* 134 * 16-bit type definitions 135 */ 136typedef unsigned char UINT8; 137typedef unsigned char BOOLEAN; 138typedef unsigned int UINT16; 139typedef long INT32; 140typedef int INT16; 141typedef unsigned long UINT32; 142 143struct 144{ 145 UINT32 Lo; 146 UINT32 Hi; 147}; 148 149/*! [End] no source code translation !*/ 150 151typedef u16 acpi_native_uint; 152typedef s16 acpi_native_int; 153 154typedef u32 acpi_table_ptr; 155typedef u32 acpi_io_address; 156typedef char *acpi_physical_address; 157typedef u16 acpi_size; 158 159#define ALIGNED_ADDRESS_BOUNDARY 0x00000002 160#define ACPI_MISALIGNED_TRANSFERS 161#define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ 162#define ACPI_MAX_PTR ACPI_UINT16_MAX 163#define ACPI_SIZE_MAX ACPI_UINT16_MAX 164 165/* 166 * (16-bit only) internal integers must be 32-bits, so 167 * 64-bit integers cannot be supported 168 */ 169#define ACPI_NO_INTEGER64_SUPPORT 170 171 172#elif ACPI_MACHINE_WIDTH == 32 173 174/*! [Begin] no source code translation (keep the typedefs) */ 175 176/* 177 * 32-bit type definitions (default) 178 */ 179typedef unsigned char UINT8; 180typedef unsigned char BOOLEAN; 181typedef unsigned short UINT16; 182typedef int INT32; 183typedef unsigned int UINT32; 184typedef COMPILER_DEPENDENT_INT64 INT64; 185typedef COMPILER_DEPENDENT_UINT64 UINT64; 186 187/*! [End] no source code translation !*/ 188 189typedef s32 acpi_native_int; 190typedef u32 acpi_native_uint; 191 192typedef u64 acpi_table_ptr; 193typedef u32 acpi_io_address; 194typedef u64 acpi_physical_address; 195typedef u32 acpi_size; 196 197#define ALIGNED_ADDRESS_BOUNDARY 0x00000004 198#define ACPI_MISALIGNED_TRANSFERS 199#define ACPI_MAX_PTR ACPI_UINT32_MAX 200#define ACPI_SIZE_MAX ACPI_UINT32_MAX 201 202#else 203#error unknown ACPI_MACHINE_WIDTH 204#endif 205 206 207/* 208 * Miscellaneous common types 209 */ 210typedef u16 UINT16_BIT; 211typedef u32 UINT32_BIT; 212typedef acpi_native_uint ACPI_PTRDIFF; 213 214/* 215 * Pointer overlays to avoid lots of typecasting for 216 * code that accepts both physical and logical pointers. 217 */ 218union acpi_pointers 219{ 220 acpi_physical_address physical; 221 void *logical; 222 acpi_table_ptr value; 223}; 224 225struct acpi_pointer 226{ 227 u32 pointer_type; 228 union acpi_pointers pointer; 229}; 230 231/* pointer_types for above */ 232 233#define ACPI_PHYSICAL_POINTER 0x01 234#define ACPI_LOGICAL_POINTER 0x02 235 236/* Processor mode */ 237 238#define ACPI_PHYSICAL_ADDRESSING 0x04 239#define ACPI_LOGICAL_ADDRESSING 0x08 240#define ACPI_MEMORY_MODE 0x0C 241 242#define ACPI_PHYSMODE_PHYSPTR ACPI_PHYSICAL_ADDRESSING | ACPI_PHYSICAL_POINTER 243#define ACPI_LOGMODE_PHYSPTR ACPI_LOGICAL_ADDRESSING | ACPI_PHYSICAL_POINTER 244#define ACPI_LOGMODE_LOGPTR ACPI_LOGICAL_ADDRESSING | ACPI_LOGICAL_POINTER 245 246 247/* 248 * Useful defines 249 */ 250#ifdef FALSE 251#undef FALSE 252#endif 253#define FALSE (1 == 0) 254 255#ifdef TRUE 256#undef TRUE 257#endif 258#define TRUE (1 == 1) 259 260#ifndef NULL 261#define NULL (void *) 0 262#endif 263 264 265/* 266 * Local datatypes 267 */ 268typedef u32 acpi_status; /* All ACPI Exceptions */ 269typedef u32 acpi_name; /* 4-byte ACPI name */ 270typedef char * acpi_string; /* Null terminated ASCII string */ 271typedef void * acpi_handle; /* Actually a ptr to an Node */ 272 273struct uint64_struct 274{ 275 u32 lo; 276 u32 hi; 277}; 278 279union uint64_overlay 280{ 281 u64 full; 282 struct uint64_struct part; 283}; 284 285struct uint32_struct 286{ 287 u32 lo; 288 u32 hi; 289}; 290 291 292/* 293 * Acpi integer width. In ACPI version 1, integers are 294 * 32 bits. In ACPI version 2, integers are 64 bits. 295 * Note that this pertains to the ACPI integer type only, not 296 * other integers used in the implementation of the ACPI CA 297 * subsystem. 298 */ 299#ifdef ACPI_NO_INTEGER64_SUPPORT 300 301/* 32-bit integers only, no 64-bit support */ 302 303typedef u32 acpi_integer; 304#define ACPI_INTEGER_MAX ACPI_UINT32_MAX 305#define ACPI_INTEGER_BIT_SIZE 32 306#define ACPI_MAX_DECIMAL_DIGITS 10 /* 2^32 = 4,294,967,296 */ 307 308#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 32-bit divide */ 309 310 311#else 312 313/* 64-bit integers */ 314 315typedef u64 acpi_integer; 316#define ACPI_INTEGER_MAX ACPI_UINT64_MAX 317#define ACPI_INTEGER_BIT_SIZE 64 318#define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */ 319 320 321#if ACPI_MACHINE_WIDTH == 64 322#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 64-bit divide */ 323#endif 324#endif 325 326#define ACPI_MAX64_DECIMAL_DIGITS 20 327#define ACPI_MAX32_DECIMAL_DIGITS 10 328#define ACPI_MAX16_DECIMAL_DIGITS 5 329#define ACPI_MAX8_DECIMAL_DIGITS 3 330 331/* 332 * Constants with special meanings 333 */ 334#define ACPI_ROOT_OBJECT (acpi_handle) ACPI_PTR_ADD (char, NULL, ACPI_MAX_PTR) 335 336 337/* 338 * Initialization sequence 339 */ 340#define ACPI_FULL_INITIALIZATION 0x00 341#define ACPI_NO_ADDRESS_SPACE_INIT 0x01 342#define ACPI_NO_HARDWARE_INIT 0x02 343#define ACPI_NO_EVENT_INIT 0x04 344#define ACPI_NO_HANDLER_INIT 0x08 345#define ACPI_NO_ACPI_ENABLE 0x10 346#define ACPI_NO_DEVICE_INIT 0x20 347#define ACPI_NO_OBJECT_INIT 0x40 348 349/* 350 * Initialization state 351 */ 352#define ACPI_INITIALIZED_OK 0x01 353 354/* 355 * Power state values 356 */ 357#define ACPI_STATE_UNKNOWN (u8) 0xFF 358 359#define ACPI_STATE_S0 (u8) 0 360#define ACPI_STATE_S1 (u8) 1 361#define ACPI_STATE_S2 (u8) 2 362#define ACPI_STATE_S3 (u8) 3 363#define ACPI_STATE_S4 (u8) 4 364#define ACPI_STATE_S5 (u8) 5 365#define ACPI_S_STATES_MAX ACPI_STATE_S5 366#define ACPI_S_STATE_COUNT 6 367 368#define ACPI_STATE_D0 (u8) 0 369#define ACPI_STATE_D1 (u8) 1 370#define ACPI_STATE_D2 (u8) 2 371#define ACPI_STATE_D3 (u8) 3 372#define ACPI_D_STATES_MAX ACPI_STATE_D3 373#define ACPI_D_STATE_COUNT 4 374 375#define ACPI_STATE_C0 (u8) 0 376#define ACPI_STATE_C1 (u8) 1 377#define ACPI_STATE_C2 (u8) 2 378#define ACPI_STATE_C3 (u8) 3 379#define ACPI_C_STATES_MAX ACPI_STATE_C3 380#define ACPI_C_STATE_COUNT 4 381 382/* 383 * Sleep type invalid value 384 */ 385#define ACPI_SLEEP_TYPE_MAX 0x7 386#define ACPI_SLEEP_TYPE_INVALID 0xFF 387 388/* 389 * Standard notify values 390 */ 391#define ACPI_NOTIFY_BUS_CHECK (u8) 0 392#define ACPI_NOTIFY_DEVICE_CHECK (u8) 1 393#define ACPI_NOTIFY_DEVICE_WAKE (u8) 2 394#define ACPI_NOTIFY_EJECT_REQUEST (u8) 3 395#define ACPI_NOTIFY_DEVICE_CHECK_LIGHT (u8) 4 396#define ACPI_NOTIFY_FREQUENCY_MISMATCH (u8) 5 397#define ACPI_NOTIFY_BUS_MODE_MISMATCH (u8) 6 398#define ACPI_NOTIFY_POWER_FAULT (u8) 7 399 400/* 401 * Table types. These values are passed to the table related APIs 402 */ 403typedef u32 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_TABLE_TYPES (ACPI_TABLE_MAX+1) 414 415/* 416 * Types associated with ACPI names and objects. The first group of 417 * values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition 418 * of the ACPI object_type() operator (See the ACPI Spec). Therefore, 419 * only add to the first group if the spec changes. 420 * 421 * NOTE: Types must be kept in sync with the global acpi_ns_properties 422 * and acpi_ns_type_names arrays. 423 */ 424typedef u32 acpi_object_type; 425 426#define ACPI_TYPE_ANY 0x00 427#define ACPI_TYPE_INTEGER 0x01 /* Byte/Word/Dword/Zero/One/Ones */ 428#define ACPI_TYPE_STRING 0x02 429#define ACPI_TYPE_BUFFER 0x03 430#define ACPI_TYPE_PACKAGE 0x04 /* byte_const, multiple data_term/Constant/super_name */ 431#define ACPI_TYPE_FIELD_UNIT 0x05 432#define ACPI_TYPE_DEVICE 0x06 /* Name, multiple Node */ 433#define ACPI_TYPE_EVENT 0x07 434#define ACPI_TYPE_METHOD 0x08 /* Name, byte_const, multiple Code */ 435#define ACPI_TYPE_MUTEX 0x09 436#define ACPI_TYPE_REGION 0x0A 437#define ACPI_TYPE_POWER 0x0B /* Name,byte_const,word_const,multi Node */ 438#define ACPI_TYPE_PROCESSOR 0x0C /* Name,byte_const,Dword_const,byte_const,multi nm_o */ 439#define ACPI_TYPE_THERMAL 0x0D /* Name, multiple Node */ 440#define ACPI_TYPE_BUFFER_FIELD 0x0E 441#define ACPI_TYPE_DDB_HANDLE 0x0F 442#define ACPI_TYPE_DEBUG_OBJECT 0x10 443 444#define ACPI_TYPE_EXTERNAL_MAX 0x10 445 446/* 447 * These are object types that do not map directly to the ACPI 448 * object_type() operator. They are used for various internal purposes only. 449 * If new predefined ACPI_TYPEs are added (via the ACPI specification), these 450 * internal types must move upwards. (There is code that depends on these 451 * values being contiguous with the external types above.) 452 */ 453#define ACPI_TYPE_LOCAL_REGION_FIELD 0x11 454#define ACPI_TYPE_LOCAL_BANK_FIELD 0x12 455#define ACPI_TYPE_LOCAL_INDEX_FIELD 0x13 456#define ACPI_TYPE_LOCAL_REFERENCE 0x14 /* Arg#, Local#, Name, Debug, ref_of, Index */ 457#define ACPI_TYPE_LOCAL_ALIAS 0x15 458#define ACPI_TYPE_LOCAL_METHOD_ALIAS 0x16 459#define ACPI_TYPE_LOCAL_NOTIFY 0x17 460#define ACPI_TYPE_LOCAL_ADDRESS_HANDLER 0x18 461#define ACPI_TYPE_LOCAL_RESOURCE 0x19 462#define ACPI_TYPE_LOCAL_RESOURCE_FIELD 0x1A 463#define ACPI_TYPE_LOCAL_SCOPE 0x1B /* 1 Name, multiple object_list Nodes */ 464 465#define ACPI_TYPE_NS_NODE_MAX 0x1B /* Last typecode used within a NS Node */ 466 467/* 468 * These are special object types that never appear in 469 * a Namespace node, only in an union acpi_operand_object 470 */ 471#define ACPI_TYPE_LOCAL_EXTRA 0x1C 472#define ACPI_TYPE_LOCAL_DATA 0x1D 473 474#define ACPI_TYPE_LOCAL_MAX 0x1D 475 476/* All types above here are invalid */ 477 478#define ACPI_TYPE_INVALID 0x1E 479#define ACPI_TYPE_NOT_FOUND 0xFF 480 481/* 482 * Bitmapped ACPI types. Used internally only 483 */ 484#define ACPI_BTYPE_ANY 0x00000000 485#define ACPI_BTYPE_INTEGER 0x00000001 486#define ACPI_BTYPE_STRING 0x00000002 487#define ACPI_BTYPE_BUFFER 0x00000004 488#define ACPI_BTYPE_PACKAGE 0x00000008 489#define ACPI_BTYPE_FIELD_UNIT 0x00000010 490#define ACPI_BTYPE_DEVICE 0x00000020 491#define ACPI_BTYPE_EVENT 0x00000040 492#define ACPI_BTYPE_METHOD 0x00000080 493#define ACPI_BTYPE_MUTEX 0x00000100 494#define ACPI_BTYPE_REGION 0x00000200 495#define ACPI_BTYPE_POWER 0x00000400 496#define ACPI_BTYPE_PROCESSOR 0x00000800 497#define ACPI_BTYPE_THERMAL 0x00001000 498#define ACPI_BTYPE_BUFFER_FIELD 0x00002000 499#define ACPI_BTYPE_DDB_HANDLE 0x00004000 500#define ACPI_BTYPE_DEBUG_OBJECT 0x00008000 501#define ACPI_BTYPE_REFERENCE 0x00010000 502#define ACPI_BTYPE_RESOURCE 0x00020000 503 504#define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER) 505 506#define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE) 507#define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE) 508#define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR) 509#define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */ 510#define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF 511 512/* 513 * All I/O 514 */ 515#define ACPI_READ 0 516#define ACPI_WRITE 1 517#define ACPI_IO_MASK 1 518 519/* 520 * Event Types: Fixed & General Purpose 521 */ 522typedef u32 acpi_event_type; 523 524/* 525 * Fixed events 526 */ 527#define ACPI_EVENT_PMTIMER 0 528#define ACPI_EVENT_GLOBAL 1 529#define ACPI_EVENT_POWER_BUTTON 2 530#define ACPI_EVENT_SLEEP_BUTTON 3 531#define ACPI_EVENT_RTC 4 532#define ACPI_EVENT_MAX 4 533#define ACPI_NUM_FIXED_EVENTS ACPI_EVENT_MAX + 1 534 535/* 536 * Event Status - Per event 537 * ------------- 538 * The encoding of acpi_event_status is illustrated below. 539 * Note that a set bit (1) indicates the property is TRUE 540 * (e.g. if bit 0 is set then the event is enabled). 541 * +-------------+-+-+-+ 542 * | Bits 31:3 |2|1|0| 543 * +-------------+-+-+-+ 544 * | | | | 545 * | | | +- Enabled? 546 * | | +--- Enabled for wake? 547 * | +----- Set? 548 * +----------- <Reserved> 549 */ 550typedef u32 acpi_event_status; 551 552#define ACPI_EVENT_FLAG_DISABLED (acpi_event_status) 0x00 553#define ACPI_EVENT_FLAG_ENABLED (acpi_event_status) 0x01 554#define ACPI_EVENT_FLAG_WAKE_ENABLED (acpi_event_status) 0x02 555#define ACPI_EVENT_FLAG_SET (acpi_event_status) 0x04 556 557/* 558 * General Purpose Events (GPE) 559 */ 560#define ACPI_GPE_INVALID 0xFF 561#define ACPI_GPE_MAX 0xFF 562#define ACPI_NUM_GPE 256 563 564#define ACPI_GPE_ENABLE 0 565#define ACPI_GPE_DISABLE 1 566 567 568/* 569 * GPE info flags - Per GPE 570 * +-+-+-+---+---+-+ 571 * |7|6|5|4:3|2:1|0| 572 * +-+-+-+---+---+-+ 573 * | | | | | | 574 * | | | | | +--- Interrupt type: Edge or Level Triggered 575 * | | | | +--- Type: Wake-only, Runtime-only, or wake/runtime 576 * | | | +--- Type of dispatch -- to method, handler, or none 577 * | | +--- Enabled for runtime? 578 * | +--- Enabled for wake? 579 * +--- System state when GPE ocurred (running/waking) 580 */ 581#define ACPI_GPE_XRUPT_TYPE_MASK (u8) 0x01 582#define ACPI_GPE_LEVEL_TRIGGERED (u8) 0x01 583#define ACPI_GPE_EDGE_TRIGGERED (u8) 0x00 584 585#define ACPI_GPE_TYPE_MASK (u8) 0x06 586#define ACPI_GPE_TYPE_WAKE_RUN (u8) 0x06 587#define ACPI_GPE_TYPE_WAKE (u8) 0x02 588#define ACPI_GPE_TYPE_RUNTIME (u8) 0x04 /* Default */ 589 590#define ACPI_GPE_DISPATCH_MASK (u8) 0x18 591#define ACPI_GPE_DISPATCH_HANDLER (u8) 0x08 592#define ACPI_GPE_DISPATCH_METHOD (u8) 0x10 593#define ACPI_GPE_DISPATCH_NOT_USED (u8) 0x00 /* Default */ 594 595#define ACPI_GPE_RUN_ENABLE_MASK (u8) 0x20 596#define ACPI_GPE_RUN_ENABLED (u8) 0x20 597#define ACPI_GPE_RUN_DISABLED (u8) 0x00 /* Default */ 598 599#define ACPI_GPE_WAKE_ENABLE_MASK (u8) 0x40 600#define ACPI_GPE_WAKE_ENABLED (u8) 0x40 601#define ACPI_GPE_WAKE_DISABLED (u8) 0x00 /* Default */ 602 603#define ACPI_GPE_ENABLE_MASK (u8) 0x60 /* Both run/wake */ 604 605#define ACPI_GPE_SYSTEM_MASK (u8) 0x80 606#define ACPI_GPE_SYSTEM_RUNNING (u8) 0x80 607#define ACPI_GPE_SYSTEM_WAKING (u8) 0x00 608 609/* 610 * Flags for GPE and Lock interfaces 611 */ 612#define ACPI_EVENT_WAKE_ENABLE 0x2 /* acpi_gpe_enable */ 613#define ACPI_EVENT_WAKE_DISABLE 0x2 /* acpi_gpe_disable */ 614 615#define ACPI_NOT_ISR 0x1 616#define ACPI_ISR 0x0 617 618 619/* Notify types */ 620 621#define ACPI_SYSTEM_NOTIFY 0x1 622#define ACPI_DEVICE_NOTIFY 0x2 623#define ACPI_ALL_NOTIFY 0x3 624#define ACPI_MAX_NOTIFY_HANDLER_TYPE 0x3 625 626#define ACPI_MAX_SYS_NOTIFY 0x7f 627 628 629/* Address Space (Operation Region) Types */ 630 631typedef u8 acpi_adr_space_type; 632 633#define ACPI_ADR_SPACE_SYSTEM_MEMORY (acpi_adr_space_type) 0 634#define ACPI_ADR_SPACE_SYSTEM_IO (acpi_adr_space_type) 1 635#define ACPI_ADR_SPACE_PCI_CONFIG (acpi_adr_space_type) 2 636#define ACPI_ADR_SPACE_EC (acpi_adr_space_type) 3 637#define ACPI_ADR_SPACE_SMBUS (acpi_adr_space_type) 4 638#define ACPI_ADR_SPACE_CMOS (acpi_adr_space_type) 5 639#define ACPI_ADR_SPACE_PCI_BAR_TARGET (acpi_adr_space_type) 6 640#define ACPI_ADR_SPACE_DATA_TABLE (acpi_adr_space_type) 7 641#define ACPI_ADR_SPACE_FIXED_HARDWARE (acpi_adr_space_type) 127 642 643 644/* 645 * bit_register IDs 646 * These are bitfields defined within the full ACPI registers 647 */ 648#define ACPI_BITREG_TIMER_STATUS 0x00 649#define ACPI_BITREG_BUS_MASTER_STATUS 0x01 650#define ACPI_BITREG_GLOBAL_LOCK_STATUS 0x02 651#define ACPI_BITREG_POWER_BUTTON_STATUS 0x03 652#define ACPI_BITREG_SLEEP_BUTTON_STATUS 0x04 653#define ACPI_BITREG_RT_CLOCK_STATUS 0x05 654#define ACPI_BITREG_WAKE_STATUS 0x06 655#define ACPI_BITREG_PCIEXP_WAKE_STATUS 0x07 656 657#define ACPI_BITREG_TIMER_ENABLE 0x08 658#define ACPI_BITREG_GLOBAL_LOCK_ENABLE 0x09 659#define ACPI_BITREG_POWER_BUTTON_ENABLE 0x0A 660#define ACPI_BITREG_SLEEP_BUTTON_ENABLE 0x0B 661#define ACPI_BITREG_RT_CLOCK_ENABLE 0x0C 662#define ACPI_BITREG_WAKE_ENABLE 0x0D 663#define ACPI_BITREG_PCIEXP_WAKE_DISABLE 0x0E 664 665#define ACPI_BITREG_SCI_ENABLE 0x0F 666#define ACPI_BITREG_BUS_MASTER_RLD 0x10 667#define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x11 668#define ACPI_BITREG_SLEEP_TYPE_A 0x12 669#define ACPI_BITREG_SLEEP_TYPE_B 0x13 670#define ACPI_BITREG_SLEEP_ENABLE 0x14 671 672#define ACPI_BITREG_ARB_DISABLE 0x15 673 674#define ACPI_BITREG_MAX 0x15 675#define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1 676 677 678/* 679 * External ACPI object definition 680 */ 681union acpi_object 682{ 683 acpi_object_type type; /* See definition of acpi_ns_type for values */ 684 struct 685 { 686 acpi_object_type type; 687 acpi_integer value; /* The actual number */ 688 } integer; 689 690 struct 691 { 692 acpi_object_type type; 693 u32 length; /* # of bytes in string, excluding trailing null */ 694 char *pointer; /* points to the string value */ 695 } string; 696 697 struct 698 { 699 acpi_object_type type; 700 u32 length; /* # of bytes in buffer */ 701 u8 *pointer; /* points to the buffer */ 702 } buffer; 703 704 struct 705 { 706 acpi_object_type type; 707 u32 fill1; 708 acpi_handle handle; /* object reference */ 709 } reference; 710 711 struct 712 { 713 acpi_object_type type; 714 u32 count; /* # of elements in package */ 715 union acpi_object *elements; /* Pointer to an array of ACPI_OBJECTs */ 716 } package; 717 718 struct 719 { 720 acpi_object_type type; 721 u32 proc_id; 722 acpi_io_address pblk_address; 723 u32 pblk_length; 724 } processor; 725 726 struct 727 { 728 acpi_object_type type; 729 u32 system_level; 730 u32 resource_order; 731 } power_resource; 732}; 733 734 735/* 736 * List of objects, used as a parameter list for control method evaluation 737 */ 738struct acpi_object_list 739{ 740 u32 count; 741 union acpi_object *pointer; 742}; 743 744 745/* 746 * Miscellaneous common Data Structures used by the interfaces 747 */ 748#define ACPI_NO_BUFFER 0 749#define ACPI_ALLOCATE_BUFFER (acpi_size) (-1) 750#define ACPI_ALLOCATE_LOCAL_BUFFER (acpi_size) (-2) 751 752struct acpi_buffer 753{ 754 acpi_size length; /* Length in bytes of the buffer */ 755 void *pointer; /* pointer to buffer */ 756}; 757 758 759/* 760 * name_type for acpi_get_name 761 */ 762#define ACPI_FULL_PATHNAME 0 763#define ACPI_SINGLE_NAME 1 764#define ACPI_NAME_TYPE_MAX 1 765 766 767/* 768 * Structure and flags for acpi_get_system_info 769 */ 770#define ACPI_SYS_MODE_UNKNOWN 0x0000 771#define ACPI_SYS_MODE_ACPI 0x0001 772#define ACPI_SYS_MODE_LEGACY 0x0002 773#define ACPI_SYS_MODES_MASK 0x0003 774 775 776/* 777 * ACPI Table Info. One per ACPI table _type_ 778 */ 779struct acpi_table_info 780{ 781 u32 count; 782}; 783 784 785/* 786 * System info returned by acpi_get_system_info() 787 */ 788struct acpi_system_info 789{ 790 u32 acpi_ca_version; 791 u32 flags; 792 u32 timer_resolution; 793 u32 reserved1; 794 u32 reserved2; 795 u32 debug_level; 796 u32 debug_layer; 797 u32 num_table_types; 798 struct acpi_table_info table_info [NUM_ACPI_TABLE_TYPES]; 799}; 800 801 802/* 803 * Types specific to the OS service interfaces 804 */ 805typedef u32 806(ACPI_SYSTEM_XFACE *acpi_osd_handler) ( 807 void *context); 808 809typedef void 810(ACPI_SYSTEM_XFACE *acpi_osd_exec_callback) ( 811 void *context); 812 813/* 814 * Various handlers and callback procedures 815 */ 816typedef 817u32 (*acpi_event_handler) ( 818 void *context); 819 820typedef 821void (*acpi_notify_handler) ( 822 acpi_handle device, 823 u32 value, 824 void *context); 825 826typedef 827void (*acpi_object_handler) ( 828 acpi_handle object, 829 u32 function, 830 void *data); 831 832typedef 833acpi_status (*acpi_init_handler) ( 834 acpi_handle object, 835 u32 function); 836 837#define ACPI_INIT_DEVICE_INI 1 838 839typedef 840acpi_status (*acpi_exception_handler) ( 841 acpi_status aml_status, 842 acpi_name name, 843 u16 opcode, 844 u32 aml_offset, 845 void *context); 846 847 848/* Address Spaces (For Operation Regions) */ 849 850typedef 851acpi_status (*acpi_adr_space_handler) ( 852 u32 function, 853 acpi_physical_address address, 854 u32 bit_width, 855 acpi_integer *value, 856 void *handler_context, 857 void *region_context); 858 859#define ACPI_DEFAULT_HANDLER NULL 860 861 862typedef 863acpi_status (*acpi_adr_space_setup) ( 864 acpi_handle region_handle, 865 u32 function, 866 void *handler_context, 867 void **region_context); 868 869#define ACPI_REGION_ACTIVATE 0 870#define ACPI_REGION_DEACTIVATE 1 871 872typedef 873acpi_status (*acpi_walk_callback) ( 874 acpi_handle obj_handle, 875 u32 nesting_level, 876 void *context, 877 void **return_value); 878 879 880/* Interrupt handler return values */ 881 882#define ACPI_INTERRUPT_NOT_HANDLED 0x00 883#define ACPI_INTERRUPT_HANDLED 0x01 884 885 886/* Common string version of device HIDs and UIDs */ 887 888struct acpi_device_id 889{ 890 char value[ACPI_DEVICE_ID_LENGTH]; 891}; 892 893/* Common string version of device CIDs */ 894 895struct acpi_compatible_id 896{ 897 char value[ACPI_MAX_CID_LENGTH]; 898}; 899 900struct acpi_compatible_id_list 901{ 902 u32 count; 903 u32 size; 904 struct acpi_compatible_id id[1]; 905}; 906 907 908/* Structure and flags for acpi_get_object_info */ 909 910#define ACPI_VALID_STA 0x0001 911#define ACPI_VALID_ADR 0x0002 912#define ACPI_VALID_HID 0x0004 913#define ACPI_VALID_UID 0x0008 914#define ACPI_VALID_CID 0x0010 915#define ACPI_VALID_SXDS 0x0020 916 917 918#define ACPI_COMMON_OBJ_INFO \ 919 acpi_object_type type; /* ACPI object type */ \ 920 acpi_name name /* ACPI object Name */ 921 922 923struct acpi_obj_info_header 924{ 925 ACPI_COMMON_OBJ_INFO; 926}; 927 928 929/* Structure returned from Get Object Info */ 930 931struct acpi_device_info 932{ 933 ACPI_COMMON_OBJ_INFO; 934 935 u32 valid; /* Indicates which fields below are valid */ 936 u32 current_status; /* _STA value */ 937 acpi_integer address; /* _ADR value if any */ 938 struct acpi_device_id hardware_id; /* _HID value if any */ 939 struct acpi_device_id unique_id; /* _UID value if any */ 940 u8 highest_dstates[4]; /* _sx_d values: 0xFF indicates not valid */ 941 struct acpi_compatible_id_list compatibility_id; /* List of _CIDs if any */ 942}; 943 944 945/* Context structs for address space handlers */ 946 947struct acpi_pci_id 948{ 949 u16 segment; 950 u16 bus; 951 u16 device; 952 u16 function; 953}; 954 955 956struct acpi_mem_space_context 957{ 958 u32 length; 959 acpi_physical_address address; 960 acpi_physical_address mapped_physical_address; 961 u8 *mapped_logical_address; 962 acpi_size mapped_length; 963}; 964 965 966/* 967 * Definitions for Resource Attributes 968 */ 969 970/* 971 * Memory Attributes 972 */ 973#define ACPI_READ_ONLY_MEMORY (u8) 0x00 974#define ACPI_READ_WRITE_MEMORY (u8) 0x01 975 976#define ACPI_NON_CACHEABLE_MEMORY (u8) 0x00 977#define ACPI_CACHABLE_MEMORY (u8) 0x01 978#define ACPI_WRITE_COMBINING_MEMORY (u8) 0x02 979#define ACPI_PREFETCHABLE_MEMORY (u8) 0x03 980 981/* 982 * IO Attributes 983 * The ISA Io ranges are: n000-n0_ffh, n400-n4_ffh, n800-n8_ffh, n_c00-n_cFFh. 984 * The non-ISA Io ranges are: n100-n3_ffh, n500-n7_ffh, n900-n_bFfh, n_cd0-n_fFFh. 985 */ 986#define ACPI_NON_ISA_ONLY_RANGES (u8) 0x01 987#define ACPI_ISA_ONLY_RANGES (u8) 0x02 988#define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES) 989 990#define ACPI_SPARSE_TRANSLATION (u8) 0x03 991 992/* 993 * IO Port Descriptor Decode 994 */ 995#define ACPI_DECODE_10 (u8) 0x00 /* 10-bit IO address decode */ 996#define ACPI_DECODE_16 (u8) 0x01 /* 16-bit IO address decode */ 997 998/* 999 * IRQ Attributes 1000 */ 1001#define ACPI_EDGE_SENSITIVE (u8) 0x00 1002#define ACPI_LEVEL_SENSITIVE (u8) 0x01 1003 1004#define ACPI_ACTIVE_HIGH (u8) 0x00 1005#define ACPI_ACTIVE_LOW (u8) 0x01 1006 1007#define ACPI_EXCLUSIVE (u8) 0x00 1008#define ACPI_SHARED (u8) 0x01 1009 1010/* 1011 * DMA Attributes 1012 */ 1013#define ACPI_COMPATIBILITY (u8) 0x00 1014#define ACPI_TYPE_A (u8) 0x01 1015#define ACPI_TYPE_B (u8) 0x02 1016#define ACPI_TYPE_F (u8) 0x03 1017 1018#define ACPI_NOT_BUS_MASTER (u8) 0x00 1019#define ACPI_BUS_MASTER (u8) 0x01 1020 1021#define ACPI_TRANSFER_8 (u8) 0x00 1022#define ACPI_TRANSFER_8_16 (u8) 0x01 1023#define ACPI_TRANSFER_16 (u8) 0x02 1024 1025/* 1026 * Start Dependent Functions Priority definitions 1027 */ 1028#define ACPI_GOOD_CONFIGURATION (u8) 0x00 1029#define ACPI_ACCEPTABLE_CONFIGURATION (u8) 0x01 1030#define ACPI_SUB_OPTIMAL_CONFIGURATION (u8) 0x02 1031 1032/* 1033 * 16, 32 and 64-bit Address Descriptor resource types 1034 */ 1035#define ACPI_MEMORY_RANGE (u8) 0x00 1036#define ACPI_IO_RANGE (u8) 0x01 1037#define ACPI_BUS_NUMBER_RANGE (u8) 0x02 1038 1039#define ACPI_ADDRESS_NOT_FIXED (u8) 0x00 1040#define ACPI_ADDRESS_FIXED (u8) 0x01 1041 1042#define ACPI_POS_DECODE (u8) 0x00 1043#define ACPI_SUB_DECODE (u8) 0x01 1044 1045#define ACPI_PRODUCER (u8) 0x00 1046#define ACPI_CONSUMER (u8) 0x01 1047 1048 1049/* 1050 * Structures used to describe device resources 1051 */ 1052struct acpi_resource_irq 1053{ 1054 u32 edge_level; 1055 u32 active_high_low; 1056 u32 shared_exclusive; 1057 u32 number_of_interrupts; 1058 u32 interrupts[1]; 1059}; 1060 1061struct acpi_resource_dma 1062{ 1063 u32 type; 1064 u32 bus_master; 1065 u32 transfer; 1066 u32 number_of_channels; 1067 u32 channels[1]; 1068}; 1069 1070struct acpi_resource_start_dpf 1071{ 1072 u32 compatibility_priority; 1073 u32 performance_robustness; 1074}; 1075 1076/* 1077 * END_DEPENDENT_FUNCTIONS_RESOURCE struct is not 1078 * needed because it has no fields 1079 */ 1080 1081struct acpi_resource_io 1082{ 1083 u32 io_decode; 1084 u32 min_base_address; 1085 u32 max_base_address; 1086 u32 alignment; 1087 u32 range_length; 1088}; 1089 1090struct acpi_resource_fixed_io 1091{ 1092 u32 base_address; 1093 u32 range_length; 1094}; 1095 1096struct acpi_resource_vendor 1097{ 1098 u32 length; 1099 u8 reserved[1]; 1100}; 1101 1102struct acpi_resource_end_tag 1103{ 1104 u8 checksum; 1105}; 1106 1107struct acpi_resource_mem24 1108{ 1109 u32 read_write_attribute; 1110 u32 min_base_address; 1111 u32 max_base_address; 1112 u32 alignment; 1113 u32 range_length; 1114}; 1115 1116struct acpi_resource_mem32 1117{ 1118 u32 read_write_attribute; 1119 u32 min_base_address; 1120 u32 max_base_address; 1121 u32 alignment; 1122 u32 range_length; 1123}; 1124 1125struct acpi_resource_fixed_mem32 1126{ 1127 u32 read_write_attribute; 1128 u32 range_base_address; 1129 u32 range_length; 1130}; 1131 1132struct acpi_memory_attribute 1133{ 1134 u16 cache_attribute; 1135 u16 read_write_attribute; 1136}; 1137 1138struct acpi_io_attribute 1139{ 1140 u16 range_attribute; 1141 u16 translation_attribute; 1142}; 1143 1144struct acpi_bus_attribute 1145{ 1146 u16 reserved1; 1147 u16 reserved2; 1148}; 1149 1150union acpi_resource_attribute 1151{ 1152 struct acpi_memory_attribute memory; 1153 struct acpi_io_attribute io; 1154 struct acpi_bus_attribute bus; 1155}; 1156 1157struct acpi_resource_source 1158{ 1159 u32 index; 1160 u32 string_length; 1161 char *string_ptr; 1162}; 1163 1164struct acpi_resource_address16 1165{ 1166 u32 resource_type; 1167 u32 producer_consumer; 1168 u32 decode; 1169 u32 min_address_fixed; 1170 u32 max_address_fixed; 1171 union acpi_resource_attribute attribute; 1172 u32 granularity; 1173 u32 min_address_range; 1174 u32 max_address_range; 1175 u32 address_translation_offset; 1176 u32 address_length; 1177 struct acpi_resource_source resource_source; 1178}; 1179 1180struct acpi_resource_address32 1181{ 1182 u32 resource_type; 1183 u32 producer_consumer; 1184 u32 decode; 1185 u32 min_address_fixed; 1186 u32 max_address_fixed; 1187 union acpi_resource_attribute attribute; 1188 u32 granularity; 1189 u32 min_address_range; 1190 u32 max_address_range; 1191 u32 address_translation_offset; 1192 u32 address_length; 1193 struct acpi_resource_source resource_source; 1194}; 1195 1196struct acpi_resource_address64 1197{ 1198 u32 resource_type; 1199 u32 producer_consumer; 1200 u32 decode; 1201 u32 min_address_fixed; 1202 u32 max_address_fixed; 1203 union acpi_resource_attribute attribute; 1204 u64 granularity; 1205 u64 min_address_range; 1206 u64 max_address_range; 1207 u64 address_translation_offset; 1208 u64 address_length; 1209 u64 type_specific_attributes; 1210 struct acpi_resource_source resource_source; 1211}; 1212 1213struct acpi_resource_ext_irq 1214{ 1215 u32 producer_consumer; 1216 u32 edge_level; 1217 u32 active_high_low; 1218 u32 shared_exclusive; 1219 u32 number_of_interrupts; 1220 struct acpi_resource_source resource_source; 1221 u32 interrupts[1]; 1222}; 1223 1224 1225/* ACPI_RESOURCE_TYPEs */ 1226 1227#define ACPI_RSTYPE_IRQ 0 1228#define ACPI_RSTYPE_DMA 1 1229#define ACPI_RSTYPE_START_DPF 2 1230#define ACPI_RSTYPE_END_DPF 3 1231#define ACPI_RSTYPE_IO 4 1232#define ACPI_RSTYPE_FIXED_IO 5 1233#define ACPI_RSTYPE_VENDOR 6 1234#define ACPI_RSTYPE_END_TAG 7 1235#define ACPI_RSTYPE_MEM24 8 1236#define ACPI_RSTYPE_MEM32 9 1237#define ACPI_RSTYPE_FIXED_MEM32 10 1238#define ACPI_RSTYPE_ADDRESS16 11 1239#define ACPI_RSTYPE_ADDRESS32 12 1240#define ACPI_RSTYPE_ADDRESS64 13 1241#define ACPI_RSTYPE_EXT_IRQ 14 1242 1243typedef u32 acpi_resource_type; 1244 1245union acpi_resource_data 1246{ 1247 struct acpi_resource_irq irq; 1248 struct acpi_resource_dma dma; 1249 struct acpi_resource_start_dpf start_dpf; 1250 struct acpi_resource_io io; 1251 struct acpi_resource_fixed_io fixed_io; 1252 struct acpi_resource_vendor vendor_specific; 1253 struct acpi_resource_end_tag end_tag; 1254 struct acpi_resource_mem24 memory24; 1255 struct acpi_resource_mem32 memory32; 1256 struct acpi_resource_fixed_mem32 fixed_memory32; 1257 struct acpi_resource_address16 address16; 1258 struct acpi_resource_address32 address32; 1259 struct acpi_resource_address64 address64; 1260 struct acpi_resource_ext_irq extended_irq; 1261}; 1262 1263struct acpi_resource 1264{ 1265 acpi_resource_type id; 1266 u32 length; 1267 union acpi_resource_data data; 1268}; 1269 1270#define ACPI_RESOURCE_LENGTH 12 1271#define ACPI_RESOURCE_LENGTH_NO_DATA 8 /* Id + Length fields */ 1272 1273#define ACPI_SIZEOF_RESOURCE(type) (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (type)) 1274 1275#define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length) 1276 1277#ifdef ACPI_MISALIGNED_TRANSFERS 1278#define ACPI_ALIGN_RESOURCE_SIZE(length) (length) 1279#else 1280#define ACPI_ALIGN_RESOURCE_SIZE(length) ACPI_ROUND_UP_TO_NATIVE_WORD(length) 1281#endif 1282 1283/* 1284 * END: of definitions for Resource Attributes 1285 */ 1286 1287 1288struct acpi_pci_routing_table 1289{ 1290 u32 length; 1291 u32 pin; 1292 acpi_integer address; /* here for 64-bit alignment */ 1293 u32 source_index; 1294 char source[4]; /* pad to 64 bits so sizeof() works in all cases */ 1295}; 1296 1297/* 1298 * END: of definitions for PCI Routing tables 1299 */ 1300 1301 1302#endif /* __ACTYPES_H__ */