ACPICA: Implement simplified Table Manager
The Table Manager component has been completely redesigned and reimplemented. The new design is much simpler, and reduces the overall code and data size of the kernel-resident ACPICA by approximately 5%. Also, it is now possible to obtain the ACPI tables very early during kernel initialization, even before dynamic memory management is initialized. Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
@@ -46,8 +46,9 @@
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acnamesp.h>
|
||||
|
||||
ACPI_EXPORT_SYMBOL(acpi_gbl_FADT)
|
||||
#define _COMPONENT ACPI_UTILITIES
|
||||
ACPI_MODULE_NAME("utglobal")
|
||||
ACPI_MODULE_NAME("utglobal")
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@@ -280,53 +281,6 @@ char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position)
|
||||
return (acpi_gbl_hex_to_ascii[(integer >> position) & 0xF]);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Table name globals
|
||||
*
|
||||
* NOTE: This table includes ONLY the ACPI tables that the subsystem consumes.
|
||||
* it is NOT an exhaustive list of all possible ACPI tables. All ACPI tables
|
||||
* that are not used by the subsystem are simply ignored.
|
||||
*
|
||||
* Do NOT add any table to this list that is not consumed directly by this
|
||||
* subsystem (No MADT, ECDT, SBST, etc.)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
struct acpi_table_list acpi_gbl_table_lists[ACPI_TABLE_ID_MAX + 1];
|
||||
|
||||
struct acpi_table_support acpi_gbl_table_data[ACPI_TABLE_ID_MAX + 1] = {
|
||||
/*********** Name, Signature, Global typed pointer Signature size, Type How many allowed?, Contains valid AML? */
|
||||
|
||||
/* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL, sizeof(RSDP_SIG) - 1,
|
||||
ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE}
|
||||
,
|
||||
/* DSDT 1 */ {DSDT_SIG, DSDT_SIG, (void *)&acpi_gbl_DSDT,
|
||||
sizeof(DSDT_SIG) - 1,
|
||||
ACPI_TABLE_SECONDARY | ACPI_TABLE_SINGLE |
|
||||
ACPI_TABLE_EXECUTABLE}
|
||||
,
|
||||
/* FADT 2 */ {FADT_SIG, FADT_SIG, (void *)&acpi_gbl_FADT,
|
||||
sizeof(FADT_SIG) - 1,
|
||||
ACPI_TABLE_PRIMARY | ACPI_TABLE_SINGLE}
|
||||
,
|
||||
/* FACS 3 */ {FACS_SIG, FACS_SIG, (void *)&acpi_gbl_FACS,
|
||||
sizeof(FACS_SIG) - 1,
|
||||
ACPI_TABLE_SECONDARY | ACPI_TABLE_SINGLE}
|
||||
,
|
||||
/* PSDT 4 */ {PSDT_SIG, PSDT_SIG, NULL, sizeof(PSDT_SIG) - 1,
|
||||
ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE |
|
||||
ACPI_TABLE_EXECUTABLE}
|
||||
,
|
||||
/* SSDT 5 */ {SSDT_SIG, SSDT_SIG, NULL, sizeof(SSDT_SIG) - 1,
|
||||
ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE |
|
||||
ACPI_TABLE_EXECUTABLE}
|
||||
,
|
||||
/* XSDT 6 */ {XSDT_SIG, XSDT_SIG, NULL, sizeof(RSDT_SIG) - 1,
|
||||
ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE}
|
||||
,
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Event and Hardware globals
|
||||
@@ -751,13 +705,6 @@ void acpi_ut_init_globals(void)
|
||||
return;
|
||||
}
|
||||
|
||||
/* ACPI table structure */
|
||||
|
||||
for (i = 0; i < (ACPI_TABLE_ID_MAX + 1); i++) {
|
||||
acpi_gbl_table_lists[i].next = NULL;
|
||||
acpi_gbl_table_lists[i].count = 0;
|
||||
}
|
||||
|
||||
/* Mutex locked flags */
|
||||
|
||||
for (i = 0; i < ACPI_NUM_MUTEX; i++) {
|
||||
@@ -784,14 +731,6 @@ void acpi_ut_init_globals(void)
|
||||
acpi_gbl_exception_handler = NULL;
|
||||
acpi_gbl_init_handler = NULL;
|
||||
|
||||
/* Global "typed" ACPI table pointers */
|
||||
|
||||
acpi_gbl_RSDP = NULL;
|
||||
acpi_gbl_XSDT = NULL;
|
||||
acpi_gbl_FACS = NULL;
|
||||
acpi_gbl_FADT = NULL;
|
||||
acpi_gbl_DSDT = NULL;
|
||||
|
||||
/* Global Lock support */
|
||||
|
||||
acpi_gbl_global_lock_semaphore = NULL;
|
||||
@@ -801,8 +740,6 @@ void acpi_ut_init_globals(void)
|
||||
|
||||
/* Miscellaneous variables */
|
||||
|
||||
acpi_gbl_table_flags = ACPI_PHYSICAL_POINTER;
|
||||
acpi_gbl_rsdp_original_location = 0;
|
||||
acpi_gbl_cm_single_step = FALSE;
|
||||
acpi_gbl_db_terminate_threads = FALSE;
|
||||
acpi_gbl_shutdown = FALSE;
|
||||
|
@@ -44,6 +44,7 @@
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acnamesp.h>
|
||||
#include <acpi/acevents.h>
|
||||
#include <acpi/actables.h>
|
||||
|
||||
#define _COMPONENT ACPI_UTILITIES
|
||||
ACPI_MODULE_NAME("utinit")
|
||||
@@ -73,8 +74,8 @@ acpi_ut_fadt_register_error(char *register_name, u32 value, u8 offset)
|
||||
{
|
||||
|
||||
ACPI_WARNING((AE_INFO,
|
||||
"Invalid FADT value %s=%X at offset %X FADT=%p",
|
||||
register_name, value, offset, acpi_gbl_FADT));
|
||||
"Invalid FADT value %s=%X at offset %X in FADT=%p",
|
||||
register_name, value, offset, &acpi_gbl_FADT));
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -96,62 +97,70 @@ acpi_status acpi_ut_validate_fadt(void)
|
||||
* Verify Fixed ACPI Description Table fields,
|
||||
* but don't abort on any problems, just display error
|
||||
*/
|
||||
if (acpi_gbl_FADT->pm1_evt_len < 4) {
|
||||
if (acpi_gbl_FADT.pm1_event_length < 4) {
|
||||
acpi_ut_fadt_register_error("PM1_EVT_LEN",
|
||||
(u32) acpi_gbl_FADT->pm1_evt_len,
|
||||
ACPI_FADT_OFFSET(pm1_evt_len));
|
||||
(u32) acpi_gbl_FADT.
|
||||
pm1_event_length,
|
||||
ACPI_FADT_OFFSET(pm1_event_length));
|
||||
}
|
||||
|
||||
if (!acpi_gbl_FADT->pm1_cnt_len) {
|
||||
if (!acpi_gbl_FADT.pm1_control_length) {
|
||||
acpi_ut_fadt_register_error("PM1_CNT_LEN", 0,
|
||||
ACPI_FADT_OFFSET(pm1_cnt_len));
|
||||
ACPI_FADT_OFFSET
|
||||
(pm1_control_length));
|
||||
}
|
||||
|
||||
if (!acpi_gbl_FADT->xpm1a_evt_blk.address) {
|
||||
if (!acpi_gbl_FADT.xpm1a_event_block.address) {
|
||||
acpi_ut_fadt_register_error("X_PM1a_EVT_BLK", 0,
|
||||
ACPI_FADT_OFFSET(xpm1a_evt_blk.
|
||||
ACPI_FADT_OFFSET(xpm1a_event_block.
|
||||
address));
|
||||
}
|
||||
|
||||
if (!acpi_gbl_FADT->xpm1a_cnt_blk.address) {
|
||||
if (!acpi_gbl_FADT.xpm1a_control_block.address) {
|
||||
acpi_ut_fadt_register_error("X_PM1a_CNT_BLK", 0,
|
||||
ACPI_FADT_OFFSET(xpm1a_cnt_blk.
|
||||
address));
|
||||
ACPI_FADT_OFFSET
|
||||
(xpm1a_control_block.address));
|
||||
}
|
||||
|
||||
if (!acpi_gbl_FADT->xpm_tmr_blk.address) {
|
||||
if (!acpi_gbl_FADT.xpm_timer_block.address) {
|
||||
acpi_ut_fadt_register_error("X_PM_TMR_BLK", 0,
|
||||
ACPI_FADT_OFFSET(xpm_tmr_blk.
|
||||
ACPI_FADT_OFFSET(xpm_timer_block.
|
||||
address));
|
||||
}
|
||||
|
||||
if ((acpi_gbl_FADT->xpm2_cnt_blk.address &&
|
||||
!acpi_gbl_FADT->pm2_cnt_len)) {
|
||||
if ((acpi_gbl_FADT.xpm2_control_block.address &&
|
||||
!acpi_gbl_FADT.pm2_control_length)) {
|
||||
acpi_ut_fadt_register_error("PM2_CNT_LEN",
|
||||
(u32) acpi_gbl_FADT->pm2_cnt_len,
|
||||
ACPI_FADT_OFFSET(pm2_cnt_len));
|
||||
(u32) acpi_gbl_FADT.
|
||||
pm2_control_length,
|
||||
ACPI_FADT_OFFSET
|
||||
(pm2_control_length));
|
||||
}
|
||||
|
||||
if (acpi_gbl_FADT->pm_tm_len < 4) {
|
||||
if (acpi_gbl_FADT.pm_timer_length < 4) {
|
||||
acpi_ut_fadt_register_error("PM_TM_LEN",
|
||||
(u32) acpi_gbl_FADT->pm_tm_len,
|
||||
ACPI_FADT_OFFSET(pm_tm_len));
|
||||
(u32) acpi_gbl_FADT.pm_timer_length,
|
||||
ACPI_FADT_OFFSET(pm_timer_length));
|
||||
}
|
||||
|
||||
/* Length of GPE blocks must be a multiple of 2 */
|
||||
|
||||
if (acpi_gbl_FADT->xgpe0_blk.address &&
|
||||
(acpi_gbl_FADT->gpe0_blk_len & 1)) {
|
||||
if (acpi_gbl_FADT.xgpe0_block.address &&
|
||||
(acpi_gbl_FADT.gpe0_block_length & 1)) {
|
||||
acpi_ut_fadt_register_error("(x)GPE0_BLK_LEN",
|
||||
(u32) acpi_gbl_FADT->gpe0_blk_len,
|
||||
ACPI_FADT_OFFSET(gpe0_blk_len));
|
||||
(u32) acpi_gbl_FADT.
|
||||
gpe0_block_length,
|
||||
ACPI_FADT_OFFSET
|
||||
(gpe0_block_length));
|
||||
}
|
||||
|
||||
if (acpi_gbl_FADT->xgpe1_blk.address &&
|
||||
(acpi_gbl_FADT->gpe1_blk_len & 1)) {
|
||||
if (acpi_gbl_FADT.xgpe1_block.address &&
|
||||
(acpi_gbl_FADT.gpe1_block_length & 1)) {
|
||||
acpi_ut_fadt_register_error("(x)GPE1_BLK_LEN",
|
||||
(u32) acpi_gbl_FADT->gpe1_blk_len,
|
||||
ACPI_FADT_OFFSET(gpe1_blk_len));
|
||||
(u32) acpi_gbl_FADT.
|
||||
gpe1_block_length,
|
||||
ACPI_FADT_OFFSET
|
||||
(gpe1_block_length));
|
||||
}
|
||||
|
||||
return (AE_OK);
|
||||
@@ -178,7 +187,6 @@ static void acpi_ut_terminate(void)
|
||||
|
||||
ACPI_FUNCTION_TRACE(ut_terminate);
|
||||
|
||||
/* Free global tables, etc. */
|
||||
/* Free global GPE blocks and related info structures */
|
||||
|
||||
gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head;
|
||||
@@ -239,6 +247,10 @@ void acpi_ut_subsystem_shutdown(void)
|
||||
|
||||
acpi_ns_terminate();
|
||||
|
||||
/* Delete the ACPI tables */
|
||||
|
||||
acpi_tb_terminate();
|
||||
|
||||
/* Close the globals */
|
||||
|
||||
acpi_ut_terminate();
|
||||
|
@@ -67,9 +67,9 @@ u8 acpi_ut_is_aml_table(struct acpi_table_header *table)
|
||||
|
||||
/* These are the only tables that contain executable AML */
|
||||
|
||||
if (ACPI_COMPARE_NAME(table->signature, DSDT_SIG) ||
|
||||
ACPI_COMPARE_NAME(table->signature, PSDT_SIG) ||
|
||||
ACPI_COMPARE_NAME(table->signature, SSDT_SIG)) {
|
||||
if (ACPI_COMPARE_NAME(table->signature, ACPI_SIG_DSDT) ||
|
||||
ACPI_COMPARE_NAME(table->signature, ACPI_SIG_PSDT) ||
|
||||
ACPI_COMPARE_NAME(table->signature, ACPI_SIG_SSDT)) {
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
@@ -418,7 +418,7 @@ u32 acpi_ut_dword_byte_swap(u32 value)
|
||||
void acpi_ut_set_integer_width(u8 revision)
|
||||
{
|
||||
|
||||
if (revision <= 1) {
|
||||
if (revision < 2) {
|
||||
|
||||
/* 32-bit case */
|
||||
|
||||
|
@@ -398,7 +398,6 @@ acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer)
|
||||
{
|
||||
struct acpi_system_info *info_ptr;
|
||||
acpi_status status;
|
||||
u32 i;
|
||||
|
||||
ACPI_FUNCTION_TRACE(acpi_get_system_info);
|
||||
|
||||
@@ -431,9 +430,7 @@ acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer)
|
||||
|
||||
/* Timer resolution - 24 or 32 bits */
|
||||
|
||||
if (!acpi_gbl_FADT) {
|
||||
info_ptr->timer_resolution = 0;
|
||||
} else if (acpi_gbl_FADT->tmr_val_ext == 0) {
|
||||
if (acpi_gbl_FADT.flags & ACPI_FADT_32BIT_TIMER) {
|
||||
info_ptr->timer_resolution = 24;
|
||||
} else {
|
||||
info_ptr->timer_resolution = 32;
|
||||
@@ -449,13 +446,6 @@ acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer)
|
||||
info_ptr->debug_layer = acpi_dbg_layer;
|
||||
info_ptr->debug_level = acpi_dbg_level;
|
||||
|
||||
/* Current status of the ACPI tables, per table type */
|
||||
|
||||
info_ptr->num_table_types = ACPI_TABLE_ID_MAX + 1;
|
||||
for (i = 0; i < (ACPI_TABLE_ID_MAX + 1); i++) {
|
||||
info_ptr->table_info[i].count = acpi_gbl_table_lists[i].count;
|
||||
}
|
||||
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user