Skip to content

Commit

Permalink
ACPICA: Add mechanism to defer _REG methods for some installed handlers
Browse files Browse the repository at this point in the history
The memory/io/pci/dataTable regions must always be available. For
any user installed handlers for these spaces, defer execution
of _REG methods until acpi_enable_subsystem. This prevents any
chicken/egg problems and ensures that no methods are executed
until all of these regions are ready and available.

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 Mar 3, 2011
1 parent 47863b9 commit ef09c4f
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 2 deletions.
4 changes: 4 additions & 0 deletions drivers/acpi/acpica/acglobal.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,10 @@ ACPI_EXTERN u32 acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS];
ACPI_EXTERN u8 acpi_gbl_last_owner_id_index;
ACPI_EXTERN u8 acpi_gbl_next_owner_id_offset;

/* Initialization sequencing */

ACPI_EXTERN u8 acpi_gbl_reg_methods_executed;

/* Misc */

ACPI_EXTERN u32 acpi_gbl_original_mode;
Expand Down
2 changes: 2 additions & 0 deletions drivers/acpi/acpica/evregion.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ acpi_status acpi_ev_initialize_op_regions(void)
}
}

acpi_gbl_reg_methods_executed = TRUE;

(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
return_ACPI_STATUS(status);
}
Expand Down
34 changes: 32 additions & 2 deletions drivers/acpi/acpica/evxfregn.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,39 @@ acpi_install_address_space_handler(acpi_handle device,
goto unlock_and_exit;
}

/* Run all _REG methods for this address space */
/*
* For the default space_iDs, (the IDs for which there are default region handlers
* installed) Only execute the _REG methods if the global initialization _REG
* methods have already been run (via acpi_initialize_objects). In other words,
* we will defer the execution of the _REG methods for these space_iDs until
* execution of acpi_initialize_objects. This is done because we need the handlers
* for the default spaces (mem/io/pci/table) to be installed before we can run
* any control methods (or _REG methods). There is known BIOS code that depends
* on this.
*
* For all other space_iDs, we can safely execute the _REG methods immediately.
* This means that for IDs like embedded_controller, this function should be called
* only after acpi_enable_subsystem has been called.
*/
switch (space_id) {
case ACPI_ADR_SPACE_SYSTEM_MEMORY:
case ACPI_ADR_SPACE_SYSTEM_IO:
case ACPI_ADR_SPACE_PCI_CONFIG:
case ACPI_ADR_SPACE_DATA_TABLE:

if (acpi_gbl_reg_methods_executed) {

/* Run all _REG methods for this address space */

status = acpi_ev_execute_reg_methods(node, space_id);
}
break;

default:

status = acpi_ev_execute_reg_methods(node, space_id);
status = acpi_ev_execute_reg_methods(node, space_id);
break;
}

unlock_and_exit:
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
Expand Down
1 change: 1 addition & 0 deletions drivers/acpi/acpica/utglobal.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ acpi_status acpi_ut_init_globals(void)
acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT;
acpi_gbl_osi_data = 0;
acpi_gbl_osi_mutex = NULL;
acpi_gbl_reg_methods_executed = FALSE;

/* Hardware oriented */

Expand Down

0 comments on commit ef09c4f

Please sign in to comment.