File: /usr/src/linux/drivers/acpi/include/aclocal.h

1     /******************************************************************************
2      *
3      * Name: aclocal.h - Internal data types used across the ACPI subsystem
4      *       $Revision: 130 $
5      *
6      *****************************************************************************/
7     
8     /*
9      *  Copyright (C) 2000, 2001 R. Byron Moore
10      *
11      *  This program is free software; you can redistribute it and/or modify
12      *  it under the terms of the GNU General Public License as published by
13      *  the Free Software Foundation; either version 2 of the License, or
14      *  (at your option) any later version.
15      *
16      *  This program is distributed in the hope that it will be useful,
17      *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18      *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19      *  GNU General Public License for more details.
20      *
21      *  You should have received a copy of the GNU General Public License
22      *  along with this program; if not, write to the Free Software
23      *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24      */
25     
26     #ifndef __ACLOCAL_H__
27     #define __ACLOCAL_H__
28     
29     
30     #define WAIT_FOREVER                    ((u32) -1)
31     
32     typedef void*                           ACPI_MUTEX;
33     typedef u32                             ACPI_MUTEX_HANDLE;
34     
35     
36     #define ACPI_MEMORY_MODE                0x01
37     #define ACPI_LOGICAL_ADDRESSING         0x00
38     #define ACPI_PHYSICAL_ADDRESSING        0x01
39     
40     /* Object descriptor types */
41     
42     #define ACPI_CACHED_OBJECT              0x11    /* ORed in when object is cached */
43     #define ACPI_DESC_TYPE_STATE            0x22
44     #define ACPI_DESC_TYPE_WALK             0x44
45     #define ACPI_DESC_TYPE_PARSER           0x66
46     #define ACPI_DESC_TYPE_INTERNAL         0x88
47     #define ACPI_DESC_TYPE_NAMED            0xAA
48     
49     
50     /*****************************************************************************
51      *
52      * Mutex typedefs and structs
53      *
54      ****************************************************************************/
55     
56     
57     /*
58      * Predefined handles for the mutex objects used within the subsystem
59      * All mutex objects are automatically created by Acpi_ut_mutex_initialize.
60      *
61      * The acquire/release ordering protocol is implied via this list.  Mutexes
62      * with a lower value must be acquired before mutexes with a higher value.
63      *
64      * NOTE: any changes here must be reflected in the Acpi_gbl_Mutex_names table also!
65      */
66     
67     #define ACPI_MTX_EXECUTE                0
68     #define ACPI_MTX_INTERPRETER            1
69     #define ACPI_MTX_PARSER                 2
70     #define ACPI_MTX_DISPATCHER             3
71     #define ACPI_MTX_TABLES                 4
72     #define ACPI_MTX_OP_REGIONS             5
73     #define ACPI_MTX_NAMESPACE              6
74     #define ACPI_MTX_EVENTS                 7
75     #define ACPI_MTX_HARDWARE               8
76     #define ACPI_MTX_CACHES                 9
77     #define ACPI_MTX_MEMORY                 10
78     #define ACPI_MTX_DEBUG_CMD_COMPLETE     11
79     #define ACPI_MTX_DEBUG_CMD_READY        12
80     
81     #define MAX_MTX                         12
82     #define NUM_MTX                         MAX_MTX+1
83     
84     
85     #if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER)
86     #ifdef DEFINE_ACPI_GLOBALS
87     
88     /* Names for the mutexes used in the subsystem */
89     
90     static NATIVE_CHAR          *acpi_gbl_mutex_names[] =
91     {
92     	"ACPI_MTX_Execute",
93     	"ACPI_MTX_Interpreter",
94     	"ACPI_MTX_Parser",
95     	"ACPI_MTX_Dispatcher",
96     	"ACPI_MTX_Tables",
97     	"ACPI_MTX_Op_regions",
98     	"ACPI_MTX_Namespace",
99     	"ACPI_MTX_Events",
100     	"ACPI_MTX_Hardware",
101     	"ACPI_MTX_Caches",
102     	"ACPI_MTX_Memory",
103     	"ACPI_MTX_Debug_cmd_complete",
104     	"ACPI_MTX_Debug_cmd_ready",
105     };
106     
107     #endif
108     #endif
109     
110     
111     /* Table for the global mutexes */
112     
113     typedef struct acpi_mutex_info
114     {
115     	ACPI_MUTEX                  mutex;
116     	u32                         use_count;
117     	u32                         owner_id;
118     
119     } ACPI_MUTEX_INFO;
120     
121     /* This owner ID means that the mutex is not in use (unlocked) */
122     
123     #define ACPI_MUTEX_NOT_ACQUIRED         (u32) (-1)
124     
125     
126     /* Lock flag parameter for various interfaces */
127     
128     #define ACPI_MTX_DO_NOT_LOCK            0
129     #define ACPI_MTX_LOCK                   1
130     
131     
132     typedef u16                             acpi_owner_id;
133     #define OWNER_TYPE_TABLE                0x0
134     #define OWNER_TYPE_METHOD               0x1
135     #define FIRST_METHOD_ID                 0x0000
136     #define FIRST_TABLE_ID                  0x8000
137     
138     /* TBD: [Restructure] get rid of the need for this! */
139     
140     #define TABLE_ID_DSDT                   (acpi_owner_id) 0x8000
141     
142     
143     /* Field access granularities */
144     
145     #define ACPI_FIELD_BYTE_GRANULARITY     1
146     #define ACPI_FIELD_WORD_GRANULARITY     2
147     #define ACPI_FIELD_DWORD_GRANULARITY    4
148     #define ACPI_FIELD_QWORD_GRANULARITY    8
149     
150     /*****************************************************************************
151      *
152      * Namespace typedefs and structs
153      *
154      ****************************************************************************/
155     
156     
157     /* Operational modes of the AML interpreter/scanner */
158     
159     typedef enum
160     {
161     	IMODE_LOAD_PASS1                = 0x01,
162     	IMODE_LOAD_PASS2                = 0x02,
163     	IMODE_EXECUTE                   = 0x0E
164     
165     } operating_mode;
166     
167     
168     /*
169      * The Node describes a named object that appears in the AML
170      * An Acpi_node is used to store Nodes.
171      *
172      * Data_type is used to differentiate between internal descriptors, and MUST
173      * be the first byte in this structure.
174      */
175     
176     typedef struct acpi_node
177     {
178     	u8                      data_type;
179     	u8                      type;           /* Type associated with this name */
180     	u16                     owner_id;
181     	u32                     name;           /* ACPI Name, always 4 chars per ACPI spec */
182     
183     
184     	void                    *object;        /* Pointer to attached ACPI object (optional) */
185     	struct acpi_node        *child;         /* first child */
186     	struct acpi_node        *peer;          /* Next peer*/
187     	u16                     reference_count; /* Current count of references and children */
188     	u8                      flags;
189     
190     } acpi_namespace_node;
191     
192     
193     #define ENTRY_NOT_FOUND             NULL
194     
195     
196     /* Node flags */
197     
198     #define ANOBJ_AML_ATTACHMENT            0x01
199     #define ANOBJ_END_OF_PEER_LIST          0x02
200     #define ANOBJ_DATA_WIDTH_32             0x04     /* Parent table is 64-bits */
201     #define ANOBJ_METHOD_ARG                0x08
202     #define ANOBJ_METHOD_LOCAL              0x10
203     #define ANOBJ_METHOD_NO_RETVAL          0x20
204     #define ANOBJ_METHOD_SOME_NO_RETVAL     0x40
205     
206     #define ANOBJ_IS_BIT_OFFSET             0x80
207     
208     
209     /*
210      * ACPI Table Descriptor.  One per ACPI table
211      */
212     typedef struct acpi_table_desc
213     {
214     	struct acpi_table_desc  *prev;
215     	struct acpi_table_desc  *next;
216     	struct acpi_table_desc  *installed_desc;
217     	acpi_table_header       *pointer;
218     	void                    *base_pointer;
219     	u8                      *aml_pointer;
220     	UINT64                  physical_address;
221     	u32                     aml_length;
222     	u32                     length;
223     	u32                     count;
224     	acpi_owner_id           table_id;
225     	u8                      type;
226     	u8                      allocation;
227     	u8                      loaded_into_namespace;
228     
229     } acpi_table_desc;
230     
231     
232     typedef struct
233     {
234     	NATIVE_CHAR             *search_for;
235     	acpi_handle             *list;
236     	u32                     *count;
237     
238     } FIND_CONTEXT;
239     
240     
241     typedef struct
242     {
243     	acpi_namespace_node     *node;
244     } NS_SEARCH_DATA;
245     
246     
247     /*
248      * Predefined Namespace items
249      */
250     typedef struct
251     {
252     	NATIVE_CHAR             *name;
253     	acpi_object_type8       type;
254     	NATIVE_CHAR             *val;
255     
256     } predefined_names;
257     
258     
259     /* Object types used during package copies */
260     
261     
262     #define ACPI_COPY_TYPE_SIMPLE           0
263     #define ACPI_COPY_TYPE_PACKAGE          1
264     
265     /* Info structure used to convert external<->internal namestrings */
266     
267     typedef struct acpi_namestring_info
268     {
269     	NATIVE_CHAR             *external_name;
270     	NATIVE_CHAR             *next_external_char;
271     	NATIVE_CHAR             *internal_name;
272     	u32                     length;
273     	u32                     num_segments;
274     	u32                     num_carats;
275     	u8                      fully_qualified;
276     
277     } ACPI_NAMESTRING_INFO;
278     
279     
280     /*****************************************************************************
281      *
282      * Event typedefs and structs
283      *
284      ****************************************************************************/
285     
286     
287     /* Status bits. */
288     
289     #define ACPI_STATUS_PMTIMER             0x0001
290     #define ACPI_STATUS_BUSMASTER           0x0010
291     #define ACPI_STATUS_GLOBAL              0x0020
292     #define ACPI_STATUS_POWER_BUTTON        0x0100
293     #define ACPI_STATUS_SLEEP_BUTTON        0x0200
294     #define ACPI_STATUS_RTC_ALARM           0x0400
295     
296     /* Enable bits. */
297     
298     #define ACPI_ENABLE_PMTIMER             0x0001
299     #define ACPI_ENABLE_GLOBAL              0x0020
300     #define ACPI_ENABLE_POWER_BUTTON        0x0100
301     #define ACPI_ENABLE_SLEEP_BUTTON        0x0200
302     #define ACPI_ENABLE_RTC_ALARM           0x0400
303     
304     
305     /*
306      * Entry in the Address_space (AKA Operation Region) table
307      */
308     
309     typedef struct
310     {
311     	ACPI_ADR_SPACE_HANDLER  handler;
312     	void                    *context;
313     
314     } ACPI_ADR_SPACE_INFO;
315     
316     
317     /* Values and addresses of the GPE registers (both banks) */
318     
319     typedef struct
320     {
321     	u8                      status;         /* Current value of status reg */
322     	u8                      enable;         /* Current value of enable reg */
323     	u16                     status_addr;    /* Address of status reg */
324     	u16                     enable_addr;    /* Address of enable reg */
325     	u8                      gpe_base;       /* Base GPE number */
326     
327     } ACPI_GPE_REGISTERS;
328     
329     
330     #define ACPI_GPE_LEVEL_TRIGGERED        1
331     #define ACPI_GPE_EDGE_TRIGGERED         2
332     
333     
334     /* Information about each particular GPE level */
335     
336     typedef struct
337     {
338     	u8                      type;           /* Level or Edge */
339     
340     	acpi_handle             method_handle;  /* Method handle for direct (fast) execution */
341     	ACPI_GPE_HANDLER        handler;        /* Address of handler, if any */
342     	void                    *context;       /* Context to be passed to handler */
343     
344     } acpi_gpe_level_info;
345     
346     
347     /* Information about each particular fixed event */
348     
349     typedef struct
350     {
351     	ACPI_EVENT_HANDLER      handler;        /* Address of handler. */
352     	void                    *context;       /* Context to be passed to handler */
353     
354     } ACPI_FIXED_EVENT_INFO;
355     
356     
357     /* Information used during field processing */
358     
359     typedef struct
360     {
361     	u8                      skip_field;
362     	u8                      field_flag;
363     	u32                     pkg_length;
364     
365     } ACPI_FIELD_INFO;
366     
367     
368     /*****************************************************************************
369      *
370      * Generic "state" object for stacks
371      *
372      ****************************************************************************/
373     
374     
375     #define CONTROL_NORMAL                  0xC0
376     #define CONTROL_CONDITIONAL_EXECUTING   0xC1
377     #define CONTROL_PREDICATE_EXECUTING     0xC2
378     #define CONTROL_PREDICATE_FALSE         0xC3
379     #define CONTROL_PREDICATE_TRUE          0xC4
380     
381     
382     /* Forward declarations */
383     struct acpi_walk_state;
384     struct acpi_walk_list;
385     struct acpi_parse_obj;
386     struct acpi_obj_mutex;
387     
388     
389     #define ACPI_STATE_COMMON                  /* Two 32-bit fields and a pointer */\
390     	u8                      data_type;          /* To differentiate various internal objs */\
391     	u8                      flags; \
392     	u16                     value; \
393     	u16                     state; \
394     	u16                     acpi_eval; \
395     	void                    *next; \
396     
397     typedef struct acpi_common_state
398     {
399     	ACPI_STATE_COMMON
400     } ACPI_COMMON_STATE;
401     
402     
403     /*
404      * Update state - used to traverse complex objects such as packages
405      */
406     typedef struct acpi_update_state
407     {
408     	ACPI_STATE_COMMON
409     	union acpi_operand_obj  *object;
410     
411     } ACPI_UPDATE_STATE;
412     
413     
414     /*
415      * Pkg state - used to traverse nested package structures
416      */
417     typedef struct acpi_pkg_state
418     {
419     	ACPI_STATE_COMMON
420     	union acpi_operand_obj  *source_object;
421     	union acpi_operand_obj  *dest_object;
422     	struct acpi_walk_state  *walk_state;
423     	void                    *this_target_obj;
424     	u32                     num_packages;
425     	u16                     index;
426     
427     } ACPI_PKG_STATE;
428     
429     
430     /*
431      * Control state - one per if/else and while constructs.
432      * Allows nesting of these constructs
433      */
434     typedef struct acpi_control_state
435     {
436     	ACPI_STATE_COMMON
437     	struct acpi_parse_obj   *predicate_op;
438     	u8                      *aml_predicate_start; /* Start of if/while predicate */
439     
440     } ACPI_CONTROL_STATE;
441     
442     
443     /*
444      * Scope state - current scope during namespace lookups
445      */
446     typedef struct acpi_scope_state
447     {
448     	ACPI_STATE_COMMON
449     	acpi_namespace_node     *node;
450     
451     } ACPI_SCOPE_STATE;
452     
453     
454     typedef struct acpi_pscope_state
455     {
456     	ACPI_STATE_COMMON
457     	struct acpi_parse_obj   *op;            /* current op being parsed */
458     	u8                      *arg_end;       /* current argument end */
459     	u8                      *pkg_end;       /* current package end */
460     	u32                     arg_list;       /* next argument to parse */
461     	u32                     arg_count;      /* Number of fixed arguments */
462     
463     } ACPI_PSCOPE_STATE;
464     
465     
466     /*
467      * Result values - used to accumulate the results of nested
468      * AML arguments
469      */
470     typedef struct acpi_result_values
471     {
472     	ACPI_STATE_COMMON
473     	union acpi_operand_obj  *obj_desc [OBJ_NUM_OPERANDS];
474     	u8                      num_results;
475     	u8                      last_insert;
476     
477     } ACPI_RESULT_VALUES;
478     
479     
480     /*
481      * Notify info - used to pass info to the deferred notify
482      * handler/dispatcher.
483      */
484     typedef struct acpi_notify_info
485     {
486     	ACPI_STATE_COMMON
487     	acpi_namespace_node     *node;
488     	union acpi_operand_obj  *handler_obj;
489     
490     } ACPI_NOTIFY_INFO;
491     
492     
493     /* Generic state is union of structs above */
494     
495     typedef union acpi_gen_state
496     {
497     	ACPI_COMMON_STATE       common;
498     	ACPI_CONTROL_STATE      control;
499     	ACPI_UPDATE_STATE       update;
500     	ACPI_SCOPE_STATE        scope;
501     	ACPI_PSCOPE_STATE       parse_scope;
502     	ACPI_PKG_STATE          pkg;
503     	ACPI_RESULT_VALUES      results;
504     	ACPI_NOTIFY_INFO        notify;
505     
506     } acpi_generic_state;
507     
508     
509     typedef
510     acpi_status (*acpi_parse_downwards) (
511     	u16                     opcode,
512     	struct acpi_parse_obj   *op,
513     	struct acpi_walk_state  *walk_state,
514     	struct acpi_parse_obj   **out_op);
515     
516     typedef
517     acpi_status (*acpi_parse_upwards) (
518     	struct acpi_walk_state  *walk_state,
519     	struct acpi_parse_obj   *op);
520     
521     
522     /*****************************************************************************
523      *
524      * Parser typedefs and structs
525      *
526      ****************************************************************************/
527     
528     #define ACPI_OP_CLASS_MASK              0x1F
529     #define ACPI_OP_ARGS_MASK               0x20
530     #define ACPI_OP_TYPE_MASK               0xC0
531     
532     #define ACPI_OP_TYPE_OPCODE             0x00
533     #define ACPI_OP_TYPE_ASCII              0x40
534     #define ACPI_OP_TYPE_PREFIX             0x80
535     #define ACPI_OP_TYPE_UNKNOWN            0xC0
536     
537     #define ACPI_GET_OP_CLASS(a)            ((a)->flags & ACPI_OP_CLASS_MASK)
538     #define ACPI_GET_OP_ARGS(a)             ((a)->flags & ACPI_OP_ARGS_MASK)
539     #define ACPI_GET_OP_TYPE(a)             ((a)->flags & ACPI_OP_TYPE_MASK)
540     
541     /*
542      * Flags byte: 0-4 (5 bits) = Opcode Class  (0x001F
543      *             5   (1 bit)  = Has arguments flag
544      *             6-7 (2 bits) = Reserved
545      */
546     #define AML_NO_ARGS         0
547     #define AML_HAS_ARGS        0x0020
548     #define AML_NSOBJECT        0x0100
549     #define AML_NSOPCODE        0x0200
550     #define AML_NSNODE          0x0400
551     #define AML_NAMED           0x0800
552     #define AML_DEFER           0x1000
553     #define AML_FIELD           0x2000
554     #define AML_CREATE          0x4000
555     
556     
557     /*
558      * AML opcode, name, and argument layout
559      */
560     typedef struct acpi_opcode_info
561     {
562     	u32                     parse_args;     /* Grammar/Parse time arguments */
563     	u32                     runtime_args;   /* Interpret time arguments */
564     	u16                     flags;          /* Opcode type, Has_args flag */
565     
566     #ifdef _OPCODE_NAMES
567     	NATIVE_CHAR             *name;          /* op name (debug only) */
568     #endif
569     
570     } acpi_opcode_info;
571     
572     
573     typedef union acpi_parse_val
574     {
575     	acpi_integer            integer;        /* integer constant (Up to 64 bits) */
576     	uint64_struct           integer64;      /* Structure overlay for 2 32-bit Dwords */
577     	u32                     integer32;      /* integer constant, 32 bits only */
578     	u16                     integer16;      /* integer constant, 16 bits only */
579     	u8                      integer8;       /* integer constant, 8 bits only */
580     	u32                     size;           /* bytelist or field size */
581     	NATIVE_CHAR             *string;        /* NULL terminated string */
582     	u8                      *buffer;        /* buffer or string */
583     	NATIVE_CHAR             *name;          /* NULL terminated string */
584     	struct acpi_parse_obj   *arg;           /* arguments and contained ops */
585     
586     } ACPI_PARSE_VALUE;
587     
588     
589     #define ACPI_PARSE_COMMON \
590     	u8                      data_type;      /* To differentiate various internal objs */\
591     	u8                      flags;          /* Type of Op */\
592     	u16                     opcode;         /* AML opcode */\
593     	u32                     aml_offset;     /* offset of declaration in AML */\
594     	struct acpi_parse_obj   *parent;        /* parent op */\
595     	struct acpi_parse_obj   *next;          /* next op */\
596     	DEBUG_ONLY_MEMBERS (\
597     	NATIVE_CHAR             op_name[16])    /* op name (debug only) */\
598     			  /* NON-DEBUG members below: */\
599     	acpi_namespace_node     *node;          /* for use by interpreter */\
600     	ACPI_PARSE_VALUE        value;          /* Value or args associated with the opcode */\
601     
602     
603     /*
604      * generic operation (eg. If, While, Store)
605      */
606     typedef struct acpi_parse_obj
607     {
608     	ACPI_PARSE_COMMON
609     } acpi_parse_object;
610     
611     
612     /*
613      * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and Op_regions),
614      * and bytelists.
615      */
616     typedef struct acpi_parse2_obj
617     {
618     	ACPI_PARSE_COMMON
619     	u8                      *data;          /* AML body or bytelist data */
620     	u32                     length;         /* AML length */
621     	u32                     name;           /* 4-byte name or zero if no name */
622     
623     } acpi_parse2_object;
624     
625     
626     /*
627      * Parse state - one state per parser invocation and each control
628      * method.
629      */
630     
631     typedef struct acpi_parse_state
632     {
633     	u8                      *aml_start;     /* first AML byte */
634     	u8                      *aml;           /* next AML byte */
635     	u8                      *aml_end;       /* (last + 1) AML byte */
636     	u8                      *pkg_start;     /* current package begin */
637     	u8                      *pkg_end;       /* current package end */
638     	acpi_parse_object       *start_op;      /* root of parse tree */
639     	struct acpi_node        *start_node;
640     	acpi_generic_state      *scope;         /* current scope */
641     	struct acpi_parse_state *next;
642     
643     } acpi_parse_state;
644     
645     
646     /*****************************************************************************
647      *
648      * Hardware and PNP
649      *
650      ****************************************************************************/
651     
652     
653     /* PCI */
654     #define PCI_ROOT_HID_STRING             "PNP0A03"
655     
656     /*
657      * The #define's and enum below establish an abstract way of identifying what
658      * register block and register is to be accessed.  Do not change any of the
659      * values as they are used in switch statements and offset calculations.
660      */
661     
662     #define REGISTER_BLOCK_MASK             0xFF00  /* Register Block Id    */
663     #define BIT_IN_REGISTER_MASK            0x00FF  /* Bit Id in the Register Block Id    */
664     #define BYTE_IN_REGISTER_MASK           0x00FF  /* Register Offset in the Register Block    */
665     
666     #define REGISTER_BLOCK_ID(reg_id)       (reg_id & REGISTER_BLOCK_MASK)
667     #define REGISTER_BIT_ID(reg_id)         (reg_id & BIT_IN_REGISTER_MASK)
668     #define REGISTER_OFFSET(reg_id)         (reg_id & BYTE_IN_REGISTER_MASK)
669     
670     /*
671      * Access Rule
672      *  To access a Register Bit:
673      *  -> Use Bit Name (= Register Block Id | Bit Id) defined in the enum.
674      *
675      *  To access a Register:
676      *  -> Use Register Id (= Register Block Id | Register Offset)
677      */
678     
679     
680     /*
681      * Register Block Id
682      */
683     #define PM1_STS                         0x0100
684     #define PM1_EN                          0x0200
685     #define PM1_CONTROL                     0x0300
686     #define PM1_a_CONTROL                   0x0400
687     #define PM1_b_CONTROL                   0x0500
688     #define PM2_CONTROL                     0x0600
689     #define PM_TIMER                        0x0700
690     #define PROCESSOR_BLOCK                 0x0800
691     #define GPE0_STS_BLOCK                  0x0900
692     #define GPE0_EN_BLOCK                   0x0A00
693     #define GPE1_STS_BLOCK                  0x0B00
694     #define GPE1_EN_BLOCK                   0x0C00
695     #define SMI_CMD_BLOCK                   0x0D00
696     
697     /*
698      * Address space bitmasks for mmio or io spaces
699      */
700     
701     #define SMI_CMD_ADDRESS_SPACE           0x01
702     #define PM1_BLK_ADDRESS_SPACE           0x02
703     #define PM2_CNT_BLK_ADDRESS_SPACE       0x04
704     #define PM_TMR_BLK_ADDRESS_SPACE        0x08
705     #define GPE0_BLK_ADDRESS_SPACE          0x10
706     #define GPE1_BLK_ADDRESS_SPACE          0x20
707     
708     /*
709      * Control bit definitions
710      */
711     #define TMR_STS                         (PM1_STS | 0x01)
712     #define BM_STS                          (PM1_STS | 0x02)
713     #define GBL_STS                         (PM1_STS | 0x03)
714     #define PWRBTN_STS                      (PM1_STS | 0x04)
715     #define SLPBTN_STS                      (PM1_STS | 0x05)
716     #define RTC_STS                         (PM1_STS | 0x06)
717     #define WAK_STS                         (PM1_STS | 0x07)
718     
719     #define TMR_EN                          (PM1_EN | 0x01)
720     			 /* no BM_EN */
721     #define GBL_EN                          (PM1_EN | 0x03)
722     #define PWRBTN_EN                       (PM1_EN | 0x04)
723     #define SLPBTN_EN                       (PM1_EN | 0x05)
724     #define RTC_EN                          (PM1_EN | 0x06)
725     #define WAK_EN                          (PM1_EN | 0x07)
726     
727     #define SCI_EN                          (PM1_CONTROL | 0x01)
728     #define BM_RLD                          (PM1_CONTROL | 0x02)
729     #define GBL_RLS                         (PM1_CONTROL | 0x03)
730     #define SLP_TYPE_A                      (PM1_CONTROL | 0x04)
731     #define SLP_TYPE_B                      (PM1_CONTROL | 0x05)
732     #define SLP_EN                          (PM1_CONTROL | 0x06)
733     
734     #define ARB_DIS                         (PM2_CONTROL | 0x01)
735     
736     #define TMR_VAL                         (PM_TIMER | 0x01)
737     
738     #define GPE0_STS                        (GPE0_STS_BLOCK | 0x01)
739     #define GPE0_EN                         (GPE0_EN_BLOCK  | 0x01)
740     
741     #define GPE1_STS                        (GPE1_STS_BLOCK | 0x01)
742     #define GPE1_EN                         (GPE1_EN_BLOCK  | 0x01)
743     
744     
745     #define TMR_STS_MASK                    0x0001
746     #define BM_STS_MASK                     0x0010
747     #define GBL_STS_MASK                    0x0020
748     #define PWRBTN_STS_MASK                 0x0100
749     #define SLPBTN_STS_MASK                 0x0200
750     #define RTC_STS_MASK                    0x0400
751     #define WAK_STS_MASK                    0x8000
752     
753     #define ALL_FIXED_STS_BITS              (TMR_STS_MASK   | BM_STS_MASK  | GBL_STS_MASK \
754     					  | PWRBTN_STS_MASK | SLPBTN_STS_MASK \
755     					  | RTC_STS_MASK | WAK_STS_MASK)
756     
757     #define TMR_EN_MASK                     0x0001
758     #define GBL_EN_MASK                     0x0020
759     #define PWRBTN_EN_MASK                  0x0100
760     #define SLPBTN_EN_MASK                  0x0200
761     #define RTC_EN_MASK                     0x0400
762     
763     #define SCI_EN_MASK                     0x0001
764     #define BM_RLD_MASK                     0x0002
765     #define GBL_RLS_MASK                    0x0004
766     #define SLP_TYPE_X_MASK                 0x1C00
767     #define SLP_EN_MASK                     0x2000
768     
769     #define ARB_DIS_MASK                    0x0001
770     #define TMR_VAL_MASK                    0xFFFFFFFF
771     
772     #define GPE0_STS_MASK
773     #define GPE0_EN_MASK
774     
775     #define GPE1_STS_MASK
776     #define GPE1_EN_MASK
777     
778     
779     #define ACPI_READ                       1
780     #define ACPI_WRITE                      2
781     
782     
783     /*****************************************************************************
784      *
785      * Resource descriptors
786      *
787      ****************************************************************************/
788     
789     
790     /* Resource_type values */
791     
792     #define RESOURCE_TYPE_MEMORY_RANGE              0
793     #define RESOURCE_TYPE_IO_RANGE                  1
794     #define RESOURCE_TYPE_BUS_NUMBER_RANGE          2
795     
796     /* Resource descriptor types and masks */
797     
798     #define RESOURCE_DESC_TYPE_LARGE                0x80
799     #define RESOURCE_DESC_TYPE_SMALL                0x00
800     
801     #define RESOURCE_DESC_TYPE_MASK                 0x80
802     #define RESOURCE_DESC_SMALL_MASK                0x78        /* Only bits 6:3 contain the type */
803     
804     
805     /*
806      * Small resource descriptor types
807      * Note: The 3 length bits (2:0) must be zero
808      */
809     #define RESOURCE_DESC_IRQ_FORMAT                0x20
810     #define RESOURCE_DESC_DMA_FORMAT                0x28
811     #define RESOURCE_DESC_START_DEPENDENT           0x30
812     #define RESOURCE_DESC_END_DEPENDENT             0x38
813     #define RESOURCE_DESC_IO_PORT                   0x40
814     #define RESOURCE_DESC_FIXED_IO_PORT             0x48
815     #define RESOURCE_DESC_SMALL_VENDOR              0x70
816     #define RESOURCE_DESC_END_TAG                   0x78
817     
818     /*
819      * Large resource descriptor types
820      */
821     
822     #define RESOURCE_DESC_MEMORY_24                 0x81
823     #define RESOURCE_DESC_GENERAL_REGISTER          0x82
824     #define RESOURCE_DESC_LARGE_VENDOR              0x84
825     #define RESOURCE_DESC_MEMORY_32                 0x85
826     #define RESOURCE_DESC_FIXED_MEMORY_32           0x86
827     #define RESOURCE_DESC_DWORD_ADDRESS_SPACE       0x87
828     #define RESOURCE_DESC_WORD_ADDRESS_SPACE        0x88
829     #define RESOURCE_DESC_EXTENDED_XRUPT            0x89
830     #define RESOURCE_DESC_QWORD_ADDRESS_SPACE       0x8A
831     
832     
833     /* String version of device HIDs and UIDs */
834     
835     #define ACPI_DEVICE_ID_LENGTH                   0x09
836     
837     typedef struct
838     {
839     	char            buffer[ACPI_DEVICE_ID_LENGTH];
840     
841     } ACPI_DEVICE_ID;
842     
843     
844     /*****************************************************************************
845      *
846      * Miscellaneous
847      *
848      ****************************************************************************/
849     
850     #define ASCII_ZERO                      0x30
851     
852     /*****************************************************************************
853      *
854      * Debugger
855      *
856      ****************************************************************************/
857     
858     typedef struct dbmethodinfo
859     {
860     	acpi_handle             thread_gate;
861     	NATIVE_CHAR             *name;
862     	NATIVE_CHAR             **args;
863     	u32                     flags;
864     	u32                     num_loops;
865     	NATIVE_CHAR             pathname[128];
866     
867     } db_method_info;
868     
869     
870     /*****************************************************************************
871      *
872      * Debug
873      *
874      ****************************************************************************/
875     
876     typedef struct
877     {
878     	u32                     component_id;
879     	NATIVE_CHAR             *proc_name;
880     	NATIVE_CHAR             *module_name;
881     
882     } ACPI_DEBUG_PRINT_INFO;
883     
884     
885     /* Entry for a memory allocation (debug only) */
886     
887     
888     #define MEM_MALLOC                      0
889     #define MEM_CALLOC                      1
890     #define MAX_MODULE_NAME                 16
891     
892     #define ACPI_COMMON_DEBUG_MEM_HEADER \
893     	struct acpi_debug_mem_block *previous; \
894     	struct acpi_debug_mem_block *next; \
895     	u32                         size; \
896     	u32                         component; \
897     	u32                         line; \
898     	NATIVE_CHAR                 module[MAX_MODULE_NAME]; \
899     	u8                          alloc_type;
900     
901     
902     typedef struct
903     {
904     	ACPI_COMMON_DEBUG_MEM_HEADER
905     
906     } ACPI_DEBUG_MEM_HEADER;
907     
908     typedef struct acpi_debug_mem_block
909     {
910     	ACPI_COMMON_DEBUG_MEM_HEADER
911     	UINT64                      user_space;
912     
913     } ACPI_DEBUG_MEM_BLOCK;
914     
915     
916     #define ACPI_MEM_LIST_GLOBAL            0
917     #define ACPI_MEM_LIST_NSNODE            1
918     
919     #define ACPI_MEM_LIST_FIRST_CACHE_LIST  2
920     #define ACPI_MEM_LIST_STATE             2
921     #define ACPI_MEM_LIST_PSNODE            3
922     #define ACPI_MEM_LIST_PSNODE_EXT        4
923     #define ACPI_MEM_LIST_OPERAND           5
924     #define ACPI_MEM_LIST_WALK              6
925     #define ACPI_MEM_LIST_MAX               6
926     #define ACPI_NUM_MEM_LISTS              7
927     
928     
929     typedef struct
930     {
931     	void                        *list_head;
932     	u16                         link_offset;
933     	u16                         max_cache_depth;
934     	u16                         cache_depth;
935     	u16                         object_size;
936     
937     #ifdef ACPI_DBG_TRACK_ALLOCATIONS
938     
939     	/* Statistics for debug memory tracking only */
940     
941     	u32                         total_allocated;
942     	u32                         total_freed;
943     	u32                         current_total_size;
944     	u32                         cache_requests;
945     	u32                         cache_hits;
946     	char                        *list_name;
947     #endif
948     
949     } ACPI_MEMORY_LIST;
950     
951     
952     #endif /* __ACLOCAL_H__ */
953