actypes.h 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256
  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. #define ACPI_EVENT_FLAG_HANDLE (acpi_event_status) 0x08
  445. /*
  446. * General Purpose Events (GPE)
  447. */
  448. #define ACPI_GPE_INVALID 0xFF
  449. #define ACPI_GPE_MAX 0xFF
  450. #define ACPI_NUM_GPE 256
  451. #define ACPI_GPE_ENABLE 0
  452. #define ACPI_GPE_DISABLE 1
  453. /*
  454. * GPE info flags - Per GPE
  455. * +-+-+-+---+---+-+
  456. * |7|6|5|4:3|2:1|0|
  457. * +-+-+-+---+---+-+
  458. * | | | | | |
  459. * | | | | | +--- Interrupt type: Edge or Level Triggered
  460. * | | | | +--- Type: Wake-only, Runtime-only, or wake/runtime
  461. * | | | +--- Type of dispatch -- to method, handler, or none
  462. * | | +--- Enabled for runtime?
  463. * | +--- Enabled for wake?
  464. * +--- Unused
  465. */
  466. #define ACPI_GPE_XRUPT_TYPE_MASK (u8) 0x01
  467. #define ACPI_GPE_LEVEL_TRIGGERED (u8) 0x01
  468. #define ACPI_GPE_EDGE_TRIGGERED (u8) 0x00
  469. #define ACPI_GPE_TYPE_MASK (u8) 0x06
  470. #define ACPI_GPE_TYPE_WAKE_RUN (u8) 0x06
  471. #define ACPI_GPE_TYPE_WAKE (u8) 0x02
  472. #define ACPI_GPE_TYPE_RUNTIME (u8) 0x04 /* Default */
  473. #define ACPI_GPE_DISPATCH_MASK (u8) 0x18
  474. #define ACPI_GPE_DISPATCH_HANDLER (u8) 0x08
  475. #define ACPI_GPE_DISPATCH_METHOD (u8) 0x10
  476. #define ACPI_GPE_DISPATCH_NOT_USED (u8) 0x00 /* Default */
  477. #define ACPI_GPE_RUN_ENABLE_MASK (u8) 0x20
  478. #define ACPI_GPE_RUN_ENABLED (u8) 0x20
  479. #define ACPI_GPE_RUN_DISABLED (u8) 0x00 /* Default */
  480. #define ACPI_GPE_WAKE_ENABLE_MASK (u8) 0x40
  481. #define ACPI_GPE_WAKE_ENABLED (u8) 0x40
  482. #define ACPI_GPE_WAKE_DISABLED (u8) 0x00 /* Default */
  483. #define ACPI_GPE_ENABLE_MASK (u8) 0x60 /* Both run/wake */
  484. /*
  485. * Flags for GPE and Lock interfaces
  486. */
  487. #define ACPI_EVENT_WAKE_ENABLE 0x2 /* acpi_gpe_enable */
  488. #define ACPI_EVENT_WAKE_DISABLE 0x2 /* acpi_gpe_disable */
  489. #define ACPI_NOT_ISR 0x1
  490. #define ACPI_ISR 0x0
  491. /* Notify types */
  492. #define ACPI_SYSTEM_NOTIFY 0x1
  493. #define ACPI_DEVICE_NOTIFY 0x2
  494. #define ACPI_ALL_NOTIFY (ACPI_SYSTEM_NOTIFY | ACPI_DEVICE_NOTIFY)
  495. #define ACPI_MAX_NOTIFY_HANDLER_TYPE 0x3
  496. #define ACPI_MAX_SYS_NOTIFY 0x7f
  497. /* Address Space (Operation Region) Types */
  498. typedef u8 acpi_adr_space_type;
  499. #define ACPI_ADR_SPACE_SYSTEM_MEMORY (acpi_adr_space_type) 0
  500. #define ACPI_ADR_SPACE_SYSTEM_IO (acpi_adr_space_type) 1
  501. #define ACPI_ADR_SPACE_PCI_CONFIG (acpi_adr_space_type) 2
  502. #define ACPI_ADR_SPACE_EC (acpi_adr_space_type) 3
  503. #define ACPI_ADR_SPACE_SMBUS (acpi_adr_space_type) 4
  504. #define ACPI_ADR_SPACE_CMOS (acpi_adr_space_type) 5
  505. #define ACPI_ADR_SPACE_PCI_BAR_TARGET (acpi_adr_space_type) 6
  506. #define ACPI_ADR_SPACE_DATA_TABLE (acpi_adr_space_type) 7
  507. #define ACPI_ADR_SPACE_FIXED_HARDWARE (acpi_adr_space_type) 127
  508. /*
  509. * bit_register IDs
  510. *
  511. * These values are intended to be used by the hardware interfaces
  512. * and are mapped to individual bitfields defined within the ACPI
  513. * registers. See the acpi_gbl_bit_register_info global table in utglobal.c
  514. * for this mapping.
  515. */
  516. /* PM1 Status register */
  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. /* PM1 Enable register */
  526. #define ACPI_BITREG_TIMER_ENABLE 0x08
  527. #define ACPI_BITREG_GLOBAL_LOCK_ENABLE 0x09
  528. #define ACPI_BITREG_POWER_BUTTON_ENABLE 0x0A
  529. #define ACPI_BITREG_SLEEP_BUTTON_ENABLE 0x0B
  530. #define ACPI_BITREG_RT_CLOCK_ENABLE 0x0C
  531. #define ACPI_BITREG_PCIEXP_WAKE_DISABLE 0x0D
  532. /* PM1 Control register */
  533. #define ACPI_BITREG_SCI_ENABLE 0x0E
  534. #define ACPI_BITREG_BUS_MASTER_RLD 0x0F
  535. #define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x10
  536. #define ACPI_BITREG_SLEEP_TYPE_A 0x11
  537. #define ACPI_BITREG_SLEEP_TYPE_B 0x12
  538. #define ACPI_BITREG_SLEEP_ENABLE 0x13
  539. /* PM2 Control register */
  540. #define ACPI_BITREG_ARB_DISABLE 0x14
  541. #define ACPI_BITREG_MAX 0x14
  542. #define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1
  543. /*
  544. * External ACPI object definition
  545. */
  546. /*
  547. * Note: Type == ACPI_TYPE_ANY (0) is used to indicate a NULL package element
  548. * or an unresolved named reference.
  549. */
  550. union acpi_object {
  551. acpi_object_type type; /* See definition of acpi_ns_type for values */
  552. struct {
  553. acpi_object_type type; /* ACPI_TYPE_INTEGER */
  554. acpi_integer value; /* The actual number */
  555. } integer;
  556. struct {
  557. acpi_object_type type; /* ACPI_TYPE_STRING */
  558. u32 length; /* # of bytes in string, excluding trailing null */
  559. char *pointer; /* points to the string value */
  560. } string;
  561. struct {
  562. acpi_object_type type; /* ACPI_TYPE_BUFFER */
  563. u32 length; /* # of bytes in buffer */
  564. u8 *pointer; /* points to the buffer */
  565. } buffer;
  566. struct {
  567. acpi_object_type type; /* ACPI_TYPE_PACKAGE */
  568. u32 count; /* # of elements in package */
  569. union acpi_object *elements; /* Pointer to an array of ACPI_OBJECTs */
  570. } package;
  571. struct {
  572. acpi_object_type type; /* ACPI_TYPE_LOCAL_REFERENCE */
  573. acpi_object_type actual_type; /* Type associated with the Handle */
  574. acpi_handle handle; /* object reference */
  575. } reference;
  576. struct {
  577. acpi_object_type type; /* ACPI_TYPE_PROCESSOR */
  578. u32 proc_id;
  579. acpi_io_address pblk_address;
  580. u32 pblk_length;
  581. } processor;
  582. struct {
  583. acpi_object_type type; /* ACPI_TYPE_POWER */
  584. u32 system_level;
  585. u32 resource_order;
  586. } power_resource;
  587. };
  588. /*
  589. * List of objects, used as a parameter list for control method evaluation
  590. */
  591. struct acpi_object_list {
  592. u32 count;
  593. union acpi_object *pointer;
  594. };
  595. /*
  596. * Miscellaneous common Data Structures used by the interfaces
  597. */
  598. #define ACPI_NO_BUFFER 0
  599. #define ACPI_ALLOCATE_BUFFER (acpi_size) (-1)
  600. #define ACPI_ALLOCATE_LOCAL_BUFFER (acpi_size) (-2)
  601. struct acpi_buffer {
  602. acpi_size length; /* Length in bytes of the buffer */
  603. void *pointer; /* pointer to buffer */
  604. };
  605. /*
  606. * name_type for acpi_get_name
  607. */
  608. #define ACPI_FULL_PATHNAME 0
  609. #define ACPI_SINGLE_NAME 1
  610. #define ACPI_NAME_TYPE_MAX 1
  611. /*
  612. * Structure and flags for acpi_get_system_info
  613. */
  614. #define ACPI_SYS_MODE_UNKNOWN 0x0000
  615. #define ACPI_SYS_MODE_ACPI 0x0001
  616. #define ACPI_SYS_MODE_LEGACY 0x0002
  617. #define ACPI_SYS_MODES_MASK 0x0003
  618. /*
  619. * System info returned by acpi_get_system_info()
  620. */
  621. struct acpi_system_info {
  622. u32 acpi_ca_version;
  623. u32 flags;
  624. u32 timer_resolution;
  625. u32 reserved1;
  626. u32 reserved2;
  627. u32 debug_level;
  628. u32 debug_layer;
  629. };
  630. /* Table Event Types */
  631. #define ACPI_TABLE_EVENT_LOAD 0x0
  632. #define ACPI_TABLE_EVENT_UNLOAD 0x1
  633. #define ACPI_NUM_TABLE_EVENTS 2
  634. /*
  635. * Types specific to the OS service interfaces
  636. */
  637. typedef u32(ACPI_SYSTEM_XFACE * acpi_osd_handler) (void *context);
  638. typedef void
  639. (ACPI_SYSTEM_XFACE * acpi_osd_exec_callback) (void *context);
  640. /*
  641. * Various handlers and callback procedures
  642. */
  643. typedef u32(*acpi_event_handler) (void *context);
  644. typedef
  645. void (*acpi_notify_handler) (acpi_handle device, u32 value, void *context);
  646. typedef
  647. void (*acpi_object_handler) (acpi_handle object, u32 function, void *data);
  648. typedef acpi_status(*acpi_init_handler) (acpi_handle object, u32 function);
  649. #define ACPI_INIT_DEVICE_INI 1
  650. typedef
  651. acpi_status(*acpi_exception_handler) (acpi_status aml_status,
  652. acpi_name name,
  653. u16 opcode,
  654. u32 aml_offset, void *context);
  655. /* Table Event handler (Load, load_table etc) and types */
  656. typedef
  657. acpi_status(*acpi_tbl_handler) (u32 event, void *table, void *context);
  658. /* Address Spaces (For Operation Regions) */
  659. typedef
  660. acpi_status(*acpi_adr_space_handler) (u32 function,
  661. acpi_physical_address address,
  662. u32 bit_width,
  663. acpi_integer * value,
  664. void *handler_context,
  665. void *region_context);
  666. #define ACPI_DEFAULT_HANDLER NULL
  667. typedef
  668. acpi_status(*acpi_adr_space_setup) (acpi_handle region_handle,
  669. u32 function,
  670. void *handler_context,
  671. void **region_context);
  672. #define ACPI_REGION_ACTIVATE 0
  673. #define ACPI_REGION_DEACTIVATE 1
  674. typedef
  675. acpi_status(*acpi_walk_callback) (acpi_handle obj_handle,
  676. u32 nesting_level,
  677. void *context, void **return_value);
  678. /* Interrupt handler return values */
  679. #define ACPI_INTERRUPT_NOT_HANDLED 0x00
  680. #define ACPI_INTERRUPT_HANDLED 0x01
  681. /* Common string version of device HIDs and UIDs */
  682. struct acpica_device_id {
  683. char value[ACPI_DEVICE_ID_LENGTH];
  684. };
  685. /* Common string version of device CIDs */
  686. struct acpi_compatible_id {
  687. char value[ACPI_MAX_CID_LENGTH];
  688. };
  689. struct acpi_compatible_id_list {
  690. u32 count;
  691. u32 size;
  692. struct acpi_compatible_id id[1];
  693. };
  694. /* Structure and flags for acpi_get_object_info */
  695. #define ACPI_VALID_STA 0x0001
  696. #define ACPI_VALID_ADR 0x0002
  697. #define ACPI_VALID_HID 0x0004
  698. #define ACPI_VALID_UID 0x0008
  699. #define ACPI_VALID_CID 0x0010
  700. #define ACPI_VALID_SXDS 0x0020
  701. /* Flags for _STA method */
  702. #define ACPI_STA_DEVICE_PRESENT 0x01
  703. #define ACPI_STA_DEVICE_ENABLED 0x02
  704. #define ACPI_STA_DEVICE_UI 0x04
  705. #define ACPI_STA_DEVICE_FUNCTIONING 0x08
  706. #define ACPI_STA_DEVICE_OK 0x08 /* Synonym */
  707. #define ACPI_STA_BATTERY_PRESENT 0x10
  708. #define ACPI_COMMON_OBJ_INFO \
  709. acpi_object_type type; /* ACPI object type */ \
  710. acpi_name name /* ACPI object Name */
  711. struct acpi_obj_info_header {
  712. ACPI_COMMON_OBJ_INFO;
  713. };
  714. /* Structure returned from Get Object Info */
  715. struct acpi_device_info {
  716. ACPI_COMMON_OBJ_INFO;
  717. u32 param_count; /* If a method, required parameter count */
  718. u32 valid; /* Indicates which fields below are valid */
  719. u32 current_status; /* _STA value */
  720. acpi_integer address; /* _ADR value if any */
  721. struct acpica_device_id hardware_id; /* _HID value if any */
  722. struct acpica_device_id unique_id; /* _UID value if any */
  723. u8 highest_dstates[4]; /* _sx_d values: 0xFF indicates not valid */
  724. struct acpi_compatible_id_list compatibility_id; /* List of _CIDs if any */
  725. };
  726. /* Context structs for address space handlers */
  727. struct acpi_pci_id {
  728. u16 segment;
  729. u16 bus;
  730. u16 device;
  731. u16 function;
  732. };
  733. struct acpi_mem_space_context {
  734. u32 length;
  735. acpi_physical_address address;
  736. acpi_physical_address mapped_physical_address;
  737. u8 *mapped_logical_address;
  738. acpi_size mapped_length;
  739. };
  740. /*
  741. * Definitions for Resource Attributes
  742. */
  743. typedef u16 acpi_rs_length; /* Resource Length field is fixed at 16 bits */
  744. typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (Length+3) = (64_k-1)+3 */
  745. /*
  746. * Memory Attributes
  747. */
  748. #define ACPI_READ_ONLY_MEMORY (u8) 0x00
  749. #define ACPI_READ_WRITE_MEMORY (u8) 0x01
  750. #define ACPI_NON_CACHEABLE_MEMORY (u8) 0x00
  751. #define ACPI_CACHABLE_MEMORY (u8) 0x01
  752. #define ACPI_WRITE_COMBINING_MEMORY (u8) 0x02
  753. #define ACPI_PREFETCHABLE_MEMORY (u8) 0x03
  754. /*
  755. * IO Attributes
  756. * The ISA IO ranges are: n000-n0_fFh, n400-n4_fFh, n800-n8_fFh, n_c00-n_cFFh.
  757. * The non-ISA IO ranges are: n100-n3_fFh, n500-n7_fFh, n900-n_bFFh, n_cd0-n_fFFh.
  758. */
  759. #define ACPI_NON_ISA_ONLY_RANGES (u8) 0x01
  760. #define ACPI_ISA_ONLY_RANGES (u8) 0x02
  761. #define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES)
  762. /* Type of translation - 1=Sparse, 0=Dense */
  763. #define ACPI_SPARSE_TRANSLATION (u8) 0x01
  764. /*
  765. * IO Port Descriptor Decode
  766. */
  767. #define ACPI_DECODE_10 (u8) 0x00 /* 10-bit IO address decode */
  768. #define ACPI_DECODE_16 (u8) 0x01 /* 16-bit IO address decode */
  769. /*
  770. * IRQ Attributes
  771. */
  772. #define ACPI_LEVEL_SENSITIVE (u8) 0x00
  773. #define ACPI_EDGE_SENSITIVE (u8) 0x01
  774. #define ACPI_ACTIVE_HIGH (u8) 0x00
  775. #define ACPI_ACTIVE_LOW (u8) 0x01
  776. #define ACPI_EXCLUSIVE (u8) 0x00
  777. #define ACPI_SHARED (u8) 0x01
  778. /*
  779. * DMA Attributes
  780. */
  781. #define ACPI_COMPATIBILITY (u8) 0x00
  782. #define ACPI_TYPE_A (u8) 0x01
  783. #define ACPI_TYPE_B (u8) 0x02
  784. #define ACPI_TYPE_F (u8) 0x03
  785. #define ACPI_NOT_BUS_MASTER (u8) 0x00
  786. #define ACPI_BUS_MASTER (u8) 0x01
  787. #define ACPI_TRANSFER_8 (u8) 0x00
  788. #define ACPI_TRANSFER_8_16 (u8) 0x01
  789. #define ACPI_TRANSFER_16 (u8) 0x02
  790. /*
  791. * Start Dependent Functions Priority definitions
  792. */
  793. #define ACPI_GOOD_CONFIGURATION (u8) 0x00
  794. #define ACPI_ACCEPTABLE_CONFIGURATION (u8) 0x01
  795. #define ACPI_SUB_OPTIMAL_CONFIGURATION (u8) 0x02
  796. /*
  797. * 16, 32 and 64-bit Address Descriptor resource types
  798. */
  799. #define ACPI_MEMORY_RANGE (u8) 0x00
  800. #define ACPI_IO_RANGE (u8) 0x01
  801. #define ACPI_BUS_NUMBER_RANGE (u8) 0x02
  802. #define ACPI_ADDRESS_NOT_FIXED (u8) 0x00
  803. #define ACPI_ADDRESS_FIXED (u8) 0x01
  804. #define ACPI_POS_DECODE (u8) 0x00
  805. #define ACPI_SUB_DECODE (u8) 0x01
  806. #define ACPI_PRODUCER (u8) 0x00
  807. #define ACPI_CONSUMER (u8) 0x01
  808. /*
  809. * If possible, pack the following structures to byte alignment
  810. */
  811. #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
  812. #pragma pack(1)
  813. #endif
  814. /* UUID data structures for use in vendor-defined resource descriptors */
  815. struct acpi_uuid {
  816. u8 data[ACPI_UUID_LENGTH];
  817. };
  818. struct acpi_vendor_uuid {
  819. u8 subtype;
  820. u8 data[ACPI_UUID_LENGTH];
  821. };
  822. /*
  823. * Structures used to describe device resources
  824. */
  825. struct acpi_resource_irq {
  826. u8 descriptor_length;
  827. u8 triggering;
  828. u8 polarity;
  829. u8 sharable;
  830. u8 interrupt_count;
  831. u8 interrupts[1];
  832. };
  833. struct acpi_resource_dma {
  834. u8 type;
  835. u8 bus_master;
  836. u8 transfer;
  837. u8 channel_count;
  838. u8 channels[1];
  839. };
  840. struct acpi_resource_start_dependent {
  841. u8 descriptor_length;
  842. u8 compatibility_priority;
  843. u8 performance_robustness;
  844. };
  845. /*
  846. * END_DEPENDENT_FUNCTIONS_RESOURCE struct is not
  847. * needed because it has no fields
  848. */
  849. struct acpi_resource_io {
  850. u8 io_decode;
  851. u8 alignment;
  852. u8 address_length;
  853. u16 minimum;
  854. u16 maximum;
  855. };
  856. struct acpi_resource_fixed_io {
  857. u16 address;
  858. u8 address_length;
  859. };
  860. struct acpi_resource_vendor {
  861. u16 byte_length;
  862. u8 byte_data[1];
  863. };
  864. /* Vendor resource with UUID info (introduced in ACPI 3.0) */
  865. struct acpi_resource_vendor_typed {
  866. u16 byte_length;
  867. u8 uuid_subtype;
  868. u8 uuid[ACPI_UUID_LENGTH];
  869. u8 byte_data[1];
  870. };
  871. struct acpi_resource_end_tag {
  872. u8 checksum;
  873. };
  874. struct acpi_resource_memory24 {
  875. u8 write_protect;
  876. u16 minimum;
  877. u16 maximum;
  878. u16 alignment;
  879. u16 address_length;
  880. };
  881. struct acpi_resource_memory32 {
  882. u8 write_protect;
  883. u32 minimum;
  884. u32 maximum;
  885. u32 alignment;
  886. u32 address_length;
  887. };
  888. struct acpi_resource_fixed_memory32 {
  889. u8 write_protect;
  890. u32 address;
  891. u32 address_length;
  892. };
  893. struct acpi_memory_attribute {
  894. u8 write_protect;
  895. u8 caching;
  896. u8 range_type;
  897. u8 translation;
  898. };
  899. struct acpi_io_attribute {
  900. u8 range_type;
  901. u8 translation;
  902. u8 translation_type;
  903. u8 reserved1;
  904. };
  905. union acpi_resource_attribute {
  906. struct acpi_memory_attribute mem;
  907. struct acpi_io_attribute io;
  908. /* Used for the *word_space macros */
  909. u8 type_specific;
  910. };
  911. struct acpi_resource_source {
  912. u8 index;
  913. u16 string_length;
  914. char *string_ptr;
  915. };
  916. /* Fields common to all address descriptors, 16/32/64 bit */
  917. #define ACPI_RESOURCE_ADDRESS_COMMON \
  918. u8 resource_type; \
  919. u8 producer_consumer; \
  920. u8 decode; \
  921. u8 min_address_fixed; \
  922. u8 max_address_fixed; \
  923. union acpi_resource_attribute info;
  924. struct acpi_resource_address {
  925. ACPI_RESOURCE_ADDRESS_COMMON};
  926. struct acpi_resource_address16 {
  927. ACPI_RESOURCE_ADDRESS_COMMON u16 granularity;
  928. u16 minimum;
  929. u16 maximum;
  930. u16 translation_offset;
  931. u16 address_length;
  932. struct acpi_resource_source resource_source;
  933. };
  934. struct acpi_resource_address32 {
  935. ACPI_RESOURCE_ADDRESS_COMMON u32 granularity;
  936. u32 minimum;
  937. u32 maximum;
  938. u32 translation_offset;
  939. u32 address_length;
  940. struct acpi_resource_source resource_source;
  941. };
  942. struct acpi_resource_address64 {
  943. ACPI_RESOURCE_ADDRESS_COMMON u64 granularity;
  944. u64 minimum;
  945. u64 maximum;
  946. u64 translation_offset;
  947. u64 address_length;
  948. struct acpi_resource_source resource_source;
  949. };
  950. struct acpi_resource_extended_address64 {
  951. ACPI_RESOURCE_ADDRESS_COMMON u8 revision_iD;
  952. u64 granularity;
  953. u64 minimum;
  954. u64 maximum;
  955. u64 translation_offset;
  956. u64 address_length;
  957. u64 type_specific;
  958. };
  959. struct acpi_resource_extended_irq {
  960. u8 producer_consumer;
  961. u8 triggering;
  962. u8 polarity;
  963. u8 sharable;
  964. u8 interrupt_count;
  965. struct acpi_resource_source resource_source;
  966. u32 interrupts[1];
  967. };
  968. struct acpi_resource_generic_register {
  969. u8 space_id;
  970. u8 bit_width;
  971. u8 bit_offset;
  972. u8 access_size;
  973. u64 address;
  974. };
  975. /* ACPI_RESOURCE_TYPEs */
  976. #define ACPI_RESOURCE_TYPE_IRQ 0
  977. #define ACPI_RESOURCE_TYPE_DMA 1
  978. #define ACPI_RESOURCE_TYPE_START_DEPENDENT 2
  979. #define ACPI_RESOURCE_TYPE_END_DEPENDENT 3
  980. #define ACPI_RESOURCE_TYPE_IO 4
  981. #define ACPI_RESOURCE_TYPE_FIXED_IO 5
  982. #define ACPI_RESOURCE_TYPE_VENDOR 6
  983. #define ACPI_RESOURCE_TYPE_END_TAG 7
  984. #define ACPI_RESOURCE_TYPE_MEMORY24 8
  985. #define ACPI_RESOURCE_TYPE_MEMORY32 9
  986. #define ACPI_RESOURCE_TYPE_FIXED_MEMORY32 10
  987. #define ACPI_RESOURCE_TYPE_ADDRESS16 11
  988. #define ACPI_RESOURCE_TYPE_ADDRESS32 12
  989. #define ACPI_RESOURCE_TYPE_ADDRESS64 13
  990. #define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */
  991. #define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15
  992. #define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16
  993. #define ACPI_RESOURCE_TYPE_MAX 16
  994. union acpi_resource_data {
  995. struct acpi_resource_irq irq;
  996. struct acpi_resource_dma dma;
  997. struct acpi_resource_start_dependent start_dpf;
  998. struct acpi_resource_io io;
  999. struct acpi_resource_fixed_io fixed_io;
  1000. struct acpi_resource_vendor vendor;
  1001. struct acpi_resource_vendor_typed vendor_typed;
  1002. struct acpi_resource_end_tag end_tag;
  1003. struct acpi_resource_memory24 memory24;
  1004. struct acpi_resource_memory32 memory32;
  1005. struct acpi_resource_fixed_memory32 fixed_memory32;
  1006. struct acpi_resource_address16 address16;
  1007. struct acpi_resource_address32 address32;
  1008. struct acpi_resource_address64 address64;
  1009. struct acpi_resource_extended_address64 ext_address64;
  1010. struct acpi_resource_extended_irq extended_irq;
  1011. struct acpi_resource_generic_register generic_reg;
  1012. /* Common fields */
  1013. struct acpi_resource_address address; /* Common 16/32/64 address fields */
  1014. };
  1015. struct acpi_resource {
  1016. u32 type;
  1017. u32 length;
  1018. union acpi_resource_data data;
  1019. };
  1020. /* restore default alignment */
  1021. #pragma pack()
  1022. #define ACPI_RS_SIZE_NO_DATA 8 /* Id + Length fields */
  1023. #define ACPI_RS_SIZE_MIN (u32) ACPI_ROUND_UP_TO_NATIVE_WORD (12)
  1024. #define ACPI_RS_SIZE(type) (u32) (ACPI_RS_SIZE_NO_DATA + sizeof (type))
  1025. #define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length)
  1026. struct acpi_pci_routing_table {
  1027. u32 length;
  1028. u32 pin;
  1029. acpi_integer address; /* here for 64-bit alignment */
  1030. u32 source_index;
  1031. char source[4]; /* pad to 64 bits so sizeof() works in all cases */
  1032. };
  1033. #endif /* __ACTYPES_H__ */