gdb - Local mods (compile)
[dragonfly.git] / sys / contrib / dev / acpica / source / include / acapps.h
CommitLineData
0d02842f
SW
1/******************************************************************************
2 *
3 * Module Name: acapps - common include for ACPI applications/tools
4 *
5 *****************************************************************************/
6
7/*
fe7b5cb4 8 * Copyright (C) 2000 - 2015, Intel Corp.
0d02842f
SW
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
820c5b08 47#include <stdio.h>
0d02842f
SW
48
49#ifdef _MSC_VER /* disable some level-4 warnings */
50#pragma warning(disable:4100) /* warning C4100: unreferenced formal parameter */
51#endif
52
53/* Common info for tool signons */
54
55#define ACPICA_NAME "Intel ACPI Component Architecture"
fe7b5cb4 56#define ACPICA_COPYRIGHT "Copyright (c) 2000 - 2015 Intel Corporation"
0d02842f
SW
57
58#if ACPI_MACHINE_WIDTH == 64
59#define ACPI_WIDTH "-64"
60
61#elif ACPI_MACHINE_WIDTH == 32
62#define ACPI_WIDTH "-32"
63
64#else
65#error unknown ACPI_MACHINE_WIDTH
66#define ACPI_WIDTH "-??"
67
68#endif
69
70/* Macros for signons and file headers */
71
72#define ACPI_COMMON_SIGNON(UtilityName) \
5943f66c 73 "\n%s\n%s version %8.8X%s\n%s\n\n", \
0d02842f 74 ACPICA_NAME, \
5943f66c 75 UtilityName, ((UINT32) ACPI_CA_VERSION), ACPI_WIDTH, \
0d02842f
SW
76 ACPICA_COPYRIGHT
77
78#define ACPI_COMMON_HEADER(UtilityName, Prefix) \
5943f66c 79 "%s%s\n%s%s version %8.8X%s\n%s%s\n%s\n", \
0d02842f 80 Prefix, ACPICA_NAME, \
5943f66c 81 Prefix, UtilityName, ((UINT32) ACPI_CA_VERSION), ACPI_WIDTH, \
0d02842f
SW
82 Prefix, ACPICA_COPYRIGHT, \
83 Prefix
84
85/* Macros for usage messages */
86
87#define ACPI_USAGE_HEADER(Usage) \
5f39c7e7
SW
88 AcpiOsPrintf ("Usage: %s\nOptions:\n", Usage);
89
90#define ACPI_USAGE_TEXT(Description) \
91 AcpiOsPrintf (Description);
0d02842f
SW
92
93#define ACPI_OPTION(Name, Description) \
12673cf1 94 AcpiOsPrintf (" %-18s%s\n", Name, Description);
0d02842f
SW
95
96
820c5b08
SW
97/* Check for unexpected exceptions */
98
99#define ACPI_CHECK_STATUS(Name, Status, Expected) \
100 if (Status != Expected) \
101 { \
102 AcpiOsPrintf ("Unexpected %s from %s (%s-%d)\n", \
103 AcpiFormatException (Status), #Name, _AcpiModuleName, __LINE__); \
104 }
105
106/* Check for unexpected non-AE_OK errors */
107
108
109#define ACPI_CHECK_OK(Name, Status) ACPI_CHECK_STATUS (Name, Status, AE_OK);
110
0d02842f 111#define FILE_SUFFIX_DISASSEMBLY "dsl"
c6400d37 112#define FILE_SUFFIX_BINARY_TABLE ".dat" /* Needs the dot */
0d02842f
SW
113
114
820c5b08
SW
115/* acfileio */
116
117ACPI_STATUS
12673cf1 118AcpiAcGetAllTablesFromFile (
820c5b08
SW
119 char *Filename,
120 UINT8 GetOnlyAmlTables,
121 ACPI_NEW_TABLE_DESC **ReturnListHead);
122
123/* Values for GetOnlyAmlTables */
124
125#define ACPI_GET_ONLY_AML_TABLES TRUE
126#define ACPI_GET_ALL_TABLES FALSE
127
128
0d02842f
SW
129/*
130 * getopt
131 */
132int
133AcpiGetopt(
134 int argc,
135 char **argv,
136 char *opts);
137
138int
139AcpiGetoptArgument (
140 int argc,
141 char **argv);
142
143extern int AcpiGbl_Optind;
144extern int AcpiGbl_Opterr;
145extern int AcpiGbl_SubOptChar;
146extern char *AcpiGbl_Optarg;
147
148
d4972a9c
SW
149/*
150 * cmfsize - Common get file size function
151 */
152UINT32
153CmGetFileSize (
5f39c7e7 154 ACPI_FILE File);
d4972a9c
SW
155
156
0d02842f
SW
157/*
158 * adwalk
159 */
160void
161AcpiDmCrossReferenceNamespace (
162 ACPI_PARSE_OBJECT *ParseTreeRoot,
163 ACPI_NAMESPACE_NODE *NamespaceRoot,
164 ACPI_OWNER_ID OwnerId);
165
166void
167AcpiDmDumpTree (
168 ACPI_PARSE_OBJECT *Origin);
169
170void
171AcpiDmFindOrphanMethods (
172 ACPI_PARSE_OBJECT *Origin);
173
174void
175AcpiDmFinishNamespaceLoad (
176 ACPI_PARSE_OBJECT *ParseTreeRoot,
177 ACPI_NAMESPACE_NODE *NamespaceRoot,
178 ACPI_OWNER_ID OwnerId);
179
180void
181AcpiDmConvertResourceIndexes (
182 ACPI_PARSE_OBJECT *ParseTreeRoot,
183 ACPI_NAMESPACE_NODE *NamespaceRoot);
184
185
186/*
187 * adfile
188 */
189ACPI_STATUS
190AdInitialize (
191 void);
192
193char *
194FlGenerateFilename (
195 char *InputFilename,
196 char *Suffix);
197
198ACPI_STATUS
199FlSplitInputPathname (
200 char *InputPath,
201 char **OutDirectoryPath,
202 char **OutFilename);
203
204char *
205AdGenerateFilename (
206 char *Prefix,
207 char *TableId);
208
209void
210AdWriteTable (
211 ACPI_TABLE_HEADER *Table,
212 UINT32 Length,
213 char *TableName,
214 char *OemTableId);
0d02842f
SW
215
216#endif /* _ACAPPS */