actypes.h 47 KB

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