asltypes.h revision 240716
1118611Snjl
2118611Snjl/******************************************************************************
3118611Snjl *
4118611Snjl * Module Name: asltypes.h - compiler data types and struct definitions
5118611Snjl *
6118611Snjl *****************************************************************************/
7118611Snjl
8217365Sjkim/*
9229989Sjkim * Copyright (C) 2000 - 2012, Intel Corp.
10118611Snjl * All rights reserved.
11118611Snjl *
12217365Sjkim * Redistribution and use in source and binary forms, with or without
13217365Sjkim * modification, are permitted provided that the following conditions
14217365Sjkim * are met:
15217365Sjkim * 1. Redistributions of source code must retain the above copyright
16217365Sjkim *    notice, this list of conditions, and the following disclaimer,
17217365Sjkim *    without modification.
18217365Sjkim * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19217365Sjkim *    substantially similar to the "NO WARRANTY" disclaimer below
20217365Sjkim *    ("Disclaimer") and any redistribution must be conditioned upon
21217365Sjkim *    including a substantially similar Disclaimer requirement for further
22217365Sjkim *    binary redistribution.
23217365Sjkim * 3. Neither the names of the above-listed copyright holders nor the names
24217365Sjkim *    of any contributors may be used to endorse or promote products derived
25217365Sjkim *    from this software without specific prior written permission.
26118611Snjl *
27217365Sjkim * Alternatively, this software may be distributed under the terms of the
28217365Sjkim * GNU General Public License ("GPL") version 2 as published by the Free
29217365Sjkim * Software Foundation.
30118611Snjl *
31217365Sjkim * NO WARRANTY
32217365Sjkim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33217365Sjkim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34217365Sjkim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35217365Sjkim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36217365Sjkim * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37217365Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38217365Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39217365Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40217365Sjkim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41217365Sjkim * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42217365Sjkim * POSSIBILITY OF SUCH DAMAGES.
43217365Sjkim */
44118611Snjl
45118611Snjl
46118611Snjl#ifndef __ASLTYPES_H
47118611Snjl#define __ASLTYPES_H
48118611Snjl
49118611Snjl
50118611Snjl/*******************************************************************************
51118611Snjl *
52118611Snjl * Structure definitions
53118611Snjl *
54118611Snjl ******************************************************************************/
55118611Snjl
56118611Snjl
57118611Snjl/* Op flags for the ACPI_PARSE_OBJECT */
58118611Snjl
59118611Snjl#define NODE_VISITED                0x00000001
60118611Snjl#define NODE_AML_PACKAGE            0x00000002
61118611Snjl#define NODE_IS_TARGET              0x00000004
62118611Snjl#define NODE_IS_RESOURCE_DESC       0x00000008
63118611Snjl#define NODE_IS_RESOURCE_FIELD      0x00000010
64118611Snjl#define NODE_HAS_NO_EXIT            0x00000020
65118611Snjl#define NODE_IF_HAS_NO_EXIT         0x00000040
66118611Snjl#define NODE_NAME_INTERNALIZED      0x00000080
67118611Snjl#define NODE_METHOD_NO_RETVAL       0x00000100
68118611Snjl#define NODE_METHOD_SOME_NO_RETVAL  0x00000200
69118611Snjl#define NODE_RESULT_NOT_USED        0x00000400
70118611Snjl#define NODE_METHOD_TYPED           0x00000800
71228110Sjkim#define NODE_UNUSED_FLAG            0x00001000
72118611Snjl#define NODE_COMPILE_TIME_CONST     0x00002000
73118611Snjl#define NODE_IS_TERM_ARG            0x00004000
74118611Snjl#define NODE_WAS_ONES_OP            0x00008000
75118611Snjl#define NODE_IS_NAME_DECLARATION    0x00010000
76138287Smarks#define NODE_COMPILER_EMITTED       0x00020000
77151937Sjkim#define NODE_IS_DUPLICATE           0x00040000
78167802Sjkim#define NODE_IS_RESOURCE_DATA       0x00080000
79220663Sjkim#define NODE_IS_NULL_RETURN         0x00100000
80118611Snjl
81118611Snjl/* Keeps information about individual control methods */
82118611Snjl
83118611Snjltypedef struct asl_method_info
84118611Snjl{
85118611Snjl    UINT8                   NumArguments;
86118611Snjl    UINT8                   LocalInitialized[ACPI_METHOD_NUM_LOCALS];
87118611Snjl    UINT8                   ArgInitialized[ACPI_METHOD_NUM_ARGS];
88138287Smarks    UINT32                  ValidArgTypes[ACPI_METHOD_NUM_ARGS];
89138287Smarks    UINT32                  ValidReturnTypes;
90118611Snjl    UINT32                  NumReturnNoValue;
91118611Snjl    UINT32                  NumReturnWithValue;
92118611Snjl    ACPI_PARSE_OBJECT       *Op;
93118611Snjl    struct asl_method_info  *Next;
94118611Snjl    UINT8                   HasBeenTyped;
95118611Snjl
96118611Snjl} ASL_METHOD_INFO;
97118611Snjl
98118611Snjl
99118611Snjl/* Parse tree walk info for control method analysis */
100118611Snjl
101118611Snjltypedef struct asl_analysis_walk_info
102118611Snjl{
103118611Snjl    ASL_METHOD_INFO         *MethodStack;
104118611Snjl
105118611Snjl} ASL_ANALYSIS_WALK_INFO;
106118611Snjl
107118611Snjl
108118611Snjl/* An entry in the ParseOpcode to AmlOpcode mapping table */
109118611Snjl
110118611Snjltypedef struct asl_mapping_entry
111118611Snjl{
112118611Snjl    UINT32                      Value;
113118611Snjl    UINT32                      AcpiBtype;   /* Object type or return type */
114118611Snjl    UINT16                      AmlOpcode;
115118611Snjl    UINT8                       Flags;
116118611Snjl
117118611Snjl} ASL_MAPPING_ENTRY;
118118611Snjl
119118611Snjl
120118611Snjl/* Parse tree walk info structure */
121118611Snjl
122118611Snjltypedef struct asl_walk_info
123118611Snjl{
124118611Snjl    ACPI_PARSE_OBJECT           **NodePtr;
125118611Snjl    UINT32                      *LevelPtr;
126118611Snjl
127118611Snjl} ASL_WALK_INFO;
128118611Snjl
129118611Snjl
130118611Snjl/* File info */
131118611Snjl
132118611Snjltypedef struct asl_file_info
133118611Snjl{
134118611Snjl    FILE                        *Handle;
135118611Snjl    char                        *Filename;
136240716Sjkim    const char                  *ShortDescription;
137240716Sjkim    const char                  *Description;
138118611Snjl
139118611Snjl} ASL_FILE_INFO;
140118611Snjl
141167802Sjkimtypedef struct asl_file_status
142167802Sjkim{
143167802Sjkim    UINT32                  Line;
144167802Sjkim    UINT32                  Offset;
145118611Snjl
146167802Sjkim} ASL_FILE_STATUS;
147167802Sjkim
148167802Sjkim
149228110Sjkim/*
150228110Sjkim * File types. Note: Any changes to this table must also be reflected
151240716Sjkim * in the Gbl_Files array.
152228110Sjkim */
153118611Snjltypedef enum
154118611Snjl{
155118611Snjl    ASL_FILE_STDOUT             = 0,
156118611Snjl    ASL_FILE_STDERR,
157240716Sjkim    ASL_FILE_INPUT,
158240716Sjkim    ASL_FILE_AML_OUTPUT,        /* Don't move these first 4 file types */
159118611Snjl    ASL_FILE_SOURCE_OUTPUT,
160233250Sjkim    ASL_FILE_PREPROCESSOR,
161118611Snjl    ASL_FILE_LISTING_OUTPUT,
162118611Snjl    ASL_FILE_HEX_OUTPUT,
163118611Snjl    ASL_FILE_NAMESPACE_OUTPUT,
164118611Snjl    ASL_FILE_DEBUG_OUTPUT,
165118611Snjl    ASL_FILE_ASM_SOURCE_OUTPUT,
166118611Snjl    ASL_FILE_C_SOURCE_OUTPUT,
167118611Snjl    ASL_FILE_ASM_INCLUDE_OUTPUT,
168118611Snjl    ASL_FILE_C_INCLUDE_OUTPUT
169118611Snjl
170118611Snjl} ASL_FILE_TYPES;
171118611Snjl
172118611Snjl
173233250Sjkim#define ASL_MAX_FILE_TYPE       13
174118611Snjl#define ASL_NUM_FILES           (ASL_MAX_FILE_TYPE + 1)
175118611Snjl
176118611Snjl
177197104Sjkimtypedef struct asl_include_dir
178197104Sjkim{
179197104Sjkim    char                        *Dir;
180197104Sjkim    struct asl_include_dir      *Next;
181197104Sjkim
182197104Sjkim} ASL_INCLUDE_DIR;
183197104Sjkim
184197104Sjkim
185118611Snjl/* An entry in the exception list, one for each error/warning */
186118611Snjl
187118611Snjltypedef struct asl_error_msg
188118611Snjl{
189118611Snjl    UINT32                      LineNumber;
190118611Snjl    UINT32                      LogicalLineNumber;
191118611Snjl    UINT32                      LogicalByteOffset;
192118611Snjl    UINT32                      Column;
193118611Snjl    char                        *Message;
194118611Snjl    struct asl_error_msg        *Next;
195118611Snjl    char                        *Filename;
196233250Sjkim    char                        *SourceLine;
197118611Snjl    UINT32                      FilenameLength;
198118611Snjl    UINT8                       MessageId;
199118611Snjl    UINT8                       Level;
200118611Snjl
201118611Snjl} ASL_ERROR_MSG;
202118611Snjl
203118611Snjl
204118611Snjl/* An entry in the listing file stack (for include files) */
205118611Snjl
206118611Snjltypedef struct asl_listing_node
207118611Snjl{
208118611Snjl    char                        *Filename;
209118611Snjl    UINT32                      LineNumber;
210118611Snjl    struct asl_listing_node     *Next;
211118611Snjl
212118611Snjl} ASL_LISTING_NODE;
213118611Snjl
214118611Snjl
215118611Snjl/* Callback interface for a parse tree walk */
216118611Snjl
217209746Sjkim/*
218209746Sjkim * TBD - another copy of this is in adisasm.h, fix
219209746Sjkim */
220209746Sjkim#ifndef ASL_WALK_CALLBACK_DEFINED
221118611Snjltypedef
222118611SnjlACPI_STATUS (*ASL_WALK_CALLBACK) (
223118611Snjl    ACPI_PARSE_OBJECT           *Op,
224118611Snjl    UINT32                      Level,
225118611Snjl    void                        *Context);
226209746Sjkim#define ASL_WALK_CALLBACK_DEFINED
227209746Sjkim#endif
228118611Snjl
229118611Snjl
230118611Snjltypedef struct asl_event_info
231118611Snjl{
232151937Sjkim    UINT64                      StartTime;
233151937Sjkim    UINT64                      EndTime;
234118611Snjl    char                        *EventName;
235118611Snjl    BOOLEAN                     Valid;
236118611Snjl
237118611Snjl} ASL_EVENT_INFO;
238118611Snjl
239118611Snjl
240118611Snjl#endif  /* __ASLTYPES_H */
241