1 /****************************************************************************** 2 * 3 * Module Name: acapps - common include for ACPI applications/tools 4 * 5 *****************************************************************************/ 6 7 /* 8 * Copyright (C) 2000 - 2014, 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 _ACAPPS 45 #define _ACAPPS 46 47 48 #pragma pack(push) /* Set default struct packing */ 49 50 #ifdef _MSC_VER /* disable some level-4 warnings */ 51 #pragma warning(disable:4100) /* warning C4100: unreferenced formal parameter */ 52 #endif 53 54 /* Common info for tool signons */ 55 56 #define ACPICA_NAME "Intel ACPI Component Architecture" 57 #define ACPICA_COPYRIGHT "Copyright (c) 2000 - 2014 Intel Corporation" 58 59 #if ACPI_MACHINE_WIDTH == 64 60 #define ACPI_WIDTH "-64" 61 62 #elif ACPI_MACHINE_WIDTH == 32 63 #define ACPI_WIDTH "-32" 64 65 #else 66 #error unknown ACPI_MACHINE_WIDTH 67 #define ACPI_WIDTH "-??" 68 69 #endif 70 71 /* Macros for signons and file headers */ 72 73 #define ACPI_COMMON_SIGNON(UtilityName) \ 74 "\n%s\n%s version %8.8X%s [%s]\n%s\n\n", \ 75 ACPICA_NAME, \ 76 UtilityName, ((UINT32) ACPI_CA_VERSION), ACPI_WIDTH, __DATE__, \ 77 ACPICA_COPYRIGHT 78 79 #define ACPI_COMMON_HEADER(UtilityName, Prefix) \ 80 "%s%s\n%s%s version %8.8X%s [%s]\n%s%s\n%s\n", \ 81 Prefix, ACPICA_NAME, \ 82 Prefix, UtilityName, ((UINT32) ACPI_CA_VERSION), ACPI_WIDTH, __DATE__, \ 83 Prefix, ACPICA_COPYRIGHT, \ 84 Prefix 85 86 /* Macros for usage messages */ 87 88 #define ACPI_USAGE_HEADER(Usage) \ 89 printf ("Usage: %s\nOptions:\n", Usage); 90 91 #define ACPI_OPTION(Name, Description) \ 92 printf (" %-18s%s\n", Name, Description); 93 94 95 #define FILE_SUFFIX_DISASSEMBLY "dsl" 96 #define ACPI_TABLE_FILE_SUFFIX ".dat" 97 98 99 /* 100 * getopt 101 */ 102 int 103 AcpiGetopt( 104 int argc, 105 char **argv, 106 char *opts); 107 108 int 109 AcpiGetoptArgument ( 110 int argc, 111 char **argv); 112 113 extern int AcpiGbl_Optind; 114 extern int AcpiGbl_Opterr; 115 extern int AcpiGbl_SubOptChar; 116 extern char *AcpiGbl_Optarg; 117 118 119 #ifndef ACPI_DUMP_APP 120 /* 121 * adisasm 122 */ 123 ACPI_STATUS 124 AdAmlDisassemble ( 125 BOOLEAN OutToFile, 126 char *Filename, 127 char *Prefix, 128 char **OutFilename); 129 130 void 131 AdPrintStatistics ( 132 void); 133 134 ACPI_STATUS 135 AdFindDsdt( 136 UINT8 **DsdtPtr, 137 UINT32 *DsdtLength); 138 139 void 140 AdDumpTables ( 141 void); 142 143 ACPI_STATUS 144 AdGetLocalTables ( 145 void); 146 147 ACPI_STATUS 148 AdParseTable ( 149 ACPI_TABLE_HEADER *Table, 150 ACPI_OWNER_ID *OwnerId, 151 BOOLEAN LoadTable, 152 BOOLEAN External); 153 154 ACPI_STATUS 155 AdDisplayTables ( 156 char *Filename, 157 ACPI_TABLE_HEADER *Table); 158 159 ACPI_STATUS 160 AdDisplayStatistics ( 161 void); 162 163 164 /* 165 * adwalk 166 */ 167 void 168 AcpiDmCrossReferenceNamespace ( 169 ACPI_PARSE_OBJECT *ParseTreeRoot, 170 ACPI_NAMESPACE_NODE *NamespaceRoot, 171 ACPI_OWNER_ID OwnerId); 172 173 void 174 AcpiDmDumpTree ( 175 ACPI_PARSE_OBJECT *Origin); 176 177 void 178 AcpiDmFindOrphanMethods ( 179 ACPI_PARSE_OBJECT *Origin); 180 181 void 182 AcpiDmFinishNamespaceLoad ( 183 ACPI_PARSE_OBJECT *ParseTreeRoot, 184 ACPI_NAMESPACE_NODE *NamespaceRoot, 185 ACPI_OWNER_ID OwnerId); 186 187 void 188 AcpiDmConvertResourceIndexes ( 189 ACPI_PARSE_OBJECT *ParseTreeRoot, 190 ACPI_NAMESPACE_NODE *NamespaceRoot); 191 192 193 /* 194 * adfile 195 */ 196 ACPI_STATUS 197 AdInitialize ( 198 void); 199 200 char * 201 FlGenerateFilename ( 202 char *InputFilename, 203 char *Suffix); 204 205 ACPI_STATUS 206 FlSplitInputPathname ( 207 char *InputPath, 208 char **OutDirectoryPath, 209 char **OutFilename); 210 211 char * 212 AdGenerateFilename ( 213 char *Prefix, 214 char *TableId); 215 216 void 217 AdWriteTable ( 218 ACPI_TABLE_HEADER *Table, 219 UINT32 Length, 220 char *TableName, 221 char *OemTableId); 222 #endif 223 224 #pragma pack(pop) /* Restore original struct packing */ 225 226 #endif /* _ACAPPS */ 227