1 // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
2 /*******************************************************************************
4 * Module Name: dbfileio - Debugger file I/O commands. These can't usually
5 * be used when running the debugger in Ring 0 (Kernel mode)
7 ******************************************************************************/
14 #define _COMPONENT ACPI_CA_DEBUGGER
15 ACPI_MODULE_NAME("dbfileio")
17 #ifdef ACPI_APPLICATION
20 /*******************************************************************************
22 * FUNCTION: acpi_db_close_debug_file
28 * DESCRIPTION: If open, close the current debug output file
30 ******************************************************************************/
31 void acpi_db_close_debug_file(void)
34 if (acpi_gbl_debug_file
) {
35 fclose(acpi_gbl_debug_file
);
36 acpi_gbl_debug_file
= NULL
;
37 acpi_gbl_db_output_to_file
= FALSE
;
38 acpi_os_printf("Debug output file %s closed\n",
39 acpi_gbl_db_debug_filename
);
43 /*******************************************************************************
45 * FUNCTION: acpi_db_open_debug_file
47 * PARAMETERS: name - Filename to open
51 * DESCRIPTION: Open a file where debug output will be directed.
53 ******************************************************************************/
55 void acpi_db_open_debug_file(char *name
)
58 acpi_db_close_debug_file();
59 acpi_gbl_debug_file
= fopen(name
, "w+");
60 if (!acpi_gbl_debug_file
) {
61 acpi_os_printf("Could not open debug file %s\n", name
);
65 acpi_os_printf("Debug output file %s opened\n", name
);
66 acpi_ut_safe_strncpy(acpi_gbl_db_debug_filename
, name
,
67 sizeof(acpi_gbl_db_debug_filename
));
68 acpi_gbl_db_output_to_file
= TRUE
;
72 /*******************************************************************************
74 * FUNCTION: acpi_db_load_tables
76 * PARAMETERS: list_head - List of ACPI tables to load
80 * DESCRIPTION: Load ACPI tables from a previously constructed table list.
82 ******************************************************************************/
84 acpi_status
acpi_db_load_tables(struct acpi_new_table_desc
*list_head
)
87 struct acpi_new_table_desc
*table_list_head
;
88 struct acpi_table_header
*table
;
90 /* Load all ACPI tables in the list */
92 table_list_head
= list_head
;
93 while (table_list_head
) {
94 table
= table_list_head
->table
;
96 status
= acpi_load_table(table
, NULL
);
97 if (ACPI_FAILURE(status
)) {
98 if (status
== AE_ALREADY_EXISTS
) {
100 ("Table %4.4s is already installed\n",
103 acpi_os_printf("Could not install table, %s\n",
104 acpi_format_exception(status
));
111 ("Acpi table [%4.4s] successfully installed and loaded\n",
114 table_list_head
= table_list_head
->next
;