actypes.h 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201
  1. /******************************************************************************
  2. *
  3. * Name: actypes.h - Common data types for the entire ACPI subsystem
  4. *
  5. *****************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2005, R. Byron Moore
  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. /*! [Begin] no source code translation (keep the typedefs) */
  45. /*
  46. * Data type ranges
  47. * Note: These macros are designed to be compiler independent as well as
  48. * working around problems that some 32-bit compilers have with 64-bit
  49. * constants.
  50. */
  51. #define ACPI_UINT8_MAX (UINT8) (~((UINT8) 0)) /* 0xFF */
  52. #define ACPI_UINT16_MAX (UINT16)(~((UINT16) 0)) /* 0xFFFF */
  53. #define ACPI_UINT32_MAX (UINT32)(~((UINT32) 0)) /* 0xFFFFFFFF */
  54. #define ACPI_UINT64_MAX (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */
  55. #define ACPI_ASCII_MAX 0x7F
  56. #ifdef DEFINE_ALTERNATE_TYPES
  57. /*
  58. * Types used only in translated source, defined here to enable
  59. * cross-platform compilation only.
  60. */
  61. typedef int s32;
  62. typedef unsigned char u8;
  63. typedef unsigned short u16;
  64. typedef unsigned int u32;
  65. typedef COMPILER_DEPENDENT_UINT64 u64;
  66. #endif
  67. /*
  68. * Data types - Fixed across all compilation models (16/32/64)
  69. *
  70. * BOOLEAN Logical Boolean.
  71. * INT8 8-bit (1 byte) signed value
  72. * UINT8 8-bit (1 byte) unsigned value
  73. * INT16 16-bit (2 byte) signed value
  74. * UINT16 16-bit (2 byte) unsigned value
  75. * INT32 32-bit (4 byte) signed value
  76. * UINT32 32-bit (4 byte) unsigned value
  77. * INT64 64-bit (8 byte) signed value
  78. * UINT64 64-bit (8 byte) unsigned value
  79. * ACPI_NATIVE_INT 32-bit on IA-32, 64-bit on IA-64 signed value
  80. * ACPI_NATIVE_UINT 32-bit on IA-32, 64-bit on IA-64 unsigned value
  81. */
  82. #ifndef ACPI_MACHINE_WIDTH
  83. #error ACPI_MACHINE_WIDTH not defined
  84. #endif
  85. #if ACPI_MACHINE_WIDTH == 64
  86. /*! [Begin] no source code translation (keep the typedefs) */
  87. /*
  88. * 64-bit type definitions
  89. */
  90. typedef unsigned char UINT8;
  91. typedef unsigned char BOOLEAN;
  92. typedef unsigned short UINT16;
  93. typedef int INT32;
  94. typedef unsigned int UINT32;
  95. typedef COMPILER_DEPENDENT_INT64 INT64;
  96. typedef COMPILER_DEPENDENT_UINT64 UINT64;
  97. /*! [End] no source code translation !*/
  98. typedef s64 acpi_native_int;
  99. typedef u64 acpi_native_uint;
  100. typedef u64 acpi_table_ptr;
  101. typedef u64 acpi_io_address;
  102. typedef u64 acpi_physical_address;
  103. typedef u64 acpi_size;
  104. #define ALIGNED_ADDRESS_BOUNDARY 0x00000008 /* No hardware alignment support in IA64 */
  105. #define ACPI_USE_NATIVE_DIVIDE /* Native 64-bit integer support */
  106. #define ACPI_MAX_PTR ACPI_UINT64_MAX
  107. #define ACPI_SIZE_MAX ACPI_UINT64_MAX
  108. #elif ACPI_MACHINE_WIDTH == 16
  109. /*! [Begin] no source code translation (keep the typedefs) */
  110. /*
  111. * 16-bit type definitions
  112. */
  113. typedef unsigned char UINT8;
  114. typedef unsigned char BOOLEAN;
  115. typedef unsigned int UINT16;
  116. typedef long INT32;
  117. typedef int INT16;
  118. typedef unsigned long UINT32;
  119. struct {
  120. UINT32 Lo;
  121. UINT32 Hi;
  122. };
  123. /*! [End] no source code translation !*/
  124. typedef u16 acpi_native_uint;
  125. typedef s16 acpi_native_int;
  126. typedef u32 acpi_table_ptr;
  127. typedef u32 acpi_io_address;
  128. typedef char *acpi_physical_address;
  129. typedef u16 acpi_size;
  130. #define ALIGNED_ADDRESS_BOUNDARY 0x00000002
  131. #define ACPI_MISALIGNED_TRANSFERS
  132. #define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */
  133. #define ACPI_MAX_PTR ACPI_UINT16_MAX
  134. #define ACPI_SIZE_MAX ACPI_UINT16_MAX
  135. /*
  136. * (16-bit only) internal integers must be 32-bits, so
  137. * 64-bit integers cannot be supported
  138. */
  139. #define ACPI_NO_INTEGER64_SUPPORT
  140. #elif ACPI_MACHINE_WIDTH == 32
  141. /*! [Begin] no source code translation (keep the typedefs) */
  142. /*
  143. * 32-bit type definitions (default)
  144. */
  145. typedef unsigned char UINT8;
  146. typedef unsigned char BOOLEAN;
  147. typedef unsigned short UINT16;
  148. typedef int INT32;
  149. typedef unsigned int UINT32;
  150. typedef COMPILER_DEPENDENT_INT64 INT64;
  151. typedef COMPILER_DEPENDENT_UINT64 UINT64;
  152. /*! [End] no source code translation !*/
  153. typedef s32 acpi_native_int;
  154. typedef u32 acpi_native_uint;
  155. typedef u64 acpi_table_ptr;
  156. typedef u32 acpi_io_address;
  157. typedef u64 acpi_physical_address;
  158. typedef u32 acpi_size;
  159. #define ALIGNED_ADDRESS_BOUNDARY 0x00000004
  160. #define ACPI_MISALIGNED_TRANSFERS
  161. #define ACPI_MAX_PTR ACPI_UINT32_MAX
  162. #define ACPI_SIZE_MAX ACPI_UINT32_MAX
  163. #else
  164. #error unknown ACPI_MACHINE_WIDTH
  165. #endif
  166. /*
  167. * This type is used for bitfields in ACPI tables. The only type that is
  168. * even remotely portable is u8. Anything else is not portable, so
  169. * do not add any more bitfield types.
  170. */
  171. typedef u8 UINT8_BIT;
  172. typedef acpi_native_uint ACPI_PTRDIFF;
  173. /*
  174. * Pointer overlays to avoid lots of typecasting for
  175. * code that accepts both physical and logical pointers.
  176. */
  177. union acpi_pointers {
  178. acpi_physical_address physical;
  179. void *logical;
  180. acpi_table_ptr value;
  181. };
  182. struct acpi_pointer {
  183. u32 pointer_type;
  184. union acpi_pointers pointer;
  185. };
  186. /* pointer_types for above */
  187. #define ACPI_PHYSICAL_POINTER 0x01
  188. #define ACPI_LOGICAL_POINTER 0x02
  189. /* Processor mode */
  190. #define ACPI_PHYSICAL_ADDRESSING 0x04
  191. #define ACPI_LOGICAL_ADDRESSING 0x08
  192. #define ACPI_MEMORY_MODE 0x0C
  193. #define ACPI_PHYSMODE_PHYSPTR ACPI_PHYSICAL_ADDRESSING | ACPI_PHYSICAL_POINTER
  194. #define ACPI_LOGMODE_PHYSPTR ACPI_LOGICAL_ADDRESSING | ACPI_PHYSICAL_POINTER
  195. #define ACPI_LOGMODE_LOGPTR ACPI_LOGICAL_ADDRESSING | ACPI_LOGICAL_POINTER
  196. /*
  197. * If acpi_cache_t was not defined in the OS-dependent header,
  198. * define it now. This is typically the case where the local cache
  199. * manager implementation is to be used (ACPI_USE_LOCAL_CACHE)
  200. */
  201. #ifndef acpi_cache_t
  202. #define acpi_cache_t struct acpi_memory_list
  203. #endif
  204. /*
  205. * Useful defines
  206. */
  207. #ifdef FALSE
  208. #undef FALSE
  209. #endif
  210. #define FALSE (1 == 0)
  211. #ifdef TRUE
  212. #undef TRUE
  213. #endif
  214. #define TRUE (1 == 1)
  215. #ifndef NULL
  216. #define NULL (void *) 0
  217. #endif
  218. /*
  219. * Local datatypes
  220. */
  221. typedef u32 acpi_status; /* All ACPI Exceptions */
  222. typedef u32 acpi_name; /* 4-byte ACPI name */
  223. typedef char *acpi_string; /* Null terminated ASCII string */
  224. typedef void *acpi_handle; /* Actually a ptr to an Node */
  225. struct uint64_struct {
  226. u32 lo;
  227. u32 hi;
  228. };
  229. union uint64_overlay {
  230. u64 full;
  231. struct uint64_struct part;
  232. };
  233. struct uint32_struct {
  234. u32 lo;
  235. u32 hi;
  236. };
  237. /*
  238. * Acpi integer width. In ACPI version 1, integers are
  239. * 32 bits. In ACPI version 2, integers are 64 bits.
  240. * Note that this pertains to the ACPI integer type only, not
  241. * other integers used in the implementation of the ACPI CA
  242. * subsystem.
  243. */
  244. #ifdef ACPI_NO_INTEGER64_SUPPORT
  245. /* 32-bit integers only, no 64-bit support */
  246. typedef u32 acpi_integer;
  247. #define ACPI_INTEGER_MAX ACPI_UINT32_MAX
  248. #define ACPI_INTEGER_BIT_SIZE 32
  249. #define ACPI_MAX_DECIMAL_DIGITS 10 /* 2^32 = 4,294,967,296 */
  250. #define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 32-bit divide */
  251. #else
  252. /* 64-bit integers */
  253. typedef u64 acpi_integer;
  254. #define ACPI_INTEGER_MAX ACPI_UINT64_MAX
  255. #define ACPI_INTEGER_BIT_SIZE 64
  256. #define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */
  257. #if ACPI_MACHINE_WIDTH == 64
  258. #define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 64-bit divide */
  259. #endif
  260. #endif
  261. #define ACPI_MAX64_DECIMAL_DIGITS 20
  262. #define ACPI_MAX32_DECIMAL_DIGITS 10
  263. #define ACPI_MAX16_DECIMAL_DIGITS 5
  264. #define ACPI_MAX8_DECIMAL_DIGITS 3
  265. /*
  266. * Constants with special meanings
  267. */
  268. #define ACPI_ROOT_OBJECT (acpi_handle) ACPI_PTR_ADD (char, NULL, ACPI_MAX_PTR)
  269. /*
  270. * Initialization sequence
  271. */
  272. #define ACPI_FULL_INITIALIZATION 0x00
  273. #define ACPI_NO_ADDRESS_SPACE_INIT 0x01
  274. #define ACPI_NO_HARDWARE_INIT 0x02
  275. #define ACPI_NO_EVENT_INIT 0x04
  276. #define ACPI_NO_HANDLER_INIT 0x08
  277. #define ACPI_NO_ACPI_ENABLE 0x10
  278. #define ACPI_NO_DEVICE_INIT 0x20
  279. #define ACPI_NO_OBJECT_INIT 0x40
  280. /*
  281. * Initialization state
  282. */
  283. #define ACPI_INITIALIZED_OK 0x01
  284. /*
  285. * Power state values
  286. */
  287. #define ACPI_STATE_UNKNOWN (u8) 0xFF
  288. #define ACPI_STATE_S0 (u8) 0
  289. #define ACPI_STATE_S1 (u8) 1
  290. #define ACPI_STATE_S2 (u8) 2
  291. #define ACPI_STATE_S3 (u8) 3
  292. #define ACPI_STATE_S4 (u8) 4
  293. #define ACPI_STATE_S5 (u8) 5
  294. #define ACPI_S_STATES_MAX ACPI_STATE_S5
  295. #define ACPI_S_STATE_COUNT 6
  296. #define ACPI_STATE_D0 (u8) 0
  297. #define ACPI_STATE_D1 (u8) 1
  298. #define ACPI_STATE_D2 (u8) 2
  299. #define ACPI_STATE_D3 (u8) 3
  300. #define ACPI_D_STATES_MAX ACPI_STATE_D3
  301. #define ACPI_D_STATE_COUNT 4
  302. #define ACPI_STATE_C0 (u8) 0
  303. #define ACPI_STATE_C1 (u8) 1
  304. #define ACPI_STATE_C2 (u8) 2
  305. #define ACPI_STATE_C3 (u8) 3
  306. #define ACPI_C_STATES_MAX ACPI_STATE_C3
  307. #define ACPI_C_STATE_COUNT 4
  308. /*
  309. * Sleep type invalid value
  310. */
  311. #define ACPI_SLEEP_TYPE_MAX 0x7
  312. #define ACPI_SLEEP_TYPE_INVALID 0xFF
  313. /*
  314. * Standard notify values
  315. */
  316. #define ACPI_NOTIFY_BUS_CHECK (u8) 0
  317. #define ACPI_NOTIFY_DEVICE_CHECK (u8) 1
  318. #define ACPI_NOTIFY_DEVICE_WAKE (u8) 2
  319. #define ACPI_NOTIFY_EJECT_REQUEST (u8) 3
  320. #define ACPI_NOTIFY_DEVICE_CHECK_LIGHT (u8) 4
  321. #define ACPI_NOTIFY_FREQUENCY_MISMATCH (u8) 5
  322. #define ACPI_NOTIFY_BUS_MODE_MISMATCH (u8) 6
  323. #define ACPI_NOTIFY_POWER_FAULT (u8) 7
  324. /*
  325. * Table types. These values are passed to the table related APIs
  326. */
  327. typedef u32 acpi_table_type;
  328. #define ACPI_TABLE_RSDP (acpi_table_type) 0
  329. #define ACPI_TABLE_DSDT (acpi_table_type) 1
  330. #define ACPI_TABLE_FADT (acpi_table_type) 2
  331. #define ACPI_TABLE_FACS (acpi_table_type) 3
  332. #define ACPI_TABLE_PSDT (acpi_table_type) 4
  333. #define ACPI_TABLE_SSDT (acpi_table_type) 5
  334. #define ACPI_TABLE_XSDT (acpi_table_type) 6
  335. #define ACPI_TABLE_MAX 6
  336. #define NUM_ACPI_TABLE_TYPES (ACPI_TABLE_MAX+1)
  337. /*
  338. * Types associated with ACPI names and objects. The first group of
  339. * values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition
  340. * of the ACPI object_type() operator (See the ACPI Spec). Therefore,
  341. * only add to the first group if the spec changes.
  342. *
  343. * NOTE: Types must be kept in sync with the global acpi_ns_properties
  344. * and acpi_ns_type_names arrays.
  345. */
  346. typedef u32 acpi_object_type;
  347. #define ACPI_TYPE_ANY 0x00
  348. #define ACPI_TYPE_INTEGER 0x01 /* Byte/Word/Dword/Zero/One/Ones */
  349. #define ACPI_TYPE_STRING 0x02
  350. #define ACPI_TYPE_BUFFER 0x03
  351. #define ACPI_TYPE_PACKAGE 0x04 /* byte_const, multiple data_term/Constant/super_name */
  352. #define ACPI_TYPE_FIELD_UNIT 0x05
  353. #define ACPI_TYPE_DEVICE 0x06 /* Name, multiple Node */
  354. #define ACPI_TYPE_EVENT 0x07
  355. #define ACPI_TYPE_METHOD 0x08 /* Name, byte_const, multiple Code */
  356. #define ACPI_TYPE_MUTEX 0x09
  357. #define ACPI_TYPE_REGION 0x0A
  358. #define ACPI_TYPE_POWER 0x0B /* Name,byte_const,word_const,multi Node */
  359. #define ACPI_TYPE_PROCESSOR 0x0C /* Name,byte_const,Dword_const,byte_const,multi nm_o */
  360. #define ACPI_TYPE_THERMAL 0x0D /* Name, multiple Node */
  361. #define ACPI_TYPE_BUFFER_FIELD 0x0E
  362. #define ACPI_TYPE_DDB_HANDLE 0x0F
  363. #define ACPI_TYPE_DEBUG_OBJECT 0x10
  364. #define ACPI_TYPE_EXTERNAL_MAX 0x10
  365. /*
  366. * These are object types that do not map directly to the ACPI
  367. * object_type() operator. They are used for various internal purposes only.
  368. * If new predefined ACPI_TYPEs are added (via the ACPI specification), these
  369. * internal types must move upwards. (There is code that depends on these
  370. * values being contiguous with the external types above.)
  371. */
  372. #define ACPI_TYPE_LOCAL_REGION_FIELD 0x11
  373. #define ACPI_TYPE_LOCAL_BANK_FIELD 0x12
  374. #define ACPI_TYPE_LOCAL_INDEX_FIELD 0x13
  375. #define ACPI_TYPE_LOCAL_REFERENCE 0x14 /* Arg#, Local#, Name, Debug, ref_of, Index */
  376. #define ACPI_TYPE_LOCAL_ALIAS 0x15
  377. #define ACPI_TYPE_LOCAL_METHOD_ALIAS 0x16
  378. #define ACPI_TYPE_LOCAL_NOTIFY 0x17
  379. #define ACPI_TYPE_LOCAL_ADDRESS_HANDLER 0x18
  380. #define ACPI_TYPE_LOCAL_RESOURCE 0x19
  381. #define ACPI_TYPE_LOCAL_RESOURCE_FIELD 0x1A
  382. #define ACPI_TYPE_LOCAL_SCOPE 0x1B /* 1 Name, multiple object_list Nodes */
  383. #define ACPI_TYPE_NS_NODE_MAX 0x1B /* Last typecode used within a NS Node */
  384. /*
  385. * These are special object types that never appear in
  386. * a Namespace node, only in an union acpi_operand_object
  387. */
  388. #define ACPI_TYPE_LOCAL_EXTRA 0x1C
  389. #define ACPI_TYPE_LOCAL_DATA 0x1D
  390. #define ACPI_TYPE_LOCAL_MAX 0x1D
  391. /* All types above here are invalid */
  392. #define ACPI_TYPE_INVALID 0x1E
  393. #define ACPI_TYPE_NOT_FOUND 0xFF
  394. /*
  395. * Bitmapped ACPI types. Used internally only
  396. */
  397. #define ACPI_BTYPE_ANY 0x00000000
  398. #define ACPI_BTYPE_INTEGER 0x00000001
  399. #define ACPI_BTYPE_STRING 0x00000002
  400. #define ACPI_BTYPE_BUFFER 0x00000004
  401. #define ACPI_BTYPE_PACKAGE 0x00000008
  402. #define ACPI_BTYPE_FIELD_UNIT 0x00000010
  403. #define ACPI_BTYPE_DEVICE 0x00000020
  404. #define ACPI_BTYPE_EVENT 0x00000040
  405. #define ACPI_BTYPE_METHOD 0x00000080
  406. #define ACPI_BTYPE_MUTEX 0x00000100
  407. #define ACPI_BTYPE_REGION 0x00000200
  408. #define ACPI_BTYPE_POWER 0x00000400
  409. #define ACPI_BTYPE_PROCESSOR 0x00000800
  410. #define ACPI_BTYPE_THERMAL 0x00001000
  411. #define ACPI_BTYPE_BUFFER_FIELD 0x00002000
  412. #define ACPI_BTYPE_DDB_HANDLE 0x00004000
  413. #define ACPI_BTYPE_DEBUG_OBJECT 0x00008000
  414. #define ACPI_BTYPE_REFERENCE 0x00010000
  415. #define ACPI_BTYPE_RESOURCE 0x00020000
  416. #define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
  417. #define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE)
  418. #define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
  419. #define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
  420. #define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */
  421. #define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF
  422. /*
  423. * All I/O
  424. */
  425. #define ACPI_READ 0
  426. #define ACPI_WRITE 1
  427. #define ACPI_IO_MASK 1
  428. /*
  429. * Event Types: Fixed & General Purpose
  430. */
  431. typedef u32 acpi_event_type;
  432. /*
  433. * Fixed events
  434. */
  435. #define ACPI_EVENT_PMTIMER 0
  436. #define ACPI_EVENT_GLOBAL 1
  437. #define ACPI_EVENT_POWER_BUTTON 2
  438. #define ACPI_EVENT_SLEEP_BUTTON 3
  439. #define ACPI_EVENT_RTC 4
  440. #define ACPI_EVENT_MAX 4
  441. #define ACPI_NUM_FIXED_EVENTS ACPI_EVENT_MAX + 1
  442. /*
  443. * Event Status - Per event
  444. * -------------
  445. * The encoding of acpi_event_status is illustrated below.
  446. * Note that a set bit (1) indicates the property is TRUE
  447. * (e.g. if bit 0 is set then the event is enabled).
  448. * +-------------+-+-+-+
  449. * | Bits 31:3 |2|1|0|
  450. * +-------------+-+-+-+
  451. * | | | |
  452. * | | | +- Enabled?
  453. * | | +--- Enabled for wake?
  454. * | +----- Set?
  455. * +----------- <Reserved>
  456. */
  457. typedef u32 acpi_event_status;
  458. #define ACPI_EVENT_FLAG_DISABLED (acpi_event_status) 0x00
  459. #define ACPI_EVENT_FLAG_ENABLED (acpi_event_status) 0x01
  460. #define ACPI_EVENT_FLAG_WAKE_ENABLED (acpi_event_status) 0x02
  461. #define ACPI_EVENT_FLAG_SET (acpi_event_status) 0x04
  462. /*
  463. * General Purpose Events (GPE)
  464. */
  465. #define ACPI_GPE_INVALID 0xFF
  466. #define ACPI_GPE_MAX 0xFF
  467. #define ACPI_NUM_GPE 256
  468. #define ACPI_GPE_ENABLE 0
  469. #define ACPI_GPE_DISABLE 1
  470. /*
  471. * GPE info flags - Per GPE
  472. * +-+-+-+---+---+-+
  473. * |7|6|5|4:3|2:1|0|
  474. * +-+-+-+---+---+-+
  475. * | | | | | |
  476. * | | | | | +--- Interrupt type: Edge or Level Triggered
  477. * | | | | +--- Type: Wake-only, Runtime-only, or wake/runtime
  478. * | | | +--- Type of dispatch -- to method, handler, or none
  479. * | | +--- Enabled for runtime?
  480. * | +--- Enabled for wake?
  481. * +--- System state when GPE ocurred (running/waking)
  482. */
  483. #define ACPI_GPE_XRUPT_TYPE_MASK (u8) 0x01
  484. #define ACPI_GPE_LEVEL_TRIGGERED (u8) 0x01
  485. #define ACPI_GPE_EDGE_TRIGGERED (u8) 0x00
  486. #define ACPI_GPE_TYPE_MASK (u8) 0x06
  487. #define ACPI_GPE_TYPE_WAKE_RUN (u8) 0x06
  488. #define ACPI_GPE_TYPE_WAKE (u8) 0x02
  489. #define ACPI_GPE_TYPE_RUNTIME (u8) 0x04 /* Default */
  490. #define ACPI_GPE_DISPATCH_MASK (u8) 0x18
  491. #define ACPI_GPE_DISPATCH_HANDLER (u8) 0x08
  492. #define ACPI_GPE_DISPATCH_METHOD (u8) 0x10
  493. #define ACPI_GPE_DISPATCH_NOT_USED (u8) 0x00 /* Default */
  494. #define ACPI_GPE_RUN_ENABLE_MASK (u8) 0x20
  495. #define ACPI_GPE_RUN_ENABLED (u8) 0x20
  496. #define ACPI_GPE_RUN_DISABLED (u8) 0x00 /* Default */
  497. #define ACPI_GPE_WAKE_ENABLE_MASK (u8) 0x40
  498. #define ACPI_GPE_WAKE_ENABLED (u8) 0x40
  499. #define ACPI_GPE_WAKE_DISABLED (u8) 0x00 /* Default */
  500. #define ACPI_GPE_ENABLE_MASK (u8) 0x60 /* Both run/wake */
  501. #define ACPI_GPE_SYSTEM_MASK (u8) 0x80
  502. #define ACPI_GPE_SYSTEM_RUNNING (u8) 0x80
  503. #define ACPI_GPE_SYSTEM_WAKING (u8) 0x00
  504. /*
  505. * Flags for GPE and Lock interfaces
  506. */
  507. #define ACPI_EVENT_WAKE_ENABLE 0x2 /* acpi_gpe_enable */
  508. #define ACPI_EVENT_WAKE_DISABLE 0x2 /* acpi_gpe_disable */
  509. #define ACPI_NOT_ISR 0x1
  510. #define ACPI_ISR 0x0
  511. /* Notify types */
  512. #define ACPI_SYSTEM_NOTIFY 0x1
  513. #define ACPI_DEVICE_NOTIFY 0x2
  514. #define ACPI_ALL_NOTIFY 0x3
  515. #define ACPI_MAX_NOTIFY_HANDLER_TYPE 0x3
  516. #define ACPI_MAX_SYS_NOTIFY 0x7f
  517. /* Address Space (Operation Region) Types */
  518. typedef u8 acpi_adr_space_type;
  519. #define ACPI_ADR_SPACE_SYSTEM_MEMORY (acpi_adr_space_type) 0
  520. #define ACPI_ADR_SPACE_SYSTEM_IO (acpi_adr_space_type) 1
  521. #define ACPI_ADR_SPACE_PCI_CONFIG (acpi_adr_space_type) 2
  522. #define ACPI_ADR_SPACE_EC (acpi_adr_space_type) 3
  523. #define ACPI_ADR_SPACE_SMBUS (acpi_adr_space_type) 4
  524. #define ACPI_ADR_SPACE_CMOS (acpi_adr_space_type) 5
  525. #define ACPI_ADR_SPACE_PCI_BAR_TARGET (acpi_adr_space_type) 6
  526. #define ACPI_ADR_SPACE_DATA_TABLE (acpi_adr_space_type) 7
  527. #define ACPI_ADR_SPACE_FIXED_HARDWARE (acpi_adr_space_type) 127
  528. /*
  529. * bit_register IDs
  530. * These are bitfields defined within the full ACPI registers
  531. */
  532. #define ACPI_BITREG_TIMER_STATUS 0x00
  533. #define ACPI_BITREG_BUS_MASTER_STATUS 0x01
  534. #define ACPI_BITREG_GLOBAL_LOCK_STATUS 0x02
  535. #define ACPI_BITREG_POWER_BUTTON_STATUS 0x03
  536. #define ACPI_BITREG_SLEEP_BUTTON_STATUS 0x04
  537. #define ACPI_BITREG_RT_CLOCK_STATUS 0x05
  538. #define ACPI_BITREG_WAKE_STATUS 0x06
  539. #define ACPI_BITREG_PCIEXP_WAKE_STATUS 0x07
  540. #define ACPI_BITREG_TIMER_ENABLE 0x08
  541. #define ACPI_BITREG_GLOBAL_LOCK_ENABLE 0x09
  542. #define ACPI_BITREG_POWER_BUTTON_ENABLE 0x0A
  543. #define ACPI_BITREG_SLEEP_BUTTON_ENABLE 0x0B
  544. #define ACPI_BITREG_RT_CLOCK_ENABLE 0x0C
  545. #define ACPI_BITREG_WAKE_ENABLE 0x0D
  546. #define ACPI_BITREG_PCIEXP_WAKE_DISABLE 0x0E
  547. #define ACPI_BITREG_SCI_ENABLE 0x0F
  548. #define ACPI_BITREG_BUS_MASTER_RLD 0x10
  549. #define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x11
  550. #define ACPI_BITREG_SLEEP_TYPE_A 0x12
  551. #define ACPI_BITREG_SLEEP_TYPE_B 0x13
  552. #define ACPI_BITREG_SLEEP_ENABLE 0x14
  553. #define ACPI_BITREG_ARB_DISABLE 0x15
  554. #define ACPI_BITREG_MAX 0x15
  555. #define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1
  556. /*
  557. * External ACPI object definition
  558. */
  559. union acpi_object {
  560. acpi_object_type type; /* See definition of acpi_ns_type for values */
  561. struct {
  562. acpi_object_type type;
  563. acpi_integer value; /* The actual number */
  564. } integer;
  565. struct {
  566. acpi_object_type type;
  567. u32 length; /* # of bytes in string, excluding trailing null */
  568. char *pointer; /* points to the string value */
  569. } string;
  570. struct {
  571. acpi_object_type type;
  572. u32 length; /* # of bytes in buffer */
  573. u8 *pointer; /* points to the buffer */
  574. } buffer;
  575. struct {
  576. acpi_object_type type;
  577. u32 fill1;
  578. acpi_handle handle; /* object reference */
  579. } reference;
  580. struct {
  581. acpi_object_type type;
  582. u32 count; /* # of elements in package */
  583. union acpi_object *elements; /* Pointer to an array of ACPI_OBJECTs */
  584. } package;
  585. struct {
  586. acpi_object_type type;
  587. u32 proc_id;
  588. acpi_io_address pblk_address;
  589. u32 pblk_length;
  590. } processor;
  591. struct {
  592. acpi_object_type type;
  593. u32 system_level;
  594. u32 resource_order;
  595. } power_resource;
  596. };
  597. /*
  598. * List of objects, used as a parameter list for control method evaluation
  599. */
  600. struct acpi_object_list {
  601. u32 count;
  602. union acpi_object *pointer;
  603. };
  604. /*
  605. * Miscellaneous common Data Structures used by the interfaces
  606. */
  607. #define ACPI_NO_BUFFER 0
  608. #define ACPI_ALLOCATE_BUFFER (acpi_size) (-1)
  609. #define ACPI_ALLOCATE_LOCAL_BUFFER (acpi_size) (-2)
  610. struct acpi_buffer {
  611. acpi_size length; /* Length in bytes of the buffer */
  612. void *pointer; /* pointer to buffer */
  613. };
  614. /*
  615. * name_type for acpi_get_name
  616. */
  617. #define ACPI_FULL_PATHNAME 0
  618. #define ACPI_SINGLE_NAME 1
  619. #define ACPI_NAME_TYPE_MAX 1
  620. /*
  621. * Structure and flags for acpi_get_system_info
  622. */
  623. #define ACPI_SYS_MODE_UNKNOWN 0x0000
  624. #define ACPI_SYS_MODE_ACPI 0x0001
  625. #define ACPI_SYS_MODE_LEGACY 0x0002
  626. #define ACPI_SYS_MODES_MASK 0x0003
  627. /*
  628. * ACPI Table Info. One per ACPI table _type_
  629. */
  630. struct acpi_table_info {
  631. u32 count;
  632. };
  633. /*
  634. * System info returned by acpi_get_system_info()
  635. */
  636. struct acpi_system_info {
  637. u32 acpi_ca_version;
  638. u32 flags;
  639. u32 timer_resolution;
  640. u32 reserved1;
  641. u32 reserved2;
  642. u32 debug_level;
  643. u32 debug_layer;
  644. u32 num_table_types;
  645. struct acpi_table_info table_info[NUM_ACPI_TABLE_TYPES];
  646. };
  647. /*
  648. * Types specific to the OS service interfaces
  649. */
  650. typedef u32(ACPI_SYSTEM_XFACE * acpi_osd_handler) (void *context);
  651. typedef void
  652. (ACPI_SYSTEM_XFACE * acpi_osd_exec_callback) (void *context);
  653. /*
  654. * Various handlers and callback procedures
  655. */
  656. typedef u32(*acpi_event_handler) (void *context);
  657. typedef
  658. void (*acpi_notify_handler) (acpi_handle device, u32 value, void *context);
  659. typedef
  660. void (*acpi_object_handler) (acpi_handle object, u32 function, void *data);
  661. typedef acpi_status(*acpi_init_handler) (acpi_handle object, u32 function);
  662. #define ACPI_INIT_DEVICE_INI 1
  663. typedef
  664. acpi_status(*acpi_exception_handler) (acpi_status aml_status,
  665. acpi_name name,
  666. u16 opcode,
  667. u32 aml_offset, void *context);
  668. /* Address Spaces (For Operation Regions) */
  669. typedef
  670. acpi_status(*acpi_adr_space_handler) (u32 function,
  671. acpi_physical_address address,
  672. u32 bit_width,
  673. acpi_integer * value,
  674. void *handler_context,
  675. void *region_context);
  676. #define ACPI_DEFAULT_HANDLER NULL
  677. typedef
  678. acpi_status(*acpi_adr_space_setup) (acpi_handle region_handle,
  679. u32 function,
  680. void *handler_context,
  681. void **region_context);
  682. #define ACPI_REGION_ACTIVATE 0
  683. #define ACPI_REGION_DEACTIVATE 1
  684. typedef
  685. acpi_status(*acpi_walk_callback) (acpi_handle obj_handle,
  686. u32 nesting_level,
  687. void *context, void **return_value);
  688. /* Interrupt handler return values */
  689. #define ACPI_INTERRUPT_NOT_HANDLED 0x00
  690. #define ACPI_INTERRUPT_HANDLED 0x01
  691. /* Common string version of device HIDs and UIDs */
  692. struct acpi_device_id {
  693. char value[ACPI_DEVICE_ID_LENGTH];
  694. };
  695. /* Common string version of device CIDs */
  696. struct acpi_compatible_id {
  697. char value[ACPI_MAX_CID_LENGTH];
  698. };
  699. struct acpi_compatible_id_list {
  700. u32 count;
  701. u32 size;
  702. struct acpi_compatible_id id[1];
  703. };
  704. /* Structure and flags for acpi_get_object_info */
  705. #define ACPI_VALID_STA 0x0001
  706. #define ACPI_VALID_ADR 0x0002
  707. #define ACPI_VALID_HID 0x0004
  708. #define ACPI_VALID_UID 0x0008
  709. #define ACPI_VALID_CID 0x0010
  710. #define ACPI_VALID_SXDS 0x0020
  711. #define ACPI_COMMON_OBJ_INFO \
  712. acpi_object_type type; /* ACPI object type */ \
  713. acpi_name name /* ACPI object Name */
  714. struct acpi_obj_info_header {
  715. ACPI_COMMON_OBJ_INFO;
  716. };
  717. /* Structure returned from Get Object Info */
  718. struct acpi_device_info {
  719. ACPI_COMMON_OBJ_INFO;
  720. u32 valid; /* Indicates which fields below are valid */
  721. u32 current_status; /* _STA value */
  722. acpi_integer address; /* _ADR value if any */
  723. struct acpi_device_id hardware_id; /* _HID value if any */
  724. struct acpi_device_id unique_id; /* _UID value if any */
  725. u8 highest_dstates[4]; /* _sx_d values: 0xFF indicates not valid */
  726. struct acpi_compatible_id_list compatibility_id; /* List of _CIDs if any */
  727. };
  728. /* Context structs for address space handlers */
  729. struct acpi_pci_id {
  730. u16 segment;
  731. u16 bus;
  732. u16 device;
  733. u16 function;
  734. };
  735. struct acpi_mem_space_context {
  736. u32 length;
  737. acpi_physical_address address;
  738. acpi_physical_address mapped_physical_address;
  739. u8 *mapped_logical_address;
  740. acpi_size mapped_length;
  741. };
  742. /*
  743. * Definitions for Resource Attributes
  744. */
  745. /*
  746. * Memory Attributes
  747. */
  748. #define ACPI_READ_ONLY_MEMORY (u8) 0x00
  749. #define ACPI_READ_WRITE_MEMORY (u8) 0x01
  750. #define ACPI_NON_CACHEABLE_MEMORY (u8) 0x00
  751. #define ACPI_CACHABLE_MEMORY (u8) 0x01
  752. #define ACPI_WRITE_COMBINING_MEMORY (u8) 0x02
  753. #define ACPI_PREFETCHABLE_MEMORY (u8) 0x03
  754. /*
  755. * IO Attributes
  756. * The ISA Io ranges are: n000-n0_ffh, n400-n4_ffh, n800-n8_ffh, n_c00-n_cFFh.
  757. * The non-ISA Io ranges are: n100-n3_ffh, n500-n7_ffh, n900-n_bFfh, n_cd0-n_fFFh.
  758. */
  759. #define ACPI_NON_ISA_ONLY_RANGES (u8) 0x01
  760. #define ACPI_ISA_ONLY_RANGES (u8) 0x02
  761. #define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES)
  762. #define ACPI_SPARSE_TRANSLATION (u8) 0x03
  763. /*
  764. * IO Port Descriptor Decode
  765. */
  766. #define ACPI_DECODE_10 (u8) 0x00 /* 10-bit IO address decode */
  767. #define ACPI_DECODE_16 (u8) 0x01 /* 16-bit IO address decode */
  768. /*
  769. * IRQ Attributes
  770. */
  771. #define ACPI_EDGE_SENSITIVE (u8) 0x00
  772. #define ACPI_LEVEL_SENSITIVE (u8) 0x01
  773. #define ACPI_ACTIVE_HIGH (u8) 0x00
  774. #define ACPI_ACTIVE_LOW (u8) 0x01
  775. #define ACPI_EXCLUSIVE (u8) 0x00
  776. #define ACPI_SHARED (u8) 0x01
  777. /*
  778. * DMA Attributes
  779. */
  780. #define ACPI_COMPATIBILITY (u8) 0x00
  781. #define ACPI_TYPE_A (u8) 0x01
  782. #define ACPI_TYPE_B (u8) 0x02
  783. #define ACPI_TYPE_F (u8) 0x03
  784. #define ACPI_NOT_BUS_MASTER (u8) 0x00
  785. #define ACPI_BUS_MASTER (u8) 0x01
  786. #define ACPI_TRANSFER_8 (u8) 0x00
  787. #define ACPI_TRANSFER_8_16 (u8) 0x01
  788. #define ACPI_TRANSFER_16 (u8) 0x02
  789. /*
  790. * Start Dependent Functions Priority definitions
  791. */
  792. #define ACPI_GOOD_CONFIGURATION (u8) 0x00
  793. #define ACPI_ACCEPTABLE_CONFIGURATION (u8) 0x01
  794. #define ACPI_SUB_OPTIMAL_CONFIGURATION (u8) 0x02
  795. /*
  796. * 16, 32 and 64-bit Address Descriptor resource types
  797. */
  798. #define ACPI_MEMORY_RANGE (u8) 0x00
  799. #define ACPI_IO_RANGE (u8) 0x01
  800. #define ACPI_BUS_NUMBER_RANGE (u8) 0x02
  801. #define ACPI_ADDRESS_NOT_FIXED (u8) 0x00
  802. #define ACPI_ADDRESS_FIXED (u8) 0x01
  803. #define ACPI_POS_DECODE (u8) 0x00
  804. #define ACPI_SUB_DECODE (u8) 0x01
  805. #define ACPI_PRODUCER (u8) 0x00
  806. #define ACPI_CONSUMER (u8) 0x01
  807. /*
  808. * Structures used to describe device resources
  809. */
  810. struct acpi_resource_irq {
  811. u32 edge_level;
  812. u32 active_high_low;
  813. u32 shared_exclusive;
  814. u32 number_of_interrupts;
  815. u32 interrupts[1];
  816. };
  817. struct acpi_resource_dma {
  818. u32 type;
  819. u32 bus_master;
  820. u32 transfer;
  821. u32 number_of_channels;
  822. u32 channels[1];
  823. };
  824. struct acpi_resource_start_dpf {
  825. u32 compatibility_priority;
  826. u32 performance_robustness;
  827. };
  828. /*
  829. * END_DEPENDENT_FUNCTIONS_RESOURCE struct is not
  830. * needed because it has no fields
  831. */
  832. struct acpi_resource_io {
  833. u32 io_decode;
  834. u32 min_base_address;
  835. u32 max_base_address;
  836. u32 alignment;
  837. u32 range_length;
  838. };
  839. struct acpi_resource_fixed_io {
  840. u32 base_address;
  841. u32 range_length;
  842. };
  843. struct acpi_resource_vendor {
  844. u32 length;
  845. u8 reserved[1];
  846. };
  847. struct acpi_resource_end_tag {
  848. u8 checksum;
  849. };
  850. struct acpi_resource_mem24 {
  851. u32 read_write_attribute;
  852. u32 min_base_address;
  853. u32 max_base_address;
  854. u32 alignment;
  855. u32 range_length;
  856. };
  857. struct acpi_resource_mem32 {
  858. u32 read_write_attribute;
  859. u32 min_base_address;
  860. u32 max_base_address;
  861. u32 alignment;
  862. u32 range_length;
  863. };
  864. struct acpi_resource_fixed_mem32 {
  865. u32 read_write_attribute;
  866. u32 range_base_address;
  867. u32 range_length;
  868. };
  869. struct acpi_memory_attribute {
  870. u16 cache_attribute;
  871. u16 read_write_attribute;
  872. };
  873. struct acpi_io_attribute {
  874. u16 range_attribute;
  875. u16 translation_attribute;
  876. };
  877. struct acpi_bus_attribute {
  878. u16 reserved1;
  879. u16 reserved2;
  880. };
  881. union acpi_resource_attribute {
  882. struct acpi_memory_attribute memory;
  883. struct acpi_io_attribute io;
  884. struct acpi_bus_attribute bus;
  885. };
  886. struct acpi_resource_source {
  887. u32 index;
  888. u32 string_length;
  889. char *string_ptr;
  890. };
  891. /* Fields common to all address descriptors, 16/32/64 bit */
  892. #define ACPI_RESOURCE_ADDRESS_COMMON \
  893. u32 resource_type; \
  894. u32 producer_consumer; \
  895. u32 decode; \
  896. u32 min_address_fixed; \
  897. u32 max_address_fixed; \
  898. union acpi_resource_attribute attribute;
  899. struct acpi_resource_address {
  900. ACPI_RESOURCE_ADDRESS_COMMON};
  901. struct acpi_resource_address16 {
  902. ACPI_RESOURCE_ADDRESS_COMMON u32 granularity;
  903. u32 min_address_range;
  904. u32 max_address_range;
  905. u32 address_translation_offset;
  906. u32 address_length;
  907. struct acpi_resource_source resource_source;
  908. };
  909. struct acpi_resource_address32 {
  910. ACPI_RESOURCE_ADDRESS_COMMON u32 granularity;
  911. u32 min_address_range;
  912. u32 max_address_range;
  913. u32 address_translation_offset;
  914. u32 address_length;
  915. struct acpi_resource_source resource_source;
  916. };
  917. struct acpi_resource_address64 {
  918. ACPI_RESOURCE_ADDRESS_COMMON u64 granularity;
  919. u64 min_address_range;
  920. u64 max_address_range;
  921. u64 address_translation_offset;
  922. u64 address_length;
  923. u64 type_specific_attributes;
  924. struct acpi_resource_source resource_source;
  925. };
  926. struct acpi_resource_ext_irq {
  927. u32 producer_consumer;
  928. u32 edge_level;
  929. u32 active_high_low;
  930. u32 shared_exclusive;
  931. u32 number_of_interrupts;
  932. struct acpi_resource_source resource_source;
  933. u32 interrupts[1];
  934. };
  935. /* ACPI_RESOURCE_TYPEs */
  936. #define ACPI_RSTYPE_IRQ 0
  937. #define ACPI_RSTYPE_DMA 1
  938. #define ACPI_RSTYPE_START_DPF 2
  939. #define ACPI_RSTYPE_END_DPF 3
  940. #define ACPI_RSTYPE_IO 4
  941. #define ACPI_RSTYPE_FIXED_IO 5
  942. #define ACPI_RSTYPE_VENDOR 6
  943. #define ACPI_RSTYPE_END_TAG 7
  944. #define ACPI_RSTYPE_MEM24 8
  945. #define ACPI_RSTYPE_MEM32 9
  946. #define ACPI_RSTYPE_FIXED_MEM32 10
  947. #define ACPI_RSTYPE_ADDRESS16 11
  948. #define ACPI_RSTYPE_ADDRESS32 12
  949. #define ACPI_RSTYPE_ADDRESS64 13
  950. #define ACPI_RSTYPE_EXT_IRQ 14
  951. typedef u32 acpi_resource_type;
  952. union acpi_resource_data {
  953. struct acpi_resource_irq irq;
  954. struct acpi_resource_dma dma;
  955. struct acpi_resource_start_dpf start_dpf;
  956. struct acpi_resource_io io;
  957. struct acpi_resource_fixed_io fixed_io;
  958. struct acpi_resource_vendor vendor_specific;
  959. struct acpi_resource_end_tag end_tag;
  960. struct acpi_resource_mem24 memory24;
  961. struct acpi_resource_mem32 memory32;
  962. struct acpi_resource_fixed_mem32 fixed_memory32;
  963. struct acpi_resource_address address; /* Common 16/32/64 address fields */
  964. struct acpi_resource_address16 address16;
  965. struct acpi_resource_address32 address32;
  966. struct acpi_resource_address64 address64;
  967. struct acpi_resource_ext_irq extended_irq;
  968. };
  969. struct acpi_resource {
  970. acpi_resource_type id;
  971. u32 length;
  972. union acpi_resource_data data;
  973. };
  974. #define ACPI_RESOURCE_LENGTH 12
  975. #define ACPI_RESOURCE_LENGTH_NO_DATA 8 /* Id + Length fields */
  976. #define ACPI_SIZEOF_RESOURCE(type) (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (type))
  977. #define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length)
  978. #ifdef ACPI_MISALIGNED_TRANSFERS
  979. #define ACPI_ALIGN_RESOURCE_SIZE(length) (length)
  980. #else
  981. #define ACPI_ALIGN_RESOURCE_SIZE(length) ACPI_ROUND_UP_TO_NATIVE_WORD(length)
  982. #endif
  983. /*
  984. * END: of definitions for Resource Attributes
  985. */
  986. struct acpi_pci_routing_table {
  987. u32 length;
  988. u32 pin;
  989. acpi_integer address; /* here for 64-bit alignment */
  990. u32 source_index;
  991. char source[4]; /* pad to 64 bits so sizeof() works in all cases */
  992. };
  993. /*
  994. * END: of definitions for PCI Routing tables
  995. */
  996. #endif /* __ACTYPES_H__ */