actypes.h 38 KB

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