1 /****************************************************************************** 2 * 3 * Module Name: aecommon - common include for the AcpiExec utility 4 * 5 *****************************************************************************/ 6 7 /* 8 * Copyright (C) 2000 - 2022, 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 MERCHANTABILITY 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 63 /* 64 * Debug Regions 65 */ 66 typedef struct ae_region 67 { 68 ACPI_PHYSICAL_ADDRESS Address; 69 UINT32 Length; 70 void *Buffer; 71 void *NextRegion; 72 UINT8 SpaceId; 73 74 } AE_REGION; 75 76 typedef struct ae_debug_regions 77 { 78 UINT32 NumberOfRegions; 79 AE_REGION *RegionList; 80 81 } AE_DEBUG_REGIONS; 82 83 84 /* 85 * Init file entry 86 */ 87 typedef struct init_file_entry 88 { 89 char *Name; 90 char *Value; 91 ACPI_OPERAND_OBJECT *ObjDesc; 92 BOOLEAN IsUsed; 93 94 } INIT_FILE_ENTRY; 95 96 extern BOOLEAN AcpiGbl_UseLocalFaultHandler; 97 extern BOOLEAN AcpiGbl_VerboseHandlers; 98 extern BOOLEAN AcpiGbl_IgnoreErrors; 99 extern BOOLEAN AcpiGbl_AbortLoopOnTimeout; 100 extern UINT8 AcpiGbl_RegionFillValue; 101 extern INIT_FILE_ENTRY *AcpiGbl_InitEntries; 102 extern UINT32 AcpiGbl_InitFileLineCount; 103 extern UINT8 AcpiGbl_UseHwReducedFadt; 104 extern BOOLEAN AcpiGbl_DisplayRegionAccess; 105 extern BOOLEAN AcpiGbl_DoInterfaceTests; 106 extern BOOLEAN AcpiGbl_LoadTestTables; 107 extern FILE *AcpiGbl_NamespaceInitFile; 108 extern ACPI_CONNECTION_INFO AeMyContext; 109 110 extern UINT8 Ssdt2Code[]; 111 extern UINT8 Ssdt3Code[]; 112 extern UINT8 Ssdt4Code[]; 113 114 115 #define TEST_OUTPUT_LEVEL(lvl) if ((lvl) & OutputLevel) 116 117 #define OSD_PRINT(lvl,fp) TEST_OUTPUT_LEVEL(lvl) {\ 118 AcpiOsPrintf PARAM_LIST(fp);} 119 120 #define AE_PREFIX "ACPI Exec: " 121 122 void ACPI_SYSTEM_XFACE 123 AeSignalHandler ( 124 int Sig); 125 126 ACPI_STATUS 127 AeExceptionHandler ( 128 ACPI_STATUS AmlStatus, 129 ACPI_NAME Name, 130 UINT16 Opcode, 131 UINT32 AmlOffset, 132 void *Context); 133 134 ACPI_STATUS 135 AeBuildLocalTables ( 136 ACPI_NEW_TABLE_DESC *TableList); 137 138 ACPI_STATUS 139 AeInstallTables ( 140 void); 141 142 ACPI_STATUS 143 AeLoadTables ( 144 void); 145 146 void 147 AeDumpNamespace ( 148 void); 149 150 void 151 AeDumpObject ( 152 char *MethodName, 153 ACPI_BUFFER *ReturnObj); 154 155 void 156 AeDumpBuffer ( 157 UINT32 Address); 158 159 void 160 AeExecute ( 161 char *Name); 162 163 void 164 AeSetScope ( 165 char *Name); 166 167 void 168 AeCloseDebugFile ( 169 void); 170 171 void 172 AeOpenDebugFile ( 173 char *Name); 174 175 ACPI_STATUS 176 AeDisplayAllMethods ( 177 UINT32 DisplayCount); 178 179 /* aetests */ 180 181 void 182 AeMiscellaneousTests ( 183 void); 184 185 void 186 AeLateTest ( 187 void); 188 189 /* aeregion */ 190 191 ACPI_STATUS 192 AeRegionHandler ( 193 UINT32 Function, 194 ACPI_PHYSICAL_ADDRESS Address, 195 UINT32 BitWidth, 196 UINT64 *Value, 197 void *HandlerContext, 198 void *RegionContext); 199 200 /* aeinstall */ 201 202 ACPI_STATUS 203 AeInstallDeviceHandlers ( 204 void); 205 206 void 207 AeInstallRegionHandlers ( 208 void); 209 210 void 211 AeOverrideRegionHandlers ( 212 void); 213 214 /* aehandlers */ 215 216 ACPI_STATUS 217 AeInstallEarlyHandlers ( 218 void); 219 220 ACPI_STATUS 221 AeInstallLateHandlers ( 222 void); 223 224 UINT32 225 AeGpeHandler ( 226 ACPI_HANDLE GpeDevice, 227 UINT32 GpeNumber, 228 void *Context); 229 230 void 231 AeGlobalEventHandler ( 232 UINT32 Type, 233 ACPI_HANDLE GpeDevice, 234 UINT32 EventNumber, 235 void *Context); 236 237 /* aeinitfile */ 238 239 int 240 AeOpenInitializationFile ( 241 char *Filename); 242 243 ACPI_STATUS 244 AeProcessInitFile ( 245 void); 246 247 ACPI_STATUS 248 AeLookupInitFileEntry ( 249 char *Pathname, 250 ACPI_OPERAND_OBJECT **ObjDesc); 251 252 void 253 AeDisplayUnusedInitFileItems ( 254 void); 255 256 void 257 AeDeleteInitFileList ( 258 void); 259 260 /* aeexec */ 261 262 void 263 AeTestBufferArgument ( 264 void); 265 266 void 267 AeTestPackageArgument ( 268 void); 269 270 ACPI_STATUS 271 AeGetDevices ( 272 ACPI_HANDLE ObjHandle, 273 UINT32 NestingLevel, 274 void *Context, 275 void **ReturnValue); 276 277 ACPI_STATUS 278 AeSetupConfiguration ( 279 void *RegionAddr); 280 281 ACPI_STATUS 282 ExecuteOSI ( 283 char *OsiString, 284 UINT64 ExpectedResult); 285 286 void 287 AeGenericRegisters ( 288 void); 289 290 #if (!ACPI_REDUCED_HARDWARE) 291 void 292 AfInstallGpeBlock ( 293 void); 294 #endif /* !ACPI_REDUCED_HARDWARE */ 295 296 #endif /* _AECOMMON */ 297