diff options
Diffstat (limited to 'drivers/acpi/events/evgpeblk.c')
-rw-r--r-- | drivers/acpi/events/evgpeblk.c | 189 |
1 files changed, 112 insertions, 77 deletions
diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c index b312eb33c43e..3b9bbdda551d 100644 --- a/drivers/acpi/events/evgpeblk.c +++ b/drivers/acpi/events/evgpeblk.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | 8 | * Copyright (C) 2000 - 2006, R. Byron Moore |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -78,7 +78,7 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block); | |||
78 | * | 78 | * |
79 | * RETURN: TRUE if the gpe_event is valid | 79 | * RETURN: TRUE if the gpe_event is valid |
80 | * | 80 | * |
81 | * DESCRIPTION: Validate a GPE event. DO NOT CALL FROM INTERRUPT LEVEL. | 81 | * DESCRIPTION: Validate a GPE event. DO NOT CALL FROM INTERRUPT LEVEL. |
82 | * Should be called only when the GPE lists are semaphore locked | 82 | * Should be called only when the GPE lists are semaphore locked |
83 | * and not subject to change. | 83 | * and not subject to change. |
84 | * | 84 | * |
@@ -136,7 +136,7 @@ acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback) | |||
136 | struct acpi_gpe_block_info *gpe_block; | 136 | struct acpi_gpe_block_info *gpe_block; |
137 | struct acpi_gpe_xrupt_info *gpe_xrupt_info; | 137 | struct acpi_gpe_xrupt_info *gpe_xrupt_info; |
138 | acpi_status status = AE_OK; | 138 | acpi_status status = AE_OK; |
139 | u32 flags; | 139 | acpi_native_uint flags; |
140 | 140 | ||
141 | ACPI_FUNCTION_TRACE("ev_walk_gpe_list"); | 141 | ACPI_FUNCTION_TRACE("ev_walk_gpe_list"); |
142 | 142 | ||
@@ -264,7 +264,7 @@ acpi_ev_save_method_info(acpi_handle obj_handle, | |||
264 | * 2) Edge/Level determination is based on the 2nd character | 264 | * 2) Edge/Level determination is based on the 2nd character |
265 | * of the method name | 265 | * of the method name |
266 | * | 266 | * |
267 | * NOTE: Default GPE type is RUNTIME. May be changed later to WAKE | 267 | * NOTE: Default GPE type is RUNTIME. May be changed later to WAKE |
268 | * if a _PRW object is found that points to this GPE. | 268 | * if a _PRW object is found that points to this GPE. |
269 | */ | 269 | */ |
270 | switch (name[1]) { | 270 | switch (name[1]) { |
@@ -279,9 +279,7 @@ acpi_ev_save_method_info(acpi_handle obj_handle, | |||
279 | default: | 279 | default: |
280 | /* Unknown method type, just ignore it! */ | 280 | /* Unknown method type, just ignore it! */ |
281 | 281 | ||
282 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 282 | ACPI_REPORT_ERROR(("Unknown GPE method type: %s (name not of form _Lxx or _Exx)\n", name)); |
283 | "Unknown GPE method type: %s (name not of form _Lxx or _Exx)\n", | ||
284 | name)); | ||
285 | return_ACPI_STATUS(AE_OK); | 283 | return_ACPI_STATUS(AE_OK); |
286 | } | 284 | } |
287 | 285 | ||
@@ -291,9 +289,7 @@ acpi_ev_save_method_info(acpi_handle obj_handle, | |||
291 | if (gpe_number == ACPI_UINT32_MAX) { | 289 | if (gpe_number == ACPI_UINT32_MAX) { |
292 | /* Conversion failed; invalid method, just ignore it */ | 290 | /* Conversion failed; invalid method, just ignore it */ |
293 | 291 | ||
294 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 292 | ACPI_REPORT_ERROR(("Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)\n", name)); |
295 | "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)\n", | ||
296 | name)); | ||
297 | return_ACPI_STATUS(AE_OK); | 293 | return_ACPI_STATUS(AE_OK); |
298 | } | 294 | } |
299 | 295 | ||
@@ -313,14 +309,14 @@ acpi_ev_save_method_info(acpi_handle obj_handle, | |||
313 | 309 | ||
314 | /* | 310 | /* |
315 | * Now we can add this information to the gpe_event_info block | 311 | * Now we can add this information to the gpe_event_info block |
316 | * for use during dispatch of this GPE. Default type is RUNTIME, although | 312 | * for use during dispatch of this GPE. Default type is RUNTIME, although |
317 | * this may change when the _PRW methods are executed later. | 313 | * this may change when the _PRW methods are executed later. |
318 | */ | 314 | */ |
319 | gpe_event_info = | 315 | gpe_event_info = |
320 | &gpe_block->event_info[gpe_number - gpe_block->block_base_number]; | 316 | &gpe_block->event_info[gpe_number - gpe_block->block_base_number]; |
321 | 317 | ||
322 | gpe_event_info->flags = (u8) (type | ACPI_GPE_DISPATCH_METHOD | | 318 | gpe_event_info->flags = (u8) |
323 | ACPI_GPE_TYPE_RUNTIME); | 319 | (type | ACPI_GPE_DISPATCH_METHOD | ACPI_GPE_TYPE_RUNTIME); |
324 | 320 | ||
325 | gpe_event_info->dispatch.method_node = | 321 | gpe_event_info->dispatch.method_node = |
326 | (struct acpi_namespace_node *)obj_handle; | 322 | (struct acpi_namespace_node *)obj_handle; |
@@ -341,11 +337,11 @@ acpi_ev_save_method_info(acpi_handle obj_handle, | |||
341 | * | 337 | * |
342 | * PARAMETERS: Callback from walk_namespace | 338 | * PARAMETERS: Callback from walk_namespace |
343 | * | 339 | * |
344 | * RETURN: Status. NOTE: We ignore errors so that the _PRW walk is | 340 | * RETURN: Status. NOTE: We ignore errors so that the _PRW walk is |
345 | * not aborted on a single _PRW failure. | 341 | * not aborted on a single _PRW failure. |
346 | * | 342 | * |
347 | * DESCRIPTION: Called from acpi_walk_namespace. Expects each object to be a | 343 | * DESCRIPTION: Called from acpi_walk_namespace. Expects each object to be a |
348 | * Device. Run the _PRW method. If present, extract the GPE | 344 | * Device. Run the _PRW method. If present, extract the GPE |
349 | * number and mark the GPE as a WAKE GPE. | 345 | * number and mark the GPE as a WAKE GPE. |
350 | * | 346 | * |
351 | ******************************************************************************/ | 347 | ******************************************************************************/ |
@@ -443,6 +439,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, | |||
443 | 439 | ||
444 | gpe_event_info->flags &= | 440 | gpe_event_info->flags &= |
445 | ~(ACPI_GPE_WAKE_ENABLED | ACPI_GPE_RUN_ENABLED); | 441 | ~(ACPI_GPE_WAKE_ENABLED | ACPI_GPE_RUN_ENABLED); |
442 | |||
446 | status = | 443 | status = |
447 | acpi_ev_set_gpe_type(gpe_event_info, ACPI_GPE_TYPE_WAKE); | 444 | acpi_ev_set_gpe_type(gpe_event_info, ACPI_GPE_TYPE_WAKE); |
448 | if (ACPI_FAILURE(status)) { | 445 | if (ACPI_FAILURE(status)) { |
@@ -466,7 +463,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, | |||
466 | * | 463 | * |
467 | * RETURN: A GPE interrupt block | 464 | * RETURN: A GPE interrupt block |
468 | * | 465 | * |
469 | * DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt | 466 | * DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt |
470 | * block per unique interrupt level used for GPEs. | 467 | * block per unique interrupt level used for GPEs. |
471 | * Should be called only when the GPE lists are semaphore locked | 468 | * Should be called only when the GPE lists are semaphore locked |
472 | * and not subject to change. | 469 | * and not subject to change. |
@@ -479,7 +476,7 @@ static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 | |||
479 | struct acpi_gpe_xrupt_info *next_gpe_xrupt; | 476 | struct acpi_gpe_xrupt_info *next_gpe_xrupt; |
480 | struct acpi_gpe_xrupt_info *gpe_xrupt; | 477 | struct acpi_gpe_xrupt_info *gpe_xrupt; |
481 | acpi_status status; | 478 | acpi_status status; |
482 | u32 flags; | 479 | acpi_native_uint flags; |
483 | 480 | ||
484 | ACPI_FUNCTION_TRACE("ev_get_gpe_xrupt_block"); | 481 | ACPI_FUNCTION_TRACE("ev_get_gpe_xrupt_block"); |
485 | 482 | ||
@@ -526,9 +523,7 @@ static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 | |||
526 | acpi_ev_gpe_xrupt_handler, | 523 | acpi_ev_gpe_xrupt_handler, |
527 | gpe_xrupt); | 524 | gpe_xrupt); |
528 | if (ACPI_FAILURE(status)) { | 525 | if (ACPI_FAILURE(status)) { |
529 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 526 | ACPI_REPORT_ERROR(("Could not install GPE interrupt handler at level 0x%X\n", interrupt_number)); |
530 | "Could not install GPE interrupt handler at level 0x%X\n", | ||
531 | interrupt_number)); | ||
532 | return_PTR(NULL); | 527 | return_PTR(NULL); |
533 | } | 528 | } |
534 | } | 529 | } |
@@ -553,7 +548,7 @@ static acpi_status | |||
553 | acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt) | 548 | acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt) |
554 | { | 549 | { |
555 | acpi_status status; | 550 | acpi_status status; |
556 | u32 flags; | 551 | acpi_native_uint flags; |
557 | 552 | ||
558 | ACPI_FUNCTION_TRACE("ev_delete_gpe_xrupt"); | 553 | ACPI_FUNCTION_TRACE("ev_delete_gpe_xrupt"); |
559 | 554 | ||
@@ -566,8 +561,9 @@ acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt) | |||
566 | 561 | ||
567 | /* Disable this interrupt */ | 562 | /* Disable this interrupt */ |
568 | 563 | ||
569 | status = acpi_os_remove_interrupt_handler(gpe_xrupt->interrupt_number, | 564 | status = |
570 | acpi_ev_gpe_xrupt_handler); | 565 | acpi_os_remove_interrupt_handler(gpe_xrupt->interrupt_number, |
566 | acpi_ev_gpe_xrupt_handler); | ||
571 | if (ACPI_FAILURE(status)) { | 567 | if (ACPI_FAILURE(status)) { |
572 | return_ACPI_STATUS(status); | 568 | return_ACPI_STATUS(status); |
573 | } | 569 | } |
@@ -610,7 +606,7 @@ acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block, | |||
610 | struct acpi_gpe_block_info *next_gpe_block; | 606 | struct acpi_gpe_block_info *next_gpe_block; |
611 | struct acpi_gpe_xrupt_info *gpe_xrupt_block; | 607 | struct acpi_gpe_xrupt_info *gpe_xrupt_block; |
612 | acpi_status status; | 608 | acpi_status status; |
613 | u32 flags; | 609 | acpi_native_uint flags; |
614 | 610 | ||
615 | ACPI_FUNCTION_TRACE("ev_install_gpe_block"); | 611 | ACPI_FUNCTION_TRACE("ev_install_gpe_block"); |
616 | 612 | ||
@@ -663,7 +659,7 @@ acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block, | |||
663 | acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block) | 659 | acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block) |
664 | { | 660 | { |
665 | acpi_status status; | 661 | acpi_status status; |
666 | u32 flags; | 662 | acpi_native_uint flags; |
667 | 663 | ||
668 | ACPI_FUNCTION_TRACE("ev_install_gpe_block"); | 664 | ACPI_FUNCTION_TRACE("ev_install_gpe_block"); |
669 | 665 | ||
@@ -743,22 +739,20 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) | |||
743 | sizeof(struct | 739 | sizeof(struct |
744 | acpi_gpe_register_info)); | 740 | acpi_gpe_register_info)); |
745 | if (!gpe_register_info) { | 741 | if (!gpe_register_info) { |
746 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 742 | ACPI_REPORT_ERROR(("Could not allocate the gpe_register_info table\n")); |
747 | "Could not allocate the gpe_register_info table\n")); | ||
748 | return_ACPI_STATUS(AE_NO_MEMORY); | 743 | return_ACPI_STATUS(AE_NO_MEMORY); |
749 | } | 744 | } |
750 | 745 | ||
751 | /* | 746 | /* |
752 | * Allocate the GPE event_info block. There are eight distinct GPEs | 747 | * Allocate the GPE event_info block. There are eight distinct GPEs |
753 | * per register. Initialization to zeros is sufficient. | 748 | * per register. Initialization to zeros is sufficient. |
754 | */ | 749 | */ |
755 | gpe_event_info = ACPI_MEM_CALLOCATE(((acpi_size) gpe_block-> | 750 | gpe_event_info = ACPI_MEM_CALLOCATE(((acpi_size) gpe_block-> |
756 | register_count * | 751 | register_count * |
757 | ACPI_GPE_REGISTER_WIDTH) * | 752 | ACPI_GPE_REGISTER_WIDTH) * |
758 | sizeof(struct acpi_gpe_event_info)); | 753 | sizeof(struct acpi_gpe_event_info)); |
759 | if (!gpe_event_info) { | 754 | if (!gpe_event_info) { |
760 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 755 | ACPI_REPORT_ERROR(("Could not allocate the gpe_event_info table\n")); |
761 | "Could not allocate the gpe_event_info table\n")); | ||
762 | status = AE_NO_MEMORY; | 756 | status = AE_NO_MEMORY; |
763 | goto error_exit; | 757 | goto error_exit; |
764 | } | 758 | } |
@@ -769,9 +763,9 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) | |||
769 | gpe_block->event_info = gpe_event_info; | 763 | gpe_block->event_info = gpe_event_info; |
770 | 764 | ||
771 | /* | 765 | /* |
772 | * Initialize the GPE Register and Event structures. A goal of these | 766 | * Initialize the GPE Register and Event structures. A goal of these |
773 | * tables is to hide the fact that there are two separate GPE register sets | 767 | * tables is to hide the fact that there are two separate GPE register sets |
774 | * in a given gpe hardware block, the status registers occupy the first half, | 768 | * in a given GPE hardware block, the status registers occupy the first half, |
775 | * and the enable registers occupy the second half. | 769 | * and the enable registers occupy the second half. |
776 | */ | 770 | */ |
777 | this_register = gpe_register_info; | 771 | this_register = gpe_register_info; |
@@ -812,11 +806,8 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) | |||
812 | this_event++; | 806 | this_event++; |
813 | } | 807 | } |
814 | 808 | ||
815 | /* | 809 | /* Disable all GPEs within this register */ |
816 | * Clear the status/enable registers. Note that status registers | 810 | |
817 | * are cleared by writing a '1', while enable registers are cleared | ||
818 | * by writing a '0'. | ||
819 | */ | ||
820 | status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0x00, | 811 | status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0x00, |
821 | &this_register-> | 812 | &this_register-> |
822 | enable_address); | 813 | enable_address); |
@@ -824,6 +815,8 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) | |||
824 | goto error_exit; | 815 | goto error_exit; |
825 | } | 816 | } |
826 | 817 | ||
818 | /* Clear any pending GPE events within this register */ | ||
819 | |||
827 | status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0xFF, | 820 | status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0xFF, |
828 | &this_register-> | 821 | &this_register-> |
829 | status_address); | 822 | status_address); |
@@ -860,7 +853,9 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) | |||
860 | * | 853 | * |
861 | * RETURN: Status | 854 | * RETURN: Status |
862 | * | 855 | * |
863 | * DESCRIPTION: Create and Install a block of GPE registers | 856 | * DESCRIPTION: Create and Install a block of GPE registers. All GPEs within |
857 | * the block are disabled at exit. | ||
858 | * Note: Assumes namespace is locked. | ||
864 | * | 859 | * |
865 | ******************************************************************************/ | 860 | ******************************************************************************/ |
866 | 861 | ||
@@ -872,14 +867,8 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
872 | u32 interrupt_number, | 867 | u32 interrupt_number, |
873 | struct acpi_gpe_block_info **return_gpe_block) | 868 | struct acpi_gpe_block_info **return_gpe_block) |
874 | { | 869 | { |
875 | struct acpi_gpe_block_info *gpe_block; | ||
876 | struct acpi_gpe_event_info *gpe_event_info; | ||
877 | acpi_native_uint i; | ||
878 | acpi_native_uint j; | ||
879 | u32 wake_gpe_count; | ||
880 | u32 gpe_enabled_count; | ||
881 | acpi_status status; | 870 | acpi_status status; |
882 | struct acpi_gpe_walk_info gpe_info; | 871 | struct acpi_gpe_block_info *gpe_block; |
883 | 872 | ||
884 | ACPI_FUNCTION_TRACE("ev_create_gpe_block"); | 873 | ACPI_FUNCTION_TRACE("ev_create_gpe_block"); |
885 | 874 | ||
@@ -896,22 +885,24 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
896 | 885 | ||
897 | /* Initialize the new GPE block */ | 886 | /* Initialize the new GPE block */ |
898 | 887 | ||
888 | gpe_block->node = gpe_device; | ||
899 | gpe_block->register_count = register_count; | 889 | gpe_block->register_count = register_count; |
900 | gpe_block->block_base_number = gpe_block_base_number; | 890 | gpe_block->block_base_number = gpe_block_base_number; |
901 | gpe_block->node = gpe_device; | ||
902 | 891 | ||
903 | ACPI_MEMCPY(&gpe_block->block_address, gpe_block_address, | 892 | ACPI_MEMCPY(&gpe_block->block_address, gpe_block_address, |
904 | sizeof(struct acpi_generic_address)); | 893 | sizeof(struct acpi_generic_address)); |
905 | 894 | ||
906 | /* Create the register_info and event_info sub-structures */ | 895 | /* |
907 | 896 | * Create the register_info and event_info sub-structures | |
897 | * Note: disables and clears all GPEs in the block | ||
898 | */ | ||
908 | status = acpi_ev_create_gpe_info_blocks(gpe_block); | 899 | status = acpi_ev_create_gpe_info_blocks(gpe_block); |
909 | if (ACPI_FAILURE(status)) { | 900 | if (ACPI_FAILURE(status)) { |
910 | ACPI_MEM_FREE(gpe_block); | 901 | ACPI_MEM_FREE(gpe_block); |
911 | return_ACPI_STATUS(status); | 902 | return_ACPI_STATUS(status); |
912 | } | 903 | } |
913 | 904 | ||
914 | /* Install the new block in the global list(s) */ | 905 | /* Install the new block in the global lists */ |
915 | 906 | ||
916 | status = acpi_ev_install_gpe_block(gpe_block, interrupt_number); | 907 | status = acpi_ev_install_gpe_block(gpe_block, interrupt_number); |
917 | if (ACPI_FAILURE(status)) { | 908 | if (ACPI_FAILURE(status)) { |
@@ -926,16 +917,70 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
926 | acpi_ev_save_method_info, gpe_block, | 917 | acpi_ev_save_method_info, gpe_block, |
927 | NULL); | 918 | NULL); |
928 | 919 | ||
920 | /* Return the new block */ | ||
921 | |||
922 | if (return_gpe_block) { | ||
923 | (*return_gpe_block) = gpe_block; | ||
924 | } | ||
925 | |||
926 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, | ||
927 | "GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n", | ||
928 | (u32) gpe_block->block_base_number, | ||
929 | (u32) (gpe_block->block_base_number + | ||
930 | ((gpe_block->register_count * | ||
931 | ACPI_GPE_REGISTER_WIDTH) - 1)), | ||
932 | gpe_device->name.ascii, gpe_block->register_count, | ||
933 | interrupt_number)); | ||
934 | |||
935 | return_ACPI_STATUS(AE_OK); | ||
936 | } | ||
937 | |||
938 | /******************************************************************************* | ||
939 | * | ||
940 | * FUNCTION: acpi_ev_initialize_gpe_block | ||
941 | * | ||
942 | * PARAMETERS: gpe_device - Handle to the parent GPE block | ||
943 | * gpe_block - Gpe Block info | ||
944 | * | ||
945 | * RETURN: Status | ||
946 | * | ||
947 | * DESCRIPTION: Initialize and enable a GPE block. First find and run any | ||
948 | * _PRT methods associated with the block, then enable the | ||
949 | * appropriate GPEs. | ||
950 | * Note: Assumes namespace is locked. | ||
951 | * | ||
952 | ******************************************************************************/ | ||
953 | |||
954 | acpi_status | ||
955 | acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | ||
956 | struct acpi_gpe_block_info *gpe_block) | ||
957 | { | ||
958 | acpi_status status; | ||
959 | struct acpi_gpe_event_info *gpe_event_info; | ||
960 | struct acpi_gpe_walk_info gpe_info; | ||
961 | u32 wake_gpe_count; | ||
962 | u32 gpe_enabled_count; | ||
963 | acpi_native_uint i; | ||
964 | acpi_native_uint j; | ||
965 | |||
966 | ACPI_FUNCTION_TRACE("ev_initialize_gpe_block"); | ||
967 | |||
968 | /* Ignore a null GPE block (e.g., if no GPE block 1 exists) */ | ||
969 | |||
970 | if (!gpe_block) { | ||
971 | return_ACPI_STATUS(AE_OK); | ||
972 | } | ||
973 | |||
929 | /* | 974 | /* |
930 | * Runtime option: Should Wake GPEs be enabled at runtime? The default | 975 | * Runtime option: Should wake GPEs be enabled at runtime? The default |
931 | * is No, they should only be enabled just as the machine goes to sleep. | 976 | * is no, they should only be enabled just as the machine goes to sleep. |
932 | */ | 977 | */ |
933 | if (acpi_gbl_leave_wake_gpes_disabled) { | 978 | if (acpi_gbl_leave_wake_gpes_disabled) { |
934 | /* | 979 | /* |
935 | * Differentiate RUNTIME vs WAKE GPEs, via the _PRW control methods. | 980 | * Differentiate runtime vs wake GPEs, via the _PRW control methods. |
936 | * (Each GPE that has one or more _PRWs that reference it is by | 981 | * Each GPE that has one or more _PRWs that reference it is by |
937 | * definition a WAKE GPE and will not be enabled while the machine | 982 | * definition a wake GPE and will not be enabled while the machine |
938 | * is running.) | 983 | * is running. |
939 | */ | 984 | */ |
940 | gpe_info.gpe_block = gpe_block; | 985 | gpe_info.gpe_block = gpe_block; |
941 | gpe_info.gpe_device = gpe_device; | 986 | gpe_info.gpe_device = gpe_device; |
@@ -948,9 +993,12 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
948 | } | 993 | } |
949 | 994 | ||
950 | /* | 995 | /* |
951 | * Enable all GPEs in this block that are 1) "runtime" or "run/wake" GPEs, | 996 | * Enable all GPEs in this block that have these attributes: |
952 | * and 2) have a corresponding _Lxx or _Exx method. All other GPEs must | 997 | * 1) are "runtime" or "run/wake" GPEs, and |
953 | * be enabled via the acpi_enable_gpe() external interface. | 998 | * 2) have a corresponding _Lxx or _Exx method |
999 | * | ||
1000 | * Any other GPEs within this block must be enabled via the acpi_enable_gpe() | ||
1001 | * external interface. | ||
954 | */ | 1002 | */ |
955 | wake_gpe_count = 0; | 1003 | wake_gpe_count = 0; |
956 | gpe_enabled_count = 0; | 1004 | gpe_enabled_count = 0; |
@@ -976,32 +1024,19 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
976 | } | 1024 | } |
977 | } | 1025 | } |
978 | 1026 | ||
979 | /* Dump info about this GPE block */ | ||
980 | |||
981 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, | ||
982 | "GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n", | ||
983 | (u32) gpe_block->block_base_number, | ||
984 | (u32) (gpe_block->block_base_number + | ||
985 | ((gpe_block->register_count * | ||
986 | ACPI_GPE_REGISTER_WIDTH) - 1)), | ||
987 | gpe_device->name.ascii, gpe_block->register_count, | ||
988 | interrupt_number)); | ||
989 | |||
990 | /* Enable all valid GPEs found above */ | ||
991 | |||
992 | status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block); | ||
993 | |||
994 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, | 1027 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, |
995 | "Found %u Wake, Enabled %u Runtime GPEs in this block\n", | 1028 | "Found %u Wake, Enabled %u Runtime GPEs in this block\n", |
996 | wake_gpe_count, gpe_enabled_count)); | 1029 | wake_gpe_count, gpe_enabled_count)); |
997 | 1030 | ||
998 | /* Return the new block */ | 1031 | /* Enable all valid runtime GPEs found above */ |
999 | 1032 | ||
1000 | if (return_gpe_block) { | 1033 | status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block); |
1001 | (*return_gpe_block) = gpe_block; | 1034 | if (ACPI_FAILURE(status)) { |
1035 | ACPI_REPORT_ERROR(("Could not enable GPEs in gpe_block %p\n", | ||
1036 | gpe_block)); | ||
1002 | } | 1037 | } |
1003 | 1038 | ||
1004 | return_ACPI_STATUS(AE_OK); | 1039 | return_ACPI_STATUS(status); |
1005 | } | 1040 | } |
1006 | 1041 | ||
1007 | /******************************************************************************* | 1042 | /******************************************************************************* |