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

Linux/Unix编程

开发平台:

Unix_Linux

  1. /******************************************************************************
  2.  *
  3.  * Name: aclocal.h - Internal data types used across the ACPI subsystem
  4.  *       $Revision: 138 $
  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 __ACLOCAL_H__
  25. #define __ACLOCAL_H__
  26. #define WAIT_FOREVER                    ((u32) -1)
  27. typedef void*                           acpi_mutex;
  28. typedef u32                             ACPI_MUTEX_HANDLE;
  29. #define ACPI_MEMORY_MODE                0x01
  30. #define ACPI_LOGICAL_ADDRESSING         0x00
  31. #define ACPI_PHYSICAL_ADDRESSING        0x01
  32. /* Object descriptor types */
  33. #define ACPI_CACHED_OBJECT              0x11    /* ORed in when object is cached */
  34. #define ACPI_DESC_TYPE_STATE            0x20
  35. #define ACPI_DESC_TYPE_STATE_UPDATE     0x21
  36. #define ACPI_DESC_TYPE_STATE_PACKAGE    0x22
  37. #define ACPI_DESC_TYPE_STATE_CONTROL    0x23
  38. #define ACPI_DESC_TYPE_STATE_RPSCOPE    0x24
  39. #define ACPI_DESC_TYPE_STATE_PSCOPE     0x25
  40. #define ACPI_DESC_TYPE_STATE_WSCOPE     0x26
  41. #define ACPI_DESC_TYPE_STATE_RESULT     0x27
  42. #define ACPI_DESC_TYPE_STATE_NOTIFY     0x28
  43. #define ACPI_DESC_TYPE_WALK             0x44
  44. #define ACPI_DESC_TYPE_PARSER           0x66
  45. #define ACPI_DESC_TYPE_INTERNAL         0x88
  46. #define ACPI_DESC_TYPE_NAMED            0xAA
  47. /*****************************************************************************
  48.  *
  49.  * Mutex typedefs and structs
  50.  *
  51.  ****************************************************************************/
  52. /*
  53.  * Predefined handles for the mutex objects used within the subsystem
  54.  * All mutex objects are automatically created by Acpi_ut_mutex_initialize.
  55.  *
  56.  * The acquire/release ordering protocol is implied via this list.  Mutexes
  57.  * with a lower value must be acquired before mutexes with a higher value.
  58.  *
  59.  * NOTE: any changes here must be reflected in the Acpi_gbl_Mutex_names table also!
  60.  */
  61. #define ACPI_MTX_EXECUTE                0
  62. #define ACPI_MTX_INTERPRETER            1
  63. #define ACPI_MTX_PARSER                 2
  64. #define ACPI_MTX_DISPATCHER             3
  65. #define ACPI_MTX_TABLES                 4
  66. #define ACPI_MTX_OP_REGIONS             5
  67. #define ACPI_MTX_NAMESPACE              6
  68. #define ACPI_MTX_EVENTS                 7
  69. #define ACPI_MTX_HARDWARE               8
  70. #define ACPI_MTX_CACHES                 9
  71. #define ACPI_MTX_MEMORY                 10
  72. #define ACPI_MTX_DEBUG_CMD_COMPLETE     11
  73. #define ACPI_MTX_DEBUG_CMD_READY        12
  74. #define MAX_MTX                         12
  75. #define NUM_MTX                         MAX_MTX+1
  76. #if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER)
  77. #ifdef DEFINE_ACPI_GLOBALS
  78. /* Names for the mutexes used in the subsystem */
  79. static NATIVE_CHAR          *acpi_gbl_mutex_names[] =
  80. {
  81. "ACPI_MTX_Execute",
  82. "ACPI_MTX_Interpreter",
  83. "ACPI_MTX_Parser",
  84. "ACPI_MTX_Dispatcher",
  85. "ACPI_MTX_Tables",
  86. "ACPI_MTX_Op_regions",
  87. "ACPI_MTX_Namespace",
  88. "ACPI_MTX_Events",
  89. "ACPI_MTX_Hardware",
  90. "ACPI_MTX_Caches",
  91. "ACPI_MTX_Memory",
  92. "ACPI_MTX_Debug_cmd_complete",
  93. "ACPI_MTX_Debug_cmd_ready",
  94. };
  95. #endif
  96. #endif
  97. /* Table for the global mutexes */
  98. typedef struct acpi_mutex_info
  99. {
  100. acpi_mutex                  mutex;
  101. u32                         use_count;
  102. u32                         owner_id;
  103. } acpi_mutex_info;
  104. /* This owner ID means that the mutex is not in use (unlocked) */
  105. #define ACPI_MUTEX_NOT_ACQUIRED         (u32) (-1)
  106. /* Lock flag parameter for various interfaces */
  107. #define ACPI_MTX_DO_NOT_LOCK            0
  108. #define ACPI_MTX_LOCK                   1
  109. typedef u16                             acpi_owner_id;
  110. #define OWNER_TYPE_TABLE                0x0
  111. #define OWNER_TYPE_METHOD               0x1
  112. #define FIRST_METHOD_ID                 0x0000
  113. #define FIRST_TABLE_ID                  0x8000
  114. /* TBD: [Restructure] get rid of the need for this! */
  115. #define TABLE_ID_DSDT                   (acpi_owner_id) 0x8000
  116. /* Field access granularities */
  117. #define ACPI_FIELD_BYTE_GRANULARITY     1
  118. #define ACPI_FIELD_WORD_GRANULARITY     2
  119. #define ACPI_FIELD_DWORD_GRANULARITY    4
  120. #define ACPI_FIELD_QWORD_GRANULARITY    8
  121. /*****************************************************************************
  122.  *
  123.  * Namespace typedefs and structs
  124.  *
  125.  ****************************************************************************/
  126. /* Operational modes of the AML interpreter/scanner */
  127. typedef enum
  128. {
  129. IMODE_LOAD_PASS1                = 0x01,
  130. IMODE_LOAD_PASS2                = 0x02,
  131. IMODE_EXECUTE                   = 0x0E
  132. } operating_mode;
  133. /*
  134.  * The Node describes a named object that appears in the AML
  135.  * An Acpi_node is used to store Nodes.
  136.  *
  137.  * Data_type is used to differentiate between internal descriptors, and MUST
  138.  * be the first byte in this structure.
  139.  */
  140. typedef struct acpi_node
  141. {
  142. u8                      data_type;
  143. u8                      type;           /* Type associated with this name */
  144. u16                     owner_id;
  145. u32                     name;           /* ACPI Name, always 4 chars per ACPI spec */
  146. union acpi_operand_obj  *object;        /* Pointer to attached ACPI object (optional) */
  147. struct acpi_node        *child;         /* first child */
  148. struct acpi_node        *peer;          /* Next peer*/
  149. u16                     reference_count; /* Current count of references and children */
  150. u8                      flags;
  151. } acpi_namespace_node;
  152. #define ENTRY_NOT_FOUND             NULL
  153. /* Node flags */
  154. #define ANOBJ_AML_ATTACHMENT            0x01
  155. #define ANOBJ_END_OF_PEER_LIST          0x02
  156. #define ANOBJ_DATA_WIDTH_32             0x04     /* Parent table is 64-bits */
  157. #define ANOBJ_METHOD_ARG                0x08
  158. #define ANOBJ_METHOD_LOCAL              0x10
  159. #define ANOBJ_METHOD_NO_RETVAL          0x20
  160. #define ANOBJ_METHOD_SOME_NO_RETVAL     0x40
  161. #define ANOBJ_IS_BIT_OFFSET             0x80
  162. /*
  163.  * ACPI Table Descriptor.  One per ACPI table
  164.  */
  165. typedef struct acpi_table_desc
  166. {
  167. struct acpi_table_desc  *prev;
  168. struct acpi_table_desc  *next;
  169. struct acpi_table_desc  *installed_desc;
  170. acpi_table_header       *pointer;
  171. void                    *base_pointer;
  172. u8                      *aml_start;
  173. u64                     physical_address;
  174. u32                     aml_length;
  175. u32                     length;
  176. u32                     count;
  177. acpi_owner_id           table_id;
  178. u8                      type;
  179. u8                      allocation;
  180. u8                      loaded_into_namespace;
  181. } acpi_table_desc;
  182. typedef struct
  183. {
  184. NATIVE_CHAR             *search_for;
  185. acpi_handle             *list;
  186. u32                     *count;
  187. } find_context;
  188. typedef struct
  189. {
  190. acpi_namespace_node     *node;
  191. } ns_search_data;
  192. /*
  193.  * Predefined Namespace items
  194.  */
  195. typedef struct
  196. {
  197. NATIVE_CHAR             *name;
  198. acpi_object_type8       type;
  199. NATIVE_CHAR             *val;
  200. } predefined_names;
  201. /* Object types used during package copies */
  202. #define ACPI_COPY_TYPE_SIMPLE           0
  203. #define ACPI_COPY_TYPE_PACKAGE          1
  204. /* Info structure used to convert external<->internal namestrings */
  205. typedef struct acpi_namestring_info
  206. {
  207. NATIVE_CHAR             *external_name;
  208. NATIVE_CHAR             *next_external_char;
  209. NATIVE_CHAR             *internal_name;
  210. u32                     length;
  211. u32                     num_segments;
  212. u32                     num_carats;
  213. u8                      fully_qualified;
  214. } acpi_namestring_info;
  215. /* Field creation info */
  216. typedef struct
  217. {
  218. acpi_namespace_node     *region_node;
  219. acpi_namespace_node     *field_node;
  220. acpi_namespace_node     *register_node;
  221. acpi_namespace_node     *data_register_node;
  222. u32                     bank_value;
  223. u32                     field_bit_position;
  224. u32                     field_bit_length;
  225. u8                      field_flags;
  226. u8                      field_type;
  227. } ACPI_CREATE_FIELD_INFO;
  228. /*
  229.  * Field flags: Bits 00 - 03 : Access_type (Any_acc, Byte_acc, etc.)
  230.  *                   04      : Lock_rule (1 == Lock)
  231.  *                   05 - 06 : Update_rule
  232.  */
  233. #define FIELD_ACCESS_TYPE_MASK      0x0F
  234. #define FIELD_LOCK_RULE_MASK        0x10
  235. #define FIELD_UPDATE_RULE_MASK      0x60
  236. /*****************************************************************************
  237.  *
  238.  * Event typedefs and structs
  239.  *
  240.  ****************************************************************************/
  241. /* Status bits. */
  242. #define ACPI_STATUS_PMTIMER             0x0001
  243. #define ACPI_STATUS_BUSMASTER           0x0010
  244. #define ACPI_STATUS_GLOBAL              0x0020
  245. #define ACPI_STATUS_POWER_BUTTON        0x0100
  246. #define ACPI_STATUS_SLEEP_BUTTON        0x0200
  247. #define ACPI_STATUS_RTC_ALARM           0x0400
  248. /* Enable bits. */
  249. #define ACPI_ENABLE_PMTIMER             0x0001
  250. #define ACPI_ENABLE_GLOBAL              0x0020
  251. #define ACPI_ENABLE_POWER_BUTTON        0x0100
  252. #define ACPI_ENABLE_SLEEP_BUTTON        0x0200
  253. #define ACPI_ENABLE_RTC_ALARM           0x0400
  254. /*
  255.  * Entry in the Address_space (AKA Operation Region) table
  256.  */
  257. typedef struct
  258. {
  259. acpi_adr_space_handler  handler;
  260. void                    *context;
  261. } acpi_adr_space_info;
  262. /* Values and addresses of the GPE registers (both banks) */
  263. typedef struct
  264. {
  265. u16                     status_addr;    /* Address of status reg */
  266. u16                     enable_addr;    /* Address of enable reg */
  267. u8                      status;         /* Current value of status reg */
  268. u8                      enable;         /* Current value of enable reg */
  269. u8                      wake_enable;    /* Mask of bits to keep enabled when sleeping */
  270. u8                      gpe_base;       /* Base GPE number */
  271. } acpi_gpe_registers;
  272. #define ACPI_GPE_LEVEL_TRIGGERED        1
  273. #define ACPI_GPE_EDGE_TRIGGERED         2
  274. /* Information about each particular GPE level */
  275. typedef struct
  276. {
  277. u8                      type;           /* Level or Edge */
  278. acpi_handle             method_handle;  /* Method handle for direct (fast) execution */
  279. acpi_gpe_handler        handler;        /* Address of handler, if any */
  280. void                    *context;       /* Context to be passed to handler */
  281. } acpi_gpe_level_info;
  282. /* Information about each particular fixed event */
  283. typedef struct
  284. {
  285. acpi_event_handler      handler;        /* Address of handler. */
  286. void                    *context;       /* Context to be passed to handler */
  287. } acpi_fixed_event_info;
  288. /* Information used during field processing */
  289. typedef struct
  290. {
  291. u8                      skip_field;
  292. u8                      field_flag;
  293. u32                     pkg_length;
  294. } acpi_field_info;
  295. /*****************************************************************************
  296.  *
  297.  * Generic "state" object for stacks
  298.  *
  299.  ****************************************************************************/
  300. #define CONTROL_NORMAL                  0xC0
  301. #define CONTROL_CONDITIONAL_EXECUTING   0xC1
  302. #define CONTROL_PREDICATE_EXECUTING     0xC2
  303. #define CONTROL_PREDICATE_FALSE         0xC3
  304. #define CONTROL_PREDICATE_TRUE          0xC4
  305. /* Forward declarations */
  306. struct acpi_walk_state;
  307. struct acpi_walk_list;
  308. struct acpi_parse_obj;
  309. struct acpi_obj_mutex;
  310. #define ACPI_STATE_COMMON                  /* Two 32-bit fields and a pointer */
  311. u8                      data_type;          /* To differentiate various internal objs */
  312. u8                      flags; 
  313. u16                     value; 
  314. u16                     state; 
  315. u16                     acpi_eval; 
  316. void                    *next; 
  317. typedef struct acpi_common_state
  318. {
  319. ACPI_STATE_COMMON
  320. } acpi_common_state;
  321. /*
  322.  * Update state - used to traverse complex objects such as packages
  323.  */
  324. typedef struct acpi_update_state
  325. {
  326. ACPI_STATE_COMMON
  327. union acpi_operand_obj  *object;
  328. } acpi_update_state;
  329. /*
  330.  * Pkg state - used to traverse nested package structures
  331.  */
  332. typedef struct acpi_pkg_state
  333. {
  334. ACPI_STATE_COMMON
  335. union acpi_operand_obj  *source_object;
  336. union acpi_operand_obj  *dest_object;
  337. struct acpi_walk_state  *walk_state;
  338. void                    *this_target_obj;
  339. u32                     num_packages;
  340. u16                     index;
  341. } acpi_pkg_state;
  342. /*
  343.  * Control state - one per if/else and while constructs.
  344.  * Allows nesting of these constructs
  345.  */
  346. typedef struct acpi_control_state
  347. {
  348. ACPI_STATE_COMMON
  349. struct acpi_parse_obj   *predicate_op;
  350. u8                      *aml_predicate_start; /* Start of if/while predicate */
  351. } acpi_control_state;
  352. /*
  353.  * Scope state - current scope during namespace lookups
  354.  */
  355. typedef struct acpi_scope_state
  356. {
  357. ACPI_STATE_COMMON
  358. acpi_namespace_node     *node;
  359. } acpi_scope_state;
  360. typedef struct acpi_pscope_state
  361. {
  362. ACPI_STATE_COMMON
  363. struct acpi_parse_obj   *op;            /* current op being parsed */
  364. u8                      *arg_end;       /* current argument end */
  365. u8                      *pkg_end;       /* current package end */
  366. u32                     arg_list;       /* next argument to parse */
  367. u32                     arg_count;      /* Number of fixed arguments */
  368. } acpi_pscope_state;
  369. /*
  370.  * Result values - used to accumulate the results of nested
  371.  * AML arguments
  372.  */
  373. typedef struct acpi_result_values
  374. {
  375. ACPI_STATE_COMMON
  376. union acpi_operand_obj  *obj_desc [OBJ_NUM_OPERANDS];
  377. u8                      num_results;
  378. u8                      last_insert;
  379. } acpi_result_values;
  380. typedef
  381. acpi_status (*acpi_parse_downwards) (
  382. struct acpi_walk_state  *walk_state,
  383. struct acpi_parse_obj   **out_op);
  384. typedef
  385. acpi_status (*acpi_parse_upwards) (
  386. struct acpi_walk_state  *walk_state);
  387. /*
  388.  * Notify info - used to pass info to the deferred notify
  389.  * handler/dispatcher.
  390.  */
  391. typedef struct acpi_notify_info
  392. {
  393. ACPI_STATE_COMMON
  394. acpi_namespace_node     *node;
  395. union acpi_operand_obj  *handler_obj;
  396. } acpi_notify_info;
  397. /* Generic state is union of structs above */
  398. typedef union acpi_gen_state
  399. {
  400. acpi_common_state       common;
  401. acpi_control_state      control;
  402. acpi_update_state       update;
  403. acpi_scope_state        scope;
  404. acpi_pscope_state       parse_scope;
  405. acpi_pkg_state          pkg;
  406. acpi_result_values      results;
  407. acpi_notify_info        notify;
  408. } acpi_generic_state;
  409. /*****************************************************************************
  410.  *
  411.  * Interpreter typedefs and structs
  412.  *
  413.  ****************************************************************************/
  414. typedef
  415. acpi_status (*ACPI_EXECUTE_OP) (
  416. struct acpi_walk_state  *walk_state);
  417. /*****************************************************************************
  418.  *
  419.  * Parser typedefs and structs
  420.  *
  421.  ****************************************************************************/
  422. /*
  423.  * AML opcode, name, and argument layout
  424.  */
  425. typedef struct acpi_opcode_info
  426. {
  427. u32                     parse_args;     /* Grammar/Parse time arguments */
  428. u32                     runtime_args;   /* Interpret time arguments */
  429. u16                     flags;          /* Misc flags */
  430. u8                      class;          /* Opcode class */
  431. u8                      type;           /* Opcode type */
  432. #ifdef _OPCODE_NAMES
  433. NATIVE_CHAR             *name;          /* op name (debug only) */
  434. #endif
  435. } acpi_opcode_info;
  436. typedef union acpi_parse_val
  437. {
  438. acpi_integer            integer;        /* integer constant (Up to 64 bits) */
  439. uint64_struct           integer64;      /* Structure overlay for 2 32-bit Dwords */
  440. u32                     integer32;      /* integer constant, 32 bits only */
  441. u16                     integer16;      /* integer constant, 16 bits only */
  442. u8                      integer8;       /* integer constant, 8 bits only */
  443. u32                     size;           /* bytelist or field size */
  444. NATIVE_CHAR             *string;        /* NULL terminated string */
  445. u8                      *buffer;        /* buffer or string */
  446. NATIVE_CHAR             *name;          /* NULL terminated string */
  447. struct acpi_parse_obj   *arg;           /* arguments and contained ops */
  448. } acpi_parse_value;
  449. #define ACPI_PARSE_COMMON 
  450. u8                      data_type;      /* To differentiate various internal objs */
  451. u8                      flags;          /* Type of Op */
  452. u16                     opcode;         /* AML opcode */
  453. u32                     aml_offset;     /* offset of declaration in AML */
  454. struct acpi_parse_obj   *parent;        /* parent op */
  455. struct acpi_parse_obj   *next;          /* next op */
  456. DEBUG_ONLY_MEMBERS (
  457. NATIVE_CHAR             op_name[16])    /* op name (debug only) */
  458.   /* NON-DEBUG members below: */
  459. acpi_namespace_node     *node;          /* for use by interpreter */
  460. acpi_parse_value        value;          /* Value or args associated with the opcode */
  461. /*
  462.  * generic operation (eg. If, While, Store)
  463.  */
  464. typedef struct acpi_parse_obj
  465. {
  466. ACPI_PARSE_COMMON
  467. } acpi_parse_object;
  468. /*
  469.  * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and Op_regions),
  470.  * and bytelists.
  471.  */
  472. typedef struct acpi_parse2_obj
  473. {
  474. ACPI_PARSE_COMMON
  475. u8                      *data;          /* AML body or bytelist data */
  476. u32                     length;         /* AML length */
  477. u32                     name;           /* 4-byte name or zero if no name */
  478. } acpi_parse2_object;
  479. /*
  480.  * Parse state - one state per parser invocation and each control
  481.  * method.
  482.  */
  483. typedef struct acpi_parse_state
  484. {
  485. u32                     aml_size;
  486. u8                      *aml_start;     /* first AML byte */
  487. u8                      *aml;           /* next AML byte */
  488. u8                      *aml_end;       /* (last + 1) AML byte */
  489. u8                      *pkg_start;     /* current package begin */
  490. u8                      *pkg_end;       /* current package end */
  491. struct acpi_parse_obj   *start_op;      /* root of parse tree */
  492. struct acpi_node        *start_node;
  493. union acpi_gen_state    *scope;         /* current scope */
  494. struct acpi_parse_obj   *start_scope;
  495. } acpi_parse_state;
  496. /*****************************************************************************
  497.  *
  498.  * Hardware and PNP
  499.  *
  500.  ****************************************************************************/
  501. /* PCI */
  502. #define PCI_ROOT_HID_STRING             "PNP0A03"
  503. /*
  504.  * The #define's and enum below establish an abstract way of identifying what
  505.  * register block and register is to be accessed.  Do not change any of the
  506.  * values as they are used in switch statements and offset calculations.
  507.  */
  508. #define REGISTER_BLOCK_MASK             0xFF00  /* Register Block Id    */
  509. #define BIT_IN_REGISTER_MASK            0x00FF  /* Bit Id in the Register Block Id    */
  510. #define BYTE_IN_REGISTER_MASK           0x00FF  /* Register Offset in the Register Block    */
  511. #define REGISTER_BLOCK_ID(reg_id)       (reg_id & REGISTER_BLOCK_MASK)
  512. #define REGISTER_BIT_ID(reg_id)         (reg_id & BIT_IN_REGISTER_MASK)
  513. #define REGISTER_OFFSET(reg_id)         (reg_id & BYTE_IN_REGISTER_MASK)
  514. /*
  515.  * Access Rule
  516.  *  To access a Register Bit:
  517.  *  -> Use Bit Name (= Register Block Id | Bit Id) defined in the enum.
  518.  *
  519.  *  To access a Register:
  520.  *  -> Use Register Id (= Register Block Id | Register Offset)
  521.  */
  522. /*
  523.  * Register Block Id
  524.  */
  525. #define PM1_STS                         0x0100
  526. #define PM1_EN                          0x0200
  527. #define PM1_CONTROL                     0x0300
  528. #define PM1A_CONTROL                    0x0400
  529. #define PM1B_CONTROL                    0x0500
  530. #define PM2_CONTROL                     0x0600
  531. #define PM_TIMER                        0x0700
  532. #define PROCESSOR_BLOCK                 0x0800
  533. #define GPE0_STS_BLOCK                  0x0900
  534. #define GPE0_EN_BLOCK                   0x0A00
  535. #define GPE1_STS_BLOCK                  0x0B00
  536. #define GPE1_EN_BLOCK                   0x0C00
  537. #define SMI_CMD_BLOCK                   0x0D00
  538. /*
  539.  * Address space bitmasks for mmio or io spaces
  540.  */
  541. #define SMI_CMD_ADDRESS_SPACE           0x01
  542. #define PM1_BLK_ADDRESS_SPACE           0x02
  543. #define PM2_CNT_BLK_ADDRESS_SPACE       0x04
  544. #define PM_TMR_BLK_ADDRESS_SPACE        0x08
  545. #define GPE0_BLK_ADDRESS_SPACE          0x10
  546. #define GPE1_BLK_ADDRESS_SPACE          0x20
  547. /*
  548.  * Control bit definitions
  549.  */
  550. #define TMR_STS                         (PM1_STS | 0x01)
  551. #define BM_STS                          (PM1_STS | 0x02)
  552. #define GBL_STS                         (PM1_STS | 0x03)
  553. #define PWRBTN_STS                      (PM1_STS | 0x04)
  554. #define SLPBTN_STS                      (PM1_STS | 0x05)
  555. #define RTC_STS                         (PM1_STS | 0x06)
  556. #define WAK_STS                         (PM1_STS | 0x07)
  557. #define TMR_EN                          (PM1_EN | 0x01)
  558.  /* no BM_EN */
  559. #define GBL_EN                          (PM1_EN | 0x03)
  560. #define PWRBTN_EN                       (PM1_EN | 0x04)
  561. #define SLPBTN_EN                       (PM1_EN | 0x05)
  562. #define RTC_EN                          (PM1_EN | 0x06)
  563. #define WAK_EN                          (PM1_EN | 0x07)
  564. #define SCI_EN                          (PM1_CONTROL | 0x01)
  565. #define BM_RLD                          (PM1_CONTROL | 0x02)
  566. #define GBL_RLS                         (PM1_CONTROL | 0x03)
  567. #define SLP_TYPE_A                      (PM1_CONTROL | 0x04)
  568. #define SLP_TYPE_B                      (PM1_CONTROL | 0x05)
  569. #define SLP_EN                          (PM1_CONTROL | 0x06)
  570. #define ARB_DIS                         (PM2_CONTROL | 0x01)
  571. #define TMR_VAL                         (PM_TIMER | 0x01)
  572. #define GPE0_STS                        (GPE0_STS_BLOCK | 0x01)
  573. #define GPE0_EN                         (GPE0_EN_BLOCK  | 0x01)
  574. #define GPE1_STS                        (GPE1_STS_BLOCK | 0x01)
  575. #define GPE1_EN                         (GPE1_EN_BLOCK  | 0x01)
  576. #define TMR_STS_MASK                    0x0001
  577. #define BM_STS_MASK                     0x0010
  578. #define GBL_STS_MASK                    0x0020
  579. #define PWRBTN_STS_MASK                 0x0100
  580. #define SLPBTN_STS_MASK                 0x0200
  581. #define RTC_STS_MASK                    0x0400
  582. #define WAK_STS_MASK                    0x8000
  583. #define ALL_FIXED_STS_BITS              (TMR_STS_MASK   | BM_STS_MASK  | GBL_STS_MASK 
  584.   | PWRBTN_STS_MASK | SLPBTN_STS_MASK 
  585.   | RTC_STS_MASK | WAK_STS_MASK)
  586. #define TMR_EN_MASK                     0x0001
  587. #define GBL_EN_MASK                     0x0020
  588. #define PWRBTN_EN_MASK                  0x0100
  589. #define SLPBTN_EN_MASK                  0x0200
  590. #define RTC_EN_MASK                     0x0400
  591. #define SCI_EN_MASK                     0x0001
  592. #define BM_RLD_MASK                     0x0002
  593. #define GBL_RLS_MASK                    0x0004
  594. #define SLP_TYPE_X_MASK                 0x1C00
  595. #define SLP_EN_MASK                     0x2000
  596. #define ARB_DIS_MASK                    0x0001
  597. #define TMR_VAL_MASK                    0xFFFFFFFF
  598. #define GPE0_STS_MASK
  599. #define GPE0_EN_MASK
  600. #define GPE1_STS_MASK
  601. #define GPE1_EN_MASK
  602. #define ACPI_READ                       1
  603. #define ACPI_WRITE                      2
  604. /*****************************************************************************
  605.  *
  606.  * Resource descriptors
  607.  *
  608.  ****************************************************************************/
  609. /* Resource_type values */
  610. #define RESOURCE_TYPE_MEMORY_RANGE              0
  611. #define RESOURCE_TYPE_IO_RANGE                  1
  612. #define RESOURCE_TYPE_BUS_NUMBER_RANGE          2
  613. /* Resource descriptor types and masks */
  614. #define RESOURCE_DESC_TYPE_LARGE                0x80
  615. #define RESOURCE_DESC_TYPE_SMALL                0x00
  616. #define RESOURCE_DESC_TYPE_MASK                 0x80
  617. #define RESOURCE_DESC_SMALL_MASK                0x78        /* Only bits 6:3 contain the type */
  618. /*
  619.  * Small resource descriptor types
  620.  * Note: The 3 length bits (2:0) must be zero
  621.  */
  622. #define RESOURCE_DESC_IRQ_FORMAT                0x20
  623. #define RESOURCE_DESC_DMA_FORMAT                0x28
  624. #define RESOURCE_DESC_START_DEPENDENT           0x30
  625. #define RESOURCE_DESC_END_DEPENDENT             0x38
  626. #define RESOURCE_DESC_IO_PORT                   0x40
  627. #define RESOURCE_DESC_FIXED_IO_PORT             0x48
  628. #define RESOURCE_DESC_SMALL_VENDOR              0x70
  629. #define RESOURCE_DESC_END_TAG                   0x78
  630. /*
  631.  * Large resource descriptor types
  632.  */
  633. #define RESOURCE_DESC_MEMORY_24                 0x81
  634. #define RESOURCE_DESC_GENERAL_REGISTER          0x82
  635. #define RESOURCE_DESC_LARGE_VENDOR              0x84
  636. #define RESOURCE_DESC_MEMORY_32                 0x85
  637. #define RESOURCE_DESC_FIXED_MEMORY_32           0x86
  638. #define RESOURCE_DESC_DWORD_ADDRESS_SPACE       0x87
  639. #define RESOURCE_DESC_WORD_ADDRESS_SPACE        0x88
  640. #define RESOURCE_DESC_EXTENDED_XRUPT            0x89
  641. #define RESOURCE_DESC_QWORD_ADDRESS_SPACE       0x8A
  642. /* String version of device HIDs and UIDs */
  643. #define ACPI_DEVICE_ID_LENGTH                   0x09
  644. typedef struct
  645. {
  646. char            buffer[ACPI_DEVICE_ID_LENGTH];
  647. } acpi_device_id;
  648. /*****************************************************************************
  649.  *
  650.  * Miscellaneous
  651.  *
  652.  ****************************************************************************/
  653. #define ASCII_ZERO                      0x30
  654. /*****************************************************************************
  655.  *
  656.  * Debugger
  657.  *
  658.  ****************************************************************************/
  659. typedef struct dbmethodinfo
  660. {
  661. acpi_handle             thread_gate;
  662. NATIVE_CHAR             *name;
  663. NATIVE_CHAR             **args;
  664. u32                     flags;
  665. u32                     num_loops;
  666. NATIVE_CHAR             pathname[128];
  667. } db_method_info;
  668. /*****************************************************************************
  669.  *
  670.  * Debug
  671.  *
  672.  ****************************************************************************/
  673. typedef struct
  674. {
  675. u32                     component_id;
  676. NATIVE_CHAR             *proc_name;
  677. NATIVE_CHAR             *module_name;
  678. } acpi_debug_print_info;
  679. /* Entry for a memory allocation (debug only) */
  680. #define MEM_MALLOC                      0
  681. #define MEM_CALLOC                      1
  682. #define MAX_MODULE_NAME                 16
  683. #define ACPI_COMMON_DEBUG_MEM_HEADER 
  684. struct acpi_debug_mem_block *previous; 
  685. struct acpi_debug_mem_block *next; 
  686. u32                         size; 
  687. u32                         component; 
  688. u32                         line; 
  689. NATIVE_CHAR                 module[MAX_MODULE_NAME]; 
  690. u8                          alloc_type;
  691. typedef struct
  692. {
  693. ACPI_COMMON_DEBUG_MEM_HEADER
  694. } acpi_debug_mem_header;
  695. typedef struct acpi_debug_mem_block
  696. {
  697. ACPI_COMMON_DEBUG_MEM_HEADER
  698. u64                         user_space;
  699. } acpi_debug_mem_block;
  700. #define ACPI_MEM_LIST_GLOBAL            0
  701. #define ACPI_MEM_LIST_NSNODE            1
  702. #define ACPI_MEM_LIST_FIRST_CACHE_LIST  2
  703. #define ACPI_MEM_LIST_STATE             2
  704. #define ACPI_MEM_LIST_PSNODE            3
  705. #define ACPI_MEM_LIST_PSNODE_EXT        4
  706. #define ACPI_MEM_LIST_OPERAND           5
  707. #define ACPI_MEM_LIST_WALK              6
  708. #define ACPI_MEM_LIST_MAX               6
  709. #define ACPI_NUM_MEM_LISTS              7
  710. typedef struct
  711. {
  712. void                        *list_head;
  713. u16                         link_offset;
  714. u16                         max_cache_depth;
  715. u16                         cache_depth;
  716. u16                         object_size;
  717. #ifdef ACPI_DBG_TRACK_ALLOCATIONS
  718. /* Statistics for debug memory tracking only */
  719. u32                         total_allocated;
  720. u32                         total_freed;
  721. u32                         current_total_size;
  722. u32                         cache_requests;
  723. u32                         cache_hits;
  724. char                        *list_name;
  725. #endif
  726. } ACPI_MEMORY_LIST;
  727. #endif /* __ACLOCAL_H__ */