1 /****************************************************************************** 2 * 3 * Name: actypes.h - Common data types for the entire ACPI subsystem 4 * 5 *****************************************************************************/ 6 7 /* 8 * Copyright (C) 2000 - 2014, Intel Corp. 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 /* acpisrc:StructDefs -- for acpisrc conversion */ 48 49 /* 50 * ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent header 51 * and must be either 32 or 64. 16-bit ACPICA is no longer supported, as of 52 * 12/2006. 53 */ 54 #ifndef ACPI_MACHINE_WIDTH 55 #error ACPI_MACHINE_WIDTH not defined 56 #endif 57 58 /* 59 * Data type ranges 60 * Note: These macros are designed to be compiler independent as well as 61 * working around problems that some 32-bit compilers have with 64-bit 62 * constants. 63 */ 64 #define ACPI_UINT8_MAX (UINT8) (~((UINT8) 0)) /* 0xFF */ 65 #define ACPI_UINT16_MAX (UINT16)(~((UINT16) 0)) /* 0xFFFF */ 66 #define ACPI_UINT32_MAX (UINT32)(~((UINT32) 0)) /* 0xFFFFFFFF */ 67 #define ACPI_UINT64_MAX (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */ 68 #define ACPI_ASCII_MAX 0x7F 69 70 71 /* 72 * Architecture-specific ACPICA Subsystem Data Types 73 * 74 * The goal of these types is to provide source code portability across 75 * 16-bit, 32-bit, and 64-bit targets. 76 * 77 * 1) The following types are of fixed size for all targets (16/32/64): 78 * 79 * BOOLEAN Logical boolean 80 * 81 * UINT8 8-bit (1 byte) unsigned value 82 * UINT16 16-bit (2 byte) unsigned value 83 * UINT32 32-bit (4 byte) unsigned value 84 * UINT64 64-bit (8 byte) unsigned value 85 * 86 * INT16 16-bit (2 byte) signed value 87 * INT32 32-bit (4 byte) signed value 88 * INT64 64-bit (8 byte) signed value 89 * 90 * COMPILER_DEPENDENT_UINT64/INT64 - These types are defined in the 91 * compiler-dependent header(s) and were introduced because there is no common 92 * 64-bit integer type across the various compilation models, as shown in 93 * the table below. 94 * 95 * Datatype LP64 ILP64 LLP64 ILP32 LP32 16bit 96 * char 8 8 8 8 8 8 97 * short 16 16 16 16 16 16 98 * _int32 32 99 * int 32 64 32 32 16 16 100 * long 64 64 32 32 32 32 101 * long long 64 64 102 * pointer 64 64 64 32 32 32 103 * 104 * Note: ILP64 and LP32 are currently not supported. 105 * 106 * 107 * 2) These types represent the native word size of the target mode of the 108 * processor, and may be 16-bit, 32-bit, or 64-bit as required. They are 109 * usually used for memory allocation, efficient loop counters, and array 110 * indexes. The types are similar to the size_t type in the C library and are 111 * required because there is no C type that consistently represents the native 112 * data width. ACPI_SIZE is needed because there is no guarantee that a 113 * kernel-level C library is present. 114 * 115 * ACPI_SIZE 16/32/64-bit unsigned value 116 * ACPI_NATIVE_INT 16/32/64-bit signed value 117 */ 118 119 /******************************************************************************* 120 * 121 * Common types for all compilers, all targets 122 * 123 ******************************************************************************/ 124 125 #ifndef ACPI_USE_SYSTEM_INTTYPES 126 127 typedef unsigned char BOOLEAN; 128 typedef unsigned char UINT8; 129 typedef unsigned short UINT16; 130 typedef COMPILER_DEPENDENT_UINT64 UINT64; 131 typedef COMPILER_DEPENDENT_INT64 INT64; 132 133 #endif /* ACPI_USE_SYSTEM_INTTYPES */ 134 135 /* 136 * Value returned by AcpiOsGetThreadId. There is no standard "thread_id" 137 * across operating systems or even the various UNIX systems. Since ACPICA 138 * only needs the thread ID as a unique thread identifier, we use a UINT64 139 * as the only common data type - it will accommodate any type of pointer or 140 * any type of integer. It is up to the host-dependent OSL to cast the 141 * native thread ID type to a UINT64 (in AcpiOsGetThreadId). 142 */ 143 #define ACPI_THREAD_ID UINT64 144 145 146 /******************************************************************************* 147 * 148 * Types specific to 64-bit targets 149 * 150 ******************************************************************************/ 151 152 #if ACPI_MACHINE_WIDTH == 64 153 154 #ifndef ACPI_USE_SYSTEM_INTTYPES 155 156 typedef unsigned int UINT32; 157 typedef int INT32; 158 159 #endif /* ACPI_USE_SYSTEM_INTTYPES */ 160 161 162 typedef INT64 ACPI_NATIVE_INT; 163 typedef UINT64 ACPI_SIZE; 164 typedef UINT64 ACPI_IO_ADDRESS; 165 typedef UINT64 ACPI_PHYSICAL_ADDRESS; 166 167 #define ACPI_MAX_PTR ACPI_UINT64_MAX 168 #define ACPI_SIZE_MAX ACPI_UINT64_MAX 169 #define ACPI_USE_NATIVE_DIVIDE /* Has native 64-bit integer support */ 170 171 /* 172 * In the case of the Itanium Processor Family (IPF), the hardware does not 173 * support misaligned memory transfers. Set the MISALIGNMENT_NOT_SUPPORTED flag 174 * to indicate that special precautions must be taken to avoid alignment faults. 175 * (IA64 or ia64 is currently used by existing compilers to indicate IPF.) 176 * 177 * Note: EM64T and other X86-64 processors support misaligned transfers, 178 * so there is no need to define this flag. 179 */ 180 #if defined (__IA64__) || defined (__ia64__) 181 #define ACPI_MISALIGNMENT_NOT_SUPPORTED 182 #endif 183 184 185 /******************************************************************************* 186 * 187 * Types specific to 32-bit targets 188 * 189 ******************************************************************************/ 190 191 #elif ACPI_MACHINE_WIDTH == 32 192 193 #ifndef ACPI_USE_SYSTEM_INTTYPES 194 195 typedef unsigned int UINT32; 196 typedef int INT32; 197 198 #endif /* ACPI_USE_SYSTEM_INTTYPES */ 199 200 201 typedef INT32 ACPI_NATIVE_INT; 202 typedef UINT32 ACPI_SIZE; 203 typedef UINT32 ACPI_IO_ADDRESS; 204 typedef UINT32 ACPI_PHYSICAL_ADDRESS; 205 206 #define ACPI_MAX_PTR ACPI_UINT32_MAX 207 #define ACPI_SIZE_MAX ACPI_UINT32_MAX 208 209 #else 210 211 /* ACPI_MACHINE_WIDTH must be either 64 or 32 */ 212 213 #error unknown ACPI_MACHINE_WIDTH 214 #endif 215 216 217 /******************************************************************************* 218 * 219 * OS-dependent types 220 * 221 * If the defaults below are not appropriate for the host system, they can 222 * be defined in the OS-specific header, and this will take precedence. 223 * 224 ******************************************************************************/ 225 226 /* Flags for AcpiOsAcquireLock/AcpiOsReleaseLock */ 227 228 #ifndef ACPI_CPU_FLAGS 229 #define ACPI_CPU_FLAGS ACPI_SIZE 230 #endif 231 232 /* Object returned from AcpiOsCreateCache */ 233 234 #ifndef ACPI_CACHE_T 235 #ifdef ACPI_USE_LOCAL_CACHE 236 #define ACPI_CACHE_T ACPI_MEMORY_LIST 237 #else 238 #define ACPI_CACHE_T void * 239 #endif 240 #endif 241 242 /* 243 * Synchronization objects - Mutexes, Semaphores, and SpinLocks 244 */ 245 #if (ACPI_MUTEX_TYPE == ACPI_BINARY_SEMAPHORE) 246 /* 247 * These macros are used if the host OS does not support a mutex object. 248 * Map the OSL Mutex interfaces to binary semaphores. 249 */ 250 #define ACPI_MUTEX ACPI_SEMAPHORE 251 #define AcpiOsCreateMutex(OutHandle) AcpiOsCreateSemaphore (1, 1, OutHandle) 252 #define AcpiOsDeleteMutex(Handle) (void) AcpiOsDeleteSemaphore (Handle) 253 #define AcpiOsAcquireMutex(Handle,Time) AcpiOsWaitSemaphore (Handle, 1, Time) 254 #define AcpiOsReleaseMutex(Handle) (void) AcpiOsSignalSemaphore (Handle, 1) 255 #endif 256 257 /* Configurable types for synchronization objects */ 258 259 #ifndef ACPI_SPINLOCK 260 #define ACPI_SPINLOCK void * 261 #endif 262 263 #ifndef ACPI_SEMAPHORE 264 #define ACPI_SEMAPHORE void * 265 #endif 266 267 #ifndef ACPI_MUTEX 268 #define ACPI_MUTEX void * 269 #endif 270 271 272 /******************************************************************************* 273 * 274 * Compiler-dependent types 275 * 276 * If the defaults below are not appropriate for the host compiler, they can 277 * be defined in the compiler-specific header, and this will take precedence. 278 * 279 ******************************************************************************/ 280 281 /* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */ 282 283 #ifndef ACPI_UINTPTR_T 284 #define ACPI_UINTPTR_T void * 285 #endif 286 287 /* 288 * ACPI_PRINTF_LIKE is used to tag functions as "printf-like" because 289 * some compilers can catch printf format string problems 290 */ 291 #ifndef ACPI_PRINTF_LIKE 292 #define ACPI_PRINTF_LIKE(c) 293 #endif 294 295 /* 296 * Some compilers complain about unused variables. Sometimes we don't want to 297 * use all the variables (for example, _AcpiModuleName). This allows us 298 * to tell the compiler in a per-variable manner that a variable 299 * is unused 300 */ 301 #ifndef ACPI_UNUSED_VAR 302 #define ACPI_UNUSED_VAR 303 #endif 304 305 /* 306 * All ACPICA external functions that are available to the rest of the kernel 307 * are tagged with thes macros which can be defined as appropriate for the host. 308 * 309 * Notes: 310 * ACPI_EXPORT_SYMBOL_INIT is used for initialization and termination 311 * interfaces that may need special processing. 312 * ACPI_EXPORT_SYMBOL is used for all other public external functions. 313 */ 314 #ifndef ACPI_EXPORT_SYMBOL_INIT 315 #define ACPI_EXPORT_SYMBOL_INIT(Symbol) 316 #endif 317 318 #ifndef ACPI_EXPORT_SYMBOL 319 #define ACPI_EXPORT_SYMBOL(Symbol) 320 #endif 321 322 /* 323 * Compiler/Clibrary-dependent debug initialization. Used for ACPICA 324 * utilities only. 325 */ 326 #ifndef ACPI_DEBUG_INITIALIZE 327 #define ACPI_DEBUG_INITIALIZE() 328 #endif 329 330 331 /******************************************************************************* 332 * 333 * Configuration 334 * 335 ******************************************************************************/ 336 337 #ifdef ACPI_NO_MEM_ALLOCATIONS 338 339 #define ACPI_ALLOCATE(a) NULL 340 #define ACPI_ALLOCATE_ZEROED(a) NULL 341 #define ACPI_FREE(a) 342 #define ACPI_MEM_TRACKING(a) 343 344 #else /* ACPI_NO_MEM_ALLOCATIONS */ 345 346 #ifdef ACPI_DBG_TRACK_ALLOCATIONS 347 /* 348 * Memory allocation tracking (used by AcpiExec to detect memory leaks) 349 */ 350 #define ACPI_MEM_PARAMETERS _COMPONENT, _AcpiModuleName, __LINE__ 351 #define ACPI_ALLOCATE(a) AcpiUtAllocateAndTrack ((ACPI_SIZE) (a), ACPI_MEM_PARAMETERS) 352 #define ACPI_ALLOCATE_ZEROED(a) AcpiUtAllocateZeroedAndTrack ((ACPI_SIZE) (a), ACPI_MEM_PARAMETERS) 353 #define ACPI_FREE(a) AcpiUtFreeAndTrack (a, ACPI_MEM_PARAMETERS) 354 #define ACPI_MEM_TRACKING(a) a 355 356 #else 357 /* 358 * Normal memory allocation directly via the OS services layer 359 */ 360 #define ACPI_ALLOCATE(a) AcpiOsAllocate ((ACPI_SIZE) (a)) 361 #define ACPI_ALLOCATE_ZEROED(a) AcpiOsAllocateZeroed ((ACPI_SIZE) (a)) 362 #define ACPI_FREE(a) AcpiOsFree (a) 363 #define ACPI_MEM_TRACKING(a) 364 365 #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ 366 367 #endif /* ACPI_NO_MEM_ALLOCATIONS */ 368 369 370 /****************************************************************************** 371 * 372 * ACPI Specification constants (Do not change unless the specification changes) 373 * 374 *****************************************************************************/ 375 376 /* Number of distinct FADT-based GPE register blocks (GPE0 and GPE1) */ 377 378 #define ACPI_MAX_GPE_BLOCKS 2 379 380 /* Default ACPI register widths */ 381 382 #define ACPI_GPE_REGISTER_WIDTH 8 383 #define ACPI_PM1_REGISTER_WIDTH 16 384 #define ACPI_PM2_REGISTER_WIDTH 8 385 #define ACPI_PM_TIMER_WIDTH 32 386 #define ACPI_RESET_REGISTER_WIDTH 8 387 388 /* Names within the namespace are 4 bytes long */ 389 390 #define ACPI_NAME_SIZE 4 391 #define ACPI_PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */ 392 #define ACPI_PATH_SEPARATOR '.' 393 394 /* Sizes for ACPI table headers */ 395 396 #define ACPI_OEM_ID_SIZE 6 397 #define ACPI_OEM_TABLE_ID_SIZE 8 398 399 /* ACPI/PNP hardware IDs */ 400 401 #define PCI_ROOT_HID_STRING "PNP0A03" 402 #define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08" 403 404 /* PM Timer ticks per second (HZ) */ 405 406 #define ACPI_PM_TIMER_FREQUENCY 3579545 407 408 409 /******************************************************************************* 410 * 411 * Independent types 412 * 413 ******************************************************************************/ 414 415 /* Logical defines and NULL */ 416 417 #ifdef FALSE 418 #undef FALSE 419 #endif 420 #define FALSE (1 == 0) 421 422 #ifdef TRUE 423 #undef TRUE 424 #endif 425 #define TRUE (1 == 1) 426 427 #ifndef NULL 428 #define NULL (void *) 0 429 #endif 430 431 432 /* 433 * Miscellaneous types 434 */ 435 typedef UINT32 ACPI_STATUS; /* All ACPI Exceptions */ 436 typedef UINT32 ACPI_NAME; /* 4-byte ACPI name */ 437 typedef char * ACPI_STRING; /* Null terminated ASCII string */ 438 typedef void * ACPI_HANDLE; /* Actually a ptr to a NS Node */ 439 440 441 /* Time constants for timer calculations */ 442 443 #define ACPI_MSEC_PER_SEC 1000L 444 445 #define ACPI_USEC_PER_MSEC 1000L 446 #define ACPI_USEC_PER_SEC 1000000L 447 448 #define ACPI_100NSEC_PER_USEC 10L 449 #define ACPI_100NSEC_PER_MSEC 10000L 450 #define ACPI_100NSEC_PER_SEC 10000000L 451 452 #define ACPI_NSEC_PER_USEC 1000L 453 #define ACPI_NSEC_PER_MSEC 1000000L 454 #define ACPI_NSEC_PER_SEC 1000000000L 455 456 457 /* Owner IDs are used to track namespace nodes for selective deletion */ 458 459 typedef UINT8 ACPI_OWNER_ID; 460 #define ACPI_OWNER_ID_MAX 0xFF 461 462 463 #define ACPI_INTEGER_BIT_SIZE 64 464 #define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */ 465 #define ACPI_MAX64_DECIMAL_DIGITS 20 466 #define ACPI_MAX32_DECIMAL_DIGITS 10 467 #define ACPI_MAX16_DECIMAL_DIGITS 5 468 #define ACPI_MAX8_DECIMAL_DIGITS 3 469 470 /* 471 * Constants with special meanings 472 */ 473 #define ACPI_ROOT_OBJECT ACPI_ADD_PTR (ACPI_HANDLE, NULL, ACPI_MAX_PTR) 474 #define ACPI_WAIT_FOREVER 0xFFFF /* UINT16, as per ACPI spec */ 475 #define ACPI_DO_NOT_WAIT 0 476 477 /* 478 * Obsolete: Acpi integer width. In ACPI version 1 (1996), integers are 32 bits. 479 * In ACPI version 2 (2000) and later, integers are 64 bits. Note that this 480 * pertains to the ACPI integer type only, not to other integers used in the 481 * implementation of the ACPICA subsystem. 482 * 483 * 01/2010: This type is obsolete and has been removed from the entire ACPICA 484 * code base. It remains here for compatibility with device drivers that use 485 * the type. However, it will be removed in the future. 486 */ 487 typedef UINT64 ACPI_INTEGER; 488 #define ACPI_INTEGER_MAX ACPI_UINT64_MAX 489 490 491 /******************************************************************************* 492 * 493 * Commonly used macros 494 * 495 ******************************************************************************/ 496 497 /* Data manipulation */ 498 499 #define ACPI_LOBYTE(Integer) ((UINT8) (UINT16)(Integer)) 500 #define ACPI_HIBYTE(Integer) ((UINT8) (((UINT16)(Integer)) >> 8)) 501 #define ACPI_LOWORD(Integer) ((UINT16) (UINT32)(Integer)) 502 #define ACPI_HIWORD(Integer) ((UINT16)(((UINT32)(Integer)) >> 16)) 503 #define ACPI_LODWORD(Integer64) ((UINT32) (UINT64)(Integer64)) 504 #define ACPI_HIDWORD(Integer64) ((UINT32)(((UINT64)(Integer64)) >> 32)) 505 506 #define ACPI_SET_BIT(target,bit) ((target) |= (bit)) 507 #define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit)) 508 #define ACPI_MIN(a,b) (((a)<(b))?(a):(b)) 509 #define ACPI_MAX(a,b) (((a)>(b))?(a):(b)) 510 511 /* Size calculation */ 512 513 #define ACPI_ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0])) 514 515 /* Pointer manipulation */ 516 517 #define ACPI_CAST_PTR(t, p) ((t *) (ACPI_UINTPTR_T) (p)) 518 #define ACPI_CAST_INDIRECT_PTR(t, p) ((t **) (ACPI_UINTPTR_T) (p)) 519 #define ACPI_ADD_PTR(t, a, b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) + (ACPI_SIZE)(b))) 520 #define ACPI_PTR_DIFF(a, b) (ACPI_SIZE) (ACPI_CAST_PTR (UINT8, (a)) - ACPI_CAST_PTR (UINT8, (b))) 521 522 /* Pointer/Integer type conversions */ 523 524 #define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void, (void *) NULL,(ACPI_SIZE) i) 525 #define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p, (void *) NULL) 526 #define ACPI_OFFSET(d, f) (ACPI_SIZE) ACPI_PTR_DIFF (&(((d *)0)->f), (void *) NULL) 527 #define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i) 528 #define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) 529 530 /* Optimizations for 4-character (32-bit) ACPI_NAME manipulation */ 531 532 #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED 533 #define ACPI_COMPARE_NAME(a,b) (*ACPI_CAST_PTR (UINT32, (a)) == *ACPI_CAST_PTR (UINT32, (b))) 534 #define ACPI_MOVE_NAME(dest,src) (*ACPI_CAST_PTR (UINT32, (dest)) = *ACPI_CAST_PTR (UINT32, (src))) 535 #else 536 #define ACPI_COMPARE_NAME(a,b) (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE)) 537 #define ACPI_MOVE_NAME(dest,src) (ACPI_STRNCPY (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src)), ACPI_NAME_SIZE)) 538 #endif 539 540 /* Support for the special RSDP signature (8 characters) */ 541 542 #define ACPI_VALIDATE_RSDP_SIG(a) (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, 8)) 543 #define ACPI_MAKE_RSDP_SIG(dest) (ACPI_MEMCPY (ACPI_CAST_PTR (char, (dest)), ACPI_SIG_RSDP, 8)) 544 545 546 /******************************************************************************* 547 * 548 * Miscellaneous constants 549 * 550 ******************************************************************************/ 551 552 /* 553 * Initialization sequence 554 */ 555 #define ACPI_FULL_INITIALIZATION 0x00 556 #define ACPI_NO_ADDRESS_SPACE_INIT 0x01 557 #define ACPI_NO_HARDWARE_INIT 0x02 558 #define ACPI_NO_EVENT_INIT 0x04 559 #define ACPI_NO_HANDLER_INIT 0x08 560 #define ACPI_NO_ACPI_ENABLE 0x10 561 #define ACPI_NO_DEVICE_INIT 0x20 562 #define ACPI_NO_OBJECT_INIT 0x40 563 564 /* 565 * Initialization state 566 */ 567 #define ACPI_SUBSYSTEM_INITIALIZE 0x01 568 #define ACPI_INITIALIZED_OK 0x02 569 570 /* 571 * Power state values 572 */ 573 #define ACPI_STATE_UNKNOWN (UINT8) 0xFF 574 575 #define ACPI_STATE_S0 (UINT8) 0 576 #define ACPI_STATE_S1 (UINT8) 1 577 #define ACPI_STATE_S2 (UINT8) 2 578 #define ACPI_STATE_S3 (UINT8) 3 579 #define ACPI_STATE_S4 (UINT8) 4 580 #define ACPI_STATE_S5 (UINT8) 5 581 #define ACPI_S_STATES_MAX ACPI_STATE_S5 582 #define ACPI_S_STATE_COUNT 6 583 584 #define ACPI_STATE_D0 (UINT8) 0 585 #define ACPI_STATE_D1 (UINT8) 1 586 #define ACPI_STATE_D2 (UINT8) 2 587 #define ACPI_STATE_D3 (UINT8) 3 588 #define ACPI_D_STATES_MAX ACPI_STATE_D3 589 #define ACPI_D_STATE_COUNT 4 590 591 #define ACPI_STATE_C0 (UINT8) 0 592 #define ACPI_STATE_C1 (UINT8) 1 593 #define ACPI_STATE_C2 (UINT8) 2 594 #define ACPI_STATE_C3 (UINT8) 3 595 #define ACPI_C_STATES_MAX ACPI_STATE_C3 596 #define ACPI_C_STATE_COUNT 4 597 598 /* 599 * Sleep type invalid value 600 */ 601 #define ACPI_SLEEP_TYPE_MAX 0x7 602 #define ACPI_SLEEP_TYPE_INVALID 0xFF 603 604 /* 605 * Standard notify values 606 */ 607 #define ACPI_NOTIFY_BUS_CHECK (UINT8) 0x00 608 #define ACPI_NOTIFY_DEVICE_CHECK (UINT8) 0x01 609 #define ACPI_NOTIFY_DEVICE_WAKE (UINT8) 0x02 610 #define ACPI_NOTIFY_EJECT_REQUEST (UINT8) 0x03 611 #define ACPI_NOTIFY_DEVICE_CHECK_LIGHT (UINT8) 0x04 612 #define ACPI_NOTIFY_FREQUENCY_MISMATCH (UINT8) 0x05 613 #define ACPI_NOTIFY_BUS_MODE_MISMATCH (UINT8) 0x06 614 #define ACPI_NOTIFY_POWER_FAULT (UINT8) 0x07 615 #define ACPI_NOTIFY_CAPABILITIES_CHECK (UINT8) 0x08 616 #define ACPI_NOTIFY_DEVICE_PLD_CHECK (UINT8) 0x09 617 #define ACPI_NOTIFY_RESERVED (UINT8) 0x0A 618 #define ACPI_NOTIFY_LOCALITY_UPDATE (UINT8) 0x0B 619 #define ACPI_NOTIFY_SHUTDOWN_REQUEST (UINT8) 0x0C 620 621 #define ACPI_NOTIFY_MAX 0x0C 622 623 /* 624 * Types associated with ACPI names and objects. The first group of 625 * values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition 626 * of the ACPI ObjectType() operator (See the ACPI Spec). Therefore, 627 * only add to the first group if the spec changes. 628 * 629 * NOTE: Types must be kept in sync with the global AcpiNsProperties 630 * and AcpiNsTypeNames arrays. 631 */ 632 typedef UINT32 ACPI_OBJECT_TYPE; 633 634 #define ACPI_TYPE_ANY 0x00 635 #define ACPI_TYPE_INTEGER 0x01 /* Byte/Word/Dword/Zero/One/Ones */ 636 #define ACPI_TYPE_STRING 0x02 637 #define ACPI_TYPE_BUFFER 0x03 638 #define ACPI_TYPE_PACKAGE 0x04 /* ByteConst, multiple DataTerm/Constant/SuperName */ 639 #define ACPI_TYPE_FIELD_UNIT 0x05 640 #define ACPI_TYPE_DEVICE 0x06 /* Name, multiple Node */ 641 #define ACPI_TYPE_EVENT 0x07 642 #define ACPI_TYPE_METHOD 0x08 /* Name, ByteConst, multiple Code */ 643 #define ACPI_TYPE_MUTEX 0x09 644 #define ACPI_TYPE_REGION 0x0A 645 #define ACPI_TYPE_POWER 0x0B /* Name,ByteConst,WordConst,multi Node */ 646 #define ACPI_TYPE_PROCESSOR 0x0C /* Name,ByteConst,DWordConst,ByteConst,multi NmO */ 647 #define ACPI_TYPE_THERMAL 0x0D /* Name, multiple Node */ 648 #define ACPI_TYPE_BUFFER_FIELD 0x0E 649 #define ACPI_TYPE_DDB_HANDLE 0x0F 650 #define ACPI_TYPE_DEBUG_OBJECT 0x10 651 652 #define ACPI_TYPE_EXTERNAL_MAX 0x10 653 654 /* 655 * These are object types that do not map directly to the ACPI 656 * ObjectType() operator. They are used for various internal purposes only. 657 * If new predefined ACPI_TYPEs are added (via the ACPI specification), these 658 * internal types must move upwards. (There is code that depends on these 659 * values being contiguous with the external types above.) 660 */ 661 #define ACPI_TYPE_LOCAL_REGION_FIELD 0x11 662 #define ACPI_TYPE_LOCAL_BANK_FIELD 0x12 663 #define ACPI_TYPE_LOCAL_INDEX_FIELD 0x13 664 #define ACPI_TYPE_LOCAL_REFERENCE 0x14 /* Arg#, Local#, Name, Debug, RefOf, Index */ 665 #define ACPI_TYPE_LOCAL_ALIAS 0x15 666 #define ACPI_TYPE_LOCAL_METHOD_ALIAS 0x16 667 #define ACPI_TYPE_LOCAL_NOTIFY 0x17 668 #define ACPI_TYPE_LOCAL_ADDRESS_HANDLER 0x18 669 #define ACPI_TYPE_LOCAL_RESOURCE 0x19 670 #define ACPI_TYPE_LOCAL_RESOURCE_FIELD 0x1A 671 #define ACPI_TYPE_LOCAL_SCOPE 0x1B /* 1 Name, multiple ObjectList Nodes */ 672 673 #define ACPI_TYPE_NS_NODE_MAX 0x1B /* Last typecode used within a NS Node */ 674 675 /* 676 * These are special object types that never appear in 677 * a Namespace node, only in an object of ACPI_OPERAND_OBJECT 678 */ 679 #define ACPI_TYPE_LOCAL_EXTRA 0x1C 680 #define ACPI_TYPE_LOCAL_DATA 0x1D 681 682 #define ACPI_TYPE_LOCAL_MAX 0x1D 683 684 /* All types above here are invalid */ 685 686 #define ACPI_TYPE_INVALID 0x1E 687 #define ACPI_TYPE_NOT_FOUND 0xFF 688 689 #define ACPI_NUM_NS_TYPES (ACPI_TYPE_INVALID + 1) 690 691 692 /* 693 * All I/O 694 */ 695 #define ACPI_READ 0 696 #define ACPI_WRITE 1 697 #define ACPI_IO_MASK 1 698 699 /* 700 * Event Types: Fixed & General Purpose 701 */ 702 typedef UINT32 ACPI_EVENT_TYPE; 703 704 /* 705 * Fixed events 706 */ 707 #define ACPI_EVENT_PMTIMER 0 708 #define ACPI_EVENT_GLOBAL 1 709 #define ACPI_EVENT_POWER_BUTTON 2 710 #define ACPI_EVENT_SLEEP_BUTTON 3 711 #define ACPI_EVENT_RTC 4 712 #define ACPI_EVENT_MAX 4 713 #define ACPI_NUM_FIXED_EVENTS ACPI_EVENT_MAX + 1 714 715 /* 716 * Event Status - Per event 717 * ------------- 718 * The encoding of ACPI_EVENT_STATUS is illustrated below. 719 * Note that a set bit (1) indicates the property is TRUE 720 * (e.g. if bit 0 is set then the event is enabled). 721 * +-------------+-+-+-+ 722 * | Bits 31:3 |2|1|0| 723 * +-------------+-+-+-+ 724 * | | | | 725 * | | | +- Enabled? 726 * | | +--- Enabled for wake? 727 * | +----- Set? 728 * +----------- <Reserved> 729 */ 730 typedef UINT32 ACPI_EVENT_STATUS; 731 732 #define ACPI_EVENT_FLAG_DISABLED (ACPI_EVENT_STATUS) 0x00 733 #define ACPI_EVENT_FLAG_ENABLED (ACPI_EVENT_STATUS) 0x01 734 #define ACPI_EVENT_FLAG_WAKE_ENABLED (ACPI_EVENT_STATUS) 0x02 735 #define ACPI_EVENT_FLAG_SET (ACPI_EVENT_STATUS) 0x04 736 737 /* Actions for AcpiSetGpe, AcpiGpeWakeup, AcpiHwLowSetGpe */ 738 739 #define ACPI_GPE_ENABLE 0 740 #define ACPI_GPE_DISABLE 1 741 #define ACPI_GPE_CONDITIONAL_ENABLE 2 742 743 /* 744 * GPE info flags - Per GPE 745 * +-------+-+-+---+ 746 * | 7:4 |3|2|1:0| 747 * +-------+-+-+---+ 748 * | | | | 749 * | | | +-- Type of dispatch:to method, handler, notify, or none 750 * | | +----- Interrupt type: edge or level triggered 751 * | +------- Is a Wake GPE 752 * +------------ <Reserved> 753 */ 754 #define ACPI_GPE_DISPATCH_NONE (UINT8) 0x00 755 #define ACPI_GPE_DISPATCH_METHOD (UINT8) 0x01 756 #define ACPI_GPE_DISPATCH_HANDLER (UINT8) 0x02 757 #define ACPI_GPE_DISPATCH_NOTIFY (UINT8) 0x03 758 #define ACPI_GPE_DISPATCH_MASK (UINT8) 0x03 759 760 #define ACPI_GPE_LEVEL_TRIGGERED (UINT8) 0x04 761 #define ACPI_GPE_EDGE_TRIGGERED (UINT8) 0x00 762 #define ACPI_GPE_XRUPT_TYPE_MASK (UINT8) 0x04 763 764 #define ACPI_GPE_CAN_WAKE (UINT8) 0x08 765 766 /* 767 * Flags for GPE and Lock interfaces 768 */ 769 #define ACPI_NOT_ISR 0x1 770 #define ACPI_ISR 0x0 771 772 773 /* Notify types */ 774 775 #define ACPI_SYSTEM_NOTIFY 0x1 776 #define ACPI_DEVICE_NOTIFY 0x2 777 #define ACPI_ALL_NOTIFY (ACPI_SYSTEM_NOTIFY | ACPI_DEVICE_NOTIFY) 778 #define ACPI_MAX_NOTIFY_HANDLER_TYPE 0x3 779 #define ACPI_NUM_NOTIFY_TYPES 2 780 781 #define ACPI_MAX_SYS_NOTIFY 0x7F 782 #define ACPI_MAX_DEVICE_SPECIFIC_NOTIFY 0xBF 783 784 #define ACPI_SYSTEM_HANDLER_LIST 0 /* Used as index, must be SYSTEM_NOTIFY -1 */ 785 #define ACPI_DEVICE_HANDLER_LIST 1 /* Used as index, must be DEVICE_NOTIFY -1 */ 786 787 788 /* Address Space (Operation Region) Types */ 789 790 typedef UINT8 ACPI_ADR_SPACE_TYPE; 791 792 #define ACPI_ADR_SPACE_SYSTEM_MEMORY (ACPI_ADR_SPACE_TYPE) 0 793 #define ACPI_ADR_SPACE_SYSTEM_IO (ACPI_ADR_SPACE_TYPE) 1 794 #define ACPI_ADR_SPACE_PCI_CONFIG (ACPI_ADR_SPACE_TYPE) 2 795 #define ACPI_ADR_SPACE_EC (ACPI_ADR_SPACE_TYPE) 3 796 #define ACPI_ADR_SPACE_SMBUS (ACPI_ADR_SPACE_TYPE) 4 797 #define ACPI_ADR_SPACE_CMOS (ACPI_ADR_SPACE_TYPE) 5 798 #define ACPI_ADR_SPACE_PCI_BAR_TARGET (ACPI_ADR_SPACE_TYPE) 6 799 #define ACPI_ADR_SPACE_IPMI (ACPI_ADR_SPACE_TYPE) 7 800 #define ACPI_ADR_SPACE_GPIO (ACPI_ADR_SPACE_TYPE) 8 801 #define ACPI_ADR_SPACE_GSBUS (ACPI_ADR_SPACE_TYPE) 9 802 #define ACPI_ADR_SPACE_PLATFORM_COMM (ACPI_ADR_SPACE_TYPE) 10 803 804 #define ACPI_NUM_PREDEFINED_REGIONS 11 805 806 /* 807 * Special Address Spaces 808 * 809 * Note: A Data Table region is a special type of operation region 810 * that has its own AML opcode. However, internally, the AML 811 * interpreter simply creates an operation region with an an address 812 * space type of ACPI_ADR_SPACE_DATA_TABLE. 813 */ 814 #define ACPI_ADR_SPACE_DATA_TABLE (ACPI_ADR_SPACE_TYPE) 0x7E /* Internal to ACPICA only */ 815 #define ACPI_ADR_SPACE_FIXED_HARDWARE (ACPI_ADR_SPACE_TYPE) 0x7F 816 817 /* Values for _REG connection code */ 818 819 #define ACPI_REG_DISCONNECT 0 820 #define ACPI_REG_CONNECT 1 821 822 /* 823 * BitRegister IDs 824 * 825 * These values are intended to be used by the hardware interfaces 826 * and are mapped to individual bitfields defined within the ACPI 827 * registers. See the AcpiGbl_BitRegisterInfo global table in utglobal.c 828 * for this mapping. 829 */ 830 831 /* PM1 Status register */ 832 833 #define ACPI_BITREG_TIMER_STATUS 0x00 834 #define ACPI_BITREG_BUS_MASTER_STATUS 0x01 835 #define ACPI_BITREG_GLOBAL_LOCK_STATUS 0x02 836 #define ACPI_BITREG_POWER_BUTTON_STATUS 0x03 837 #define ACPI_BITREG_SLEEP_BUTTON_STATUS 0x04 838 #define ACPI_BITREG_RT_CLOCK_STATUS 0x05 839 #define ACPI_BITREG_WAKE_STATUS 0x06 840 #define ACPI_BITREG_PCIEXP_WAKE_STATUS 0x07 841 842 /* PM1 Enable register */ 843 844 #define ACPI_BITREG_TIMER_ENABLE 0x08 845 #define ACPI_BITREG_GLOBAL_LOCK_ENABLE 0x09 846 #define ACPI_BITREG_POWER_BUTTON_ENABLE 0x0A 847 #define ACPI_BITREG_SLEEP_BUTTON_ENABLE 0x0B 848 #define ACPI_BITREG_RT_CLOCK_ENABLE 0x0C 849 #define ACPI_BITREG_PCIEXP_WAKE_DISABLE 0x0D 850 851 /* PM1 Control register */ 852 853 #define ACPI_BITREG_SCI_ENABLE 0x0E 854 #define ACPI_BITREG_BUS_MASTER_RLD 0x0F 855 #define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x10 856 #define ACPI_BITREG_SLEEP_TYPE 0x11 857 #define ACPI_BITREG_SLEEP_ENABLE 0x12 858 859 /* PM2 Control register */ 860 861 #define ACPI_BITREG_ARB_DISABLE 0x13 862 863 #define ACPI_BITREG_MAX 0x13 864 #define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1 865 866 867 /* Status register values. A 1 clears a status bit. 0 = no effect */ 868 869 #define ACPI_CLEAR_STATUS 1 870 871 /* Enable and Control register values */ 872 873 #define ACPI_ENABLE_EVENT 1 874 #define ACPI_DISABLE_EVENT 0 875 876 877 /* Sleep function dispatch */ 878 879 typedef ACPI_STATUS (*ACPI_SLEEP_FUNCTION) ( 880 UINT8 SleepState); 881 882 typedef struct acpi_sleep_functions 883 { 884 ACPI_SLEEP_FUNCTION LegacyFunction; 885 ACPI_SLEEP_FUNCTION ExtendedFunction; 886 887 } ACPI_SLEEP_FUNCTIONS; 888 889 890 /* 891 * External ACPI object definition 892 */ 893 894 /* 895 * Note: Type == ACPI_TYPE_ANY (0) is used to indicate a NULL package element 896 * or an unresolved named reference. 897 */ 898 typedef union acpi_object 899 { 900 ACPI_OBJECT_TYPE Type; /* See definition of AcpiNsType for values */ 901 struct 902 { 903 ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_INTEGER */ 904 UINT64 Value; /* The actual number */ 905 } Integer; 906 907 struct 908 { 909 ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_STRING */ 910 UINT32 Length; /* # of bytes in string, excluding trailing null */ 911 char *Pointer; /* points to the string value */ 912 } String; 913 914 struct 915 { 916 ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_BUFFER */ 917 UINT32 Length; /* # of bytes in buffer */ 918 UINT8 *Pointer; /* points to the buffer */ 919 } Buffer; 920 921 struct 922 { 923 ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_PACKAGE */ 924 UINT32 Count; /* # of elements in package */ 925 union acpi_object *Elements; /* Pointer to an array of ACPI_OBJECTs */ 926 } Package; 927 928 struct 929 { 930 ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_LOCAL_REFERENCE */ 931 ACPI_OBJECT_TYPE ActualType; /* Type associated with the Handle */ 932 ACPI_HANDLE Handle; /* object reference */ 933 } Reference; 934 935 struct 936 { 937 ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_PROCESSOR */ 938 UINT32 ProcId; 939 ACPI_IO_ADDRESS PblkAddress; 940 UINT32 PblkLength; 941 } Processor; 942 943 struct 944 { 945 ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_POWER */ 946 UINT32 SystemLevel; 947 UINT32 ResourceOrder; 948 } PowerResource; 949 950 } ACPI_OBJECT; 951 952 953 /* 954 * List of objects, used as a parameter list for control method evaluation 955 */ 956 typedef struct acpi_object_list 957 { 958 UINT32 Count; 959 ACPI_OBJECT *Pointer; 960 961 } ACPI_OBJECT_LIST; 962 963 964 /* 965 * Miscellaneous common Data Structures used by the interfaces 966 */ 967 #define ACPI_NO_BUFFER 0 968 969 #ifdef ACPI_NO_MEM_ALLOCATIONS 970 971 #define ACPI_ALLOCATE_BUFFER (ACPI_SIZE) (0) 972 #define ACPI_ALLOCATE_LOCAL_BUFFER (ACPI_SIZE) (0) 973 974 #else /* ACPI_NO_MEM_ALLOCATIONS */ 975 976 #define ACPI_ALLOCATE_BUFFER (ACPI_SIZE) (-1) /* Let ACPICA allocate buffer */ 977 #define ACPI_ALLOCATE_LOCAL_BUFFER (ACPI_SIZE) (-2) /* For internal use only (enables tracking) */ 978 979 #endif /* ACPI_NO_MEM_ALLOCATIONS */ 980 981 typedef struct acpi_buffer 982 { 983 ACPI_SIZE Length; /* Length in bytes of the buffer */ 984 void *Pointer; /* pointer to buffer */ 985 986 } ACPI_BUFFER; 987 988 989 /* 990 * NameType for AcpiGetName 991 */ 992 #define ACPI_FULL_PATHNAME 0 993 #define ACPI_SINGLE_NAME 1 994 #define ACPI_NAME_TYPE_MAX 1 995 996 997 /* 998 * Predefined Namespace items 999 */ 1000 typedef struct acpi_predefined_names 1001 { 1002 char *Name; 1003 UINT8 Type; 1004 char *Val; 1005 1006 } ACPI_PREDEFINED_NAMES; 1007 1008 1009 /* 1010 * Structure and flags for AcpiGetSystemInfo 1011 */ 1012 #define ACPI_SYS_MODE_UNKNOWN 0x0000 1013 #define ACPI_SYS_MODE_ACPI 0x0001 1014 #define ACPI_SYS_MODE_LEGACY 0x0002 1015 #define ACPI_SYS_MODES_MASK 0x0003 1016 1017 1018 /* 1019 * System info returned by AcpiGetSystemInfo() 1020 */ 1021 typedef struct acpi_system_info 1022 { 1023 UINT32 AcpiCaVersion; 1024 UINT32 Flags; 1025 UINT32 TimerResolution; 1026 UINT32 Reserved1; 1027 UINT32 Reserved2; 1028 UINT32 DebugLevel; 1029 UINT32 DebugLayer; 1030 1031 } ACPI_SYSTEM_INFO; 1032 1033 1034 /* 1035 * System statistics returned by AcpiGetStatistics() 1036 */ 1037 typedef struct acpi_statistics 1038 { 1039 UINT32 SciCount; 1040 UINT32 GpeCount; 1041 UINT32 FixedEventCount[ACPI_NUM_FIXED_EVENTS]; 1042 UINT32 MethodCount; 1043 1044 } ACPI_STATISTICS; 1045 1046 1047 /* Table Event Types */ 1048 1049 #define ACPI_TABLE_EVENT_LOAD 0x0 1050 #define ACPI_TABLE_EVENT_UNLOAD 0x1 1051 #define ACPI_NUM_TABLE_EVENTS 2 1052 1053 1054 /* 1055 * Types specific to the OS service interfaces 1056 */ 1057 typedef UINT32 1058 (ACPI_SYSTEM_XFACE *ACPI_OSD_HANDLER) ( 1059 void *Context); 1060 1061 typedef void 1062 (ACPI_SYSTEM_XFACE *ACPI_OSD_EXEC_CALLBACK) ( 1063 void *Context); 1064 1065 /* 1066 * Various handlers and callback procedures 1067 */ 1068 typedef 1069 UINT32 (*ACPI_SCI_HANDLER) ( 1070 void *Context); 1071 1072 typedef 1073 void (*ACPI_GBL_EVENT_HANDLER) ( 1074 UINT32 EventType, 1075 ACPI_HANDLE Device, 1076 UINT32 EventNumber, 1077 void *Context); 1078 1079 #define ACPI_EVENT_TYPE_GPE 0 1080 #define ACPI_EVENT_TYPE_FIXED 1 1081 1082 typedef 1083 UINT32 (*ACPI_EVENT_HANDLER) ( 1084 void *Context); 1085 1086 typedef 1087 UINT32 (*ACPI_GPE_HANDLER) ( 1088 ACPI_HANDLE GpeDevice, 1089 UINT32 GpeNumber, 1090 void *Context); 1091 1092 typedef 1093 void (*ACPI_NOTIFY_HANDLER) ( 1094 ACPI_HANDLE Device, 1095 UINT32 Value, 1096 void *Context); 1097 1098 typedef 1099 void (*ACPI_OBJECT_HANDLER) ( 1100 ACPI_HANDLE Object, 1101 void *Data); 1102 1103 typedef 1104 ACPI_STATUS (*ACPI_INIT_HANDLER) ( 1105 ACPI_HANDLE Object, 1106 UINT32 Function); 1107 1108 #define ACPI_INIT_DEVICE_INI 1 1109 1110 typedef 1111 ACPI_STATUS (*ACPI_EXCEPTION_HANDLER) ( 1112 ACPI_STATUS AmlStatus, 1113 ACPI_NAME Name, 1114 UINT16 Opcode, 1115 UINT32 AmlOffset, 1116 void *Context); 1117 1118 /* Table Event handler (Load, LoadTable, etc.) and types */ 1119 1120 typedef 1121 ACPI_STATUS (*ACPI_TABLE_HANDLER) ( 1122 UINT32 Event, 1123 void *Table, 1124 void *Context); 1125 1126 #define ACPI_TABLE_LOAD 0x0 1127 #define ACPI_TABLE_UNLOAD 0x1 1128 #define ACPI_NUM_TABLE_EVENTS 2 1129 1130 1131 /* Address Spaces (For Operation Regions) */ 1132 1133 typedef 1134 ACPI_STATUS (*ACPI_ADR_SPACE_HANDLER) ( 1135 UINT32 Function, 1136 ACPI_PHYSICAL_ADDRESS Address, 1137 UINT32 BitWidth, 1138 UINT64 *Value, 1139 void *HandlerContext, 1140 void *RegionContext); 1141 1142 #define ACPI_DEFAULT_HANDLER NULL 1143 1144 /* Special Context data for GenericSerialBus/GeneralPurposeIo (ACPI 5.0) */ 1145 1146 typedef struct acpi_connection_info 1147 { 1148 UINT8 *Connection; 1149 UINT16 Length; 1150 UINT8 AccessLength; 1151 1152 } ACPI_CONNECTION_INFO; 1153 1154 1155 typedef 1156 ACPI_STATUS (*ACPI_ADR_SPACE_SETUP) ( 1157 ACPI_HANDLE RegionHandle, 1158 UINT32 Function, 1159 void *HandlerContext, 1160 void **RegionContext); 1161 1162 #define ACPI_REGION_ACTIVATE 0 1163 #define ACPI_REGION_DEACTIVATE 1 1164 1165 typedef 1166 ACPI_STATUS (*ACPI_WALK_CALLBACK) ( 1167 ACPI_HANDLE Object, 1168 UINT32 NestingLevel, 1169 void *Context, 1170 void **ReturnValue); 1171 1172 typedef 1173 UINT32 (*ACPI_INTERFACE_HANDLER) ( 1174 ACPI_STRING InterfaceName, 1175 UINT32 Supported); 1176 1177 1178 /* Interrupt handler return values */ 1179 1180 #define ACPI_INTERRUPT_NOT_HANDLED 0x00 1181 #define ACPI_INTERRUPT_HANDLED 0x01 1182 1183 /* GPE handler return values */ 1184 1185 #define ACPI_REENABLE_GPE 0x80 1186 1187 1188 /* Length of 32-bit EISAID values when converted back to a string */ 1189 1190 #define ACPI_EISAID_STRING_SIZE 8 /* Includes null terminator */ 1191 1192 /* Length of UUID (string) values */ 1193 1194 #define ACPI_UUID_LENGTH 16 1195 1196 1197 /* Structures used for device/processor HID, UID, CID, and SUB */ 1198 1199 typedef struct acpi_pnp_device_id 1200 { 1201 UINT32 Length; /* Length of string + null */ 1202 char *String; 1203 1204 } ACPI_PNP_DEVICE_ID; 1205 1206 typedef struct acpi_pnp_device_id_list 1207 { 1208 UINT32 Count; /* Number of IDs in Ids array */ 1209 UINT32 ListSize; /* Size of list, including ID strings */ 1210 ACPI_PNP_DEVICE_ID Ids[1]; /* ID array */ 1211 1212 } ACPI_PNP_DEVICE_ID_LIST; 1213 1214 /* 1215 * Structure returned from AcpiGetObjectInfo. 1216 * Optimized for both 32- and 64-bit builds 1217 */ 1218 typedef struct acpi_device_info 1219 { 1220 UINT32 InfoSize; /* Size of info, including ID strings */ 1221 UINT32 Name; /* ACPI object Name */ 1222 ACPI_OBJECT_TYPE Type; /* ACPI object Type */ 1223 UINT8 ParamCount; /* If a method, required parameter count */ 1224 UINT8 Valid; /* Indicates which optional fields are valid */ 1225 UINT8 Flags; /* Miscellaneous info */ 1226 UINT8 HighestDstates[4]; /* _SxD values: 0xFF indicates not valid */ 1227 UINT8 LowestDstates[5]; /* _SxW values: 0xFF indicates not valid */ 1228 UINT32 CurrentStatus; /* _STA value */ 1229 UINT64 Address; /* _ADR value */ 1230 ACPI_PNP_DEVICE_ID HardwareId; /* _HID value */ 1231 ACPI_PNP_DEVICE_ID UniqueId; /* _UID value */ 1232 ACPI_PNP_DEVICE_ID SubsystemId; /* _SUB value */ 1233 ACPI_PNP_DEVICE_ID_LIST CompatibleIdList; /* _CID list <must be last> */ 1234 1235 } ACPI_DEVICE_INFO; 1236 1237 /* Values for Flags field above (AcpiGetObjectInfo) */ 1238 1239 #define ACPI_PCI_ROOT_BRIDGE 0x01 1240 1241 /* Flags for Valid field above (AcpiGetObjectInfo) */ 1242 1243 #define ACPI_VALID_STA 0x01 1244 #define ACPI_VALID_ADR 0x02 1245 #define ACPI_VALID_HID 0x04 1246 #define ACPI_VALID_UID 0x08 1247 #define ACPI_VALID_SUB 0x10 1248 #define ACPI_VALID_CID 0x20 1249 #define ACPI_VALID_SXDS 0x40 1250 #define ACPI_VALID_SXWS 0x80 1251 1252 /* Flags for _STA return value (CurrentStatus above) */ 1253 1254 #define ACPI_STA_DEVICE_PRESENT 0x01 1255 #define ACPI_STA_DEVICE_ENABLED 0x02 1256 #define ACPI_STA_DEVICE_UI 0x04 1257 #define ACPI_STA_DEVICE_FUNCTIONING 0x08 1258 #define ACPI_STA_DEVICE_OK 0x08 /* Synonym */ 1259 #define ACPI_STA_BATTERY_PRESENT 0x10 1260 1261 1262 /* Context structs for address space handlers */ 1263 1264 typedef struct acpi_pci_id 1265 { 1266 UINT16 Segment; 1267 UINT16 Bus; 1268 UINT16 Device; 1269 UINT16 Function; 1270 1271 } ACPI_PCI_ID; 1272 1273 typedef struct acpi_mem_space_context 1274 { 1275 UINT32 Length; 1276 ACPI_PHYSICAL_ADDRESS Address; 1277 ACPI_PHYSICAL_ADDRESS MappedPhysicalAddress; 1278 UINT8 *MappedLogicalAddress; 1279 ACPI_SIZE MappedLength; 1280 1281 } ACPI_MEM_SPACE_CONTEXT; 1282 1283 1284 /* 1285 * ACPI_MEMORY_LIST is used only if the ACPICA local cache is enabled 1286 */ 1287 typedef struct acpi_memory_list 1288 { 1289 char *ListName; 1290 void *ListHead; 1291 UINT16 ObjectSize; 1292 UINT16 MaxDepth; 1293 UINT16 CurrentDepth; 1294 1295 #ifdef ACPI_DBG_TRACK_ALLOCATIONS 1296 1297 /* Statistics for debug memory tracking only */ 1298 1299 UINT32 TotalAllocated; 1300 UINT32 TotalFreed; 1301 UINT32 MaxOccupied; 1302 UINT32 TotalSize; 1303 UINT32 CurrentTotalSize; 1304 UINT32 Requests; 1305 UINT32 Hits; 1306 #endif 1307 1308 } ACPI_MEMORY_LIST; 1309 1310 1311 /* Definitions of _OSI support */ 1312 1313 #define ACPI_VENDOR_STRINGS 0x01 1314 #define ACPI_FEATURE_STRINGS 0x02 1315 #define ACPI_ENABLE_INTERFACES 0x00 1316 #define ACPI_DISABLE_INTERFACES 0x04 1317 1318 #define ACPI_DISABLE_ALL_VENDOR_STRINGS (ACPI_DISABLE_INTERFACES | ACPI_VENDOR_STRINGS) 1319 #define ACPI_DISABLE_ALL_FEATURE_STRINGS (ACPI_DISABLE_INTERFACES | ACPI_FEATURE_STRINGS) 1320 #define ACPI_DISABLE_ALL_STRINGS (ACPI_DISABLE_INTERFACES | ACPI_VENDOR_STRINGS | ACPI_FEATURE_STRINGS) 1321 #define ACPI_ENABLE_ALL_VENDOR_STRINGS (ACPI_ENABLE_INTERFACES | ACPI_VENDOR_STRINGS) 1322 #define ACPI_ENABLE_ALL_FEATURE_STRINGS (ACPI_ENABLE_INTERFACES | ACPI_FEATURE_STRINGS) 1323 #define ACPI_ENABLE_ALL_STRINGS (ACPI_ENABLE_INTERFACES | ACPI_VENDOR_STRINGS | ACPI_FEATURE_STRINGS) 1324 1325 #define ACPI_OSI_WIN_2000 0x01 1326 #define ACPI_OSI_WIN_XP 0x02 1327 #define ACPI_OSI_WIN_XP_SP1 0x03 1328 #define ACPI_OSI_WINSRV_2003 0x04 1329 #define ACPI_OSI_WIN_XP_SP2 0x05 1330 #define ACPI_OSI_WINSRV_2003_SP1 0x06 1331 #define ACPI_OSI_WIN_VISTA 0x07 1332 #define ACPI_OSI_WINSRV_2008 0x08 1333 #define ACPI_OSI_WIN_VISTA_SP1 0x09 1334 #define ACPI_OSI_WIN_VISTA_SP2 0x0A 1335 #define ACPI_OSI_WIN_7 0x0B 1336 #define ACPI_OSI_WIN_8 0x0C 1337 1338 1339 #endif /* __ACTYPES_H__ */ 1340