actypes.h 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224
  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 triggering;
  812. u32 polarity;
  813. u32 sharable;
  814. u32 interrupt_count;
  815. u32 interrupts[1];
  816. };
  817. struct acpi_resource_dma {
  818. u32 type;
  819. u32 bus_master;
  820. u32 transfer;
  821. u32 channel_count;
  822. u32 channels[1];
  823. };
  824. struct acpi_resource_start_dependent {
  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 minimum;
  835. u32 maximum;
  836. u32 alignment;
  837. u32 address_length;
  838. };
  839. struct acpi_resource_fixed_io {
  840. u32 address;
  841. u32 address_length;
  842. };
  843. struct acpi_resource_vendor {
  844. u32 byte_length;
  845. u8 byte_data[1];
  846. };
  847. struct acpi_resource_end_tag {
  848. u8 checksum;
  849. };
  850. struct acpi_resource_memory24 {
  851. u32 read_write_attribute;
  852. u32 minimum;
  853. u32 maximum;
  854. u32 alignment;
  855. u32 address_length;
  856. };
  857. struct acpi_resource_memory32 {
  858. u32 read_write_attribute;
  859. u32 minimum;
  860. u32 maximum;
  861. u32 alignment;
  862. u32 address_length;
  863. };
  864. struct acpi_resource_fixed_memory32 {
  865. u32 read_write_attribute;
  866. u32 address;
  867. u32 address_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 minimum;
  904. u32 maximum;
  905. u32 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 minimum;
  912. u32 maximum;
  913. u32 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 minimum;
  920. u64 maximum;
  921. u64 translation_offset;
  922. u64 address_length;
  923. struct acpi_resource_source resource_source;
  924. };
  925. struct acpi_resource_extended_address64 {
  926. ACPI_RESOURCE_ADDRESS_COMMON u64 granularity;
  927. u64 minimum;
  928. u64 maximum;
  929. u64 translation_offset;
  930. u64 address_length;
  931. u64 type_specific_attributes;
  932. u8 revision_iD;
  933. };
  934. struct acpi_resource_extended_irq {
  935. u32 producer_consumer;
  936. u32 triggering;
  937. u32 polarity;
  938. u32 sharable;
  939. u32 interrupt_count;
  940. struct acpi_resource_source resource_source;
  941. u32 interrupts[1];
  942. };
  943. struct acpi_resource_generic_register {
  944. u32 space_id;
  945. u32 bit_width;
  946. u32 bit_offset;
  947. u32 access_size;
  948. u64 address;
  949. };
  950. /* ACPI_RESOURCE_TYPEs */
  951. #define ACPI_RESOURCE_TYPE_IRQ 0
  952. #define ACPI_RESOURCE_TYPE_DMA 1
  953. #define ACPI_RESOURCE_TYPE_START_DEPENDENT 2
  954. #define ACPI_RESOURCE_TYPE_END_DEPENDENT 3
  955. #define ACPI_RESOURCE_TYPE_IO 4
  956. #define ACPI_RESOURCE_TYPE_FIXED_IO 5
  957. #define ACPI_RESOURCE_TYPE_VENDOR 6
  958. #define ACPI_RESOURCE_TYPE_END_TAG 7
  959. #define ACPI_RESOURCE_TYPE_MEMORY24 8
  960. #define ACPI_RESOURCE_TYPE_MEMORY32 9
  961. #define ACPI_RESOURCE_TYPE_FIXED_MEMORY32 10
  962. #define ACPI_RESOURCE_TYPE_ADDRESS16 11
  963. #define ACPI_RESOURCE_TYPE_ADDRESS32 12
  964. #define ACPI_RESOURCE_TYPE_ADDRESS64 13
  965. #define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */
  966. #define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15
  967. #define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16
  968. #define ACPI_RESOURCE_TYPE_MAX 16
  969. union acpi_resource_data {
  970. struct acpi_resource_irq irq;
  971. struct acpi_resource_dma dma;
  972. struct acpi_resource_start_dependent start_dpf;
  973. struct acpi_resource_io io;
  974. struct acpi_resource_fixed_io fixed_io;
  975. struct acpi_resource_vendor vendor;
  976. struct acpi_resource_end_tag end_tag;
  977. struct acpi_resource_memory24 memory24;
  978. struct acpi_resource_memory32 memory32;
  979. struct acpi_resource_fixed_memory32 fixed_memory32;
  980. struct acpi_resource_address16 address16;
  981. struct acpi_resource_address32 address32;
  982. struct acpi_resource_address64 address64;
  983. struct acpi_resource_extended_address64 ext_address64;
  984. struct acpi_resource_extended_irq extended_irq;
  985. struct acpi_resource_generic_register generic_reg;
  986. /* Common fields */
  987. struct acpi_resource_address address; /* Common 16/32/64 address fields */
  988. };
  989. struct acpi_resource {
  990. u32 type;
  991. u32 length;
  992. union acpi_resource_data data;
  993. };
  994. #define ACPI_RESOURCE_LENGTH 12
  995. #define ACPI_RESOURCE_LENGTH_NO_DATA 8 /* Id + Length fields */
  996. #define ACPI_SIZEOF_RESOURCE(type) (u32) (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (type))
  997. #define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length)
  998. #ifdef ACPI_MISALIGNED_TRANSFERS
  999. #define ACPI_ALIGN_RESOURCE_SIZE(length) (length)
  1000. #else
  1001. #define ACPI_ALIGN_RESOURCE_SIZE(length) ACPI_ROUND_UP_TO_NATIVE_WORD(length)
  1002. #endif
  1003. /*
  1004. * END: of definitions for Resource Attributes
  1005. */
  1006. struct acpi_pci_routing_table {
  1007. u32 length;
  1008. u32 pin;
  1009. acpi_integer address; /* here for 64-bit alignment */
  1010. u32 source_index;
  1011. char source[4]; /* pad to 64 bits so sizeof() works in all cases */
  1012. };
  1013. /*
  1014. * END: of definitions for PCI Routing tables
  1015. */
  1016. #endif /* __ACTYPES_H__ */