167754Smsmith/****************************************************************************** 267754Smsmith * 367754Smsmith * Name: actypes.h - Common data types for the entire ACPI subsystem 467754Smsmith * 567754Smsmith *****************************************************************************/ 667754Smsmith 7217365Sjkim/* 8217365Sjkim * Copyright (C) 2000 - 2011, Intel Corp. 970243Smsmith * All rights reserved. 1067754Smsmith * 11217365Sjkim * Redistribution and use in source and binary forms, with or without 12217365Sjkim * modification, are permitted provided that the following conditions 13217365Sjkim * are met: 14217365Sjkim * 1. Redistributions of source code must retain the above copyright 15217365Sjkim * notice, this list of conditions, and the following disclaimer, 16217365Sjkim * without modification. 17217365Sjkim * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18217365Sjkim * substantially similar to the "NO WARRANTY" disclaimer below 19217365Sjkim * ("Disclaimer") and any redistribution must be conditioned upon 20217365Sjkim * including a substantially similar Disclaimer requirement for further 21217365Sjkim * binary redistribution. 22217365Sjkim * 3. Neither the names of the above-listed copyright holders nor the names 23217365Sjkim * of any contributors may be used to endorse or promote products derived 24217365Sjkim * from this software without specific prior written permission. 2567754Smsmith * 26217365Sjkim * Alternatively, this software may be distributed under the terms of the 27217365Sjkim * GNU General Public License ("GPL") version 2 as published by the Free 28217365Sjkim * Software Foundation. 2967754Smsmith * 30217365Sjkim * NO WARRANTY 31217365Sjkim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32217365Sjkim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33217365Sjkim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 34217365Sjkim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35217365Sjkim * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36217365Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37217365Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38217365Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39217365Sjkim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40217365Sjkim * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41217365Sjkim * POSSIBILITY OF SUCH DAMAGES. 42217365Sjkim */ 4367754Smsmith 4467754Smsmith#ifndef __ACTYPES_H__ 4567754Smsmith#define __ACTYPES_H__ 4667754Smsmith 47167802Sjkim/* acpisrc:StructDefs -- for acpisrc conversion */ 4867754Smsmith 49167802Sjkim/* 50167802Sjkim * ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent header 51167802Sjkim * and must be either 32 or 64. 16-bit ACPICA is no longer supported, as of 52167802Sjkim * 12/2006. 53167802Sjkim */ 54167802Sjkim#ifndef ACPI_MACHINE_WIDTH 55167802Sjkim#error ACPI_MACHINE_WIDTH not defined 56167802Sjkim#endif 5799679Siwasaki 58167802Sjkim/*! [Begin] no source code translation */ 5999679Siwasaki 6067754Smsmith/* 6199679Siwasaki * Data type ranges 62117521Snjl * Note: These macros are designed to be compiler independent as well as 63117521Snjl * working around problems that some 32-bit compilers have with 64-bit 64117521Snjl * constants. 6599679Siwasaki */ 66117521Snjl#define ACPI_UINT8_MAX (UINT8) (~((UINT8) 0)) /* 0xFF */ 67117521Snjl#define ACPI_UINT16_MAX (UINT16)(~((UINT16) 0)) /* 0xFFFF */ 68117521Snjl#define ACPI_UINT32_MAX (UINT32)(~((UINT32) 0)) /* 0xFFFFFFFF */ 69117521Snjl#define ACPI_UINT64_MAX (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */ 7099679Siwasaki#define ACPI_ASCII_MAX 0x7F 7199679Siwasaki 7299679Siwasaki 73114237Snjl/* 74167802Sjkim * Architecture-specific ACPICA Subsystem Data Types 75167802Sjkim * 76167802Sjkim * The goal of these types is to provide source code portability across 77167802Sjkim * 16-bit, 32-bit, and 64-bit targets. 78167802Sjkim * 79167802Sjkim * 1) The following types are of fixed size for all targets (16/32/64): 80167802Sjkim * 81167802Sjkim * BOOLEAN Logical boolean 82167802Sjkim * 83167802Sjkim * UINT8 8-bit (1 byte) unsigned value 84167802Sjkim * UINT16 16-bit (2 byte) unsigned value 85167802Sjkim * UINT32 32-bit (4 byte) unsigned value 86167802Sjkim * UINT64 64-bit (8 byte) unsigned value 87167802Sjkim * 88167802Sjkim * INT16 16-bit (2 byte) signed value 89167802Sjkim * INT32 32-bit (4 byte) signed value 90167802Sjkim * INT64 64-bit (8 byte) signed value 91167802Sjkim * 92167802Sjkim * COMPILER_DEPENDENT_UINT64/INT64 - These types are defined in the 93167802Sjkim * compiler-dependent header(s) and were introduced because there is no common 94167802Sjkim * 64-bit integer type across the various compilation models, as shown in 95167802Sjkim * the table below. 96167802Sjkim * 97167802Sjkim * Datatype LP64 ILP64 LLP64 ILP32 LP32 16bit 98167802Sjkim * char 8 8 8 8 8 8 99167802Sjkim * short 16 16 16 16 16 16 100167802Sjkim * _int32 32 101167802Sjkim * int 32 64 32 32 16 16 102167802Sjkim * long 64 64 32 32 32 32 103167802Sjkim * long long 64 64 104167802Sjkim * pointer 64 64 64 32 32 32 105167802Sjkim * 106167802Sjkim * Note: ILP64 and LP32 are currently not supported. 107167802Sjkim * 108167802Sjkim * 109167802Sjkim * 2) These types represent the native word size of the target mode of the 110167802Sjkim * processor, and may be 16-bit, 32-bit, or 64-bit as required. They are 111167802Sjkim * usually used for memory allocation, efficient loop counters, and array 112167802Sjkim * indexes. The types are similar to the size_t type in the C library and are 113167802Sjkim * required because there is no C type that consistently represents the native 114193267Sjkim * data width. ACPI_SIZE is needed because there is no guarantee that a 115193267Sjkim * kernel-level C library is present. 116167802Sjkim * 117167802Sjkim * ACPI_SIZE 16/32/64-bit unsigned value 118167802Sjkim * ACPI_NATIVE_INT 16/32/64-bit signed value 119114237Snjl */ 12099679Siwasaki 121167802Sjkim/******************************************************************************* 122167802Sjkim * 123167802Sjkim * Common types for all compilers, all targets 124167802Sjkim * 125167802Sjkim ******************************************************************************/ 126114237Snjl 127167802Sjkimtypedef unsigned char BOOLEAN; 128167802Sjkimtypedef unsigned char UINT8; 129167802Sjkimtypedef unsigned short UINT16; 130167802Sjkimtypedef COMPILER_DEPENDENT_UINT64 UINT64; 131167802Sjkimtypedef COMPILER_DEPENDENT_INT64 INT64; 132114237Snjl 133167802Sjkim/*! [End] no source code translation !*/ 134167802Sjkim 135212761Sjkim/* 136212761Sjkim * Value returned by AcpiOsGetThreadId. There is no standard "thread_id" 137212761Sjkim * across operating systems or even the various UNIX systems. Since ACPICA 138212761Sjkim * only needs the thread ID as a unique thread identifier, we use a UINT64 139212761Sjkim * as the only common data type - it will accommodate any type of pointer or 140212761Sjkim * any type of integer. It is up to the host-dependent OSL to cast the 141212761Sjkim * native thread ID type to a UINT64 (in AcpiOsGetThreadId). 142212761Sjkim */ 143212761Sjkim#define ACPI_THREAD_ID UINT64 144167802Sjkim 145212761Sjkim 146167802Sjkim/******************************************************************************* 14767754Smsmith * 148167802Sjkim * Types specific to 64-bit targets 149167802Sjkim * 150167802Sjkim ******************************************************************************/ 15167754Smsmith 15299679Siwasaki#if ACPI_MACHINE_WIDTH == 64 153114237Snjl 154167802Sjkim/*! [Begin] no source code translation (keep the typedefs as-is) */ 155114237Snjl 156167802Sjkimtypedef unsigned int UINT32; 15767754Smsmithtypedef int INT32; 15867754Smsmith 159114237Snjl/*! [End] no source code translation !*/ 16067754Smsmith 161167802Sjkim 162114237Snjltypedef INT64 ACPI_NATIVE_INT; 163193267Sjkimtypedef UINT64 ACPI_SIZE; 16467754Smsmithtypedef UINT64 ACPI_IO_ADDRESS; 16569450Smsmithtypedef UINT64 ACPI_PHYSICAL_ADDRESS; 16667754Smsmith 16799679Siwasaki#define ACPI_MAX_PTR ACPI_UINT64_MAX 16899679Siwasaki#define ACPI_SIZE_MAX ACPI_UINT64_MAX 169167802Sjkim#define ACPI_USE_NATIVE_DIVIDE /* Has native 64-bit integer support */ 170167802Sjkim 171151937Sjkim/* 172151937Sjkim * In the case of the Itanium Processor Family (IPF), the hardware does not 173151937Sjkim * support misaligned memory transfers. Set the MISALIGNMENT_NOT_SUPPORTED flag 174151937Sjkim * to indicate that special precautions must be taken to avoid alignment faults. 175151937Sjkim * (IA64 or ia64 is currently used by existing compilers to indicate IPF.) 176151937Sjkim * 177167802Sjkim * Note: EM64T and other X86-64 processors support misaligned transfers, 178151937Sjkim * so there is no need to define this flag. 179151937Sjkim */ 180151937Sjkim#if defined (__IA64__) || defined (__ia64__) 181151937Sjkim#define ACPI_MISALIGNMENT_NOT_SUPPORTED 182151937Sjkim#endif 18367754Smsmith 184107325Siwasaki 185167802Sjkim/******************************************************************************* 186167802Sjkim * 187167802Sjkim * Types specific to 32-bit targets 188167802Sjkim * 189167802Sjkim ******************************************************************************/ 190114237Snjl 19199679Siwasaki#elif ACPI_MACHINE_WIDTH == 32 192107325Siwasaki 193167802Sjkim/*! [Begin] no source code translation (keep the typedefs as-is) */ 194114237Snjl 195167802Sjkimtypedef unsigned int UINT32; 19667754Smsmithtypedef int INT32; 19767754Smsmith 198114237Snjl/*! [End] no source code translation !*/ 19967754Smsmith 200167802Sjkim 201114237Snjltypedef INT32 ACPI_NATIVE_INT; 202193267Sjkimtypedef UINT32 ACPI_SIZE; 20367754Smsmithtypedef UINT32 ACPI_IO_ADDRESS; 204167802Sjkimtypedef UINT32 ACPI_PHYSICAL_ADDRESS; 20567754Smsmith 20699679Siwasaki#define ACPI_MAX_PTR ACPI_UINT32_MAX 20799679Siwasaki#define ACPI_SIZE_MAX ACPI_UINT32_MAX 20899679Siwasaki 20999679Siwasaki#else 210167802Sjkim 211167802Sjkim/* ACPI_MACHINE_WIDTH must be either 64 or 32 */ 212167802Sjkim 21399679Siwasaki#error unknown ACPI_MACHINE_WIDTH 21467754Smsmith#endif 21567754Smsmith 21667754Smsmith 217167802Sjkim/******************************************************************************* 218167802Sjkim * 219193267Sjkim * OS-dependent types 220167802Sjkim * 221167802Sjkim * If the defaults below are not appropriate for the host system, they can 222193267Sjkim * be defined in the OS-specific header, and this will take precedence. 223167802Sjkim * 224167802Sjkim ******************************************************************************/ 22599146Siwasaki 226167802Sjkim/* Flags for AcpiOsAcquireLock/AcpiOsReleaseLock */ 227100966Siwasaki 228167802Sjkim#ifndef ACPI_CPU_FLAGS 229193267Sjkim#define ACPI_CPU_FLAGS ACPI_SIZE 230167802Sjkim#endif 231167802Sjkim 232167802Sjkim/* Object returned from AcpiOsCreateCache */ 233167802Sjkim 234151937Sjkim#ifndef ACPI_CACHE_T 235193267Sjkim#ifdef ACPI_USE_LOCAL_CACHE 236151937Sjkim#define ACPI_CACHE_T ACPI_MEMORY_LIST 237193267Sjkim#else 238193267Sjkim#define ACPI_CACHE_T void * 239151937Sjkim#endif 240193267Sjkim#endif 241100966Siwasaki 242193267Sjkim/* 243193267Sjkim * Synchronization objects - Mutexes, Semaphores, and SpinLocks 244193267Sjkim */ 245193267Sjkim#if (ACPI_MUTEX_TYPE == ACPI_BINARY_SEMAPHORE) 246193267Sjkim/* 247193267Sjkim * These macros are used if the host OS does not support a mutex object. 248193267Sjkim * Map the OSL Mutex interfaces to binary semaphores. 249193267Sjkim */ 250193267Sjkim#define ACPI_MUTEX ACPI_SEMAPHORE 251193267Sjkim#define AcpiOsCreateMutex(OutHandle) AcpiOsCreateSemaphore (1, 1, OutHandle) 252193267Sjkim#define AcpiOsDeleteMutex(Handle) (void) AcpiOsDeleteSemaphore (Handle) 253193267Sjkim#define AcpiOsAcquireMutex(Handle,Time) AcpiOsWaitSemaphore (Handle, 1, Time) 254193267Sjkim#define AcpiOsReleaseMutex(Handle) (void) AcpiOsSignalSemaphore (Handle, 1) 255193267Sjkim#endif 256193267Sjkim 257193267Sjkim/* Configurable types for synchronization objects */ 258193267Sjkim 259193267Sjkim#ifndef ACPI_SPINLOCK 260193267Sjkim#define ACPI_SPINLOCK void * 261193267Sjkim#endif 262193267Sjkim 263193267Sjkim#ifndef ACPI_SEMAPHORE 264193267Sjkim#define ACPI_SEMAPHORE void * 265193267Sjkim#endif 266193267Sjkim 267193267Sjkim#ifndef ACPI_MUTEX 268193267Sjkim#define ACPI_MUTEX void * 269193267Sjkim#endif 270193267Sjkim 271193267Sjkim 272193267Sjkim/******************************************************************************* 273193267Sjkim * 274193267Sjkim * Compiler-dependent types 275193267Sjkim * 276193267Sjkim * If the defaults below are not appropriate for the host compiler, they can 277193267Sjkim * be defined in the compiler-specific header, and this will take precedence. 278193267Sjkim * 279193267Sjkim ******************************************************************************/ 280193267Sjkim 281167802Sjkim/* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */ 282167802Sjkim 283167802Sjkim#ifndef ACPI_UINTPTR_T 284167802Sjkim#define ACPI_UINTPTR_T void * 285167802Sjkim#endif 286167802Sjkim 28799146Siwasaki/* 288167802Sjkim * ACPI_PRINTF_LIKE is used to tag functions as "printf-like" because 289167802Sjkim * some compilers can catch printf format string problems 29067754Smsmith */ 291167802Sjkim#ifndef ACPI_PRINTF_LIKE 292167802Sjkim#define ACPI_PRINTF_LIKE(c) 293167802Sjkim#endif 294167802Sjkim 295167802Sjkim/* 296167802Sjkim * Some compilers complain about unused variables. Sometimes we don't want to 297167802Sjkim * use all the variables (for example, _AcpiModuleName). This allows us 298167802Sjkim * to to tell the compiler in a per-variable manner that a variable 299167802Sjkim * is unused 300167802Sjkim */ 301167802Sjkim#ifndef ACPI_UNUSED_VAR 302167802Sjkim#define ACPI_UNUSED_VAR 303167802Sjkim#endif 304167802Sjkim 305167802Sjkim/* 306167802Sjkim * All ACPICA functions that are available to the rest of the kernel are 307167802Sjkim * tagged with this macro which can be defined as appropriate for the host. 308167802Sjkim */ 309167802Sjkim#ifndef ACPI_EXPORT_SYMBOL 310167802Sjkim#define ACPI_EXPORT_SYMBOL(Symbol) 311167802Sjkim#endif 312167802Sjkim 313167802Sjkim 314193267Sjkim/****************************************************************************** 315193267Sjkim * 316193267Sjkim * ACPI Specification constants (Do not change unless the specification changes) 317193267Sjkim * 318193267Sjkim *****************************************************************************/ 319193267Sjkim 320193267Sjkim/* Number of distinct FADT-based GPE register blocks (GPE0 and GPE1) */ 321193267Sjkim 322193267Sjkim#define ACPI_MAX_GPE_BLOCKS 2 323193267Sjkim 324193267Sjkim/* Default ACPI register widths */ 325193267Sjkim 326193267Sjkim#define ACPI_GPE_REGISTER_WIDTH 8 327193267Sjkim#define ACPI_PM1_REGISTER_WIDTH 16 328193267Sjkim#define ACPI_PM2_REGISTER_WIDTH 8 329193267Sjkim#define ACPI_PM_TIMER_WIDTH 32 330193267Sjkim 331193267Sjkim/* Names within the namespace are 4 bytes long */ 332193267Sjkim 333193267Sjkim#define ACPI_NAME_SIZE 4 334193267Sjkim#define ACPI_PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */ 335193267Sjkim#define ACPI_PATH_SEPARATOR '.' 336193267Sjkim 337193267Sjkim/* Sizes for ACPI table headers */ 338193267Sjkim 339193267Sjkim#define ACPI_OEM_ID_SIZE 6 340193267Sjkim#define ACPI_OEM_TABLE_ID_SIZE 8 341193267Sjkim 342193267Sjkim/* ACPI/PNP hardware IDs */ 343193267Sjkim 344193267Sjkim#define PCI_ROOT_HID_STRING "PNP0A03" 345193267Sjkim#define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08" 346193267Sjkim 347193267Sjkim/* PM Timer ticks per second (HZ) */ 348193267Sjkim 349197104Sjkim#define PM_TIMER_FREQUENCY 3579545 350193267Sjkim 351193267Sjkim 352167802Sjkim/******************************************************************************* 353167802Sjkim * 354167802Sjkim * Independent types 355167802Sjkim * 356167802Sjkim ******************************************************************************/ 357167802Sjkim 358167802Sjkim/* Logical defines and NULL */ 359167802Sjkim 36067754Smsmith#ifdef FALSE 36167754Smsmith#undef FALSE 36267754Smsmith#endif 36367754Smsmith#define FALSE (1 == 0) 36467754Smsmith 36567754Smsmith#ifdef TRUE 36667754Smsmith#undef TRUE 36767754Smsmith#endif 36867754Smsmith#define TRUE (1 == 1) 36967754Smsmith 37067754Smsmith#ifndef NULL 37167754Smsmith#define NULL (void *) 0 37267754Smsmith#endif 37367754Smsmith 37467754Smsmith 37567754Smsmith/* 376193267Sjkim * Miscellaneous types 37767754Smsmith */ 37867754Smsmithtypedef UINT32 ACPI_STATUS; /* All ACPI Exceptions */ 37980062Smsmithtypedef UINT32 ACPI_NAME; /* 4-byte ACPI name */ 380114237Snjltypedef char * ACPI_STRING; /* Null terminated ASCII string */ 381167802Sjkimtypedef void * ACPI_HANDLE; /* Actually a ptr to a NS Node */ 38267754Smsmith 383193267Sjkim 384193267Sjkim/* Owner IDs are used to track namespace nodes for selective deletion */ 385193267Sjkim 386193267Sjkimtypedef UINT8 ACPI_OWNER_ID; 387193267Sjkim#define ACPI_OWNER_ID_MAX 0xFF 388193267Sjkim 389193267Sjkim 39067754Smsmith#define ACPI_INTEGER_BIT_SIZE 64 391138287Smarks#define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */ 392138287Smarks#define ACPI_MAX64_DECIMAL_DIGITS 20 393138287Smarks#define ACPI_MAX32_DECIMAL_DIGITS 10 394138287Smarks#define ACPI_MAX16_DECIMAL_DIGITS 5 395138287Smarks#define ACPI_MAX8_DECIMAL_DIGITS 3 39667754Smsmith 39767754Smsmith/* 39867754Smsmith * Constants with special meanings 39967754Smsmith */ 400167802Sjkim#define ACPI_ROOT_OBJECT ACPI_ADD_PTR (ACPI_HANDLE, NULL, ACPI_MAX_PTR) 401193267Sjkim#define ACPI_WAIT_FOREVER 0xFFFF /* UINT16, as per ACPI spec */ 402193267Sjkim#define ACPI_DO_NOT_WAIT 0 40367754Smsmith 404202771Sjkim/* 405202771Sjkim * Obsolete: Acpi integer width. In ACPI version 1 (1996), integers are 32 bits. 406202771Sjkim * In ACPI version 2 (2000) and later, integers are 64 bits. Note that this 407202771Sjkim * pertains to the ACPI integer type only, not to other integers used in the 408202771Sjkim * implementation of the ACPICA subsystem. 409202771Sjkim * 410202771Sjkim * 01/2010: This type is obsolete and has been removed from the entire ACPICA 411202771Sjkim * code base. It remains here for compatibility with device drivers that use 412202771Sjkim * the type. However, it will be removed in the future. 413202771Sjkim */ 414202771Sjkimtypedef UINT64 ACPI_INTEGER; 415202771Sjkim#define ACPI_INTEGER_MAX ACPI_UINT64_MAX 41677424Smsmith 417202771Sjkim 418193267Sjkim/******************************************************************************* 419193267Sjkim * 420193267Sjkim * Commonly used macros 421193267Sjkim * 422193267Sjkim ******************************************************************************/ 423193267Sjkim 424193267Sjkim/* Data manipulation */ 425193267Sjkim 426193267Sjkim#define ACPI_LOBYTE(Integer) ((UINT8) (UINT16)(Integer)) 427193267Sjkim#define ACPI_HIBYTE(Integer) ((UINT8) (((UINT16)(Integer)) >> 8)) 428193267Sjkim#define ACPI_LOWORD(Integer) ((UINT16) (UINT32)(Integer)) 429193267Sjkim#define ACPI_HIWORD(Integer) ((UINT16)(((UINT32)(Integer)) >> 16)) 430193267Sjkim#define ACPI_LODWORD(Integer64) ((UINT32) (UINT64)(Integer64)) 431193267Sjkim#define ACPI_HIDWORD(Integer64) ((UINT32)(((UINT64)(Integer64)) >> 32)) 432193267Sjkim 433193267Sjkim#define ACPI_SET_BIT(target,bit) ((target) |= (bit)) 434193267Sjkim#define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit)) 435193267Sjkim#define ACPI_MIN(a,b) (((a)<(b))?(a):(b)) 436193267Sjkim#define ACPI_MAX(a,b) (((a)>(b))?(a):(b)) 437193267Sjkim 438193267Sjkim/* Size calculation */ 439193267Sjkim 440193267Sjkim#define ACPI_ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0])) 441193267Sjkim 442193267Sjkim/* Pointer manipulation */ 443193267Sjkim 444193267Sjkim#define ACPI_CAST_PTR(t, p) ((t *) (ACPI_UINTPTR_T) (p)) 445193267Sjkim#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **) (ACPI_UINTPTR_T) (p)) 446193267Sjkim#define ACPI_ADD_PTR(t, a, b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) + (ACPI_SIZE)(b))) 447193267Sjkim#define ACPI_PTR_DIFF(a, b) (ACPI_SIZE) (ACPI_CAST_PTR (UINT8, (a)) - ACPI_CAST_PTR (UINT8, (b))) 448193267Sjkim 449193267Sjkim/* Pointer/Integer type conversions */ 450193267Sjkim 451193267Sjkim#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void, (void *) NULL,(ACPI_SIZE) i) 452193267Sjkim#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p, (void *) NULL) 453193267Sjkim#define ACPI_OFFSET(d, f) (ACPI_SIZE) ACPI_PTR_DIFF (&(((d *)0)->f), (void *) NULL) 454193267Sjkim#define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i) 455193267Sjkim#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) 456193267Sjkim 457193267Sjkim#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED 458193267Sjkim#define ACPI_COMPARE_NAME(a,b) (*ACPI_CAST_PTR (UINT32, (a)) == *ACPI_CAST_PTR (UINT32, (b))) 459193267Sjkim#else 460193267Sjkim#define ACPI_COMPARE_NAME(a,b) (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE)) 461193267Sjkim#endif 462193267Sjkim 463193267Sjkim 464193267Sjkim/******************************************************************************* 465193267Sjkim * 466193267Sjkim * Miscellaneous constants 467193267Sjkim * 468193267Sjkim ******************************************************************************/ 469193267Sjkim 47077424Smsmith/* 47177424Smsmith * Initialization sequence 47277424Smsmith */ 47367754Smsmith#define ACPI_FULL_INITIALIZATION 0x00 47467754Smsmith#define ACPI_NO_ADDRESS_SPACE_INIT 0x01 47567754Smsmith#define ACPI_NO_HARDWARE_INIT 0x02 47667754Smsmith#define ACPI_NO_EVENT_INIT 0x04 47791116Smsmith#define ACPI_NO_HANDLER_INIT 0x08 47891116Smsmith#define ACPI_NO_ACPI_ENABLE 0x10 47991116Smsmith#define ACPI_NO_DEVICE_INIT 0x20 48091116Smsmith#define ACPI_NO_OBJECT_INIT 0x40 48167754Smsmith 48280062Smsmith/* 48380062Smsmith * Initialization state 48480062Smsmith */ 485167802Sjkim#define ACPI_SUBSYSTEM_INITIALIZE 0x01 486167802Sjkim#define ACPI_INITIALIZED_OK 0x02 48767754Smsmith 48867754Smsmith/* 48978986Smsmith * Power state values 49067754Smsmith */ 49178986Smsmith#define ACPI_STATE_UNKNOWN (UINT8) 0xFF 49278986Smsmith 49367754Smsmith#define ACPI_STATE_S0 (UINT8) 0 49467754Smsmith#define ACPI_STATE_S1 (UINT8) 1 49567754Smsmith#define ACPI_STATE_S2 (UINT8) 2 49667754Smsmith#define ACPI_STATE_S3 (UINT8) 3 49767754Smsmith#define ACPI_STATE_S4 (UINT8) 4 49871867Smsmith#define ACPI_STATE_S5 (UINT8) 5 49967754Smsmith#define ACPI_S_STATES_MAX ACPI_STATE_S5 50077424Smsmith#define ACPI_S_STATE_COUNT 6 50167754Smsmith 50277424Smsmith#define ACPI_STATE_D0 (UINT8) 0 50377424Smsmith#define ACPI_STATE_D1 (UINT8) 1 50477424Smsmith#define ACPI_STATE_D2 (UINT8) 2 50577424Smsmith#define ACPI_STATE_D3 (UINT8) 3 50677424Smsmith#define ACPI_D_STATES_MAX ACPI_STATE_D3 50777424Smsmith#define ACPI_D_STATE_COUNT 4 50867754Smsmith 50991116Smsmith#define ACPI_STATE_C0 (UINT8) 0 51091116Smsmith#define ACPI_STATE_C1 (UINT8) 1 51191116Smsmith#define ACPI_STATE_C2 (UINT8) 2 51291116Smsmith#define ACPI_STATE_C3 (UINT8) 3 51391116Smsmith#define ACPI_C_STATES_MAX ACPI_STATE_C3 51491116Smsmith#define ACPI_C_STATE_COUNT 4 51591116Smsmith 51678986Smsmith/* 51787031Smsmith * Sleep type invalid value 51887031Smsmith */ 51987031Smsmith#define ACPI_SLEEP_TYPE_MAX 0x7 52087031Smsmith#define ACPI_SLEEP_TYPE_INVALID 0xFF 52187031Smsmith 52287031Smsmith/* 52378986Smsmith * Standard notify values 52478986Smsmith */ 525193267Sjkim#define ACPI_NOTIFY_BUS_CHECK (UINT8) 0x00 526193267Sjkim#define ACPI_NOTIFY_DEVICE_CHECK (UINT8) 0x01 527193267Sjkim#define ACPI_NOTIFY_DEVICE_WAKE (UINT8) 0x02 528193267Sjkim#define ACPI_NOTIFY_EJECT_REQUEST (UINT8) 0x03 529193267Sjkim#define ACPI_NOTIFY_DEVICE_CHECK_LIGHT (UINT8) 0x04 530193267Sjkim#define ACPI_NOTIFY_FREQUENCY_MISMATCH (UINT8) 0x05 531193267Sjkim#define ACPI_NOTIFY_BUS_MODE_MISMATCH (UINT8) 0x06 532193267Sjkim#define ACPI_NOTIFY_POWER_FAULT (UINT8) 0x07 533193267Sjkim#define ACPI_NOTIFY_CAPABILITIES_CHECK (UINT8) 0x08 534193267Sjkim#define ACPI_NOTIFY_DEVICE_PLD_CHECK (UINT8) 0x09 535193267Sjkim#define ACPI_NOTIFY_RESERVED (UINT8) 0x0A 536193267Sjkim#define ACPI_NOTIFY_LOCALITY_UPDATE (UINT8) 0x0B 53777424Smsmith 538193267Sjkim#define ACPI_NOTIFY_MAX 0x0B 539193267Sjkim 54067754Smsmith/* 541193267Sjkim * Types associated with ACPI names and objects. The first group of 542107325Siwasaki * values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition 543193267Sjkim * of the ACPI ObjectType() operator (See the ACPI Spec). Therefore, 54491116Smsmith * only add to the first group if the spec changes. 54567754Smsmith * 546128212Snjl * NOTE: Types must be kept in sync with the global AcpiNsProperties 547107325Siwasaki * and AcpiNsTypeNames arrays. 54867754Smsmith */ 54967754Smsmithtypedef UINT32 ACPI_OBJECT_TYPE; 55067754Smsmith 55187031Smsmith#define ACPI_TYPE_ANY 0x00 55287031Smsmith#define ACPI_TYPE_INTEGER 0x01 /* Byte/Word/Dword/Zero/One/Ones */ 55387031Smsmith#define ACPI_TYPE_STRING 0x02 55487031Smsmith#define ACPI_TYPE_BUFFER 0x03 55587031Smsmith#define ACPI_TYPE_PACKAGE 0x04 /* ByteConst, multiple DataTerm/Constant/SuperName */ 55687031Smsmith#define ACPI_TYPE_FIELD_UNIT 0x05 55787031Smsmith#define ACPI_TYPE_DEVICE 0x06 /* Name, multiple Node */ 55887031Smsmith#define ACPI_TYPE_EVENT 0x07 55987031Smsmith#define ACPI_TYPE_METHOD 0x08 /* Name, ByteConst, multiple Code */ 56087031Smsmith#define ACPI_TYPE_MUTEX 0x09 56187031Smsmith#define ACPI_TYPE_REGION 0x0A 56287031Smsmith#define ACPI_TYPE_POWER 0x0B /* Name,ByteConst,WordConst,multi Node */ 56387031Smsmith#define ACPI_TYPE_PROCESSOR 0x0C /* Name,ByteConst,DWordConst,ByteConst,multi NmO */ 56487031Smsmith#define ACPI_TYPE_THERMAL 0x0D /* Name, multiple Node */ 56587031Smsmith#define ACPI_TYPE_BUFFER_FIELD 0x0E 56687031Smsmith#define ACPI_TYPE_DDB_HANDLE 0x0F 56787031Smsmith#define ACPI_TYPE_DEBUG_OBJECT 0x10 56867754Smsmith 569107325Siwasaki#define ACPI_TYPE_EXTERNAL_MAX 0x10 57067754Smsmith 57167754Smsmith/* 572114237Snjl * These are object types that do not map directly to the ACPI 573114237Snjl * ObjectType() operator. They are used for various internal purposes only. 574114237Snjl * If new predefined ACPI_TYPEs are added (via the ACPI specification), these 575107325Siwasaki * internal types must move upwards. (There is code that depends on these 576107325Siwasaki * values being contiguous with the external types above.) 57767754Smsmith */ 578107325Siwasaki#define ACPI_TYPE_LOCAL_REGION_FIELD 0x11 579107325Siwasaki#define ACPI_TYPE_LOCAL_BANK_FIELD 0x12 580107325Siwasaki#define ACPI_TYPE_LOCAL_INDEX_FIELD 0x13 581107325Siwasaki#define ACPI_TYPE_LOCAL_REFERENCE 0x14 /* Arg#, Local#, Name, Debug, RefOf, Index */ 582107325Siwasaki#define ACPI_TYPE_LOCAL_ALIAS 0x15 583128212Snjl#define ACPI_TYPE_LOCAL_METHOD_ALIAS 0x16 584128212Snjl#define ACPI_TYPE_LOCAL_NOTIFY 0x17 585128212Snjl#define ACPI_TYPE_LOCAL_ADDRESS_HANDLER 0x18 586128212Snjl#define ACPI_TYPE_LOCAL_RESOURCE 0x19 587128212Snjl#define ACPI_TYPE_LOCAL_RESOURCE_FIELD 0x1A 588128212Snjl#define ACPI_TYPE_LOCAL_SCOPE 0x1B /* 1 Name, multiple ObjectList Nodes */ 58967754Smsmith 590128212Snjl#define ACPI_TYPE_NS_NODE_MAX 0x1B /* Last typecode used within a NS Node */ 59167754Smsmith 592107325Siwasaki/* 593107325Siwasaki * These are special object types that never appear in 594107325Siwasaki * a Namespace node, only in an ACPI_OPERAND_OBJECT 595107325Siwasaki */ 596128212Snjl#define ACPI_TYPE_LOCAL_EXTRA 0x1C 597128212Snjl#define ACPI_TYPE_LOCAL_DATA 0x1D 59867754Smsmith 599128212Snjl#define ACPI_TYPE_LOCAL_MAX 0x1D 60069450Smsmith 601107325Siwasaki/* All types above here are invalid */ 60267754Smsmith 603128212Snjl#define ACPI_TYPE_INVALID 0x1E 60467754Smsmith#define ACPI_TYPE_NOT_FOUND 0xFF 60567754Smsmith 606193267Sjkim#define ACPI_NUM_NS_TYPES (ACPI_TYPE_INVALID + 1) 607193267Sjkim 608193267Sjkim 60967754Smsmith/* 61087031Smsmith * All I/O 61187031Smsmith */ 61287031Smsmith#define ACPI_READ 0 61387031Smsmith#define ACPI_WRITE 1 614107325Siwasaki#define ACPI_IO_MASK 1 61577424Smsmith 61677424Smsmith/* 617128212Snjl * Event Types: Fixed & General Purpose 61867754Smsmith */ 61967754Smsmithtypedef UINT32 ACPI_EVENT_TYPE; 62067754Smsmith 62167754Smsmith/* 62267754Smsmith * Fixed events 62367754Smsmith */ 62491116Smsmith#define ACPI_EVENT_PMTIMER 0 62591116Smsmith#define ACPI_EVENT_GLOBAL 1 62691116Smsmith#define ACPI_EVENT_POWER_BUTTON 2 62791116Smsmith#define ACPI_EVENT_SLEEP_BUTTON 3 62891116Smsmith#define ACPI_EVENT_RTC 4 62991116Smsmith#define ACPI_EVENT_MAX 4 63091116Smsmith#define ACPI_NUM_FIXED_EVENTS ACPI_EVENT_MAX + 1 63167754Smsmith 63267754Smsmith/* 633128212Snjl * Event Status - Per event 63467754Smsmith * ------------- 63567754Smsmith * The encoding of ACPI_EVENT_STATUS is illustrated below. 63667754Smsmith * Note that a set bit (1) indicates the property is TRUE 63767754Smsmith * (e.g. if bit 0 is set then the event is enabled). 63884491Smsmith * +-------------+-+-+-+ 63984491Smsmith * | Bits 31:3 |2|1|0| 64084491Smsmith * +-------------+-+-+-+ 64184491Smsmith * | | | | 64284491Smsmith * | | | +- Enabled? 64384491Smsmith * | | +--- Enabled for wake? 64484491Smsmith * | +----- Set? 64567754Smsmith * +----------- <Reserved> 64667754Smsmith */ 64767754Smsmithtypedef UINT32 ACPI_EVENT_STATUS; 64867754Smsmith 64969450Smsmith#define ACPI_EVENT_FLAG_DISABLED (ACPI_EVENT_STATUS) 0x00 65067754Smsmith#define ACPI_EVENT_FLAG_ENABLED (ACPI_EVENT_STATUS) 0x01 65184491Smsmith#define ACPI_EVENT_FLAG_WAKE_ENABLED (ACPI_EVENT_STATUS) 0x02 65284491Smsmith#define ACPI_EVENT_FLAG_SET (ACPI_EVENT_STATUS) 0x04 65367754Smsmith 654128212Snjl/* 655128212Snjl * General Purpose Events (GPE) 656128212Snjl */ 657128212Snjl#define ACPI_GPE_INVALID 0xFF 658128212Snjl#define ACPI_GPE_MAX 0xFF 659128212Snjl#define ACPI_NUM_GPE 256 66067754Smsmith 661209746Sjkim/* Actions for AcpiSetGpe, AcpiGpeWakeup, AcpiHwLowSetGpe */ 662206117Sjkim 663129684Snjl#define ACPI_GPE_ENABLE 0 664129684Snjl#define ACPI_GPE_DISABLE 1 665209746Sjkim#define ACPI_GPE_CONDITIONAL_ENABLE 2 666129684Snjl 667128212Snjl/* 668128212Snjl * GPE info flags - Per GPE 669216471Sjkim * +-------+-+-+---+ 670216471Sjkim * | 7:4 |3|2|1:0| 671216471Sjkim * +-------+-+-+---+ 672216471Sjkim * | | | | 673216471Sjkim * | | | +-- Type of dispatch:to method, handler, notify, or none 674216471Sjkim * | | +----- Interrupt type: edge or level triggered 675216471Sjkim * | +------- Is a Wake GPE 676216471Sjkim * +------------ <Reserved> 677128212Snjl */ 678216471Sjkim#define ACPI_GPE_DISPATCH_NONE (UINT8) 0x00 679216471Sjkim#define ACPI_GPE_DISPATCH_METHOD (UINT8) 0x01 680216471Sjkim#define ACPI_GPE_DISPATCH_HANDLER (UINT8) 0x02 681216471Sjkim#define ACPI_GPE_DISPATCH_NOTIFY (UINT8) 0x03 682216471Sjkim#define ACPI_GPE_DISPATCH_MASK (UINT8) 0x03 683216471Sjkim 684216471Sjkim#define ACPI_GPE_LEVEL_TRIGGERED (UINT8) 0x04 685129684Snjl#define ACPI_GPE_EDGE_TRIGGERED (UINT8) 0x00 686216471Sjkim#define ACPI_GPE_XRUPT_TYPE_MASK (UINT8) 0x04 687128212Snjl 688216471Sjkim#define ACPI_GPE_CAN_WAKE (UINT8) 0x08 689128212Snjl 690128212Snjl/* 691128212Snjl * Flags for GPE and Lock interfaces 692128212Snjl */ 693128212Snjl#define ACPI_NOT_ISR 0x1 694128212Snjl#define ACPI_ISR 0x0 695128212Snjl 696128212Snjl 69767754Smsmith/* Notify types */ 69867754Smsmith 699129684Snjl#define ACPI_SYSTEM_NOTIFY 0x1 700129684Snjl#define ACPI_DEVICE_NOTIFY 0x2 701193267Sjkim#define ACPI_ALL_NOTIFY (ACPI_SYSTEM_NOTIFY | ACPI_DEVICE_NOTIFY) 702129684Snjl#define ACPI_MAX_NOTIFY_HANDLER_TYPE 0x3 70367754Smsmith 704107325Siwasaki#define ACPI_MAX_SYS_NOTIFY 0x7f 70567754Smsmith 70667754Smsmith 70767754Smsmith/* Address Space (Operation Region) Types */ 70867754Smsmith 70977424Smsmithtypedef UINT8 ACPI_ADR_SPACE_TYPE; 71067754Smsmith 71177424Smsmith#define ACPI_ADR_SPACE_SYSTEM_MEMORY (ACPI_ADR_SPACE_TYPE) 0 71277424Smsmith#define ACPI_ADR_SPACE_SYSTEM_IO (ACPI_ADR_SPACE_TYPE) 1 71377424Smsmith#define ACPI_ADR_SPACE_PCI_CONFIG (ACPI_ADR_SPACE_TYPE) 2 71477424Smsmith#define ACPI_ADR_SPACE_EC (ACPI_ADR_SPACE_TYPE) 3 71577424Smsmith#define ACPI_ADR_SPACE_SMBUS (ACPI_ADR_SPACE_TYPE) 4 71677424Smsmith#define ACPI_ADR_SPACE_CMOS (ACPI_ADR_SPACE_TYPE) 5 71777424Smsmith#define ACPI_ADR_SPACE_PCI_BAR_TARGET (ACPI_ADR_SPACE_TYPE) 6 718197104Sjkim#define ACPI_ADR_SPACE_IPMI (ACPI_ADR_SPACE_TYPE) 7 71967754Smsmith 720220663Sjkim#define ACPI_NUM_PREDEFINED_REGIONS 8 72167754Smsmith 72267754Smsmith/* 723220663Sjkim * Special Address Spaces 724220663Sjkim * 725220663Sjkim * Note: A Data Table region is a special type of operation region 726220663Sjkim * that has its own AML opcode. However, internally, the AML 727220663Sjkim * interpreter simply creates an operation region with an an address 728220663Sjkim * space type of ACPI_ADR_SPACE_DATA_TABLE. 729220663Sjkim */ 730220663Sjkim#define ACPI_ADR_SPACE_DATA_TABLE (ACPI_ADR_SPACE_TYPE) 0x7E /* Internal to ACPICA only */ 731220663Sjkim#define ACPI_ADR_SPACE_FIXED_HARDWARE (ACPI_ADR_SPACE_TYPE) 0x7F 732220663Sjkim 733220663Sjkim/* Values for _REG connection code */ 734220663Sjkim 735220663Sjkim#define ACPI_REG_DISCONNECT 0 736220663Sjkim#define ACPI_REG_CONNECT 1 737220663Sjkim 738220663Sjkim/* 73999679Siwasaki * BitRegister IDs 740193267Sjkim * 741193267Sjkim * These values are intended to be used by the hardware interfaces 742193267Sjkim * and are mapped to individual bitfields defined within the ACPI 743193267Sjkim * registers. See the AcpiGbl_BitRegisterInfo global table in utglobal.c 744193267Sjkim * for this mapping. 74599679Siwasaki */ 746193267Sjkim 747193267Sjkim/* PM1 Status register */ 748193267Sjkim 74999679Siwasaki#define ACPI_BITREG_TIMER_STATUS 0x00 75099679Siwasaki#define ACPI_BITREG_BUS_MASTER_STATUS 0x01 75199679Siwasaki#define ACPI_BITREG_GLOBAL_LOCK_STATUS 0x02 75299679Siwasaki#define ACPI_BITREG_POWER_BUTTON_STATUS 0x03 75399679Siwasaki#define ACPI_BITREG_SLEEP_BUTTON_STATUS 0x04 75499679Siwasaki#define ACPI_BITREG_RT_CLOCK_STATUS 0x05 75599679Siwasaki#define ACPI_BITREG_WAKE_STATUS 0x06 756151937Sjkim#define ACPI_BITREG_PCIEXP_WAKE_STATUS 0x07 75799679Siwasaki 758193267Sjkim/* PM1 Enable register */ 759193267Sjkim 760151937Sjkim#define ACPI_BITREG_TIMER_ENABLE 0x08 761151937Sjkim#define ACPI_BITREG_GLOBAL_LOCK_ENABLE 0x09 762151937Sjkim#define ACPI_BITREG_POWER_BUTTON_ENABLE 0x0A 763151937Sjkim#define ACPI_BITREG_SLEEP_BUTTON_ENABLE 0x0B 764151937Sjkim#define ACPI_BITREG_RT_CLOCK_ENABLE 0x0C 765193267Sjkim#define ACPI_BITREG_PCIEXP_WAKE_DISABLE 0x0D 76699679Siwasaki 767193267Sjkim/* PM1 Control register */ 76899679Siwasaki 769193267Sjkim#define ACPI_BITREG_SCI_ENABLE 0x0E 770193267Sjkim#define ACPI_BITREG_BUS_MASTER_RLD 0x0F 771193267Sjkim#define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x10 772193267Sjkim#define ACPI_BITREG_SLEEP_TYPE 0x11 773193267Sjkim#define ACPI_BITREG_SLEEP_ENABLE 0x12 77499679Siwasaki 775193267Sjkim/* PM2 Control register */ 776193267Sjkim 777193267Sjkim#define ACPI_BITREG_ARB_DISABLE 0x13 778193267Sjkim 779193267Sjkim#define ACPI_BITREG_MAX 0x13 78099679Siwasaki#define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1 78199679Siwasaki 782107325Siwasaki 783193267Sjkim/* Status register values. A 1 clears a status bit. 0 = no effect */ 784193267Sjkim 785193267Sjkim#define ACPI_CLEAR_STATUS 1 786193267Sjkim 787193267Sjkim/* Enable and Control register values */ 788193267Sjkim 789193267Sjkim#define ACPI_ENABLE_EVENT 1 790193267Sjkim#define ACPI_DISABLE_EVENT 0 791193267Sjkim 792193267Sjkim 79399679Siwasaki/* 79467754Smsmith * External ACPI object definition 79567754Smsmith */ 796193267Sjkim 797193267Sjkim/* 798193267Sjkim * Note: Type == ACPI_TYPE_ANY (0) is used to indicate a NULL package element 799193267Sjkim * or an unresolved named reference. 800193267Sjkim */ 801114237Snjltypedef union acpi_object 80267754Smsmith{ 803167802Sjkim ACPI_OBJECT_TYPE Type; /* See definition of AcpiNsType for values */ 80467754Smsmith struct 80567754Smsmith { 806193267Sjkim ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_INTEGER */ 807202771Sjkim UINT64 Value; /* The actual number */ 80871867Smsmith } Integer; 80967754Smsmith 81067754Smsmith struct 81167754Smsmith { 812193267Sjkim ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_STRING */ 813167802Sjkim UINT32 Length; /* # of bytes in string, excluding trailing null */ 814167802Sjkim char *Pointer; /* points to the string value */ 81567754Smsmith } String; 81667754Smsmith 81767754Smsmith struct 81867754Smsmith { 819193267Sjkim ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_BUFFER */ 820167802Sjkim UINT32 Length; /* # of bytes in buffer */ 821167802Sjkim UINT8 *Pointer; /* points to the buffer */ 82267754Smsmith } Buffer; 82367754Smsmith 82467754Smsmith struct 82567754Smsmith { 826193267Sjkim ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_PACKAGE */ 827167802Sjkim UINT32 Count; /* # of elements in package */ 828167802Sjkim union acpi_object *Elements; /* Pointer to an array of ACPI_OBJECTs */ 82967754Smsmith } Package; 83067754Smsmith 83167754Smsmith struct 83267754Smsmith { 833193267Sjkim ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_LOCAL_REFERENCE */ 834193267Sjkim ACPI_OBJECT_TYPE ActualType; /* Type associated with the Handle */ 835193267Sjkim ACPI_HANDLE Handle; /* object reference */ 836193267Sjkim } Reference; 837193267Sjkim 838193267Sjkim struct 839193267Sjkim { 840193267Sjkim ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_PROCESSOR */ 841167802Sjkim UINT32 ProcId; 842167802Sjkim ACPI_IO_ADDRESS PblkAddress; 843167802Sjkim UINT32 PblkLength; 84467754Smsmith } Processor; 84567754Smsmith 84667754Smsmith struct 84767754Smsmith { 848193267Sjkim ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_POWER */ 849167802Sjkim UINT32 SystemLevel; 850167802Sjkim UINT32 ResourceOrder; 85167754Smsmith } PowerResource; 85267754Smsmith 85391116Smsmith} ACPI_OBJECT; 85467754Smsmith 85567754Smsmith 85667754Smsmith/* 85767754Smsmith * List of objects, used as a parameter list for control method evaluation 85867754Smsmith */ 859114237Snjltypedef struct acpi_object_list 86067754Smsmith{ 861167802Sjkim UINT32 Count; 862167802Sjkim ACPI_OBJECT *Pointer; 86367754Smsmith 86491116Smsmith} ACPI_OBJECT_LIST; 86567754Smsmith 86667754Smsmith 86767754Smsmith/* 86867754Smsmith * Miscellaneous common Data Structures used by the interfaces 86967754Smsmith */ 87091116Smsmith#define ACPI_NO_BUFFER 0 87191116Smsmith#define ACPI_ALLOCATE_BUFFER (ACPI_SIZE) (-1) 87291116Smsmith#define ACPI_ALLOCATE_LOCAL_BUFFER (ACPI_SIZE) (-2) 87391116Smsmith 874114237Snjltypedef struct acpi_buffer 87567754Smsmith{ 876167802Sjkim ACPI_SIZE Length; /* Length in bytes of the buffer */ 877167802Sjkim void *Pointer; /* pointer to buffer */ 87867754Smsmith 87967754Smsmith} ACPI_BUFFER; 88067754Smsmith 88167754Smsmith 88267754Smsmith/* 88367754Smsmith * NameType for AcpiGetName 88467754Smsmith */ 88567754Smsmith#define ACPI_FULL_PATHNAME 0 88667754Smsmith#define ACPI_SINGLE_NAME 1 88767754Smsmith#define ACPI_NAME_TYPE_MAX 1 88867754Smsmith 88967754Smsmith 89067754Smsmith/* 891193267Sjkim * Predefined Namespace items 892193267Sjkim */ 893193267Sjkimtypedef struct acpi_predefined_names 894193267Sjkim{ 895193267Sjkim char *Name; 896193267Sjkim UINT8 Type; 897193267Sjkim char *Val; 898193267Sjkim 899193267Sjkim} ACPI_PREDEFINED_NAMES; 900193267Sjkim 901193267Sjkim 902193267Sjkim/* 90367754Smsmith * Structure and flags for AcpiGetSystemInfo 90467754Smsmith */ 90591116Smsmith#define ACPI_SYS_MODE_UNKNOWN 0x0000 90691116Smsmith#define ACPI_SYS_MODE_ACPI 0x0001 90791116Smsmith#define ACPI_SYS_MODE_LEGACY 0x0002 90891116Smsmith#define ACPI_SYS_MODES_MASK 0x0003 90967754Smsmith 91067754Smsmith 91167754Smsmith/* 91267754Smsmith * System info returned by AcpiGetSystemInfo() 91367754Smsmith */ 914114237Snjltypedef struct acpi_system_info 91567754Smsmith{ 916167802Sjkim UINT32 AcpiCaVersion; 917167802Sjkim UINT32 Flags; 918167802Sjkim UINT32 TimerResolution; 919167802Sjkim UINT32 Reserved1; 920167802Sjkim UINT32 Reserved2; 921167802Sjkim UINT32 DebugLevel; 922167802Sjkim UINT32 DebugLayer; 92367754Smsmith 92467754Smsmith} ACPI_SYSTEM_INFO; 92567754Smsmith 92667754Smsmith 92767754Smsmith/* 928193267Sjkim * System statistics returned by AcpiGetStatistics() 929193267Sjkim */ 930193267Sjkimtypedef struct acpi_statistics 931193267Sjkim{ 932193267Sjkim UINT32 SciCount; 933193267Sjkim UINT32 GpeCount; 934193267Sjkim UINT32 FixedEventCount[ACPI_NUM_FIXED_EVENTS]; 935193267Sjkim UINT32 MethodCount; 936193267Sjkim 937193267Sjkim} ACPI_STATISTICS; 938193267Sjkim 939193267Sjkim 940193267Sjkim/* Table Event Types */ 941193267Sjkim 942193267Sjkim#define ACPI_TABLE_EVENT_LOAD 0x0 943193267Sjkim#define ACPI_TABLE_EVENT_UNLOAD 0x1 944193267Sjkim#define ACPI_NUM_TABLE_EVENTS 2 945193267Sjkim 946193267Sjkim 947193267Sjkim/* 948117521Snjl * Types specific to the OS service interfaces 949117521Snjl */ 950117521Snjltypedef UINT32 951138287Smarks(ACPI_SYSTEM_XFACE *ACPI_OSD_HANDLER) ( 952167802Sjkim void *Context); 953117521Snjl 954117521Snjltypedef void 955138287Smarks(ACPI_SYSTEM_XFACE *ACPI_OSD_EXEC_CALLBACK) ( 956167802Sjkim void *Context); 957117521Snjl 958117521Snjl/* 95967754Smsmith * Various handlers and callback procedures 96067754Smsmith */ 96167754Smsmithtypedef 962216471Sjkimvoid (*ACPI_GBL_EVENT_HANDLER) ( 963216471Sjkim UINT32 EventType, 964216471Sjkim ACPI_HANDLE Device, 965216471Sjkim UINT32 EventNumber, 966216471Sjkim void *Context); 967216471Sjkim 968216471Sjkim#define ACPI_EVENT_TYPE_GPE 0 969216471Sjkim#define ACPI_EVENT_TYPE_FIXED 1 970216471Sjkim 971216471Sjkimtypedef 97277424SmsmithUINT32 (*ACPI_EVENT_HANDLER) ( 973167802Sjkim void *Context); 97467754Smsmith 97567754Smsmithtypedef 976216471SjkimUINT32 (*ACPI_GPE_HANDLER) ( 977216471Sjkim ACPI_HANDLE GpeDevice, 978216471Sjkim UINT32 GpeNumber, 979216471Sjkim void *Context); 980216471Sjkim 981216471Sjkimtypedef 98277424Smsmithvoid (*ACPI_NOTIFY_HANDLER) ( 983167802Sjkim ACPI_HANDLE Device, 984167802Sjkim UINT32 Value, 985167802Sjkim void *Context); 98667754Smsmith 98787031Smsmithtypedef 98887031Smsmithvoid (*ACPI_OBJECT_HANDLER) ( 989167802Sjkim ACPI_HANDLE Object, 990167802Sjkim void *Data); 99167754Smsmith 99299679Siwasakitypedef 99399679SiwasakiACPI_STATUS (*ACPI_INIT_HANDLER) ( 994167802Sjkim ACPI_HANDLE Object, 995167802Sjkim UINT32 Function); 99687031Smsmith 99799679Siwasaki#define ACPI_INIT_DEVICE_INI 1 99899679Siwasaki 999138287Smarkstypedef 1000138287SmarksACPI_STATUS (*ACPI_EXCEPTION_HANDLER) ( 1001167802Sjkim ACPI_STATUS AmlStatus, 1002167802Sjkim ACPI_NAME Name, 1003167802Sjkim UINT16 Opcode, 1004167802Sjkim UINT32 AmlOffset, 1005167802Sjkim void *Context); 100699679Siwasaki 1007193267Sjkim/* Table Event handler (Load, LoadTable, etc.) and types */ 1008138287Smarks 1009193267Sjkimtypedef 1010193267SjkimACPI_STATUS (*ACPI_TABLE_HANDLER) ( 1011193267Sjkim UINT32 Event, 1012193267Sjkim void *Table, 1013193267Sjkim void *Context); 1014193267Sjkim 1015193267Sjkim#define ACPI_TABLE_LOAD 0x0 1016193267Sjkim#define ACPI_TABLE_UNLOAD 0x1 1017193267Sjkim#define ACPI_NUM_TABLE_EVENTS 2 1018193267Sjkim 1019193267Sjkim 1020127175Snjl/* Address Spaces (For Operation Regions) */ 102177424Smsmith 102267754Smsmithtypedef 102377424SmsmithACPI_STATUS (*ACPI_ADR_SPACE_HANDLER) ( 1024167802Sjkim UINT32 Function, 1025167802Sjkim ACPI_PHYSICAL_ADDRESS Address, 1026167802Sjkim UINT32 BitWidth, 1027202771Sjkim UINT64 *Value, 1028167802Sjkim void *HandlerContext, 1029167802Sjkim void *RegionContext); 103067754Smsmith 1031167802Sjkim#define ACPI_DEFAULT_HANDLER NULL 103267754Smsmith 103367754Smsmithtypedef 103477424SmsmithACPI_STATUS (*ACPI_ADR_SPACE_SETUP) ( 1035167802Sjkim ACPI_HANDLE RegionHandle, 1036167802Sjkim UINT32 Function, 1037167802Sjkim void *HandlerContext, 1038167802Sjkim void **RegionContext); 103967754Smsmith 104067754Smsmith#define ACPI_REGION_ACTIVATE 0 104167754Smsmith#define ACPI_REGION_DEACTIVATE 1 104267754Smsmith 104367754Smsmithtypedef 104477424SmsmithACPI_STATUS (*ACPI_WALK_CALLBACK) ( 1045207344Sjkim ACPI_HANDLE Object, 1046167802Sjkim UINT32 NestingLevel, 1047167802Sjkim void *Context, 1048167802Sjkim void **ReturnValue); 104967754Smsmith 1050210976Sjkimtypedef 1051210976SjkimUINT32 (*ACPI_INTERFACE_HANDLER) ( 1052210976Sjkim ACPI_STRING InterfaceName, 1053210976Sjkim UINT32 Supported); 105467754Smsmith 1055210976Sjkim 105667754Smsmith/* Interrupt handler return values */ 105767754Smsmith 105891116Smsmith#define ACPI_INTERRUPT_NOT_HANDLED 0x00 105991116Smsmith#define ACPI_INTERRUPT_HANDLED 0x01 106067754Smsmith 1061216471Sjkim/* GPE handler return values */ 1062216471Sjkim 1063216471Sjkim#define ACPI_REENABLE_GPE 0x80 1064216471Sjkim 1065216471Sjkim 1066197104Sjkim/* Length of 32-bit EISAID values when converted back to a string */ 106767754Smsmith 1068197104Sjkim#define ACPI_EISAID_STRING_SIZE 8 /* Includes null terminator */ 1069193267Sjkim 1070197104Sjkim/* Length of UUID (string) values */ 1071197104Sjkim 1072193267Sjkim#define ACPI_UUID_LENGTH 16 1073193267Sjkim 107467754Smsmith 1075197104Sjkim/* Structures used for device/processor HID, UID, CID */ 1076197104Sjkim 1077117521Snjltypedef struct acpi_device_id 1078117521Snjl{ 1079197104Sjkim UINT32 Length; /* Length of string + null */ 1080197104Sjkim char *String; 108167754Smsmith 1082117521Snjl} ACPI_DEVICE_ID; 108367754Smsmith 1084197104Sjkimtypedef struct acpi_device_id_list 1085117521Snjl{ 1086197104Sjkim UINT32 Count; /* Number of IDs in Ids array */ 1087197104Sjkim UINT32 ListSize; /* Size of list, including ID strings */ 1088197104Sjkim ACPI_DEVICE_ID Ids[1]; /* ID array */ 1089117521Snjl 1090197104Sjkim} ACPI_DEVICE_ID_LIST; 1091117521Snjl 1092197104Sjkim/* 1093197104Sjkim * Structure returned from AcpiGetObjectInfo. 1094197104Sjkim * Optimized for both 32- and 64-bit builds 1095197104Sjkim */ 1096197104Sjkimtypedef struct acpi_device_info 1097117521Snjl{ 1098197104Sjkim UINT32 InfoSize; /* Size of info, including ID strings */ 1099197104Sjkim UINT32 Name; /* ACPI object Name */ 1100197104Sjkim ACPI_OBJECT_TYPE Type; /* ACPI object Type */ 1101197104Sjkim UINT8 ParamCount; /* If a method, required parameter count */ 1102197104Sjkim UINT8 Valid; /* Indicates which optional fields are valid */ 1103197104Sjkim UINT8 Flags; /* Miscellaneous info */ 1104197104Sjkim UINT8 HighestDstates[4]; /* _SxD values: 0xFF indicates not valid */ 1105197104Sjkim UINT8 LowestDstates[5]; /* _SxW values: 0xFF indicates not valid */ 1106197104Sjkim UINT32 CurrentStatus; /* _STA value */ 1107202771Sjkim UINT64 Address; /* _ADR value */ 1108197104Sjkim ACPI_DEVICE_ID HardwareId; /* _HID value */ 1109197104Sjkim ACPI_DEVICE_ID UniqueId; /* _UID value */ 1110197104Sjkim ACPI_DEVICE_ID_LIST CompatibleIdList; /* _CID list <must be last> */ 1111117521Snjl 1112197104Sjkim} ACPI_DEVICE_INFO; 1113117521Snjl 1114197104Sjkim/* Values for Flags field above (AcpiGetObjectInfo) */ 1115117521Snjl 1116197104Sjkim#define ACPI_PCI_ROOT_BRIDGE 0x01 1117117521Snjl 1118197104Sjkim/* Flags for Valid field above (AcpiGetObjectInfo) */ 1119117521Snjl 1120197104Sjkim#define ACPI_VALID_STA 0x01 1121197104Sjkim#define ACPI_VALID_ADR 0x02 1122197104Sjkim#define ACPI_VALID_HID 0x04 1123197104Sjkim#define ACPI_VALID_UID 0x08 1124197104Sjkim#define ACPI_VALID_CID 0x10 1125197104Sjkim#define ACPI_VALID_SXDS 0x20 1126197104Sjkim#define ACPI_VALID_SXWS 0x40 1127197104Sjkim 1128167802Sjkim/* Flags for _STA method */ 1129117521Snjl 1130167802Sjkim#define ACPI_STA_DEVICE_PRESENT 0x01 1131167802Sjkim#define ACPI_STA_DEVICE_ENABLED 0x02 1132167802Sjkim#define ACPI_STA_DEVICE_UI 0x04 1133167802Sjkim#define ACPI_STA_DEVICE_FUNCTIONING 0x08 1134167802Sjkim#define ACPI_STA_DEVICE_OK 0x08 /* Synonym */ 1135167802Sjkim#define ACPI_STA_BATTERY_PRESENT 0x10 1136167802Sjkim 1137167802Sjkim 113867754Smsmith/* Context structs for address space handlers */ 113967754Smsmith 1140114237Snjltypedef struct acpi_pci_id 114167754Smsmith{ 1142167802Sjkim UINT16 Segment; 1143167802Sjkim UINT16 Bus; 1144167802Sjkim UINT16 Device; 1145167802Sjkim UINT16 Function; 1146114237Snjl 114780062Smsmith} ACPI_PCI_ID; 114867754Smsmith 1149114237Snjltypedef struct acpi_mem_space_context 115067754Smsmith{ 1151167802Sjkim UINT32 Length; 1152167802Sjkim ACPI_PHYSICAL_ADDRESS Address; 1153167802Sjkim ACPI_PHYSICAL_ADDRESS MappedPhysicalAddress; 1154167802Sjkim UINT8 *MappedLogicalAddress; 1155167802Sjkim ACPI_SIZE MappedLength; 1156114237Snjl 115777424Smsmith} ACPI_MEM_SPACE_CONTEXT; 115867754Smsmith 115967754Smsmith 116067754Smsmith/* 1161193267Sjkim * ACPI_MEMORY_LIST is used only if the ACPICA local cache is enabled 116267754Smsmith */ 1163193267Sjkimtypedef struct acpi_memory_list 1164193267Sjkim{ 1165193267Sjkim char *ListName; 1166193267Sjkim void *ListHead; 1167193267Sjkim UINT16 ObjectSize; 1168193267Sjkim UINT16 MaxDepth; 1169193267Sjkim UINT16 CurrentDepth; 1170193267Sjkim UINT16 LinkOffset; 117167754Smsmith 1172193267Sjkim#ifdef ACPI_DBG_TRACK_ALLOCATIONS 117367754Smsmith 1174193267Sjkim /* Statistics for debug memory tracking only */ 117567754Smsmith 1176193267Sjkim UINT32 TotalAllocated; 1177193267Sjkim UINT32 TotalFreed; 1178193267Sjkim UINT32 MaxOccupied; 1179193267Sjkim UINT32 TotalSize; 1180193267Sjkim UINT32 CurrentTotalSize; 1181193267Sjkim UINT32 Requests; 1182193267Sjkim UINT32 Hits; 1183151937Sjkim#endif 1184151937Sjkim 1185193267Sjkim} ACPI_MEMORY_LIST; 1186167802Sjkim 1187167802Sjkim 118867754Smsmith#endif /* __ACTYPES_H__ */ 1189