xref: /titanic_44/usr/src/uts/intel/sys/acpi/aclocal.h (revision 5151fb1220e0ceafdc172203863c73da4285c170)
1 /******************************************************************************
2  *
3  * Name: aclocal.h - Internal data types used across the ACPI subsystem
4  *       $Revision: 1.237 $
5  *
6  *****************************************************************************/
7 
8 /******************************************************************************
9  *
10  * 1. Copyright Notice
11  *
12  * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp.
13  * All rights reserved.
14  *
15  * 2. License
16  *
17  * 2.1. This is your license from Intel Corp. under its intellectual property
18  * rights.  You may have additional license terms from the party that provided
19  * you this software, covering your right to use that party's intellectual
20  * property rights.
21  *
22  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23  * copy of the source code appearing in this file ("Covered Code") an
24  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25  * base code distributed originally by Intel ("Original Intel Code") to copy,
26  * make derivatives, distribute, use and display any portion of the Covered
27  * Code in any form, with the right to sublicense such rights; and
28  *
29  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30  * license (with the right to sublicense), under only those claims of Intel
31  * patents that are infringed by the Original Intel Code, to make, use, sell,
32  * offer to sell, and import the Covered Code and derivative works thereof
33  * solely to the minimum extent necessary to exercise the above copyright
34  * license, and in no event shall the patent license extend to any additions
35  * to or modifications of the Original Intel Code.  No other license or right
36  * is granted directly or by implication, estoppel or otherwise;
37  *
38  * The above copyright and patent license is granted only if the following
39  * conditions are met:
40  *
41  * 3. Conditions
42  *
43  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44  * Redistribution of source code of any substantial portion of the Covered
45  * Code or modification with rights to further distribute source must include
46  * the above Copyright Notice, the above License, this list of Conditions,
47  * and the following Disclaimer and Export Compliance provision.  In addition,
48  * Licensee must cause all Covered Code to which Licensee contributes to
49  * contain a file documenting the changes Licensee made to create that Covered
50  * Code and the date of any change.  Licensee must include in that file the
51  * documentation of any changes made by any predecessor Licensee.  Licensee
52  * must include a prominent statement that the modification is derived,
53  * directly or indirectly, from Original Intel Code.
54  *
55  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56  * Redistribution of source code of any substantial portion of the Covered
57  * Code or modification without rights to further distribute source must
58  * include the following Disclaimer and Export Compliance provision in the
59  * documentation and/or other materials provided with distribution.  In
60  * addition, Licensee may not authorize further sublicense of source of any
61  * portion of the Covered Code, and must include terms to the effect that the
62  * license from Licensee to its licensee is limited to the intellectual
63  * property embodied in the software Licensee provides to its licensee, and
64  * not to intellectual property embodied in modifications its licensee may
65  * make.
66  *
67  * 3.3. Redistribution of Executable. Redistribution in executable form of any
68  * substantial portion of the Covered Code or modification must reproduce the
69  * above Copyright Notice, and the following Disclaimer and Export Compliance
70  * provision in the documentation and/or other materials provided with the
71  * distribution.
72  *
73  * 3.4. Intel retains all right, title, and interest in and to the Original
74  * Intel Code.
75  *
76  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77  * Intel shall be used in advertising or otherwise to promote the sale, use or
78  * other dealings in products derived from or relating to the Covered Code
79  * without prior written authorization from Intel.
80  *
81  * 4. Disclaimer and Export Compliance
82  *
83  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
86  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
87  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
88  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89  * PARTICULAR PURPOSE.
90  *
91  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
97  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98  * LIMITED REMEDY.
99  *
100  * 4.3. Licensee shall not export, either directly or indirectly, any of this
101  * software or system incorporating such software without first obtaining any
102  * required license or other approval from the U. S. Department of Commerce or
103  * any other agency or department of the United States Government.  In the
104  * event Licensee exports any such software from the United States or
105  * re-exports any such software from a foreign destination, Licensee shall
106  * ensure that the distribution and export/re-export of the software is in
107  * compliance with all laws, regulations, orders, or other restrictions of the
108  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109  * any of its subsidiaries will export/re-export any technical data, process,
110  * software, or service, directly or indirectly, to any country for which the
111  * United States government or any agency thereof requires an export license,
112  * other governmental approval, or letter of assurance, without first obtaining
113  * such license, approval or letter.
114  *
115  *****************************************************************************/
116 
117 #ifndef __ACLOCAL_H__
118 #define __ACLOCAL_H__
119 
120 /* acpisrc:StructDefs -- for acpisrc conversion */
121 
122 #define ACPI_WAIT_FOREVER               0xFFFF  /* UINT16, as per ACPI spec */
123 #define ACPI_DO_NOT_WAIT                0
124 #define ACPI_SERIALIZED                 0xFF
125 
126 typedef UINT32                          ACPI_MUTEX_HANDLE;
127 
128 /* Total number of aml opcodes defined */
129 
130 #define AML_NUM_OPCODES                 0x7F
131 
132 
133 /* Forward declarations */
134 
135 struct acpi_walk_state;
136 struct acpi_obj_mutex;
137 union acpi_parse_object;
138 
139 
140 /*****************************************************************************
141  *
142  * Mutex typedefs and structs
143  *
144  ****************************************************************************/
145 
146 
147 /*
148  * Predefined handles for the mutex objects used within the subsystem
149  * All mutex objects are automatically created by AcpiUtMutexInitialize.
150  *
151  * The acquire/release ordering protocol is implied via this list. Mutexes
152  * with a lower value must be acquired before mutexes with a higher value.
153  *
154  * NOTE: any changes here must be reflected in the AcpiGbl_MutexNames
155  * table below also!
156  */
157 #define ACPI_MTX_INTERPRETER            0   /* AML Interpreter, main lock */
158 #define ACPI_MTX_TABLES                 1   /* Data for ACPI tables */
159 #define ACPI_MTX_NAMESPACE              2   /* ACPI Namespace */
160 #define ACPI_MTX_EVENTS                 3   /* Data for ACPI events */
161 #define ACPI_MTX_CACHES                 4   /* Internal caches, general purposes */
162 #define ACPI_MTX_MEMORY                 5   /* Debug memory tracking lists */
163 #define ACPI_MTX_DEBUG_CMD_COMPLETE     6   /* AML debugger */
164 #define ACPI_MTX_DEBUG_CMD_READY        7   /* AML debugger */
165 
166 #define ACPI_MAX_MUTEX                  7
167 #define ACPI_NUM_MUTEX                  ACPI_MAX_MUTEX+1
168 
169 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
170 #ifdef DEFINE_ACPI_GLOBALS
171 
172 /* Debug names for the mutexes above */
173 
174 static char                 *AcpiGbl_MutexNames[ACPI_NUM_MUTEX] =
175 {
176     "ACPI_MTX_Interpreter",
177     "ACPI_MTX_Tables",
178     "ACPI_MTX_Namespace",
179     "ACPI_MTX_Events",
180     "ACPI_MTX_Caches",
181     "ACPI_MTX_Memory",
182     "ACPI_MTX_CommandComplete",
183     "ACPI_MTX_CommandReady"
184 };
185 
186 #endif
187 #endif
188 
189 
190 /*
191  * Predefined handles for spinlocks used within the subsystem.
192  * These spinlocks are created by AcpiUtMutexInitialize
193  */
194 #define ACPI_LOCK_GPES                  0
195 #define ACPI_LOCK_HARDWARE              1
196 
197 #define ACPI_MAX_LOCK                   1
198 #define ACPI_NUM_LOCK                   ACPI_MAX_LOCK+1
199 
200 
201 /* Owner IDs are used to track namespace nodes for selective deletion */
202 
203 typedef UINT8                           ACPI_OWNER_ID;
204 #define ACPI_OWNER_ID_MAX               0xFF
205 
206 /* This Thread ID means that the mutex is not in use (unlocked) */
207 
208 #define ACPI_MUTEX_NOT_ACQUIRED         (UINT32) -1
209 
210 /* Table for the global mutexes */
211 
212 typedef struct acpi_mutex_info
213 {
214     ACPI_MUTEX                      Mutex;
215     UINT32                          UseCount;
216     ACPI_THREAD_ID                  ThreadId;
217 
218 } ACPI_MUTEX_INFO;
219 
220 
221 /* Lock flag parameter for various interfaces */
222 
223 #define ACPI_MTX_DO_NOT_LOCK            0
224 #define ACPI_MTX_LOCK                   1
225 
226 
227 /* Field access granularities */
228 
229 #define ACPI_FIELD_BYTE_GRANULARITY     1
230 #define ACPI_FIELD_WORD_GRANULARITY     2
231 #define ACPI_FIELD_DWORD_GRANULARITY    4
232 #define ACPI_FIELD_QWORD_GRANULARITY    8
233 
234 
235 #define ACPI_ENTRY_NOT_FOUND            NULL
236 
237 
238 /*****************************************************************************
239  *
240  * Namespace typedefs and structs
241  *
242  ****************************************************************************/
243 
244 /* Operational modes of the AML interpreter/scanner */
245 
246 typedef enum
247 {
248     ACPI_IMODE_LOAD_PASS1           = 0x01,
249     ACPI_IMODE_LOAD_PASS2           = 0x02,
250     ACPI_IMODE_EXECUTE              = 0x0E
251 
252 } ACPI_INTERPRETER_MODE;
253 
254 typedef union acpi_name_union
255 {
256     UINT32                          Integer;
257     char                            Ascii[4];
258 
259 } ACPI_NAME_UNION;
260 
261 
262 /*
263  * The Namespace Node describes a named object that appears in the AML.
264  * DescriptorType is used to differentiate between internal descriptors.
265  *
266  * The node is optimized for both 32-bit and 64-bit platforms:
267  * 20 bytes for the 32-bit case, 32 bytes for the 64-bit case.
268  *
269  * Note: The DescriptorType and Type fields must appear in the identical
270  * position in both the ACPI_NAMESPACE_NODE and ACPI_OPERAND_OBJECT
271  * structures.
272  */
273 typedef struct acpi_namespace_node
274 {
275     union acpi_operand_object       *Object;        /* Interpreter object */
276     UINT8                           DescriptorType; /* Differentiate object descriptor types */
277     UINT8                           Type;           /* ACPI Type associated with this name */
278     UINT8                           Flags;          /* Miscellaneous flags */
279     ACPI_OWNER_ID                   OwnerId;        /* Node creator */
280     ACPI_NAME_UNION                 Name;           /* ACPI Name, always 4 chars per ACPI spec */
281     struct acpi_namespace_node      *Child;         /* First child */
282     struct acpi_namespace_node      *Peer;          /* Peer. Parent if ANOBJ_END_OF_PEER_LIST set */
283 
284     /*
285      * The following fields are used by the ASL compiler and disassembler only
286      */
287 #ifdef ACPI_LARGE_NAMESPACE_NODE
288     union acpi_parse_object         *Op;
289     UINT32                          Value;
290     UINT32                          Length;
291 #endif
292 
293 } ACPI_NAMESPACE_NODE;
294 
295 
296 /* Namespace Node flags */
297 
298 #define ANOBJ_END_OF_PEER_LIST          0x01    /* End-of-list, Peer field points to parent */
299 #define ANOBJ_RESERVED                  0x02    /* Available for future use */
300 #define ANOBJ_METHOD_ARG                0x04    /* Node is a method argument */
301 #define ANOBJ_METHOD_LOCAL              0x08    /* Node is a method local */
302 #define ANOBJ_SUBTREE_HAS_INI           0x10    /* Used to optimize device initialization */
303 
304 #define ANOBJ_IS_EXTERNAL               0x08    /* iASL only: This object created via External() */
305 #define ANOBJ_METHOD_NO_RETVAL          0x10    /* iASL only: Method has no return value */
306 #define ANOBJ_METHOD_SOME_NO_RETVAL     0x20    /* iASL only: Method has at least one return value */
307 #define ANOBJ_IS_BIT_OFFSET             0x40    /* iASL only: Reference is a bit offset */
308 #define ANOBJ_IS_REFERENCED             0x80    /* iASL only: Object was referenced */
309 
310 /*
311  * ACPI Table Descriptor.  One per ACPI table
312  */
313 typedef struct acpi_table_desc
314 {
315     struct acpi_table_desc          *Prev;
316     struct acpi_table_desc          *Next;
317     struct acpi_table_desc          *InstalledDesc;
318     ACPI_TABLE_HEADER               *Pointer;
319     UINT8                           *AmlStart;
320     UINT64                          PhysicalAddress;
321     ACPI_SIZE                       Length;
322     UINT32                          AmlLength;
323     ACPI_OWNER_ID                   OwnerId;
324     UINT8                           Type;
325     UINT8                           Allocation;
326     BOOLEAN                         LoadedIntoNamespace;
327 
328 } ACPI_TABLE_DESC;
329 
330 typedef struct acpi_table_list
331 {
332     struct acpi_table_desc          *Next;
333     UINT32                          Count;
334 
335 } ACPI_TABLE_LIST;
336 
337 
338 typedef struct acpi_find_context
339 {
340     char                            *SearchFor;
341     ACPI_HANDLE                     *List;
342     UINT32                          *Count;
343 
344 } ACPI_FIND_CONTEXT;
345 
346 
347 typedef struct acpi_ns_search_data
348 {
349     ACPI_NAMESPACE_NODE             *Node;
350 
351 } ACPI_NS_SEARCH_DATA;
352 
353 
354 /*
355  * Predefined Namespace items
356  */
357 typedef struct acpi_predefined_names
358 {
359     char                            *Name;
360     UINT8                           Type;
361     char                            *Val;
362 
363 } ACPI_PREDEFINED_NAMES;
364 
365 
366 /* Object types used during package copies */
367 
368 #define ACPI_COPY_TYPE_SIMPLE           0
369 #define ACPI_COPY_TYPE_PACKAGE          1
370 
371 
372 /* Info structure used to convert external<->internal namestrings */
373 
374 typedef struct acpi_namestring_info
375 {
376     char                            *ExternalName;
377     char                            *NextExternalChar;
378     char                            *InternalName;
379     UINT32                          Length;
380     UINT32                          NumSegments;
381     UINT32                          NumCarats;
382     BOOLEAN                         FullyQualified;
383 
384 } ACPI_NAMESTRING_INFO;
385 
386 
387 /* Field creation info */
388 
389 typedef struct acpi_create_field_info
390 {
391     ACPI_NAMESPACE_NODE             *RegionNode;
392     ACPI_NAMESPACE_NODE             *FieldNode;
393     ACPI_NAMESPACE_NODE             *RegisterNode;
394     ACPI_NAMESPACE_NODE             *DataRegisterNode;
395     UINT32                          BankValue;
396     UINT32                          FieldBitPosition;
397     UINT32                          FieldBitLength;
398     UINT8                           FieldFlags;
399     UINT8                           Attribute;
400     UINT8                           FieldType;
401 
402 } ACPI_CREATE_FIELD_INFO;
403 
404 
405 typedef
406 ACPI_STATUS (*ACPI_INTERNAL_METHOD) (
407     struct acpi_walk_state          *WalkState);
408 
409 
410 /*
411  * Bitmapped ACPI types.  Used internally only
412  */
413 #define ACPI_BTYPE_ANY                  0x00000000
414 #define ACPI_BTYPE_INTEGER              0x00000001
415 #define ACPI_BTYPE_STRING               0x00000002
416 #define ACPI_BTYPE_BUFFER               0x00000004
417 #define ACPI_BTYPE_PACKAGE              0x00000008
418 #define ACPI_BTYPE_FIELD_UNIT           0x00000010
419 #define ACPI_BTYPE_DEVICE               0x00000020
420 #define ACPI_BTYPE_EVENT                0x00000040
421 #define ACPI_BTYPE_METHOD               0x00000080
422 #define ACPI_BTYPE_MUTEX                0x00000100
423 #define ACPI_BTYPE_REGION               0x00000200
424 #define ACPI_BTYPE_POWER                0x00000400
425 #define ACPI_BTYPE_PROCESSOR            0x00000800
426 #define ACPI_BTYPE_THERMAL              0x00001000
427 #define ACPI_BTYPE_BUFFER_FIELD         0x00002000
428 #define ACPI_BTYPE_DDB_HANDLE           0x00004000
429 #define ACPI_BTYPE_DEBUG_OBJECT         0x00008000
430 #define ACPI_BTYPE_REFERENCE            0x00010000
431 #define ACPI_BTYPE_RESOURCE             0x00020000
432 
433 #define ACPI_BTYPE_COMPUTE_DATA         (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
434 
435 #define ACPI_BTYPE_DATA                 (ACPI_BTYPE_COMPUTE_DATA  | ACPI_BTYPE_PACKAGE)
436 #define ACPI_BTYPE_DATA_REFERENCE       (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
437 #define ACPI_BTYPE_DEVICE_OBJECTS       (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
438 #define ACPI_BTYPE_OBJECTS_AND_REFS     0x0001FFFF  /* ARG or LOCAL */
439 #define ACPI_BTYPE_ALL_OBJECTS          0x0000FFFF
440 
441 
442 /*****************************************************************************
443  *
444  * Event typedefs and structs
445  *
446  ****************************************************************************/
447 
448 /* Dispatch info for each GPE -- either a method or handler, cannot be both */
449 
450 typedef struct acpi_handler_info
451 {
452     ACPI_EVENT_HANDLER              Address;        /* Address of handler, if any */
453     void                            *Context;       /* Context to be passed to handler */
454     ACPI_NAMESPACE_NODE             *MethodNode;    /* Method node for this GPE level (saved) */
455 
456 } ACPI_HANDLER_INFO;
457 
458 typedef union acpi_gpe_dispatch_info
459 {
460     ACPI_NAMESPACE_NODE             *MethodNode;    /* Method node for this GPE level */
461     struct acpi_handler_info        *Handler;
462 
463 } ACPI_GPE_DISPATCH_INFO;
464 
465 /*
466  * Information about a GPE, one per each GPE in an array.
467  * NOTE: Important to keep this struct as small as possible.
468  */
469 typedef struct acpi_gpe_event_info
470 {
471     union acpi_gpe_dispatch_info    Dispatch;       /* Either Method or Handler */
472     struct acpi_gpe_register_info   *RegisterInfo;  /* Backpointer to register info */
473     UINT8                           Flags;          /* Misc info about this GPE */
474     UINT8                           RegisterBit;    /* This GPE bit within the register */
475 
476 } ACPI_GPE_EVENT_INFO;
477 
478 /* Information about a GPE register pair, one per each status/enable pair in an array */
479 
480 typedef struct acpi_gpe_register_info
481 {
482     ACPI_GENERIC_ADDRESS            StatusAddress;  /* Address of status reg */
483     ACPI_GENERIC_ADDRESS            EnableAddress;  /* Address of enable reg */
484     UINT8                           EnableForWake;  /* GPEs to keep enabled when sleeping */
485     UINT8                           EnableForRun;   /* GPEs to keep enabled when running */
486     UINT8                           BaseGpeNumber;  /* Base GPE number for this register */
487 
488 } ACPI_GPE_REGISTER_INFO;
489 
490 /*
491  * Information about a GPE register block, one per each installed block --
492  * GPE0, GPE1, and one per each installed GPE Block Device.
493  */
494 typedef struct acpi_gpe_block_info
495 {
496     ACPI_NAMESPACE_NODE             *Node;
497     struct acpi_gpe_block_info      *Previous;
498     struct acpi_gpe_block_info      *Next;
499     struct acpi_gpe_xrupt_info      *XruptBlock;    /* Backpointer to interrupt block */
500     ACPI_GPE_REGISTER_INFO          *RegisterInfo;  /* One per GPE register pair */
501     ACPI_GPE_EVENT_INFO             *EventInfo;     /* One for each GPE */
502     ACPI_GENERIC_ADDRESS            BlockAddress;   /* Base address of the block */
503     UINT32                          RegisterCount;  /* Number of register pairs in block */
504     UINT8                           BlockBaseNumber;/* Base GPE number for this block */
505 
506 } ACPI_GPE_BLOCK_INFO;
507 
508 /* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */
509 
510 typedef struct acpi_gpe_xrupt_info
511 {
512     struct acpi_gpe_xrupt_info      *Previous;
513     struct acpi_gpe_xrupt_info      *Next;
514     ACPI_GPE_BLOCK_INFO             *GpeBlockListHead;  /* List of GPE blocks for this xrupt */
515     UINT32                          InterruptNumber;    /* System interrupt number */
516 
517 } ACPI_GPE_XRUPT_INFO;
518 
519 
520 typedef struct acpi_gpe_walk_info
521 {
522     ACPI_NAMESPACE_NODE             *GpeDevice;
523     ACPI_GPE_BLOCK_INFO             *GpeBlock;
524 
525 } ACPI_GPE_WALK_INFO;
526 
527 
528 typedef ACPI_STATUS (*ACPI_GPE_CALLBACK) (
529     ACPI_GPE_XRUPT_INFO             *GpeXruptInfo,
530     ACPI_GPE_BLOCK_INFO             *GpeBlock);
531 
532 
533 /* Information about each particular fixed event */
534 
535 typedef struct acpi_fixed_event_handler
536 {
537     ACPI_EVENT_HANDLER              Handler;        /* Address of handler. */
538     void                            *Context;       /* Context to be passed to handler */
539 
540 } ACPI_FIXED_EVENT_HANDLER;
541 
542 typedef struct acpi_fixed_event_info
543 {
544     UINT8                           StatusRegisterId;
545     UINT8                           EnableRegisterId;
546     UINT16                          StatusBitMask;
547     UINT16                          EnableBitMask;
548 
549 } ACPI_FIXED_EVENT_INFO;
550 
551 /* Information used during field processing */
552 
553 typedef struct acpi_field_info
554 {
555     UINT8                           SkipField;
556     UINT8                           FieldFlag;
557     UINT32                          PkgLength;
558 
559 } ACPI_FIELD_INFO;
560 
561 
562 /*****************************************************************************
563  *
564  * Generic "state" object for stacks
565  *
566  ****************************************************************************/
567 
568 #define ACPI_CONTROL_NORMAL                  0xC0
569 #define ACPI_CONTROL_CONDITIONAL_EXECUTING   0xC1
570 #define ACPI_CONTROL_PREDICATE_EXECUTING     0xC2
571 #define ACPI_CONTROL_PREDICATE_FALSE         0xC3
572 #define ACPI_CONTROL_PREDICATE_TRUE          0xC4
573 
574 
575 #define ACPI_STATE_COMMON \
576     void                            *Next; \
577     UINT8                           DescriptorType; /* To differentiate various internal objs */\
578     UINT8                           Flags; \
579     UINT16                          Value; \
580     UINT16                          State;
581 
582     /* There are 2 bytes available here until the next natural alignment boundary */
583 
584 typedef struct acpi_common_state
585 {
586     ACPI_STATE_COMMON
587 } ACPI_COMMON_STATE;
588 
589 
590 /*
591  * Update state - used to traverse complex objects such as packages
592  */
593 typedef struct acpi_update_state
594 {
595     ACPI_STATE_COMMON
596     union acpi_operand_object       *Object;
597 
598 } ACPI_UPDATE_STATE;
599 
600 
601 /*
602  * Pkg state - used to traverse nested package structures
603  */
604 typedef struct acpi_pkg_state
605 {
606     ACPI_STATE_COMMON
607     UINT16                          Index;
608     union acpi_operand_object       *SourceObject;
609     union acpi_operand_object       *DestObject;
610     struct acpi_walk_state          *WalkState;
611     void                            *ThisTargetObj;
612     UINT32                          NumPackages;
613 
614 } ACPI_PKG_STATE;
615 
616 
617 /*
618  * Control state - one per if/else and while constructs.
619  * Allows nesting of these constructs
620  */
621 typedef struct acpi_control_state
622 {
623     ACPI_STATE_COMMON
624     UINT16                          Opcode;
625     union acpi_parse_object         *PredicateOp;
626     UINT8                           *AmlPredicateStart;     /* Start of if/while predicate */
627     UINT8                           *PackageEnd;            /* End of if/while block */
628 
629 } ACPI_CONTROL_STATE;
630 
631 
632 /*
633  * Scope state - current scope during namespace lookups
634  */
635 typedef struct acpi_scope_state
636 {
637     ACPI_STATE_COMMON
638     ACPI_NAMESPACE_NODE             *Node;
639 
640 } ACPI_SCOPE_STATE;
641 
642 
643 typedef struct acpi_pscope_state
644 {
645     ACPI_STATE_COMMON
646     UINT32                          ArgCount;               /* Number of fixed arguments */
647     union acpi_parse_object         *Op;                    /* Current op being parsed */
648     UINT8                           *ArgEnd;                /* Current argument end */
649     UINT8                           *PkgEnd;                /* Current package end */
650     UINT32                          ArgList;                /* Next argument to parse */
651 
652 } ACPI_PSCOPE_STATE;
653 
654 
655 /*
656  * Thread state - one per thread across multiple walk states.  Multiple walk
657  * states are created when there are nested control methods executing.
658  */
659 typedef struct acpi_thread_state
660 {
661     ACPI_STATE_COMMON
662     UINT8                           CurrentSyncLevel;       /* Mutex Sync (nested acquire) level */
663     struct acpi_walk_state          *WalkStateList;         /* Head of list of WalkStates for this thread */
664     union acpi_operand_object       *AcquiredMutexList;     /* List of all currently acquired mutexes */
665     ACPI_THREAD_ID                  ThreadId;               /* Running thread ID */
666 
667 } ACPI_THREAD_STATE;
668 
669 
670 /*
671  * Result values - used to accumulate the results of nested
672  * AML arguments
673  */
674 typedef struct acpi_result_values
675 {
676     ACPI_STATE_COMMON
677     UINT8                           NumResults;
678     UINT8                           LastInsert;
679     union acpi_operand_object       *ObjDesc [ACPI_OBJ_NUM_OPERANDS];
680 
681 } ACPI_RESULT_VALUES;
682 
683 
684 typedef
685 ACPI_STATUS (*ACPI_PARSE_DOWNWARDS) (
686     struct acpi_walk_state          *WalkState,
687     union acpi_parse_object         **OutOp);
688 
689 typedef
690 ACPI_STATUS (*ACPI_PARSE_UPWARDS) (
691     struct acpi_walk_state          *WalkState);
692 
693 
694 /*
695  * Notify info - used to pass info to the deferred notify
696  * handler/dispatcher.
697  */
698 typedef struct acpi_notify_info
699 {
700     ACPI_STATE_COMMON
701     ACPI_NAMESPACE_NODE             *Node;
702     union acpi_operand_object       *HandlerObj;
703 
704 } ACPI_NOTIFY_INFO;
705 
706 
707 /* Generic state is union of structs above */
708 
709 typedef union acpi_generic_state
710 {
711     ACPI_COMMON_STATE               Common;
712     ACPI_CONTROL_STATE              Control;
713     ACPI_UPDATE_STATE               Update;
714     ACPI_SCOPE_STATE                Scope;
715     ACPI_PSCOPE_STATE               ParseScope;
716     ACPI_PKG_STATE                  Pkg;
717     ACPI_THREAD_STATE               Thread;
718     ACPI_RESULT_VALUES              Results;
719     ACPI_NOTIFY_INFO                Notify;
720 
721 } ACPI_GENERIC_STATE;
722 
723 
724 /*****************************************************************************
725  *
726  * Interpreter typedefs and structs
727  *
728  ****************************************************************************/
729 
730 typedef
731 ACPI_STATUS (*ACPI_EXECUTE_OP) (
732     struct acpi_walk_state          *WalkState);
733 
734 
735 /*****************************************************************************
736  *
737  * Parser typedefs and structs
738  *
739  ****************************************************************************/
740 
741 /*
742  * AML opcode, name, and argument layout
743  */
744 typedef struct acpi_opcode_info
745 {
746 #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
747     char                            *Name;          /* Opcode name (disassembler/debug only) */
748 #endif
749     UINT32                          ParseArgs;      /* Grammar/Parse time arguments */
750     UINT32                          RuntimeArgs;    /* Interpret time arguments */
751     UINT16                          Flags;          /* Misc flags */
752     UINT8                           ObjectType;     /* Corresponding internal object type */
753     UINT8                           Class;          /* Opcode class */
754     UINT8                           Type;           /* Opcode type */
755 
756 } ACPI_OPCODE_INFO;
757 
758 typedef union acpi_parse_value
759 {
760     ACPI_INTEGER                    Integer;        /* Integer constant (Up to 64 bits) */
761     UINT64_STRUCT                   Integer64;      /* Structure overlay for 2 32-bit Dwords */
762     UINT32                          Size;           /* bytelist or field size */
763     char                            *String;        /* NULL terminated string */
764     UINT8                           *Buffer;        /* buffer or string */
765     char                            *Name;          /* NULL terminated string */
766     union acpi_parse_object         *Arg;           /* arguments and contained ops */
767 
768 } ACPI_PARSE_VALUE;
769 
770 #define ACPI_PARSE_COMMON \
771     union acpi_parse_object         *Parent;        /* Parent op */\
772     UINT8                           DescriptorType; /* To differentiate various internal objs */\
773     UINT8                           Flags;          /* Type of Op */\
774     UINT16                          AmlOpcode;      /* AML opcode */\
775     UINT32                          AmlOffset;      /* Offset of declaration in AML */\
776     union acpi_parse_object         *Next;          /* Next op */\
777     ACPI_NAMESPACE_NODE             *Node;          /* For use by interpreter */\
778     ACPI_PARSE_VALUE                Value;          /* Value or args associated with the opcode */\
779     ACPI_DISASM_ONLY_MEMBERS (\
780     UINT8                           DisasmFlags;    /* Used during AML disassembly */\
781     UINT8                           DisasmOpcode;   /* Subtype used for disassembly */\
782     char                            AmlOpName[16])  /* Op name (debug only) */
783 
784 
785 #define ACPI_DASM_BUFFER                0x00
786 #define ACPI_DASM_RESOURCE              0x01
787 #define ACPI_DASM_STRING                0x02
788 #define ACPI_DASM_UNICODE               0x03
789 #define ACPI_DASM_EISAID                0x04
790 #define ACPI_DASM_MATCHOP               0x05
791 #define ACPI_DASM_LNOT_PREFIX           0x06
792 #define ACPI_DASM_LNOT_SUFFIX           0x07
793 #define ACPI_DASM_IGNORE                0x08
794 
795 /*
796  * Generic operation (for example:  If, While, Store)
797  */
798 typedef struct acpi_parse_obj_common
799 {
800     ACPI_PARSE_COMMON
801 } ACPI_PARSE_OBJ_COMMON;
802 
803 
804 /*
805  * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and OpRegions),
806  * and bytelists.
807  */
808 typedef struct acpi_parse_obj_named
809 {
810     ACPI_PARSE_COMMON
811     UINT8                           *Path;
812     UINT8                           *Data;          /* AML body or bytelist data */
813     UINT32                          Length;         /* AML length */
814     UINT32                          Name;           /* 4-byte name or zero if no name */
815 
816 } ACPI_PARSE_OBJ_NAMED;
817 
818 
819 /* This version is used by the iASL compiler only */
820 
821 #define ACPI_MAX_PARSEOP_NAME   20
822 
823 typedef struct acpi_parse_obj_asl
824 {
825     ACPI_PARSE_COMMON
826     union acpi_parse_object         *Child;
827     union acpi_parse_object         *ParentMethod;
828     char                            *Filename;
829     char                            *ExternalName;
830     char                            *Namepath;
831     char                            NameSeg[4];
832     UINT32                          ExtraValue;
833     UINT32                          Column;
834     UINT32                          LineNumber;
835     UINT32                          LogicalLineNumber;
836     UINT32                          LogicalByteOffset;
837     UINT32                          EndLine;
838     UINT32                          EndLogicalLine;
839     UINT32                          AcpiBtype;
840     UINT32                          AmlLength;
841     UINT32                          AmlSubtreeLength;
842     UINT32                          FinalAmlLength;
843     UINT32                          FinalAmlOffset;
844     UINT32                          CompileFlags;
845     UINT16                          ParseOpcode;
846     UINT8                           AmlOpcodeLength;
847     UINT8                           AmlPkgLenBytes;
848     UINT8                           Extra;
849     char                            ParseOpName[ACPI_MAX_PARSEOP_NAME];
850 
851 } ACPI_PARSE_OBJ_ASL;
852 
853 typedef union acpi_parse_object
854 {
855     ACPI_PARSE_OBJ_COMMON           Common;
856     ACPI_PARSE_OBJ_NAMED            Named;
857     ACPI_PARSE_OBJ_ASL              Asl;
858 
859 } ACPI_PARSE_OBJECT;
860 
861 
862 /*
863  * Parse state - one state per parser invocation and each control
864  * method.
865  */
866 typedef struct acpi_parse_state
867 {
868     UINT8                           *AmlStart;      /* First AML byte */
869     UINT8                           *Aml;           /* Next AML byte */
870     UINT8                           *AmlEnd;        /* (last + 1) AML byte */
871     UINT8                           *PkgStart;      /* Current package begin */
872     UINT8                           *PkgEnd;        /* Current package end */
873     union acpi_parse_object         *StartOp;       /* Root of parse tree */
874     struct acpi_namespace_node      *StartNode;
875     union acpi_generic_state        *Scope;         /* Current scope */
876     union acpi_parse_object         *StartScope;
877     UINT32                          AmlSize;
878 
879 } ACPI_PARSE_STATE;
880 
881 
882 /* Parse object flags */
883 
884 #define ACPI_PARSEOP_GENERIC            0x01
885 #define ACPI_PARSEOP_NAMED              0x02
886 #define ACPI_PARSEOP_DEFERRED           0x04
887 #define ACPI_PARSEOP_BYTELIST           0x08
888 #define ACPI_PARSEOP_IN_CACHE           0x80
889 
890 /* Parse object DisasmFlags */
891 
892 #define ACPI_PARSEOP_IGNORE             0x01
893 #define ACPI_PARSEOP_PARAMLIST          0x02
894 #define ACPI_PARSEOP_EMPTY_TERMLIST     0x04
895 #define ACPI_PARSEOP_SPECIAL            0x10
896 
897 
898 /*****************************************************************************
899  *
900  * Hardware (ACPI registers) and PNP
901  *
902  ****************************************************************************/
903 
904 #define PCI_ROOT_HID_STRING             "PNP0A03"
905 #define PCI_EXPRESS_ROOT_HID_STRING     "PNP0A08"
906 
907 typedef struct acpi_bit_register_info
908 {
909     UINT8                           ParentRegister;
910     UINT8                           BitPosition;
911     UINT16                          AccessBitMask;
912 
913 } ACPI_BIT_REGISTER_INFO;
914 
915 
916 /*
917  * Some ACPI registers have bits that must be ignored -- meaning that they
918  * must be preserved.
919  */
920 #define ACPI_PM1_STATUS_PRESERVED_BITS          0x0800  /* Bit 11 */
921 #define ACPI_PM1_CONTROL_PRESERVED_BITS         0x0201  /* Bit 9, Bit 0 (SCI_EN) */
922 
923 
924 /*
925  * Register IDs
926  * These are the full ACPI registers
927  */
928 #define ACPI_REGISTER_PM1_STATUS                0x01
929 #define ACPI_REGISTER_PM1_ENABLE                0x02
930 #define ACPI_REGISTER_PM1_CONTROL               0x03
931 #define ACPI_REGISTER_PM1A_CONTROL              0x04
932 #define ACPI_REGISTER_PM1B_CONTROL              0x05
933 #define ACPI_REGISTER_PM2_CONTROL               0x06
934 #define ACPI_REGISTER_PM_TIMER                  0x07
935 #define ACPI_REGISTER_PROCESSOR_BLOCK           0x08
936 #define ACPI_REGISTER_SMI_COMMAND_BLOCK         0x09
937 
938 
939 /* Masks used to access the BitRegisters */
940 
941 #define ACPI_BITMASK_TIMER_STATUS               0x0001
942 #define ACPI_BITMASK_BUS_MASTER_STATUS          0x0010
943 #define ACPI_BITMASK_GLOBAL_LOCK_STATUS         0x0020
944 #define ACPI_BITMASK_POWER_BUTTON_STATUS        0x0100
945 #define ACPI_BITMASK_SLEEP_BUTTON_STATUS        0x0200
946 #define ACPI_BITMASK_RT_CLOCK_STATUS            0x0400
947 #define ACPI_BITMASK_PCIEXP_WAKE_STATUS         0x4000    /* ACPI 3.0 */
948 #define ACPI_BITMASK_WAKE_STATUS                0x8000
949 
950 #define ACPI_BITMASK_ALL_FIXED_STATUS           (\
951     ACPI_BITMASK_TIMER_STATUS          | \
952     ACPI_BITMASK_BUS_MASTER_STATUS     | \
953     ACPI_BITMASK_GLOBAL_LOCK_STATUS    | \
954     ACPI_BITMASK_POWER_BUTTON_STATUS   | \
955     ACPI_BITMASK_SLEEP_BUTTON_STATUS   | \
956     ACPI_BITMASK_RT_CLOCK_STATUS       | \
957     ACPI_BITMASK_WAKE_STATUS)
958 
959 #define ACPI_BITMASK_TIMER_ENABLE               0x0001
960 #define ACPI_BITMASK_GLOBAL_LOCK_ENABLE         0x0020
961 #define ACPI_BITMASK_POWER_BUTTON_ENABLE        0x0100
962 #define ACPI_BITMASK_SLEEP_BUTTON_ENABLE        0x0200
963 #define ACPI_BITMASK_RT_CLOCK_ENABLE            0x0400
964 #define ACPI_BITMASK_PCIEXP_WAKE_DISABLE        0x4000    /* ACPI 3.0 */
965 
966 #define ACPI_BITMASK_SCI_ENABLE                 0x0001
967 #define ACPI_BITMASK_BUS_MASTER_RLD             0x0002
968 #define ACPI_BITMASK_GLOBAL_LOCK_RELEASE        0x0004
969 #define ACPI_BITMASK_SLEEP_TYPE_X               0x1C00
970 #define ACPI_BITMASK_SLEEP_ENABLE               0x2000
971 
972 #define ACPI_BITMASK_ARB_DISABLE                0x0001
973 
974 
975 /* Raw bit position of each BitRegister */
976 
977 #define ACPI_BITPOSITION_TIMER_STATUS           0x00
978 #define ACPI_BITPOSITION_BUS_MASTER_STATUS      0x04
979 #define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS     0x05
980 #define ACPI_BITPOSITION_POWER_BUTTON_STATUS    0x08
981 #define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS    0x09
982 #define ACPI_BITPOSITION_RT_CLOCK_STATUS        0x0A
983 #define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS     0x0E    /* ACPI 3.0 */
984 #define ACPI_BITPOSITION_WAKE_STATUS            0x0F
985 
986 #define ACPI_BITPOSITION_TIMER_ENABLE           0x00
987 #define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE     0x05
988 #define ACPI_BITPOSITION_POWER_BUTTON_ENABLE    0x08
989 #define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE    0x09
990 #define ACPI_BITPOSITION_RT_CLOCK_ENABLE        0x0A
991 #define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE    0x0E    /* ACPI 3.0 */
992 
993 #define ACPI_BITPOSITION_SCI_ENABLE             0x00
994 #define ACPI_BITPOSITION_BUS_MASTER_RLD         0x01
995 #define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE    0x02
996 #define ACPI_BITPOSITION_SLEEP_TYPE_X           0x0A
997 #define ACPI_BITPOSITION_SLEEP_ENABLE           0x0D
998 
999 #define ACPI_BITPOSITION_ARB_DISABLE            0x00
1000 
1001 
1002 /*****************************************************************************
1003  *
1004  * Resource descriptors
1005  *
1006  ****************************************************************************/
1007 
1008 /* ResourceType values */
1009 
1010 #define ACPI_ADDRESS_TYPE_MEMORY_RANGE          0
1011 #define ACPI_ADDRESS_TYPE_IO_RANGE              1
1012 #define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE      2
1013 
1014 /* Resource descriptor types and masks */
1015 
1016 #define ACPI_RESOURCE_NAME_LARGE                0x80
1017 #define ACPI_RESOURCE_NAME_SMALL                0x00
1018 
1019 #define ACPI_RESOURCE_NAME_SMALL_MASK           0x78 /* Bits 6:3 contain the type */
1020 #define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK    0x07 /* Bits 2:0 contain the length */
1021 #define ACPI_RESOURCE_NAME_LARGE_MASK           0x7F /* Bits 6:0 contain the type */
1022 
1023 
1024 /*
1025  * Small resource descriptor "names" as defined by the ACPI specification.
1026  * Note: Bits 2:0 are used for the descriptor length
1027  */
1028 #define ACPI_RESOURCE_NAME_IRQ                  0x20
1029 #define ACPI_RESOURCE_NAME_DMA                  0x28
1030 #define ACPI_RESOURCE_NAME_START_DEPENDENT      0x30
1031 #define ACPI_RESOURCE_NAME_END_DEPENDENT        0x38
1032 #define ACPI_RESOURCE_NAME_IO                   0x40
1033 #define ACPI_RESOURCE_NAME_FIXED_IO             0x48
1034 #define ACPI_RESOURCE_NAME_RESERVED_S1          0x50
1035 #define ACPI_RESOURCE_NAME_RESERVED_S2          0x58
1036 #define ACPI_RESOURCE_NAME_RESERVED_S3          0x60
1037 #define ACPI_RESOURCE_NAME_RESERVED_S4          0x68
1038 #define ACPI_RESOURCE_NAME_VENDOR_SMALL         0x70
1039 #define ACPI_RESOURCE_NAME_END_TAG              0x78
1040 
1041 /*
1042  * Large resource descriptor "names" as defined by the ACPI specification.
1043  * Note: includes the Large Descriptor bit in bit[7]
1044  */
1045 #define ACPI_RESOURCE_NAME_MEMORY24             0x81
1046 #define ACPI_RESOURCE_NAME_GENERIC_REGISTER     0x82
1047 #define ACPI_RESOURCE_NAME_RESERVED_L1          0x83
1048 #define ACPI_RESOURCE_NAME_VENDOR_LARGE         0x84
1049 #define ACPI_RESOURCE_NAME_MEMORY32             0x85
1050 #define ACPI_RESOURCE_NAME_FIXED_MEMORY32       0x86
1051 #define ACPI_RESOURCE_NAME_ADDRESS32            0x87
1052 #define ACPI_RESOURCE_NAME_ADDRESS16            0x88
1053 #define ACPI_RESOURCE_NAME_EXTENDED_IRQ         0x89
1054 #define ACPI_RESOURCE_NAME_ADDRESS64            0x8A
1055 #define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64   0x8B
1056 #define ACPI_RESOURCE_NAME_LARGE_MAX            0x8B
1057 
1058 
1059 /*****************************************************************************
1060  *
1061  * Miscellaneous
1062  *
1063  ****************************************************************************/
1064 
1065 #define ACPI_ASCII_ZERO                 0x30
1066 
1067 
1068 /*****************************************************************************
1069  *
1070  * Debugger
1071  *
1072  ****************************************************************************/
1073 
1074 typedef struct acpi_db_method_info
1075 {
1076     ACPI_HANDLE                     ThreadGate;
1077     char                            *Name;
1078     char                            **Args;
1079     UINT32                          Flags;
1080     UINT32                          NumLoops;
1081     char                            Pathname[128];
1082 
1083 } ACPI_DB_METHOD_INFO;
1084 
1085 typedef struct acpi_integrity_info
1086 {
1087     UINT32                          Nodes;
1088     UINT32                          Objects;
1089 
1090 } ACPI_INTEGRITY_INFO;
1091 
1092 
1093 #define ACPI_DB_REDIRECTABLE_OUTPUT     0x01
1094 #define ACPI_DB_CONSOLE_OUTPUT          0x02
1095 #define ACPI_DB_DUPLICATE_OUTPUT        0x03
1096 
1097 
1098 /*****************************************************************************
1099  *
1100  * Debug
1101  *
1102  ****************************************************************************/
1103 
1104 /* Entry for a memory allocation (debug only) */
1105 
1106 #define ACPI_MEM_MALLOC                 0
1107 #define ACPI_MEM_CALLOC                 1
1108 #define ACPI_MAX_MODULE_NAME            16
1109 
1110 #define ACPI_COMMON_DEBUG_MEM_HEADER \
1111     struct acpi_debug_mem_block     *Previous; \
1112     struct acpi_debug_mem_block     *Next; \
1113     UINT32                          Size; \
1114     UINT32                          Component; \
1115     UINT32                          Line; \
1116     char                            Module[ACPI_MAX_MODULE_NAME]; \
1117     UINT8                           AllocType;
1118 
1119 typedef struct acpi_debug_mem_header
1120 {
1121     ACPI_COMMON_DEBUG_MEM_HEADER
1122 
1123 } ACPI_DEBUG_MEM_HEADER;
1124 
1125 typedef struct acpi_debug_mem_block
1126 {
1127     ACPI_COMMON_DEBUG_MEM_HEADER
1128     UINT64                          UserSpace;
1129 
1130 } ACPI_DEBUG_MEM_BLOCK;
1131 
1132 
1133 #define ACPI_MEM_LIST_GLOBAL            0
1134 #define ACPI_MEM_LIST_NSNODE            1
1135 #define ACPI_MEM_LIST_MAX               1
1136 #define ACPI_NUM_MEM_LISTS              2
1137 
1138 
1139 typedef struct acpi_memory_list
1140 {
1141     char                            *ListName;
1142     void                            *ListHead;
1143     UINT16                          ObjectSize;
1144     UINT16                          MaxDepth;
1145     UINT16                          CurrentDepth;
1146     UINT16                          LinkOffset;
1147 
1148 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
1149 
1150     /* Statistics for debug memory tracking only */
1151 
1152     UINT32                          TotalAllocated;
1153     UINT32                          TotalFreed;
1154     UINT32                          CurrentTotalSize;
1155     UINT32                          Requests;
1156     UINT32                          Hits;
1157 #endif
1158 
1159 } ACPI_MEMORY_LIST;
1160 
1161 
1162 #endif /* __ACLOCAL_H__ */
1163