:pserver:cvsanon@mok.lvcm.com:/CVS/ReactOS reactos
[reactos.git] / drivers / bus / acpi / include / aclocal.h
1 /******************************************************************************
2  *
3  * Name: aclocal.h - Internal data types used across the ACPI subsystem
4  *       $Revision$
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 /* Object descriptor types */
37
38 #define ACPI_CACHED_OBJECT              0x11    /* ORed in when object is cached */
39 #define ACPI_DESC_TYPE_STATE            0x22
40 #define ACPI_DESC_TYPE_WALK             0x44
41 #define ACPI_DESC_TYPE_PARSER           0x66
42 #define ACPI_DESC_TYPE_INTERNAL         0x88
43 #define ACPI_DESC_TYPE_NAMED            0xAA
44
45
46 /*****************************************************************************
47  *
48  * Mutex typedefs and structs
49  *
50  ****************************************************************************/
51
52
53 /*
54  * Predefined handles for the mutex objects used within the subsystem
55  * All mutex objects are automatically created by Acpi_cm_mutex_initialize.
56  *
57  * The acquire/release ordering protocol is implied via this list.  Mutexes
58  * with a lower value must be acquired before mutexes with a higher value.
59  *
60  * NOTE: any changes here must be reflected in the Acpi_gbl_Mutex_names table also!
61  */
62
63 #define ACPI_MTX_EXECUTE                0
64 #define ACPI_MTX_INTERPRETER            1
65 #define ACPI_MTX_PARSER                 2
66 #define ACPI_MTX_DISPATCHER             3
67 #define ACPI_MTX_TABLES                 4
68 #define ACPI_MTX_OP_REGIONS             5
69 #define ACPI_MTX_NAMESPACE              6
70 #define ACPI_MTX_EVENTS                 7
71 #define ACPI_MTX_HARDWARE               8
72 #define ACPI_MTX_CACHES                 9
73 #define ACPI_MTX_MEMORY                 10
74 #define ACPI_MTX_DEBUG_CMD_COMPLETE     11
75 #define ACPI_MTX_DEBUG_CMD_READY        12
76
77 #define MAX_MTX                         12
78 #define NUM_MTX                         MAX_MTX+1
79
80
81 #if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER)
82 #ifdef DEFINE_ACPI_GLOBALS
83
84 /* Names for the mutexes used in the subsystem */
85
86 static NATIVE_CHAR          *acpi_gbl_mutex_names[] =
87 {
88         "ACPI_MTX_Execute",
89         "ACPI_MTX_Interpreter",
90         "ACPI_MTX_Parser",
91         "ACPI_MTX_Dispatcher",
92         "ACPI_MTX_Tables",
93         "ACPI_MTX_Op_regions",
94         "ACPI_MTX_Namespace",
95         "ACPI_MTX_Events",
96         "ACPI_MTX_Hardware",
97         "ACPI_MTX_Caches",
98         "ACPI_MTX_Memory",
99         "ACPI_MTX_Debug_cmd_complete"
100         "ACPI_MTX_Debug_cmd_ready",
101 };
102
103 #endif
104 #endif
105
106
107 /* Table for the global mutexes */
108
109 typedef struct acpi_mutex_info
110 {
111         ACPI_MUTEX                  mutex;
112         u32                         use_count;
113         u32                         owner_id;
114         u8                          locked;
115
116 } ACPI_MUTEX_INFO;
117
118
119 /* Lock flag parameter for various interfaces */
120
121 #define ACPI_MTX_DO_NOT_LOCK            0
122 #define ACPI_MTX_LOCK                   1
123
124
125 typedef u16                             ACPI_OWNER_ID;
126 #define OWNER_TYPE_TABLE                0x0
127 #define OWNER_TYPE_METHOD               0x1
128 #define FIRST_METHOD_ID                 0x0000
129 #define FIRST_TABLE_ID                  0x8000
130
131 /* TBD: [Restructure] get rid of the need for this! */
132
133 #define TABLE_ID_DSDT                   (ACPI_OWNER_ID) 0x8000
134
135
136 /*****************************************************************************
137  *
138  * Namespace typedefs and structs
139  *
140  ****************************************************************************/
141
142
143 /* Operational modes of the AML interpreter/scanner */
144
145 typedef enum
146 {
147         IMODE_LOAD_PASS1                = 0x01,
148         IMODE_LOAD_PASS2                = 0x02,
149         IMODE_EXECUTE                   = 0x0E
150
151 } OPERATING_MODE;
152
153
154 /*
155  * The Node describes a named object that appears in the AML
156  * An Acpi_node is used to store Nodes.
157  *
158  * Data_type is used to differentiate between internal descriptors, and MUST
159  * be the first byte in this structure.
160  */
161
162 typedef struct acpi_node
163 {
164         u8                      data_type;
165         u8                      type;           /* Type associated with this name */
166         u16                     owner_id;
167         u32                     name;           /* ACPI Name, always 4 chars per ACPI spec */
168
169
170         void                    *object;        /* Pointer to attached ACPI object (optional) */
171         struct acpi_node        *child;         /* first child */
172         struct acpi_node        *peer;          /* Next peer*/
173         u16                     reference_count; /* Current count of references and children */
174         u8                      flags;
175
176 } ACPI_NAMESPACE_NODE;
177
178
179 #define ENTRY_NOT_FOUND             NULL
180
181
182 /* Node flags */
183
184 #define ANOBJ_AML_ATTACHMENT            0x01
185 #define ANOBJ_END_OF_PEER_LIST          0x02
186 #define ANOBJ_DATA_WIDTH_32             0x04     /* Parent table is 64-bits */
187 #define ANOBJ_METHOD_ARG                0x08
188 #define ANOBJ_METHOD_LOCAL              0x10
189 #define ANOBJ_METHOD_NO_RETVAL          0x20
190 #define ANOBJ_METHOD_SOME_NO_RETVAL     0x40
191
192
193 /*
194  * ACPI Table Descriptor.  One per ACPI table
195  */
196 typedef struct acpi_table_desc
197 {
198         struct acpi_table_desc  *prev;
199         struct acpi_table_desc  *next;
200         struct acpi_table_desc  *installed_desc;
201         ACPI_TABLE_HEADER       *pointer;
202         void                    *base_pointer;
203         u8                      *aml_pointer;
204         UINT64                  physical_address;
205         u32                     aml_length;
206         u32                     length;
207         u32                     count;
208         ACPI_OWNER_ID           table_id;
209         u8                      type;
210         u8                      allocation;
211         u8                      loaded_into_namespace;
212
213 } ACPI_TABLE_DESC;
214
215
216 typedef struct
217 {
218         NATIVE_CHAR             *search_for;
219         ACPI_HANDLE             *list;
220         u32                     *count;
221
222 } FIND_CONTEXT;
223
224
225 typedef struct
226 {
227         ACPI_NAMESPACE_NODE     *node;
228 } NS_SEARCH_DATA;
229
230
231 /*
232  * Predefined Namespace items
233  */
234 #define ACPI_MAX_ADDRESS_SPACE          255
235 #define ACPI_NUM_ADDRESS_SPACES         256
236
237
238 typedef struct
239 {
240         NATIVE_CHAR             *name;
241         ACPI_OBJECT_TYPE        type;
242         NATIVE_CHAR             *val;
243
244 } PREDEFINED_NAMES;
245
246
247 /* Object types used during package copies */
248
249
250 #define ACPI_COPY_TYPE_SIMPLE           0
251 #define ACPI_COPY_TYPE_PACKAGE          1
252
253
254 /*****************************************************************************
255  *
256  * Event typedefs and structs
257  *
258  ****************************************************************************/
259
260
261 /* Status bits. */
262
263 #define ACPI_STATUS_PMTIMER             0x0001
264 #define ACPI_STATUS_GLOBAL              0x0020
265 #define ACPI_STATUS_POWER_BUTTON        0x0100
266 #define ACPI_STATUS_SLEEP_BUTTON        0x0200
267 #define ACPI_STATUS_RTC_ALARM           0x0400
268
269 /* Enable bits. */
270
271 #define ACPI_ENABLE_PMTIMER             0x0001
272 #define ACPI_ENABLE_GLOBAL              0x0020
273 #define ACPI_ENABLE_POWER_BUTTON        0x0100
274 #define ACPI_ENABLE_SLEEP_BUTTON        0x0200
275 #define ACPI_ENABLE_RTC_ALARM           0x0400
276
277
278 /*
279  * Entry in the Address_space (AKA Operation Region) table
280  */
281
282 typedef struct
283 {
284         ADDRESS_SPACE_HANDLER   handler;
285         void                    *context;
286
287 } ACPI_ADDRESS_SPACE_INFO;
288
289
290 /* Values and addresses of the GPE registers (both banks) */
291
292 typedef struct
293 {
294         u8                      status;         /* Current value of status reg */
295         u8                      enable;         /* Current value of enable reg */
296         u16                     status_addr;    /* Address of status reg */
297         u16                     enable_addr;    /* Address of enable reg */
298         u8                      gpe_base;       /* Base GPE number */
299
300 } ACPI_GPE_REGISTERS;
301
302
303 #define ACPI_GPE_LEVEL_TRIGGERED        1
304 #define ACPI_GPE_EDGE_TRIGGERED         2
305
306
307 /* Information about each particular GPE level */
308
309 typedef struct
310 {
311         u8                      type;           /* Level or Edge */
312
313         ACPI_HANDLE             method_handle;  /* Method handle for direct (fast) execution */
314         GPE_HANDLER             handler;        /* Address of handler, if any */
315         void                    *context;       /* Context to be passed to handler */
316
317 } ACPI_GPE_LEVEL_INFO;
318
319
320 /* Information about each particular fixed event */
321
322 typedef struct
323 {
324         FIXED_EVENT_HANDLER     handler;        /* Address of handler. */
325         void                    *context;       /* Context to be passed to handler */
326
327 } ACPI_FIXED_EVENT_INFO;
328
329
330 /* Information used during field processing */
331
332 typedef struct
333 {
334         u8                      skip_field;
335         u8                      field_flag;
336         u32                     pkg_length;
337
338 } ACPI_FIELD_INFO;
339
340
341 /*****************************************************************************
342  *
343  * Generic "state" object for stacks
344  *
345  ****************************************************************************/
346
347
348 #define CONTROL_NORMAL                  0xC0
349 #define CONTROL_CONDITIONAL_EXECUTING   0xC1
350 #define CONTROL_PREDICATE_EXECUTING     0xC2
351 #define CONTROL_PREDICATE_FALSE         0xC3
352 #define CONTROL_PREDICATE_TRUE          0xC4
353
354
355 /* Forward declarations */
356 struct acpi_walk_state;
357 struct acpi_walk_list;
358 struct acpi_parse_obj;
359 struct acpi_obj_mutex;
360
361
362 #define ACPI_STATE_COMMON                  /* Two 32-bit fields and a pointer */\
363         u8                      data_type;          /* To differentiate various internal objs */\
364         u8                      flags; \
365         u16                     value; \
366         u16                     state; \
367         u16                     acpi_eval; \
368         void                    *next; \
369
370 typedef struct acpi_common_state
371 {
372         ACPI_STATE_COMMON
373 } ACPI_COMMON_STATE;
374
375
376 /*
377  * Update state - used to traverse complex objects such as packages
378  */
379 typedef struct acpi_update_state
380 {
381         ACPI_STATE_COMMON
382         union acpi_operand_obj  *object;
383
384 } ACPI_UPDATE_STATE;
385
386
387 /*
388  * Pkg state - used to traverse nested package structures
389  */
390 typedef struct acpi_pkg_state
391 {
392         ACPI_STATE_COMMON
393         union acpi_operand_obj  *source_object;
394         union acpi_operand_obj  *dest_object;
395         struct acpi_walk_state  *walk_state;
396         void                    *this_target_obj;
397         u32                     num_packages;
398         u16                     index;
399
400 } ACPI_PKG_STATE;
401
402
403 /*
404  * Control state - one per if/else and while constructs.
405  * Allows nesting of these constructs
406  */
407 typedef struct acpi_control_state
408 {
409         ACPI_STATE_COMMON
410         struct acpi_parse_obj   *predicate_op;
411         u8                      *aml_predicate_start; /* Start of if/while predicate */
412
413 } ACPI_CONTROL_STATE;
414
415
416 /*
417  * Scope state - current scope during namespace lookups
418  */
419
420 typedef struct acpi_scope_state
421 {
422         ACPI_STATE_COMMON
423         ACPI_NAMESPACE_NODE     *node;
424
425 } ACPI_SCOPE_STATE;
426
427
428 typedef struct acpi_pscope_state
429 {
430         ACPI_STATE_COMMON
431         struct acpi_parse_obj   *op;            /* current op being parsed */
432         u8                      *arg_end;       /* current argument end */
433         u8                      *pkg_end;       /* current package end */
434         u32                     arg_list;       /* next argument to parse */
435         u32                     arg_count;      /* Number of fixed arguments */
436
437 } ACPI_PSCOPE_STATE;
438
439
440 /*
441  * Result values - used to accumulate the results of nested
442  * AML arguments
443  */
444 typedef struct acpi_result_values
445 {
446         ACPI_STATE_COMMON
447         union acpi_operand_obj  *obj_desc [OBJ_NUM_OPERANDS];
448         u8                      num_results;
449         u8                      last_insert;
450
451 } ACPI_RESULT_VALUES;
452
453
454 /*
455  * Notify info - used to pass info to the deferred notify
456  * handler/dispatcher.
457  */
458
459 typedef struct acpi_notify_info
460 {
461         ACPI_STATE_COMMON
462         ACPI_NAMESPACE_NODE     *node;
463         union acpi_operand_obj  *handler_obj;
464
465 } ACPI_NOTIFY_INFO;
466
467
468 /* Generic state is union of structs above */
469
470 typedef union acpi_gen_state
471 {
472         ACPI_COMMON_STATE       common;
473         ACPI_CONTROL_STATE      control;
474         ACPI_UPDATE_STATE       update;
475         ACPI_SCOPE_STATE        scope;
476         ACPI_PSCOPE_STATE       parse_scope;
477         ACPI_PKG_STATE          pkg;
478         ACPI_RESULT_VALUES      results;
479         ACPI_NOTIFY_INFO        notify;
480
481 } ACPI_GENERIC_STATE;
482
483
484 typedef
485 ACPI_STATUS (*ACPI_PARSE_DOWNWARDS) (
486         u16                     opcode,
487         struct acpi_parse_obj   *op,
488         struct acpi_walk_state  *walk_state,
489         struct acpi_parse_obj   **out_op);
490
491 typedef
492 ACPI_STATUS (*ACPI_PARSE_UPWARDS) (
493         struct acpi_walk_state  *walk_state,
494         struct acpi_parse_obj   *op);
495
496
497 /*****************************************************************************
498  *
499  * Parser typedefs and structs
500  *
501  ****************************************************************************/
502
503
504 #define ACPI_OP_CLASS_MASK              0x1F
505 #define ACPI_OP_ARGS_MASK               0x20
506 #define ACPI_OP_TYPE_MASK               0xC0
507
508 #define ACPI_OP_TYPE_OPCODE             0x00
509 #define ACPI_OP_TYPE_ASCII              0x40
510 #define ACPI_OP_TYPE_PREFIX             0x80
511 #define ACPI_OP_TYPE_UNKNOWN            0xC0
512
513 #define ACPI_GET_OP_CLASS(a)            ((a)->flags & ACPI_OP_CLASS_MASK)
514 #define ACPI_GET_OP_ARGS(a)             ((a)->flags & ACPI_OP_ARGS_MASK)
515 #define ACPI_GET_OP_TYPE(a)             ((a)->flags & ACPI_OP_TYPE_MASK)
516
517
518 /*
519  * AML opcode, name, and argument layout
520  */
521 typedef struct acpi_opcode_info
522 {
523         u8                      flags;          /* Opcode type, Has_args flag */
524         u32                     parse_args;     /* Grammar/Parse time arguments */
525         u32                     runtime_args;   /* Interpret time arguments */
526
527 #ifdef _OPCODE_NAMES
528         NATIVE_CHAR             *name;          /* op name (debug only) */
529 #endif
530
531 } ACPI_OPCODE_INFO;
532
533
534 typedef union acpi_parse_val
535 {
536         u32                     integer;        /* integer constant */
537         u32                     size;           /* bytelist or field size */
538         NATIVE_CHAR             *string;        /* NULL terminated string */
539         u8                      *buffer;        /* buffer or string */
540         NATIVE_CHAR             *name;          /* NULL terminated string */
541         struct acpi_parse_obj   *arg;           /* arguments and contained ops */
542
543 } ACPI_PARSE_VALUE;
544
545
546 #define ACPI_PARSE_COMMON \
547         u8                      data_type;      /* To differentiate various internal objs */\
548         u8                      flags;          /* Type of Op */\
549         u16                     opcode;         /* AML opcode */\
550         u32                     aml_offset;     /* offset of declaration in AML */\
551         struct acpi_parse_obj   *parent;        /* parent op */\
552         struct acpi_parse_obj   *next;          /* next op */\
553         DEBUG_ONLY_MEMBERS (\
554         NATIVE_CHAR             op_name[16])    /* op name (debug only) */\
555                           /* NON-DEBUG members below: */\
556         ACPI_NAMESPACE_NODE     *node;          /* for use by interpreter */\
557         ACPI_PARSE_VALUE        value;          /* Value or args associated with the opcode */\
558
559
560 /*
561  * generic operation (eg. If, While, Store)
562  */
563 typedef struct acpi_parse_obj
564 {
565         ACPI_PARSE_COMMON
566 } ACPI_PARSE_OBJECT;
567
568
569 /*
570  * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and Op_regions),
571  * and bytelists.
572  */
573 typedef struct acpi_parse2_obj
574 {
575         ACPI_PARSE_COMMON
576         u8                      *data;          /* AML body or bytelist data */
577         u32                     length;         /* AML length */
578         u32                     name;           /* 4-byte name or zero if no name */
579
580 } ACPI_PARSE2_OBJECT;
581
582
583 /*
584  * Parse state - one state per parser invocation and each control
585  * method.
586  */
587
588 typedef struct acpi_parse_state
589 {
590         u8                      *aml_start;     /* first AML byte */
591         u8                      *aml;           /* next AML byte */
592         u8                      *aml_end;       /* (last + 1) AML byte */
593         u8                      *pkg_start;     /* current package begin */
594         u8                      *pkg_end;       /* current package end */
595         ACPI_PARSE_OBJECT       *start_op;      /* root of parse tree */
596         struct acpi_node        *start_node;
597         ACPI_GENERIC_STATE      *scope;         /* current scope */
598         struct acpi_parse_state *next;
599
600 } ACPI_PARSE_STATE;
601
602
603 /*****************************************************************************
604  *
605  * Hardware and PNP
606  *
607  ****************************************************************************/
608
609
610 /* PCI */
611
612 #define PCI_ROOT_HID_STRING             "PNP0A03"
613 #define PCI_ROOT_HID_VALUE              0x030AD041       /* EISAID("PNP0A03") */
614
615
616 /* Sleep states */
617
618 #define SLWA_DEBUG_LEVEL                4
619 #define GTS_CALL                        0
620 #define GTS_WAKE                        1
621
622 /* Cx States */
623
624 #define MAX_CX_STATE_LATENCY            0xFFFFFFFF
625 #define MAX_CX_STATES                   4
626
627
628 /*
629  * The #define's and enum below establish an abstract way of identifying what
630  * register block and register is to be accessed.  Do not change any of the
631  * values as they are used in switch statements and offset calculations.
632  */
633
634 #define REGISTER_BLOCK_MASK             0xFF00  /* Register Block Id    */
635 #define BIT_IN_REGISTER_MASK            0x00FF  /* Bit Id in the Register Block Id    */
636 #define BYTE_IN_REGISTER_MASK           0x00FF  /* Register Offset in the Register Block    */
637
638 #define REGISTER_BLOCK_ID(reg_id)       (reg_id & REGISTER_BLOCK_MASK)
639 #define REGISTER_BIT_ID(reg_id)         (reg_id & BIT_IN_REGISTER_MASK)
640 #define REGISTER_OFFSET(reg_id)         (reg_id & BYTE_IN_REGISTER_MASK)
641
642 /*
643  * Access Rule
644  *  To access a Register Bit:
645  *  -> Use Bit Name (= Register Block Id | Bit Id) defined in the enum.
646  *
647  *  To access a Register:
648  *  -> Use Register Id (= Register Block Id | Register Offset)
649  */
650
651
652 /*
653  * Register Block Id
654  */
655 #define PM1_STS                         0x0100
656 #define PM1_EN                          0x0200
657 #define PM1_CONTROL                     0x0300
658 #define PM1_a_CONTROL                   0x0400
659 #define PM1_b_CONTROL                   0x0500
660 #define PM2_CONTROL                     0x0600
661 #define PM_TIMER                        0x0700
662 #define PROCESSOR_BLOCK                 0x0800
663 #define GPE0_STS_BLOCK                  0x0900
664 #define GPE0_EN_BLOCK                   0x0A00
665 #define GPE1_STS_BLOCK                  0x0B00
666 #define GPE1_EN_BLOCK                   0x0C00
667 #define SMI_CMD_BLOCK                   0x0D00
668
669 /*
670  * Address space bitmasks for mmio or io spaces
671  */
672
673 #define SMI_CMD_ADDRESS_SPACE           0x01
674 #define PM1_BLK_ADDRESS_SPACE           0x02
675 #define PM2_CNT_BLK_ADDRESS_SPACE       0x04
676 #define PM_TMR_BLK_ADDRESS_SPACE        0x08
677 #define GPE0_BLK_ADDRESS_SPACE          0x10
678 #define GPE1_BLK_ADDRESS_SPACE          0x20
679
680 /*
681  * Control bit definitions
682  */
683 #define TMR_STS                         (PM1_STS | 0x01)
684 #define BM_STS                          (PM1_STS | 0x02)
685 #define GBL_STS                         (PM1_STS | 0x03)
686 #define PWRBTN_STS                      (PM1_STS | 0x04)
687 #define SLPBTN_STS                      (PM1_STS | 0x05)
688 #define RTC_STS                         (PM1_STS | 0x06)
689 #define WAK_STS                         (PM1_STS | 0x07)
690
691 #define TMR_EN                          (PM1_EN | 0x01)
692                          /* no BM_EN */
693 #define GBL_EN                          (PM1_EN | 0x03)
694 #define PWRBTN_EN                       (PM1_EN | 0x04)
695 #define SLPBTN_EN                       (PM1_EN | 0x05)
696 #define RTC_EN                          (PM1_EN | 0x06)
697 #define WAK_EN                          (PM1_EN | 0x07)
698
699 #define SCI_EN                          (PM1_CONTROL | 0x01)
700 #define BM_RLD                          (PM1_CONTROL | 0x02)
701 #define GBL_RLS                         (PM1_CONTROL | 0x03)
702 #define SLP_TYPE_A                      (PM1_CONTROL | 0x04)
703 #define SLP_TYPE_B                      (PM1_CONTROL | 0x05)
704 #define SLP_EN                          (PM1_CONTROL | 0x06)
705
706 #define ARB_DIS                         (PM2_CONTROL | 0x01)
707
708 #define TMR_VAL                         (PM_TIMER | 0x01)
709
710 #define GPE0_STS                        (GPE0_STS_BLOCK | 0x01)
711 #define GPE0_EN                         (GPE0_EN_BLOCK  | 0x01)
712
713 #define GPE1_STS                        (GPE1_STS_BLOCK | 0x01)
714 #define GPE1_EN                         (GPE1_EN_BLOCK  | 0x01)
715
716
717 #define TMR_STS_MASK                    0x0001
718 #define BM_STS_MASK                     0x0010
719 #define GBL_STS_MASK                    0x0020
720 #define PWRBTN_STS_MASK                 0x0100
721 #define SLPBTN_STS_MASK                 0x0200
722 #define RTC_STS_MASK                    0x0400
723 #define WAK_STS_MASK                    0x8000
724
725 #define ALL_FIXED_STS_BITS              (TMR_STS_MASK   | BM_STS_MASK  | GBL_STS_MASK \
726                                           | PWRBTN_STS_MASK | SLPBTN_STS_MASK \
727                                           | RTC_STS_MASK | WAK_STS_MASK)
728
729 #define TMR_EN_MASK                     0x0001
730 #define GBL_EN_MASK                     0x0020
731 #define PWRBTN_EN_MASK                  0x0100
732 #define SLPBTN_EN_MASK                  0x0200
733 #define RTC_EN_MASK                     0x0400
734
735 #define SCI_EN_MASK                     0x0001
736 #define BM_RLD_MASK                     0x0002
737 #define GBL_RLS_MASK                    0x0004
738 #define SLP_TYPE_X_MASK                 0x1C00
739 #define SLP_EN_MASK                     0x2000
740
741 #define ARB_DIS_MASK                    0x0001
742 #define TMR_VAL_MASK                    0xFFFFFFFF
743
744 #define GPE0_STS_MASK
745 #define GPE0_EN_MASK
746
747 #define GPE1_STS_MASK
748 #define GPE1_EN_MASK
749
750
751 #define ACPI_READ                       1
752 #define ACPI_WRITE                      2
753
754
755 /* Plug and play */
756
757 /* Pnp and ACPI data */
758
759 #define VERSION_NO                      0x01
760 #define LOGICAL_DEVICE_ID               0x02
761 #define COMPATIBLE_DEVICE_ID            0x03
762 #define IRQ_FORMAT                      0x04
763 #define DMA_FORMAT                      0x05
764 #define START_DEPENDENT_TAG             0x06
765 #define END_DEPENDENT_TAG               0x07
766 #define IO_PORT_DESCRIPTOR              0x08
767 #define FIXED_LOCATION_IO_DESCRIPTOR    0x09
768 #define RESERVED_TYPE0                  0x0A
769 #define RESERVED_TYPE1                  0x0B
770 #define RESERVED_TYPE2                  0x0C
771 #define RESERVED_TYPE3                  0x0D
772 #define SMALL_VENDOR_DEFINED            0x0E
773 #define END_TAG                         0x0F
774
775 /* Pnp and ACPI data */
776
777 #define MEMORY_RANGE_24                 0x81
778 #define ISA_MEMORY_RANGE                0x81
779 #define LARGE_VENDOR_DEFINED            0x84
780 #define EISA_MEMORY_RANGE               0x85
781 #define MEMORY_RANGE_32                 0x85
782 #define FIXED_EISA_MEMORY_RANGE         0x86
783 #define FIXED_MEMORY_RANGE_32           0x86
784
785 /* ACPI only data */
786
787 #define DWORD_ADDRESS_SPACE             0x87
788 #define WORD_ADDRESS_SPACE              0x88
789 #define EXTENDED_IRQ                    0x89
790
791 /* MUST HAVES */
792
793 #define DEVICE_ID_LENGTH                0x09
794
795 typedef struct
796 {
797         NATIVE_CHAR             buffer[DEVICE_ID_LENGTH];
798
799 } DEVICE_ID;
800
801
802 /*****************************************************************************
803  *
804  * Debug
805  *
806  ****************************************************************************/
807
808
809 /* Entry for a memory allocation (debug only) */
810
811 #ifdef ACPI_DEBUG
812
813 #define MEM_MALLOC                      0
814 #define MEM_CALLOC                      1
815 #define MAX_MODULE_NAME                 16
816
817 typedef struct allocation_info
818 {
819         struct allocation_info  *previous;
820         struct allocation_info  *next;
821         void                    *address;
822         u32                     size;
823         u32                     component;
824         u32                     line;
825         NATIVE_CHAR             module[MAX_MODULE_NAME];
826         u8                      alloc_type;
827
828 } ALLOCATION_INFO;
829
830 #endif
831
832 #endif /* __ACLOCAL_H__ */