diff options
author | Bob Moore <robert.moore@intel.com> | 2014-04-29 22:06:15 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-05-06 18:55:02 -0400 |
commit | 7505da4c3f90dd61302e825b005d08144c5de050 (patch) | |
tree | 601b41987fa6d7b0d403907636e3e40598063916 /drivers/acpi | |
parent | 21126b296e6f5f172e72da7cebb42b87fbd19b3a (diff) |
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>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/acpica/acevents.h | 5 | ||||
-rw-r--r-- | drivers/acpi/acpica/aclocal.h | 9 | ||||
-rw-r--r-- | drivers/acpi/acpica/evgpe.c | 13 | ||||
-rw-r--r-- | drivers/acpi/acpica/evgpeblk.c | 34 | ||||
-rw-r--r-- | drivers/acpi/acpica/evgpeinit.c | 12 | ||||
-rw-r--r-- | drivers/acpi/acpica/evxfgpe.c | 7 |
6 files changed, 43 insertions, 37 deletions
diff --git a/drivers/acpi/acpica/acevents.h b/drivers/acpi/acpica/acevents.h index 68ec61fff188..7a7811a9fc26 100644 --- a/drivers/acpi/acpica/acevents.h +++ b/drivers/acpi/acpica/acevents.h | |||
@@ -104,9 +104,10 @@ acpi_status acpi_ev_finish_gpe(struct acpi_gpe_event_info *gpe_event_info); | |||
104 | */ | 104 | */ |
105 | acpi_status | 105 | acpi_status |
106 | acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | 106 | acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, |
107 | struct acpi_generic_address *gpe_block_address, | 107 | u64 address, |
108 | u8 space_id, | ||
108 | u32 register_count, | 109 | u32 register_count, |
109 | u8 gpe_block_base_number, | 110 | u16 gpe_block_base_number, |
110 | u32 interrupt_number, | 111 | u32 interrupt_number, |
111 | struct acpi_gpe_block_info **return_gpe_block); | 112 | struct acpi_gpe_block_info **return_gpe_block); |
112 | 113 | ||
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h index f68cb602dc23..91f801a2e689 100644 --- a/drivers/acpi/acpica/aclocal.h +++ b/drivers/acpi/acpica/aclocal.h | |||
@@ -450,9 +450,9 @@ struct acpi_gpe_event_info { | |||
450 | struct acpi_gpe_register_info { | 450 | struct acpi_gpe_register_info { |
451 | struct acpi_generic_address status_address; /* Address of status reg */ | 451 | struct acpi_generic_address status_address; /* Address of status reg */ |
452 | struct acpi_generic_address enable_address; /* Address of enable reg */ | 452 | struct acpi_generic_address enable_address; /* Address of enable reg */ |
453 | u16 base_gpe_number; /* Base GPE number for this register */ | ||
453 | u8 enable_for_wake; /* GPEs to keep enabled when sleeping */ | 454 | u8 enable_for_wake; /* GPEs to keep enabled when sleeping */ |
454 | u8 enable_for_run; /* GPEs to keep enabled when running */ | 455 | u8 enable_for_run; /* GPEs to keep enabled when running */ |
455 | u8 base_gpe_number; /* Base GPE number for this register */ | ||
456 | }; | 456 | }; |
457 | 457 | ||
458 | /* | 458 | /* |
@@ -466,11 +466,12 @@ struct acpi_gpe_block_info { | |||
466 | struct acpi_gpe_xrupt_info *xrupt_block; /* Backpointer to interrupt block */ | 466 | struct acpi_gpe_xrupt_info *xrupt_block; /* Backpointer to interrupt block */ |
467 | struct acpi_gpe_register_info *register_info; /* One per GPE register pair */ | 467 | struct acpi_gpe_register_info *register_info; /* One per GPE register pair */ |
468 | struct acpi_gpe_event_info *event_info; /* One for each GPE */ | 468 | struct acpi_gpe_event_info *event_info; /* One for each GPE */ |
469 | struct acpi_generic_address block_address; /* Base address of the block */ | 469 | u64 address; /* Base address of the block */ |
470 | u32 register_count; /* Number of register pairs in block */ | 470 | u32 register_count; /* Number of register pairs in block */ |
471 | u16 gpe_count; /* Number of individual GPEs in block */ | 471 | u16 gpe_count; /* Number of individual GPEs in block */ |
472 | u8 block_base_number; /* Base GPE number for this block */ | 472 | u16 block_base_number; /* Base GPE number for this block */ |
473 | u8 initialized; /* TRUE if this block is initialized */ | 473 | u8 space_id; |
474 | u8 initialized; /* TRUE if this block is initialized */ | ||
474 | }; | 475 | }; |
475 | 476 | ||
476 | /* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */ | 477 | /* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */ |
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c index 955f83da68a5..48f70013b488 100644 --- a/drivers/acpi/acpica/evgpe.c +++ b/drivers/acpi/acpica/evgpe.c | |||
@@ -383,7 +383,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
383 | if (!(gpe_register_info->enable_for_run | | 383 | if (!(gpe_register_info->enable_for_run | |
384 | gpe_register_info->enable_for_wake)) { | 384 | gpe_register_info->enable_for_wake)) { |
385 | ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS, | 385 | ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS, |
386 | "Ignore disabled registers for GPE%02X-GPE%02X: " | 386 | "Ignore disabled registers for GPE %02X-%02X: " |
387 | "RunEnable=%02X, WakeEnable=%02X\n", | 387 | "RunEnable=%02X, WakeEnable=%02X\n", |
388 | gpe_register_info-> | 388 | gpe_register_info-> |
389 | base_gpe_number, | 389 | base_gpe_number, |
@@ -416,7 +416,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
416 | } | 416 | } |
417 | 417 | ||
418 | ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS, | 418 | ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS, |
419 | "Read registers for GPE%02X-GPE%02X: Status=%02X, Enable=%02X, " | 419 | "Read registers for GPE %02X-%02X: Status=%02X, Enable=%02X, " |
420 | "RunEnable=%02X, WakeEnable=%02X\n", | 420 | "RunEnable=%02X, WakeEnable=%02X\n", |
421 | gpe_register_info->base_gpe_number, | 421 | gpe_register_info->base_gpe_number, |
422 | gpe_register_info->base_gpe_number + | 422 | gpe_register_info->base_gpe_number + |
@@ -706,7 +706,8 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device, | |||
706 | status = acpi_hw_clear_gpe(gpe_event_info); | 706 | status = acpi_hw_clear_gpe(gpe_event_info); |
707 | if (ACPI_FAILURE(status)) { | 707 | if (ACPI_FAILURE(status)) { |
708 | ACPI_EXCEPTION((AE_INFO, status, | 708 | ACPI_EXCEPTION((AE_INFO, status, |
709 | "Unable to clear GPE%02X", gpe_number)); | 709 | "Unable to clear GPE %02X", |
710 | gpe_number)); | ||
710 | return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); | 711 | return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); |
711 | } | 712 | } |
712 | } | 713 | } |
@@ -723,7 +724,7 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device, | |||
723 | status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_DISABLE); | 724 | status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_DISABLE); |
724 | if (ACPI_FAILURE(status)) { | 725 | if (ACPI_FAILURE(status)) { |
725 | ACPI_EXCEPTION((AE_INFO, status, | 726 | ACPI_EXCEPTION((AE_INFO, status, |
726 | "Unable to disable GPE%02X", gpe_number)); | 727 | "Unable to disable GPE %02X", gpe_number)); |
727 | return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); | 728 | return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); |
728 | } | 729 | } |
729 | 730 | ||
@@ -764,7 +765,7 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device, | |||
764 | gpe_event_info); | 765 | gpe_event_info); |
765 | if (ACPI_FAILURE(status)) { | 766 | if (ACPI_FAILURE(status)) { |
766 | ACPI_EXCEPTION((AE_INFO, status, | 767 | ACPI_EXCEPTION((AE_INFO, status, |
767 | "Unable to queue handler for GPE%02X - event disabled", | 768 | "Unable to queue handler for GPE %02X - event disabled", |
768 | gpe_number)); | 769 | gpe_number)); |
769 | } | 770 | } |
770 | break; | 771 | break; |
@@ -776,7 +777,7 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device, | |||
776 | * a GPE to be enabled if it has no handler or method. | 777 | * a GPE to be enabled if it has no handler or method. |
777 | */ | 778 | */ |
778 | ACPI_ERROR((AE_INFO, | 779 | ACPI_ERROR((AE_INFO, |
779 | "No handler or method for GPE%02X, disabling event", | 780 | "No handler or method for GPE %02X, disabling event", |
780 | gpe_number)); | 781 | gpe_number)); |
781 | 782 | ||
782 | break; | 783 | break; |
diff --git a/drivers/acpi/acpica/evgpeblk.c b/drivers/acpi/acpica/evgpeblk.c index caaed3c673fd..d86699eea33c 100644 --- a/drivers/acpi/acpica/evgpeblk.c +++ b/drivers/acpi/acpica/evgpeblk.c | |||
@@ -252,21 +252,17 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) | |||
252 | 252 | ||
253 | /* Init the register_info for this GPE register (8 GPEs) */ | 253 | /* Init the register_info for this GPE register (8 GPEs) */ |
254 | 254 | ||
255 | this_register->base_gpe_number = | 255 | this_register->base_gpe_number = (u16) |
256 | (u8) (gpe_block->block_base_number + | 256 | (gpe_block->block_base_number + |
257 | (i * ACPI_GPE_REGISTER_WIDTH)); | 257 | (i * ACPI_GPE_REGISTER_WIDTH)); |
258 | 258 | ||
259 | this_register->status_address.address = | 259 | this_register->status_address.address = gpe_block->address + i; |
260 | gpe_block->block_address.address + i; | ||
261 | 260 | ||
262 | this_register->enable_address.address = | 261 | this_register->enable_address.address = |
263 | gpe_block->block_address.address + i + | 262 | gpe_block->address + i + gpe_block->register_count; |
264 | gpe_block->register_count; | ||
265 | 263 | ||
266 | this_register->status_address.space_id = | 264 | this_register->status_address.space_id = gpe_block->space_id; |
267 | gpe_block->block_address.space_id; | 265 | this_register->enable_address.space_id = gpe_block->space_id; |
268 | this_register->enable_address.space_id = | ||
269 | gpe_block->block_address.space_id; | ||
270 | this_register->status_address.bit_width = | 266 | this_register->status_address.bit_width = |
271 | ACPI_GPE_REGISTER_WIDTH; | 267 | ACPI_GPE_REGISTER_WIDTH; |
272 | this_register->enable_address.bit_width = | 268 | this_register->enable_address.bit_width = |
@@ -334,9 +330,10 @@ error_exit: | |||
334 | 330 | ||
335 | acpi_status | 331 | acpi_status |
336 | acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | 332 | acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, |
337 | struct acpi_generic_address *gpe_block_address, | 333 | u64 address, |
334 | u8 space_id, | ||
338 | u32 register_count, | 335 | u32 register_count, |
339 | u8 gpe_block_base_number, | 336 | u16 gpe_block_base_number, |
340 | u32 interrupt_number, | 337 | u32 interrupt_number, |
341 | struct acpi_gpe_block_info **return_gpe_block) | 338 | struct acpi_gpe_block_info **return_gpe_block) |
342 | { | 339 | { |
@@ -359,15 +356,14 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
359 | 356 | ||
360 | /* Initialize the new GPE block */ | 357 | /* Initialize the new GPE block */ |
361 | 358 | ||
359 | gpe_block->address = address; | ||
360 | gpe_block->space_id = space_id; | ||
362 | gpe_block->node = gpe_device; | 361 | gpe_block->node = gpe_device; |
363 | gpe_block->gpe_count = (u16)(register_count * ACPI_GPE_REGISTER_WIDTH); | 362 | gpe_block->gpe_count = (u16)(register_count * ACPI_GPE_REGISTER_WIDTH); |
364 | gpe_block->initialized = FALSE; | 363 | gpe_block->initialized = FALSE; |
365 | gpe_block->register_count = register_count; | 364 | gpe_block->register_count = register_count; |
366 | gpe_block->block_base_number = gpe_block_base_number; | 365 | gpe_block->block_base_number = gpe_block_base_number; |
367 | 366 | ||
368 | ACPI_MEMCPY(&gpe_block->block_address, gpe_block_address, | ||
369 | sizeof(struct acpi_generic_address)); | ||
370 | |||
371 | /* | 367 | /* |
372 | * Create the register_info and event_info sub-structures | 368 | * Create the register_info and event_info sub-structures |
373 | * Note: disables and clears all GPEs in the block | 369 | * Note: disables and clears all GPEs in the block |
@@ -408,12 +404,14 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
408 | } | 404 | } |
409 | 405 | ||
410 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 406 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
411 | " Initialized GPE %02X to %02X [%4.4s] %u regs on interrupt 0x%X\n", | 407 | " Initialized GPE %02X to %02X [%4.4s] %u regs on interrupt 0x%X%s\n", |
412 | (u32)gpe_block->block_base_number, | 408 | (u32)gpe_block->block_base_number, |
413 | (u32)(gpe_block->block_base_number + | 409 | (u32)(gpe_block->block_base_number + |
414 | (gpe_block->gpe_count - 1)), | 410 | (gpe_block->gpe_count - 1)), |
415 | gpe_device->name.ascii, gpe_block->register_count, | 411 | gpe_device->name.ascii, gpe_block->register_count, |
416 | interrupt_number)); | 412 | interrupt_number, |
413 | interrupt_number == | ||
414 | acpi_gbl_FADT.sci_interrupt ? " (SCI)" : "")); | ||
417 | 415 | ||
418 | /* Update global count of currently available GPEs */ | 416 | /* Update global count of currently available GPEs */ |
419 | 417 | ||
diff --git a/drivers/acpi/acpica/evgpeinit.c b/drivers/acpi/acpica/evgpeinit.c index ae779c1e871d..49fc7effd961 100644 --- a/drivers/acpi/acpica/evgpeinit.c +++ b/drivers/acpi/acpica/evgpeinit.c | |||
@@ -131,8 +131,10 @@ acpi_status acpi_ev_gpe_initialize(void) | |||
131 | /* Install GPE Block 0 */ | 131 | /* Install GPE Block 0 */ |
132 | 132 | ||
133 | status = acpi_ev_create_gpe_block(acpi_gbl_fadt_gpe_device, | 133 | status = acpi_ev_create_gpe_block(acpi_gbl_fadt_gpe_device, |
134 | &acpi_gbl_FADT.xgpe0_block, | 134 | acpi_gbl_FADT.xgpe0_block. |
135 | register_count0, 0, | 135 | address, |
136 | acpi_gbl_FADT.xgpe0_block. | ||
137 | space_id, register_count0, 0, | ||
136 | acpi_gbl_FADT.sci_interrupt, | 138 | acpi_gbl_FADT.sci_interrupt, |
137 | &acpi_gbl_gpe_fadt_blocks[0]); | 139 | &acpi_gbl_gpe_fadt_blocks[0]); |
138 | 140 | ||
@@ -169,8 +171,10 @@ acpi_status acpi_ev_gpe_initialize(void) | |||
169 | 171 | ||
170 | status = | 172 | status = |
171 | acpi_ev_create_gpe_block(acpi_gbl_fadt_gpe_device, | 173 | acpi_ev_create_gpe_block(acpi_gbl_fadt_gpe_device, |
172 | &acpi_gbl_FADT.xgpe1_block, | 174 | acpi_gbl_FADT.xgpe1_block. |
173 | register_count1, | 175 | address, |
176 | acpi_gbl_FADT.xgpe1_block. | ||
177 | space_id, register_count1, | ||
174 | acpi_gbl_FADT.gpe1_base, | 178 | acpi_gbl_FADT.gpe1_base, |
175 | acpi_gbl_FADT. | 179 | acpi_gbl_FADT. |
176 | sci_interrupt, | 180 | sci_interrupt, |
diff --git a/drivers/acpi/acpica/evxfgpe.c b/drivers/acpi/acpica/evxfgpe.c index 20a1392ffe06..cb534faf5369 100644 --- a/drivers/acpi/acpica/evxfgpe.c +++ b/drivers/acpi/acpica/evxfgpe.c | |||
@@ -599,9 +599,10 @@ acpi_install_gpe_block(acpi_handle gpe_device, | |||
599 | * For user-installed GPE Block Devices, the gpe_block_base_number | 599 | * For user-installed GPE Block Devices, the gpe_block_base_number |
600 | * is always zero | 600 | * is always zero |
601 | */ | 601 | */ |
602 | status = | 602 | status = acpi_ev_create_gpe_block(node, gpe_block_address->address, |
603 | acpi_ev_create_gpe_block(node, gpe_block_address, register_count, 0, | 603 | gpe_block_address->space_id, |
604 | interrupt_number, &gpe_block); | 604 | register_count, 0, interrupt_number, |
605 | &gpe_block); | ||
605 | if (ACPI_FAILURE(status)) { | 606 | if (ACPI_FAILURE(status)) { |
606 | goto unlock_and_exit; | 607 | goto unlock_and_exit; |
607 | } | 608 | } |