actypes.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:33k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /******************************************************************************
  2.  *
  3.  * Name: actypes.h - Common data types for the entire ACPI subsystem
  4.  *       $Revision: 193 $
  5.  *
  6.  *****************************************************************************/
  7. /*
  8.  *  Copyright (C) 2000, 2001 R. Byron Moore
  9.  *
  10.  *  This program is free software; you can redistribute it and/or modify
  11.  *  it under the terms of the GNU General Public License as published by
  12.  *  the Free Software Foundation; either version 2 of the License, or
  13.  *  (at your option) any later version.
  14.  *
  15.  *  This program is distributed in the hope that it will be useful,
  16.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18.  *  GNU General Public License for more details.
  19.  *
  20.  *  You should have received a copy of the GNU General Public License
  21.  *  along with this program; if not, write to the Free Software
  22.  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  23.  */
  24. #ifndef __ACTYPES_H__
  25. #define __ACTYPES_H__
  26. /*! [Begin] no source code translation (keep the typedefs) */
  27. /*
  28.  * Data types - Fixed across all compilation models
  29.  *
  30.  * BOOLEAN      Logical Boolean.
  31.  *              1 byte value containing a 0 for FALSE or a 1 for TRUE.
  32.  *              Other values are undefined.
  33.  *
  34.  * INT8         8-bit  (1 byte) signed value
  35.  * UINT8        8-bit  (1 byte) unsigned value
  36.  * INT16        16-bit (2 byte) signed value
  37.  * UINT16       16-bit (2 byte) unsigned value
  38.  * INT32        32-bit (4 byte) signed value
  39.  * UINT32       32-bit (4 byte) unsigned value
  40.  * INT64        64-bit (8 byte) signed value
  41.  * UINT64       64-bit (8 byte) unsigned value
  42.  * NATIVE_INT   32-bit on IA-32, 64-bit on IA-64 signed value
  43.  * NATIVE_UINT  32-bit on IA-32, 64-bit on IA-64 unsigned value
  44.  * UCHAR        Character. 1 byte unsigned value.
  45.  */
  46. #ifndef BITS_PER_LONG
  47. #error "define BITS_PER_LONG"
  48. #endif
  49. #if BITS_PER_LONG == 64
  50. /*
  51.  * 64-bit type definitions
  52.  */
  53. typedef unsigned char                   UINT8;
  54. typedef unsigned char                   BOOLEAN;
  55. typedef unsigned char                   UCHAR;
  56. typedef unsigned short                  UINT16;
  57. typedef int                             INT32;
  58. typedef unsigned int                    UINT32;
  59. typedef COMPILER_DEPENDENT_UINT64       UINT64;
  60. typedef UINT64                          NATIVE_UINT;
  61. typedef long long                          NATIVE_INT;
  62. typedef NATIVE_UINT                     ACPI_TBLPTR;
  63. typedef UINT64                          ACPI_IO_ADDRESS;
  64. typedef UINT64                          ACPI_PHYSICAL_ADDRESS;
  65. #define ALIGNED_ADDRESS_BOUNDARY        0x00000008      /* No hardware alignment support in IA64 */
  66. #define ACPI_USE_NATIVE_DIVIDE                          /* Native 64-bit integer support */
  67. #elif BITS_PER_LONG == 16
  68. /*
  69.  * 16-bit type definitions
  70.  */
  71. typedef unsigned char                   UINT8;
  72. typedef unsigned char                   BOOLEAN;
  73. typedef unsigned char                   UCHAR;
  74. typedef unsigned int                    UINT16;
  75. typedef long                            INT32;
  76. typedef int                             INT16;
  77. typedef unsigned long                   UINT32;
  78. typedef struct
  79. {
  80. UINT32                                  Lo;
  81. UINT32                                  Hi;
  82. } UINT64;
  83. typedef UINT16                          NATIVE_UINT;
  84. typedef INT16                           NATIVE_INT;
  85. typedef UINT32                          ACPI_TBLPTR;
  86. typedef UINT32                          ACPI_IO_ADDRESS;
  87. typedef char                            *ACPI_PHYSICAL_ADDRESS;
  88. #define ALIGNED_ADDRESS_BOUNDARY        0x00000002
  89. #define _HW_ALIGNMENT_SUPPORT
  90. #define ACPI_USE_NATIVE_DIVIDE                          /* No 64-bit integers, ok to use native divide */
  91. /*
  92.  * (16-bit only) internal integers must be 32-bits, so
  93.  * 64-bit integers cannot be supported
  94.  */
  95. #define ACPI_NO_INTEGER64_SUPPORT
  96. #elif BITS_PER_LONG == 32
  97. /*
  98.  * 32-bit type definitions (default)
  99.  */
  100. typedef unsigned char                   UINT8;
  101. typedef unsigned char                   BOOLEAN;
  102. typedef unsigned char                   UCHAR;
  103. typedef unsigned short                  UINT16;
  104. typedef int                             INT32;
  105. typedef unsigned int                    UINT32;
  106. typedef COMPILER_DEPENDENT_UINT64       UINT64;
  107. typedef UINT32                          NATIVE_UINT;
  108. typedef INT32                           NATIVE_INT;
  109. typedef NATIVE_UINT                     ACPI_TBLPTR;
  110. typedef UINT32                          ACPI_IO_ADDRESS;
  111. typedef UINT64                          ACPI_PHYSICAL_ADDRESS;
  112. #define ALIGNED_ADDRESS_BOUNDARY        0x00000004
  113. #define _HW_ALIGNMENT_SUPPORT
  114. #else
  115. #error "unknown BITS_PER_LONG"
  116. #endif
  117. /*
  118.  * Miscellaneous common types
  119.  */
  120. typedef UINT32                          UINT32_BIT;
  121. typedef NATIVE_UINT                     ACPI_PTRDIFF;
  122. typedef char                            NATIVE_CHAR;
  123. /*
  124.  * Data type ranges
  125.  */
  126. #define ACPI_UINT8_MAX                  (UINT8)  0xFF
  127. #define ACPI_UINT16_MAX                 (UINT16) 0xFFFF
  128. #define ACPI_UINT32_MAX                 (UINT32) 0xFFFFFFFF
  129. #define ACPI_UINT64_MAX                 (UINT64) 0xFFFFFFFFFFFFFFFF
  130. #ifdef DEFINE_ALTERNATE_TYPES
  131. /*
  132.  * Types used only in translated source
  133.  */
  134. typedef INT32                           s32;
  135. typedef UINT8                           u8;
  136. typedef UINT16                          u16;
  137. typedef UINT32                          u32;
  138. typedef UINT64                          u64;
  139. #endif
  140. /*! [End] no source code translation !*/
  141. /*
  142.  * Useful defines
  143.  */
  144. #ifdef FALSE
  145. #undef FALSE
  146. #endif
  147. #define FALSE                           (1 == 0)
  148. #ifdef TRUE
  149. #undef TRUE
  150. #endif
  151. #define TRUE                            (1 == 1)
  152. #ifndef NULL
  153. #define NULL                            (void *) 0
  154. #endif
  155. /*
  156.  * Local datatypes
  157.  */
  158. typedef u32                             acpi_status;    /* All ACPI Exceptions */
  159. typedef u32                             acpi_name;      /* 4-byte ACPI name */
  160. typedef char*                           acpi_string;    /* Null terminated ASCII string */
  161. typedef void*                           acpi_handle;    /* Actually a ptr to an Node */
  162. typedef struct
  163. {
  164. u32                         lo;
  165. u32                         hi;
  166. } uint64_struct;
  167. typedef union
  168. {
  169. u64                         full;
  170. uint64_struct               part;
  171. } uint64_overlay;
  172. /*
  173.  * Acpi integer width. In ACPI version 1, integers are
  174.  * 32 bits.  In ACPI version 2, integers are 64 bits.
  175.  * Note that this pertains to the ACPI integer type only, not
  176.  * other integers used in the implementation of the ACPI CA
  177.  * subsystem.
  178.  */
  179. #ifdef ACPI_NO_INTEGER64_SUPPORT
  180. /* 32-bit integers only, no 64-bit support */
  181. typedef u32                             acpi_integer;
  182. #define ACPI_INTEGER_MAX                ACPI_UINT32_MAX
  183. #define ACPI_INTEGER_BIT_SIZE           32
  184. #define ACPI_MAX_BCD_VALUE              99999999
  185. #define ACPI_MAX_BCD_DIGITS             8
  186. #define ACPI_MAX_DECIMAL_DIGITS         10
  187. #define ACPI_USE_NATIVE_DIVIDE          /* Use compiler native 32-bit divide */
  188. #else
  189. /* 64-bit integers */
  190. typedef u64                             acpi_integer;
  191. #define ACPI_INTEGER_MAX                ACPI_UINT64_MAX
  192. #define ACPI_INTEGER_BIT_SIZE           64
  193. #define ACPI_MAX_BCD_VALUE              9999999999999999
  194. #define ACPI_MAX_BCD_DIGITS             16
  195. #define ACPI_MAX_DECIMAL_DIGITS         19
  196. #ifdef _IA64
  197. #define ACPI_USE_NATIVE_DIVIDE          /* Use compiler native 64-bit divide */
  198. #endif
  199. #endif
  200. /*
  201.  * Constants with special meanings
  202.  */
  203. #define ACPI_ROOT_OBJECT                (acpi_handle)(-1)
  204. /*
  205.  * Initialization sequence
  206.  */
  207. #define ACPI_FULL_INITIALIZATION        0x00
  208. #define ACPI_NO_ADDRESS_SPACE_INIT      0x01
  209. #define ACPI_NO_HARDWARE_INIT           0x02
  210. #define ACPI_NO_EVENT_INIT              0x04
  211. #define ACPI_NO_ACPI_ENABLE             0x08
  212. #define ACPI_NO_DEVICE_INIT             0x10
  213. #define ACPI_NO_OBJECT_INIT             0x20
  214. /*
  215.  * Initialization state
  216.  */
  217. #define ACPI_INITIALIZED_OK             0x01
  218. /*
  219.  * Power state values
  220.  */
  221. #define ACPI_STATE_UNKNOWN              (u8) 0xFF
  222. #define ACPI_STATE_S0                   (u8) 0
  223. #define ACPI_STATE_S1                   (u8) 1
  224. #define ACPI_STATE_S2                   (u8) 2
  225. #define ACPI_STATE_S3                   (u8) 3
  226. #define ACPI_STATE_S4                   (u8) 4
  227. #define ACPI_STATE_S5                   (u8) 5
  228. #define ACPI_S_STATES_MAX               ACPI_STATE_S5
  229. #define ACPI_S_STATE_COUNT              6
  230. #define ACPI_STATE_D0                   (u8) 0
  231. #define ACPI_STATE_D1                   (u8) 1
  232. #define ACPI_STATE_D2                   (u8) 2
  233. #define ACPI_STATE_D3                   (u8) 3
  234. #define ACPI_D_STATES_MAX               ACPI_STATE_D3
  235. #define ACPI_D_STATE_COUNT              4
  236. /*
  237.  * Standard notify values
  238.  */
  239. #define ACPI_NOTIFY_BUS_CHECK           (u8) 0
  240. #define ACPI_NOTIFY_DEVICE_CHECK        (u8) 1
  241. #define ACPI_NOTIFY_DEVICE_WAKE         (u8) 2
  242. #define ACPI_NOTIFY_EJECT_REQUEST       (u8) 3
  243. #define ACPI_NOTIFY_DEVICE_CHECK_LIGHT  (u8) 4
  244. #define ACPI_NOTIFY_FREQUENCY_MISMATCH  (u8) 5
  245. #define ACPI_NOTIFY_BUS_MODE_MISMATCH   (u8) 6
  246. #define ACPI_NOTIFY_POWER_FAULT         (u8) 7
  247. /*
  248.  *  Table types.  These values are passed to the table related APIs
  249.  */
  250. typedef u32                             acpi_table_type;
  251. #define ACPI_TABLE_RSDP                 (acpi_table_type) 0
  252. #define ACPI_TABLE_DSDT                 (acpi_table_type) 1
  253. #define ACPI_TABLE_FADT                 (acpi_table_type) 2
  254. #define ACPI_TABLE_FACS                 (acpi_table_type) 3
  255. #define ACPI_TABLE_PSDT                 (acpi_table_type) 4
  256. #define ACPI_TABLE_SSDT                 (acpi_table_type) 5
  257. #define ACPI_TABLE_XSDT                 (acpi_table_type) 6
  258. #define ACPI_TABLE_MAX                  6
  259. #define NUM_ACPI_TABLES                 (ACPI_TABLE_MAX+1)
  260. /*
  261.  * Types associated with names.  The first group of
  262.  * values correspond to the definition of the ACPI
  263.  * Object_type operator (See the ACPI Spec). Therefore,
  264.  * only add to the first group if the spec changes!
  265.  *
  266.  * Types must be kept in sync with the Acpi_ns_properties
  267.  * and Acpi_ns_type_names arrays
  268.  */
  269. typedef u32                             acpi_object_type;
  270. typedef u8                              acpi_object_type8;
  271. #define ACPI_TYPE_ANY                   0  /* 0x00  */
  272. #define ACPI_TYPE_INTEGER               1  /* 0x01  Byte/Word/Dword/Zero/One/Ones */
  273. #define ACPI_TYPE_STRING                2  /* 0x02  */
  274. #define ACPI_TYPE_BUFFER                3  /* 0x03  */
  275. #define ACPI_TYPE_PACKAGE               4  /* 0x04  Byte_const, multiple Data_term/Constant/Super_name */
  276. #define ACPI_TYPE_FIELD_UNIT            5  /* 0x05  */
  277. #define ACPI_TYPE_DEVICE                6  /* 0x06  Name, multiple Node */
  278. #define ACPI_TYPE_EVENT                 7  /* 0x07  */
  279. #define ACPI_TYPE_METHOD                8  /* 0x08  Name, Byte_const, multiple Code */
  280. #define ACPI_TYPE_MUTEX                 9  /* 0x09  */
  281. #define ACPI_TYPE_REGION                10 /* 0x0A  */
  282. #define ACPI_TYPE_POWER                 11 /* 0x0B  Name,Byte_const,Word_const,multi Node */
  283. #define ACPI_TYPE_PROCESSOR             12 /* 0x0C  Name,Byte_const,DWord_const,Byte_const,multi Nm_o */
  284. #define ACPI_TYPE_THERMAL               13 /* 0x0D  Name, multiple Node */
  285. #define ACPI_TYPE_BUFFER_FIELD          14 /* 0x0E  */
  286. #define ACPI_TYPE_DDB_HANDLE            15 /* 0x0F  */
  287. #define ACPI_TYPE_DEBUG_OBJECT          16 /* 0x10  */
  288. #define ACPI_TYPE_MAX                   16
  289. /*
  290.  * This section contains object types that do not relate to the ACPI Object_type operator.
  291.  * They are used for various internal purposes only.  If new predefined ACPI_TYPEs are
  292.  * added (via the ACPI specification), these internal types must move upwards.
  293.  * Also, values exceeding the largest official ACPI Object_type must not overlap with
  294.  * defined AML opcodes.
  295.  */
  296. #define INTERNAL_TYPE_BEGIN             17
  297. #define INTERNAL_TYPE_REGION_FIELD      17 /* 0x11  */
  298. #define INTERNAL_TYPE_BANK_FIELD        18 /* 0x12  */
  299. #define INTERNAL_TYPE_INDEX_FIELD       19 /* 0x13  */
  300. #define INTERNAL_TYPE_REFERENCE         20 /* 0x14  Arg#, Local#, Name, Debug; used only in descriptors */
  301. #define INTERNAL_TYPE_ALIAS             21 /* 0x15  */
  302. #define INTERNAL_TYPE_NOTIFY            22 /* 0x16  */
  303. #define INTERNAL_TYPE_ADDRESS_HANDLER   23 /* 0x17  */
  304. #define INTERNAL_TYPE_RESOURCE          24 /* 0x18  */
  305. #define INTERNAL_TYPE_RESOURCE_FIELD    25 /* 0x19  */
  306. #define INTERNAL_TYPE_NODE_MAX          25
  307. /* These are pseudo-types because there are never any namespace nodes with these types */
  308. #define INTERNAL_TYPE_FIELD_DEFN        26 /* 0x1A  Name, Byte_const, multiple Field_element */
  309. #define INTERNAL_TYPE_BANK_FIELD_DEFN   27 /* 0x1B  2 Name,DWord_const,Byte_const,multi Field_element */
  310. #define INTERNAL_TYPE_INDEX_FIELD_DEFN  28 /* 0x1C  2 Name, Byte_const, multiple Field_element */
  311. #define INTERNAL_TYPE_IF                29 /* 0x1D  */
  312. #define INTERNAL_TYPE_ELSE              30 /* 0x1E  */
  313. #define INTERNAL_TYPE_WHILE             31 /* 0x1F  */
  314. #define INTERNAL_TYPE_SCOPE             32 /* 0x20  Name, multiple Node */
  315. #define INTERNAL_TYPE_DEF_ANY           33 /* 0x21  type is Any, suppress search of enclosing scopes */
  316. #define INTERNAL_TYPE_EXTRA             34 /* 0x22  */
  317. #define INTERNAL_TYPE_MAX               34
  318. #define INTERNAL_TYPE_INVALID           35
  319. #define ACPI_TYPE_NOT_FOUND             0xFF
  320. /*
  321.  * Bitmapped ACPI types
  322.  * Used internally only
  323.  */
  324. #define ACPI_BTYPE_ANY                  0x00000000
  325. #define ACPI_BTYPE_INTEGER              0x00000001
  326. #define ACPI_BTYPE_STRING               0x00000002
  327. #define ACPI_BTYPE_BUFFER               0x00000004
  328. #define ACPI_BTYPE_PACKAGE              0x00000008
  329. #define ACPI_BTYPE_FIELD_UNIT           0x00000010
  330. #define ACPI_BTYPE_DEVICE               0x00000020
  331. #define ACPI_BTYPE_EVENT                0x00000040
  332. #define ACPI_BTYPE_METHOD               0x00000080
  333. #define ACPI_BTYPE_MUTEX                0x00000100
  334. #define ACPI_BTYPE_REGION               0x00000200
  335. #define ACPI_BTYPE_POWER                0x00000400
  336. #define ACPI_BTYPE_PROCESSOR            0x00000800
  337. #define ACPI_BTYPE_THERMAL              0x00001000
  338. #define ACPI_BTYPE_BUFFER_FIELD         0x00002000
  339. #define ACPI_BTYPE_DDB_HANDLE           0x00004000
  340. #define ACPI_BTYPE_DEBUG_OBJECT         0x00008000
  341. #define ACPI_BTYPE_REFERENCE            0x00010000
  342. #define ACPI_BTYPE_RESOURCE             0x00020000
  343. #define ACPI_BTYPE_COMPUTE_DATA         (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
  344. #define ACPI_BTYPE_DATA                 (ACPI_BTYPE_COMPUTE_DATA  | ACPI_BTYPE_PACKAGE)
  345. #define ACPI_BTYPE_DATA_REFERENCE       (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
  346. #define ACPI_BTYPE_DEVICE_OBJECTS       (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
  347. #define ACPI_BTYPE_OBJECTS_AND_REFS     0x0001FFFF  /* ARG or LOCAL */
  348. #define ACPI_BTYPE_ALL_OBJECTS          0x0000FFFF
  349. /*
  350.  * Acpi_event Types:
  351.  * ------------
  352.  * Fixed & general purpose...
  353.  */
  354. typedef u32                             acpi_event_type;
  355. #define ACPI_EVENT_FIXED                (acpi_event_type) 0
  356. #define ACPI_EVENT_GPE                  (acpi_event_type) 1
  357. /*
  358.  * Fixed events
  359.  */
  360. #define ACPI_EVENT_PMTIMER              (acpi_event_type) 0
  361. /*
  362.  * There's no bus master event so index 1 is used for IRQ's that are not
  363.  * handled by the SCI handler
  364.  */
  365. #define ACPI_EVENT_NOT_USED             (acpi_event_type) 1
  366. #define ACPI_EVENT_GLOBAL               (acpi_event_type) 2
  367. #define ACPI_EVENT_POWER_BUTTON         (acpi_event_type) 3
  368. #define ACPI_EVENT_SLEEP_BUTTON         (acpi_event_type) 4
  369. #define ACPI_EVENT_RTC                  (acpi_event_type) 5
  370. #define ACPI_EVENT_GENERAL              (acpi_event_type) 6
  371. #define ACPI_EVENT_MAX                  6
  372. #define ACPI_NUM_FIXED_EVENTS           (acpi_event_type) 7
  373. #define ACPI_GPE_INVALID                0xFF
  374. #define ACPI_GPE_MAX                    0xFF
  375. #define ACPI_NUM_GPE                    256
  376. #define ACPI_EVENT_LEVEL_TRIGGERED      (acpi_event_type) 1
  377. #define ACPI_EVENT_EDGE_TRIGGERED       (acpi_event_type) 2
  378. /*
  379.  * GPEs
  380.  */
  381. #define ACPI_EVENT_ENABLE               0x1
  382. #define ACPI_EVENT_WAKE_ENABLE         0x2
  383. #define ACPI_EVENT_DISABLE              0x1
  384. #define ACPI_EVENT_WAKE_DISABLE         0x2
  385. /*
  386.  * Acpi_event Status:
  387.  * -------------
  388.  * The encoding of acpi_event_status is illustrated below.
  389.  * Note that a set bit (1) indicates the property is TRUE
  390.  * (e.g. if bit 0 is set then the event is enabled).
  391.  * +-------------+-+-+-+
  392.  * |   Bits 31:3 |2|1|0|
  393.  * +-------------+-+-+-+
  394.  *          |     | | |
  395.  *          |     | | +- Enabled?
  396.  *          |     | +--- Enabled for wake?
  397.  *          |     +----- Set?
  398.  *          +----------- <Reserved>
  399.  */
  400. typedef u32                             acpi_event_status;
  401. #define ACPI_EVENT_FLAG_DISABLED        (acpi_event_status) 0x00
  402. #define ACPI_EVENT_FLAG_ENABLED         (acpi_event_status) 0x01
  403. #define ACPI_EVENT_FLAG_WAKE_ENABLED    (acpi_event_status) 0x02
  404. #define ACPI_EVENT_FLAG_SET             (acpi_event_status) 0x04
  405. /* Notify types */
  406. #define ACPI_SYSTEM_NOTIFY              0
  407. #define ACPI_DEVICE_NOTIFY              1
  408. #define ACPI_MAX_NOTIFY_HANDLER_TYPE    1
  409. #define MAX_SYS_NOTIFY                  0x7f
  410. /* Address Space (Operation Region) Types */
  411. typedef u8                              ACPI_ADR_SPACE_TYPE;
  412. #define ACPI_ADR_SPACE_SYSTEM_MEMORY    (ACPI_ADR_SPACE_TYPE) 0
  413. #define ACPI_ADR_SPACE_SYSTEM_IO        (ACPI_ADR_SPACE_TYPE) 1
  414. #define ACPI_ADR_SPACE_PCI_CONFIG       (ACPI_ADR_SPACE_TYPE) 2
  415. #define ACPI_ADR_SPACE_EC               (ACPI_ADR_SPACE_TYPE) 3
  416. #define ACPI_ADR_SPACE_SMBUS            (ACPI_ADR_SPACE_TYPE) 4
  417. #define ACPI_ADR_SPACE_CMOS             (ACPI_ADR_SPACE_TYPE) 5
  418. #define ACPI_ADR_SPACE_PCI_BAR_TARGET   (ACPI_ADR_SPACE_TYPE) 6
  419. /*
  420.  * External ACPI object definition
  421.  */
  422. typedef union acpi_obj
  423. {
  424. acpi_object_type            type;   /* See definition of Acpi_ns_type for values */
  425. struct
  426. {
  427. acpi_object_type            type;
  428. acpi_integer                value;      /* The actual number */
  429. } integer;
  430. struct
  431. {
  432. acpi_object_type            type;
  433. u32                         length;     /* # of bytes in string, excluding trailing null */
  434. NATIVE_CHAR                 *pointer;   /* points to the string value */
  435. } string;
  436. struct
  437. {
  438. acpi_object_type            type;
  439. u32                         length;     /* # of bytes in buffer */
  440. u8                          *pointer;   /* points to the buffer */
  441. } buffer;
  442. struct
  443. {
  444. acpi_object_type            type;
  445. u32                         fill1;
  446. acpi_handle                 handle;     /* object reference */
  447. } reference;
  448. struct
  449. {
  450. acpi_object_type            type;
  451. u32                         count;      /* # of elements in package */
  452. union acpi_obj              *elements;  /* Pointer to an array of ACPI_OBJECTs */
  453. } package;
  454. struct
  455. {
  456. acpi_object_type            type;
  457. u32                         proc_id;
  458. ACPI_IO_ADDRESS             pblk_address;
  459. u32                         pblk_length;
  460. } processor;
  461. struct
  462. {
  463. acpi_object_type            type;
  464. u32                         system_level;
  465. u32                         resource_order;
  466. } power_resource;
  467. } acpi_object, *PACPI_OBJECT;
  468. /*
  469.  * List of objects, used as a parameter list for control method evaluation
  470.  */
  471. typedef struct acpi_obj_list
  472. {
  473. u32                         count;
  474. acpi_object                 *pointer;
  475. } acpi_object_list, *PACPI_OBJECT_LIST;
  476. /*
  477.  * Miscellaneous common Data Structures used by the interfaces
  478.  */
  479. typedef struct
  480. {
  481. u32                         length;         /* Length in bytes of the buffer */
  482. void                        *pointer;       /* pointer to buffer */
  483. } acpi_buffer;
  484. /*
  485.  * Name_type for Acpi_get_name
  486.  */
  487. #define ACPI_FULL_PATHNAME              0
  488. #define ACPI_SINGLE_NAME                1
  489. #define ACPI_NAME_TYPE_MAX              1
  490. /*
  491.  * Structure and flags for Acpi_get_system_info
  492.  */
  493. #define SYS_MODE_UNKNOWN                0x0000
  494. #define SYS_MODE_ACPI                   0x0001
  495. #define SYS_MODE_LEGACY                 0x0002
  496. #define SYS_MODES_MASK                  0x0003
  497. /*
  498.  * ACPI Table Info.  One per ACPI table _type_
  499.  */
  500. typedef struct acpi_table_info
  501. {
  502. u32                         count;
  503. } acpi_table_info;
  504. /*
  505.  * System info returned by Acpi_get_system_info()
  506.  */
  507. typedef struct _acpi_sys_info
  508. {
  509. u32                         acpi_ca_version;
  510. u32                         flags;
  511. u32                         timer_resolution;
  512. u32                         reserved1;
  513. u32                         reserved2;
  514. u32                         debug_level;
  515. u32                         debug_layer;
  516. u32                         num_table_types;
  517. acpi_table_info             table_info [NUM_ACPI_TABLES];
  518. } acpi_system_info;
  519. /*
  520.  * Various handlers and callback procedures
  521.  */
  522. typedef
  523. u32 (*acpi_event_handler) (
  524. void                        *context);
  525. typedef
  526. void (*acpi_gpe_handler) (
  527. void                        *context);
  528. typedef
  529. void (*acpi_notify_handler) (
  530. acpi_handle                 device,
  531. u32                         value,
  532. void                        *context);
  533. /* Address Spaces (Operation Regions */
  534. #define ACPI_READ_ADR_SPACE     1
  535. #define ACPI_WRITE_ADR_SPACE    2
  536. typedef
  537. acpi_status (*acpi_adr_space_handler) (
  538. u32                         function,
  539. ACPI_PHYSICAL_ADDRESS       address,
  540. u32                         bit_width,
  541. u32                         *value,
  542. void                        *handler_context,
  543. void                        *region_context);
  544. #define ACPI_DEFAULT_HANDLER            ((acpi_adr_space_handler) NULL)
  545. typedef
  546. acpi_status (*acpi_adr_space_setup) (
  547. acpi_handle                 region_handle,
  548. u32                         function,
  549. void                        *handler_context,
  550. void                        **region_context);
  551. #define ACPI_REGION_ACTIVATE    0
  552. #define ACPI_REGION_DEACTIVATE  1
  553. typedef
  554. acpi_status (*acpi_walk_callback) (
  555. acpi_handle                 obj_handle,
  556. u32                         nesting_level,
  557. void                        *context,
  558. void                        **return_value);
  559. /* Interrupt handler return values */
  560. #define INTERRUPT_NOT_HANDLED           0x00
  561. #define INTERRUPT_HANDLED               0x01
  562. /* Structure and flags for Acpi_get_device_info */
  563. #define ACPI_VALID_HID                  0x1
  564. #define ACPI_VALID_UID                  0x2
  565. #define ACPI_VALID_ADR                  0x4
  566. #define ACPI_VALID_STA                  0x8
  567. #define ACPI_COMMON_OBJ_INFO 
  568. acpi_object_type            type;           /* ACPI object type */ 
  569. acpi_name                   name            /* ACPI object Name */
  570. typedef struct
  571. {
  572. ACPI_COMMON_OBJ_INFO;
  573. } acpi_obj_info_header;
  574. typedef struct
  575. {
  576. ACPI_COMMON_OBJ_INFO;
  577. u32                         valid;              /*  Are the next bits legit? */
  578. NATIVE_CHAR                 hardware_id[9];     /*  _HID value if any */
  579. NATIVE_CHAR                 unique_id[9];       /*  _UID value if any */
  580. acpi_integer                address;            /*  _ADR value if any */
  581. u32                         current_status;     /*  _STA value */
  582. } acpi_device_info;
  583. /* Context structs for address space handlers */
  584. typedef struct
  585. {
  586. u16                         segment;
  587. u16                         bus;
  588. u16                         device;
  589. u16                         function;
  590. } acpi_pci_id;
  591. typedef struct
  592. {
  593. ACPI_PHYSICAL_ADDRESS       mapped_physical_address;
  594. u8                          *mapped_logical_address;
  595. u32                         mapped_length;
  596. } acpi_mem_space_context;
  597. /* Sleep states */
  598. #define ACPI_NUM_SLEEP_STATES           7
  599. /*
  600.  * Definitions for Resource Attributes
  601.  */
  602. /*
  603.  *  Memory Attributes
  604.  */
  605. #define READ_ONLY_MEMORY                (u8) 0x00
  606. #define READ_WRITE_MEMORY               (u8) 0x01
  607. #define NON_CACHEABLE_MEMORY            (u8) 0x00
  608. #define CACHABLE_MEMORY                 (u8) 0x01
  609. #define WRITE_COMBINING_MEMORY          (u8) 0x02
  610. #define PREFETCHABLE_MEMORY             (u8) 0x03
  611. /*
  612.  *  IO Attributes
  613.  *  The ISA IO ranges are:     n000-n0FFh,  n400-n4_fFh, n800-n8_fFh, n_c00-n_cFFh.
  614.  *  The non-ISA IO ranges are: n100-n3_fFh, n500-n7_fFh, n900-n_bFFh, n_cD0-n_fFFh.
  615.  */
  616. #define NON_ISA_ONLY_RANGES             (u8) 0x01
  617. #define ISA_ONLY_RANGES                 (u8) 0x02
  618. #define ENTIRE_RANGE                    (NON_ISA_ONLY_RANGES | ISA_ONLY_RANGES)
  619. /*
  620.  *  IO Port Descriptor Decode
  621.  */
  622. #define DECODE_10                       (u8) 0x00    /* 10-bit IO address decode */
  623. #define DECODE_16                       (u8) 0x01    /* 16-bit IO address decode */
  624. /*
  625.  *  IRQ Attributes
  626.  */
  627. #define EDGE_SENSITIVE                  (u8) 0x00
  628. #define LEVEL_SENSITIVE                 (u8) 0x01
  629. #define ACTIVE_HIGH                     (u8) 0x00
  630. #define ACTIVE_LOW                      (u8) 0x01
  631. #define EXCLUSIVE                       (u8) 0x00
  632. #define SHARED                          (u8) 0x01
  633. /*
  634.  *  DMA Attributes
  635.  */
  636. #define COMPATIBILITY                   (u8) 0x00
  637. #define TYPE_A                          (u8) 0x01
  638. #define TYPE_B                          (u8) 0x02
  639. #define TYPE_F                          (u8) 0x03
  640. #define NOT_BUS_MASTER                  (u8) 0x00
  641. #define BUS_MASTER                      (u8) 0x01
  642. #define TRANSFER_8                      (u8) 0x00
  643. #define TRANSFER_8_16                   (u8) 0x01
  644. #define TRANSFER_16                     (u8) 0x02
  645. /*
  646.  * Start Dependent Functions Priority definitions
  647.  */
  648. #define GOOD_CONFIGURATION              (u8) 0x00
  649. #define ACCEPTABLE_CONFIGURATION        (u8) 0x01
  650. #define SUB_OPTIMAL_CONFIGURATION       (u8) 0x02
  651. /*
  652.  *  16, 32 and 64-bit Address Descriptor resource types
  653.  */
  654. #define MEMORY_RANGE                    (u8) 0x00
  655. #define IO_RANGE                        (u8) 0x01
  656. #define BUS_NUMBER_RANGE                (u8) 0x02
  657. #define ADDRESS_NOT_FIXED               (u8) 0x00
  658. #define ADDRESS_FIXED                   (u8) 0x01
  659. #define POS_DECODE                      (u8) 0x00
  660. #define SUB_DECODE                      (u8) 0x01
  661. #define PRODUCER                        (u8) 0x00
  662. #define CONSUMER                        (u8) 0x01
  663. /*
  664.  *  Structures used to describe device resources
  665.  */
  666. typedef struct
  667. {
  668. u32                         edge_level;
  669. u32                         active_high_low;
  670. u32                         shared_exclusive;
  671. u32                         number_of_interrupts;
  672. u32                         interrupts[1];
  673. } acpi_resource_irq;
  674. typedef struct
  675. {
  676. u32                         type;
  677. u32                         bus_master;
  678. u32                         transfer;
  679. u32                         number_of_channels;
  680. u32                         channels[1];
  681. } acpi_resource_dma;
  682. typedef struct
  683. {
  684. u32                         compatibility_priority;
  685. u32                         performance_robustness;
  686. } acpi_resource_start_dpf;
  687. /*
  688.  * END_DEPENDENT_FUNCTIONS_RESOURCE struct is not
  689.  *  needed because it has no fields
  690.  */
  691. typedef struct
  692. {
  693. u32                         io_decode;
  694. u32                         min_base_address;
  695. u32                         max_base_address;
  696. u32                         alignment;
  697. u32                         range_length;
  698. } acpi_resource_io;
  699. typedef struct
  700. {
  701. u32                         base_address;
  702. u32                         range_length;
  703. } acpi_resource_fixed_io;
  704. typedef struct
  705. {
  706. u32                         length;
  707. u8                          reserved[1];
  708. } acpi_resource_vendor;
  709. typedef struct
  710. {
  711. u32                         read_write_attribute;
  712. u32                         min_base_address;
  713. u32                         max_base_address;
  714. u32                         alignment;
  715. u32                         range_length;
  716. } acpi_resource_mem24;
  717. typedef struct
  718. {
  719. u32                         read_write_attribute;
  720. u32                         min_base_address;
  721. u32                         max_base_address;
  722. u32                         alignment;
  723. u32                         range_length;
  724. } acpi_resource_mem32;
  725. typedef struct
  726. {
  727. u32                         read_write_attribute;
  728. u32                         range_base_address;
  729. u32                         range_length;
  730. } acpi_resource_fixed_mem32;
  731. typedef struct
  732. {
  733. u16                         cache_attribute;
  734. u16                         read_write_attribute;
  735. } acpi_memory_attribute;
  736. typedef struct
  737. {
  738. u16                         range_attribute;
  739. u16                         reserved;
  740. } acpi_io_attribute;
  741. typedef struct
  742. {
  743. u16                         reserved1;
  744. u16                         reserved2;
  745. } acpi_bus_attribute;
  746. typedef union
  747. {
  748. acpi_memory_attribute       memory;
  749. acpi_io_attribute           io;
  750. acpi_bus_attribute          bus;
  751. } acpi_resource_attribute;
  752. typedef struct
  753. {
  754. u32                         index;
  755. u32                         string_length;
  756. NATIVE_CHAR                 *string_ptr;
  757. } acpi_resource_source;
  758. typedef struct
  759. {
  760. u32                         resource_type;
  761. u32                         producer_consumer;
  762. u32                         decode;
  763. u32                         min_address_fixed;
  764. u32                         max_address_fixed;
  765. acpi_resource_attribute     attribute;
  766. u32                         granularity;
  767. u32                         min_address_range;
  768. u32                         max_address_range;
  769. u32                         address_translation_offset;
  770. u32                         address_length;
  771. acpi_resource_source        resource_source;
  772. } acpi_resource_address16;
  773. typedef struct
  774. {
  775. u32                         resource_type;
  776. u32                         producer_consumer;
  777. u32                         decode;
  778. u32                         min_address_fixed;
  779. u32                         max_address_fixed;
  780. acpi_resource_attribute     attribute;
  781. u32                         granularity;
  782. u32                         min_address_range;
  783. u32                         max_address_range;
  784. u32                         address_translation_offset;
  785. u32                         address_length;
  786. acpi_resource_source        resource_source;
  787. } acpi_resource_address32;
  788. typedef struct
  789. {
  790. u32                         resource_type;
  791. u32                         producer_consumer;
  792. u32                         decode;
  793. u32                         min_address_fixed;
  794. u32                         max_address_fixed;
  795. acpi_resource_attribute     attribute;
  796. u64                         granularity;
  797. u64                         min_address_range;
  798. u64                         max_address_range;
  799. u64                         address_translation_offset;
  800. u64                         address_length;
  801. acpi_resource_source        resource_source;
  802. } acpi_resource_address64;
  803. typedef struct
  804. {
  805. u32                         producer_consumer;
  806. u32                         edge_level;
  807. u32                         active_high_low;
  808. u32                         shared_exclusive;
  809. u32                         number_of_interrupts;
  810. acpi_resource_source        resource_source;
  811. u32                         interrupts[1];
  812. } acpi_resource_ext_irq;
  813. /* ACPI_RESOURCE_TYPEs */
  814. #define ACPI_RSTYPE_IRQ                 0
  815. #define ACPI_RSTYPE_DMA                 1
  816. #define ACPI_RSTYPE_START_DPF           2
  817. #define ACPI_RSTYPE_END_DPF             3
  818. #define ACPI_RSTYPE_IO                  4
  819. #define ACPI_RSTYPE_FIXED_IO            5
  820. #define ACPI_RSTYPE_VENDOR              6
  821. #define ACPI_RSTYPE_END_TAG             7
  822. #define ACPI_RSTYPE_MEM24               8
  823. #define ACPI_RSTYPE_MEM32               9
  824. #define ACPI_RSTYPE_FIXED_MEM32         10
  825. #define ACPI_RSTYPE_ADDRESS16           11
  826. #define ACPI_RSTYPE_ADDRESS32           12
  827. #define ACPI_RSTYPE_ADDRESS64           13
  828. #define ACPI_RSTYPE_EXT_IRQ             14
  829. typedef u32                     acpi_resource_type;
  830. typedef union
  831. {
  832. acpi_resource_irq           irq;
  833. acpi_resource_dma           dma;
  834. acpi_resource_start_dpf     start_dpf;
  835. acpi_resource_io            io;
  836. acpi_resource_fixed_io      fixed_io;
  837. acpi_resource_vendor        vendor_specific;
  838. acpi_resource_mem24         memory24;
  839. acpi_resource_mem32         memory32;
  840. acpi_resource_fixed_mem32   fixed_memory32;
  841. acpi_resource_address16     address16;
  842. acpi_resource_address32     address32;
  843. acpi_resource_address64     address64;
  844. acpi_resource_ext_irq       extended_irq;
  845. } acpi_resource_data;
  846. typedef struct acpi_resource
  847. {
  848. acpi_resource_type          id;
  849. u32                         length;
  850. acpi_resource_data          data;
  851. } acpi_resource;
  852. #define ACPI_RESOURCE_LENGTH            12
  853. #define ACPI_RESOURCE_LENGTH_NO_DATA    8       /* Id + Length fields */
  854. #define SIZEOF_RESOURCE(type)   (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (type))
  855. #define NEXT_RESOURCE(res)      (acpi_resource *)((u8 *) res + res->length)
  856. /*
  857.  * END: Definitions for Resource Attributes
  858.  */
  859. typedef struct pci_routing_table
  860. {
  861. u32                         length;
  862. u32                         pin;
  863. acpi_integer                address;        /* here for 64-bit alignment */
  864. u32                         source_index;
  865. NATIVE_CHAR                 source[4];      /* pad to 64 bits so sizeof() works in all cases */
  866. } pci_routing_table;
  867. /*
  868.  * END: Definitions for PCI Routing tables
  869.  */
  870. #endif /* __ACTYPES_H__ */