1 /****************************************************************************** 2 * 3 * Module Name: acpihelp.h - Include file for AcpiHelp utility 4 * 5 *****************************************************************************/ 6 7 /* 8 * Copyright (C) 2000 - 2017, 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 __ACPIHELP_H 45 #define __ACPIHELP_H 46 47 48 #include "acpi.h" 49 #include "accommon.h" 50 #include "acapps.h" 51 52 #include <sys/types.h> 53 #ifdef WIN32 54 #include <io.h> 55 #include <direct.h> 56 #endif 57 58 59 /* 60 * Global variables. Defined in ahmain.c only, externed in all other files 61 */ 62 #undef ACPI_GLOBAL 63 #undef ACPI_INIT_GLOBAL 64 65 #ifdef DEFINE_AHELP_GLOBALS 66 #define ACPI_GLOBAL(type,name) \ 67 extern type name; \ 68 type name 69 70 #define ACPI_INIT_GLOBAL(type,name,value) \ 71 type name=value 72 73 #else 74 #ifndef ACPI_GLOBAL 75 #define ACPI_GLOBAL(type,name) \ 76 extern type name 77 #endif 78 79 #ifndef ACPI_INIT_GLOBAL 80 #define ACPI_INIT_GLOBAL(type,name,value) \ 81 extern type name 82 #endif 83 #endif 84 85 86 #define AH_BUFFER_LENGTH 128 87 #define AH_LINE_BUFFER_LENGTH 512 88 #define AH_MAX_ASL_LINE_LENGTH 70 89 #define AH_MAX_AML_LINE_LENGTH 100 90 91 ACPI_GLOBAL (char, Gbl_Buffer[AH_BUFFER_LENGTH]); 92 ACPI_GLOBAL (char, Gbl_LineBuffer[AH_LINE_BUFFER_LENGTH]); 93 94 95 #define AH_DISPLAY_EXCEPTION(Status, Name) \ 96 printf ("%.4X: %s\n", Status, Name) 97 98 #define AH_DISPLAY_EXCEPTION_TEXT(Status, Exception) \ 99 printf ("%.4X: %-28s (%s)\n", Status,\ 100 Exception->Name, Exception->Description) 101 102 103 typedef enum 104 { 105 AH_DECODE_DEFAULT = 0, 106 AH_DECODE_ASL, 107 AH_DECODE_ASL_KEYWORD, 108 AH_DECODE_PREDEFINED_NAME, 109 AH_DECODE_AML, 110 AH_DECODE_AML_OPCODE, 111 AH_DECODE_AML_TYPE, 112 AH_DECODE_ASL_AML, 113 AH_DECODE_EXCEPTION, 114 115 AH_DISPLAY_DEVICE_IDS, 116 AH_DISPLAY_UUIDS, 117 AH_DISPLAY_TABLES, 118 AH_DISPLAY_DIRECTIVES 119 120 } AH_OPTION_TYPES; 121 122 typedef struct ah_aml_opcode 123 { 124 UINT16 OpcodeRangeStart; 125 UINT16 OpcodeRangeEnd; 126 char *OpcodeString; 127 char *OpcodeName; 128 char *Type; 129 char *FixedArguments; 130 char *VariableArguments; 131 char *Grammar; 132 133 } AH_AML_OPCODE; 134 135 typedef struct ah_aml_type 136 { 137 char *Name; 138 char *Description; 139 140 } AH_AML_TYPE; 141 142 typedef struct ah_asl_operator 143 { 144 char *Name; 145 char *Syntax; 146 char *Description; 147 148 } AH_ASL_OPERATOR; 149 150 typedef struct ah_asl_keyword 151 { 152 char *Name; 153 char *Description; 154 char *KeywordList; 155 156 } AH_ASL_KEYWORD; 157 158 typedef struct ah_directive_info 159 { 160 char *Name; 161 char *Description; 162 163 } AH_DIRECTIVE_INFO; 164 165 166 /* Externals for various data tables */ 167 168 extern const AH_AML_OPCODE Gbl_AmlOpcodeInfo[]; 169 extern const AH_AML_TYPE Gbl_AmlTypesInfo[]; 170 extern const AH_ASL_OPERATOR Gbl_AslOperatorInfo[]; 171 extern const AH_ASL_KEYWORD Gbl_AslKeywordInfo[]; 172 extern const AH_UUID Gbl_AcpiUuids[]; 173 extern const AH_DIRECTIVE_INFO Gbl_PreprocessorDirectives[]; 174 extern const AH_TABLE Gbl_AcpiSupportedTables[]; 175 176 177 void 178 AhFindAmlOpcode ( 179 char *Name); 180 181 void 182 AhDecodeAmlOpcode ( 183 char *Name); 184 185 void 186 AhDecodeException ( 187 char *Name); 188 189 void 190 AhFindPredefinedNames ( 191 char *Name); 192 193 void 194 AhFindAslAndAmlOperators ( 195 char *Name); 196 197 UINT32 198 AhFindAslOperators ( 199 char *Name); 200 201 void 202 AhFindAslKeywords ( 203 char *Name); 204 205 void 206 AhFindAmlTypes ( 207 char *Name); 208 209 void 210 AhDisplayDeviceIds ( 211 char *Name); 212 213 void 214 AhDisplayTables ( 215 void); 216 217 const AH_TABLE * 218 AcpiAhGetTableInfo ( 219 char *Signature); 220 221 void 222 AhDisplayUuids ( 223 void); 224 225 void 226 AhDisplayDirectives ( 227 void); 228 229 void 230 AhPrintOneField ( 231 UINT32 Indent, 232 UINT32 CurrentPosition, 233 UINT32 MaxPosition, 234 const char *Field); 235 236 #endif /* __ACPIHELP_H */ 237