1*cb565728SJerry Jelinek /******************************************************************************
2*cb565728SJerry Jelinek *
3*cb565728SJerry Jelinek * Module Name: apmain - Main module for the acpidump utility
4*cb565728SJerry Jelinek *
5*cb565728SJerry Jelinek *****************************************************************************/
6*cb565728SJerry Jelinek
7*cb565728SJerry Jelinek /*
8*cb565728SJerry Jelinek * Copyright (C) 2000 - 2016, Intel Corp.
9*cb565728SJerry Jelinek * All rights reserved.
10*cb565728SJerry Jelinek *
11*cb565728SJerry Jelinek * Redistribution and use in source and binary forms, with or without
12*cb565728SJerry Jelinek * modification, are permitted provided that the following conditions
13*cb565728SJerry Jelinek * are met:
14*cb565728SJerry Jelinek * 1. Redistributions of source code must retain the above copyright
15*cb565728SJerry Jelinek * notice, this list of conditions, and the following disclaimer,
16*cb565728SJerry Jelinek * without modification.
17*cb565728SJerry Jelinek * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18*cb565728SJerry Jelinek * substantially similar to the "NO WARRANTY" disclaimer below
19*cb565728SJerry Jelinek * ("Disclaimer") and any redistribution must be conditioned upon
20*cb565728SJerry Jelinek * including a substantially similar Disclaimer requirement for further
21*cb565728SJerry Jelinek * binary redistribution.
22*cb565728SJerry Jelinek * 3. Neither the names of the above-listed copyright holders nor the names
23*cb565728SJerry Jelinek * of any contributors may be used to endorse or promote products derived
24*cb565728SJerry Jelinek * from this software without specific prior written permission.
25*cb565728SJerry Jelinek *
26*cb565728SJerry Jelinek * Alternatively, this software may be distributed under the terms of the
27*cb565728SJerry Jelinek * GNU General Public License ("GPL") version 2 as published by the Free
28*cb565728SJerry Jelinek * Software Foundation.
29*cb565728SJerry Jelinek *
30*cb565728SJerry Jelinek * NO WARRANTY
31*cb565728SJerry Jelinek * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32*cb565728SJerry Jelinek * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33*cb565728SJerry Jelinek * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34*cb565728SJerry Jelinek * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35*cb565728SJerry Jelinek * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36*cb565728SJerry Jelinek * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37*cb565728SJerry Jelinek * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38*cb565728SJerry Jelinek * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39*cb565728SJerry Jelinek * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40*cb565728SJerry Jelinek * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41*cb565728SJerry Jelinek * POSSIBILITY OF SUCH DAMAGES.
42*cb565728SJerry Jelinek */
43*cb565728SJerry Jelinek
44*cb565728SJerry Jelinek #define _DECLARE_GLOBALS
45*cb565728SJerry Jelinek #include "acpidump.h"
46*cb565728SJerry Jelinek #include "acapps.h"
47*cb565728SJerry Jelinek
48*cb565728SJerry Jelinek
49*cb565728SJerry Jelinek /*
50*cb565728SJerry Jelinek * acpidump - A portable utility for obtaining system ACPI tables and dumping
51*cb565728SJerry Jelinek * them in an ASCII hex format suitable for binary extraction via acpixtract.
52*cb565728SJerry Jelinek *
53*cb565728SJerry Jelinek * Obtaining the system ACPI tables is an OS-specific operation.
54*cb565728SJerry Jelinek *
55*cb565728SJerry Jelinek * This utility can be ported to any host operating system by providing a
56*cb565728SJerry Jelinek * module containing system-specific versions of these interfaces:
57*cb565728SJerry Jelinek *
58*cb565728SJerry Jelinek * AcpiOsGetTableByAddress
59*cb565728SJerry Jelinek * AcpiOsGetTableByIndex
60*cb565728SJerry Jelinek * AcpiOsGetTableByName
61*cb565728SJerry Jelinek *
62*cb565728SJerry Jelinek * See the ACPICA Reference Guide for the exact definitions of these
63*cb565728SJerry Jelinek * interfaces. Also, see these ACPICA source code modules for example
64*cb565728SJerry Jelinek * implementations:
65*cb565728SJerry Jelinek *
66*cb565728SJerry Jelinek * source/os_specific/service_layers/oswintbl.c
67*cb565728SJerry Jelinek * source/os_specific/service_layers/oslinuxtbl.c
68*cb565728SJerry Jelinek */
69*cb565728SJerry Jelinek
70*cb565728SJerry Jelinek
71*cb565728SJerry Jelinek /* Local prototypes */
72*cb565728SJerry Jelinek
73*cb565728SJerry Jelinek static void
74*cb565728SJerry Jelinek ApDisplayUsage (
75*cb565728SJerry Jelinek void);
76*cb565728SJerry Jelinek
77*cb565728SJerry Jelinek static int
78*cb565728SJerry Jelinek ApDoOptions (
79*cb565728SJerry Jelinek int argc,
80*cb565728SJerry Jelinek char **argv);
81*cb565728SJerry Jelinek
82*cb565728SJerry Jelinek static int
83*cb565728SJerry Jelinek ApInsertAction (
84*cb565728SJerry Jelinek char *Argument,
85*cb565728SJerry Jelinek UINT32 ToBeDone);
86*cb565728SJerry Jelinek
87*cb565728SJerry Jelinek
88*cb565728SJerry Jelinek /* Table for deferred actions from command line options */
89*cb565728SJerry Jelinek
90*cb565728SJerry Jelinek AP_DUMP_ACTION ActionTable [AP_MAX_ACTIONS];
91*cb565728SJerry Jelinek UINT32 CurrentAction = 0;
92*cb565728SJerry Jelinek
93*cb565728SJerry Jelinek
94*cb565728SJerry Jelinek #define AP_UTILITY_NAME "ACPI Binary Table Dump Utility"
95*cb565728SJerry Jelinek #define AP_SUPPORTED_OPTIONS "?a:bc:f:hn:o:r:svxz"
96*cb565728SJerry Jelinek
97*cb565728SJerry Jelinek
98*cb565728SJerry Jelinek /******************************************************************************
99*cb565728SJerry Jelinek *
100*cb565728SJerry Jelinek * FUNCTION: ApDisplayUsage
101*cb565728SJerry Jelinek *
102*cb565728SJerry Jelinek * DESCRIPTION: Usage message for the AcpiDump utility
103*cb565728SJerry Jelinek *
104*cb565728SJerry Jelinek ******************************************************************************/
105*cb565728SJerry Jelinek
106*cb565728SJerry Jelinek static void
ApDisplayUsage(void)107*cb565728SJerry Jelinek ApDisplayUsage (
108*cb565728SJerry Jelinek void)
109*cb565728SJerry Jelinek {
110*cb565728SJerry Jelinek
111*cb565728SJerry Jelinek ACPI_USAGE_HEADER ("acpidump [options]");
112*cb565728SJerry Jelinek
113*cb565728SJerry Jelinek ACPI_OPTION ("-b", "Dump tables to binary files");
114*cb565728SJerry Jelinek ACPI_OPTION ("-h -?", "This help message");
115*cb565728SJerry Jelinek ACPI_OPTION ("-o <File>", "Redirect output to file");
116*cb565728SJerry Jelinek ACPI_OPTION ("-r <Address>", "Dump tables from specified RSDP");
117*cb565728SJerry Jelinek ACPI_OPTION ("-s", "Print table summaries only");
118*cb565728SJerry Jelinek ACPI_OPTION ("-v", "Display version information");
119*cb565728SJerry Jelinek ACPI_OPTION ("-z", "Verbose mode");
120*cb565728SJerry Jelinek
121*cb565728SJerry Jelinek ACPI_USAGE_TEXT ("\nTable Options:\n");
122*cb565728SJerry Jelinek
123*cb565728SJerry Jelinek ACPI_OPTION ("-a <Address>", "Get table via a physical address");
124*cb565728SJerry Jelinek ACPI_OPTION ("-c <on|off>", "Turning on/off customized table dumping");
125*cb565728SJerry Jelinek ACPI_OPTION ("-f <BinaryFile>", "Get table via a binary file");
126*cb565728SJerry Jelinek ACPI_OPTION ("-n <Signature>", "Get table via a name/signature");
127*cb565728SJerry Jelinek ACPI_OPTION ("-x", "Do not use but dump XSDT");
128*cb565728SJerry Jelinek ACPI_OPTION ("-x -x", "Do not use or dump XSDT");
129*cb565728SJerry Jelinek
130*cb565728SJerry Jelinek ACPI_USAGE_TEXT (
131*cb565728SJerry Jelinek "\n"
132*cb565728SJerry Jelinek "Invocation without parameters dumps all available tables\n"
133*cb565728SJerry Jelinek "Multiple mixed instances of -a, -f, and -n are supported\n\n");
134*cb565728SJerry Jelinek }
135*cb565728SJerry Jelinek
136*cb565728SJerry Jelinek
137*cb565728SJerry Jelinek /******************************************************************************
138*cb565728SJerry Jelinek *
139*cb565728SJerry Jelinek * FUNCTION: ApInsertAction
140*cb565728SJerry Jelinek *
141*cb565728SJerry Jelinek * PARAMETERS: Argument - Pointer to the argument for this action
142*cb565728SJerry Jelinek * ToBeDone - What to do to process this action
143*cb565728SJerry Jelinek *
144*cb565728SJerry Jelinek * RETURN: Status
145*cb565728SJerry Jelinek *
146*cb565728SJerry Jelinek * DESCRIPTION: Add an action item to the action table
147*cb565728SJerry Jelinek *
148*cb565728SJerry Jelinek ******************************************************************************/
149*cb565728SJerry Jelinek
150*cb565728SJerry Jelinek static int
ApInsertAction(char * Argument,UINT32 ToBeDone)151*cb565728SJerry Jelinek ApInsertAction (
152*cb565728SJerry Jelinek char *Argument,
153*cb565728SJerry Jelinek UINT32 ToBeDone)
154*cb565728SJerry Jelinek {
155*cb565728SJerry Jelinek
156*cb565728SJerry Jelinek /* Insert action and check for table overflow */
157*cb565728SJerry Jelinek
158*cb565728SJerry Jelinek ActionTable [CurrentAction].Argument = Argument;
159*cb565728SJerry Jelinek ActionTable [CurrentAction].ToBeDone = ToBeDone;
160*cb565728SJerry Jelinek
161*cb565728SJerry Jelinek CurrentAction++;
162*cb565728SJerry Jelinek if (CurrentAction > AP_MAX_ACTIONS)
163*cb565728SJerry Jelinek {
164*cb565728SJerry Jelinek AcpiLogError ("Too many table options (max %u)\n", AP_MAX_ACTIONS);
165*cb565728SJerry Jelinek return (-1);
166*cb565728SJerry Jelinek }
167*cb565728SJerry Jelinek
168*cb565728SJerry Jelinek return (0);
169*cb565728SJerry Jelinek }
170*cb565728SJerry Jelinek
171*cb565728SJerry Jelinek
172*cb565728SJerry Jelinek /******************************************************************************
173*cb565728SJerry Jelinek *
174*cb565728SJerry Jelinek * FUNCTION: ApDoOptions
175*cb565728SJerry Jelinek *
176*cb565728SJerry Jelinek * PARAMETERS: argc/argv - Standard argc/argv
177*cb565728SJerry Jelinek *
178*cb565728SJerry Jelinek * RETURN: Status
179*cb565728SJerry Jelinek *
180*cb565728SJerry Jelinek * DESCRIPTION: Command line option processing. The main actions for getting
181*cb565728SJerry Jelinek * and dumping tables are deferred via the action table.
182*cb565728SJerry Jelinek *
183*cb565728SJerry Jelinek *****************************************************************************/
184*cb565728SJerry Jelinek
185*cb565728SJerry Jelinek static int
ApDoOptions(int argc,char ** argv)186*cb565728SJerry Jelinek ApDoOptions (
187*cb565728SJerry Jelinek int argc,
188*cb565728SJerry Jelinek char **argv)
189*cb565728SJerry Jelinek {
190*cb565728SJerry Jelinek int j;
191*cb565728SJerry Jelinek ACPI_STATUS Status;
192*cb565728SJerry Jelinek
193*cb565728SJerry Jelinek
194*cb565728SJerry Jelinek /* Command line options */
195*cb565728SJerry Jelinek
196*cb565728SJerry Jelinek while ((j = AcpiGetopt (argc, argv, AP_SUPPORTED_OPTIONS)) != ACPI_OPT_END) switch (j)
197*cb565728SJerry Jelinek {
198*cb565728SJerry Jelinek /*
199*cb565728SJerry Jelinek * Global options
200*cb565728SJerry Jelinek */
201*cb565728SJerry Jelinek case 'b': /* Dump all input tables to binary files */
202*cb565728SJerry Jelinek
203*cb565728SJerry Jelinek Gbl_BinaryMode = TRUE;
204*cb565728SJerry Jelinek continue;
205*cb565728SJerry Jelinek
206*cb565728SJerry Jelinek case 'c': /* Dump customized tables */
207*cb565728SJerry Jelinek
208*cb565728SJerry Jelinek if (!strcmp (AcpiGbl_Optarg, "on"))
209*cb565728SJerry Jelinek {
210*cb565728SJerry Jelinek Gbl_DumpCustomizedTables = TRUE;
211*cb565728SJerry Jelinek }
212*cb565728SJerry Jelinek else if (!strcmp (AcpiGbl_Optarg, "off"))
213*cb565728SJerry Jelinek {
214*cb565728SJerry Jelinek Gbl_DumpCustomizedTables = FALSE;
215*cb565728SJerry Jelinek }
216*cb565728SJerry Jelinek else
217*cb565728SJerry Jelinek {
218*cb565728SJerry Jelinek AcpiLogError ("%s: Cannot handle this switch, please use on|off\n",
219*cb565728SJerry Jelinek AcpiGbl_Optarg);
220*cb565728SJerry Jelinek return (-1);
221*cb565728SJerry Jelinek }
222*cb565728SJerry Jelinek continue;
223*cb565728SJerry Jelinek
224*cb565728SJerry Jelinek case 'h':
225*cb565728SJerry Jelinek case '?':
226*cb565728SJerry Jelinek
227*cb565728SJerry Jelinek ApDisplayUsage ();
228*cb565728SJerry Jelinek return (1);
229*cb565728SJerry Jelinek
230*cb565728SJerry Jelinek case 'o': /* Redirect output to a single file */
231*cb565728SJerry Jelinek
232*cb565728SJerry Jelinek if (ApOpenOutputFile (AcpiGbl_Optarg))
233*cb565728SJerry Jelinek {
234*cb565728SJerry Jelinek return (-1);
235*cb565728SJerry Jelinek }
236*cb565728SJerry Jelinek continue;
237*cb565728SJerry Jelinek
238*cb565728SJerry Jelinek case 'r': /* Dump tables from specified RSDP */
239*cb565728SJerry Jelinek
240*cb565728SJerry Jelinek Status = AcpiUtStrtoul64 (AcpiGbl_Optarg, ACPI_ANY_BASE,
241*cb565728SJerry Jelinek ACPI_MAX64_BYTE_WIDTH, &Gbl_RsdpBase);
242*cb565728SJerry Jelinek if (ACPI_FAILURE (Status))
243*cb565728SJerry Jelinek {
244*cb565728SJerry Jelinek AcpiLogError ("%s: Could not convert to a physical address\n",
245*cb565728SJerry Jelinek AcpiGbl_Optarg);
246*cb565728SJerry Jelinek return (-1);
247*cb565728SJerry Jelinek }
248*cb565728SJerry Jelinek continue;
249*cb565728SJerry Jelinek
250*cb565728SJerry Jelinek case 's': /* Print table summaries only */
251*cb565728SJerry Jelinek
252*cb565728SJerry Jelinek Gbl_SummaryMode = TRUE;
253*cb565728SJerry Jelinek continue;
254*cb565728SJerry Jelinek
255*cb565728SJerry Jelinek case 'x': /* Do not use XSDT */
256*cb565728SJerry Jelinek
257*cb565728SJerry Jelinek if (!AcpiGbl_DoNotUseXsdt)
258*cb565728SJerry Jelinek {
259*cb565728SJerry Jelinek AcpiGbl_DoNotUseXsdt = TRUE;
260*cb565728SJerry Jelinek }
261*cb565728SJerry Jelinek else
262*cb565728SJerry Jelinek {
263*cb565728SJerry Jelinek Gbl_DoNotDumpXsdt = TRUE;
264*cb565728SJerry Jelinek }
265*cb565728SJerry Jelinek continue;
266*cb565728SJerry Jelinek
267*cb565728SJerry Jelinek case 'v': /* Revision/version */
268*cb565728SJerry Jelinek
269*cb565728SJerry Jelinek AcpiOsPrintf (ACPI_COMMON_SIGNON (AP_UTILITY_NAME));
270*cb565728SJerry Jelinek return (1);
271*cb565728SJerry Jelinek
272*cb565728SJerry Jelinek case 'z': /* Verbose mode */
273*cb565728SJerry Jelinek
274*cb565728SJerry Jelinek Gbl_VerboseMode = TRUE;
275*cb565728SJerry Jelinek AcpiLogError (ACPI_COMMON_SIGNON (AP_UTILITY_NAME));
276*cb565728SJerry Jelinek continue;
277*cb565728SJerry Jelinek
278*cb565728SJerry Jelinek /*
279*cb565728SJerry Jelinek * Table options
280*cb565728SJerry Jelinek */
281*cb565728SJerry Jelinek case 'a': /* Get table by physical address */
282*cb565728SJerry Jelinek
283*cb565728SJerry Jelinek if (ApInsertAction (AcpiGbl_Optarg, AP_DUMP_TABLE_BY_ADDRESS))
284*cb565728SJerry Jelinek {
285*cb565728SJerry Jelinek return (-1);
286*cb565728SJerry Jelinek }
287*cb565728SJerry Jelinek break;
288*cb565728SJerry Jelinek
289*cb565728SJerry Jelinek case 'f': /* Get table from a file */
290*cb565728SJerry Jelinek
291*cb565728SJerry Jelinek if (ApInsertAction (AcpiGbl_Optarg, AP_DUMP_TABLE_BY_FILE))
292*cb565728SJerry Jelinek {
293*cb565728SJerry Jelinek return (-1);
294*cb565728SJerry Jelinek }
295*cb565728SJerry Jelinek break;
296*cb565728SJerry Jelinek
297*cb565728SJerry Jelinek case 'n': /* Get table by input name (signature) */
298*cb565728SJerry Jelinek
299*cb565728SJerry Jelinek if (ApInsertAction (AcpiGbl_Optarg, AP_DUMP_TABLE_BY_NAME))
300*cb565728SJerry Jelinek {
301*cb565728SJerry Jelinek return (-1);
302*cb565728SJerry Jelinek }
303*cb565728SJerry Jelinek break;
304*cb565728SJerry Jelinek
305*cb565728SJerry Jelinek default:
306*cb565728SJerry Jelinek
307*cb565728SJerry Jelinek ApDisplayUsage ();
308*cb565728SJerry Jelinek return (-1);
309*cb565728SJerry Jelinek }
310*cb565728SJerry Jelinek
311*cb565728SJerry Jelinek /* If there are no actions, this means "get/dump all tables" */
312*cb565728SJerry Jelinek
313*cb565728SJerry Jelinek if (CurrentAction == 0)
314*cb565728SJerry Jelinek {
315*cb565728SJerry Jelinek if (ApInsertAction (NULL, AP_DUMP_ALL_TABLES))
316*cb565728SJerry Jelinek {
317*cb565728SJerry Jelinek return (-1);
318*cb565728SJerry Jelinek }
319*cb565728SJerry Jelinek }
320*cb565728SJerry Jelinek
321*cb565728SJerry Jelinek return (0);
322*cb565728SJerry Jelinek }
323*cb565728SJerry Jelinek
324*cb565728SJerry Jelinek
325*cb565728SJerry Jelinek /******************************************************************************
326*cb565728SJerry Jelinek *
327*cb565728SJerry Jelinek * FUNCTION: main
328*cb565728SJerry Jelinek *
329*cb565728SJerry Jelinek * PARAMETERS: argc/argv - Standard argc/argv
330*cb565728SJerry Jelinek *
331*cb565728SJerry Jelinek * RETURN: Status
332*cb565728SJerry Jelinek *
333*cb565728SJerry Jelinek * DESCRIPTION: C main function for acpidump utility
334*cb565728SJerry Jelinek *
335*cb565728SJerry Jelinek ******************************************************************************/
336*cb565728SJerry Jelinek
337*cb565728SJerry Jelinek #ifndef _GNU_EFI
338*cb565728SJerry Jelinek int ACPI_SYSTEM_XFACE
main(int argc,char * argv[])339*cb565728SJerry Jelinek main (
340*cb565728SJerry Jelinek int argc,
341*cb565728SJerry Jelinek char *argv[])
342*cb565728SJerry Jelinek #else
343*cb565728SJerry Jelinek int ACPI_SYSTEM_XFACE
344*cb565728SJerry Jelinek acpi_main (
345*cb565728SJerry Jelinek int argc,
346*cb565728SJerry Jelinek char *argv[])
347*cb565728SJerry Jelinek #endif
348*cb565728SJerry Jelinek {
349*cb565728SJerry Jelinek int Status = 0;
350*cb565728SJerry Jelinek AP_DUMP_ACTION *Action;
351*cb565728SJerry Jelinek UINT32 FileSize;
352*cb565728SJerry Jelinek UINT32 i;
353*cb565728SJerry Jelinek
354*cb565728SJerry Jelinek
355*cb565728SJerry Jelinek ACPI_DEBUG_INITIALIZE (); /* For debug version only */
356*cb565728SJerry Jelinek AcpiOsInitialize ();
357*cb565728SJerry Jelinek Gbl_OutputFile = ACPI_FILE_OUT;
358*cb565728SJerry Jelinek
359*cb565728SJerry Jelinek /* Process command line options */
360*cb565728SJerry Jelinek
361*cb565728SJerry Jelinek Status = ApDoOptions (argc, argv);
362*cb565728SJerry Jelinek if (Status > 0)
363*cb565728SJerry Jelinek {
364*cb565728SJerry Jelinek return (0);
365*cb565728SJerry Jelinek }
366*cb565728SJerry Jelinek if (Status < 0)
367*cb565728SJerry Jelinek {
368*cb565728SJerry Jelinek return (Status);
369*cb565728SJerry Jelinek }
370*cb565728SJerry Jelinek
371*cb565728SJerry Jelinek /* Get/dump ACPI table(s) as requested */
372*cb565728SJerry Jelinek
373*cb565728SJerry Jelinek for (i = 0; i < CurrentAction; i++)
374*cb565728SJerry Jelinek {
375*cb565728SJerry Jelinek Action = &ActionTable[i];
376*cb565728SJerry Jelinek switch (Action->ToBeDone)
377*cb565728SJerry Jelinek {
378*cb565728SJerry Jelinek case AP_DUMP_ALL_TABLES:
379*cb565728SJerry Jelinek
380*cb565728SJerry Jelinek Status = ApDumpAllTables ();
381*cb565728SJerry Jelinek break;
382*cb565728SJerry Jelinek
383*cb565728SJerry Jelinek case AP_DUMP_TABLE_BY_ADDRESS:
384*cb565728SJerry Jelinek
385*cb565728SJerry Jelinek Status = ApDumpTableByAddress (Action->Argument);
386*cb565728SJerry Jelinek break;
387*cb565728SJerry Jelinek
388*cb565728SJerry Jelinek case AP_DUMP_TABLE_BY_NAME:
389*cb565728SJerry Jelinek
390*cb565728SJerry Jelinek Status = ApDumpTableByName (Action->Argument);
391*cb565728SJerry Jelinek break;
392*cb565728SJerry Jelinek
393*cb565728SJerry Jelinek case AP_DUMP_TABLE_BY_FILE:
394*cb565728SJerry Jelinek
395*cb565728SJerry Jelinek Status = ApDumpTableFromFile (Action->Argument);
396*cb565728SJerry Jelinek break;
397*cb565728SJerry Jelinek
398*cb565728SJerry Jelinek default:
399*cb565728SJerry Jelinek
400*cb565728SJerry Jelinek AcpiLogError ("Internal error, invalid action: 0x%X\n",
401*cb565728SJerry Jelinek Action->ToBeDone);
402*cb565728SJerry Jelinek return (-1);
403*cb565728SJerry Jelinek }
404*cb565728SJerry Jelinek
405*cb565728SJerry Jelinek if (Status)
406*cb565728SJerry Jelinek {
407*cb565728SJerry Jelinek return (Status);
408*cb565728SJerry Jelinek }
409*cb565728SJerry Jelinek }
410*cb565728SJerry Jelinek
411*cb565728SJerry Jelinek if (Gbl_OutputFilename)
412*cb565728SJerry Jelinek {
413*cb565728SJerry Jelinek if (Gbl_VerboseMode)
414*cb565728SJerry Jelinek {
415*cb565728SJerry Jelinek /* Summary for the output file */
416*cb565728SJerry Jelinek
417*cb565728SJerry Jelinek FileSize = CmGetFileSize (Gbl_OutputFile);
418*cb565728SJerry Jelinek AcpiLogError ("Output file %s contains 0x%X (%u) bytes\n\n",
419*cb565728SJerry Jelinek Gbl_OutputFilename, FileSize, FileSize);
420*cb565728SJerry Jelinek }
421*cb565728SJerry Jelinek
422*cb565728SJerry Jelinek AcpiOsCloseFile (Gbl_OutputFile);
423*cb565728SJerry Jelinek }
424*cb565728SJerry Jelinek
425*cb565728SJerry Jelinek return (Status);
426*cb565728SJerry Jelinek }
427