1 /****************************************************************************** 2 * 3 * Module Name: aecommon - common include for the AcpiExec utility 4 * 5 *****************************************************************************/ 6 7 /* 8 * Copyright (C) 2000 - 2016, 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 ACPI_STATUS 117 AeLoadTables ( 118 void); 119 120 void 121 AeDumpNamespace ( 122 void); 123 124 void 125 AeDumpObject ( 126 char *MethodName, 127 ACPI_BUFFER *ReturnObj); 128 129 void 130 AeDumpBuffer ( 131 UINT32 Address); 132 133 void 134 AeExecute ( 135 char *Name); 136 137 void 138 AeSetScope ( 139 char *Name); 140 141 void 142 AeCloseDebugFile ( 143 void); 144 145 void 146 AeOpenDebugFile ( 147 char *Name); 148 149 ACPI_STATUS 150 AeDisplayAllMethods ( 151 UINT32 DisplayCount); 152 153 ACPI_STATUS 154 AeInstallEarlyHandlers ( 155 void); 156 157 ACPI_STATUS 158 AeInstallLateHandlers ( 159 void); 160 161 void 162 AeMiscellaneousTests ( 163 void); 164 165 ACPI_STATUS 166 AeRegionHandler ( 167 UINT32 Function, 168 ACPI_PHYSICAL_ADDRESS Address, 169 UINT32 BitWidth, 170 UINT64 *Value, 171 void *HandlerContext, 172 void *RegionContext); 173 174 UINT32 175 AeGpeHandler ( 176 ACPI_HANDLE GpeDevice, 177 UINT32 GpeNumber, 178 void *Context); 179 180 void 181 AeGlobalEventHandler ( 182 UINT32 Type, 183 ACPI_HANDLE GpeDevice, 184 UINT32 EventNumber, 185 void *Context); 186 187 /* aeregion */ 188 189 ACPI_STATUS 190 AeInstallDeviceHandlers ( 191 void); 192 193 void 194 AeInstallRegionHandlers ( 195 void); 196 197 void 198 AeOverrideRegionHandlers ( 199 void); 200 201 202 /* aeinitfile */ 203 204 int 205 AeOpenInitializationFile ( 206 char *Filename); 207 208 void 209 AeDoObjectOverrides ( 210 void); 211 212 #endif /* _AECOMMON */ 213