Linux Audio

Check our new training course

Yocto distribution development and maintenance

Need a Yocto distribution for your embedded project?
Loading...
Note: File does not exist in v3.1.
  1/*******************************************************************************
  2 *
  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)
  5 *
  6 ******************************************************************************/
  7
  8/*
  9 * Copyright (C) 2000 - 2016, Intel Corp.
 10 * All rights reserved.
 11 *
 12 * Redistribution and use in source and binary forms, with or without
 13 * modification, are permitted provided that the following conditions
 14 * are met:
 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.
 26 *
 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.
 30 *
 31 * NO WARRANTY
 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.
 43 */
 44
 45#include <acpi/acpi.h>
 46#include "accommon.h"
 47#include "acdebug.h"
 48#include "actables.h"
 49#include <stdio.h>
 50#ifdef ACPI_APPLICATION
 51#include "acapps.h"
 52#endif
 53
 54#define _COMPONENT          ACPI_CA_DEBUGGER
 55ACPI_MODULE_NAME("dbfileio")
 56
 57#ifdef ACPI_DEBUGGER
 58/*******************************************************************************
 59 *
 60 * FUNCTION:    acpi_db_close_debug_file
 61 *
 62 * PARAMETERS:  None
 63 *
 64 * RETURN:      None
 65 *
 66 * DESCRIPTION: If open, close the current debug output file
 67 *
 68 ******************************************************************************/
 69void acpi_db_close_debug_file(void)
 70{
 71
 72#ifdef ACPI_APPLICATION
 73
 74	if (acpi_gbl_debug_file) {
 75		fclose(acpi_gbl_debug_file);
 76		acpi_gbl_debug_file = NULL;
 77		acpi_gbl_db_output_to_file = FALSE;
 78		acpi_os_printf("Debug output file %s closed\n",
 79			       acpi_gbl_db_debug_filename);
 80	}
 81#endif
 82}
 83
 84/*******************************************************************************
 85 *
 86 * FUNCTION:    acpi_db_open_debug_file
 87 *
 88 * PARAMETERS:  name                - Filename to open
 89 *
 90 * RETURN:      None
 91 *
 92 * DESCRIPTION: Open a file where debug output will be directed.
 93 *
 94 ******************************************************************************/
 95
 96void acpi_db_open_debug_file(char *name)
 97{
 98
 99#ifdef ACPI_APPLICATION
100
101	acpi_db_close_debug_file();
102	acpi_gbl_debug_file = fopen(name, "w+");
103	if (!acpi_gbl_debug_file) {
104		acpi_os_printf("Could not open debug file %s\n", name);
105		return;
106	}
107
108	acpi_os_printf("Debug output file %s opened\n", name);
109	strncpy(acpi_gbl_db_debug_filename, name,
110		sizeof(acpi_gbl_db_debug_filename));
111	acpi_gbl_db_output_to_file = TRUE;
112
113#endif
114}
115#endif
116
117/*******************************************************************************
118 *
119 * FUNCTION:    acpi_db_load_tables
120 *
121 * PARAMETERS:  list_head       - List of ACPI tables to load
122 *
123 * RETURN:      Status
124 *
125 * DESCRIPTION: Load ACPI tables from a previously constructed table list.
126 *
127 ******************************************************************************/
128
129acpi_status acpi_db_load_tables(struct acpi_new_table_desc *list_head)
130{
131	acpi_status status;
132	struct acpi_new_table_desc *table_list_head;
133	struct acpi_table_header *table;
134
135	/* Load all ACPI tables in the list */
136
137	table_list_head = list_head;
138	while (table_list_head) {
139		table = table_list_head->table;
140
141		status = acpi_load_table(table);
142		if (ACPI_FAILURE(status)) {
143			if (status == AE_ALREADY_EXISTS) {
144				acpi_os_printf
145				    ("Table %4.4s is already installed\n",
146				     table->signature);
147			} else {
148				acpi_os_printf("Could not install table, %s\n",
149					       acpi_format_exception(status));
150			}
151
152			return (status);
153		}
154
155		fprintf(stderr,
156			"Acpi table [%4.4s] successfully installed and loaded\n",
157			table->signature);
158
159		table_list_head = table_list_head->next;
160	}
161
162	return (AE_OK);
163}