Commit 2ba7379b authored by Bob Moore's avatar Bob Moore Committed by Rafael J. Wysocki

ACPICA: Disassembler/tools: Support for multiple ACPI tables in one file

ACPICA commit 5be7dc4d0d69b2953d156f5bc4d3e8a65a390837

Matches the support in iASL and acpi_exec.

Link: https://github.com/acpica/acpica/commit/5be7dc4dSigned-off-by: default avatarBob Moore <robert.moore@intel.com>
Signed-off-by: default avatarLv Zheng <lv.zheng@intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 675dfa0a
......@@ -197,7 +197,6 @@ acpi-$(ACPI_FUTURE_USAGE) += \
dbfileio.o \
dbtest.o \
utcache.o \
utfileio.o \
utprint.o \
uttrack.o \
utuuid.o
......
......@@ -44,6 +44,8 @@
#ifndef _ACAPPS
#define _ACAPPS
#include <stdio.h>
/* Common info for tool signons */
#define ACPICA_NAME "Intel ACPI Component Architecture"
......@@ -90,6 +92,18 @@
#define FILE_SUFFIX_DISASSEMBLY "dsl"
#define FILE_SUFFIX_BINARY_TABLE ".dat" /* Needs the dot */
/* acfileio */
acpi_status
acpi_ac_get_all_tables_from_file(char *filename,
u8 get_only_aml_tables,
struct acpi_new_table_desc **return_list_head);
/* Values for get_only_aml_tables */
#define ACPI_GET_ONLY_AML_TABLES TRUE
#define ACPI_GET_ALL_TABLES FALSE
/*
* getopt
*/
......@@ -107,30 +121,6 @@ extern char *acpi_gbl_optarg;
*/
u32 cm_get_file_size(ACPI_FILE file);
#ifndef ACPI_DUMP_APP
/*
* adisasm
*/
acpi_status
ad_aml_disassemble(u8 out_to_file,
char *filename, char *prefix, char **out_filename);
void ad_print_statistics(void);
acpi_status ad_find_dsdt(u8 **dsdt_ptr, u32 *dsdt_length);
void ad_dump_tables(void);
acpi_status ad_get_local_tables(void);
acpi_status
ad_parse_table(struct acpi_table_header *table,
acpi_owner_id * owner_id, u8 load_table, u8 external);
acpi_status ad_display_tables(char *filename, struct acpi_table_header *table);
acpi_status ad_display_statistics(void);
/*
* adwalk
*/
......@@ -168,6 +158,5 @@ char *ad_generate_filename(char *prefix, char *table_id);
void
ad_write_table(struct acpi_table_header *table,
u32 length, char *table_name, char *oem_table_id);
#endif
#endif /* _ACAPPS */
......@@ -245,10 +245,7 @@ void acpi_db_open_debug_file(char *name);
acpi_status acpi_db_load_acpi_table(char *filename);
acpi_status
acpi_db_get_table_from_file(char *filename,
struct acpi_table_header **table,
u8 must_be_aml_table);
acpi_status acpi_db_load_tables(struct acpi_new_table_desc *list_head);
/*
* dbhistry - debugger HISTORY command
......
......@@ -219,6 +219,13 @@ struct acpi_table_list {
#define ACPI_ROOT_ORIGIN_ALLOCATED (1)
#define ACPI_ROOT_ALLOW_RESIZE (2)
/* List to manage incoming ACPI tables */
struct acpi_new_table_desc {
struct acpi_table_header *table;
struct acpi_new_table_desc *next;
};
/* Predefined table indexes */
#define ACPI_INVALID_TABLE_INDEX (0xFFFFFFFF)
......
......@@ -352,18 +352,6 @@ acpi_ut_execute_power_methods(struct acpi_namespace_node *device_node,
const char **method_names,
u8 method_count, u8 *out_values);
/*
* utfileio - file operations
*/
#ifdef ACPI_APPLICATION
acpi_status
acpi_ut_read_tables_from_file(FILE * file, struct acpi_table_header **table);
acpi_status
acpi_ut_read_table_from_file(char *filename, struct acpi_table_header **table);
#endif
/*
* utids - device ID support
*/
......
......@@ -46,6 +46,10 @@
#include "accommon.h"
#include "acdebug.h"
#include "actables.h"
#include <stdio.h>
#ifdef ACPI_APPLICATION
#include "acapps.h"
#endif
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME("dbfileio")
......@@ -110,122 +114,31 @@ void acpi_db_open_debug_file(char *name)
}
#endif
#ifdef ACPI_APPLICATION
#include "acapps.h"
/*******************************************************************************
*
* FUNCTION: ae_local_load_table
*
* PARAMETERS: table - pointer to a buffer containing the entire
* table to be loaded
*
* RETURN: Status
*
* DESCRIPTION: This function is called to load a table from the caller's
* buffer. The buffer must contain an entire ACPI Table including
* a valid header. The header fields will be verified, and if it
* is determined that the table is invalid, the call will fail.
*
******************************************************************************/
static acpi_status ae_local_load_table(struct acpi_table_header *table)
{
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE(ae_local_load_table);
#if 0
/* struct acpi_table_desc table_info; */
if (!table) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
table_info.pointer = table;
status = acpi_tb_recognize_table(&table_info, ACPI_TABLE_ALL);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
/* Install the new table into the local data structures */
status = acpi_tb_init_table_descriptor(&table_info);
if (ACPI_FAILURE(status)) {
if (status == AE_ALREADY_EXISTS) {
/* Table already exists, no error */
status = AE_OK;
}
/* Free table allocated by acpi_tb_get_table */
acpi_tb_delete_single_table(&table_info);
return_ACPI_STATUS(status);
}
#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
status =
acpi_ns_load_table(table_info.installed_desc, acpi_gbl_root_node);
if (ACPI_FAILURE(status)) {
/* Uninstall table and free the buffer */
acpi_tb_delete_tables_by_type(ACPI_TABLE_ID_DSDT);
return_ACPI_STATUS(status);
}
#endif
#endif
return_ACPI_STATUS(status);
}
#endif
/*******************************************************************************
*
* FUNCTION: acpi_db_get_table_from_file
* FUNCTION: acpi_db_load_tables
*
* PARAMETERS: filename - File where table is located
* return_table - Where a pointer to the table is returned
* PARAMETERS: list_head - List of ACPI tables to load
*
* RETURN: Status
*
* DESCRIPTION: Load an ACPI table from a file
* DESCRIPTION: Load ACPI tables from a previously constructed table list.
*
******************************************************************************/
acpi_status
acpi_db_get_table_from_file(char *filename,
struct acpi_table_header **return_table,
u8 must_be_aml_file)
acpi_status acpi_db_load_tables(struct acpi_new_table_desc *list_head)
{
#ifdef ACPI_APPLICATION
acpi_status status;
struct acpi_new_table_desc *table_list_head;
struct acpi_table_header *table;
u8 is_aml_table = TRUE;
status = acpi_ut_read_table_from_file(filename, &table);
if (ACPI_FAILURE(status)) {
return (status);
}
if (must_be_aml_file) {
is_aml_table = acpi_ut_is_aml_table(table);
if (!is_aml_table) {
ACPI_EXCEPTION((AE_INFO, AE_OK,
"Input for -e is not an AML table: "
"\"%4.4s\" (must be DSDT/SSDT)",
table->signature));
return (AE_TYPE);
}
}
if (is_aml_table) {
/* Load all ACPI tables in the list */
/* Attempt to recognize and install the table */
table_list_head = list_head;
while (table_list_head) {
table = table_list_head->table;
status = ae_local_load_table(table);
status = acpi_load_table(table);
if (ACPI_FAILURE(status)) {
if (status == AE_ALREADY_EXISTS) {
acpi_os_printf
......@@ -239,18 +152,12 @@ acpi_db_get_table_from_file(char *filename,
return (status);
}
acpi_tb_print_table_header(0, table);
fprintf(stderr,
"Acpi table [%4.4s] successfully installed and loaded\n",
table->signature);
}
acpi_gbl_acpi_hardware_present = FALSE;
if (return_table) {
*return_table = table;
table_list_head = table_list_head->next;
}
#endif /* ACPI_APPLICATION */
return (AE_OK);
}
......@@ -45,6 +45,10 @@
#include "accommon.h"
#include "acdebug.h"
#ifdef ACPI_APPLICATION
#include "acapps.h"
#endif
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME("dbinput")
......@@ -1048,11 +1052,18 @@ acpi_db_command_dispatch(char *input_buffer,
acpi_db_close_debug_file();
break;
case CMD_LOAD:
case CMD_LOAD:{
struct acpi_new_table_desc *list_head = NULL;
status =
acpi_db_get_table_from_file(acpi_gbl_db_args[1], NULL,
FALSE);
status =
acpi_ac_get_all_tables_from_file(acpi_gbl_db_args
[1],
ACPI_GET_ALL_TABLES,
&list_head);
if (ACPI_SUCCESS(status)) {
acpi_db_load_tables(list_head);
}
}
break;
case CMD_OPEN:
......
......@@ -207,7 +207,7 @@ acpi_status acpi_tb_load_namespace(void)
if (!tables_failed) {
ACPI_INFO((AE_INFO,
"%u ACPI AML tables successfully acquired and loaded",
"%u ACPI AML tables successfully acquired and loaded\n",
tables_loaded));
} else {
ACPI_ERROR((AE_INFO,
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment