ReactOS 0.4.15-dev-7654-g6bc40d3
acapps.h
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * Module Name: acapps - common include for ACPI applications/tools
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2022, 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 MERCHANTABILITY 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#ifdef ACPI_USE_STANDARD_HEADERS
48#include <sys/stat.h>
49#endif /* ACPI_USE_STANDARD_HEADERS */
50
51/* Common info for tool signons */
52
53#define ACPICA_NAME "Intel ACPI Component Architecture"
54#define ACPICA_COPYRIGHT "Copyright (c) 2000 - 2022 Intel Corporation"
55
56#if ACPI_MACHINE_WIDTH == 64
57#define ACPI_WIDTH " (64-bit version)"
58
59#elif ACPI_MACHINE_WIDTH == 32
60#define ACPI_WIDTH " (32-bit version)"
61
62#else
63#error unknown ACPI_MACHINE_WIDTH
64#define ACPI_WIDTH " (unknown bit width, not 32 or 64)"
65
66#endif
67
68/* Macros for signons and file headers */
69
70#define ACPI_COMMON_SIGNON(UtilityName) \
71 "\n%s\n%s version %8.8X\n%s\n\n", \
72 ACPICA_NAME, \
73 UtilityName, ((UINT32) ACPI_CA_VERSION), \
74 ACPICA_COPYRIGHT
75
76#define ACPI_COMMON_HEADER(UtilityName, Prefix) \
77 "%s%s\n%s%s version %8.8X%s\n%s%s\n%s\n", \
78 Prefix, ACPICA_NAME, \
79 Prefix, UtilityName, ((UINT32) ACPI_CA_VERSION), ACPI_WIDTH, \
80 Prefix, ACPICA_COPYRIGHT, \
81 Prefix
82
83#define ACPI_COMMON_BUILD_TIME \
84 "Build date/time: %s %s\n", __DATE__, __TIME__
85
86/* Macros for usage messages */
87
88#define ACPI_USAGE_HEADER(Usage) \
89 printf ("Usage: %s\nOptions:\n", Usage);
90
91#define ACPI_USAGE_TEXT(Description) \
92 printf (Description);
93
94#define ACPI_OPTION(Name, Description) \
95 printf (" %-20s%s\n", Name, Description);
96
97
98/* Check for unexpected exceptions */
99
100#define ACPI_CHECK_STATUS(Name, Status, Expected) \
101 if (Status != Expected) \
102 { \
103 AcpiOsPrintf ("Unexpected %s from %s (%s-%d)\n", \
104 AcpiFormatException (Status), #Name, _AcpiModuleName, __LINE__); \
105 }
106
107/* Check for unexpected non-AE_OK errors */
108
109
110#define ACPI_CHECK_OK(Name, Status) ACPI_CHECK_STATUS (Name, Status, AE_OK);
111
112#define FILE_SUFFIX_DISASSEMBLY "dsl"
113#define FILE_SUFFIX_BINARY_TABLE ".dat" /* Needs the dot */
114
115
116/* acfileio */
117
120 char *Filename,
121 UINT8 GetOnlyAmlTables,
122 ACPI_NEW_TABLE_DESC **ReturnListHead);
123
124void
126 ACPI_NEW_TABLE_DESC *ListHead);
127
130 FILE *File);
131
134 FILE *File,
135 long TableOffset);
136
137
138/* Values for GetOnlyAmlTables */
139
140#define ACPI_GET_ONLY_AML_TABLES TRUE
141#define ACPI_GET_ALL_TABLES FALSE
142
143
144/*
145 * getopt
146 */
147int
149 int argc,
150 char **argv,
151 char *opts);
152
153int
155 int argc,
156 char **argv);
157
158extern int AcpiGbl_Optind;
159extern int AcpiGbl_Opterr;
160extern int AcpiGbl_SubOptChar;
161extern char *AcpiGbl_Optarg;
162
163
164/*
165 * cmfsize - Common get file size function
166 */
167UINT32
170
171
172/*
173 * adwalk
174 */
175void
177 ACPI_PARSE_OBJECT *ParseTreeRoot,
178 ACPI_NAMESPACE_NODE *NamespaceRoot,
180
181void
183 ACPI_PARSE_OBJECT *Origin);
184
185void
187 ACPI_PARSE_OBJECT *Origin);
188
189void
191 ACPI_PARSE_OBJECT *ParseTreeRoot,
192 ACPI_NAMESPACE_NODE *NamespaceRoot,
194
195void
197 ACPI_PARSE_OBJECT *ParseTreeRoot,
198 ACPI_NAMESPACE_NODE *NamespaceRoot);
199
200
201/*
202 * adfile
203 */
206 void);
207
208char *
210 char *InputFilename,
211 char *Suffix);
212
215 char *InputPath,
216 char **OutDirectoryPath,
217 char **OutFilename);
218
219char *
221 char *FilePathname);
222
223char *
225 char *Prefix,
226 char *TableId);
227
228void
232 char *TableName,
233 char *OemTableId);
234
235#endif /* _ACAPPS */
unsigned char BOOLEAN
unsigned char UINT8
unsigned int UINT32
static int argc
Definition: ServiceArgs.c:12
void AcpiDmDumpTree(ACPI_PARSE_OBJECT *Origin)
UINT32 CmGetFileSize(ACPI_FILE File)
void AcDeleteTableList(ACPI_NEW_TABLE_DESC *ListHead)
ACPI_STATUS AdInitialize(void)
void AcpiDmConvertParseObjects(ACPI_PARSE_OBJECT *ParseTreeRoot, ACPI_NAMESPACE_NODE *NamespaceRoot)
void AcpiDmFindOrphanMethods(ACPI_PARSE_OBJECT *Origin)
void AdWriteTable(ACPI_TABLE_HEADER *Table, UINT32 Length, char *TableName, char *OemTableId)
char * AcpiGbl_Optarg
void AcpiDmCrossReferenceNamespace(ACPI_PARSE_OBJECT *ParseTreeRoot, ACPI_NAMESPACE_NODE *NamespaceRoot, ACPI_OWNER_ID OwnerId)
ACPI_STATUS AcValidateTableHeader(FILE *File, long TableOffset)
char * FlGetFileBasename(char *FilePathname)
ACPI_STATUS AcGetAllTablesFromFile(char *Filename, UINT8 GetOnlyAmlTables, ACPI_NEW_TABLE_DESC **ReturnListHead)
int AcpiGbl_Opterr
int AcpiGetopt(int argc, char **argv, char *opts)
int AcpiGetoptArgument(int argc, char **argv)
char * FlGenerateFilename(char *InputFilename, char *Suffix)
void AcpiDmFinishNamespaceLoad(ACPI_PARSE_OBJECT *ParseTreeRoot, ACPI_NAMESPACE_NODE *NamespaceRoot, ACPI_OWNER_ID OwnerId)
int AcpiGbl_Optind
int AcpiGbl_SubOptChar
BOOLEAN AcIsFileBinary(FILE *File)
ACPI_STATUS FlSplitInputPathname(char *InputPath, char **OutDirectoryPath, char **OutFilename)
char * AdGenerateFilename(char *Prefix, char *TableId)
#define ACPI_FILE
Definition: acenv.h:404
UINT32 ACPI_STATUS
Definition: actypes.h:460
UINT16 ACPI_OWNER_ID
Definition: actypes.h:486
Definition: File.h:16
IN PVCB IN PBCB OUT PDIRENT IN USHORT IN POEM_STRING Filename
Definition: fatprocs.h:939
_Must_inspect_result_ _In_opt_ PVOID OwnerId
Definition: fsrtlfuncs.h:907
ASMGENDATA Table[]
Definition: genincdata.c:61
#define argv
Definition: mplay32.c:18
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
_In_ __drv_aliasesMem PSTRING Prefix
Definition: rtlfuncs.h:1630