actypes.h 36 KB

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