Skip to content

Commit

Permalink
ACPICA: Split file: tbxface.c -> tbxfload.c
Browse files Browse the repository at this point in the history
Split out the table load functions in preparation for addition
of new interfaces.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
  • Loading branch information
Bob Moore authored and Len Brown committed Jul 17, 2012
1 parent 540b85a commit d59b8ec
Show file tree
Hide file tree
Showing 3 changed files with 213 additions and 164 deletions.
1 change: 1 addition & 0 deletions drivers/acpi/acpica/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ acpi-y += \
tbinstal.o \
tbutils.o \
tbxface.o \
tbxfload.o \
tbxfroot.o

acpi-y += \
Expand Down
165 changes: 1 addition & 164 deletions drivers/acpi/acpica/tbxface.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: tbxface - Public interfaces to the ACPI subsystem
* ACPI table oriented interfaces
* Module Name: tbxface - ACPI table oriented external interfaces
*
*****************************************************************************/

Expand Down Expand Up @@ -51,11 +50,6 @@
#define _COMPONENT ACPI_TABLES
ACPI_MODULE_NAME("tbxface")

/* Local prototypes */
static acpi_status acpi_tb_load_namespace(void);

static int no_auto_ssdt;

/*******************************************************************************
*
* FUNCTION: acpi_allocate_root_table
Expand All @@ -69,7 +63,6 @@ static int no_auto_ssdt;
* acpi_initialize_tables.
*
******************************************************************************/

acpi_status acpi_allocate_root_table(u32 initial_table_count)
{

Expand Down Expand Up @@ -502,150 +495,6 @@ acpi_get_table_by_index(u32 table_index, struct acpi_table_header **table)

ACPI_EXPORT_SYMBOL(acpi_get_table_by_index)

/*******************************************************************************
*
* FUNCTION: acpi_tb_load_namespace
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Load the namespace from the DSDT and all SSDTs/PSDTs found in
* the RSDT/XSDT.
*
******************************************************************************/
static acpi_status acpi_tb_load_namespace(void)
{
acpi_status status;
u32 i;
struct acpi_table_header *new_dsdt;

ACPI_FUNCTION_TRACE(tb_load_namespace);

(void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);

/*
* Load the namespace. The DSDT is required, but any SSDT and
* PSDT tables are optional. Verify the DSDT.
*/
if (!acpi_gbl_root_table_list.current_table_count ||
!ACPI_COMPARE_NAME(&
(acpi_gbl_root_table_list.
tables[ACPI_TABLE_INDEX_DSDT].signature),
ACPI_SIG_DSDT)
||
ACPI_FAILURE(acpi_tb_verify_table
(&acpi_gbl_root_table_list.
tables[ACPI_TABLE_INDEX_DSDT]))) {
status = AE_NO_ACPI_TABLES;
goto unlock_and_exit;
}

/*
* Save the DSDT pointer for simple access. This is the mapped memory
* address. We must take care here because the address of the .Tables
* array can change dynamically as tables are loaded at run-time. Note:
* .Pointer field is not validated until after call to acpi_tb_verify_table.
*/
acpi_gbl_DSDT =
acpi_gbl_root_table_list.tables[ACPI_TABLE_INDEX_DSDT].pointer;

/*
* Optionally copy the entire DSDT to local memory (instead of simply
* mapping it.) There are some BIOSs that corrupt or replace the original
* DSDT, creating the need for this option. Default is FALSE, do not copy
* the DSDT.
*/
if (acpi_gbl_copy_dsdt_locally) {
new_dsdt = acpi_tb_copy_dsdt(ACPI_TABLE_INDEX_DSDT);
if (new_dsdt) {
acpi_gbl_DSDT = new_dsdt;
}
}

/*
* Save the original DSDT header for detection of table corruption
* and/or replacement of the DSDT from outside the OS.
*/
ACPI_MEMCPY(&acpi_gbl_original_dsdt_header, acpi_gbl_DSDT,
sizeof(struct acpi_table_header));

(void)acpi_ut_release_mutex(ACPI_MTX_TABLES);

/* Load and parse tables */

status = acpi_ns_load_table(ACPI_TABLE_INDEX_DSDT, acpi_gbl_root_node);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}

/* Load any SSDT or PSDT tables. Note: Loop leaves tables locked */

(void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
for (i = 0; i < acpi_gbl_root_table_list.current_table_count; ++i) {
if ((!ACPI_COMPARE_NAME
(&(acpi_gbl_root_table_list.tables[i].signature),
ACPI_SIG_SSDT)
&&
!ACPI_COMPARE_NAME(&
(acpi_gbl_root_table_list.tables[i].
signature), ACPI_SIG_PSDT))
||
ACPI_FAILURE(acpi_tb_verify_table
(&acpi_gbl_root_table_list.tables[i]))) {
continue;
}

if (no_auto_ssdt) {
printk(KERN_WARNING "ACPI: SSDT ignored due to \"acpi_no_auto_ssdt\"\n");
continue;
}

/* Ignore errors while loading tables, get as many as possible */

(void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
(void)acpi_ns_load_table(i, acpi_gbl_root_node);
(void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
}

ACPI_DEBUG_PRINT((ACPI_DB_INIT, "ACPI Tables successfully acquired\n"));

unlock_and_exit:
(void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
return_ACPI_STATUS(status);
}

/*******************************************************************************
*
* FUNCTION: acpi_load_tables
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Load the ACPI tables from the RSDT/XSDT
*
******************************************************************************/

acpi_status acpi_load_tables(void)
{
acpi_status status;

ACPI_FUNCTION_TRACE(acpi_load_tables);

/* Load the namespace from the tables */

status = acpi_tb_load_namespace();
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status,
"While loading namespace from ACPI tables"));
}

return_ACPI_STATUS(status);
}

ACPI_EXPORT_SYMBOL(acpi_load_tables)


/*******************************************************************************
*
Expand Down Expand Up @@ -734,15 +583,3 @@ acpi_status acpi_remove_table_handler(acpi_tbl_handler handler)
}

ACPI_EXPORT_SYMBOL(acpi_remove_table_handler)


static int __init acpi_no_auto_ssdt_setup(char *s) {

printk(KERN_NOTICE "ACPI: SSDT auto-load disabled\n");

no_auto_ssdt = 1;

return 1;
}

__setup("acpi_no_auto_ssdt", acpi_no_auto_ssdt_setup);
Loading

0 comments on commit d59b8ec

Please sign in to comment.