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