aecommon.h revision 1.1.1.14 1 1.1 jruoho /******************************************************************************
2 1.1 jruoho *
3 1.1 jruoho * Module Name: aecommon - common include for the AcpiExec utility
4 1.1 jruoho *
5 1.1 jruoho *****************************************************************************/
6 1.1 jruoho
7 1.1.1.2 jruoho /*
8 1.1.1.14 christos * Copyright (C) 2000 - 2019, Intel Corp.
9 1.1 jruoho * All rights reserved.
10 1.1 jruoho *
11 1.1.1.2 jruoho * Redistribution and use in source and binary forms, with or without
12 1.1.1.2 jruoho * modification, are permitted provided that the following conditions
13 1.1.1.2 jruoho * are met:
14 1.1.1.2 jruoho * 1. Redistributions of source code must retain the above copyright
15 1.1.1.2 jruoho * notice, this list of conditions, and the following disclaimer,
16 1.1.1.2 jruoho * without modification.
17 1.1.1.2 jruoho * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 1.1.1.2 jruoho * substantially similar to the "NO WARRANTY" disclaimer below
19 1.1.1.2 jruoho * ("Disclaimer") and any redistribution must be conditioned upon
20 1.1.1.2 jruoho * including a substantially similar Disclaimer requirement for further
21 1.1.1.2 jruoho * binary redistribution.
22 1.1.1.2 jruoho * 3. Neither the names of the above-listed copyright holders nor the names
23 1.1.1.2 jruoho * of any contributors may be used to endorse or promote products derived
24 1.1.1.2 jruoho * from this software without specific prior written permission.
25 1.1.1.2 jruoho *
26 1.1.1.2 jruoho * Alternatively, this software may be distributed under the terms of the
27 1.1.1.2 jruoho * GNU General Public License ("GPL") version 2 as published by the Free
28 1.1.1.2 jruoho * Software Foundation.
29 1.1.1.2 jruoho *
30 1.1.1.2 jruoho * NO WARRANTY
31 1.1.1.2 jruoho * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 1.1.1.2 jruoho * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 1.1.1.2 jruoho * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 1.1.1.2 jruoho * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 1.1.1.2 jruoho * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 1.1.1.2 jruoho * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 1.1.1.2 jruoho * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 1.1.1.2 jruoho * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 1.1.1.2 jruoho * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 1.1.1.2 jruoho * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 1.1.1.2 jruoho * POSSIBILITY OF SUCH DAMAGES.
42 1.1.1.2 jruoho */
43 1.1 jruoho
44 1.1 jruoho #ifndef _AECOMMON
45 1.1 jruoho #define _AECOMMON
46 1.1 jruoho
47 1.1 jruoho #ifdef _MSC_VER /* disable some level-4 warnings */
48 1.1 jruoho #pragma warning(disable:4100) /* warning C4100: unreferenced formal parameter */
49 1.1 jruoho #endif
50 1.1 jruoho
51 1.1 jruoho #include "acpi.h"
52 1.1 jruoho #include "accommon.h"
53 1.1 jruoho #include "acparser.h"
54 1.1 jruoho #include "amlcode.h"
55 1.1 jruoho #include "acnamesp.h"
56 1.1 jruoho #include "acdebug.h"
57 1.1 jruoho #include "actables.h"
58 1.1 jruoho #include "acinterp.h"
59 1.1.1.4 christos #include "amlresrc.h"
60 1.1 jruoho #include "acapps.h"
61 1.1 jruoho
62 1.1 jruoho
63 1.1 jruoho /*
64 1.1 jruoho * Debug Regions
65 1.1 jruoho */
66 1.1 jruoho typedef struct ae_region
67 1.1 jruoho {
68 1.1 jruoho ACPI_PHYSICAL_ADDRESS Address;
69 1.1 jruoho UINT32 Length;
70 1.1 jruoho void *Buffer;
71 1.1 jruoho void *NextRegion;
72 1.1 jruoho UINT8 SpaceId;
73 1.1 jruoho
74 1.1 jruoho } AE_REGION;
75 1.1 jruoho
76 1.1 jruoho typedef struct ae_debug_regions
77 1.1 jruoho {
78 1.1 jruoho UINT32 NumberOfRegions;
79 1.1 jruoho AE_REGION *RegionList;
80 1.1 jruoho
81 1.1 jruoho } AE_DEBUG_REGIONS;
82 1.1 jruoho
83 1.1 jruoho
84 1.1.1.13 christos /*
85 1.1.1.13 christos * Init file entry
86 1.1.1.13 christos */
87 1.1.1.13 christos typedef struct init_file_entry
88 1.1.1.13 christos {
89 1.1.1.13 christos char *Name;
90 1.1.1.13 christos UINT64 Value;
91 1.1.1.13 christos } INIT_FILE_ENTRY;
92 1.1.1.13 christos
93 1.1.1.12 christos extern BOOLEAN AcpiGbl_UseLocalFaultHandler;
94 1.1.1.13 christos extern BOOLEAN AcpiGbl_VerboseHandlers;
95 1.1.1.6 christos extern BOOLEAN AcpiGbl_IgnoreErrors;
96 1.1.1.10 christos extern BOOLEAN AcpiGbl_AbortLoopOnTimeout;
97 1.1.1.6 christos extern UINT8 AcpiGbl_RegionFillValue;
98 1.1.1.13 christos extern INIT_FILE_ENTRY *AcpiGbl_InitEntries;
99 1.1.1.13 christos extern UINT32 AcpiGbl_InitFileLineCount;
100 1.1.1.6 christos extern UINT8 AcpiGbl_UseHwReducedFadt;
101 1.1.1.6 christos extern BOOLEAN AcpiGbl_DisplayRegionAccess;
102 1.1.1.6 christos extern BOOLEAN AcpiGbl_DoInterfaceTests;
103 1.1.1.6 christos extern BOOLEAN AcpiGbl_LoadTestTables;
104 1.1.1.6 christos extern FILE *AcpiGbl_NamespaceInitFile;
105 1.1.1.6 christos extern ACPI_CONNECTION_INFO AeMyContext;
106 1.1.1.6 christos
107 1.1.1.10 christos extern UINT8 Ssdt2Code[];
108 1.1.1.10 christos extern UINT8 Ssdt3Code[];
109 1.1.1.10 christos extern UINT8 Ssdt4Code[];
110 1.1.1.10 christos
111 1.1.1.6 christos
112 1.1 jruoho #define TEST_OUTPUT_LEVEL(lvl) if ((lvl) & OutputLevel)
113 1.1 jruoho
114 1.1 jruoho #define OSD_PRINT(lvl,fp) TEST_OUTPUT_LEVEL(lvl) {\
115 1.1 jruoho AcpiOsPrintf PARAM_LIST(fp);}
116 1.1 jruoho
117 1.1.1.9 christos #define AE_PREFIX "ACPI Exec: "
118 1.1.1.9 christos
119 1.1.1.2 jruoho void ACPI_SYSTEM_XFACE
120 1.1.1.9 christos AeSignalHandler (
121 1.1 jruoho int Sig);
122 1.1 jruoho
123 1.1 jruoho ACPI_STATUS
124 1.1.1.9 christos AeExceptionHandler (
125 1.1.1.9 christos ACPI_STATUS AmlStatus,
126 1.1.1.9 christos ACPI_NAME Name,
127 1.1.1.9 christos UINT16 Opcode,
128 1.1.1.9 christos UINT32 AmlOffset,
129 1.1.1.9 christos void *Context);
130 1.1.1.9 christos
131 1.1.1.9 christos ACPI_STATUS
132 1.1 jruoho AeBuildLocalTables (
133 1.1.1.6 christos ACPI_NEW_TABLE_DESC *TableList);
134 1.1 jruoho
135 1.1 jruoho ACPI_STATUS
136 1.1 jruoho AeInstallTables (
137 1.1 jruoho void);
138 1.1 jruoho
139 1.1.1.6 christos ACPI_STATUS
140 1.1.1.6 christos AeLoadTables (
141 1.1.1.6 christos void);
142 1.1.1.6 christos
143 1.1 jruoho void
144 1.1 jruoho AeDumpNamespace (
145 1.1 jruoho void);
146 1.1 jruoho
147 1.1 jruoho void
148 1.1 jruoho AeDumpObject (
149 1.1 jruoho char *MethodName,
150 1.1 jruoho ACPI_BUFFER *ReturnObj);
151 1.1 jruoho
152 1.1 jruoho void
153 1.1 jruoho AeDumpBuffer (
154 1.1 jruoho UINT32 Address);
155 1.1 jruoho
156 1.1 jruoho void
157 1.1 jruoho AeExecute (
158 1.1 jruoho char *Name);
159 1.1 jruoho
160 1.1 jruoho void
161 1.1 jruoho AeSetScope (
162 1.1 jruoho char *Name);
163 1.1 jruoho
164 1.1 jruoho void
165 1.1 jruoho AeCloseDebugFile (
166 1.1 jruoho void);
167 1.1 jruoho
168 1.1 jruoho void
169 1.1 jruoho AeOpenDebugFile (
170 1.1 jruoho char *Name);
171 1.1 jruoho
172 1.1 jruoho ACPI_STATUS
173 1.1 jruoho AeDisplayAllMethods (
174 1.1 jruoho UINT32 DisplayCount);
175 1.1 jruoho
176 1.1.1.10 christos /* aetests */
177 1.1 jruoho
178 1.1 jruoho void
179 1.1 jruoho AeMiscellaneousTests (
180 1.1 jruoho void);
181 1.1 jruoho
182 1.1.1.14 christos void
183 1.1.1.14 christos AeLateTest (
184 1.1.1.14 christos void);
185 1.1.1.14 christos
186 1.1.1.10 christos /* aeregion */
187 1.1.1.10 christos
188 1.1 jruoho ACPI_STATUS
189 1.1 jruoho AeRegionHandler (
190 1.1 jruoho UINT32 Function,
191 1.1 jruoho ACPI_PHYSICAL_ADDRESS Address,
192 1.1 jruoho UINT32 BitWidth,
193 1.1 jruoho UINT64 *Value,
194 1.1 jruoho void *HandlerContext,
195 1.1 jruoho void *RegionContext);
196 1.1 jruoho
197 1.1.1.10 christos /* aeinstall */
198 1.1.1.10 christos
199 1.1.1.10 christos ACPI_STATUS
200 1.1.1.10 christos AeInstallDeviceHandlers (
201 1.1.1.10 christos void);
202 1.1.1.10 christos
203 1.1.1.10 christos void
204 1.1.1.10 christos AeInstallRegionHandlers (
205 1.1.1.10 christos void);
206 1.1.1.10 christos
207 1.1.1.10 christos void
208 1.1.1.10 christos AeOverrideRegionHandlers (
209 1.1.1.10 christos void);
210 1.1.1.10 christos
211 1.1.1.10 christos /* aehandlers */
212 1.1.1.10 christos
213 1.1.1.10 christos ACPI_STATUS
214 1.1.1.10 christos AeInstallEarlyHandlers (
215 1.1.1.10 christos void);
216 1.1.1.10 christos
217 1.1.1.10 christos ACPI_STATUS
218 1.1.1.10 christos AeInstallLateHandlers (
219 1.1.1.10 christos void);
220 1.1.1.10 christos
221 1.1 jruoho UINT32
222 1.1 jruoho AeGpeHandler (
223 1.1.1.2 jruoho ACPI_HANDLE GpeDevice,
224 1.1.1.2 jruoho UINT32 GpeNumber,
225 1.1.1.2 jruoho void *Context);
226 1.1.1.2 jruoho
227 1.1.1.2 jruoho void
228 1.1.1.2 jruoho AeGlobalEventHandler (
229 1.1.1.2 jruoho UINT32 Type,
230 1.1.1.2 jruoho ACPI_HANDLE GpeDevice,
231 1.1.1.2 jruoho UINT32 EventNumber,
232 1.1 jruoho void *Context);
233 1.1 jruoho
234 1.1.1.10 christos /* aeinitfile */
235 1.1.1.4 christos
236 1.1.1.10 christos int
237 1.1.1.10 christos AeOpenInitializationFile (
238 1.1.1.10 christos char *Filename);
239 1.1.1.10 christos
240 1.1.1.10 christos void
241 1.1.1.13 christos AeProcessInitFile (
242 1.1.1.4 christos void);
243 1.1.1.4 christos
244 1.1.1.10 christos ACPI_STATUS
245 1.1.1.10 christos AeSetupConfiguration (
246 1.1.1.10 christos void *RegionAddr);
247 1.1.1.10 christos
248 1.1.1.13 christos ACPI_STATUS
249 1.1.1.13 christos AeLookupInitFileEntry (
250 1.1.1.13 christos char *Pathname,
251 1.1.1.13 christos UINT64 *Value);
252 1.1.1.13 christos
253 1.1.1.10 christos /* aeexec */
254 1.1.1.10 christos
255 1.1.1.4 christos void
256 1.1.1.10 christos AeTestBufferArgument (
257 1.1.1.4 christos void);
258 1.1.1.4 christos
259 1.1.1.4 christos void
260 1.1.1.10 christos AeTestPackageArgument (
261 1.1.1.4 christos void);
262 1.1.1.4 christos
263 1.1.1.10 christos ACPI_STATUS
264 1.1.1.10 christos AeGetDevices (
265 1.1.1.10 christos ACPI_HANDLE ObjHandle,
266 1.1.1.10 christos UINT32 NestingLevel,
267 1.1.1.10 christos void *Context,
268 1.1.1.10 christos void **ReturnValue);
269 1.1.1.4 christos
270 1.1.1.10 christos ACPI_STATUS
271 1.1.1.10 christos ExecuteOSI (
272 1.1.1.10 christos char *OsiString,
273 1.1.1.10 christos UINT64 ExpectedResult);
274 1.1.1.5 christos
275 1.1.1.10 christos void
276 1.1.1.10 christos AeGenericRegisters (
277 1.1.1.10 christos void);
278 1.1.1.5 christos
279 1.1.1.10 christos #if (!ACPI_REDUCED_HARDWARE)
280 1.1.1.5 christos void
281 1.1.1.10 christos AfInstallGpeBlock (
282 1.1.1.5 christos void);
283 1.1.1.10 christos #endif /* !ACPI_REDUCED_HARDWARE */
284 1.1.1.5 christos
285 1.1 jruoho #endif /* _AECOMMON */
286