diff options
Diffstat (limited to 'drivers/acpi/events/evgpeblk.c')
-rw-r--r-- | drivers/acpi/events/evgpeblk.c | 215 |
1 files changed, 133 insertions, 82 deletions
diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c index b312eb33c43e..0fd00b5ad650 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_cpu_flags 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,9 @@ 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_ERROR((AE_INFO, |
283 | "Unknown GPE method type: %s (name not of form _Lxx or _Exx)\n", | 283 | "Unknown GPE method type: %s (name not of form _Lxx or _Exx)", |
284 | name)); | 284 | name)); |
285 | return_ACPI_STATUS(AE_OK); | 285 | return_ACPI_STATUS(AE_OK); |
286 | } | 286 | } |
287 | 287 | ||
@@ -291,9 +291,9 @@ acpi_ev_save_method_info(acpi_handle obj_handle, | |||
291 | if (gpe_number == ACPI_UINT32_MAX) { | 291 | if (gpe_number == ACPI_UINT32_MAX) { |
292 | /* Conversion failed; invalid method, just ignore it */ | 292 | /* Conversion failed; invalid method, just ignore it */ |
293 | 293 | ||
294 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 294 | ACPI_ERROR((AE_INFO, |
295 | "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)\n", | 295 | "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)", |
296 | name)); | 296 | name)); |
297 | return_ACPI_STATUS(AE_OK); | 297 | return_ACPI_STATUS(AE_OK); |
298 | } | 298 | } |
299 | 299 | ||
@@ -313,14 +313,14 @@ acpi_ev_save_method_info(acpi_handle obj_handle, | |||
313 | 313 | ||
314 | /* | 314 | /* |
315 | * Now we can add this information to the gpe_event_info block | 315 | * 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 | 316 | * for use during dispatch of this GPE. Default type is RUNTIME, although |
317 | * this may change when the _PRW methods are executed later. | 317 | * this may change when the _PRW methods are executed later. |
318 | */ | 318 | */ |
319 | gpe_event_info = | 319 | gpe_event_info = |
320 | &gpe_block->event_info[gpe_number - gpe_block->block_base_number]; | 320 | &gpe_block->event_info[gpe_number - gpe_block->block_base_number]; |
321 | 321 | ||
322 | gpe_event_info->flags = (u8) (type | ACPI_GPE_DISPATCH_METHOD | | 322 | gpe_event_info->flags = (u8) |
323 | ACPI_GPE_TYPE_RUNTIME); | 323 | (type | ACPI_GPE_DISPATCH_METHOD | ACPI_GPE_TYPE_RUNTIME); |
324 | 324 | ||
325 | gpe_event_info->dispatch.method_node = | 325 | gpe_event_info->dispatch.method_node = |
326 | (struct acpi_namespace_node *)obj_handle; | 326 | (struct acpi_namespace_node *)obj_handle; |
@@ -341,11 +341,11 @@ acpi_ev_save_method_info(acpi_handle obj_handle, | |||
341 | * | 341 | * |
342 | * PARAMETERS: Callback from walk_namespace | 342 | * PARAMETERS: Callback from walk_namespace |
343 | * | 343 | * |
344 | * RETURN: Status. NOTE: We ignore errors so that the _PRW walk is | 344 | * RETURN: Status. NOTE: We ignore errors so that the _PRW walk is |
345 | * not aborted on a single _PRW failure. | 345 | * not aborted on a single _PRW failure. |
346 | * | 346 | * |
347 | * DESCRIPTION: Called from acpi_walk_namespace. Expects each object to be a | 347 | * DESCRIPTION: Called from acpi_walk_namespace. Expects each object to be a |
348 | * Device. Run the _PRW method. If present, extract the GPE | 348 | * Device. Run the _PRW method. If present, extract the GPE |
349 | * number and mark the GPE as a WAKE GPE. | 349 | * number and mark the GPE as a WAKE GPE. |
350 | * | 350 | * |
351 | ******************************************************************************/ | 351 | ******************************************************************************/ |
@@ -443,6 +443,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, | |||
443 | 443 | ||
444 | gpe_event_info->flags &= | 444 | gpe_event_info->flags &= |
445 | ~(ACPI_GPE_WAKE_ENABLED | ACPI_GPE_RUN_ENABLED); | 445 | ~(ACPI_GPE_WAKE_ENABLED | ACPI_GPE_RUN_ENABLED); |
446 | |||
446 | status = | 447 | status = |
447 | acpi_ev_set_gpe_type(gpe_event_info, ACPI_GPE_TYPE_WAKE); | 448 | acpi_ev_set_gpe_type(gpe_event_info, ACPI_GPE_TYPE_WAKE); |
448 | if (ACPI_FAILURE(status)) { | 449 | if (ACPI_FAILURE(status)) { |
@@ -466,7 +467,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, | |||
466 | * | 467 | * |
467 | * RETURN: A GPE interrupt block | 468 | * RETURN: A GPE interrupt block |
468 | * | 469 | * |
469 | * DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt | 470 | * DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt |
470 | * block per unique interrupt level used for GPEs. | 471 | * block per unique interrupt level used for GPEs. |
471 | * Should be called only when the GPE lists are semaphore locked | 472 | * Should be called only when the GPE lists are semaphore locked |
472 | * and not subject to change. | 473 | * and not subject to change. |
@@ -479,7 +480,7 @@ static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 | |||
479 | struct acpi_gpe_xrupt_info *next_gpe_xrupt; | 480 | struct acpi_gpe_xrupt_info *next_gpe_xrupt; |
480 | struct acpi_gpe_xrupt_info *gpe_xrupt; | 481 | struct acpi_gpe_xrupt_info *gpe_xrupt; |
481 | acpi_status status; | 482 | acpi_status status; |
482 | u32 flags; | 483 | acpi_cpu_flags flags; |
483 | 484 | ||
484 | ACPI_FUNCTION_TRACE("ev_get_gpe_xrupt_block"); | 485 | ACPI_FUNCTION_TRACE("ev_get_gpe_xrupt_block"); |
485 | 486 | ||
@@ -526,9 +527,9 @@ static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 | |||
526 | acpi_ev_gpe_xrupt_handler, | 527 | acpi_ev_gpe_xrupt_handler, |
527 | gpe_xrupt); | 528 | gpe_xrupt); |
528 | if (ACPI_FAILURE(status)) { | 529 | if (ACPI_FAILURE(status)) { |
529 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 530 | ACPI_ERROR((AE_INFO, |
530 | "Could not install GPE interrupt handler at level 0x%X\n", | 531 | "Could not install GPE interrupt handler at level 0x%X", |
531 | interrupt_number)); | 532 | interrupt_number)); |
532 | return_PTR(NULL); | 533 | return_PTR(NULL); |
533 | } | 534 | } |
534 | } | 535 | } |
@@ -553,7 +554,7 @@ static acpi_status | |||
553 | acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt) | 554 | acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt) |
554 | { | 555 | { |
555 | acpi_status status; | 556 | acpi_status status; |
556 | u32 flags; | 557 | acpi_cpu_flags flags; |
557 | 558 | ||
558 | ACPI_FUNCTION_TRACE("ev_delete_gpe_xrupt"); | 559 | ACPI_FUNCTION_TRACE("ev_delete_gpe_xrupt"); |
559 | 560 | ||
@@ -566,8 +567,9 @@ acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt) | |||
566 | 567 | ||
567 | /* Disable this interrupt */ | 568 | /* Disable this interrupt */ |
568 | 569 | ||
569 | status = acpi_os_remove_interrupt_handler(gpe_xrupt->interrupt_number, | 570 | status = |
570 | acpi_ev_gpe_xrupt_handler); | 571 | acpi_os_remove_interrupt_handler(gpe_xrupt->interrupt_number, |
572 | acpi_ev_gpe_xrupt_handler); | ||
571 | if (ACPI_FAILURE(status)) { | 573 | if (ACPI_FAILURE(status)) { |
572 | return_ACPI_STATUS(status); | 574 | return_ACPI_STATUS(status); |
573 | } | 575 | } |
@@ -610,7 +612,7 @@ acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block, | |||
610 | struct acpi_gpe_block_info *next_gpe_block; | 612 | struct acpi_gpe_block_info *next_gpe_block; |
611 | struct acpi_gpe_xrupt_info *gpe_xrupt_block; | 613 | struct acpi_gpe_xrupt_info *gpe_xrupt_block; |
612 | acpi_status status; | 614 | acpi_status status; |
613 | u32 flags; | 615 | acpi_cpu_flags flags; |
614 | 616 | ||
615 | ACPI_FUNCTION_TRACE("ev_install_gpe_block"); | 617 | ACPI_FUNCTION_TRACE("ev_install_gpe_block"); |
616 | 618 | ||
@@ -663,7 +665,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) | 665 | acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block) |
664 | { | 666 | { |
665 | acpi_status status; | 667 | acpi_status status; |
666 | u32 flags; | 668 | acpi_cpu_flags flags; |
667 | 669 | ||
668 | ACPI_FUNCTION_TRACE("ev_install_gpe_block"); | 670 | ACPI_FUNCTION_TRACE("ev_install_gpe_block"); |
669 | 671 | ||
@@ -743,22 +745,22 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) | |||
743 | sizeof(struct | 745 | sizeof(struct |
744 | acpi_gpe_register_info)); | 746 | acpi_gpe_register_info)); |
745 | if (!gpe_register_info) { | 747 | if (!gpe_register_info) { |
746 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 748 | ACPI_ERROR((AE_INFO, |
747 | "Could not allocate the gpe_register_info table\n")); | 749 | "Could not allocate the gpe_register_info table")); |
748 | return_ACPI_STATUS(AE_NO_MEMORY); | 750 | return_ACPI_STATUS(AE_NO_MEMORY); |
749 | } | 751 | } |
750 | 752 | ||
751 | /* | 753 | /* |
752 | * Allocate the GPE event_info block. There are eight distinct GPEs | 754 | * Allocate the GPE event_info block. There are eight distinct GPEs |
753 | * per register. Initialization to zeros is sufficient. | 755 | * per register. Initialization to zeros is sufficient. |
754 | */ | 756 | */ |
755 | gpe_event_info = ACPI_MEM_CALLOCATE(((acpi_size) gpe_block-> | 757 | gpe_event_info = ACPI_MEM_CALLOCATE(((acpi_size) gpe_block-> |
756 | register_count * | 758 | register_count * |
757 | ACPI_GPE_REGISTER_WIDTH) * | 759 | ACPI_GPE_REGISTER_WIDTH) * |
758 | sizeof(struct acpi_gpe_event_info)); | 760 | sizeof(struct acpi_gpe_event_info)); |
759 | if (!gpe_event_info) { | 761 | if (!gpe_event_info) { |
760 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 762 | ACPI_ERROR((AE_INFO, |
761 | "Could not allocate the gpe_event_info table\n")); | 763 | "Could not allocate the gpe_event_info table")); |
762 | status = AE_NO_MEMORY; | 764 | status = AE_NO_MEMORY; |
763 | goto error_exit; | 765 | goto error_exit; |
764 | } | 766 | } |
@@ -769,9 +771,9 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) | |||
769 | gpe_block->event_info = gpe_event_info; | 771 | gpe_block->event_info = gpe_event_info; |
770 | 772 | ||
771 | /* | 773 | /* |
772 | * Initialize the GPE Register and Event structures. A goal of these | 774 | * 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 | 775 | * 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, | 776 | * in a given GPE hardware block, the status registers occupy the first half, |
775 | * and the enable registers occupy the second half. | 777 | * and the enable registers occupy the second half. |
776 | */ | 778 | */ |
777 | this_register = gpe_register_info; | 779 | this_register = gpe_register_info; |
@@ -812,11 +814,8 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) | |||
812 | this_event++; | 814 | this_event++; |
813 | } | 815 | } |
814 | 816 | ||
815 | /* | 817 | /* Disable all GPEs within this register */ |
816 | * Clear the status/enable registers. Note that status registers | 818 | |
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, | 819 | status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0x00, |
821 | &this_register-> | 820 | &this_register-> |
822 | enable_address); | 821 | enable_address); |
@@ -824,6 +823,8 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) | |||
824 | goto error_exit; | 823 | goto error_exit; |
825 | } | 824 | } |
826 | 825 | ||
826 | /* Clear any pending GPE events within this register */ | ||
827 | |||
827 | status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0xFF, | 828 | status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0xFF, |
828 | &this_register-> | 829 | &this_register-> |
829 | status_address); | 830 | status_address); |
@@ -860,7 +861,9 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) | |||
860 | * | 861 | * |
861 | * RETURN: Status | 862 | * RETURN: Status |
862 | * | 863 | * |
863 | * DESCRIPTION: Create and Install a block of GPE registers | 864 | * DESCRIPTION: Create and Install a block of GPE registers. All GPEs within |
865 | * the block are disabled at exit. | ||
866 | * Note: Assumes namespace is locked. | ||
864 | * | 867 | * |
865 | ******************************************************************************/ | 868 | ******************************************************************************/ |
866 | 869 | ||
@@ -872,14 +875,8 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
872 | u32 interrupt_number, | 875 | u32 interrupt_number, |
873 | struct acpi_gpe_block_info **return_gpe_block) | 876 | struct acpi_gpe_block_info **return_gpe_block) |
874 | { | 877 | { |
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; | 878 | acpi_status status; |
882 | struct acpi_gpe_walk_info gpe_info; | 879 | struct acpi_gpe_block_info *gpe_block; |
883 | 880 | ||
884 | ACPI_FUNCTION_TRACE("ev_create_gpe_block"); | 881 | ACPI_FUNCTION_TRACE("ev_create_gpe_block"); |
885 | 882 | ||
@@ -896,22 +893,24 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
896 | 893 | ||
897 | /* Initialize the new GPE block */ | 894 | /* Initialize the new GPE block */ |
898 | 895 | ||
896 | gpe_block->node = gpe_device; | ||
899 | gpe_block->register_count = register_count; | 897 | gpe_block->register_count = register_count; |
900 | gpe_block->block_base_number = gpe_block_base_number; | 898 | gpe_block->block_base_number = gpe_block_base_number; |
901 | gpe_block->node = gpe_device; | ||
902 | 899 | ||
903 | ACPI_MEMCPY(&gpe_block->block_address, gpe_block_address, | 900 | ACPI_MEMCPY(&gpe_block->block_address, gpe_block_address, |
904 | sizeof(struct acpi_generic_address)); | 901 | sizeof(struct acpi_generic_address)); |
905 | 902 | ||
906 | /* Create the register_info and event_info sub-structures */ | 903 | /* |
907 | 904 | * Create the register_info and event_info sub-structures | |
905 | * Note: disables and clears all GPEs in the block | ||
906 | */ | ||
908 | status = acpi_ev_create_gpe_info_blocks(gpe_block); | 907 | status = acpi_ev_create_gpe_info_blocks(gpe_block); |
909 | if (ACPI_FAILURE(status)) { | 908 | if (ACPI_FAILURE(status)) { |
910 | ACPI_MEM_FREE(gpe_block); | 909 | ACPI_MEM_FREE(gpe_block); |
911 | return_ACPI_STATUS(status); | 910 | return_ACPI_STATUS(status); |
912 | } | 911 | } |
913 | 912 | ||
914 | /* Install the new block in the global list(s) */ | 913 | /* Install the new block in the global lists */ |
915 | 914 | ||
916 | status = acpi_ev_install_gpe_block(gpe_block, interrupt_number); | 915 | status = acpi_ev_install_gpe_block(gpe_block, interrupt_number); |
917 | if (ACPI_FAILURE(status)) { | 916 | if (ACPI_FAILURE(status)) { |
@@ -926,16 +925,70 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
926 | acpi_ev_save_method_info, gpe_block, | 925 | acpi_ev_save_method_info, gpe_block, |
927 | NULL); | 926 | NULL); |
928 | 927 | ||
928 | /* Return the new block */ | ||
929 | |||
930 | if (return_gpe_block) { | ||
931 | (*return_gpe_block) = gpe_block; | ||
932 | } | ||
933 | |||
934 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, | ||
935 | "GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n", | ||
936 | (u32) gpe_block->block_base_number, | ||
937 | (u32) (gpe_block->block_base_number + | ||
938 | ((gpe_block->register_count * | ||
939 | ACPI_GPE_REGISTER_WIDTH) - 1)), | ||
940 | gpe_device->name.ascii, gpe_block->register_count, | ||
941 | interrupt_number)); | ||
942 | |||
943 | return_ACPI_STATUS(AE_OK); | ||
944 | } | ||
945 | |||
946 | /******************************************************************************* | ||
947 | * | ||
948 | * FUNCTION: acpi_ev_initialize_gpe_block | ||
949 | * | ||
950 | * PARAMETERS: gpe_device - Handle to the parent GPE block | ||
951 | * gpe_block - Gpe Block info | ||
952 | * | ||
953 | * RETURN: Status | ||
954 | * | ||
955 | * DESCRIPTION: Initialize and enable a GPE block. First find and run any | ||
956 | * _PRT methods associated with the block, then enable the | ||
957 | * appropriate GPEs. | ||
958 | * Note: Assumes namespace is locked. | ||
959 | * | ||
960 | ******************************************************************************/ | ||
961 | |||
962 | acpi_status | ||
963 | acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | ||
964 | struct acpi_gpe_block_info *gpe_block) | ||
965 | { | ||
966 | acpi_status status; | ||
967 | struct acpi_gpe_event_info *gpe_event_info; | ||
968 | struct acpi_gpe_walk_info gpe_info; | ||
969 | u32 wake_gpe_count; | ||
970 | u32 gpe_enabled_count; | ||
971 | acpi_native_uint i; | ||
972 | acpi_native_uint j; | ||
973 | |||
974 | ACPI_FUNCTION_TRACE("ev_initialize_gpe_block"); | ||
975 | |||
976 | /* Ignore a null GPE block (e.g., if no GPE block 1 exists) */ | ||
977 | |||
978 | if (!gpe_block) { | ||
979 | return_ACPI_STATUS(AE_OK); | ||
980 | } | ||
981 | |||
929 | /* | 982 | /* |
930 | * Runtime option: Should Wake GPEs be enabled at runtime? The default | 983 | * 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. | 984 | * is no, they should only be enabled just as the machine goes to sleep. |
932 | */ | 985 | */ |
933 | if (acpi_gbl_leave_wake_gpes_disabled) { | 986 | if (acpi_gbl_leave_wake_gpes_disabled) { |
934 | /* | 987 | /* |
935 | * Differentiate RUNTIME vs WAKE GPEs, via the _PRW control methods. | 988 | * Differentiate runtime vs wake GPEs, via the _PRW control methods. |
936 | * (Each GPE that has one or more _PRWs that reference it is by | 989 | * 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 | 990 | * definition a wake GPE and will not be enabled while the machine |
938 | * is running.) | 991 | * is running. |
939 | */ | 992 | */ |
940 | gpe_info.gpe_block = gpe_block; | 993 | gpe_info.gpe_block = gpe_block; |
941 | gpe_info.gpe_device = gpe_device; | 994 | gpe_info.gpe_device = gpe_device; |
@@ -948,9 +1001,12 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
948 | } | 1001 | } |
949 | 1002 | ||
950 | /* | 1003 | /* |
951 | * Enable all GPEs in this block that are 1) "runtime" or "run/wake" GPEs, | 1004 | * Enable all GPEs in this block that have these attributes: |
952 | * and 2) have a corresponding _Lxx or _Exx method. All other GPEs must | 1005 | * 1) are "runtime" or "run/wake" GPEs, and |
953 | * be enabled via the acpi_enable_gpe() external interface. | 1006 | * 2) have a corresponding _Lxx or _Exx method |
1007 | * | ||
1008 | * Any other GPEs within this block must be enabled via the acpi_enable_gpe() | ||
1009 | * external interface. | ||
954 | */ | 1010 | */ |
955 | wake_gpe_count = 0; | 1011 | wake_gpe_count = 0; |
956 | gpe_enabled_count = 0; | 1012 | gpe_enabled_count = 0; |
@@ -976,32 +1032,19 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
976 | } | 1032 | } |
977 | } | 1033 | } |
978 | 1034 | ||
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, | 1035 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, |
995 | "Found %u Wake, Enabled %u Runtime GPEs in this block\n", | 1036 | "Found %u Wake, Enabled %u Runtime GPEs in this block\n", |
996 | wake_gpe_count, gpe_enabled_count)); | 1037 | wake_gpe_count, gpe_enabled_count)); |
997 | 1038 | ||
998 | /* Return the new block */ | 1039 | /* Enable all valid runtime GPEs found above */ |
999 | 1040 | ||
1000 | if (return_gpe_block) { | 1041 | status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block); |
1001 | (*return_gpe_block) = gpe_block; | 1042 | if (ACPI_FAILURE(status)) { |
1043 | ACPI_ERROR((AE_INFO, "Could not enable GPEs in gpe_block %p", | ||
1044 | gpe_block)); | ||
1002 | } | 1045 | } |
1003 | 1046 | ||
1004 | return_ACPI_STATUS(AE_OK); | 1047 | return_ACPI_STATUS(status); |
1005 | } | 1048 | } |
1006 | 1049 | ||
1007 | /******************************************************************************* | 1050 | /******************************************************************************* |
@@ -1072,8 +1115,8 @@ acpi_status acpi_ev_gpe_initialize(void) | |||
1072 | &acpi_gbl_gpe_fadt_blocks[0]); | 1115 | &acpi_gbl_gpe_fadt_blocks[0]); |
1073 | 1116 | ||
1074 | if (ACPI_FAILURE(status)) { | 1117 | if (ACPI_FAILURE(status)) { |
1075 | ACPI_REPORT_ERROR(("Could not create GPE Block 0, %s\n", | 1118 | ACPI_EXCEPTION((AE_INFO, status, |
1076 | acpi_format_exception(status))); | 1119 | "Could not create GPE Block 0")); |
1077 | } | 1120 | } |
1078 | } | 1121 | } |
1079 | 1122 | ||
@@ -1086,7 +1129,12 @@ acpi_status acpi_ev_gpe_initialize(void) | |||
1086 | 1129 | ||
1087 | if ((register_count0) && | 1130 | if ((register_count0) && |
1088 | (gpe_number_max >= acpi_gbl_FADT->gpe1_base)) { | 1131 | (gpe_number_max >= acpi_gbl_FADT->gpe1_base)) { |
1089 | ACPI_REPORT_ERROR(("GPE0 block (GPE 0 to %d) overlaps the GPE1 block (GPE %d to %d) - Ignoring GPE1\n", gpe_number_max, acpi_gbl_FADT->gpe1_base, acpi_gbl_FADT->gpe1_base + ((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1))); | 1132 | ACPI_ERROR((AE_INFO, |
1133 | "GPE0 block (GPE 0 to %d) overlaps the GPE1 block (GPE %d to %d) - Ignoring GPE1", | ||
1134 | gpe_number_max, acpi_gbl_FADT->gpe1_base, | ||
1135 | acpi_gbl_FADT->gpe1_base + | ||
1136 | ((register_count1 * | ||
1137 | ACPI_GPE_REGISTER_WIDTH) - 1))); | ||
1090 | 1138 | ||
1091 | /* Ignore GPE1 block by setting the register count to zero */ | 1139 | /* Ignore GPE1 block by setting the register count to zero */ |
1092 | 1140 | ||
@@ -1104,7 +1152,8 @@ acpi_status acpi_ev_gpe_initialize(void) | |||
1104 | [1]); | 1152 | [1]); |
1105 | 1153 | ||
1106 | if (ACPI_FAILURE(status)) { | 1154 | if (ACPI_FAILURE(status)) { |
1107 | ACPI_REPORT_ERROR(("Could not create GPE Block 1, %s\n", acpi_format_exception(status))); | 1155 | ACPI_EXCEPTION((AE_INFO, status, |
1156 | "Could not create GPE Block 1")); | ||
1108 | } | 1157 | } |
1109 | 1158 | ||
1110 | /* | 1159 | /* |
@@ -1130,7 +1179,9 @@ acpi_status acpi_ev_gpe_initialize(void) | |||
1130 | /* Check for Max GPE number out-of-range */ | 1179 | /* Check for Max GPE number out-of-range */ |
1131 | 1180 | ||
1132 | if (gpe_number_max > ACPI_GPE_MAX) { | 1181 | if (gpe_number_max > ACPI_GPE_MAX) { |
1133 | ACPI_REPORT_ERROR(("Maximum GPE number from FADT is too large: 0x%X\n", gpe_number_max)); | 1182 | ACPI_ERROR((AE_INFO, |
1183 | "Maximum GPE number from FADT is too large: 0x%X", | ||
1184 | gpe_number_max)); | ||
1134 | status = AE_BAD_VALUE; | 1185 | status = AE_BAD_VALUE; |
1135 | goto cleanup; | 1186 | goto cleanup; |
1136 | } | 1187 | } |