aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/events/evgpeblk.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/events/evgpeblk.c')
-rw-r--r--drivers/acpi/events/evgpeblk.c63
1 files changed, 33 insertions, 30 deletions
diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c
index 84186a7d17b2..dfc54692b127 100644
--- a/drivers/acpi/events/evgpeblk.c
+++ b/drivers/acpi/events/evgpeblk.c
@@ -66,7 +66,7 @@ acpi_ev_match_prw_and_gpe (
66 66
67static struct acpi_gpe_xrupt_info * 67static struct acpi_gpe_xrupt_info *
68acpi_ev_get_gpe_xrupt_block ( 68acpi_ev_get_gpe_xrupt_block (
69 u32 interrupt_level); 69 u32 interrupt_number);
70 70
71static acpi_status 71static acpi_status
72acpi_ev_delete_gpe_xrupt ( 72acpi_ev_delete_gpe_xrupt (
@@ -75,7 +75,7 @@ acpi_ev_delete_gpe_xrupt (
75static acpi_status 75static acpi_status
76acpi_ev_install_gpe_block ( 76acpi_ev_install_gpe_block (
77 struct acpi_gpe_block_info *gpe_block, 77 struct acpi_gpe_block_info *gpe_block,
78 u32 interrupt_level); 78 u32 interrupt_number);
79 79
80static acpi_status 80static acpi_status
81acpi_ev_create_gpe_info_blocks ( 81acpi_ev_create_gpe_info_blocks (
@@ -138,7 +138,6 @@ acpi_ev_valid_gpe_event (
138 * FUNCTION: acpi_ev_walk_gpe_list 138 * FUNCTION: acpi_ev_walk_gpe_list
139 * 139 *
140 * PARAMETERS: gpe_walk_callback - Routine called for each GPE block 140 * PARAMETERS: gpe_walk_callback - Routine called for each GPE block
141 * Flags - ACPI_NOT_ISR or ACPI_ISR
142 * 141 *
143 * RETURN: Status 142 * RETURN: Status
144 * 143 *
@@ -148,18 +147,18 @@ acpi_ev_valid_gpe_event (
148 147
149acpi_status 148acpi_status
150acpi_ev_walk_gpe_list ( 149acpi_ev_walk_gpe_list (
151 ACPI_GPE_CALLBACK gpe_walk_callback, 150 ACPI_GPE_CALLBACK gpe_walk_callback)
152 u32 flags)
153{ 151{
154 struct acpi_gpe_block_info *gpe_block; 152 struct acpi_gpe_block_info *gpe_block;
155 struct acpi_gpe_xrupt_info *gpe_xrupt_info; 153 struct acpi_gpe_xrupt_info *gpe_xrupt_info;
156 acpi_status status = AE_OK; 154 acpi_status status = AE_OK;
155 u32 flags;
157 156
158 157
159 ACPI_FUNCTION_TRACE ("ev_walk_gpe_list"); 158 ACPI_FUNCTION_TRACE ("ev_walk_gpe_list");
160 159
161 160
162 acpi_os_acquire_lock (acpi_gbl_gpe_lock, flags); 161 flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
163 162
164 /* Walk the interrupt level descriptor list */ 163 /* Walk the interrupt level descriptor list */
165 164
@@ -482,7 +481,7 @@ cleanup:
482 * 481 *
483 * FUNCTION: acpi_ev_get_gpe_xrupt_block 482 * FUNCTION: acpi_ev_get_gpe_xrupt_block
484 * 483 *
485 * PARAMETERS: interrupt_level - Interrupt for a GPE block 484 * PARAMETERS: interrupt_number - Interrupt for a GPE block
486 * 485 *
487 * RETURN: A GPE interrupt block 486 * RETURN: A GPE interrupt block
488 * 487 *
@@ -495,11 +494,12 @@ cleanup:
495 494
496static struct acpi_gpe_xrupt_info * 495static struct acpi_gpe_xrupt_info *
497acpi_ev_get_gpe_xrupt_block ( 496acpi_ev_get_gpe_xrupt_block (
498 u32 interrupt_level) 497 u32 interrupt_number)
499{ 498{
500 struct acpi_gpe_xrupt_info *next_gpe_xrupt; 499 struct acpi_gpe_xrupt_info *next_gpe_xrupt;
501 struct acpi_gpe_xrupt_info *gpe_xrupt; 500 struct acpi_gpe_xrupt_info *gpe_xrupt;
502 acpi_status status; 501 acpi_status status;
502 u32 flags;
503 503
504 504
505 ACPI_FUNCTION_TRACE ("ev_get_gpe_xrupt_block"); 505 ACPI_FUNCTION_TRACE ("ev_get_gpe_xrupt_block");
@@ -509,7 +509,7 @@ acpi_ev_get_gpe_xrupt_block (
509 509
510 next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head; 510 next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head;
511 while (next_gpe_xrupt) { 511 while (next_gpe_xrupt) {
512 if (next_gpe_xrupt->interrupt_level == interrupt_level) { 512 if (next_gpe_xrupt->interrupt_number == interrupt_number) {
513 return_PTR (next_gpe_xrupt); 513 return_PTR (next_gpe_xrupt);
514 } 514 }
515 515
@@ -523,11 +523,11 @@ acpi_ev_get_gpe_xrupt_block (
523 return_PTR (NULL); 523 return_PTR (NULL);
524 } 524 }
525 525
526 gpe_xrupt->interrupt_level = interrupt_level; 526 gpe_xrupt->interrupt_number = interrupt_number;
527 527
528 /* Install new interrupt descriptor with spin lock */ 528 /* Install new interrupt descriptor with spin lock */
529 529
530 acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); 530 flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
531 if (acpi_gbl_gpe_xrupt_list_head) { 531 if (acpi_gbl_gpe_xrupt_list_head) {
532 next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head; 532 next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head;
533 while (next_gpe_xrupt->next) { 533 while (next_gpe_xrupt->next) {
@@ -540,17 +540,17 @@ acpi_ev_get_gpe_xrupt_block (
540 else { 540 else {
541 acpi_gbl_gpe_xrupt_list_head = gpe_xrupt; 541 acpi_gbl_gpe_xrupt_list_head = gpe_xrupt;
542 } 542 }
543 acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); 543 acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
544 544
545 /* Install new interrupt handler if not SCI_INT */ 545 /* Install new interrupt handler if not SCI_INT */
546 546
547 if (interrupt_level != acpi_gbl_FADT->sci_int) { 547 if (interrupt_number != acpi_gbl_FADT->sci_int) {
548 status = acpi_os_install_interrupt_handler (interrupt_level, 548 status = acpi_os_install_interrupt_handler (interrupt_number,
549 acpi_ev_gpe_xrupt_handler, gpe_xrupt); 549 acpi_ev_gpe_xrupt_handler, gpe_xrupt);
550 if (ACPI_FAILURE (status)) { 550 if (ACPI_FAILURE (status)) {
551 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 551 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
552 "Could not install GPE interrupt handler at level 0x%X\n", 552 "Could not install GPE interrupt handler at level 0x%X\n",
553 interrupt_level)); 553 interrupt_number));
554 return_PTR (NULL); 554 return_PTR (NULL);
555 } 555 }
556 } 556 }
@@ -577,6 +577,7 @@ acpi_ev_delete_gpe_xrupt (
577 struct acpi_gpe_xrupt_info *gpe_xrupt) 577 struct acpi_gpe_xrupt_info *gpe_xrupt)
578{ 578{
579 acpi_status status; 579 acpi_status status;
580 u32 flags;
580 581
581 582
582 ACPI_FUNCTION_TRACE ("ev_delete_gpe_xrupt"); 583 ACPI_FUNCTION_TRACE ("ev_delete_gpe_xrupt");
@@ -584,14 +585,14 @@ acpi_ev_delete_gpe_xrupt (
584 585
585 /* We never want to remove the SCI interrupt handler */ 586 /* We never want to remove the SCI interrupt handler */
586 587
587 if (gpe_xrupt->interrupt_level == acpi_gbl_FADT->sci_int) { 588 if (gpe_xrupt->interrupt_number == acpi_gbl_FADT->sci_int) {
588 gpe_xrupt->gpe_block_list_head = NULL; 589 gpe_xrupt->gpe_block_list_head = NULL;
589 return_ACPI_STATUS (AE_OK); 590 return_ACPI_STATUS (AE_OK);
590 } 591 }
591 592
592 /* Disable this interrupt */ 593 /* Disable this interrupt */
593 594
594 status = acpi_os_remove_interrupt_handler (gpe_xrupt->interrupt_level, 595 status = acpi_os_remove_interrupt_handler (gpe_xrupt->interrupt_number,
595 acpi_ev_gpe_xrupt_handler); 596 acpi_ev_gpe_xrupt_handler);
596 if (ACPI_FAILURE (status)) { 597 if (ACPI_FAILURE (status)) {
597 return_ACPI_STATUS (status); 598 return_ACPI_STATUS (status);
@@ -599,7 +600,7 @@ acpi_ev_delete_gpe_xrupt (
599 600
600 /* Unlink the interrupt block with lock */ 601 /* Unlink the interrupt block with lock */
601 602
602 acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); 603 flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
603 if (gpe_xrupt->previous) { 604 if (gpe_xrupt->previous) {
604 gpe_xrupt->previous->next = gpe_xrupt->next; 605 gpe_xrupt->previous->next = gpe_xrupt->next;
605 } 606 }
@@ -607,7 +608,7 @@ acpi_ev_delete_gpe_xrupt (
607 if (gpe_xrupt->next) { 608 if (gpe_xrupt->next) {
608 gpe_xrupt->next->previous = gpe_xrupt->previous; 609 gpe_xrupt->next->previous = gpe_xrupt->previous;
609 } 610 }
610 acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); 611 acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
611 612
612 /* Free the block */ 613 /* Free the block */
613 614
@@ -621,7 +622,7 @@ acpi_ev_delete_gpe_xrupt (
621 * FUNCTION: acpi_ev_install_gpe_block 622 * FUNCTION: acpi_ev_install_gpe_block
622 * 623 *
623 * PARAMETERS: gpe_block - New GPE block 624 * PARAMETERS: gpe_block - New GPE block
624 * interrupt_level - Level to be associated with this GPE block 625 * interrupt_number - Xrupt to be associated with this GPE block
625 * 626 *
626 * RETURN: Status 627 * RETURN: Status
627 * 628 *
@@ -632,11 +633,12 @@ acpi_ev_delete_gpe_xrupt (
632static acpi_status 633static acpi_status
633acpi_ev_install_gpe_block ( 634acpi_ev_install_gpe_block (
634 struct acpi_gpe_block_info *gpe_block, 635 struct acpi_gpe_block_info *gpe_block,
635 u32 interrupt_level) 636 u32 interrupt_number)
636{ 637{
637 struct acpi_gpe_block_info *next_gpe_block; 638 struct acpi_gpe_block_info *next_gpe_block;
638 struct acpi_gpe_xrupt_info *gpe_xrupt_block; 639 struct acpi_gpe_xrupt_info *gpe_xrupt_block;
639 acpi_status status; 640 acpi_status status;
641 u32 flags;
640 642
641 643
642 ACPI_FUNCTION_TRACE ("ev_install_gpe_block"); 644 ACPI_FUNCTION_TRACE ("ev_install_gpe_block");
@@ -647,7 +649,7 @@ acpi_ev_install_gpe_block (
647 return_ACPI_STATUS (status); 649 return_ACPI_STATUS (status);
648 } 650 }
649 651
650 gpe_xrupt_block = acpi_ev_get_gpe_xrupt_block (interrupt_level); 652 gpe_xrupt_block = acpi_ev_get_gpe_xrupt_block (interrupt_number);
651 if (!gpe_xrupt_block) { 653 if (!gpe_xrupt_block) {
652 status = AE_NO_MEMORY; 654 status = AE_NO_MEMORY;
653 goto unlock_and_exit; 655 goto unlock_and_exit;
@@ -655,7 +657,7 @@ acpi_ev_install_gpe_block (
655 657
656 /* Install the new block at the end of the list with lock */ 658 /* Install the new block at the end of the list with lock */
657 659
658 acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); 660 flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
659 if (gpe_xrupt_block->gpe_block_list_head) { 661 if (gpe_xrupt_block->gpe_block_list_head) {
660 next_gpe_block = gpe_xrupt_block->gpe_block_list_head; 662 next_gpe_block = gpe_xrupt_block->gpe_block_list_head;
661 while (next_gpe_block->next) { 663 while (next_gpe_block->next) {
@@ -670,7 +672,7 @@ acpi_ev_install_gpe_block (
670 } 672 }
671 673
672 gpe_block->xrupt_block = gpe_xrupt_block; 674 gpe_block->xrupt_block = gpe_xrupt_block;
673 acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); 675 acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
674 676
675unlock_and_exit: 677unlock_and_exit:
676 status = acpi_ut_release_mutex (ACPI_MTX_EVENTS); 678 status = acpi_ut_release_mutex (ACPI_MTX_EVENTS);
@@ -695,6 +697,7 @@ acpi_ev_delete_gpe_block (
695 struct acpi_gpe_block_info *gpe_block) 697 struct acpi_gpe_block_info *gpe_block)
696{ 698{
697 acpi_status status; 699 acpi_status status;
700 u32 flags;
698 701
699 702
700 ACPI_FUNCTION_TRACE ("ev_install_gpe_block"); 703 ACPI_FUNCTION_TRACE ("ev_install_gpe_block");
@@ -720,7 +723,7 @@ acpi_ev_delete_gpe_block (
720 else { 723 else {
721 /* Remove the block on this interrupt with lock */ 724 /* Remove the block on this interrupt with lock */
722 725
723 acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); 726 flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
724 if (gpe_block->previous) { 727 if (gpe_block->previous) {
725 gpe_block->previous->next = gpe_block->next; 728 gpe_block->previous->next = gpe_block->next;
726 } 729 }
@@ -731,7 +734,7 @@ acpi_ev_delete_gpe_block (
731 if (gpe_block->next) { 734 if (gpe_block->next) {
732 gpe_block->next->previous = gpe_block->previous; 735 gpe_block->next->previous = gpe_block->previous;
733 } 736 }
734 acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); 737 acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
735 } 738 }
736 739
737 /* Free the gpe_block */ 740 /* Free the gpe_block */
@@ -887,7 +890,7 @@ error_exit:
887 * gpe_block_address - Address and space_iD 890 * gpe_block_address - Address and space_iD
888 * register_count - Number of GPE register pairs in the block 891 * register_count - Number of GPE register pairs in the block
889 * gpe_block_base_number - Starting GPE number for the block 892 * gpe_block_base_number - Starting GPE number for the block
890 * interrupt_level - H/W interrupt for the block 893 * interrupt_number - H/W interrupt for the block
891 * return_gpe_block - Where the new block descriptor is returned 894 * return_gpe_block - Where the new block descriptor is returned
892 * 895 *
893 * RETURN: Status 896 * RETURN: Status
@@ -902,7 +905,7 @@ acpi_ev_create_gpe_block (
902 struct acpi_generic_address *gpe_block_address, 905 struct acpi_generic_address *gpe_block_address,
903 u32 register_count, 906 u32 register_count,
904 u8 gpe_block_base_number, 907 u8 gpe_block_base_number,
905 u32 interrupt_level, 908 u32 interrupt_number,
906 struct acpi_gpe_block_info **return_gpe_block) 909 struct acpi_gpe_block_info **return_gpe_block)
907{ 910{
908 struct acpi_gpe_block_info *gpe_block; 911 struct acpi_gpe_block_info *gpe_block;
@@ -948,7 +951,7 @@ acpi_ev_create_gpe_block (
948 951
949 /* Install the new block in the global list(s) */ 952 /* Install the new block in the global list(s) */
950 953
951 status = acpi_ev_install_gpe_block (gpe_block, interrupt_level); 954 status = acpi_ev_install_gpe_block (gpe_block, interrupt_number);
952 if (ACPI_FAILURE (status)) { 955 if (ACPI_FAILURE (status)) {
953 ACPI_MEM_FREE (gpe_block); 956 ACPI_MEM_FREE (gpe_block);
954 return_ACPI_STATUS (status); 957 return_ACPI_STATUS (status);
@@ -1013,7 +1016,7 @@ acpi_ev_create_gpe_block (
1013 ((gpe_block->register_count * ACPI_GPE_REGISTER_WIDTH) -1)), 1016 ((gpe_block->register_count * ACPI_GPE_REGISTER_WIDTH) -1)),
1014 gpe_device->name.ascii, 1017 gpe_device->name.ascii,
1015 gpe_block->register_count, 1018 gpe_block->register_count,
1016 interrupt_level)); 1019 interrupt_number));
1017 1020
1018 /* Enable all valid GPEs found above */ 1021 /* Enable all valid GPEs found above */
1019 1022