mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-19 18:53:52 +08:00
ACPICA: Events: Update GPE handling and initialization code.
1) Eliminate most use of GAS structs, since they are not needed for GPEs. 2) Allow raw GPE numbers > 255. Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
21126b296e
commit
7505da4c3f
@ -104,9 +104,10 @@ acpi_status acpi_ev_finish_gpe(struct acpi_gpe_event_info *gpe_event_info);
|
||||
*/
|
||||
acpi_status
|
||||
acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
|
||||
struct acpi_generic_address *gpe_block_address,
|
||||
u64 address,
|
||||
u8 space_id,
|
||||
u32 register_count,
|
||||
u8 gpe_block_base_number,
|
||||
u16 gpe_block_base_number,
|
||||
u32 interrupt_number,
|
||||
struct acpi_gpe_block_info **return_gpe_block);
|
||||
|
||||
|
@ -450,9 +450,9 @@ struct acpi_gpe_event_info {
|
||||
struct acpi_gpe_register_info {
|
||||
struct acpi_generic_address status_address; /* Address of status reg */
|
||||
struct acpi_generic_address enable_address; /* Address of enable reg */
|
||||
u16 base_gpe_number; /* Base GPE number for this register */
|
||||
u8 enable_for_wake; /* GPEs to keep enabled when sleeping */
|
||||
u8 enable_for_run; /* GPEs to keep enabled when running */
|
||||
u8 base_gpe_number; /* Base GPE number for this register */
|
||||
};
|
||||
|
||||
/*
|
||||
@ -466,11 +466,12 @@ struct acpi_gpe_block_info {
|
||||
struct acpi_gpe_xrupt_info *xrupt_block; /* Backpointer to interrupt block */
|
||||
struct acpi_gpe_register_info *register_info; /* One per GPE register pair */
|
||||
struct acpi_gpe_event_info *event_info; /* One for each GPE */
|
||||
struct acpi_generic_address block_address; /* Base address of the block */
|
||||
u64 address; /* Base address of the block */
|
||||
u32 register_count; /* Number of register pairs in block */
|
||||
u16 gpe_count; /* Number of individual GPEs in block */
|
||||
u8 block_base_number; /* Base GPE number for this block */
|
||||
u8 initialized; /* TRUE if this block is initialized */
|
||||
u16 block_base_number; /* Base GPE number for this block */
|
||||
u8 space_id;
|
||||
u8 initialized; /* TRUE if this block is initialized */
|
||||
};
|
||||
|
||||
/* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */
|
||||
|
@ -383,7 +383,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
|
||||
if (!(gpe_register_info->enable_for_run |
|
||||
gpe_register_info->enable_for_wake)) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS,
|
||||
"Ignore disabled registers for GPE%02X-GPE%02X: "
|
||||
"Ignore disabled registers for GPE %02X-%02X: "
|
||||
"RunEnable=%02X, WakeEnable=%02X\n",
|
||||
gpe_register_info->
|
||||
base_gpe_number,
|
||||
@ -416,7 +416,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS,
|
||||
"Read registers for GPE%02X-GPE%02X: Status=%02X, Enable=%02X, "
|
||||
"Read registers for GPE %02X-%02X: Status=%02X, Enable=%02X, "
|
||||
"RunEnable=%02X, WakeEnable=%02X\n",
|
||||
gpe_register_info->base_gpe_number,
|
||||
gpe_register_info->base_gpe_number +
|
||||
@ -706,7 +706,8 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device,
|
||||
status = acpi_hw_clear_gpe(gpe_event_info);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_EXCEPTION((AE_INFO, status,
|
||||
"Unable to clear GPE%02X", gpe_number));
|
||||
"Unable to clear GPE %02X",
|
||||
gpe_number));
|
||||
return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
|
||||
}
|
||||
}
|
||||
@ -723,7 +724,7 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device,
|
||||
status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_DISABLE);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_EXCEPTION((AE_INFO, status,
|
||||
"Unable to disable GPE%02X", gpe_number));
|
||||
"Unable to disable GPE %02X", gpe_number));
|
||||
return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
|
||||
}
|
||||
|
||||
@ -764,7 +765,7 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device,
|
||||
gpe_event_info);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_EXCEPTION((AE_INFO, status,
|
||||
"Unable to queue handler for GPE%02X - event disabled",
|
||||
"Unable to queue handler for GPE %02X - event disabled",
|
||||
gpe_number));
|
||||
}
|
||||
break;
|
||||
@ -776,7 +777,7 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device,
|
||||
* a GPE to be enabled if it has no handler or method.
|
||||
*/
|
||||
ACPI_ERROR((AE_INFO,
|
||||
"No handler or method for GPE%02X, disabling event",
|
||||
"No handler or method for GPE %02X, disabling event",
|
||||
gpe_number));
|
||||
|
||||
break;
|
||||
|
@ -252,21 +252,17 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
|
||||
|
||||
/* Init the register_info for this GPE register (8 GPEs) */
|
||||
|
||||
this_register->base_gpe_number =
|
||||
(u8) (gpe_block->block_base_number +
|
||||
(i * ACPI_GPE_REGISTER_WIDTH));
|
||||
this_register->base_gpe_number = (u16)
|
||||
(gpe_block->block_base_number +
|
||||
(i * ACPI_GPE_REGISTER_WIDTH));
|
||||
|
||||
this_register->status_address.address =
|
||||
gpe_block->block_address.address + i;
|
||||
this_register->status_address.address = gpe_block->address + i;
|
||||
|
||||
this_register->enable_address.address =
|
||||
gpe_block->block_address.address + i +
|
||||
gpe_block->register_count;
|
||||
gpe_block->address + i + gpe_block->register_count;
|
||||
|
||||
this_register->status_address.space_id =
|
||||
gpe_block->block_address.space_id;
|
||||
this_register->enable_address.space_id =
|
||||
gpe_block->block_address.space_id;
|
||||
this_register->status_address.space_id = gpe_block->space_id;
|
||||
this_register->enable_address.space_id = gpe_block->space_id;
|
||||
this_register->status_address.bit_width =
|
||||
ACPI_GPE_REGISTER_WIDTH;
|
||||
this_register->enable_address.bit_width =
|
||||
@ -334,9 +330,10 @@ error_exit:
|
||||
|
||||
acpi_status
|
||||
acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
|
||||
struct acpi_generic_address *gpe_block_address,
|
||||
u64 address,
|
||||
u8 space_id,
|
||||
u32 register_count,
|
||||
u8 gpe_block_base_number,
|
||||
u16 gpe_block_base_number,
|
||||
u32 interrupt_number,
|
||||
struct acpi_gpe_block_info **return_gpe_block)
|
||||
{
|
||||
@ -359,15 +356,14 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
|
||||
|
||||
/* Initialize the new GPE block */
|
||||
|
||||
gpe_block->address = address;
|
||||
gpe_block->space_id = space_id;
|
||||
gpe_block->node = gpe_device;
|
||||
gpe_block->gpe_count = (u16)(register_count * ACPI_GPE_REGISTER_WIDTH);
|
||||
gpe_block->initialized = FALSE;
|
||||
gpe_block->register_count = register_count;
|
||||
gpe_block->block_base_number = gpe_block_base_number;
|
||||
|
||||
ACPI_MEMCPY(&gpe_block->block_address, gpe_block_address,
|
||||
sizeof(struct acpi_generic_address));
|
||||
|
||||
/*
|
||||
* Create the register_info and event_info sub-structures
|
||||
* Note: disables and clears all GPEs in the block
|
||||
@ -408,12 +404,14 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
|
||||
" Initialized GPE %02X to %02X [%4.4s] %u regs on interrupt 0x%X\n",
|
||||
" Initialized GPE %02X to %02X [%4.4s] %u regs on interrupt 0x%X%s\n",
|
||||
(u32)gpe_block->block_base_number,
|
||||
(u32)(gpe_block->block_base_number +
|
||||
(gpe_block->gpe_count - 1)),
|
||||
gpe_device->name.ascii, gpe_block->register_count,
|
||||
interrupt_number));
|
||||
interrupt_number,
|
||||
interrupt_number ==
|
||||
acpi_gbl_FADT.sci_interrupt ? " (SCI)" : ""));
|
||||
|
||||
/* Update global count of currently available GPEs */
|
||||
|
||||
|
@ -131,8 +131,10 @@ acpi_status acpi_ev_gpe_initialize(void)
|
||||
/* Install GPE Block 0 */
|
||||
|
||||
status = acpi_ev_create_gpe_block(acpi_gbl_fadt_gpe_device,
|
||||
&acpi_gbl_FADT.xgpe0_block,
|
||||
register_count0, 0,
|
||||
acpi_gbl_FADT.xgpe0_block.
|
||||
address,
|
||||
acpi_gbl_FADT.xgpe0_block.
|
||||
space_id, register_count0, 0,
|
||||
acpi_gbl_FADT.sci_interrupt,
|
||||
&acpi_gbl_gpe_fadt_blocks[0]);
|
||||
|
||||
@ -169,8 +171,10 @@ acpi_status acpi_ev_gpe_initialize(void)
|
||||
|
||||
status =
|
||||
acpi_ev_create_gpe_block(acpi_gbl_fadt_gpe_device,
|
||||
&acpi_gbl_FADT.xgpe1_block,
|
||||
register_count1,
|
||||
acpi_gbl_FADT.xgpe1_block.
|
||||
address,
|
||||
acpi_gbl_FADT.xgpe1_block.
|
||||
space_id, register_count1,
|
||||
acpi_gbl_FADT.gpe1_base,
|
||||
acpi_gbl_FADT.
|
||||
sci_interrupt,
|
||||
|
@ -599,9 +599,10 @@ acpi_install_gpe_block(acpi_handle gpe_device,
|
||||
* For user-installed GPE Block Devices, the gpe_block_base_number
|
||||
* is always zero
|
||||
*/
|
||||
status =
|
||||
acpi_ev_create_gpe_block(node, gpe_block_address, register_count, 0,
|
||||
interrupt_number, &gpe_block);
|
||||
status = acpi_ev_create_gpe_block(node, gpe_block_address->address,
|
||||
gpe_block_address->space_id,
|
||||
register_count, 0, interrupt_number,
|
||||
&gpe_block);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user