actypes.h 36 KB

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