1 /*******************************************************************************
3 * Module Name: dbfileio - Debugger file I/O commands. These can't usually
4 * be used when running the debugger in Ring 0 (Kernel mode)
6 ******************************************************************************/
9 * Copyright (C) 2000 - 2016, Intel Corp.
10 * All rights reserved.
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions, and the following disclaimer,
17 * without modification.
18 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 * substantially similar to the "NO WARRANTY" disclaimer below
20 * ("Disclaimer") and any redistribution must be conditioned upon
21 * including a substantially similar Disclaimer requirement for further
22 * binary redistribution.
23 * 3. Neither the names of the above-listed copyright holders nor the names
24 * of any contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
27 * Alternatively, this software may be distributed under the terms of the
28 * GNU General Public License ("GPL") version 2 as published by the Free
29 * Software Foundation.
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 * POSSIBILITY OF SUCH DAMAGES.
50 #if (defined ACPI_DEBUGGER || defined ACPI_DISASSEMBLER)
52 #define _COMPONENT ACPI_CA_DEBUGGER
53 ACPI_MODULE_NAME ("dbfileio")
56 #ifdef ACPI_APPLICATION
62 /*******************************************************************************
64 * FUNCTION: AcpiDbCloseDebugFile
70 * DESCRIPTION: If open, close the current debug output file
72 ******************************************************************************/
75 AcpiDbCloseDebugFile (
79 if (AcpiGbl_DebugFile)
81 fclose (AcpiGbl_DebugFile);
82 AcpiGbl_DebugFile = NULL;
83 AcpiGbl_DbOutputToFile = FALSE;
84 AcpiOsPrintf ("Debug output file %s closed\n",
85 AcpiGbl_DbDebugFilename);
90 /*******************************************************************************
92 * FUNCTION: AcpiDbOpenDebugFile
94 * PARAMETERS: Name - Filename to open
98 * DESCRIPTION: Open a file where debug output will be directed.
100 ******************************************************************************/
103 AcpiDbOpenDebugFile (
107 AcpiDbCloseDebugFile ();
108 AcpiGbl_DebugFile = fopen (Name, "w+");
109 if (!AcpiGbl_DebugFile)
111 AcpiOsPrintf ("Could not open debug file %s\n", Name);
115 AcpiOsPrintf ("Debug output file %s opened\n", Name);
116 strncpy (AcpiGbl_DbDebugFilename, Name,
117 sizeof (AcpiGbl_DbDebugFilename));
118 AcpiGbl_DbOutputToFile = TRUE;
123 /*******************************************************************************
125 * FUNCTION: AcpiDbLoadTables
127 * PARAMETERS: ListHead - List of ACPI tables to load
131 * DESCRIPTION: Load ACPI tables from a previously constructed table list.
133 ******************************************************************************/
137 ACPI_NEW_TABLE_DESC *ListHead)
139 #ifdef ACPI_APPLICATION
141 ACPI_NEW_TABLE_DESC *TableListHead;
142 ACPI_TABLE_HEADER *Table;
145 /* Load all ACPI tables in the list */
147 TableListHead = ListHead;
148 while (TableListHead)
150 Table = TableListHead->Table;
152 Status = AcpiLoadTable (Table);
153 if (ACPI_FAILURE (Status))
155 if (Status == AE_ALREADY_EXISTS)
157 AcpiOsPrintf ("Table %4.4s is already installed\n",
162 AcpiOsPrintf ("Could not install table, %s\n",
163 AcpiFormatException (Status));
169 AcpiOsPrintf ("Acpi table [%4.4s] successfully installed and loaded\n",
172 TableListHead = TableListHead->Next;
176 #endif /* ACPI_APPLICATION */
181 #endif /* ACPI_DEBUGGER */