1 /******************************************************************************
2  *
3  * Module Name: aecommon - common include for the AcpiExec utility
4  *
5  *****************************************************************************/
6 
7 /*
8  * Copyright (C) 2000 - 2015, Intel Corp.
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions, and the following disclaimer,
16  *    without modification.
17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18  *    substantially similar to the "NO WARRANTY" disclaimer below
19  *    ("Disclaimer") and any redistribution must be conditioned upon
20  *    including a substantially similar Disclaimer requirement for further
21  *    binary redistribution.
22  * 3. Neither the names of the above-listed copyright holders nor the names
23  *    of any contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * Alternatively, this software may be distributed under the terms of the
27  * GNU General Public License ("GPL") version 2 as published by the Free
28  * Software Foundation.
29  *
30  * NO WARRANTY
31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41  * POSSIBILITY OF SUCH DAMAGES.
42  */
43 
44 #ifndef _AECOMMON
45 #define _AECOMMON
46 
47 #ifdef _MSC_VER                 /* disable some level-4 warnings */
48 #pragma warning(disable:4100)   /* warning C4100: unreferenced formal parameter */
49 #endif
50 
51 #include "acpi.h"
52 #include "accommon.h"
53 #include "acparser.h"
54 #include "amlcode.h"
55 #include "acnamesp.h"
56 #include "acdebug.h"
57 #include "actables.h"
58 #include "acinterp.h"
59 #include "amlresrc.h"
60 #include "acapps.h"
61 
62 #include <stdio.h>
63 #include <stdlib.h>
64 #include <string.h>
65 #include <signal.h>
66 
67 
68 /*
69  * Debug Regions
70  */
71 typedef struct ae_region
72 {
73     ACPI_PHYSICAL_ADDRESS   Address;
74     UINT32                  Length;
75     void                    *Buffer;
76     void                    *NextRegion;
77     UINT8                   SpaceId;
78 
79 } AE_REGION;
80 
81 typedef struct ae_debug_regions
82 {
83     UINT32                  NumberOfRegions;
84     AE_REGION               *RegionList;
85 
86 } AE_DEBUG_REGIONS;
87 
88 
89 extern BOOLEAN              AcpiGbl_IgnoreErrors;
90 extern UINT8                AcpiGbl_RegionFillValue;
91 extern UINT8                AcpiGbl_UseHwReducedFadt;
92 extern BOOLEAN              AcpiGbl_DisplayRegionAccess;
93 extern BOOLEAN              AcpiGbl_DoInterfaceTests;
94 extern BOOLEAN              AcpiGbl_LoadTestTables;
95 extern FILE                 *AcpiGbl_NamespaceInitFile;
96 extern ACPI_CONNECTION_INFO AeMyContext;
97 
98 
99 #define TEST_OUTPUT_LEVEL(lvl)          if ((lvl) & OutputLevel)
100 
101 #define OSD_PRINT(lvl,fp)               TEST_OUTPUT_LEVEL(lvl) {\
102                                             AcpiOsPrintf PARAM_LIST(fp);}
103 
104 void ACPI_SYSTEM_XFACE
105 AeCtrlCHandler (
106     int                     Sig);
107 
108 ACPI_STATUS
109 AeBuildLocalTables (
110     ACPI_NEW_TABLE_DESC     *TableList);
111 
112 ACPI_STATUS
113 AeInstallTables (
114     void);
115 
116 void
117 AeDumpNamespace (
118     void);
119 
120 void
121 AeDumpObject (
122     char                    *MethodName,
123     ACPI_BUFFER             *ReturnObj);
124 
125 void
126 AeDumpBuffer (
127     UINT32                  Address);
128 
129 void
130 AeExecute (
131     char                    *Name);
132 
133 void
134 AeSetScope (
135     char                    *Name);
136 
137 void
138 AeCloseDebugFile (
139     void);
140 
141 void
142 AeOpenDebugFile (
143     char                    *Name);
144 
145 ACPI_STATUS
146 AeDisplayAllMethods (
147     UINT32                  DisplayCount);
148 
149 ACPI_STATUS
150 AeInstallEarlyHandlers (
151     void);
152 
153 ACPI_STATUS
154 AeInstallLateHandlers (
155     void);
156 
157 void
158 AeMiscellaneousTests (
159     void);
160 
161 ACPI_STATUS
162 AeRegionHandler (
163     UINT32                  Function,
164     ACPI_PHYSICAL_ADDRESS   Address,
165     UINT32                  BitWidth,
166     UINT64                  *Value,
167     void                    *HandlerContext,
168     void                    *RegionContext);
169 
170 UINT32
171 AeGpeHandler (
172     ACPI_HANDLE             GpeDevice,
173     UINT32                  GpeNumber,
174     void                    *Context);
175 
176 void
177 AeGlobalEventHandler (
178     UINT32                  Type,
179     ACPI_HANDLE             GpeDevice,
180     UINT32                  EventNumber,
181     void                    *Context);
182 
183 /* aeregion */
184 
185 ACPI_STATUS
186 AeInstallDeviceHandlers (
187     void);
188 
189 void
190 AeInstallRegionHandlers (
191     void);
192 
193 void
194 AeOverrideRegionHandlers (
195     void);
196 
197 
198 /* aeinitfile */
199 
200 int
201 AeOpenInitializationFile (
202     char                    *Filename);
203 
204 void
205 AeDoObjectOverrides (
206     void);
207 
208 #endif /* _AECOMMON */
209