acpixtract.c revision 1.1.1.2.4.2 1 1.1.1.2.4.2 rmind
2 1.1.1.2.4.2 rmind /******************************************************************************
3 1.1.1.2.4.2 rmind *
4 1.1.1.2.4.2 rmind * Module Name: acpixtract - convert ascii ACPI tables to binary
5 1.1.1.2.4.2 rmind *
6 1.1.1.2.4.2 rmind *****************************************************************************/
7 1.1.1.2.4.2 rmind
8 1.1.1.2.4.2 rmind /*
9 1.1.1.2.4.2 rmind * Copyright (C) 2000 - 2011, Intel Corp.
10 1.1.1.2.4.2 rmind * All rights reserved.
11 1.1.1.2.4.2 rmind *
12 1.1.1.2.4.2 rmind * Redistribution and use in source and binary forms, with or without
13 1.1.1.2.4.2 rmind * modification, are permitted provided that the following conditions
14 1.1.1.2.4.2 rmind * are met:
15 1.1.1.2.4.2 rmind * 1. Redistributions of source code must retain the above copyright
16 1.1.1.2.4.2 rmind * notice, this list of conditions, and the following disclaimer,
17 1.1.1.2.4.2 rmind * without modification.
18 1.1.1.2.4.2 rmind * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 1.1.1.2.4.2 rmind * substantially similar to the "NO WARRANTY" disclaimer below
20 1.1.1.2.4.2 rmind * ("Disclaimer") and any redistribution must be conditioned upon
21 1.1.1.2.4.2 rmind * including a substantially similar Disclaimer requirement for further
22 1.1.1.2.4.2 rmind * binary redistribution.
23 1.1.1.2.4.2 rmind * 3. Neither the names of the above-listed copyright holders nor the names
24 1.1.1.2.4.2 rmind * of any contributors may be used to endorse or promote products derived
25 1.1.1.2.4.2 rmind * from this software without specific prior written permission.
26 1.1.1.2.4.2 rmind *
27 1.1.1.2.4.2 rmind * Alternatively, this software may be distributed under the terms of the
28 1.1.1.2.4.2 rmind * GNU General Public License ("GPL") version 2 as published by the Free
29 1.1.1.2.4.2 rmind * Software Foundation.
30 1.1.1.2.4.2 rmind *
31 1.1.1.2.4.2 rmind * NO WARRANTY
32 1.1.1.2.4.2 rmind * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 1.1.1.2.4.2 rmind * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 1.1.1.2.4.2 rmind * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 1.1.1.2.4.2 rmind * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 1.1.1.2.4.2 rmind * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 1.1.1.2.4.2 rmind * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 1.1.1.2.4.2 rmind * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 1.1.1.2.4.2 rmind * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 1.1.1.2.4.2 rmind * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 1.1.1.2.4.2 rmind * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 1.1.1.2.4.2 rmind * POSSIBILITY OF SUCH DAMAGES.
43 1.1.1.2.4.2 rmind */
44 1.1.1.2.4.2 rmind
45 1.1.1.2.4.2 rmind #include <stdio.h>
46 1.1.1.2.4.2 rmind #include <stdlib.h>
47 1.1.1.2.4.2 rmind #include <string.h>
48 1.1.1.2.4.2 rmind #include <ctype.h>
49 1.1.1.2.4.2 rmind
50 1.1.1.2.4.2 rmind
51 1.1.1.2.4.2 rmind /* Note: This is a 32-bit program only */
52 1.1.1.2.4.2 rmind
53 1.1.1.2.4.2 rmind #define VERSION 0x20100107
54 1.1.1.2.4.2 rmind #define FIND_HEADER 0
55 1.1.1.2.4.2 rmind #define EXTRACT_DATA 1
56 1.1.1.2.4.2 rmind #define BUFFER_SIZE 256
57 1.1.1.2.4.2 rmind
58 1.1.1.2.4.2 rmind
59 1.1.1.2.4.2 rmind /* Local prototypes */
60 1.1.1.2.4.2 rmind
61 1.1.1.2.4.2 rmind static void
62 1.1.1.2.4.2 rmind CheckAscii (
63 1.1.1.2.4.2 rmind char *Name,
64 1.1.1.2.4.2 rmind int Count);
65 1.1.1.2.4.2 rmind
66 1.1.1.2.4.2 rmind static void
67 1.1.1.2.4.2 rmind NormalizeSignature (
68 1.1.1.2.4.2 rmind char *Signature);
69 1.1.1.2.4.2 rmind
70 1.1.1.2.4.2 rmind static unsigned int
71 1.1.1.2.4.2 rmind GetNextInstance (
72 1.1.1.2.4.2 rmind char *InputPathname,
73 1.1.1.2.4.2 rmind char *Signature);
74 1.1.1.2.4.2 rmind
75 1.1.1.2.4.2 rmind static int
76 1.1.1.2.4.2 rmind ExtractTables (
77 1.1.1.2.4.2 rmind char *InputPathname,
78 1.1.1.2.4.2 rmind char *Signature,
79 1.1.1.2.4.2 rmind unsigned int MinimumInstances);
80 1.1.1.2.4.2 rmind
81 1.1.1.2.4.2 rmind static size_t
82 1.1.1.2.4.2 rmind GetTableHeader (
83 1.1.1.2.4.2 rmind FILE *InputFile,
84 1.1.1.2.4.2 rmind unsigned char *OutputData);
85 1.1.1.2.4.2 rmind
86 1.1.1.2.4.2 rmind static unsigned int
87 1.1.1.2.4.2 rmind CountTableInstances (
88 1.1.1.2.4.2 rmind char *InputPathname,
89 1.1.1.2.4.2 rmind char *Signature);
90 1.1.1.2.4.2 rmind
91 1.1.1.2.4.2 rmind static int
92 1.1.1.2.4.2 rmind ListTables (
93 1.1.1.2.4.2 rmind char *InputPathname);
94 1.1.1.2.4.2 rmind
95 1.1.1.2.4.2 rmind static size_t
96 1.1.1.2.4.2 rmind ConvertLine (
97 1.1.1.2.4.2 rmind char *InputLine,
98 1.1.1.2.4.2 rmind unsigned char *OutputData);
99 1.1.1.2.4.2 rmind
100 1.1.1.2.4.2 rmind static void
101 1.1.1.2.4.2 rmind DisplayUsage (
102 1.1.1.2.4.2 rmind void);
103 1.1.1.2.4.2 rmind
104 1.1.1.2.4.2 rmind
105 1.1.1.2.4.2 rmind typedef struct acpi_table_header
106 1.1.1.2.4.2 rmind {
107 1.1.1.2.4.2 rmind char Signature[4];
108 1.1.1.2.4.2 rmind int Length;
109 1.1.1.2.4.2 rmind unsigned char Revision;
110 1.1.1.2.4.2 rmind unsigned char Checksum;
111 1.1.1.2.4.2 rmind char OemId[6];
112 1.1.1.2.4.2 rmind char OemTableId[8];
113 1.1.1.2.4.2 rmind int OemRevision;
114 1.1.1.2.4.2 rmind char AslCompilerId[4];
115 1.1.1.2.4.2 rmind int AslCompilerRevision;
116 1.1.1.2.4.2 rmind
117 1.1.1.2.4.2 rmind } ACPI_TABLE_HEADER;
118 1.1.1.2.4.2 rmind
119 1.1.1.2.4.2 rmind struct TableInfo
120 1.1.1.2.4.2 rmind {
121 1.1.1.2.4.2 rmind unsigned int Signature;
122 1.1.1.2.4.2 rmind unsigned int Instances;
123 1.1.1.2.4.2 rmind unsigned int NextInstance;
124 1.1.1.2.4.2 rmind struct TableInfo *Next;
125 1.1.1.2.4.2 rmind };
126 1.1.1.2.4.2 rmind
127 1.1.1.2.4.2 rmind static struct TableInfo *ListHead = NULL;
128 1.1.1.2.4.2 rmind static char Filename[16];
129 1.1.1.2.4.2 rmind static unsigned char Data[16];
130 1.1.1.2.4.2 rmind
131 1.1.1.2.4.2 rmind
132 1.1.1.2.4.2 rmind /******************************************************************************
133 1.1.1.2.4.2 rmind *
134 1.1.1.2.4.2 rmind * FUNCTION: DisplayUsage
135 1.1.1.2.4.2 rmind *
136 1.1.1.2.4.2 rmind * DESCRIPTION: Usage message
137 1.1.1.2.4.2 rmind *
138 1.1.1.2.4.2 rmind ******************************************************************************/
139 1.1.1.2.4.2 rmind
140 1.1.1.2.4.2 rmind static void
141 1.1.1.2.4.2 rmind DisplayUsage (
142 1.1.1.2.4.2 rmind void)
143 1.1.1.2.4.2 rmind {
144 1.1.1.2.4.2 rmind
145 1.1.1.2.4.2 rmind printf ("Usage: acpixtract [option] <InputFile>\n");
146 1.1.1.2.4.2 rmind printf ("\nExtract binary ACPI tables from text acpidump output\n");
147 1.1.1.2.4.2 rmind printf ("Default invocation extracts all DSDTs and SSDTs\n");
148 1.1.1.2.4.2 rmind printf ("Version %8.8X\n\n", VERSION);
149 1.1.1.2.4.2 rmind printf ("Options:\n");
150 1.1.1.2.4.2 rmind printf (" -a Extract all tables, not just DSDT/SSDT\n");
151 1.1.1.2.4.2 rmind printf (" -l List table summaries, do not extract\n");
152 1.1.1.2.4.2 rmind printf (" -s<Signature> Extract all tables named <Signature>\n");
153 1.1.1.2.4.2 rmind printf ("\n");
154 1.1.1.2.4.2 rmind }
155 1.1.1.2.4.2 rmind
156 1.1.1.2.4.2 rmind
157 1.1.1.2.4.2 rmind /*******************************************************************************
158 1.1.1.2.4.2 rmind *
159 1.1.1.2.4.2 rmind * FUNCTION: CheckAscii
160 1.1.1.2.4.2 rmind *
161 1.1.1.2.4.2 rmind * PARAMETERS: Name - Ascii string, at least as long as Count
162 1.1.1.2.4.2 rmind * Count - Number of characters to check
163 1.1.1.2.4.2 rmind *
164 1.1.1.2.4.2 rmind * RETURN: None
165 1.1.1.2.4.2 rmind *
166 1.1.1.2.4.2 rmind * DESCRIPTION: Ensure that the requested number of characters are printable
167 1.1.1.2.4.2 rmind * Ascii characters. Sets non-printable and null chars to <space>.
168 1.1.1.2.4.2 rmind *
169 1.1.1.2.4.2 rmind ******************************************************************************/
170 1.1.1.2.4.2 rmind
171 1.1.1.2.4.2 rmind static void
172 1.1.1.2.4.2 rmind CheckAscii (
173 1.1.1.2.4.2 rmind char *Name,
174 1.1.1.2.4.2 rmind int Count)
175 1.1.1.2.4.2 rmind {
176 1.1.1.2.4.2 rmind int i;
177 1.1.1.2.4.2 rmind
178 1.1.1.2.4.2 rmind
179 1.1.1.2.4.2 rmind for (i = 0; i < Count; i++)
180 1.1.1.2.4.2 rmind {
181 1.1.1.2.4.2 rmind if (!Name[i] || !isprint ((int) Name[i]))
182 1.1.1.2.4.2 rmind {
183 1.1.1.2.4.2 rmind Name[i] = ' ';
184 1.1.1.2.4.2 rmind }
185 1.1.1.2.4.2 rmind }
186 1.1.1.2.4.2 rmind }
187 1.1.1.2.4.2 rmind
188 1.1.1.2.4.2 rmind
189 1.1.1.2.4.2 rmind /*******************************************************************************
190 1.1.1.2.4.2 rmind *
191 1.1.1.2.4.2 rmind * FUNCTION: NormalizeSignature
192 1.1.1.2.4.2 rmind *
193 1.1.1.2.4.2 rmind * PARAMETERS: Name - Ascii string containing an ACPI signature
194 1.1.1.2.4.2 rmind *
195 1.1.1.2.4.2 rmind * RETURN: None
196 1.1.1.2.4.2 rmind *
197 1.1.1.2.4.2 rmind * DESCRIPTION: Change "RSD PTR" to "RSDP"
198 1.1.1.2.4.2 rmind *
199 1.1.1.2.4.2 rmind ******************************************************************************/
200 1.1.1.2.4.2 rmind
201 1.1.1.2.4.2 rmind static void
202 1.1.1.2.4.2 rmind NormalizeSignature (
203 1.1.1.2.4.2 rmind char *Signature)
204 1.1.1.2.4.2 rmind {
205 1.1.1.2.4.2 rmind
206 1.1.1.2.4.2 rmind if (!strncmp (Signature, "RSD ", 4))
207 1.1.1.2.4.2 rmind {
208 1.1.1.2.4.2 rmind Signature[3] = 'P';
209 1.1.1.2.4.2 rmind }
210 1.1.1.2.4.2 rmind }
211 1.1.1.2.4.2 rmind
212 1.1.1.2.4.2 rmind
213 1.1.1.2.4.2 rmind /******************************************************************************
214 1.1.1.2.4.2 rmind *
215 1.1.1.2.4.2 rmind * FUNCTION: ConvertLine
216 1.1.1.2.4.2 rmind *
217 1.1.1.2.4.2 rmind * PARAMETERS: InputLine - One line from the input acpidump file
218 1.1.1.2.4.2 rmind * OutputData - Where the converted data is returned
219 1.1.1.2.4.2 rmind *
220 1.1.1.2.4.2 rmind * RETURN: The number of bytes actually converted
221 1.1.1.2.4.2 rmind *
222 1.1.1.2.4.2 rmind * DESCRIPTION: Convert one line of ascii text binary (up to 16 bytes)
223 1.1.1.2.4.2 rmind *
224 1.1.1.2.4.2 rmind ******************************************************************************/
225 1.1.1.2.4.2 rmind
226 1.1.1.2.4.2 rmind static size_t
227 1.1.1.2.4.2 rmind ConvertLine (
228 1.1.1.2.4.2 rmind char *InputLine,
229 1.1.1.2.4.2 rmind unsigned char *OutputData)
230 1.1.1.2.4.2 rmind {
231 1.1.1.2.4.2 rmind char *End;
232 1.1.1.2.4.2 rmind int BytesConverted;
233 1.1.1.2.4.2 rmind int Converted[16];
234 1.1.1.2.4.2 rmind int i;
235 1.1.1.2.4.2 rmind
236 1.1.1.2.4.2 rmind
237 1.1.1.2.4.2 rmind /* Terminate the input line at the end of the actual data (for sscanf) */
238 1.1.1.2.4.2 rmind
239 1.1.1.2.4.2 rmind End = strstr (InputLine + 2, " ");
240 1.1.1.2.4.2 rmind if (!End)
241 1.1.1.2.4.2 rmind {
242 1.1.1.2.4.2 rmind return (0); /* Don't understand the format */
243 1.1.1.2.4.2 rmind }
244 1.1.1.2.4.2 rmind *End = 0;
245 1.1.1.2.4.2 rmind
246 1.1.1.2.4.2 rmind /*
247 1.1.1.2.4.2 rmind * Convert one line of table data, of the form:
248 1.1.1.2.4.2 rmind * <offset>: <up to 16 bytes of hex data> <ASCII representation> <newline>
249 1.1.1.2.4.2 rmind *
250 1.1.1.2.4.2 rmind * Example:
251 1.1.1.2.4.2 rmind * 02C0: 5F 53 42 5F 4C 4E 4B 44 00 12 13 04 0C FF FF 08 _SB_LNKD........
252 1.1.1.2.4.2 rmind */
253 1.1.1.2.4.2 rmind BytesConverted = sscanf (InputLine,
254 1.1.1.2.4.2 rmind "%*s %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x",
255 1.1.1.2.4.2 rmind &Converted[0], &Converted[1], &Converted[2], &Converted[3],
256 1.1.1.2.4.2 rmind &Converted[4], &Converted[5], &Converted[6], &Converted[7],
257 1.1.1.2.4.2 rmind &Converted[8], &Converted[9], &Converted[10], &Converted[11],
258 1.1.1.2.4.2 rmind &Converted[12], &Converted[13], &Converted[14], &Converted[15]);
259 1.1.1.2.4.2 rmind
260 1.1.1.2.4.2 rmind /* Pack converted data into a byte array */
261 1.1.1.2.4.2 rmind
262 1.1.1.2.4.2 rmind for (i = 0; i < BytesConverted; i++)
263 1.1.1.2.4.2 rmind {
264 1.1.1.2.4.2 rmind OutputData[i] = (unsigned char) Converted[i];
265 1.1.1.2.4.2 rmind }
266 1.1.1.2.4.2 rmind
267 1.1.1.2.4.2 rmind return ((size_t) BytesConverted);
268 1.1.1.2.4.2 rmind }
269 1.1.1.2.4.2 rmind
270 1.1.1.2.4.2 rmind
271 1.1.1.2.4.2 rmind /******************************************************************************
272 1.1.1.2.4.2 rmind *
273 1.1.1.2.4.2 rmind * FUNCTION: GetTableHeader
274 1.1.1.2.4.2 rmind *
275 1.1.1.2.4.2 rmind * PARAMETERS: InputFile - Handle for the input acpidump file
276 1.1.1.2.4.2 rmind * OutputData - Where the table header is returned
277 1.1.1.2.4.2 rmind *
278 1.1.1.2.4.2 rmind * RETURN: The actual number of bytes converted
279 1.1.1.2.4.2 rmind *
280 1.1.1.2.4.2 rmind * DESCRIPTION: Extract and convert an ACPI table header
281 1.1.1.2.4.2 rmind *
282 1.1.1.2.4.2 rmind ******************************************************************************/
283 1.1.1.2.4.2 rmind
284 1.1.1.2.4.2 rmind static size_t
285 1.1.1.2.4.2 rmind GetTableHeader (
286 1.1.1.2.4.2 rmind FILE *InputFile,
287 1.1.1.2.4.2 rmind unsigned char *OutputData)
288 1.1.1.2.4.2 rmind {
289 1.1.1.2.4.2 rmind size_t BytesConverted;
290 1.1.1.2.4.2 rmind size_t TotalConverted = 0;
291 1.1.1.2.4.2 rmind char Buffer[BUFFER_SIZE];
292 1.1.1.2.4.2 rmind int i;
293 1.1.1.2.4.2 rmind
294 1.1.1.2.4.2 rmind
295 1.1.1.2.4.2 rmind /* Get the full 36 byte header, requires 3 lines */
296 1.1.1.2.4.2 rmind
297 1.1.1.2.4.2 rmind for (i = 0; i < 3; i++)
298 1.1.1.2.4.2 rmind {
299 1.1.1.2.4.2 rmind if (!fgets (Buffer, BUFFER_SIZE, InputFile))
300 1.1.1.2.4.2 rmind {
301 1.1.1.2.4.2 rmind return (TotalConverted);
302 1.1.1.2.4.2 rmind }
303 1.1.1.2.4.2 rmind
304 1.1.1.2.4.2 rmind BytesConverted = ConvertLine (Buffer, OutputData);
305 1.1.1.2.4.2 rmind TotalConverted += BytesConverted;
306 1.1.1.2.4.2 rmind OutputData += 16;
307 1.1.1.2.4.2 rmind
308 1.1.1.2.4.2 rmind if (BytesConverted != 16)
309 1.1.1.2.4.2 rmind {
310 1.1.1.2.4.2 rmind return (TotalConverted);
311 1.1.1.2.4.2 rmind }
312 1.1.1.2.4.2 rmind }
313 1.1.1.2.4.2 rmind
314 1.1.1.2.4.2 rmind return (TotalConverted);
315 1.1.1.2.4.2 rmind }
316 1.1.1.2.4.2 rmind
317 1.1.1.2.4.2 rmind
318 1.1.1.2.4.2 rmind /******************************************************************************
319 1.1.1.2.4.2 rmind *
320 1.1.1.2.4.2 rmind * FUNCTION: CountTableInstances
321 1.1.1.2.4.2 rmind *
322 1.1.1.2.4.2 rmind * PARAMETERS: InputPathname - Filename for acpidump file
323 1.1.1.2.4.2 rmind * Signature - Requested signature to count
324 1.1.1.2.4.2 rmind *
325 1.1.1.2.4.2 rmind * RETURN: The number of instances of the signature
326 1.1.1.2.4.2 rmind *
327 1.1.1.2.4.2 rmind * DESCRIPTION: Count the instances of tables with the given signature within
328 1.1.1.2.4.2 rmind * the input acpidump file.
329 1.1.1.2.4.2 rmind *
330 1.1.1.2.4.2 rmind ******************************************************************************/
331 1.1.1.2.4.2 rmind
332 1.1.1.2.4.2 rmind static unsigned int
333 1.1.1.2.4.2 rmind CountTableInstances (
334 1.1.1.2.4.2 rmind char *InputPathname,
335 1.1.1.2.4.2 rmind char *Signature)
336 1.1.1.2.4.2 rmind {
337 1.1.1.2.4.2 rmind char Buffer[BUFFER_SIZE];
338 1.1.1.2.4.2 rmind FILE *InputFile;
339 1.1.1.2.4.2 rmind unsigned int Instances = 0;
340 1.1.1.2.4.2 rmind
341 1.1.1.2.4.2 rmind
342 1.1.1.2.4.2 rmind InputFile = fopen (InputPathname, "rt");
343 1.1.1.2.4.2 rmind if (!InputFile)
344 1.1.1.2.4.2 rmind {
345 1.1.1.2.4.2 rmind printf ("Could not open %s\n", InputPathname);
346 1.1.1.2.4.2 rmind return (0);
347 1.1.1.2.4.2 rmind }
348 1.1.1.2.4.2 rmind
349 1.1.1.2.4.2 rmind /* Count the number of instances of this signature */
350 1.1.1.2.4.2 rmind
351 1.1.1.2.4.2 rmind while (fgets (Buffer, BUFFER_SIZE, InputFile))
352 1.1.1.2.4.2 rmind {
353 1.1.1.2.4.2 rmind /* Ignore empty lines and lines that start with a space */
354 1.1.1.2.4.2 rmind
355 1.1.1.2.4.2 rmind if ((Buffer[0] == ' ') ||
356 1.1.1.2.4.2 rmind (Buffer[0] == '\n'))
357 1.1.1.2.4.2 rmind {
358 1.1.1.2.4.2 rmind continue;
359 1.1.1.2.4.2 rmind }
360 1.1.1.2.4.2 rmind
361 1.1.1.2.4.2 rmind NormalizeSignature (Buffer);
362 1.1.1.2.4.2 rmind if (!strncmp (Buffer, Signature, 4))
363 1.1.1.2.4.2 rmind {
364 1.1.1.2.4.2 rmind Instances++;
365 1.1.1.2.4.2 rmind }
366 1.1.1.2.4.2 rmind }
367 1.1.1.2.4.2 rmind
368 1.1.1.2.4.2 rmind fclose (InputFile);
369 1.1.1.2.4.2 rmind return (Instances);
370 1.1.1.2.4.2 rmind }
371 1.1.1.2.4.2 rmind
372 1.1.1.2.4.2 rmind
373 1.1.1.2.4.2 rmind /******************************************************************************
374 1.1.1.2.4.2 rmind *
375 1.1.1.2.4.2 rmind * FUNCTION: GetNextInstance
376 1.1.1.2.4.2 rmind *
377 1.1.1.2.4.2 rmind * PARAMETERS: InputPathname - Filename for acpidump file
378 1.1.1.2.4.2 rmind * Signature - Requested ACPI signature
379 1.1.1.2.4.2 rmind *
380 1.1.1.2.4.2 rmind * RETURN: The next instance number for this signature. Zero if this
381 1.1.1.2.4.2 rmind * is the first instance of this signature.
382 1.1.1.2.4.2 rmind *
383 1.1.1.2.4.2 rmind * DESCRIPTION: Get the next instance number of the specified table. If this
384 1.1.1.2.4.2 rmind * is the first instance of the table, create a new instance
385 1.1.1.2.4.2 rmind * block. Note: only SSDT and PSDT tables can have multiple
386 1.1.1.2.4.2 rmind * instances.
387 1.1.1.2.4.2 rmind *
388 1.1.1.2.4.2 rmind ******************************************************************************/
389 1.1.1.2.4.2 rmind
390 1.1.1.2.4.2 rmind static unsigned int
391 1.1.1.2.4.2 rmind GetNextInstance (
392 1.1.1.2.4.2 rmind char *InputPathname,
393 1.1.1.2.4.2 rmind char *Signature)
394 1.1.1.2.4.2 rmind {
395 1.1.1.2.4.2 rmind struct TableInfo *Info;
396 1.1.1.2.4.2 rmind
397 1.1.1.2.4.2 rmind
398 1.1.1.2.4.2 rmind Info = ListHead;
399 1.1.1.2.4.2 rmind while (Info)
400 1.1.1.2.4.2 rmind {
401 1.1.1.2.4.2 rmind if (*(unsigned int *) Signature == Info->Signature)
402 1.1.1.2.4.2 rmind {
403 1.1.1.2.4.2 rmind break;
404 1.1.1.2.4.2 rmind }
405 1.1.1.2.4.2 rmind
406 1.1.1.2.4.2 rmind Info = Info->Next;
407 1.1.1.2.4.2 rmind }
408 1.1.1.2.4.2 rmind
409 1.1.1.2.4.2 rmind if (!Info)
410 1.1.1.2.4.2 rmind {
411 1.1.1.2.4.2 rmind /* Signature not found, create new table info block */
412 1.1.1.2.4.2 rmind
413 1.1.1.2.4.2 rmind Info = malloc (sizeof (struct TableInfo));
414 1.1.1.2.4.2 rmind if (!Info)
415 1.1.1.2.4.2 rmind {
416 1.1.1.2.4.2 rmind printf ("Could not allocate memory\n");
417 1.1.1.2.4.2 rmind exit (0);
418 1.1.1.2.4.2 rmind }
419 1.1.1.2.4.2 rmind
420 1.1.1.2.4.2 rmind Info->Signature = *(unsigned int *) Signature;
421 1.1.1.2.4.2 rmind Info->Instances = CountTableInstances (InputPathname, Signature);
422 1.1.1.2.4.2 rmind Info->NextInstance = 1;
423 1.1.1.2.4.2 rmind Info->Next = ListHead;
424 1.1.1.2.4.2 rmind ListHead = Info;
425 1.1.1.2.4.2 rmind }
426 1.1.1.2.4.2 rmind
427 1.1.1.2.4.2 rmind if (Info->Instances > 1)
428 1.1.1.2.4.2 rmind {
429 1.1.1.2.4.2 rmind return (Info->NextInstance++);
430 1.1.1.2.4.2 rmind }
431 1.1.1.2.4.2 rmind
432 1.1.1.2.4.2 rmind return (0);
433 1.1.1.2.4.2 rmind }
434 1.1.1.2.4.2 rmind
435 1.1.1.2.4.2 rmind
436 1.1.1.2.4.2 rmind /******************************************************************************
437 1.1.1.2.4.2 rmind *
438 1.1.1.2.4.2 rmind * FUNCTION: ExtractTables
439 1.1.1.2.4.2 rmind *
440 1.1.1.2.4.2 rmind * PARAMETERS: InputPathname - Filename for acpidump file
441 1.1.1.2.4.2 rmind * Signature - Requested ACPI signature to extract.
442 1.1.1.2.4.2 rmind * NULL means extract ALL tables.
443 1.1.1.2.4.2 rmind * MinimumInstances - Min instances that are acceptable
444 1.1.1.2.4.2 rmind *
445 1.1.1.2.4.2 rmind * RETURN: Status
446 1.1.1.2.4.2 rmind *
447 1.1.1.2.4.2 rmind * DESCRIPTION: Convert text ACPI tables to binary
448 1.1.1.2.4.2 rmind *
449 1.1.1.2.4.2 rmind ******************************************************************************/
450 1.1.1.2.4.2 rmind
451 1.1.1.2.4.2 rmind static int
452 1.1.1.2.4.2 rmind ExtractTables (
453 1.1.1.2.4.2 rmind char *InputPathname,
454 1.1.1.2.4.2 rmind char *Signature,
455 1.1.1.2.4.2 rmind unsigned int MinimumInstances)
456 1.1.1.2.4.2 rmind {
457 1.1.1.2.4.2 rmind char Buffer[BUFFER_SIZE];
458 1.1.1.2.4.2 rmind FILE *InputFile;
459 1.1.1.2.4.2 rmind FILE *OutputFile = NULL;
460 1.1.1.2.4.2 rmind size_t BytesWritten;
461 1.1.1.2.4.2 rmind size_t TotalBytesWritten = 0;
462 1.1.1.2.4.2 rmind size_t BytesConverted;
463 1.1.1.2.4.2 rmind unsigned int State = FIND_HEADER;
464 1.1.1.2.4.2 rmind unsigned int FoundTable = 0;
465 1.1.1.2.4.2 rmind unsigned int Instances = 0;
466 1.1.1.2.4.2 rmind unsigned int ThisInstance;
467 1.1.1.2.4.2 rmind char ThisSignature[4];
468 1.1.1.2.4.2 rmind int Status = 0;
469 1.1.1.2.4.2 rmind
470 1.1.1.2.4.2 rmind
471 1.1.1.2.4.2 rmind /* Open input in text mode, output is in binary mode */
472 1.1.1.2.4.2 rmind
473 1.1.1.2.4.2 rmind InputFile = fopen (InputPathname, "rt");
474 1.1.1.2.4.2 rmind if (!InputFile)
475 1.1.1.2.4.2 rmind {
476 1.1.1.2.4.2 rmind printf ("Could not open %s\n", InputPathname);
477 1.1.1.2.4.2 rmind return (-1);
478 1.1.1.2.4.2 rmind }
479 1.1.1.2.4.2 rmind
480 1.1.1.2.4.2 rmind if (Signature)
481 1.1.1.2.4.2 rmind {
482 1.1.1.2.4.2 rmind /* Are there enough instances of the table to continue? */
483 1.1.1.2.4.2 rmind
484 1.1.1.2.4.2 rmind NormalizeSignature (Signature);
485 1.1.1.2.4.2 rmind
486 1.1.1.2.4.2 rmind Instances = CountTableInstances (InputPathname, Signature);
487 1.1.1.2.4.2 rmind if (Instances < MinimumInstances)
488 1.1.1.2.4.2 rmind {
489 1.1.1.2.4.2 rmind printf ("Table %s was not found in %s\n", Signature, InputPathname);
490 1.1.1.2.4.2 rmind Status = -1;
491 1.1.1.2.4.2 rmind goto CleanupAndExit;
492 1.1.1.2.4.2 rmind }
493 1.1.1.2.4.2 rmind
494 1.1.1.2.4.2 rmind if (Instances == 0)
495 1.1.1.2.4.2 rmind {
496 1.1.1.2.4.2 rmind goto CleanupAndExit;
497 1.1.1.2.4.2 rmind }
498 1.1.1.2.4.2 rmind }
499 1.1.1.2.4.2 rmind
500 1.1.1.2.4.2 rmind /* Convert all instances of the table to binary */
501 1.1.1.2.4.2 rmind
502 1.1.1.2.4.2 rmind while (fgets (Buffer, BUFFER_SIZE, InputFile))
503 1.1.1.2.4.2 rmind {
504 1.1.1.2.4.2 rmind switch (State)
505 1.1.1.2.4.2 rmind {
506 1.1.1.2.4.2 rmind case FIND_HEADER:
507 1.1.1.2.4.2 rmind
508 1.1.1.2.4.2 rmind /* Ignore empty lines and lines that start with a space */
509 1.1.1.2.4.2 rmind
510 1.1.1.2.4.2 rmind if ((Buffer[0] == ' ') ||
511 1.1.1.2.4.2 rmind (Buffer[0] == '\n'))
512 1.1.1.2.4.2 rmind {
513 1.1.1.2.4.2 rmind continue;
514 1.1.1.2.4.2 rmind }
515 1.1.1.2.4.2 rmind
516 1.1.1.2.4.2 rmind NormalizeSignature (Buffer);
517 1.1.1.2.4.2 rmind strncpy (ThisSignature, Buffer, 4);
518 1.1.1.2.4.2 rmind
519 1.1.1.2.4.2 rmind if (Signature)
520 1.1.1.2.4.2 rmind {
521 1.1.1.2.4.2 rmind /* Ignore signatures that don't match */
522 1.1.1.2.4.2 rmind
523 1.1.1.2.4.2 rmind if (strncmp (ThisSignature, Signature, 4))
524 1.1.1.2.4.2 rmind {
525 1.1.1.2.4.2 rmind continue;
526 1.1.1.2.4.2 rmind }
527 1.1.1.2.4.2 rmind }
528 1.1.1.2.4.2 rmind
529 1.1.1.2.4.2 rmind /*
530 1.1.1.2.4.2 rmind * Get the instance number for this signature. Only the
531 1.1.1.2.4.2 rmind * SSDT and PSDT tables can have multiple instances.
532 1.1.1.2.4.2 rmind */
533 1.1.1.2.4.2 rmind ThisInstance = GetNextInstance (InputPathname, ThisSignature);
534 1.1.1.2.4.2 rmind
535 1.1.1.2.4.2 rmind /* Build an output filename and create/open the output file */
536 1.1.1.2.4.2 rmind
537 1.1.1.2.4.2 rmind if (ThisInstance > 0)
538 1.1.1.2.4.2 rmind {
539 1.1.1.2.4.2 rmind sprintf (Filename, "%4.4s%u.dat", ThisSignature, ThisInstance);
540 1.1.1.2.4.2 rmind }
541 1.1.1.2.4.2 rmind else
542 1.1.1.2.4.2 rmind {
543 1.1.1.2.4.2 rmind sprintf (Filename, "%4.4s.dat", ThisSignature);
544 1.1.1.2.4.2 rmind }
545 1.1.1.2.4.2 rmind
546 1.1.1.2.4.2 rmind OutputFile = fopen (Filename, "w+b");
547 1.1.1.2.4.2 rmind if (!OutputFile)
548 1.1.1.2.4.2 rmind {
549 1.1.1.2.4.2 rmind printf ("Could not open %s\n", Filename);
550 1.1.1.2.4.2 rmind Status = -1;
551 1.1.1.2.4.2 rmind goto CleanupAndExit;
552 1.1.1.2.4.2 rmind }
553 1.1.1.2.4.2 rmind
554 1.1.1.2.4.2 rmind State = EXTRACT_DATA;
555 1.1.1.2.4.2 rmind TotalBytesWritten = 0;
556 1.1.1.2.4.2 rmind FoundTable = 1;
557 1.1.1.2.4.2 rmind continue;
558 1.1.1.2.4.2 rmind
559 1.1.1.2.4.2 rmind case EXTRACT_DATA:
560 1.1.1.2.4.2 rmind
561 1.1.1.2.4.2 rmind /* Empty line or non-data line terminates the data */
562 1.1.1.2.4.2 rmind
563 1.1.1.2.4.2 rmind if ((Buffer[0] == '\n') ||
564 1.1.1.2.4.2 rmind (Buffer[0] != ' '))
565 1.1.1.2.4.2 rmind {
566 1.1.1.2.4.2 rmind fclose (OutputFile);
567 1.1.1.2.4.2 rmind OutputFile = NULL;
568 1.1.1.2.4.2 rmind State = FIND_HEADER;
569 1.1.1.2.4.2 rmind
570 1.1.1.2.4.2 rmind printf ("Acpi table [%4.4s] - %u bytes written to %s\n",
571 1.1.1.2.4.2 rmind ThisSignature, (unsigned int) TotalBytesWritten, Filename);
572 1.1.1.2.4.2 rmind continue;
573 1.1.1.2.4.2 rmind }
574 1.1.1.2.4.2 rmind
575 1.1.1.2.4.2 rmind /* Convert the ascii data (one line of text) to binary */
576 1.1.1.2.4.2 rmind
577 1.1.1.2.4.2 rmind BytesConverted = ConvertLine (Buffer, Data);
578 1.1.1.2.4.2 rmind
579 1.1.1.2.4.2 rmind /* Write the binary data */
580 1.1.1.2.4.2 rmind
581 1.1.1.2.4.2 rmind BytesWritten = fwrite (Data, 1, BytesConverted, OutputFile);
582 1.1.1.2.4.2 rmind if (BytesWritten != BytesConverted)
583 1.1.1.2.4.2 rmind {
584 1.1.1.2.4.2 rmind printf ("Write error on %s\n", Filename);
585 1.1.1.2.4.2 rmind fclose (OutputFile);
586 1.1.1.2.4.2 rmind OutputFile = NULL;
587 1.1.1.2.4.2 rmind Status = -1;
588 1.1.1.2.4.2 rmind goto CleanupAndExit;
589 1.1.1.2.4.2 rmind }
590 1.1.1.2.4.2 rmind
591 1.1.1.2.4.2 rmind TotalBytesWritten += BytesConverted;
592 1.1.1.2.4.2 rmind continue;
593 1.1.1.2.4.2 rmind
594 1.1.1.2.4.2 rmind default:
595 1.1.1.2.4.2 rmind Status = -1;
596 1.1.1.2.4.2 rmind goto CleanupAndExit;
597 1.1.1.2.4.2 rmind }
598 1.1.1.2.4.2 rmind }
599 1.1.1.2.4.2 rmind
600 1.1.1.2.4.2 rmind if (!FoundTable)
601 1.1.1.2.4.2 rmind {
602 1.1.1.2.4.2 rmind printf ("Table %s was not found in %s\n", Signature, InputPathname);
603 1.1.1.2.4.2 rmind }
604 1.1.1.2.4.2 rmind
605 1.1.1.2.4.2 rmind
606 1.1.1.2.4.2 rmind CleanupAndExit:
607 1.1.1.2.4.2 rmind
608 1.1.1.2.4.2 rmind if (OutputFile)
609 1.1.1.2.4.2 rmind {
610 1.1.1.2.4.2 rmind fclose (OutputFile);
611 1.1.1.2.4.2 rmind if (State == EXTRACT_DATA)
612 1.1.1.2.4.2 rmind {
613 1.1.1.2.4.2 rmind /* Received an EOF while extracting data */
614 1.1.1.2.4.2 rmind
615 1.1.1.2.4.2 rmind printf ("Acpi table [%4.4s] - %u bytes written to %s\n",
616 1.1.1.2.4.2 rmind ThisSignature, (unsigned int) TotalBytesWritten, Filename);
617 1.1.1.2.4.2 rmind }
618 1.1.1.2.4.2 rmind }
619 1.1.1.2.4.2 rmind
620 1.1.1.2.4.2 rmind fclose (InputFile);
621 1.1.1.2.4.2 rmind return (Status);
622 1.1.1.2.4.2 rmind }
623 1.1.1.2.4.2 rmind
624 1.1.1.2.4.2 rmind
625 1.1.1.2.4.2 rmind /******************************************************************************
626 1.1.1.2.4.2 rmind *
627 1.1.1.2.4.2 rmind * FUNCTION: ListTables
628 1.1.1.2.4.2 rmind *
629 1.1.1.2.4.2 rmind * PARAMETERS: InputPathname - Filename for acpidump file
630 1.1.1.2.4.2 rmind *
631 1.1.1.2.4.2 rmind * RETURN: Status
632 1.1.1.2.4.2 rmind *
633 1.1.1.2.4.2 rmind * DESCRIPTION: Display info for all ACPI tables found in input. Does not
634 1.1.1.2.4.2 rmind * perform an actual extraction of the tables.
635 1.1.1.2.4.2 rmind *
636 1.1.1.2.4.2 rmind ******************************************************************************/
637 1.1.1.2.4.2 rmind
638 1.1.1.2.4.2 rmind static int
639 1.1.1.2.4.2 rmind ListTables (
640 1.1.1.2.4.2 rmind char *InputPathname)
641 1.1.1.2.4.2 rmind {
642 1.1.1.2.4.2 rmind FILE *InputFile;
643 1.1.1.2.4.2 rmind char Buffer[BUFFER_SIZE];
644 1.1.1.2.4.2 rmind size_t HeaderSize;
645 1.1.1.2.4.2 rmind unsigned char Header[48];
646 1.1.1.2.4.2 rmind int TableCount = 0;
647 1.1.1.2.4.2 rmind ACPI_TABLE_HEADER *TableHeader = (ACPI_TABLE_HEADER *) (void *) Header;
648 1.1.1.2.4.2 rmind
649 1.1.1.2.4.2 rmind
650 1.1.1.2.4.2 rmind /* Open input in text mode, output is in binary mode */
651 1.1.1.2.4.2 rmind
652 1.1.1.2.4.2 rmind InputFile = fopen (InputPathname, "rt");
653 1.1.1.2.4.2 rmind if (!InputFile)
654 1.1.1.2.4.2 rmind {
655 1.1.1.2.4.2 rmind printf ("Could not open %s\n", InputPathname);
656 1.1.1.2.4.2 rmind return (-1);
657 1.1.1.2.4.2 rmind }
658 1.1.1.2.4.2 rmind
659 1.1.1.2.4.2 rmind /* Dump the headers for all tables found in the input file */
660 1.1.1.2.4.2 rmind
661 1.1.1.2.4.2 rmind printf ("\nSignature Length Revision OemId OemTableId"
662 1.1.1.2.4.2 rmind " OemRevision CompilerId CompilerRevision\n\n");
663 1.1.1.2.4.2 rmind
664 1.1.1.2.4.2 rmind while (fgets (Buffer, BUFFER_SIZE, InputFile))
665 1.1.1.2.4.2 rmind {
666 1.1.1.2.4.2 rmind /* Ignore empty lines and lines that start with a space */
667 1.1.1.2.4.2 rmind
668 1.1.1.2.4.2 rmind if ((Buffer[0] == ' ') ||
669 1.1.1.2.4.2 rmind (Buffer[0] == '\n'))
670 1.1.1.2.4.2 rmind {
671 1.1.1.2.4.2 rmind continue;
672 1.1.1.2.4.2 rmind }
673 1.1.1.2.4.2 rmind
674 1.1.1.2.4.2 rmind /* Get the 36 byte header and display the fields */
675 1.1.1.2.4.2 rmind
676 1.1.1.2.4.2 rmind HeaderSize = GetTableHeader (InputFile, Header);
677 1.1.1.2.4.2 rmind if (HeaderSize < 16)
678 1.1.1.2.4.2 rmind {
679 1.1.1.2.4.2 rmind continue;
680 1.1.1.2.4.2 rmind }
681 1.1.1.2.4.2 rmind
682 1.1.1.2.4.2 rmind /* RSDP has an oddball signature and header */
683 1.1.1.2.4.2 rmind
684 1.1.1.2.4.2 rmind if (!strncmp (TableHeader->Signature, "RSD PTR ", 8))
685 1.1.1.2.4.2 rmind {
686 1.1.1.2.4.2 rmind CheckAscii ((char *) &Header[9], 6);
687 1.1.1.2.4.2 rmind printf ("%8.4s \"%6.6s\"\n", "RSDP", &Header[9]);
688 1.1.1.2.4.2 rmind TableCount++;
689 1.1.1.2.4.2 rmind continue;
690 1.1.1.2.4.2 rmind }
691 1.1.1.2.4.2 rmind
692 1.1.1.2.4.2 rmind /* Minimum size for table with standard header */
693 1.1.1.2.4.2 rmind
694 1.1.1.2.4.2 rmind if (HeaderSize < 36)
695 1.1.1.2.4.2 rmind {
696 1.1.1.2.4.2 rmind continue;
697 1.1.1.2.4.2 rmind }
698 1.1.1.2.4.2 rmind
699 1.1.1.2.4.2 rmind /* Signature and Table length */
700 1.1.1.2.4.2 rmind
701 1.1.1.2.4.2 rmind TableCount++;
702 1.1.1.2.4.2 rmind printf ("%8.4s % 7d", TableHeader->Signature, TableHeader->Length);
703 1.1.1.2.4.2 rmind
704 1.1.1.2.4.2 rmind /* FACS has only signature and length */
705 1.1.1.2.4.2 rmind
706 1.1.1.2.4.2 rmind if (!strncmp (TableHeader->Signature, "FACS", 4))
707 1.1.1.2.4.2 rmind {
708 1.1.1.2.4.2 rmind printf ("\n");
709 1.1.1.2.4.2 rmind continue;
710 1.1.1.2.4.2 rmind }
711 1.1.1.2.4.2 rmind
712 1.1.1.2.4.2 rmind /* OEM IDs and Compiler IDs */
713 1.1.1.2.4.2 rmind
714 1.1.1.2.4.2 rmind CheckAscii (TableHeader->OemId, 6);
715 1.1.1.2.4.2 rmind CheckAscii (TableHeader->OemTableId, 8);
716 1.1.1.2.4.2 rmind CheckAscii (TableHeader->AslCompilerId, 4);
717 1.1.1.2.4.2 rmind
718 1.1.1.2.4.2 rmind printf (" %2.2X \"%6.6s\" \"%8.8s\" %8.8X \"%4.4s\" %8.8X\n",
719 1.1.1.2.4.2 rmind TableHeader->Revision, TableHeader->OemId,
720 1.1.1.2.4.2 rmind TableHeader->OemTableId, TableHeader->OemRevision,
721 1.1.1.2.4.2 rmind TableHeader->AslCompilerId, TableHeader->AslCompilerRevision);
722 1.1.1.2.4.2 rmind }
723 1.1.1.2.4.2 rmind
724 1.1.1.2.4.2 rmind printf ("\nFound %u ACPI tables [%8.8X]\n", TableCount, VERSION);
725 1.1.1.2.4.2 rmind fclose (InputFile);
726 1.1.1.2.4.2 rmind return (0);
727 1.1.1.2.4.2 rmind }
728 1.1.1.2.4.2 rmind
729 1.1.1.2.4.2 rmind
730 1.1.1.2.4.2 rmind /******************************************************************************
731 1.1.1.2.4.2 rmind *
732 1.1.1.2.4.2 rmind * FUNCTION: main
733 1.1.1.2.4.2 rmind *
734 1.1.1.2.4.2 rmind * DESCRIPTION: C main function
735 1.1.1.2.4.2 rmind *
736 1.1.1.2.4.2 rmind ******************************************************************************/
737 1.1.1.2.4.2 rmind
738 1.1.1.2.4.2 rmind int
739 1.1.1.2.4.2 rmind main (
740 1.1.1.2.4.2 rmind int argc,
741 1.1.1.2.4.2 rmind char *argv[])
742 1.1.1.2.4.2 rmind {
743 1.1.1.2.4.2 rmind int Status;
744 1.1.1.2.4.2 rmind
745 1.1.1.2.4.2 rmind
746 1.1.1.2.4.2 rmind if (argc < 2)
747 1.1.1.2.4.2 rmind {
748 1.1.1.2.4.2 rmind DisplayUsage ();
749 1.1.1.2.4.2 rmind return (0);
750 1.1.1.2.4.2 rmind }
751 1.1.1.2.4.2 rmind
752 1.1.1.2.4.2 rmind if (argv[1][0] == '-')
753 1.1.1.2.4.2 rmind {
754 1.1.1.2.4.2 rmind if (argc < 3)
755 1.1.1.2.4.2 rmind {
756 1.1.1.2.4.2 rmind DisplayUsage ();
757 1.1.1.2.4.2 rmind return (0);
758 1.1.1.2.4.2 rmind }
759 1.1.1.2.4.2 rmind
760 1.1.1.2.4.2 rmind switch (argv[1][1])
761 1.1.1.2.4.2 rmind {
762 1.1.1.2.4.2 rmind case 'a':
763 1.1.1.2.4.2 rmind
764 1.1.1.2.4.2 rmind /* Extract all tables found */
765 1.1.1.2.4.2 rmind
766 1.1.1.2.4.2 rmind return (ExtractTables (argv[2], NULL, 0));
767 1.1.1.2.4.2 rmind
768 1.1.1.2.4.2 rmind case 'l':
769 1.1.1.2.4.2 rmind
770 1.1.1.2.4.2 rmind /* List tables only, do not extract */
771 1.1.1.2.4.2 rmind
772 1.1.1.2.4.2 rmind return (ListTables (argv[2]));
773 1.1.1.2.4.2 rmind
774 1.1.1.2.4.2 rmind case 's':
775 1.1.1.2.4.2 rmind
776 1.1.1.2.4.2 rmind /* Extract only tables with this signature */
777 1.1.1.2.4.2 rmind
778 1.1.1.2.4.2 rmind return (ExtractTables (argv[2], &argv[1][2], 1));
779 1.1.1.2.4.2 rmind
780 1.1.1.2.4.2 rmind default:
781 1.1.1.2.4.2 rmind DisplayUsage ();
782 1.1.1.2.4.2 rmind return (0);
783 1.1.1.2.4.2 rmind }
784 1.1.1.2.4.2 rmind }
785 1.1.1.2.4.2 rmind
786 1.1.1.2.4.2 rmind /*
787 1.1.1.2.4.2 rmind * Default output is the DSDT and all SSDTs. One DSDT is required,
788 1.1.1.2.4.2 rmind * any SSDTs are optional.
789 1.1.1.2.4.2 rmind */
790 1.1.1.2.4.2 rmind Status = ExtractTables (argv[1], "DSDT", 1);
791 1.1.1.2.4.2 rmind if (Status)
792 1.1.1.2.4.2 rmind {
793 1.1.1.2.4.2 rmind return (Status);
794 1.1.1.2.4.2 rmind }
795 1.1.1.2.4.2 rmind
796 1.1.1.2.4.2 rmind Status = ExtractTables (argv[1], "SSDT", 0);
797 1.1.1.2.4.2 rmind return (Status);
798 1.1.1.2.4.2 rmind }
799 1.1.1.2.4.2 rmind
800 1.1.1.2.4.2 rmind
801