actypes.h 42 KB

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