diff options
author | Len Brown <len.brown@intel.com> | 2010-08-15 00:25:40 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2010-08-15 00:25:40 -0400 |
commit | c172cb73bc79fe69915b1a1a48e374aa4b1f8a59 (patch) | |
tree | eb3d6415914968441c063f7282e824b14b5a5edb | |
parent | e8eb6228094bcf0c84d9aa32b6363e78da68e1f5 (diff) | |
parent | 28f4f8a9def2b1f3a6066bae791c77043ec49524 (diff) |
Merge branch 'acpica-gpe' into release
54 files changed, 570 insertions, 934 deletions
diff --git a/drivers/acpi/acpica/acevents.h b/drivers/acpi/acpica/acevents.h index c3f43daa8be3..36867cd70eac 100644 --- a/drivers/acpi/acpica/acevents.h +++ b/drivers/acpi/acpica/acevents.h | |||
@@ -78,7 +78,13 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node *node, | |||
78 | u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info *gpe_xrupt_list); | 78 | u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info *gpe_xrupt_list); |
79 | 79 | ||
80 | acpi_status | 80 | acpi_status |
81 | acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info); | 81 | acpi_ev_update_gpe_enable_mask(struct acpi_gpe_event_info *gpe_event_info); |
82 | |||
83 | acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info); | ||
84 | |||
85 | acpi_status acpi_raw_enable_gpe(struct acpi_gpe_event_info *gpe_event_info); | ||
86 | |||
87 | acpi_status acpi_raw_disable_gpe(struct acpi_gpe_event_info *gpe_event_info); | ||
82 | 88 | ||
83 | struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, | 89 | struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, |
84 | u32 gpe_number); | 90 | u32 gpe_number); |
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h index 92122292ef1f..1d192142c691 100644 --- a/drivers/acpi/acpica/acglobal.h +++ b/drivers/acpi/acpica/acglobal.h | |||
@@ -100,13 +100,6 @@ u8 ACPI_INIT_GLOBAL(acpi_gbl_all_methods_serialized, FALSE); | |||
100 | u8 ACPI_INIT_GLOBAL(acpi_gbl_create_osi_method, TRUE); | 100 | u8 ACPI_INIT_GLOBAL(acpi_gbl_create_osi_method, TRUE); |
101 | 101 | ||
102 | /* | 102 | /* |
103 | * Disable wakeup GPEs during runtime? Default is TRUE because WAKE and | ||
104 | * RUNTIME GPEs should never be shared, and WAKE GPEs should typically only | ||
105 | * be enabled just before going to sleep. | ||
106 | */ | ||
107 | u8 ACPI_INIT_GLOBAL(acpi_gbl_leave_wake_gpes_disabled, TRUE); | ||
108 | |||
109 | /* | ||
110 | * Optionally use default values for the ACPI register widths. Set this to | 103 | * Optionally use default values for the ACPI register widths. Set this to |
111 | * TRUE to use the defaults, if an FADT contains incorrect widths/lengths. | 104 | * TRUE to use the defaults, if an FADT contains incorrect widths/lengths. |
112 | */ | 105 | */ |
diff --git a/drivers/acpi/acpica/achware.h b/drivers/acpi/acpica/achware.h index 32391588e163..120b3af56596 100644 --- a/drivers/acpi/acpica/achware.h +++ b/drivers/acpi/acpica/achware.h | |||
@@ -90,16 +90,13 @@ acpi_status acpi_hw_write_port(acpi_io_address address, u32 value, u32 width); | |||
90 | /* | 90 | /* |
91 | * hwgpe - GPE support | 91 | * hwgpe - GPE support |
92 | */ | 92 | */ |
93 | u32 acpi_hw_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info, | 93 | u32 acpi_hw_get_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info, |
94 | struct acpi_gpe_register_info *gpe_register_info); | 94 | struct acpi_gpe_register_info *gpe_register_info); |
95 | 95 | ||
96 | acpi_status | 96 | acpi_status |
97 | acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u8 action); | 97 | acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u8 action); |
98 | 98 | ||
99 | acpi_status | 99 | acpi_status |
100 | acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info *gpe_event_info); | ||
101 | |||
102 | acpi_status | ||
103 | acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | 100 | acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, |
104 | struct acpi_gpe_block_info *gpe_block, void *context); | 101 | struct acpi_gpe_block_info *gpe_block, void *context); |
105 | 102 | ||
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h index 147a7e6bd38f..df85b53a674f 100644 --- a/drivers/acpi/acpica/aclocal.h +++ b/drivers/acpi/acpica/aclocal.h | |||
@@ -184,8 +184,9 @@ struct acpi_namespace_node { | |||
184 | u8 flags; /* Miscellaneous flags */ | 184 | u8 flags; /* Miscellaneous flags */ |
185 | acpi_owner_id owner_id; /* Node creator */ | 185 | acpi_owner_id owner_id; /* Node creator */ |
186 | union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */ | 186 | union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */ |
187 | struct acpi_namespace_node *parent; /* Parent node */ | ||
187 | struct acpi_namespace_node *child; /* First child */ | 188 | struct acpi_namespace_node *child; /* First child */ |
188 | struct acpi_namespace_node *peer; /* Peer. Parent if ANOBJ_END_OF_PEER_LIST set */ | 189 | struct acpi_namespace_node *peer; /* First peer */ |
189 | 190 | ||
190 | /* | 191 | /* |
191 | * The following fields are used by the ASL compiler and disassembler only | 192 | * The following fields are used by the ASL compiler and disassembler only |
@@ -199,7 +200,7 @@ struct acpi_namespace_node { | |||
199 | 200 | ||
200 | /* Namespace Node flags */ | 201 | /* Namespace Node flags */ |
201 | 202 | ||
202 | #define ANOBJ_END_OF_PEER_LIST 0x01 /* End-of-list, Peer field points to parent */ | 203 | #define ANOBJ_RESERVED 0x01 /* Available for use */ |
203 | #define ANOBJ_TEMPORARY 0x02 /* Node is create by a method and is temporary */ | 204 | #define ANOBJ_TEMPORARY 0x02 /* Node is create by a method and is temporary */ |
204 | #define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */ | 205 | #define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */ |
205 | #define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */ | 206 | #define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */ |
@@ -411,6 +412,7 @@ struct acpi_handler_info { | |||
411 | acpi_event_handler address; /* Address of handler, if any */ | 412 | acpi_event_handler address; /* Address of handler, if any */ |
412 | void *context; /* Context to be passed to handler */ | 413 | void *context; /* Context to be passed to handler */ |
413 | struct acpi_namespace_node *method_node; /* Method node for this GPE level (saved) */ | 414 | struct acpi_namespace_node *method_node; /* Method node for this GPE level (saved) */ |
415 | u8 orig_flags; /* Original misc info about this GPE */ | ||
414 | }; | 416 | }; |
415 | 417 | ||
416 | union acpi_gpe_dispatch_info { | 418 | union acpi_gpe_dispatch_info { |
@@ -428,7 +430,6 @@ struct acpi_gpe_event_info { | |||
428 | u8 flags; /* Misc info about this GPE */ | 430 | u8 flags; /* Misc info about this GPE */ |
429 | u8 gpe_number; /* This GPE */ | 431 | u8 gpe_number; /* This GPE */ |
430 | u8 runtime_count; /* References to a run GPE */ | 432 | u8 runtime_count; /* References to a run GPE */ |
431 | u8 wakeup_count; /* References to a wake GPE */ | ||
432 | }; | 433 | }; |
433 | 434 | ||
434 | /* Information about a GPE register pair, one per each status/enable pair in an array */ | 435 | /* Information about a GPE register pair, one per each status/enable pair in an array */ |
diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h index 258159cfcdfa..9f60ff002203 100644 --- a/drivers/acpi/acpica/acnamesp.h +++ b/drivers/acpi/acpica/acnamesp.h | |||
@@ -369,11 +369,4 @@ struct acpi_namespace_node *acpi_ns_validate_handle(acpi_handle handle); | |||
369 | 369 | ||
370 | void acpi_ns_terminate(void); | 370 | void acpi_ns_terminate(void); |
371 | 371 | ||
372 | struct acpi_namespace_node *acpi_ns_get_parent_node(struct acpi_namespace_node | ||
373 | *node); | ||
374 | |||
375 | struct acpi_namespace_node *acpi_ns_get_next_valid_node(struct | ||
376 | acpi_namespace_node | ||
377 | *node); | ||
378 | |||
379 | #endif /* __ACNAMESP_H__ */ | 372 | #endif /* __ACNAMESP_H__ */ |
diff --git a/drivers/acpi/acpica/acobject.h b/drivers/acpi/acpica/acobject.h index cde18ea82656..54857fa87aaf 100644 --- a/drivers/acpi/acpica/acobject.h +++ b/drivers/acpi/acpica/acobject.h | |||
@@ -91,14 +91,14 @@ | |||
91 | 91 | ||
92 | /* Values for Flag byte above */ | 92 | /* Values for Flag byte above */ |
93 | 93 | ||
94 | #define AOPOBJ_AML_CONSTANT 0x01 | 94 | #define AOPOBJ_AML_CONSTANT 0x01 /* Integer is an AML constant */ |
95 | #define AOPOBJ_STATIC_POINTER 0x02 | 95 | #define AOPOBJ_STATIC_POINTER 0x02 /* Data is part of an ACPI table, don't delete */ |
96 | #define AOPOBJ_DATA_VALID 0x04 | 96 | #define AOPOBJ_DATA_VALID 0x04 /* Object is intialized and data is valid */ |
97 | #define AOPOBJ_OBJECT_INITIALIZED 0x08 | 97 | #define AOPOBJ_OBJECT_INITIALIZED 0x08 /* Region is initialized, _REG was run */ |
98 | #define AOPOBJ_SETUP_COMPLETE 0x10 | 98 | #define AOPOBJ_SETUP_COMPLETE 0x10 /* Region setup is complete */ |
99 | #define AOPOBJ_SINGLE_DATUM 0x20 | 99 | #define AOPOBJ_INVALID 0x20 /* Host OS won't allow a Region address */ |
100 | #define AOPOBJ_INVALID 0x40 /* Used if host OS won't allow an op_region address */ | 100 | #define AOPOBJ_MODULE_LEVEL 0x40 /* Method is actually module-level code */ |
101 | #define AOPOBJ_MODULE_LEVEL 0x80 | 101 | #define AOPOBJ_MODIFIED_NAMESPACE 0x80 /* Method modified the namespace */ |
102 | 102 | ||
103 | /****************************************************************************** | 103 | /****************************************************************************** |
104 | * | 104 | * |
diff --git a/drivers/acpi/acpica/acpredef.h b/drivers/acpi/acpica/acpredef.h index 97116082cb6c..10998d369ad0 100644 --- a/drivers/acpi/acpica/acpredef.h +++ b/drivers/acpi/acpica/acpredef.h | |||
@@ -503,15 +503,16 @@ static const union acpi_predefined_info predefined_names[] = | |||
503 | {{"_WAK", 1, ACPI_RTYPE_NONE | ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE}}, | 503 | {{"_WAK", 1, ACPI_RTYPE_NONE | ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE}}, |
504 | {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2,0}, 0,0}}, /* Fixed-length (2 Int), but is optional */ | 504 | {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2,0}, 0,0}}, /* Fixed-length (2 Int), but is optional */ |
505 | 505 | ||
506 | {{{0,0,0,0}, 0,0}} /* Table terminator */ | 506 | /* _WDG/_WED are MS extensions defined by "Windows Instrumentation" */ |
507 | }; | ||
508 | 507 | ||
509 | #if 0 | 508 | {{"_WDG", 0, ACPI_RTYPE_BUFFER}}, |
510 | /* Not implemented */ | 509 | {{"_WED", 1, |
510 | ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER}}, | ||
511 | 511 | ||
512 | {{"_WDG", 0, ACPI_RTYPE_BUFFER}}, /* MS Extension */ | 512 | {{{0, 0, 0, 0}, 0, 0}} /* Table terminator */ |
513 | {{"_WED", 1, ACPI_RTYPE_PACKAGE}}, /* MS Extension */ | 513 | }; |
514 | 514 | ||
515 | #if 0 | ||
515 | /* This is an internally implemented control method, no need to check */ | 516 | /* This is an internally implemented control method, no need to check */ |
516 | {{"_OSI", 1, ACPI_RTYPE_INTEGER}}, | 517 | {{"_OSI", 1, ACPI_RTYPE_INTEGER}}, |
517 | 518 | ||
diff --git a/drivers/acpi/acpica/acstruct.h b/drivers/acpi/acpica/acstruct.h index 161bc0e3d70a..6e5dd97949fe 100644 --- a/drivers/acpi/acpica/acstruct.h +++ b/drivers/acpi/acpica/acstruct.h | |||
@@ -127,22 +127,22 @@ struct acpi_walk_state { | |||
127 | acpi_parse_upwards ascending_callback; | 127 | acpi_parse_upwards ascending_callback; |
128 | }; | 128 | }; |
129 | 129 | ||
130 | /* Info used by acpi_ps_init_objects */ | 130 | /* Info used by acpi_ns_initialize_objects and acpi_ds_initialize_objects */ |
131 | 131 | ||
132 | struct acpi_init_walk_info { | 132 | struct acpi_init_walk_info { |
133 | u16 method_count; | ||
134 | u16 device_count; | ||
135 | u16 op_region_count; | ||
136 | u16 field_count; | ||
137 | u16 buffer_count; | ||
138 | u16 package_count; | ||
139 | u16 op_region_init; | ||
140 | u16 field_init; | ||
141 | u16 buffer_init; | ||
142 | u16 package_init; | ||
143 | u16 object_count; | ||
144 | acpi_owner_id owner_id; | ||
145 | u32 table_index; | 133 | u32 table_index; |
134 | u32 object_count; | ||
135 | u32 method_count; | ||
136 | u32 device_count; | ||
137 | u32 op_region_count; | ||
138 | u32 field_count; | ||
139 | u32 buffer_count; | ||
140 | u32 package_count; | ||
141 | u32 op_region_init; | ||
142 | u32 field_init; | ||
143 | u32 buffer_init; | ||
144 | u32 package_init; | ||
145 | acpi_owner_id owner_id; | ||
146 | }; | 146 | }; |
147 | 147 | ||
148 | struct acpi_get_devices_info { | 148 | struct acpi_get_devices_info { |
@@ -201,11 +201,11 @@ struct acpi_evaluate_info { | |||
201 | /* Info used by acpi_ns_initialize_devices */ | 201 | /* Info used by acpi_ns_initialize_devices */ |
202 | 202 | ||
203 | struct acpi_device_walk_info { | 203 | struct acpi_device_walk_info { |
204 | u16 device_count; | ||
205 | u16 num_STA; | ||
206 | u16 num_INI; | ||
207 | struct acpi_table_desc *table_desc; | 204 | struct acpi_table_desc *table_desc; |
208 | struct acpi_evaluate_info *evaluate_info; | 205 | struct acpi_evaluate_info *evaluate_info; |
206 | u32 device_count; | ||
207 | u32 num_STA; | ||
208 | u32 num_INI; | ||
209 | }; | 209 | }; |
210 | 210 | ||
211 | /* TBD: [Restructure] Merge with struct above */ | 211 | /* TBD: [Restructure] Merge with struct above */ |
diff --git a/drivers/acpi/acpica/dsinit.c b/drivers/acpi/acpica/dsinit.c index abe140318a74..cc4a38c57558 100644 --- a/drivers/acpi/acpica/dsinit.c +++ b/drivers/acpi/acpica/dsinit.c | |||
@@ -171,12 +171,12 @@ acpi_ds_initialize_objects(u32 table_index, | |||
171 | "**** Starting initialization of namespace objects ****\n")); | 171 | "**** Starting initialization of namespace objects ****\n")); |
172 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "Parsing all Control Methods:")); | 172 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "Parsing all Control Methods:")); |
173 | 173 | ||
174 | info.method_count = 0; | 174 | /* Set all init info to zero */ |
175 | info.op_region_count = 0; | 175 | |
176 | info.object_count = 0; | 176 | ACPI_MEMSET(&info, 0, sizeof(struct acpi_init_walk_info)); |
177 | info.device_count = 0; | 177 | |
178 | info.table_index = table_index; | ||
179 | info.owner_id = owner_id; | 178 | info.owner_id = owner_id; |
179 | info.table_index = table_index; | ||
180 | 180 | ||
181 | /* Walk entire namespace from the supplied root */ | 181 | /* Walk entire namespace from the supplied root */ |
182 | 182 | ||
@@ -204,13 +204,13 @@ acpi_ds_initialize_objects(u32 table_index, | |||
204 | } | 204 | } |
205 | 205 | ||
206 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 206 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
207 | "\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n", | 207 | "\nTable [%4.4s](id %4.4X) - %u Objects with %u Devices %u Methods %u Regions\n", |
208 | table->signature, owner_id, info.object_count, | 208 | table->signature, owner_id, info.object_count, |
209 | info.device_count, info.method_count, | 209 | info.device_count, info.method_count, |
210 | info.op_region_count)); | 210 | info.op_region_count)); |
211 | 211 | ||
212 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 212 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
213 | "%hd Methods, %hd Regions\n", info.method_count, | 213 | "%u Methods, %u Regions\n", info.method_count, |
214 | info.op_region_count)); | 214 | info.op_region_count)); |
215 | 215 | ||
216 | return_ACPI_STATUS(AE_OK); | 216 | return_ACPI_STATUS(AE_OK); |
diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c index 2a9a561c2f01..64750ee96e20 100644 --- a/drivers/acpi/acpica/dsmethod.c +++ b/drivers/acpi/acpica/dsmethod.c | |||
@@ -584,8 +584,22 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, | |||
584 | * want make the objects permanent. | 584 | * want make the objects permanent. |
585 | */ | 585 | */ |
586 | if (!(method_desc->method.flags & AOPOBJ_MODULE_LEVEL)) { | 586 | if (!(method_desc->method.flags & AOPOBJ_MODULE_LEVEL)) { |
587 | acpi_ns_delete_namespace_by_owner(method_desc->method. | 587 | |
588 | owner_id); | 588 | /* Delete any direct children of (created by) this method */ |
589 | |||
590 | acpi_ns_delete_namespace_subtree(walk_state-> | ||
591 | method_node); | ||
592 | |||
593 | /* | ||
594 | * Delete any objects that were created by this method | ||
595 | * elsewhere in the namespace (if any were created). | ||
596 | */ | ||
597 | if (method_desc->method. | ||
598 | flags & AOPOBJ_MODIFIED_NAMESPACE) { | ||
599 | acpi_ns_delete_namespace_by_owner(method_desc-> | ||
600 | method. | ||
601 | owner_id); | ||
602 | } | ||
589 | } | 603 | } |
590 | } | 604 | } |
591 | 605 | ||
@@ -605,7 +619,7 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, | |||
605 | * we immediately reuse it for the next thread executing this method | 619 | * we immediately reuse it for the next thread executing this method |
606 | */ | 620 | */ |
607 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 621 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
608 | "*** Completed execution of one thread, %d threads remaining\n", | 622 | "*** Completed execution of one thread, %u threads remaining\n", |
609 | method_desc->method.thread_count)); | 623 | method_desc->method.thread_count)); |
610 | } else { | 624 | } else { |
611 | /* This is the only executing thread for this method */ | 625 | /* This is the only executing thread for this method */ |
diff --git a/drivers/acpi/acpica/dsmthdat.c b/drivers/acpi/acpica/dsmthdat.c index f3d52f59250b..8095306fcd8c 100644 --- a/drivers/acpi/acpica/dsmthdat.c +++ b/drivers/acpi/acpica/dsmthdat.c | |||
@@ -102,8 +102,7 @@ void acpi_ds_method_data_init(struct acpi_walk_state *walk_state) | |||
102 | walk_state->arguments[i].name.integer |= (i << 24); | 102 | walk_state->arguments[i].name.integer |= (i << 24); |
103 | walk_state->arguments[i].descriptor_type = ACPI_DESC_TYPE_NAMED; | 103 | walk_state->arguments[i].descriptor_type = ACPI_DESC_TYPE_NAMED; |
104 | walk_state->arguments[i].type = ACPI_TYPE_ANY; | 104 | walk_state->arguments[i].type = ACPI_TYPE_ANY; |
105 | walk_state->arguments[i].flags = | 105 | walk_state->arguments[i].flags = ANOBJ_METHOD_ARG; |
106 | ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG; | ||
107 | } | 106 | } |
108 | 107 | ||
109 | /* Init the method locals */ | 108 | /* Init the method locals */ |
@@ -116,8 +115,7 @@ void acpi_ds_method_data_init(struct acpi_walk_state *walk_state) | |||
116 | walk_state->local_variables[i].descriptor_type = | 115 | walk_state->local_variables[i].descriptor_type = |
117 | ACPI_DESC_TYPE_NAMED; | 116 | ACPI_DESC_TYPE_NAMED; |
118 | walk_state->local_variables[i].type = ACPI_TYPE_ANY; | 117 | walk_state->local_variables[i].type = ACPI_TYPE_ANY; |
119 | walk_state->local_variables[i].flags = | 118 | walk_state->local_variables[i].flags = ANOBJ_METHOD_LOCAL; |
120 | ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL; | ||
121 | } | 119 | } |
122 | 120 | ||
123 | return_VOID; | 121 | return_VOID; |
@@ -146,7 +144,7 @@ void acpi_ds_method_data_delete_all(struct acpi_walk_state *walk_state) | |||
146 | 144 | ||
147 | for (index = 0; index < ACPI_METHOD_NUM_LOCALS; index++) { | 145 | for (index = 0; index < ACPI_METHOD_NUM_LOCALS; index++) { |
148 | if (walk_state->local_variables[index].object) { | 146 | if (walk_state->local_variables[index].object) { |
149 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Deleting Local%d=%p\n", | 147 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Deleting Local%u=%p\n", |
150 | index, | 148 | index, |
151 | walk_state->local_variables[index]. | 149 | walk_state->local_variables[index]. |
152 | object)); | 150 | object)); |
@@ -162,7 +160,7 @@ void acpi_ds_method_data_delete_all(struct acpi_walk_state *walk_state) | |||
162 | 160 | ||
163 | for (index = 0; index < ACPI_METHOD_NUM_ARGS; index++) { | 161 | for (index = 0; index < ACPI_METHOD_NUM_ARGS; index++) { |
164 | if (walk_state->arguments[index].object) { | 162 | if (walk_state->arguments[index].object) { |
165 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Deleting Arg%d=%p\n", | 163 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Deleting Arg%u=%p\n", |
166 | index, | 164 | index, |
167 | walk_state->arguments[index].object)); | 165 | walk_state->arguments[index].object)); |
168 | 166 | ||
@@ -226,7 +224,7 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params, | |||
226 | index++; | 224 | index++; |
227 | } | 225 | } |
228 | 226 | ||
229 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%d args passed to method\n", index)); | 227 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%u args passed to method\n", index)); |
230 | return_ACPI_STATUS(AE_OK); | 228 | return_ACPI_STATUS(AE_OK); |
231 | } | 229 | } |
232 | 230 | ||
@@ -323,7 +321,7 @@ acpi_ds_method_data_set_value(u8 type, | |||
323 | ACPI_FUNCTION_TRACE(ds_method_data_set_value); | 321 | ACPI_FUNCTION_TRACE(ds_method_data_set_value); |
324 | 322 | ||
325 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 323 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
326 | "NewObj %p Type %2.2X, Refs=%d [%s]\n", object, | 324 | "NewObj %p Type %2.2X, Refs=%u [%s]\n", object, |
327 | type, object->common.reference_count, | 325 | type, object->common.reference_count, |
328 | acpi_ut_get_type_name(object->common.type))); | 326 | acpi_ut_get_type_name(object->common.type))); |
329 | 327 | ||
@@ -543,7 +541,7 @@ acpi_ds_store_object_to_local(u8 type, | |||
543 | union acpi_operand_object *new_obj_desc; | 541 | union acpi_operand_object *new_obj_desc; |
544 | 542 | ||
545 | ACPI_FUNCTION_TRACE(ds_store_object_to_local); | 543 | ACPI_FUNCTION_TRACE(ds_store_object_to_local); |
546 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Type=%2.2X Index=%d Obj=%p\n", | 544 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Type=%2.2X Index=%u Obj=%p\n", |
547 | type, index, obj_desc)); | 545 | type, index, obj_desc)); |
548 | 546 | ||
549 | /* Parameter validation */ | 547 | /* Parameter validation */ |
diff --git a/drivers/acpi/acpica/dsobject.c b/drivers/acpi/acpica/dsobject.c index 3607adcaf085..8e85f54a8e0e 100644 --- a/drivers/acpi/acpica/dsobject.c +++ b/drivers/acpi/acpica/dsobject.c | |||
@@ -81,6 +81,7 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, | |||
81 | { | 81 | { |
82 | union acpi_operand_object *obj_desc; | 82 | union acpi_operand_object *obj_desc; |
83 | acpi_status status; | 83 | acpi_status status; |
84 | acpi_object_type type; | ||
84 | 85 | ||
85 | ACPI_FUNCTION_TRACE(ds_build_internal_object); | 86 | ACPI_FUNCTION_TRACE(ds_build_internal_object); |
86 | 87 | ||
@@ -172,7 +173,20 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, | |||
172 | return_ACPI_STATUS(status); | 173 | return_ACPI_STATUS(status); |
173 | } | 174 | } |
174 | 175 | ||
175 | switch (op->common.node->type) { | 176 | /* |
177 | * Special handling for Alias objects. We need to setup the type | ||
178 | * and the Op->Common.Node to point to the Alias target. Note, | ||
179 | * Alias has at most one level of indirection internally. | ||
180 | */ | ||
181 | type = op->common.node->type; | ||
182 | if (type == ACPI_TYPE_LOCAL_ALIAS) { | ||
183 | type = obj_desc->common.type; | ||
184 | op->common.node = | ||
185 | ACPI_CAST_PTR(struct acpi_namespace_node, | ||
186 | op->common.node->object); | ||
187 | } | ||
188 | |||
189 | switch (type) { | ||
176 | /* | 190 | /* |
177 | * For these types, we need the actual node, not the subobject. | 191 | * For these types, we need the actual node, not the subobject. |
178 | * However, the subobject did not get an extra reference count above. | 192 | * However, the subobject did not get an extra reference count above. |
diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c index 53a7e416f33e..7c0e74227171 100644 --- a/drivers/acpi/acpica/dsopcode.c +++ b/drivers/acpi/acpica/dsopcode.c | |||
@@ -213,7 +213,7 @@ acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc) | |||
213 | 213 | ||
214 | /* Execute the AML code for the term_arg arguments */ | 214 | /* Execute the AML code for the term_arg arguments */ |
215 | 215 | ||
216 | status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node), | 216 | status = acpi_ds_execute_arguments(node, node->parent, |
217 | extra_desc->extra.aml_length, | 217 | extra_desc->extra.aml_length, |
218 | extra_desc->extra.aml_start); | 218 | extra_desc->extra.aml_start); |
219 | return_ACPI_STATUS(status); | 219 | return_ACPI_STATUS(status); |
@@ -257,7 +257,7 @@ acpi_ds_get_bank_field_arguments(union acpi_operand_object *obj_desc) | |||
257 | 257 | ||
258 | /* Execute the AML code for the term_arg arguments */ | 258 | /* Execute the AML code for the term_arg arguments */ |
259 | 259 | ||
260 | status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node), | 260 | status = acpi_ds_execute_arguments(node, node->parent, |
261 | extra_desc->extra.aml_length, | 261 | extra_desc->extra.aml_length, |
262 | extra_desc->extra.aml_start); | 262 | extra_desc->extra.aml_start); |
263 | return_ACPI_STATUS(status); | 263 | return_ACPI_STATUS(status); |
@@ -394,7 +394,7 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc) | |||
394 | 394 | ||
395 | /* Execute the argument AML */ | 395 | /* Execute the argument AML */ |
396 | 396 | ||
397 | status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node), | 397 | status = acpi_ds_execute_arguments(node, node->parent, |
398 | extra_desc->extra.aml_length, | 398 | extra_desc->extra.aml_length, |
399 | extra_desc->extra.aml_start); | 399 | extra_desc->extra.aml_start); |
400 | if (ACPI_FAILURE(status)) { | 400 | if (ACPI_FAILURE(status)) { |
diff --git a/drivers/acpi/acpica/dsutils.c b/drivers/acpi/acpica/dsutils.c index 306c62ab2e88..15135c25aa9b 100644 --- a/drivers/acpi/acpica/dsutils.c +++ b/drivers/acpi/acpica/dsutils.c | |||
@@ -746,7 +746,7 @@ acpi_ds_create_operands(struct acpi_walk_state *walk_state, | |||
746 | index--; | 746 | index--; |
747 | 747 | ||
748 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 748 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
749 | "Arg #%d (%p) done, Arg1=%p\n", index, arg, | 749 | "Arg #%u (%p) done, Arg1=%p\n", index, arg, |
750 | first_arg)); | 750 | first_arg)); |
751 | } | 751 | } |
752 | 752 | ||
@@ -760,7 +760,7 @@ acpi_ds_create_operands(struct acpi_walk_state *walk_state, | |||
760 | */ | 760 | */ |
761 | acpi_ds_obj_stack_pop_and_delete(arg_count, walk_state); | 761 | acpi_ds_obj_stack_pop_and_delete(arg_count, walk_state); |
762 | 762 | ||
763 | ACPI_EXCEPTION((AE_INFO, status, "While creating Arg %d", index)); | 763 | ACPI_EXCEPTION((AE_INFO, status, "While creating Arg %u", index)); |
764 | return_ACPI_STATUS(status); | 764 | return_ACPI_STATUS(status); |
765 | } | 765 | } |
766 | 766 | ||
diff --git a/drivers/acpi/acpica/evevent.c b/drivers/acpi/acpica/evevent.c index f5795915a2e9..303618889da0 100644 --- a/drivers/acpi/acpica/evevent.c +++ b/drivers/acpi/acpica/evevent.c | |||
@@ -102,9 +102,8 @@ acpi_status acpi_ev_initialize_events(void) | |||
102 | * RETURN: Status | 102 | * RETURN: Status |
103 | * | 103 | * |
104 | * DESCRIPTION: Completes initialization of the FADT-defined GPE blocks | 104 | * DESCRIPTION: Completes initialization of the FADT-defined GPE blocks |
105 | * (0 and 1). This causes the _PRW methods to be run, so the HW | 105 | * (0 and 1). The HW must be fully initialized at this point, |
106 | * must be fully initialized at this point, including global lock | 106 | * including global lock support. |
107 | * support. | ||
108 | * | 107 | * |
109 | ******************************************************************************/ | 108 | ******************************************************************************/ |
110 | 109 | ||
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c index 7c2c336006a1..f226eac314db 100644 --- a/drivers/acpi/acpica/evgpe.c +++ b/drivers/acpi/acpica/evgpe.c | |||
@@ -54,51 +54,159 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context); | |||
54 | 54 | ||
55 | /******************************************************************************* | 55 | /******************************************************************************* |
56 | * | 56 | * |
57 | * FUNCTION: acpi_ev_update_gpe_enable_masks | 57 | * FUNCTION: acpi_ev_update_gpe_enable_mask |
58 | * | 58 | * |
59 | * PARAMETERS: gpe_event_info - GPE to update | 59 | * PARAMETERS: gpe_event_info - GPE to update |
60 | * | 60 | * |
61 | * RETURN: Status | 61 | * RETURN: Status |
62 | * | 62 | * |
63 | * DESCRIPTION: Updates GPE register enable masks based upon whether there are | 63 | * DESCRIPTION: Updates GPE register enable mask based upon whether there are |
64 | * references (either wake or run) to this GPE | 64 | * runtime references to this GPE |
65 | * | 65 | * |
66 | ******************************************************************************/ | 66 | ******************************************************************************/ |
67 | 67 | ||
68 | acpi_status | 68 | acpi_status |
69 | acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info) | 69 | acpi_ev_update_gpe_enable_mask(struct acpi_gpe_event_info *gpe_event_info) |
70 | { | 70 | { |
71 | struct acpi_gpe_register_info *gpe_register_info; | 71 | struct acpi_gpe_register_info *gpe_register_info; |
72 | u32 register_bit; | 72 | u32 register_bit; |
73 | 73 | ||
74 | ACPI_FUNCTION_TRACE(ev_update_gpe_enable_masks); | 74 | ACPI_FUNCTION_TRACE(ev_update_gpe_enable_mask); |
75 | 75 | ||
76 | gpe_register_info = gpe_event_info->register_info; | 76 | gpe_register_info = gpe_event_info->register_info; |
77 | if (!gpe_register_info) { | 77 | if (!gpe_register_info) { |
78 | return_ACPI_STATUS(AE_NOT_EXIST); | 78 | return_ACPI_STATUS(AE_NOT_EXIST); |
79 | } | 79 | } |
80 | 80 | ||
81 | register_bit = acpi_hw_gpe_register_bit(gpe_event_info, | 81 | register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info, |
82 | gpe_register_info); | 82 | gpe_register_info); |
83 | 83 | ||
84 | /* Clear the wake/run bits up front */ | 84 | /* Clear the run bit up front */ |
85 | 85 | ||
86 | ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake, register_bit); | ||
87 | ACPI_CLEAR_BIT(gpe_register_info->enable_for_run, register_bit); | 86 | ACPI_CLEAR_BIT(gpe_register_info->enable_for_run, register_bit); |
88 | 87 | ||
89 | /* Set the mask bits only if there are references to this GPE */ | 88 | /* Set the mask bit only if there are references to this GPE */ |
90 | 89 | ||
91 | if (gpe_event_info->runtime_count) { | 90 | if (gpe_event_info->runtime_count) { |
92 | ACPI_SET_BIT(gpe_register_info->enable_for_run, register_bit); | 91 | ACPI_SET_BIT(gpe_register_info->enable_for_run, (u8)register_bit); |
93 | } | 92 | } |
94 | 93 | ||
95 | if (gpe_event_info->wakeup_count) { | 94 | return_ACPI_STATUS(AE_OK); |
96 | ACPI_SET_BIT(gpe_register_info->enable_for_wake, register_bit); | 95 | } |
96 | |||
97 | /******************************************************************************* | ||
98 | * | ||
99 | * FUNCTION: acpi_ev_enable_gpe | ||
100 | * | ||
101 | * PARAMETERS: gpe_event_info - GPE to enable | ||
102 | * | ||
103 | * RETURN: Status | ||
104 | * | ||
105 | * DESCRIPTION: Clear the given GPE from stale events and enable it. | ||
106 | * | ||
107 | ******************************************************************************/ | ||
108 | acpi_status | ||
109 | acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info) | ||
110 | { | ||
111 | acpi_status status; | ||
112 | |||
113 | ACPI_FUNCTION_TRACE(ev_enable_gpe); | ||
114 | |||
115 | /* | ||
116 | * We will only allow a GPE to be enabled if it has either an | ||
117 | * associated method (_Lxx/_Exx) or a handler. Otherwise, the | ||
118 | * GPE will be immediately disabled by acpi_ev_gpe_dispatch the | ||
119 | * first time it fires. | ||
120 | */ | ||
121 | if (!(gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK)) { | ||
122 | return_ACPI_STATUS(AE_NO_HANDLER); | ||
97 | } | 123 | } |
98 | 124 | ||
99 | return_ACPI_STATUS(AE_OK); | 125 | /* Clear the GPE (of stale events) */ |
126 | status = acpi_hw_clear_gpe(gpe_event_info); | ||
127 | if (ACPI_FAILURE(status)) { | ||
128 | return_ACPI_STATUS(status); | ||
129 | } | ||
130 | |||
131 | /* Enable the requested GPE */ | ||
132 | status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_ENABLE); | ||
133 | |||
134 | return_ACPI_STATUS(status); | ||
135 | } | ||
136 | |||
137 | |||
138 | /******************************************************************************* | ||
139 | * | ||
140 | * FUNCTION: acpi_raw_enable_gpe | ||
141 | * | ||
142 | * PARAMETERS: gpe_event_info - GPE to enable | ||
143 | * | ||
144 | * RETURN: Status | ||
145 | * | ||
146 | * DESCRIPTION: Add a reference to a GPE. On the first reference, the GPE is | ||
147 | * hardware-enabled. | ||
148 | * | ||
149 | ******************************************************************************/ | ||
150 | |||
151 | acpi_status acpi_raw_enable_gpe(struct acpi_gpe_event_info *gpe_event_info) | ||
152 | { | ||
153 | acpi_status status = AE_OK; | ||
154 | |||
155 | if (gpe_event_info->runtime_count == ACPI_UINT8_MAX) { | ||
156 | return_ACPI_STATUS(AE_LIMIT); | ||
157 | } | ||
158 | |||
159 | gpe_event_info->runtime_count++; | ||
160 | if (gpe_event_info->runtime_count == 1) { | ||
161 | status = acpi_ev_update_gpe_enable_mask(gpe_event_info); | ||
162 | if (ACPI_SUCCESS(status)) { | ||
163 | status = acpi_ev_enable_gpe(gpe_event_info); | ||
164 | } | ||
165 | |||
166 | if (ACPI_FAILURE(status)) { | ||
167 | gpe_event_info->runtime_count--; | ||
168 | } | ||
169 | } | ||
170 | |||
171 | return_ACPI_STATUS(status); | ||
100 | } | 172 | } |
101 | 173 | ||
174 | /******************************************************************************* | ||
175 | * | ||
176 | * FUNCTION: acpi_raw_disable_gpe | ||
177 | * | ||
178 | * PARAMETERS: gpe_event_info - GPE to disable | ||
179 | * | ||
180 | * RETURN: Status | ||
181 | * | ||
182 | * DESCRIPTION: Remove a reference to a GPE. When the last reference is | ||
183 | * removed, the GPE is hardware-disabled. | ||
184 | * | ||
185 | ******************************************************************************/ | ||
186 | |||
187 | acpi_status acpi_raw_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) | ||
188 | { | ||
189 | acpi_status status = AE_OK; | ||
190 | |||
191 | if (!gpe_event_info->runtime_count) { | ||
192 | return_ACPI_STATUS(AE_LIMIT); | ||
193 | } | ||
194 | |||
195 | gpe_event_info->runtime_count--; | ||
196 | if (!gpe_event_info->runtime_count) { | ||
197 | status = acpi_ev_update_gpe_enable_mask(gpe_event_info); | ||
198 | if (ACPI_SUCCESS(status)) { | ||
199 | status = acpi_hw_low_set_gpe(gpe_event_info, | ||
200 | ACPI_GPE_DISABLE); | ||
201 | } | ||
202 | |||
203 | if (ACPI_FAILURE(status)) { | ||
204 | gpe_event_info->runtime_count++; | ||
205 | } | ||
206 | } | ||
207 | |||
208 | return_ACPI_STATUS(status); | ||
209 | } | ||
102 | 210 | ||
103 | /******************************************************************************* | 211 | /******************************************************************************* |
104 | * | 212 | * |
@@ -417,8 +525,12 @@ static void acpi_ev_asynch_enable_gpe(void *context) | |||
417 | } | 525 | } |
418 | } | 526 | } |
419 | 527 | ||
420 | /* Enable this GPE */ | 528 | /* |
421 | (void)acpi_hw_write_gpe_enable_reg(gpe_event_info); | 529 | * Enable this GPE, conditionally. This means that the GPE will only be |
530 | * physically enabled if the enable_for_run bit is set in the event_info | ||
531 | */ | ||
532 | (void)acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_COND_ENABLE); | ||
533 | |||
422 | return_VOID; | 534 | return_VOID; |
423 | } | 535 | } |
424 | 536 | ||
diff --git a/drivers/acpi/acpica/evgpeblk.c b/drivers/acpi/acpica/evgpeblk.c index 341a38ce8aa6..85445fb5844e 100644 --- a/drivers/acpi/acpica/evgpeblk.c +++ b/drivers/acpi/acpica/evgpeblk.c | |||
@@ -439,8 +439,6 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | |||
439 | { | 439 | { |
440 | acpi_status status; | 440 | acpi_status status; |
441 | struct acpi_gpe_event_info *gpe_event_info; | 441 | struct acpi_gpe_event_info *gpe_event_info; |
442 | struct acpi_gpe_walk_info walk_info; | ||
443 | u32 wake_gpe_count; | ||
444 | u32 gpe_enabled_count; | 442 | u32 gpe_enabled_count; |
445 | u32 gpe_index; | 443 | u32 gpe_index; |
446 | u32 gpe_number; | 444 | u32 gpe_number; |
@@ -456,37 +454,9 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | |||
456 | } | 454 | } |
457 | 455 | ||
458 | /* | 456 | /* |
459 | * Runtime option: Should wake GPEs be enabled at runtime? The default | 457 | * Enable all GPEs that have a corresponding method. Any other GPEs |
460 | * is no, they should only be enabled just as the machine goes to sleep. | 458 | * within this block must be enabled via the acpi_enable_gpe interface. |
461 | */ | 459 | */ |
462 | if (acpi_gbl_leave_wake_gpes_disabled) { | ||
463 | /* | ||
464 | * Differentiate runtime vs wake GPEs, via the _PRW control methods. | ||
465 | * Each GPE that has one or more _PRWs that reference it is by | ||
466 | * definition a wake GPE and will not be enabled while the machine | ||
467 | * is running. | ||
468 | */ | ||
469 | walk_info.gpe_block = gpe_block; | ||
470 | walk_info.gpe_device = gpe_device; | ||
471 | walk_info.execute_by_owner_id = FALSE; | ||
472 | |||
473 | status = | ||
474 | acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, | ||
475 | ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, | ||
476 | acpi_ev_match_prw_and_gpe, NULL, | ||
477 | &walk_info, NULL); | ||
478 | if (ACPI_FAILURE(status)) { | ||
479 | ACPI_EXCEPTION((AE_INFO, status, | ||
480 | "While executing _PRW methods")); | ||
481 | } | ||
482 | } | ||
483 | |||
484 | /* | ||
485 | * Enable all GPEs that have a corresponding method and are not | ||
486 | * capable of generating wakeups. Any other GPEs within this block | ||
487 | * must be enabled via the acpi_enable_gpe interface. | ||
488 | */ | ||
489 | wake_gpe_count = 0; | ||
490 | gpe_enabled_count = 0; | 460 | gpe_enabled_count = 0; |
491 | 461 | ||
492 | if (gpe_device == acpi_gbl_fadt_gpe_device) { | 462 | if (gpe_device == acpi_gbl_fadt_gpe_device) { |
@@ -502,35 +472,21 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | |||
502 | gpe_event_info = &gpe_block->event_info[gpe_index]; | 472 | gpe_event_info = &gpe_block->event_info[gpe_index]; |
503 | gpe_number = gpe_index + gpe_block->block_base_number; | 473 | gpe_number = gpe_index + gpe_block->block_base_number; |
504 | 474 | ||
505 | /* | ||
506 | * If the GPE has already been enabled for runtime | ||
507 | * signaling, make sure it remains enabled, but do not | ||
508 | * increment its reference counter. | ||
509 | */ | ||
510 | if (gpe_event_info->runtime_count) { | ||
511 | acpi_set_gpe(gpe_device, gpe_number, | ||
512 | ACPI_GPE_ENABLE); | ||
513 | gpe_enabled_count++; | ||
514 | continue; | ||
515 | } | ||
516 | |||
517 | if (gpe_event_info->flags & ACPI_GPE_CAN_WAKE) { | ||
518 | wake_gpe_count++; | ||
519 | if (acpi_gbl_leave_wake_gpes_disabled) { | ||
520 | continue; | ||
521 | } | ||
522 | } | ||
523 | |||
524 | /* Ignore GPEs that have no corresponding _Lxx/_Exx method */ | 475 | /* Ignore GPEs that have no corresponding _Lxx/_Exx method */ |
525 | 476 | ||
526 | if (!(gpe_event_info->flags & ACPI_GPE_DISPATCH_METHOD)) { | 477 | if (!(gpe_event_info->flags & ACPI_GPE_DISPATCH_METHOD)) { |
527 | continue; | 478 | continue; |
528 | } | 479 | } |
529 | 480 | ||
530 | /* Enable this GPE */ | 481 | /* |
482 | * If the GPE has already been enabled for runtime | ||
483 | * signaling, make sure it remains enabled, but do not | ||
484 | * increment its reference counter. | ||
485 | */ | ||
486 | status = gpe_event_info->runtime_count ? | ||
487 | acpi_ev_enable_gpe(gpe_event_info) : | ||
488 | acpi_enable_gpe(gpe_device, gpe_number); | ||
531 | 489 | ||
532 | status = acpi_enable_gpe(gpe_device, gpe_number, | ||
533 | ACPI_GPE_TYPE_RUNTIME); | ||
534 | if (ACPI_FAILURE(status)) { | 490 | if (ACPI_FAILURE(status)) { |
535 | ACPI_EXCEPTION((AE_INFO, status, | 491 | ACPI_EXCEPTION((AE_INFO, status, |
536 | "Could not enable GPE 0x%02X", | 492 | "Could not enable GPE 0x%02X", |
@@ -542,10 +498,10 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | |||
542 | } | 498 | } |
543 | } | 499 | } |
544 | 500 | ||
545 | if (gpe_enabled_count || wake_gpe_count) { | 501 | if (gpe_enabled_count) { |
546 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, | 502 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, |
547 | "Enabled %u Runtime GPEs, added %u Wake GPEs in this block\n", | 503 | "Enabled %u GPEs in this block\n", |
548 | gpe_enabled_count, wake_gpe_count)); | 504 | gpe_enabled_count)); |
549 | } | 505 | } |
550 | 506 | ||
551 | return_ACPI_STATUS(AE_OK); | 507 | return_ACPI_STATUS(AE_OK); |
diff --git a/drivers/acpi/acpica/evgpeinit.c b/drivers/acpi/acpica/evgpeinit.c index 3f6c2d26410d..3084c5de1bba 100644 --- a/drivers/acpi/acpica/evgpeinit.c +++ b/drivers/acpi/acpica/evgpeinit.c | |||
@@ -211,9 +211,7 @@ acpi_status acpi_ev_gpe_initialize(void) | |||
211 | * DESCRIPTION: Check for new GPE methods (_Lxx/_Exx) made available as a | 211 | * DESCRIPTION: Check for new GPE methods (_Lxx/_Exx) made available as a |
212 | * result of a Load() or load_table() operation. If new GPE | 212 | * result of a Load() or load_table() operation. If new GPE |
213 | * methods have been installed, register the new methods and | 213 | * methods have been installed, register the new methods and |
214 | * enable and runtime GPEs that are associated with them. Also, | 214 | * enable and runtime GPEs that are associated with them. |
215 | * run any newly loaded _PRW methods in order to discover any | ||
216 | * new CAN_WAKE GPEs. | ||
217 | * | 215 | * |
218 | ******************************************************************************/ | 216 | ******************************************************************************/ |
219 | 217 | ||
@@ -223,49 +221,12 @@ void acpi_ev_update_gpes(acpi_owner_id table_owner_id) | |||
223 | struct acpi_gpe_block_info *gpe_block; | 221 | struct acpi_gpe_block_info *gpe_block; |
224 | struct acpi_gpe_walk_info walk_info; | 222 | struct acpi_gpe_walk_info walk_info; |
225 | acpi_status status = AE_OK; | 223 | acpi_status status = AE_OK; |
226 | u32 new_wake_gpe_count = 0; | ||
227 | |||
228 | /* We will examine only _PRW/_Lxx/_Exx methods owned by this table */ | ||
229 | |||
230 | walk_info.owner_id = table_owner_id; | ||
231 | walk_info.execute_by_owner_id = TRUE; | ||
232 | walk_info.count = 0; | ||
233 | |||
234 | if (acpi_gbl_leave_wake_gpes_disabled) { | ||
235 | /* | ||
236 | * 1) Run any newly-loaded _PRW methods to find any GPEs that | ||
237 | * can now be marked as CAN_WAKE GPEs. Note: We must run the | ||
238 | * _PRW methods before we process the _Lxx/_Exx methods because | ||
239 | * we will enable all runtime GPEs associated with the new | ||
240 | * _Lxx/_Exx methods at the time we process those methods. | ||
241 | * | ||
242 | * Unlock interpreter so that we can run the _PRW methods. | ||
243 | */ | ||
244 | walk_info.gpe_block = NULL; | ||
245 | walk_info.gpe_device = NULL; | ||
246 | |||
247 | acpi_ex_exit_interpreter(); | ||
248 | |||
249 | status = | ||
250 | acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, | ||
251 | ACPI_UINT32_MAX, | ||
252 | ACPI_NS_WALK_NO_UNLOCK, | ||
253 | acpi_ev_match_prw_and_gpe, NULL, | ||
254 | &walk_info, NULL); | ||
255 | if (ACPI_FAILURE(status)) { | ||
256 | ACPI_EXCEPTION((AE_INFO, status, | ||
257 | "While executing _PRW methods")); | ||
258 | } | ||
259 | |||
260 | acpi_ex_enter_interpreter(); | ||
261 | new_wake_gpe_count = walk_info.count; | ||
262 | } | ||
263 | 224 | ||
264 | /* | 225 | /* |
265 | * 2) Find any _Lxx/_Exx GPE methods that have just been loaded. | 226 | * 2) Find any _Lxx/_Exx GPE methods that have just been loaded. |
266 | * | 227 | * |
267 | * Any GPEs that correspond to new _Lxx/_Exx methods and are not | 228 | * Any GPEs that correspond to new _Lxx/_Exx methods are immediately |
268 | * marked as CAN_WAKE are immediately enabled. | 229 | * enabled. |
269 | * | 230 | * |
270 | * Examine the namespace underneath each gpe_device within the | 231 | * Examine the namespace underneath each gpe_device within the |
271 | * gpe_block lists. | 232 | * gpe_block lists. |
@@ -275,6 +236,8 @@ void acpi_ev_update_gpes(acpi_owner_id table_owner_id) | |||
275 | return; | 236 | return; |
276 | } | 237 | } |
277 | 238 | ||
239 | walk_info.owner_id = table_owner_id; | ||
240 | walk_info.execute_by_owner_id = TRUE; | ||
278 | walk_info.count = 0; | 241 | walk_info.count = 0; |
279 | walk_info.enable_this_gpe = TRUE; | 242 | walk_info.enable_this_gpe = TRUE; |
280 | 243 | ||
@@ -307,10 +270,8 @@ void acpi_ev_update_gpes(acpi_owner_id table_owner_id) | |||
307 | gpe_xrupt_info = gpe_xrupt_info->next; | 270 | gpe_xrupt_info = gpe_xrupt_info->next; |
308 | } | 271 | } |
309 | 272 | ||
310 | if (walk_info.count || new_wake_gpe_count) { | 273 | if (walk_info.count) { |
311 | ACPI_INFO((AE_INFO, | 274 | ACPI_INFO((AE_INFO, "Enabled %u new GPEs", walk_info.count)); |
312 | "Enabled %u new runtime GPEs, added %u new wakeup GPEs", | ||
313 | walk_info.count, new_wake_gpe_count)); | ||
314 | } | 275 | } |
315 | 276 | ||
316 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); | 277 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
@@ -386,9 +347,6 @@ acpi_ev_match_gpe_method(acpi_handle obj_handle, | |||
386 | /* | 347 | /* |
387 | * 3) Edge/Level determination is based on the 2nd character | 348 | * 3) Edge/Level determination is based on the 2nd character |
388 | * of the method name | 349 | * of the method name |
389 | * | ||
390 | * NOTE: Default GPE type is RUNTIME only. Later, if a _PRW object is | ||
391 | * found that points to this GPE, the ACPI_GPE_CAN_WAKE flag is set. | ||
392 | */ | 350 | */ |
393 | switch (name[1]) { | 351 | switch (name[1]) { |
394 | case 'L': | 352 | case 'L': |
@@ -471,24 +429,18 @@ acpi_ev_match_gpe_method(acpi_handle obj_handle, | |||
471 | */ | 429 | */ |
472 | if (walk_info->enable_this_gpe) { | 430 | if (walk_info->enable_this_gpe) { |
473 | 431 | ||
474 | /* Ignore GPEs that can wake the system */ | 432 | walk_info->count++; |
433 | gpe_device = walk_info->gpe_device; | ||
475 | 434 | ||
476 | if (!(gpe_event_info->flags & ACPI_GPE_CAN_WAKE) || | 435 | if (gpe_device == acpi_gbl_fadt_gpe_device) { |
477 | !acpi_gbl_leave_wake_gpes_disabled) { | 436 | gpe_device = NULL; |
478 | walk_info->count++; | 437 | } |
479 | gpe_device = walk_info->gpe_device; | ||
480 | |||
481 | if (gpe_device == acpi_gbl_fadt_gpe_device) { | ||
482 | gpe_device = NULL; | ||
483 | } | ||
484 | 438 | ||
485 | status = acpi_enable_gpe(gpe_device, gpe_number, | 439 | status = acpi_enable_gpe(gpe_device, gpe_number); |
486 | ACPI_GPE_TYPE_RUNTIME); | 440 | if (ACPI_FAILURE(status)) { |
487 | if (ACPI_FAILURE(status)) { | 441 | ACPI_EXCEPTION((AE_INFO, status, |
488 | ACPI_EXCEPTION((AE_INFO, status, | 442 | "Could not enable GPE 0x%02X", |
489 | "Could not enable GPE 0x%02X", | 443 | gpe_number)); |
490 | gpe_number)); | ||
491 | } | ||
492 | } | 444 | } |
493 | } | 445 | } |
494 | 446 | ||
@@ -497,157 +449,3 @@ acpi_ev_match_gpe_method(acpi_handle obj_handle, | |||
497 | name, gpe_number)); | 449 | name, gpe_number)); |
498 | return_ACPI_STATUS(AE_OK); | 450 | return_ACPI_STATUS(AE_OK); |
499 | } | 451 | } |
500 | |||
501 | /******************************************************************************* | ||
502 | * | ||
503 | * FUNCTION: acpi_ev_match_prw_and_gpe | ||
504 | * | ||
505 | * PARAMETERS: Callback from walk_namespace | ||
506 | * | ||
507 | * RETURN: Status. NOTE: We ignore errors so that the _PRW walk is | ||
508 | * not aborted on a single _PRW failure. | ||
509 | * | ||
510 | * DESCRIPTION: Called from acpi_walk_namespace. Expects each object to be a | ||
511 | * Device. Run the _PRW method. If present, extract the GPE | ||
512 | * number and mark the GPE as a CAN_WAKE GPE. Allows a | ||
513 | * per-owner_id execution if execute_by_owner_id is TRUE in the | ||
514 | * walk_info parameter block. | ||
515 | * | ||
516 | * If walk_info->execute_by_owner_id is TRUE, we only execute _PRWs with that | ||
517 | * owner. | ||
518 | * If walk_info->gpe_device is NULL, we execute every _PRW found. Otherwise, | ||
519 | * we only execute _PRWs that refer to the input gpe_device. | ||
520 | * | ||
521 | ******************************************************************************/ | ||
522 | |||
523 | acpi_status | ||
524 | acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, | ||
525 | u32 level, void *context, void **return_value) | ||
526 | { | ||
527 | struct acpi_gpe_walk_info *walk_info = | ||
528 | ACPI_CAST_PTR(struct acpi_gpe_walk_info, context); | ||
529 | struct acpi_namespace_node *gpe_device; | ||
530 | struct acpi_gpe_block_info *gpe_block; | ||
531 | struct acpi_namespace_node *target_gpe_device; | ||
532 | struct acpi_namespace_node *prw_node; | ||
533 | struct acpi_gpe_event_info *gpe_event_info; | ||
534 | union acpi_operand_object *pkg_desc; | ||
535 | union acpi_operand_object *obj_desc; | ||
536 | u32 gpe_number; | ||
537 | acpi_status status; | ||
538 | |||
539 | ACPI_FUNCTION_TRACE(ev_match_prw_and_gpe); | ||
540 | |||
541 | /* Check for a _PRW method under this device */ | ||
542 | |||
543 | status = acpi_ns_get_node(obj_handle, METHOD_NAME__PRW, | ||
544 | ACPI_NS_NO_UPSEARCH, &prw_node); | ||
545 | if (ACPI_FAILURE(status)) { | ||
546 | return_ACPI_STATUS(AE_OK); | ||
547 | } | ||
548 | |||
549 | /* Check if requested owner_id matches this owner_id */ | ||
550 | |||
551 | if ((walk_info->execute_by_owner_id) && | ||
552 | (prw_node->owner_id != walk_info->owner_id)) { | ||
553 | return_ACPI_STATUS(AE_OK); | ||
554 | } | ||
555 | |||
556 | /* Execute the _PRW */ | ||
557 | |||
558 | status = acpi_ut_evaluate_object(prw_node, NULL, | ||
559 | ACPI_BTYPE_PACKAGE, &pkg_desc); | ||
560 | if (ACPI_FAILURE(status)) { | ||
561 | return_ACPI_STATUS(AE_OK); | ||
562 | } | ||
563 | |||
564 | /* The returned _PRW package must have at least two elements */ | ||
565 | |||
566 | if (pkg_desc->package.count < 2) { | ||
567 | goto cleanup; | ||
568 | } | ||
569 | |||
570 | /* Extract pointers from the input context */ | ||
571 | |||
572 | gpe_device = walk_info->gpe_device; | ||
573 | gpe_block = walk_info->gpe_block; | ||
574 | |||
575 | /* | ||
576 | * The _PRW object must return a package, we are only interested | ||
577 | * in the first element | ||
578 | */ | ||
579 | obj_desc = pkg_desc->package.elements[0]; | ||
580 | |||
581 | if (obj_desc->common.type == ACPI_TYPE_INTEGER) { | ||
582 | |||
583 | /* Use FADT-defined GPE device (from definition of _PRW) */ | ||
584 | |||
585 | target_gpe_device = NULL; | ||
586 | if (gpe_device) { | ||
587 | target_gpe_device = acpi_gbl_fadt_gpe_device; | ||
588 | } | ||
589 | |||
590 | /* Integer is the GPE number in the FADT described GPE blocks */ | ||
591 | |||
592 | gpe_number = (u32)obj_desc->integer.value; | ||
593 | } else if (obj_desc->common.type == ACPI_TYPE_PACKAGE) { | ||
594 | |||
595 | /* Package contains a GPE reference and GPE number within a GPE block */ | ||
596 | |||
597 | if ((obj_desc->package.count < 2) || | ||
598 | ((obj_desc->package.elements[0])->common.type != | ||
599 | ACPI_TYPE_LOCAL_REFERENCE) || | ||
600 | ((obj_desc->package.elements[1])->common.type != | ||
601 | ACPI_TYPE_INTEGER)) { | ||
602 | goto cleanup; | ||
603 | } | ||
604 | |||
605 | /* Get GPE block reference and decode */ | ||
606 | |||
607 | target_gpe_device = | ||
608 | obj_desc->package.elements[0]->reference.node; | ||
609 | gpe_number = (u32)obj_desc->package.elements[1]->integer.value; | ||
610 | } else { | ||
611 | /* Unknown type, just ignore it */ | ||
612 | |||
613 | goto cleanup; | ||
614 | } | ||
615 | |||
616 | /* Get the gpe_event_info for this GPE */ | ||
617 | |||
618 | if (gpe_device) { | ||
619 | /* | ||
620 | * Is this GPE within this block? | ||
621 | * | ||
622 | * TRUE if and only if these conditions are true: | ||
623 | * 1) The GPE devices match. | ||
624 | * 2) The GPE index(number) is within the range of the Gpe Block | ||
625 | * associated with the GPE device. | ||
626 | */ | ||
627 | if (gpe_device != target_gpe_device) { | ||
628 | goto cleanup; | ||
629 | } | ||
630 | |||
631 | gpe_event_info = | ||
632 | acpi_ev_low_get_gpe_info(gpe_number, gpe_block); | ||
633 | } else { | ||
634 | /* gpe_device is NULL, just match the target_device and gpe_number */ | ||
635 | |||
636 | gpe_event_info = | ||
637 | acpi_ev_get_gpe_event_info(target_gpe_device, gpe_number); | ||
638 | } | ||
639 | |||
640 | if (gpe_event_info) { | ||
641 | if (!(gpe_event_info->flags & ACPI_GPE_CAN_WAKE)) { | ||
642 | |||
643 | /* This GPE can wake the system */ | ||
644 | |||
645 | gpe_event_info->flags |= ACPI_GPE_CAN_WAKE; | ||
646 | walk_info->count++; | ||
647 | } | ||
648 | } | ||
649 | |||
650 | cleanup: | ||
651 | acpi_ut_remove_reference(pkg_desc); | ||
652 | return_ACPI_STATUS(AE_OK); | ||
653 | } | ||
diff --git a/drivers/acpi/acpica/evrgnini.c b/drivers/acpi/acpica/evrgnini.c index 2e3b0334072f..f40d271bf568 100644 --- a/drivers/acpi/acpica/evrgnini.c +++ b/drivers/acpi/acpica/evrgnini.c | |||
@@ -199,7 +199,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
199 | return_ACPI_STATUS(status); | 199 | return_ACPI_STATUS(status); |
200 | } | 200 | } |
201 | 201 | ||
202 | parent_node = acpi_ns_get_parent_node(region_obj->region.node); | 202 | parent_node = region_obj->region.node->parent; |
203 | 203 | ||
204 | /* | 204 | /* |
205 | * Get the _SEG and _BBN values from the device upon which the handler | 205 | * Get the _SEG and _BBN values from the device upon which the handler |
@@ -248,7 +248,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
248 | break; | 248 | break; |
249 | } | 249 | } |
250 | 250 | ||
251 | pci_root_node = acpi_ns_get_parent_node(pci_root_node); | 251 | pci_root_node = pci_root_node->parent; |
252 | } | 252 | } |
253 | 253 | ||
254 | /* PCI root bridge not found, use namespace root node */ | 254 | /* PCI root bridge not found, use namespace root node */ |
@@ -280,7 +280,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
280 | */ | 280 | */ |
281 | pci_device_node = region_obj->region.node; | 281 | pci_device_node = region_obj->region.node; |
282 | while (pci_device_node && (pci_device_node->type != ACPI_TYPE_DEVICE)) { | 282 | while (pci_device_node && (pci_device_node->type != ACPI_TYPE_DEVICE)) { |
283 | pci_device_node = acpi_ns_get_parent_node(pci_device_node); | 283 | pci_device_node = pci_device_node->parent; |
284 | } | 284 | } |
285 | 285 | ||
286 | if (!pci_device_node) { | 286 | if (!pci_device_node) { |
@@ -521,7 +521,7 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, | |||
521 | return_ACPI_STATUS(AE_NOT_EXIST); | 521 | return_ACPI_STATUS(AE_NOT_EXIST); |
522 | } | 522 | } |
523 | 523 | ||
524 | node = acpi_ns_get_parent_node(region_obj->region.node); | 524 | node = region_obj->region.node->parent; |
525 | space_id = region_obj->region.space_id; | 525 | space_id = region_obj->region.space_id; |
526 | 526 | ||
527 | /* Setup defaults */ | 527 | /* Setup defaults */ |
@@ -654,7 +654,7 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, | |||
654 | 654 | ||
655 | /* This node does not have the handler we need; Pop up one level */ | 655 | /* This node does not have the handler we need; Pop up one level */ |
656 | 656 | ||
657 | node = acpi_ns_get_parent_node(node); | 657 | node = node->parent; |
658 | } | 658 | } |
659 | 659 | ||
660 | /* If we get here, there is no handler for this region */ | 660 | /* If we get here, there is no handler for this region */ |
diff --git a/drivers/acpi/acpica/evxface.c b/drivers/acpi/acpica/evxface.c index 4a531cdf7942..14e48add32fa 100644 --- a/drivers/acpi/acpica/evxface.c +++ b/drivers/acpi/acpica/evxface.c | |||
@@ -691,12 +691,22 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
691 | return_ACPI_STATUS(status); | 691 | return_ACPI_STATUS(status); |
692 | } | 692 | } |
693 | 693 | ||
694 | /* Allocate memory for the handler object */ | ||
695 | |||
696 | handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_handler_info)); | ||
697 | if (!handler) { | ||
698 | status = AE_NO_MEMORY; | ||
699 | goto unlock_and_exit; | ||
700 | } | ||
701 | |||
702 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | ||
703 | |||
694 | /* Ensure that we have a valid GPE number */ | 704 | /* Ensure that we have a valid GPE number */ |
695 | 705 | ||
696 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); | 706 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); |
697 | if (!gpe_event_info) { | 707 | if (!gpe_event_info) { |
698 | status = AE_BAD_PARAMETER; | 708 | status = AE_BAD_PARAMETER; |
699 | goto unlock_and_exit; | 709 | goto free_and_exit; |
700 | } | 710 | } |
701 | 711 | ||
702 | /* Make sure that there isn't a handler there already */ | 712 | /* Make sure that there isn't a handler there already */ |
@@ -704,24 +714,30 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
704 | if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == | 714 | if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == |
705 | ACPI_GPE_DISPATCH_HANDLER) { | 715 | ACPI_GPE_DISPATCH_HANDLER) { |
706 | status = AE_ALREADY_EXISTS; | 716 | status = AE_ALREADY_EXISTS; |
707 | goto unlock_and_exit; | 717 | goto free_and_exit; |
708 | } | 718 | } |
709 | 719 | ||
710 | /* Allocate and init handler object */ | 720 | /* Allocate and init handler object */ |
711 | 721 | ||
712 | handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_handler_info)); | ||
713 | if (!handler) { | ||
714 | status = AE_NO_MEMORY; | ||
715 | goto unlock_and_exit; | ||
716 | } | ||
717 | |||
718 | handler->address = address; | 722 | handler->address = address; |
719 | handler->context = context; | 723 | handler->context = context; |
720 | handler->method_node = gpe_event_info->dispatch.method_node; | 724 | handler->method_node = gpe_event_info->dispatch.method_node; |
725 | handler->orig_flags = gpe_event_info->flags & | ||
726 | (ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); | ||
727 | |||
728 | /* | ||
729 | * If the GPE is associated with a method and it cannot wake up the | ||
730 | * system from sleep states, it was enabled automatically during | ||
731 | * initialization, so it has to be disabled now to avoid spurious | ||
732 | * execution of the handler. | ||
733 | */ | ||
734 | |||
735 | if ((handler->orig_flags & ACPI_GPE_DISPATCH_METHOD) | ||
736 | && !(gpe_event_info->flags & ACPI_GPE_CAN_WAKE)) | ||
737 | (void)acpi_raw_disable_gpe(gpe_event_info); | ||
721 | 738 | ||
722 | /* Install the handler */ | 739 | /* Install the handler */ |
723 | 740 | ||
724 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | ||
725 | gpe_event_info->dispatch.handler = handler; | 741 | gpe_event_info->dispatch.handler = handler; |
726 | 742 | ||
727 | /* Setup up dispatch flags to indicate handler (vs. method) */ | 743 | /* Setup up dispatch flags to indicate handler (vs. method) */ |
@@ -735,6 +751,11 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
735 | unlock_and_exit: | 751 | unlock_and_exit: |
736 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); | 752 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
737 | return_ACPI_STATUS(status); | 753 | return_ACPI_STATUS(status); |
754 | |||
755 | free_and_exit: | ||
756 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | ||
757 | ACPI_FREE(handler); | ||
758 | goto unlock_and_exit; | ||
738 | } | 759 | } |
739 | 760 | ||
740 | ACPI_EXPORT_SYMBOL(acpi_install_gpe_handler) | 761 | ACPI_EXPORT_SYMBOL(acpi_install_gpe_handler) |
@@ -770,11 +791,17 @@ acpi_remove_gpe_handler(acpi_handle gpe_device, | |||
770 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 791 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
771 | } | 792 | } |
772 | 793 | ||
794 | /* Make sure all deferred tasks are completed */ | ||
795 | |||
796 | acpi_os_wait_events_complete(NULL); | ||
797 | |||
773 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); | 798 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); |
774 | if (ACPI_FAILURE(status)) { | 799 | if (ACPI_FAILURE(status)) { |
775 | return_ACPI_STATUS(status); | 800 | return_ACPI_STATUS(status); |
776 | } | 801 | } |
777 | 802 | ||
803 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | ||
804 | |||
778 | /* Ensure that we have a valid GPE number */ | 805 | /* Ensure that we have a valid GPE number */ |
779 | 806 | ||
780 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); | 807 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); |
@@ -798,34 +825,34 @@ acpi_remove_gpe_handler(acpi_handle gpe_device, | |||
798 | goto unlock_and_exit; | 825 | goto unlock_and_exit; |
799 | } | 826 | } |
800 | 827 | ||
801 | /* Make sure all deferred tasks are completed */ | ||
802 | |||
803 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); | ||
804 | acpi_os_wait_events_complete(NULL); | ||
805 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); | ||
806 | if (ACPI_FAILURE(status)) { | ||
807 | return_ACPI_STATUS(status); | ||
808 | } | ||
809 | |||
810 | /* Remove the handler */ | 828 | /* Remove the handler */ |
811 | 829 | ||
812 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | ||
813 | handler = gpe_event_info->dispatch.handler; | 830 | handler = gpe_event_info->dispatch.handler; |
814 | 831 | ||
815 | /* Restore Method node (if any), set dispatch flags */ | 832 | /* Restore Method node (if any), set dispatch flags */ |
816 | 833 | ||
817 | gpe_event_info->dispatch.method_node = handler->method_node; | 834 | gpe_event_info->dispatch.method_node = handler->method_node; |
818 | gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK; /* Clear bits */ | 835 | gpe_event_info->flags &= |
819 | if (handler->method_node) { | 836 | ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); |
820 | gpe_event_info->flags |= ACPI_GPE_DISPATCH_METHOD; | 837 | gpe_event_info->flags |= handler->orig_flags; |
821 | } | 838 | |
822 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | 839 | /* |
840 | * If the GPE was previously associated with a method and it cannot wake | ||
841 | * up the system from sleep states, it should be enabled at this point | ||
842 | * to restore the post-initialization configuration. | ||
843 | */ | ||
844 | |||
845 | if ((handler->orig_flags & ACPI_GPE_DISPATCH_METHOD) | ||
846 | && !(gpe_event_info->flags & ACPI_GPE_CAN_WAKE)) | ||
847 | (void)acpi_raw_enable_gpe(gpe_event_info); | ||
823 | 848 | ||
824 | /* Now we can free the handler object */ | 849 | /* Now we can free the handler object */ |
825 | 850 | ||
826 | ACPI_FREE(handler); | 851 | ACPI_FREE(handler); |
827 | 852 | ||
828 | unlock_and_exit: | 853 | unlock_and_exit: |
854 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | ||
855 | |||
829 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); | 856 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
830 | return_ACPI_STATUS(status); | 857 | return_ACPI_STATUS(status); |
831 | } | 858 | } |
diff --git a/drivers/acpi/acpica/evxfevnt.c b/drivers/acpi/acpica/evxfevnt.c index 18b3f1468b7d..304825528d48 100644 --- a/drivers/acpi/acpica/evxfevnt.c +++ b/drivers/acpi/acpica/evxfevnt.c | |||
@@ -213,101 +213,71 @@ ACPI_EXPORT_SYMBOL(acpi_enable_event) | |||
213 | 213 | ||
214 | /******************************************************************************* | 214 | /******************************************************************************* |
215 | * | 215 | * |
216 | * FUNCTION: acpi_clear_and_enable_gpe | 216 | * FUNCTION: acpi_gpe_wakeup |
217 | * | ||
218 | * PARAMETERS: gpe_event_info - GPE to enable | ||
219 | * | ||
220 | * RETURN: Status | ||
221 | * | ||
222 | * DESCRIPTION: Clear the given GPE from stale events and enable it. | ||
223 | * | ||
224 | ******************************************************************************/ | ||
225 | static acpi_status | ||
226 | acpi_clear_and_enable_gpe(struct acpi_gpe_event_info *gpe_event_info) | ||
227 | { | ||
228 | acpi_status status; | ||
229 | |||
230 | /* | ||
231 | * We will only allow a GPE to be enabled if it has either an | ||
232 | * associated method (_Lxx/_Exx) or a handler. Otherwise, the | ||
233 | * GPE will be immediately disabled by acpi_ev_gpe_dispatch the | ||
234 | * first time it fires. | ||
235 | */ | ||
236 | if (!(gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK)) { | ||
237 | return_ACPI_STATUS(AE_NO_HANDLER); | ||
238 | } | ||
239 | |||
240 | /* Clear the GPE (of stale events) */ | ||
241 | status = acpi_hw_clear_gpe(gpe_event_info); | ||
242 | if (ACPI_FAILURE(status)) { | ||
243 | return_ACPI_STATUS(status); | ||
244 | } | ||
245 | |||
246 | /* Enable the requested GPE */ | ||
247 | status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_ENABLE); | ||
248 | |||
249 | return_ACPI_STATUS(status); | ||
250 | } | ||
251 | |||
252 | /******************************************************************************* | ||
253 | * | ||
254 | * FUNCTION: acpi_set_gpe | ||
255 | * | 217 | * |
256 | * PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1 | 218 | * PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1 |
257 | * gpe_number - GPE level within the GPE block | 219 | * gpe_number - GPE level within the GPE block |
258 | * action - ACPI_GPE_ENABLE or ACPI_GPE_DISABLE | 220 | * Action - Enable or Disable |
259 | * | 221 | * |
260 | * RETURN: Status | 222 | * RETURN: Status |
261 | * | 223 | * |
262 | * DESCRIPTION: Enable or disable an individual GPE. This function bypasses | 224 | * DESCRIPTION: Set or clear the GPE's wakeup enable mask bit. |
263 | * the reference count mechanism used in the acpi_enable_gpe and | ||
264 | * acpi_disable_gpe interfaces -- and should be used with care. | ||
265 | * | ||
266 | * Note: Typically used to disable a runtime GPE for short period of time, | ||
267 | * then re-enable it, without disturbing the existing reference counts. This | ||
268 | * is useful, for example, in the Embedded Controller (EC) driver. | ||
269 | * | 225 | * |
270 | ******************************************************************************/ | 226 | ******************************************************************************/ |
271 | acpi_status acpi_set_gpe(acpi_handle gpe_device, u32 gpe_number, u8 action) | 227 | acpi_status acpi_gpe_wakeup(acpi_handle gpe_device, u32 gpe_number, u8 action) |
272 | { | 228 | { |
229 | acpi_status status = AE_OK; | ||
273 | struct acpi_gpe_event_info *gpe_event_info; | 230 | struct acpi_gpe_event_info *gpe_event_info; |
274 | acpi_status status; | 231 | struct acpi_gpe_register_info *gpe_register_info; |
275 | acpi_cpu_flags flags; | 232 | acpi_cpu_flags flags; |
233 | u32 register_bit; | ||
276 | 234 | ||
277 | ACPI_FUNCTION_TRACE(acpi_set_gpe); | 235 | ACPI_FUNCTION_TRACE(acpi_gpe_wakeup); |
278 | 236 | ||
279 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | 237 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
280 | 238 | ||
281 | /* Ensure that we have a valid GPE number */ | 239 | /* Ensure that we have a valid GPE number */ |
282 | 240 | ||
283 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); | 241 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); |
284 | if (!gpe_event_info) { | 242 | if (!gpe_event_info || !(gpe_event_info->flags & ACPI_GPE_CAN_WAKE)) { |
285 | status = AE_BAD_PARAMETER; | 243 | status = AE_BAD_PARAMETER; |
286 | goto unlock_and_exit; | 244 | goto unlock_and_exit; |
287 | } | 245 | } |
288 | 246 | ||
247 | gpe_register_info = gpe_event_info->register_info; | ||
248 | if (!gpe_register_info) { | ||
249 | status = AE_NOT_EXIST; | ||
250 | goto unlock_and_exit; | ||
251 | } | ||
252 | |||
253 | register_bit = | ||
254 | acpi_hw_get_gpe_register_bit(gpe_event_info, gpe_register_info); | ||
255 | |||
289 | /* Perform the action */ | 256 | /* Perform the action */ |
290 | 257 | ||
291 | switch (action) { | 258 | switch (action) { |
292 | case ACPI_GPE_ENABLE: | 259 | case ACPI_GPE_ENABLE: |
293 | status = acpi_clear_and_enable_gpe(gpe_event_info); | 260 | ACPI_SET_BIT(gpe_register_info->enable_for_wake, |
261 | (u8)register_bit); | ||
294 | break; | 262 | break; |
295 | 263 | ||
296 | case ACPI_GPE_DISABLE: | 264 | case ACPI_GPE_DISABLE: |
297 | status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_DISABLE); | 265 | ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake, |
266 | (u8)register_bit); | ||
298 | break; | 267 | break; |
299 | 268 | ||
300 | default: | 269 | default: |
270 | ACPI_ERROR((AE_INFO, "%u, Invalid action", action)); | ||
301 | status = AE_BAD_PARAMETER; | 271 | status = AE_BAD_PARAMETER; |
302 | break; | 272 | break; |
303 | } | 273 | } |
304 | 274 | ||
305 | unlock_and_exit: | 275 | unlock_and_exit: |
306 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | 276 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
307 | return_ACPI_STATUS(status); | 277 | return_ACPI_STATUS(status); |
308 | } | 278 | } |
309 | 279 | ||
310 | ACPI_EXPORT_SYMBOL(acpi_set_gpe) | 280 | ACPI_EXPORT_SYMBOL(acpi_gpe_wakeup) |
311 | 281 | ||
312 | /******************************************************************************* | 282 | /******************************************************************************* |
313 | * | 283 | * |
@@ -315,84 +285,30 @@ ACPI_EXPORT_SYMBOL(acpi_set_gpe) | |||
315 | * | 285 | * |
316 | * PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1 | 286 | * PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1 |
317 | * gpe_number - GPE level within the GPE block | 287 | * gpe_number - GPE level within the GPE block |
318 | * gpe_type - ACPI_GPE_TYPE_RUNTIME or ACPI_GPE_TYPE_WAKE | ||
319 | * or both | ||
320 | * | 288 | * |
321 | * RETURN: Status | 289 | * RETURN: Status |
322 | * | 290 | * |
323 | * DESCRIPTION: Add a reference to a GPE. On the first reference, the GPE is | 291 | * DESCRIPTION: Add a reference to a GPE. On the first reference, the GPE is |
324 | * hardware-enabled (for runtime GPEs), or the GPE register mask | 292 | * hardware-enabled. |
325 | * is updated (for wake GPEs). | ||
326 | * | 293 | * |
327 | ******************************************************************************/ | 294 | ******************************************************************************/ |
328 | acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type) | 295 | acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number) |
329 | { | 296 | { |
330 | acpi_status status = AE_OK; | 297 | acpi_status status = AE_BAD_PARAMETER; |
331 | struct acpi_gpe_event_info *gpe_event_info; | 298 | struct acpi_gpe_event_info *gpe_event_info; |
332 | acpi_cpu_flags flags; | 299 | acpi_cpu_flags flags; |
333 | 300 | ||
334 | ACPI_FUNCTION_TRACE(acpi_enable_gpe); | 301 | ACPI_FUNCTION_TRACE(acpi_enable_gpe); |
335 | 302 | ||
336 | /* Parameter validation */ | ||
337 | |||
338 | if (!gpe_type || (gpe_type & ~ACPI_GPE_TYPE_WAKE_RUN)) { | ||
339 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
340 | } | ||
341 | |||
342 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | 303 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
343 | 304 | ||
344 | /* Ensure that we have a valid GPE number */ | 305 | /* Ensure that we have a valid GPE number */ |
345 | 306 | ||
346 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); | 307 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); |
347 | if (!gpe_event_info) { | 308 | if (gpe_event_info) { |
348 | status = AE_BAD_PARAMETER; | 309 | status = acpi_raw_enable_gpe(gpe_event_info); |
349 | goto unlock_and_exit; | ||
350 | } | ||
351 | |||
352 | if (gpe_type & ACPI_GPE_TYPE_RUNTIME) { | ||
353 | if (gpe_event_info->runtime_count == ACPI_UINT8_MAX) { | ||
354 | status = AE_LIMIT; /* Too many references */ | ||
355 | goto unlock_and_exit; | ||
356 | } | ||
357 | |||
358 | gpe_event_info->runtime_count++; | ||
359 | if (gpe_event_info->runtime_count == 1) { | ||
360 | status = acpi_ev_update_gpe_enable_masks(gpe_event_info); | ||
361 | if (ACPI_SUCCESS(status)) { | ||
362 | status = acpi_clear_and_enable_gpe(gpe_event_info); | ||
363 | } | ||
364 | |||
365 | if (ACPI_FAILURE(status)) { | ||
366 | gpe_event_info->runtime_count--; | ||
367 | goto unlock_and_exit; | ||
368 | } | ||
369 | } | ||
370 | } | ||
371 | |||
372 | if (gpe_type & ACPI_GPE_TYPE_WAKE) { | ||
373 | /* The GPE must have the ability to wake the system */ | ||
374 | |||
375 | if (!(gpe_event_info->flags & ACPI_GPE_CAN_WAKE)) { | ||
376 | status = AE_TYPE; | ||
377 | goto unlock_and_exit; | ||
378 | } | ||
379 | |||
380 | if (gpe_event_info->wakeup_count == ACPI_UINT8_MAX) { | ||
381 | status = AE_LIMIT; /* Too many references */ | ||
382 | goto unlock_and_exit; | ||
383 | } | ||
384 | |||
385 | /* | ||
386 | * Update the enable mask on the first wakeup reference. Wake GPEs | ||
387 | * are only hardware-enabled just before sleeping. | ||
388 | */ | ||
389 | gpe_event_info->wakeup_count++; | ||
390 | if (gpe_event_info->wakeup_count == 1) { | ||
391 | status = acpi_ev_update_gpe_enable_masks(gpe_event_info); | ||
392 | } | ||
393 | } | 310 | } |
394 | 311 | ||
395 | unlock_and_exit: | ||
396 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | 312 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
397 | return_ACPI_STATUS(status); | 313 | return_ACPI_STATUS(status); |
398 | } | 314 | } |
@@ -404,8 +320,6 @@ ACPI_EXPORT_SYMBOL(acpi_enable_gpe) | |||
404 | * | 320 | * |
405 | * PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1 | 321 | * PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1 |
406 | * gpe_number - GPE level within the GPE block | 322 | * gpe_number - GPE level within the GPE block |
407 | * gpe_type - ACPI_GPE_TYPE_RUNTIME or ACPI_GPE_TYPE_WAKE | ||
408 | * or both | ||
409 | * | 323 | * |
410 | * RETURN: Status | 324 | * RETURN: Status |
411 | * | 325 | * |
@@ -414,20 +328,52 @@ ACPI_EXPORT_SYMBOL(acpi_enable_gpe) | |||
414 | * the GPE mask bit disabled (for wake GPEs) | 328 | * the GPE mask bit disabled (for wake GPEs) |
415 | * | 329 | * |
416 | ******************************************************************************/ | 330 | ******************************************************************************/ |
417 | acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type) | 331 | acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number) |
418 | { | 332 | { |
419 | acpi_status status = AE_OK; | 333 | acpi_status status = AE_BAD_PARAMETER; |
420 | struct acpi_gpe_event_info *gpe_event_info; | 334 | struct acpi_gpe_event_info *gpe_event_info; |
421 | acpi_cpu_flags flags; | 335 | acpi_cpu_flags flags; |
422 | 336 | ||
423 | ACPI_FUNCTION_TRACE(acpi_disable_gpe); | 337 | ACPI_FUNCTION_TRACE(acpi_disable_gpe); |
424 | 338 | ||
425 | /* Parameter validation */ | 339 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
340 | |||
341 | /* Ensure that we have a valid GPE number */ | ||
426 | 342 | ||
427 | if (!gpe_type || (gpe_type & ~ACPI_GPE_TYPE_WAKE_RUN)) { | 343 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); |
428 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 344 | if (gpe_event_info) { |
345 | status = acpi_raw_disable_gpe(gpe_event_info) ; | ||
429 | } | 346 | } |
430 | 347 | ||
348 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | ||
349 | return_ACPI_STATUS(status); | ||
350 | } | ||
351 | ACPI_EXPORT_SYMBOL(acpi_disable_gpe) | ||
352 | |||
353 | /******************************************************************************* | ||
354 | * | ||
355 | * FUNCTION: acpi_gpe_can_wake | ||
356 | * | ||
357 | * PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1 | ||
358 | * gpe_number - GPE level within the GPE block | ||
359 | * | ||
360 | * RETURN: Status | ||
361 | * | ||
362 | * DESCRIPTION: Set the ACPI_GPE_CAN_WAKE flag for the given GPE. If the GPE | ||
363 | * has a corresponding method and is currently enabled, disable it | ||
364 | * (GPEs with corresponding methods are enabled unconditionally | ||
365 | * during initialization, but GPEs that can wake up are expected | ||
366 | * to be initially disabled). | ||
367 | * | ||
368 | ******************************************************************************/ | ||
369 | acpi_status acpi_gpe_can_wake(acpi_handle gpe_device, u32 gpe_number) | ||
370 | { | ||
371 | acpi_status status = AE_OK; | ||
372 | struct acpi_gpe_event_info *gpe_event_info; | ||
373 | acpi_cpu_flags flags; | ||
374 | |||
375 | ACPI_FUNCTION_TRACE(acpi_gpe_can_wake); | ||
376 | |||
431 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | 377 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
432 | 378 | ||
433 | /* Ensure that we have a valid GPE number */ | 379 | /* Ensure that we have a valid GPE number */ |
@@ -438,51 +384,20 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type | |||
438 | goto unlock_and_exit; | 384 | goto unlock_and_exit; |
439 | } | 385 | } |
440 | 386 | ||
441 | /* Hardware-disable a runtime GPE on removal of the last reference */ | 387 | if (gpe_event_info->flags & ACPI_GPE_CAN_WAKE) { |
442 | 388 | goto unlock_and_exit; | |
443 | if (gpe_type & ACPI_GPE_TYPE_RUNTIME) { | ||
444 | if (!gpe_event_info->runtime_count) { | ||
445 | status = AE_LIMIT; /* There are no references to remove */ | ||
446 | goto unlock_and_exit; | ||
447 | } | ||
448 | |||
449 | gpe_event_info->runtime_count--; | ||
450 | if (!gpe_event_info->runtime_count) { | ||
451 | status = acpi_ev_update_gpe_enable_masks(gpe_event_info); | ||
452 | if (ACPI_SUCCESS(status)) { | ||
453 | status = acpi_hw_low_set_gpe(gpe_event_info, | ||
454 | ACPI_GPE_DISABLE); | ||
455 | } | ||
456 | |||
457 | if (ACPI_FAILURE(status)) { | ||
458 | gpe_event_info->runtime_count++; | ||
459 | goto unlock_and_exit; | ||
460 | } | ||
461 | } | ||
462 | } | 389 | } |
463 | 390 | ||
464 | /* | 391 | gpe_event_info->flags |= ACPI_GPE_CAN_WAKE; |
465 | * Update masks for wake GPE on removal of the last reference. | 392 | if (gpe_event_info->flags & ACPI_GPE_DISPATCH_METHOD) { |
466 | * No need to hardware-disable wake GPEs here, they are not currently | 393 | (void)acpi_raw_disable_gpe(gpe_event_info); |
467 | * enabled. | ||
468 | */ | ||
469 | if (gpe_type & ACPI_GPE_TYPE_WAKE) { | ||
470 | if (!gpe_event_info->wakeup_count) { | ||
471 | status = AE_LIMIT; /* There are no references to remove */ | ||
472 | goto unlock_and_exit; | ||
473 | } | ||
474 | |||
475 | gpe_event_info->wakeup_count--; | ||
476 | if (!gpe_event_info->wakeup_count) { | ||
477 | status = acpi_ev_update_gpe_enable_masks(gpe_event_info); | ||
478 | } | ||
479 | } | 394 | } |
480 | 395 | ||
481 | unlock_and_exit: | 396 | unlock_and_exit: |
482 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | 397 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
483 | return_ACPI_STATUS(status); | 398 | return_ACPI_STATUS(status); |
484 | } | 399 | } |
485 | ACPI_EXPORT_SYMBOL(acpi_disable_gpe) | 400 | ACPI_EXPORT_SYMBOL(acpi_gpe_can_wake) |
486 | 401 | ||
487 | /******************************************************************************* | 402 | /******************************************************************************* |
488 | * | 403 | * |
@@ -800,7 +715,7 @@ acpi_install_gpe_block(acpi_handle gpe_device, | |||
800 | 715 | ||
801 | obj_desc->device.gpe_block = gpe_block; | 716 | obj_desc->device.gpe_block = gpe_block; |
802 | 717 | ||
803 | /* Run the _PRW methods and enable the runtime GPEs in the new block */ | 718 | /* Enable the runtime GPEs in the new block */ |
804 | 719 | ||
805 | status = acpi_ev_initialize_gpe_block(node, gpe_block); | 720 | status = acpi_ev_initialize_gpe_block(node, gpe_block); |
806 | 721 | ||
diff --git a/drivers/acpi/acpica/exconfig.c b/drivers/acpi/acpica/exconfig.c index 008621c5ad85..18832205b631 100644 --- a/drivers/acpi/acpica/exconfig.c +++ b/drivers/acpi/acpica/exconfig.c | |||
@@ -120,7 +120,7 @@ acpi_ex_add_table(u32 table_index, | |||
120 | acpi_ns_exec_module_code_list(); | 120 | acpi_ns_exec_module_code_list(); |
121 | acpi_ex_enter_interpreter(); | 121 | acpi_ex_enter_interpreter(); |
122 | 122 | ||
123 | /* Update GPEs for any new _PRW or _Lxx/_Exx methods. Ignore errors */ | 123 | /* Update GPEs for any new _Lxx/_Exx methods. Ignore errors */ |
124 | 124 | ||
125 | status = acpi_tb_get_owner_id(table_index, &owner_id); | 125 | status = acpi_tb_get_owner_id(table_index, &owner_id); |
126 | if (ACPI_SUCCESS(status)) { | 126 | if (ACPI_SUCCESS(status)) { |
diff --git a/drivers/acpi/acpica/exdump.c b/drivers/acpi/acpica/exdump.c index d39d438ba1e3..f067bbb0d961 100644 --- a/drivers/acpi/acpica/exdump.c +++ b/drivers/acpi/acpica/exdump.c | |||
@@ -742,7 +742,7 @@ acpi_ex_dump_operands(union acpi_operand_object **operands, | |||
742 | } | 742 | } |
743 | 743 | ||
744 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 744 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
745 | "**** Start operand dump for opcode [%s], %d operands\n", | 745 | "**** Start operand dump for opcode [%s], %u operands\n", |
746 | opcode_name, num_operands)); | 746 | opcode_name, num_operands)); |
747 | 747 | ||
748 | if (num_operands == 0) { | 748 | if (num_operands == 0) { |
@@ -812,7 +812,7 @@ void acpi_ex_dump_namespace_node(struct acpi_namespace_node *node, u32 flags) | |||
812 | acpi_ex_out_string("Type", acpi_ut_get_type_name(node->type)); | 812 | acpi_ex_out_string("Type", acpi_ut_get_type_name(node->type)); |
813 | acpi_ex_out_pointer("Attached Object", | 813 | acpi_ex_out_pointer("Attached Object", |
814 | acpi_ns_get_attached_object(node)); | 814 | acpi_ns_get_attached_object(node)); |
815 | acpi_ex_out_pointer("Parent", acpi_ns_get_parent_node(node)); | 815 | acpi_ex_out_pointer("Parent", node->parent); |
816 | 816 | ||
817 | acpi_ex_dump_object(ACPI_CAST_PTR(union acpi_operand_object, node), | 817 | acpi_ex_dump_object(ACPI_CAST_PTR(union acpi_operand_object, node), |
818 | acpi_ex_dump_node); | 818 | acpi_ex_dump_node); |
@@ -945,7 +945,7 @@ acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc, | |||
945 | 945 | ||
946 | case ACPI_TYPE_PACKAGE: | 946 | case ACPI_TYPE_PACKAGE: |
947 | 947 | ||
948 | acpi_os_printf("[Package] Contains %d Elements:\n", | 948 | acpi_os_printf("[Package] Contains %u Elements:\n", |
949 | obj_desc->package.count); | 949 | obj_desc->package.count); |
950 | 950 | ||
951 | for (i = 0; i < obj_desc->package.count; i++) { | 951 | for (i = 0; i < obj_desc->package.count; i++) { |
diff --git a/drivers/acpi/acpica/exfldio.c b/drivers/acpi/acpica/exfldio.c index a6dc26f0b3be..047217303a4b 100644 --- a/drivers/acpi/acpica/exfldio.c +++ b/drivers/acpi/acpica/exfldio.c | |||
@@ -534,13 +534,13 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, | |||
534 | if (ACPI_SUCCESS(status)) { | 534 | if (ACPI_SUCCESS(status)) { |
535 | if (read_write == ACPI_READ) { | 535 | if (read_write == ACPI_READ) { |
536 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 536 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
537 | "Value Read %8.8X%8.8X, Width %d\n", | 537 | "Value Read %8.8X%8.8X, Width %u\n", |
538 | ACPI_FORMAT_UINT64(*value), | 538 | ACPI_FORMAT_UINT64(*value), |
539 | obj_desc->common_field. | 539 | obj_desc->common_field. |
540 | access_byte_width)); | 540 | access_byte_width)); |
541 | } else { | 541 | } else { |
542 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 542 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
543 | "Value Written %8.8X%8.8X, Width %d\n", | 543 | "Value Written %8.8X%8.8X, Width %u\n", |
544 | ACPI_FORMAT_UINT64(*value), | 544 | ACPI_FORMAT_UINT64(*value), |
545 | obj_desc->common_field. | 545 | obj_desc->common_field. |
546 | access_byte_width)); | 546 | access_byte_width)); |
diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c index 25059dace0ad..98a331d2249b 100644 --- a/drivers/acpi/acpica/exprep.c +++ b/drivers/acpi/acpica/exprep.c | |||
@@ -108,11 +108,11 @@ acpi_ex_generate_access(u32 field_bit_offset, | |||
108 | field_byte_length = field_byte_end_offset - field_byte_offset; | 108 | field_byte_length = field_byte_end_offset - field_byte_offset; |
109 | 109 | ||
110 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 110 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
111 | "Bit length %d, Bit offset %d\n", | 111 | "Bit length %u, Bit offset %u\n", |
112 | field_bit_length, field_bit_offset)); | 112 | field_bit_length, field_bit_offset)); |
113 | 113 | ||
114 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 114 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
115 | "Byte Length %d, Byte Offset %d, End Offset %d\n", | 115 | "Byte Length %u, Byte Offset %u, End Offset %u\n", |
116 | field_byte_length, field_byte_offset, | 116 | field_byte_length, field_byte_offset, |
117 | field_byte_end_offset)); | 117 | field_byte_end_offset)); |
118 | 118 | ||
@@ -147,11 +147,11 @@ acpi_ex_generate_access(u32 field_bit_offset, | |||
147 | accesses = field_end_offset - field_start_offset; | 147 | accesses = field_end_offset - field_start_offset; |
148 | 148 | ||
149 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 149 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
150 | "AccessWidth %d end is within region\n", | 150 | "AccessWidth %u end is within region\n", |
151 | access_byte_width)); | 151 | access_byte_width)); |
152 | 152 | ||
153 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 153 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
154 | "Field Start %d, Field End %d -- requires %d accesses\n", | 154 | "Field Start %u, Field End %u -- requires %u accesses\n", |
155 | field_start_offset, field_end_offset, | 155 | field_start_offset, field_end_offset, |
156 | accesses)); | 156 | accesses)); |
157 | 157 | ||
@@ -159,7 +159,7 @@ acpi_ex_generate_access(u32 field_bit_offset, | |||
159 | 159 | ||
160 | if (accesses <= 1) { | 160 | if (accesses <= 1) { |
161 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 161 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
162 | "Entire field can be accessed with one operation of size %d\n", | 162 | "Entire field can be accessed with one operation of size %u\n", |
163 | access_byte_width)); | 163 | access_byte_width)); |
164 | return_VALUE(access_byte_width); | 164 | return_VALUE(access_byte_width); |
165 | } | 165 | } |
@@ -174,7 +174,7 @@ acpi_ex_generate_access(u32 field_bit_offset, | |||
174 | } | 174 | } |
175 | } else { | 175 | } else { |
176 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 176 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
177 | "AccessWidth %d end is NOT within region\n", | 177 | "AccessWidth %u end is NOT within region\n", |
178 | access_byte_width)); | 178 | access_byte_width)); |
179 | if (access_byte_width == 1) { | 179 | if (access_byte_width == 1) { |
180 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 180 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
@@ -190,7 +190,7 @@ acpi_ex_generate_access(u32 field_bit_offset, | |||
190 | * previous access | 190 | * previous access |
191 | */ | 191 | */ |
192 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 192 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
193 | "Backing off to previous optimal access width of %d\n", | 193 | "Backing off to previous optimal access width of %u\n", |
194 | minimum_access_width)); | 194 | minimum_access_width)); |
195 | return_VALUE(minimum_access_width); | 195 | return_VALUE(minimum_access_width); |
196 | } | 196 | } |
@@ -385,15 +385,6 @@ acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc, | |||
385 | (field_bit_position - | 385 | (field_bit_position - |
386 | ACPI_MUL_8(obj_desc->common_field.base_byte_offset)); | 386 | ACPI_MUL_8(obj_desc->common_field.base_byte_offset)); |
387 | 387 | ||
388 | /* | ||
389 | * Does the entire field fit within a single field access element? (datum) | ||
390 | * (i.e., without crossing a datum boundary) | ||
391 | */ | ||
392 | if ((obj_desc->common_field.start_field_bit_offset + | ||
393 | field_bit_length) <= (u16) access_bit_width) { | ||
394 | obj_desc->common.flags |= AOPOBJ_SINGLE_DATUM; | ||
395 | } | ||
396 | |||
397 | return_ACPI_STATUS(AE_OK); | 388 | return_ACPI_STATUS(AE_OK); |
398 | } | 389 | } |
399 | 390 | ||
diff --git a/drivers/acpi/acpica/exregion.c b/drivers/acpi/acpica/exregion.c index 531000fc77d2..8819d2ac5aee 100644 --- a/drivers/acpi/acpica/exregion.c +++ b/drivers/acpi/acpica/exregion.c | |||
@@ -194,7 +194,7 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
194 | ((u64) address - (u64) mem_info->mapped_physical_address); | 194 | ((u64) address - (u64) mem_info->mapped_physical_address); |
195 | 195 | ||
196 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 196 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
197 | "System-Memory (width %d) R/W %d Address=%8.8X%8.8X\n", | 197 | "System-Memory (width %u) R/W %u Address=%8.8X%8.8X\n", |
198 | bit_width, function, | 198 | bit_width, function, |
199 | ACPI_FORMAT_NATIVE_UINT(address))); | 199 | ACPI_FORMAT_NATIVE_UINT(address))); |
200 | 200 | ||
@@ -297,7 +297,7 @@ acpi_ex_system_io_space_handler(u32 function, | |||
297 | ACPI_FUNCTION_TRACE(ex_system_io_space_handler); | 297 | ACPI_FUNCTION_TRACE(ex_system_io_space_handler); |
298 | 298 | ||
299 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 299 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
300 | "System-IO (width %d) R/W %d Address=%8.8X%8.8X\n", | 300 | "System-IO (width %u) R/W %u Address=%8.8X%8.8X\n", |
301 | bit_width, function, | 301 | bit_width, function, |
302 | ACPI_FORMAT_NATIVE_UINT(address))); | 302 | ACPI_FORMAT_NATIVE_UINT(address))); |
303 | 303 | ||
@@ -373,7 +373,7 @@ acpi_ex_pci_config_space_handler(u32 function, | |||
373 | pci_register = (u16) (u32) address; | 373 | pci_register = (u16) (u32) address; |
374 | 374 | ||
375 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 375 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
376 | "Pci-Config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n", | 376 | "Pci-Config %u (%u) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n", |
377 | function, bit_width, pci_id->segment, pci_id->bus, | 377 | function, bit_width, pci_id->segment, pci_id->bus, |
378 | pci_id->device, pci_id->function, pci_register)); | 378 | pci_id->device, pci_id->function, pci_register)); |
379 | 379 | ||
diff --git a/drivers/acpi/acpica/hwgpe.c b/drivers/acpi/acpica/hwgpe.c index 3450309c2786..14750db2a1b8 100644 --- a/drivers/acpi/acpica/hwgpe.c +++ b/drivers/acpi/acpica/hwgpe.c | |||
@@ -57,7 +57,7 @@ acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
57 | 57 | ||
58 | /****************************************************************************** | 58 | /****************************************************************************** |
59 | * | 59 | * |
60 | * FUNCTION: acpi_hw_gpe_register_bit | 60 | * FUNCTION: acpi_hw_get_gpe_register_bit |
61 | * | 61 | * |
62 | * PARAMETERS: gpe_event_info - Info block for the GPE | 62 | * PARAMETERS: gpe_event_info - Info block for the GPE |
63 | * gpe_register_info - Info block for the GPE register | 63 | * gpe_register_info - Info block for the GPE register |
@@ -69,7 +69,7 @@ acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
69 | * | 69 | * |
70 | ******************************************************************************/ | 70 | ******************************************************************************/ |
71 | 71 | ||
72 | u32 acpi_hw_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info, | 72 | u32 acpi_hw_get_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info, |
73 | struct acpi_gpe_register_info *gpe_register_info) | 73 | struct acpi_gpe_register_info *gpe_register_info) |
74 | { | 74 | { |
75 | return (u32)1 << (gpe_event_info->gpe_number - | 75 | return (u32)1 << (gpe_event_info->gpe_number - |
@@ -115,7 +115,7 @@ acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u8 action) | |||
115 | 115 | ||
116 | /* Set ot clear just the bit that corresponds to this GPE */ | 116 | /* Set ot clear just the bit that corresponds to this GPE */ |
117 | 117 | ||
118 | register_bit = acpi_hw_gpe_register_bit(gpe_event_info, | 118 | register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info, |
119 | gpe_register_info); | 119 | gpe_register_info); |
120 | switch (action) { | 120 | switch (action) { |
121 | case ACPI_GPE_COND_ENABLE: | 121 | case ACPI_GPE_COND_ENABLE: |
@@ -143,31 +143,6 @@ acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u8 action) | |||
143 | 143 | ||
144 | /****************************************************************************** | 144 | /****************************************************************************** |
145 | * | 145 | * |
146 | * FUNCTION: acpi_hw_write_gpe_enable_reg | ||
147 | * | ||
148 | * PARAMETERS: gpe_event_info - Info block for the GPE to be enabled | ||
149 | * | ||
150 | * RETURN: Status | ||
151 | * | ||
152 | * DESCRIPTION: Write a GPE enable register. Note: The bit for this GPE must | ||
153 | * already be cleared or set in the parent register | ||
154 | * enable_for_run mask. | ||
155 | * | ||
156 | ******************************************************************************/ | ||
157 | |||
158 | acpi_status | ||
159 | acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info * gpe_event_info) | ||
160 | { | ||
161 | acpi_status status; | ||
162 | |||
163 | ACPI_FUNCTION_ENTRY(); | ||
164 | |||
165 | status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_COND_ENABLE); | ||
166 | return (status); | ||
167 | } | ||
168 | |||
169 | /****************************************************************************** | ||
170 | * | ||
171 | * FUNCTION: acpi_hw_clear_gpe | 146 | * FUNCTION: acpi_hw_clear_gpe |
172 | * | 147 | * |
173 | * PARAMETERS: gpe_event_info - Info block for the GPE to be cleared | 148 | * PARAMETERS: gpe_event_info - Info block for the GPE to be cleared |
@@ -193,7 +168,7 @@ acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info) | |||
193 | return (AE_NOT_EXIST); | 168 | return (AE_NOT_EXIST); |
194 | } | 169 | } |
195 | 170 | ||
196 | register_bit = acpi_hw_gpe_register_bit(gpe_event_info, | 171 | register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info, |
197 | gpe_register_info); | 172 | gpe_register_info); |
198 | 173 | ||
199 | /* | 174 | /* |
@@ -241,7 +216,7 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info, | |||
241 | 216 | ||
242 | /* Get the register bitmask for this GPE */ | 217 | /* Get the register bitmask for this GPE */ |
243 | 218 | ||
244 | register_bit = acpi_hw_gpe_register_bit(gpe_event_info, | 219 | register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info, |
245 | gpe_register_info); | 220 | gpe_register_info); |
246 | 221 | ||
247 | /* GPE currently enabled? (enabled for runtime?) */ | 222 | /* GPE currently enabled? (enabled for runtime?) */ |
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c index 36eb803dd9d0..3796811276ac 100644 --- a/drivers/acpi/acpica/hwsleep.c +++ b/drivers/acpi/acpica/hwsleep.c | |||
@@ -307,7 +307,7 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) | |||
307 | return_ACPI_STATUS(status); | 307 | return_ACPI_STATUS(status); |
308 | } | 308 | } |
309 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, | 309 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, |
310 | "Entering sleep state [S%d]\n", sleep_state)); | 310 | "Entering sleep state [S%u]\n", sleep_state)); |
311 | 311 | ||
312 | /* Clear the SLP_EN and SLP_TYP fields */ | 312 | /* Clear the SLP_EN and SLP_TYP fields */ |
313 | 313 | ||
diff --git a/drivers/acpi/acpica/nsaccess.c b/drivers/acpi/acpica/nsaccess.c index 3a2814676ac3..0cd925be5fc1 100644 --- a/drivers/acpi/acpica/nsaccess.c +++ b/drivers/acpi/acpica/nsaccess.c | |||
@@ -338,8 +338,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
338 | */ | 338 | */ |
339 | while (!acpi_ns_opens_scope(prefix_node->type) && | 339 | while (!acpi_ns_opens_scope(prefix_node->type) && |
340 | prefix_node->type != ACPI_TYPE_ANY) { | 340 | prefix_node->type != ACPI_TYPE_ANY) { |
341 | prefix_node = | 341 | prefix_node = prefix_node->parent; |
342 | acpi_ns_get_parent_node(prefix_node); | ||
343 | } | 342 | } |
344 | } | 343 | } |
345 | } | 344 | } |
@@ -419,7 +418,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
419 | /* Backup to the parent node */ | 418 | /* Backup to the parent node */ |
420 | 419 | ||
421 | num_carats++; | 420 | num_carats++; |
422 | this_node = acpi_ns_get_parent_node(this_node); | 421 | this_node = this_node->parent; |
423 | if (!this_node) { | 422 | if (!this_node) { |
424 | 423 | ||
425 | /* Current scope has no parent scope */ | 424 | /* Current scope has no parent scope */ |
@@ -433,7 +432,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
433 | 432 | ||
434 | if (search_parent_flag == ACPI_NS_NO_UPSEARCH) { | 433 | if (search_parent_flag == ACPI_NS_NO_UPSEARCH) { |
435 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 434 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
436 | "Search scope is [%4.4s], path has %d carat(s)\n", | 435 | "Search scope is [%4.4s], path has %u carat(s)\n", |
437 | acpi_ut_get_node_name | 436 | acpi_ut_get_node_name |
438 | (this_node), num_carats)); | 437 | (this_node), num_carats)); |
439 | } | 438 | } |
@@ -495,7 +494,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
495 | path++; | 494 | path++; |
496 | 495 | ||
497 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 496 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
498 | "Multi Pathname (%d Segments, Flags=%X)\n", | 497 | "Multi Pathname (%u Segments, Flags=%X)\n", |
499 | num_segments, flags)); | 498 | num_segments, flags)); |
500 | break; | 499 | break; |
501 | 500 | ||
diff --git a/drivers/acpi/acpica/nsalloc.c b/drivers/acpi/acpica/nsalloc.c index 982269c1fa48..1e5ff803d9ad 100644 --- a/drivers/acpi/acpica/nsalloc.c +++ b/drivers/acpi/acpica/nsalloc.c | |||
@@ -159,7 +159,7 @@ void acpi_ns_remove_node(struct acpi_namespace_node *node) | |||
159 | 159 | ||
160 | ACPI_FUNCTION_TRACE_PTR(ns_remove_node, node); | 160 | ACPI_FUNCTION_TRACE_PTR(ns_remove_node, node); |
161 | 161 | ||
162 | parent_node = acpi_ns_get_parent_node(node); | 162 | parent_node = node->parent; |
163 | 163 | ||
164 | prev_node = NULL; | 164 | prev_node = NULL; |
165 | next_node = parent_node->child; | 165 | next_node = parent_node->child; |
@@ -168,29 +168,20 @@ void acpi_ns_remove_node(struct acpi_namespace_node *node) | |||
168 | 168 | ||
169 | while (next_node != node) { | 169 | while (next_node != node) { |
170 | prev_node = next_node; | 170 | prev_node = next_node; |
171 | next_node = prev_node->peer; | 171 | next_node = next_node->peer; |
172 | } | 172 | } |
173 | 173 | ||
174 | if (prev_node) { | 174 | if (prev_node) { |
175 | 175 | ||
176 | /* Node is not first child, unlink it */ | 176 | /* Node is not first child, unlink it */ |
177 | 177 | ||
178 | prev_node->peer = next_node->peer; | 178 | prev_node->peer = node->peer; |
179 | if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { | ||
180 | prev_node->flags |= ANOBJ_END_OF_PEER_LIST; | ||
181 | } | ||
182 | } else { | 179 | } else { |
183 | /* Node is first child (has no previous peer) */ | 180 | /* |
184 | 181 | * Node is first child (has no previous peer). | |
185 | if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { | 182 | * Link peer list to parent |
186 | 183 | */ | |
187 | /* No peers at all */ | 184 | parent_node->child = node->peer; |
188 | |||
189 | parent_node->child = NULL; | ||
190 | } else { /* Link peer list to parent */ | ||
191 | |||
192 | parent_node->child = next_node->peer; | ||
193 | } | ||
194 | } | 185 | } |
195 | 186 | ||
196 | /* Delete the node and any attached objects */ | 187 | /* Delete the node and any attached objects */ |
@@ -228,33 +219,42 @@ void acpi_ns_install_node(struct acpi_walk_state *walk_state, struct acpi_namesp | |||
228 | 219 | ||
229 | ACPI_FUNCTION_TRACE(ns_install_node); | 220 | ACPI_FUNCTION_TRACE(ns_install_node); |
230 | 221 | ||
231 | /* | ||
232 | * Get the owner ID from the Walk state. The owner ID is used to track | ||
233 | * table deletion and deletion of objects created by methods. | ||
234 | */ | ||
235 | if (walk_state) { | 222 | if (walk_state) { |
223 | /* | ||
224 | * Get the owner ID from the Walk state. The owner ID is used to | ||
225 | * track table deletion and deletion of objects created by methods. | ||
226 | */ | ||
236 | owner_id = walk_state->owner_id; | 227 | owner_id = walk_state->owner_id; |
228 | |||
229 | if ((walk_state->method_desc) && | ||
230 | (parent_node != walk_state->method_node)) { | ||
231 | /* | ||
232 | * A method is creating a new node that is not a child of the | ||
233 | * method (it is non-local). Mark the executing method as having | ||
234 | * modified the namespace. This is used for cleanup when the | ||
235 | * method exits. | ||
236 | */ | ||
237 | walk_state->method_desc->method.flags |= | ||
238 | AOPOBJ_MODIFIED_NAMESPACE; | ||
239 | } | ||
237 | } | 240 | } |
238 | 241 | ||
239 | /* Link the new entry into the parent and existing children */ | 242 | /* Link the new entry into the parent and existing children */ |
240 | 243 | ||
244 | node->peer = NULL; | ||
245 | node->parent = parent_node; | ||
241 | child_node = parent_node->child; | 246 | child_node = parent_node->child; |
247 | |||
242 | if (!child_node) { | 248 | if (!child_node) { |
243 | parent_node->child = node; | 249 | parent_node->child = node; |
244 | node->flags |= ANOBJ_END_OF_PEER_LIST; | ||
245 | node->peer = parent_node; | ||
246 | } else { | 250 | } else { |
247 | while (!(child_node->flags & ANOBJ_END_OF_PEER_LIST)) { | 251 | /* Add node to the end of the peer list */ |
252 | |||
253 | while (child_node->peer) { | ||
248 | child_node = child_node->peer; | 254 | child_node = child_node->peer; |
249 | } | 255 | } |
250 | 256 | ||
251 | child_node->peer = node; | 257 | child_node->peer = node; |
252 | |||
253 | /* Clear end-of-list flag */ | ||
254 | |||
255 | child_node->flags &= ~ANOBJ_END_OF_PEER_LIST; | ||
256 | node->flags |= ANOBJ_END_OF_PEER_LIST; | ||
257 | node->peer = parent_node; | ||
258 | } | 258 | } |
259 | 259 | ||
260 | /* Init the new entry */ | 260 | /* Init the new entry */ |
@@ -288,9 +288,8 @@ void acpi_ns_install_node(struct acpi_walk_state *walk_state, struct acpi_namesp | |||
288 | 288 | ||
289 | void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) | 289 | void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) |
290 | { | 290 | { |
291 | struct acpi_namespace_node *child_node; | ||
292 | struct acpi_namespace_node *next_node; | 291 | struct acpi_namespace_node *next_node; |
293 | u8 flags; | 292 | struct acpi_namespace_node *node_to_delete; |
294 | 293 | ||
295 | ACPI_FUNCTION_TRACE_PTR(ns_delete_children, parent_node); | 294 | ACPI_FUNCTION_TRACE_PTR(ns_delete_children, parent_node); |
296 | 295 | ||
@@ -298,37 +297,26 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) | |||
298 | return_VOID; | 297 | return_VOID; |
299 | } | 298 | } |
300 | 299 | ||
301 | /* If no children, all done! */ | ||
302 | |||
303 | child_node = parent_node->child; | ||
304 | if (!child_node) { | ||
305 | return_VOID; | ||
306 | } | ||
307 | |||
308 | /* Deallocate all children at this level */ | 300 | /* Deallocate all children at this level */ |
309 | 301 | ||
310 | do { | 302 | next_node = parent_node->child; |
311 | 303 | while (next_node) { | |
312 | /* Get the things we need */ | ||
313 | |||
314 | next_node = child_node->peer; | ||
315 | flags = child_node->flags; | ||
316 | 304 | ||
317 | /* Grandchildren should have all been deleted already */ | 305 | /* Grandchildren should have all been deleted already */ |
318 | 306 | ||
319 | if (child_node->child) { | 307 | if (next_node->child) { |
320 | ACPI_ERROR((AE_INFO, "Found a grandchild! P=%p C=%p", | 308 | ACPI_ERROR((AE_INFO, "Found a grandchild! P=%p C=%p", |
321 | parent_node, child_node)); | 309 | parent_node, next_node)); |
322 | } | 310 | } |
323 | 311 | ||
324 | /* | 312 | /* |
325 | * Delete this child node and move on to the next child in the list. | 313 | * Delete this child node and move on to the next child in the list. |
326 | * No need to unlink the node since we are deleting the entire branch. | 314 | * No need to unlink the node since we are deleting the entire branch. |
327 | */ | 315 | */ |
328 | acpi_ns_delete_node(child_node); | 316 | node_to_delete = next_node; |
329 | child_node = next_node; | 317 | next_node = next_node->peer; |
330 | 318 | acpi_ns_delete_node(node_to_delete); | |
331 | } while (!(flags & ANOBJ_END_OF_PEER_LIST)); | 319 | }; |
332 | 320 | ||
333 | /* Clear the parent's child pointer */ | 321 | /* Clear the parent's child pointer */ |
334 | 322 | ||
@@ -405,7 +393,7 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node) | |||
405 | 393 | ||
406 | /* Move up the tree to the grandparent */ | 394 | /* Move up the tree to the grandparent */ |
407 | 395 | ||
408 | parent_node = acpi_ns_get_parent_node(parent_node); | 396 | parent_node = parent_node->parent; |
409 | } | 397 | } |
410 | } | 398 | } |
411 | 399 | ||
@@ -510,7 +498,7 @@ void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id) | |||
510 | 498 | ||
511 | /* Move up the tree to the grandparent */ | 499 | /* Move up the tree to the grandparent */ |
512 | 500 | ||
513 | parent_node = acpi_ns_get_parent_node(parent_node); | 501 | parent_node = parent_node->parent; |
514 | } | 502 | } |
515 | } | 503 | } |
516 | 504 | ||
diff --git a/drivers/acpi/acpica/nsdump.c b/drivers/acpi/acpica/nsdump.c index 2110cc2360f0..a54dc39e304b 100644 --- a/drivers/acpi/acpica/nsdump.c +++ b/drivers/acpi/acpica/nsdump.c | |||
@@ -441,7 +441,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, | |||
441 | return (AE_OK); | 441 | return (AE_OK); |
442 | } | 442 | } |
443 | 443 | ||
444 | acpi_os_printf("(R%d)", obj_desc->common.reference_count); | 444 | acpi_os_printf("(R%u)", obj_desc->common.reference_count); |
445 | 445 | ||
446 | switch (type) { | 446 | switch (type) { |
447 | case ACPI_TYPE_METHOD: | 447 | case ACPI_TYPE_METHOD: |
diff --git a/drivers/acpi/acpica/nsinit.c b/drivers/acpi/acpica/nsinit.c index 4e5272c313e0..660a2728908d 100644 --- a/drivers/acpi/acpica/nsinit.c +++ b/drivers/acpi/acpica/nsinit.c | |||
@@ -103,8 +103,8 @@ acpi_status acpi_ns_initialize_objects(void) | |||
103 | } | 103 | } |
104 | 104 | ||
105 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 105 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
106 | "\nInitialized %hd/%hd Regions %hd/%hd Fields %hd/%hd " | 106 | "\nInitialized %u/%u Regions %u/%u Fields %u/%u " |
107 | "Buffers %hd/%hd Packages (%hd nodes)\n", | 107 | "Buffers %u/%u Packages (%u nodes)\n", |
108 | info.op_region_init, info.op_region_count, | 108 | info.op_region_init, info.op_region_count, |
109 | info.field_init, info.field_count, | 109 | info.field_init, info.field_count, |
110 | info.buffer_init, info.buffer_count, | 110 | info.buffer_init, info.buffer_count, |
@@ -112,9 +112,9 @@ acpi_status acpi_ns_initialize_objects(void) | |||
112 | info.object_count)); | 112 | info.object_count)); |
113 | 113 | ||
114 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 114 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
115 | "%hd Control Methods found\n", info.method_count)); | 115 | "%u Control Methods found\n", info.method_count)); |
116 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 116 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
117 | "%hd Op Regions found\n", info.op_region_count)); | 117 | "%u Op Regions found\n", info.op_region_count)); |
118 | 118 | ||
119 | return_ACPI_STATUS(AE_OK); | 119 | return_ACPI_STATUS(AE_OK); |
120 | } | 120 | } |
@@ -208,8 +208,8 @@ acpi_status acpi_ns_initialize_devices(void) | |||
208 | } | 208 | } |
209 | 209 | ||
210 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 210 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
211 | "\nExecuted %hd _INI methods requiring %hd _STA executions " | 211 | "\nExecuted %u _INI methods requiring %u _STA executions " |
212 | "(examined %hd objects)\n", | 212 | "(examined %u objects)\n", |
213 | info.num_INI, info.num_STA, info.device_count)); | 213 | info.num_INI, info.num_STA, info.device_count)); |
214 | 214 | ||
215 | return_ACPI_STATUS(status); | 215 | return_ACPI_STATUS(status); |
@@ -410,7 +410,7 @@ acpi_ns_find_ini_methods(acpi_handle obj_handle, | |||
410 | * The only _INI methods that we care about are those that are | 410 | * The only _INI methods that we care about are those that are |
411 | * present under Device, Processor, and Thermal objects. | 411 | * present under Device, Processor, and Thermal objects. |
412 | */ | 412 | */ |
413 | parent_node = acpi_ns_get_parent_node(node); | 413 | parent_node = node->parent; |
414 | switch (parent_node->type) { | 414 | switch (parent_node->type) { |
415 | case ACPI_TYPE_DEVICE: | 415 | case ACPI_TYPE_DEVICE: |
416 | case ACPI_TYPE_PROCESSOR: | 416 | case ACPI_TYPE_PROCESSOR: |
@@ -420,7 +420,7 @@ acpi_ns_find_ini_methods(acpi_handle obj_handle, | |||
420 | 420 | ||
421 | while (parent_node) { | 421 | while (parent_node) { |
422 | parent_node->flags |= ANOBJ_SUBTREE_HAS_INI; | 422 | parent_node->flags |= ANOBJ_SUBTREE_HAS_INI; |
423 | parent_node = acpi_ns_get_parent_node(parent_node); | 423 | parent_node = parent_node->parent; |
424 | } | 424 | } |
425 | break; | 425 | break; |
426 | 426 | ||
diff --git a/drivers/acpi/acpica/nsnames.c b/drivers/acpi/acpica/nsnames.c index 7dea0031605c..d3104af57e13 100644 --- a/drivers/acpi/acpica/nsnames.c +++ b/drivers/acpi/acpica/nsnames.c | |||
@@ -93,7 +93,7 @@ acpi_ns_build_external_path(struct acpi_namespace_node *node, | |||
93 | /* Put the name into the buffer */ | 93 | /* Put the name into the buffer */ |
94 | 94 | ||
95 | ACPI_MOVE_32_TO_32((name_buffer + index), &parent_node->name); | 95 | ACPI_MOVE_32_TO_32((name_buffer + index), &parent_node->name); |
96 | parent_node = acpi_ns_get_parent_node(parent_node); | 96 | parent_node = parent_node->parent; |
97 | 97 | ||
98 | /* Prefix name with the path separator */ | 98 | /* Prefix name with the path separator */ |
99 | 99 | ||
@@ -198,7 +198,7 @@ acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node) | |||
198 | return 0; | 198 | return 0; |
199 | } | 199 | } |
200 | size += ACPI_PATH_SEGMENT_LENGTH; | 200 | size += ACPI_PATH_SEGMENT_LENGTH; |
201 | next_node = acpi_ns_get_parent_node(next_node); | 201 | next_node = next_node->parent; |
202 | } | 202 | } |
203 | 203 | ||
204 | if (!size) { | 204 | if (!size) { |
diff --git a/drivers/acpi/acpica/nsparse.c b/drivers/acpi/acpica/nsparse.c index 27cda52c76bc..5808c89e9fac 100644 --- a/drivers/acpi/acpica/nsparse.c +++ b/drivers/acpi/acpica/nsparse.c | |||
@@ -136,8 +136,8 @@ acpi_ns_one_complete_parse(u32 pass_number, | |||
136 | 136 | ||
137 | /* Parse the AML */ | 137 | /* Parse the AML */ |
138 | 138 | ||
139 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "*PARSE* pass %d parse\n", | 139 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "*PARSE* pass %u parse\n", |
140 | (unsigned)pass_number)); | 140 | pass_number)); |
141 | status = acpi_ps_parse_aml(walk_state); | 141 | status = acpi_ps_parse_aml(walk_state); |
142 | 142 | ||
143 | cleanup: | 143 | cleanup: |
diff --git a/drivers/acpi/acpica/nsrepair.c b/drivers/acpi/acpica/nsrepair.c index d4be37751be4..d1c136692667 100644 --- a/drivers/acpi/acpica/nsrepair.c +++ b/drivers/acpi/acpica/nsrepair.c | |||
@@ -556,7 +556,7 @@ acpi_ns_repair_null_element(struct acpi_predefined_data *data, | |||
556 | 556 | ||
557 | /* Need an Integer - create a zero-value integer */ | 557 | /* Need an Integer - create a zero-value integer */ |
558 | 558 | ||
559 | new_object = acpi_ut_create_integer_object(0); | 559 | new_object = acpi_ut_create_integer_object((u64)0); |
560 | } else if (expected_btypes & ACPI_RTYPE_STRING) { | 560 | } else if (expected_btypes & ACPI_RTYPE_STRING) { |
561 | 561 | ||
562 | /* Need a String - create a NULL string */ | 562 | /* Need a String - create a NULL string */ |
diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c index 61bd0f6755d2..4009498fbabd 100644 --- a/drivers/acpi/acpica/nsrepair2.c +++ b/drivers/acpi/acpica/nsrepair2.c | |||
@@ -112,6 +112,13 @@ acpi_ns_sort_list(union acpi_operand_object **elements, | |||
112 | * _GTM: Convert Buffer of BYTEs to a Buffer of DWORDs | 112 | * _GTM: Convert Buffer of BYTEs to a Buffer of DWORDs |
113 | * _PSS: Sort the list descending by Power | 113 | * _PSS: Sort the list descending by Power |
114 | * _TSS: Sort the list descending by Power | 114 | * _TSS: Sort the list descending by Power |
115 | * | ||
116 | * Names that must be packages, but cannot be sorted: | ||
117 | * | ||
118 | * _BCL: Values are tied to the Package index where they appear, and cannot | ||
119 | * be moved or sorted. These index values are used for _BQC and _BCM. | ||
120 | * However, we can fix the case where a buffer is returned, by converting | ||
121 | * it to a Package of integers. | ||
115 | */ | 122 | */ |
116 | static const struct acpi_repair_info acpi_ns_repairable_names[] = { | 123 | static const struct acpi_repair_info acpi_ns_repairable_names[] = { |
117 | {"_ALR", acpi_ns_repair_ALR}, | 124 | {"_ALR", acpi_ns_repair_ALR}, |
diff --git a/drivers/acpi/acpica/nssearch.c b/drivers/acpi/acpica/nssearch.c index a8e42b5e9463..41102a84272f 100644 --- a/drivers/acpi/acpica/nssearch.c +++ b/drivers/acpi/acpica/nssearch.c | |||
@@ -152,17 +152,6 @@ acpi_ns_search_one_scope(u32 target_name, | |||
152 | return_ACPI_STATUS(AE_OK); | 152 | return_ACPI_STATUS(AE_OK); |
153 | } | 153 | } |
154 | 154 | ||
155 | /* | ||
156 | * The last entry in the list points back to the parent, | ||
157 | * so a flag is used to indicate the end-of-list | ||
158 | */ | ||
159 | if (node->flags & ANOBJ_END_OF_PEER_LIST) { | ||
160 | |||
161 | /* Searched entire list, we are done */ | ||
162 | |||
163 | break; | ||
164 | } | ||
165 | |||
166 | /* Didn't match name, move on to the next peer object */ | 155 | /* Didn't match name, move on to the next peer object */ |
167 | 156 | ||
168 | node = node->peer; | 157 | node = node->peer; |
@@ -217,7 +206,7 @@ acpi_ns_search_parent_tree(u32 target_name, | |||
217 | 206 | ||
218 | ACPI_FUNCTION_TRACE(ns_search_parent_tree); | 207 | ACPI_FUNCTION_TRACE(ns_search_parent_tree); |
219 | 208 | ||
220 | parent_node = acpi_ns_get_parent_node(node); | 209 | parent_node = node->parent; |
221 | 210 | ||
222 | /* | 211 | /* |
223 | * If there is no parent (i.e., we are at the root) or type is "local", | 212 | * If there is no parent (i.e., we are at the root) or type is "local", |
@@ -261,7 +250,7 @@ acpi_ns_search_parent_tree(u32 target_name, | |||
261 | 250 | ||
262 | /* Not found here, go up another level (until we reach the root) */ | 251 | /* Not found here, go up another level (until we reach the root) */ |
263 | 252 | ||
264 | parent_node = acpi_ns_get_parent_node(parent_node); | 253 | parent_node = parent_node->parent; |
265 | } | 254 | } |
266 | 255 | ||
267 | /* Not found in parent tree */ | 256 | /* Not found in parent tree */ |
diff --git a/drivers/acpi/acpica/nsutils.c b/drivers/acpi/acpica/nsutils.c index bab559712da1..e1add3491b04 100644 --- a/drivers/acpi/acpica/nsutils.c +++ b/drivers/acpi/acpica/nsutils.c | |||
@@ -847,116 +847,3 @@ acpi_ns_get_node(struct acpi_namespace_node *prefix_node, | |||
847 | ACPI_FREE(internal_path); | 847 | ACPI_FREE(internal_path); |
848 | return_ACPI_STATUS(status); | 848 | return_ACPI_STATUS(status); |
849 | } | 849 | } |
850 | |||
851 | /******************************************************************************* | ||
852 | * | ||
853 | * FUNCTION: acpi_ns_get_parent_node | ||
854 | * | ||
855 | * PARAMETERS: Node - Current table entry | ||
856 | * | ||
857 | * RETURN: Parent entry of the given entry | ||
858 | * | ||
859 | * DESCRIPTION: Obtain the parent entry for a given entry in the namespace. | ||
860 | * | ||
861 | ******************************************************************************/ | ||
862 | |||
863 | struct acpi_namespace_node *acpi_ns_get_parent_node(struct acpi_namespace_node | ||
864 | *node) | ||
865 | { | ||
866 | ACPI_FUNCTION_ENTRY(); | ||
867 | |||
868 | if (!node) { | ||
869 | return (NULL); | ||
870 | } | ||
871 | |||
872 | /* | ||
873 | * Walk to the end of this peer list. The last entry is marked with a flag | ||
874 | * and the peer pointer is really a pointer back to the parent. This saves | ||
875 | * putting a parent back pointer in each and every named object! | ||
876 | */ | ||
877 | while (!(node->flags & ANOBJ_END_OF_PEER_LIST)) { | ||
878 | node = node->peer; | ||
879 | } | ||
880 | |||
881 | return (node->peer); | ||
882 | } | ||
883 | |||
884 | /******************************************************************************* | ||
885 | * | ||
886 | * FUNCTION: acpi_ns_get_next_valid_node | ||
887 | * | ||
888 | * PARAMETERS: Node - Current table entry | ||
889 | * | ||
890 | * RETURN: Next valid Node in the linked node list. NULL if no more valid | ||
891 | * nodes. | ||
892 | * | ||
893 | * DESCRIPTION: Find the next valid node within a name table. | ||
894 | * Useful for implementing NULL-end-of-list loops. | ||
895 | * | ||
896 | ******************************************************************************/ | ||
897 | |||
898 | struct acpi_namespace_node *acpi_ns_get_next_valid_node(struct | ||
899 | acpi_namespace_node | ||
900 | *node) | ||
901 | { | ||
902 | |||
903 | /* If we are at the end of this peer list, return NULL */ | ||
904 | |||
905 | if (node->flags & ANOBJ_END_OF_PEER_LIST) { | ||
906 | return NULL; | ||
907 | } | ||
908 | |||
909 | /* Otherwise just return the next peer */ | ||
910 | |||
911 | return (node->peer); | ||
912 | } | ||
913 | |||
914 | #ifdef ACPI_OBSOLETE_FUNCTIONS | ||
915 | /******************************************************************************* | ||
916 | * | ||
917 | * FUNCTION: acpi_ns_find_parent_name | ||
918 | * | ||
919 | * PARAMETERS: *child_node - Named Obj whose name is to be found | ||
920 | * | ||
921 | * RETURN: The ACPI name | ||
922 | * | ||
923 | * DESCRIPTION: Search for the given obj in its parent scope and return the | ||
924 | * name segment, or "????" if the parent name can't be found | ||
925 | * (which "should not happen"). | ||
926 | * | ||
927 | ******************************************************************************/ | ||
928 | |||
929 | acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node * child_node) | ||
930 | { | ||
931 | struct acpi_namespace_node *parent_node; | ||
932 | |||
933 | ACPI_FUNCTION_TRACE(ns_find_parent_name); | ||
934 | |||
935 | if (child_node) { | ||
936 | |||
937 | /* Valid entry. Get the parent Node */ | ||
938 | |||
939 | parent_node = acpi_ns_get_parent_node(child_node); | ||
940 | if (parent_node) { | ||
941 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
942 | "Parent of %p [%4.4s] is %p [%4.4s]\n", | ||
943 | child_node, | ||
944 | acpi_ut_get_node_name(child_node), | ||
945 | parent_node, | ||
946 | acpi_ut_get_node_name(parent_node))); | ||
947 | |||
948 | if (parent_node->name.integer) { | ||
949 | return_VALUE((acpi_name) parent_node->name. | ||
950 | integer); | ||
951 | } | ||
952 | } | ||
953 | |||
954 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
955 | "Unable to find parent of %p (%4.4s)\n", | ||
956 | child_node, | ||
957 | acpi_ut_get_node_name(child_node))); | ||
958 | } | ||
959 | |||
960 | return_VALUE(ACPI_UNKNOWN_NAME); | ||
961 | } | ||
962 | #endif | ||
diff --git a/drivers/acpi/acpica/nswalk.c b/drivers/acpi/acpica/nswalk.c index 00e79fb26029..2cd5be8fe10f 100644 --- a/drivers/acpi/acpica/nswalk.c +++ b/drivers/acpi/acpica/nswalk.c | |||
@@ -79,15 +79,6 @@ struct acpi_namespace_node *acpi_ns_get_next_node(struct acpi_namespace_node | |||
79 | return parent_node->child; | 79 | return parent_node->child; |
80 | } | 80 | } |
81 | 81 | ||
82 | /* | ||
83 | * Get the next node. | ||
84 | * | ||
85 | * If we are at the end of this peer list, return NULL | ||
86 | */ | ||
87 | if (child_node->flags & ANOBJ_END_OF_PEER_LIST) { | ||
88 | return NULL; | ||
89 | } | ||
90 | |||
91 | /* Otherwise just return the next peer */ | 82 | /* Otherwise just return the next peer */ |
92 | 83 | ||
93 | return child_node->peer; | 84 | return child_node->peer; |
@@ -146,9 +137,9 @@ struct acpi_namespace_node *acpi_ns_get_next_node_typed(acpi_object_type type, | |||
146 | return (next_node); | 137 | return (next_node); |
147 | } | 138 | } |
148 | 139 | ||
149 | /* Otherwise, move on to the next node */ | 140 | /* Otherwise, move on to the next peer node */ |
150 | 141 | ||
151 | next_node = acpi_ns_get_next_valid_node(next_node); | 142 | next_node = next_node->peer; |
152 | } | 143 | } |
153 | 144 | ||
154 | /* Not found */ | 145 | /* Not found */ |
@@ -355,7 +346,7 @@ acpi_ns_walk_namespace(acpi_object_type type, | |||
355 | */ | 346 | */ |
356 | level--; | 347 | level--; |
357 | child_node = parent_node; | 348 | child_node = parent_node; |
358 | parent_node = acpi_ns_get_parent_node(parent_node); | 349 | parent_node = parent_node->parent; |
359 | 350 | ||
360 | node_previously_visited = TRUE; | 351 | node_previously_visited = TRUE; |
361 | } | 352 | } |
diff --git a/drivers/acpi/acpica/nsxfobj.c b/drivers/acpi/acpica/nsxfobj.c index eafef24ea448..a1f04e9b8030 100644 --- a/drivers/acpi/acpica/nsxfobj.c +++ b/drivers/acpi/acpica/nsxfobj.c | |||
@@ -190,7 +190,7 @@ acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle) | |||
190 | 190 | ||
191 | /* Get the parent entry */ | 191 | /* Get the parent entry */ |
192 | 192 | ||
193 | parent_node = acpi_ns_get_parent_node(node); | 193 | parent_node = node->parent; |
194 | *ret_handle = ACPI_CAST_PTR(acpi_handle, parent_node); | 194 | *ret_handle = ACPI_CAST_PTR(acpi_handle, parent_node); |
195 | 195 | ||
196 | /* Return exception if parent is null */ | 196 | /* Return exception if parent is null */ |
diff --git a/drivers/acpi/acpica/utglobal.c b/drivers/acpi/acpica/utglobal.c index 66116750a0f9..0558747579ef 100644 --- a/drivers/acpi/acpica/utglobal.c +++ b/drivers/acpi/acpica/utglobal.c | |||
@@ -813,10 +813,10 @@ acpi_status acpi_ut_init_globals(void) | |||
813 | acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME; | 813 | acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME; |
814 | acpi_gbl_root_node_struct.descriptor_type = ACPI_DESC_TYPE_NAMED; | 814 | acpi_gbl_root_node_struct.descriptor_type = ACPI_DESC_TYPE_NAMED; |
815 | acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE; | 815 | acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE; |
816 | acpi_gbl_root_node_struct.parent = NULL; | ||
816 | acpi_gbl_root_node_struct.child = NULL; | 817 | acpi_gbl_root_node_struct.child = NULL; |
817 | acpi_gbl_root_node_struct.peer = NULL; | 818 | acpi_gbl_root_node_struct.peer = NULL; |
818 | acpi_gbl_root_node_struct.object = NULL; | 819 | acpi_gbl_root_node_struct.object = NULL; |
819 | acpi_gbl_root_node_struct.flags = ANOBJ_END_OF_PEER_LIST; | ||
820 | 820 | ||
821 | #ifdef ACPI_DEBUG_OUTPUT | 821 | #ifdef ACPI_DEBUG_OUTPUT |
822 | acpi_gbl_lowest_stack_pointer = ACPI_CAST_PTR(acpi_size, ACPI_SIZE_MAX); | 822 | acpi_gbl_lowest_stack_pointer = ACPI_CAST_PTR(acpi_size, ACPI_SIZE_MAX); |
diff --git a/drivers/acpi/acpica/utxface.c b/drivers/acpi/acpica/utxface.c index db9d8ca57987..7f8cefcb2b32 100644 --- a/drivers/acpi/acpica/utxface.c +++ b/drivers/acpi/acpica/utxface.c | |||
@@ -293,12 +293,8 @@ acpi_status acpi_initialize_objects(u32 flags) | |||
293 | * Complete the GPE initialization for the GPE blocks defined in the FADT | 293 | * Complete the GPE initialization for the GPE blocks defined in the FADT |
294 | * (GPE block 0 and 1). | 294 | * (GPE block 0 and 1). |
295 | * | 295 | * |
296 | * Note1: This is where the _PRW methods are executed for the GPEs. These | 296 | * NOTE: Currently, there seems to be no need to run the _REG methods |
297 | * methods can only be executed after the SCI and Global Lock handlers are | 297 | * before enabling the GPEs. |
298 | * installed and initialized. | ||
299 | * | ||
300 | * Note2: Currently, there seems to be no need to run the _REG methods | ||
301 | * before execution of the _PRW methods and enabling of the GPEs. | ||
302 | */ | 298 | */ |
303 | if (!(flags & ACPI_NO_EVENT_INIT)) { | 299 | if (!(flags & ACPI_NO_EVENT_INIT)) { |
304 | status = acpi_ev_install_fadt_gpes(); | 300 | status = acpi_ev_install_fadt_gpes(); |
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 7d857dabdde4..1575a9b51f1d 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
@@ -424,8 +424,7 @@ static int acpi_button_add(struct acpi_device *device) | |||
424 | if (device->wakeup.flags.valid) { | 424 | if (device->wakeup.flags.valid) { |
425 | /* Button's GPE is run-wake GPE */ | 425 | /* Button's GPE is run-wake GPE */ |
426 | acpi_enable_gpe(device->wakeup.gpe_device, | 426 | acpi_enable_gpe(device->wakeup.gpe_device, |
427 | device->wakeup.gpe_number, | 427 | device->wakeup.gpe_number); |
428 | ACPI_GPE_TYPE_RUNTIME); | ||
429 | device->wakeup.run_wake_count++; | 428 | device->wakeup.run_wake_count++; |
430 | device->wakeup.state.enabled = 1; | 429 | device->wakeup.state.enabled = 1; |
431 | } | 430 | } |
@@ -448,8 +447,7 @@ static int acpi_button_remove(struct acpi_device *device, int type) | |||
448 | 447 | ||
449 | if (device->wakeup.flags.valid) { | 448 | if (device->wakeup.flags.valid) { |
450 | acpi_disable_gpe(device->wakeup.gpe_device, | 449 | acpi_disable_gpe(device->wakeup.gpe_device, |
451 | device->wakeup.gpe_number, | 450 | device->wakeup.gpe_number); |
452 | ACPI_GPE_TYPE_RUNTIME); | ||
453 | device->wakeup.run_wake_count--; | 451 | device->wakeup.run_wake_count--; |
454 | device->wakeup.state.enabled = 0; | 452 | device->wakeup.state.enabled = 0; |
455 | } | 453 | } |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 5f2027d782e8..1e6d4184f0ea 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -313,11 +313,8 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t) | |||
313 | pr_debug(PREFIX "transaction start\n"); | 313 | pr_debug(PREFIX "transaction start\n"); |
314 | /* disable GPE during transaction if storm is detected */ | 314 | /* disable GPE during transaction if storm is detected */ |
315 | if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { | 315 | if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { |
316 | /* | 316 | /* It has to be disabled, so that it doesn't trigger. */ |
317 | * It has to be disabled at the hardware level regardless of the | 317 | acpi_disable_gpe(NULL, ec->gpe); |
318 | * GPE reference counting, so that it doesn't trigger. | ||
319 | */ | ||
320 | acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_DISABLE); | ||
321 | } | 318 | } |
322 | 319 | ||
323 | status = acpi_ec_transaction_unlocked(ec, t); | 320 | status = acpi_ec_transaction_unlocked(ec, t); |
@@ -326,12 +323,8 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t) | |||
326 | ec_check_sci_sync(ec, acpi_ec_read_status(ec)); | 323 | ec_check_sci_sync(ec, acpi_ec_read_status(ec)); |
327 | if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { | 324 | if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { |
328 | msleep(1); | 325 | msleep(1); |
329 | /* | 326 | /* It is safe to enable the GPE outside of the transaction. */ |
330 | * It is safe to enable the GPE outside of the transaction. Use | 327 | acpi_enable_gpe(NULL, ec->gpe); |
331 | * acpi_set_gpe() for that, since we used it to disable the GPE | ||
332 | * above. | ||
333 | */ | ||
334 | acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_ENABLE); | ||
335 | } else if (t->irq_count > ACPI_EC_STORM_THRESHOLD) { | 328 | } else if (t->irq_count > ACPI_EC_STORM_THRESHOLD) { |
336 | pr_info(PREFIX "GPE storm detected, " | 329 | pr_info(PREFIX "GPE storm detected, " |
337 | "transactions will use polling mode\n"); | 330 | "transactions will use polling mode\n"); |
@@ -822,7 +815,7 @@ static int ec_install_handlers(struct acpi_ec *ec) | |||
822 | if (ACPI_FAILURE(status)) | 815 | if (ACPI_FAILURE(status)) |
823 | return -ENODEV; | 816 | return -ENODEV; |
824 | 817 | ||
825 | acpi_enable_gpe(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME); | 818 | acpi_enable_gpe(NULL, ec->gpe); |
826 | status = acpi_install_address_space_handler(ec->handle, | 819 | status = acpi_install_address_space_handler(ec->handle, |
827 | ACPI_ADR_SPACE_EC, | 820 | ACPI_ADR_SPACE_EC, |
828 | &acpi_ec_space_handler, | 821 | &acpi_ec_space_handler, |
@@ -839,7 +832,7 @@ static int ec_install_handlers(struct acpi_ec *ec) | |||
839 | } else { | 832 | } else { |
840 | acpi_remove_gpe_handler(NULL, ec->gpe, | 833 | acpi_remove_gpe_handler(NULL, ec->gpe, |
841 | &acpi_ec_gpe_handler); | 834 | &acpi_ec_gpe_handler); |
842 | acpi_disable_gpe(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME); | 835 | acpi_disable_gpe(NULL, ec->gpe); |
843 | return -ENODEV; | 836 | return -ENODEV; |
844 | } | 837 | } |
845 | } | 838 | } |
@@ -850,7 +843,7 @@ static int ec_install_handlers(struct acpi_ec *ec) | |||
850 | 843 | ||
851 | static void ec_remove_handlers(struct acpi_ec *ec) | 844 | static void ec_remove_handlers(struct acpi_ec *ec) |
852 | { | 845 | { |
853 | acpi_disable_gpe(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME); | 846 | acpi_disable_gpe(NULL, ec->gpe); |
854 | if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle, | 847 | if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle, |
855 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler))) | 848 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler))) |
856 | pr_err(PREFIX "failed to remove space handler\n"); | 849 | pr_err(PREFIX "failed to remove space handler\n"); |
@@ -1088,22 +1081,6 @@ error: | |||
1088 | return -ENODEV; | 1081 | return -ENODEV; |
1089 | } | 1082 | } |
1090 | 1083 | ||
1091 | static int acpi_ec_suspend(struct acpi_device *device, pm_message_t state) | ||
1092 | { | ||
1093 | struct acpi_ec *ec = acpi_driver_data(device); | ||
1094 | /* Stop using the GPE, but keep it reference counted. */ | ||
1095 | acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_DISABLE); | ||
1096 | return 0; | ||
1097 | } | ||
1098 | |||
1099 | static int acpi_ec_resume(struct acpi_device *device) | ||
1100 | { | ||
1101 | struct acpi_ec *ec = acpi_driver_data(device); | ||
1102 | /* Enable the GPE again, but don't reference count it once more. */ | ||
1103 | acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_ENABLE); | ||
1104 | return 0; | ||
1105 | } | ||
1106 | |||
1107 | static struct acpi_driver acpi_ec_driver = { | 1084 | static struct acpi_driver acpi_ec_driver = { |
1108 | .name = "ec", | 1085 | .name = "ec", |
1109 | .class = ACPI_EC_CLASS, | 1086 | .class = ACPI_EC_CLASS, |
@@ -1111,8 +1088,6 @@ static struct acpi_driver acpi_ec_driver = { | |||
1111 | .ops = { | 1088 | .ops = { |
1112 | .add = acpi_ec_add, | 1089 | .add = acpi_ec_add, |
1113 | .remove = acpi_ec_remove, | 1090 | .remove = acpi_ec_remove, |
1114 | .suspend = acpi_ec_suspend, | ||
1115 | .resume = acpi_ec_resume, | ||
1116 | }, | 1091 | }, |
1117 | }; | 1092 | }; |
1118 | 1093 | ||
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 78418ce4fc78..44bddc5bc6ad 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -1064,26 +1064,6 @@ static int __init acpi_serialize_setup(char *str) | |||
1064 | 1064 | ||
1065 | __setup("acpi_serialize", acpi_serialize_setup); | 1065 | __setup("acpi_serialize", acpi_serialize_setup); |
1066 | 1066 | ||
1067 | /* | ||
1068 | * Wake and Run-Time GPES are expected to be separate. | ||
1069 | * We disable wake-GPEs at run-time to prevent spurious | ||
1070 | * interrupts. | ||
1071 | * | ||
1072 | * However, if a system exists that shares Wake and | ||
1073 | * Run-time events on the same GPE this flag is available | ||
1074 | * to tell Linux to keep the wake-time GPEs enabled at run-time. | ||
1075 | */ | ||
1076 | static int __init acpi_wake_gpes_always_on_setup(char *str) | ||
1077 | { | ||
1078 | printk(KERN_INFO PREFIX "wake GPEs not disabled\n"); | ||
1079 | |||
1080 | acpi_gbl_leave_wake_gpes_disabled = FALSE; | ||
1081 | |||
1082 | return 1; | ||
1083 | } | ||
1084 | |||
1085 | __setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup); | ||
1086 | |||
1087 | /* Check of resource interference between native drivers and ACPI | 1067 | /* Check of resource interference between native drivers and ACPI |
1088 | * OperationRegions (SystemIO and System Memory only). | 1068 | * OperationRegions (SystemIO and System Memory only). |
1089 | * IO ports and memory declared in ACPI might be used by the ACPI subsystem | 1069 | * IO ports and memory declared in ACPI might be used by the ACPI subsystem |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 7f2e051ed4f1..b23825ecfa37 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -740,6 +740,8 @@ acpi_bus_extract_wakeup_device_power_package(struct acpi_device *device, | |||
740 | device->wakeup.resources.handles[i] = element->reference.handle; | 740 | device->wakeup.resources.handles[i] = element->reference.handle; |
741 | } | 741 | } |
742 | 742 | ||
743 | acpi_gpe_can_wake(device->wakeup.gpe_device, device->wakeup.gpe_number); | ||
744 | |||
743 | return AE_OK; | 745 | return AE_OK; |
744 | } | 746 | } |
745 | 747 | ||
@@ -764,8 +766,9 @@ static void acpi_bus_set_run_wake_flags(struct acpi_device *device) | |||
764 | return; | 766 | return; |
765 | } | 767 | } |
766 | 768 | ||
767 | status = acpi_get_gpe_status(NULL, device->wakeup.gpe_number, | 769 | status = acpi_get_gpe_status(device->wakeup.gpe_device, |
768 | &event_status); | 770 | device->wakeup.gpe_number, |
771 | &event_status); | ||
769 | if (status == AE_OK) | 772 | if (status == AE_OK) |
770 | device->wakeup.flags.run_wake = | 773 | device->wakeup.flags.run_wake = |
771 | !!(event_status & ACPI_EVENT_FLAG_HANDLE); | 774 | !!(event_status & ACPI_EVENT_FLAG_HANDLE); |
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index e4625f919814..cf82989ae756 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
@@ -646,18 +646,9 @@ int acpi_pm_device_sleep_wake(struct device *dev, bool enable) | |||
646 | return -ENODEV; | 646 | return -ENODEV; |
647 | } | 647 | } |
648 | 648 | ||
649 | if (enable) { | 649 | error = enable ? |
650 | error = acpi_enable_wakeup_device_power(adev, | 650 | acpi_enable_wakeup_device_power(adev, acpi_target_sleep_state) : |
651 | acpi_target_sleep_state); | 651 | acpi_disable_wakeup_device_power(adev); |
652 | if (!error) | ||
653 | acpi_enable_gpe(adev->wakeup.gpe_device, | ||
654 | adev->wakeup.gpe_number, | ||
655 | ACPI_GPE_TYPE_WAKE); | ||
656 | } else { | ||
657 | acpi_disable_gpe(adev->wakeup.gpe_device, adev->wakeup.gpe_number, | ||
658 | ACPI_GPE_TYPE_WAKE); | ||
659 | error = acpi_disable_wakeup_device_power(adev); | ||
660 | } | ||
661 | if (!error) | 652 | if (!error) |
662 | dev_info(dev, "wake-up capability %s by ACPI\n", | 653 | dev_info(dev, "wake-up capability %s by ACPI\n", |
663 | enable ? "enabled" : "disabled"); | 654 | enable ? "enabled" : "disabled"); |
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index f8db50a0941c..5981bd07e20e 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c | |||
@@ -388,12 +388,10 @@ static ssize_t counter_set(struct kobject *kobj, | |||
388 | if (index < num_gpes) { | 388 | if (index < num_gpes) { |
389 | if (!strcmp(buf, "disable\n") && | 389 | if (!strcmp(buf, "disable\n") && |
390 | (status & ACPI_EVENT_FLAG_ENABLED)) | 390 | (status & ACPI_EVENT_FLAG_ENABLED)) |
391 | result = acpi_disable_gpe(handle, index, | 391 | result = acpi_disable_gpe(handle, index); |
392 | ACPI_GPE_TYPE_RUNTIME); | ||
393 | else if (!strcmp(buf, "enable\n") && | 392 | else if (!strcmp(buf, "enable\n") && |
394 | !(status & ACPI_EVENT_FLAG_ENABLED)) | 393 | !(status & ACPI_EVENT_FLAG_ENABLED)) |
395 | result = acpi_enable_gpe(handle, index, | 394 | result = acpi_enable_gpe(handle, index); |
396 | ACPI_GPE_TYPE_RUNTIME); | ||
397 | else if (!strcmp(buf, "clear\n") && | 395 | else if (!strcmp(buf, "clear\n") && |
398 | (status & ACPI_EVENT_FLAG_SET)) | 396 | (status & ACPI_EVENT_FLAG_SET)) |
399 | result = acpi_clear_gpe(handle, index); | 397 | result = acpi_clear_gpe(handle, index); |
diff --git a/drivers/acpi/wakeup.c b/drivers/acpi/wakeup.c index dc6d1d9112fb..f62a50c3ed34 100644 --- a/drivers/acpi/wakeup.c +++ b/drivers/acpi/wakeup.c | |||
@@ -36,7 +36,8 @@ void acpi_enable_wakeup_devices(u8 sleep_state) | |||
36 | struct acpi_device *dev = | 36 | struct acpi_device *dev = |
37 | container_of(node, struct acpi_device, wakeup_list); | 37 | container_of(node, struct acpi_device, wakeup_list); |
38 | 38 | ||
39 | if (!dev->wakeup.flags.valid || !dev->wakeup.state.enabled | 39 | if (!dev->wakeup.flags.valid |
40 | || !(dev->wakeup.state.enabled || dev->wakeup.prepare_count) | ||
40 | || sleep_state > (u32) dev->wakeup.sleep_state) | 41 | || sleep_state > (u32) dev->wakeup.sleep_state) |
41 | continue; | 42 | continue; |
42 | 43 | ||
@@ -44,8 +45,8 @@ void acpi_enable_wakeup_devices(u8 sleep_state) | |||
44 | acpi_enable_wakeup_device_power(dev, sleep_state); | 45 | acpi_enable_wakeup_device_power(dev, sleep_state); |
45 | 46 | ||
46 | /* The wake-up power should have been enabled already. */ | 47 | /* The wake-up power should have been enabled already. */ |
47 | acpi_enable_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number, | 48 | acpi_gpe_wakeup(dev->wakeup.gpe_device, dev->wakeup.gpe_number, |
48 | ACPI_GPE_TYPE_WAKE); | 49 | ACPI_GPE_ENABLE); |
49 | } | 50 | } |
50 | } | 51 | } |
51 | 52 | ||
@@ -61,13 +62,16 @@ void acpi_disable_wakeup_devices(u8 sleep_state) | |||
61 | struct acpi_device *dev = | 62 | struct acpi_device *dev = |
62 | container_of(node, struct acpi_device, wakeup_list); | 63 | container_of(node, struct acpi_device, wakeup_list); |
63 | 64 | ||
64 | if (!dev->wakeup.flags.valid || !dev->wakeup.state.enabled | 65 | if (!dev->wakeup.flags.valid |
66 | || !(dev->wakeup.state.enabled || dev->wakeup.prepare_count) | ||
65 | || (sleep_state > (u32) dev->wakeup.sleep_state)) | 67 | || (sleep_state > (u32) dev->wakeup.sleep_state)) |
66 | continue; | 68 | continue; |
67 | 69 | ||
68 | acpi_disable_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number, | 70 | acpi_gpe_wakeup(dev->wakeup.gpe_device, dev->wakeup.gpe_number, |
69 | ACPI_GPE_TYPE_WAKE); | 71 | ACPI_GPE_DISABLE); |
70 | acpi_disable_wakeup_device_power(dev); | 72 | |
73 | if (dev->wakeup.state.enabled) | ||
74 | acpi_disable_wakeup_device_power(dev); | ||
71 | } | 75 | } |
72 | } | 76 | } |
73 | 77 | ||
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 2e7a3bf13824..5342e037e37f 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -295,14 +295,12 @@ static int acpi_dev_run_wake(struct device *phys_dev, bool enable) | |||
295 | if (!dev->wakeup.run_wake_count++) { | 295 | if (!dev->wakeup.run_wake_count++) { |
296 | acpi_enable_wakeup_device_power(dev, ACPI_STATE_S0); | 296 | acpi_enable_wakeup_device_power(dev, ACPI_STATE_S0); |
297 | acpi_enable_gpe(dev->wakeup.gpe_device, | 297 | acpi_enable_gpe(dev->wakeup.gpe_device, |
298 | dev->wakeup.gpe_number, | 298 | dev->wakeup.gpe_number); |
299 | ACPI_GPE_TYPE_RUNTIME); | ||
300 | } | 299 | } |
301 | } else if (dev->wakeup.run_wake_count > 0) { | 300 | } else if (dev->wakeup.run_wake_count > 0) { |
302 | if (!--dev->wakeup.run_wake_count) { | 301 | if (!--dev->wakeup.run_wake_count) { |
303 | acpi_disable_gpe(dev->wakeup.gpe_device, | 302 | acpi_disable_gpe(dev->wakeup.gpe_device, |
304 | dev->wakeup.gpe_number, | 303 | dev->wakeup.gpe_number); |
305 | ACPI_GPE_TYPE_RUNTIME); | ||
306 | acpi_disable_wakeup_device_power(dev); | 304 | acpi_disable_wakeup_device_power(dev); |
307 | } | 305 | } |
308 | } else { | 306 | } else { |
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h index 5e952262d6ee..bc4a6deb73b0 100644 --- a/include/acpi/acoutput.h +++ b/include/acpi/acoutput.h | |||
@@ -71,8 +71,9 @@ | |||
71 | #define ACPI_TOOLS 0x00002000 | 71 | #define ACPI_TOOLS 0x00002000 |
72 | #define ACPI_EXAMPLE 0x00004000 | 72 | #define ACPI_EXAMPLE 0x00004000 |
73 | #define ACPI_DRIVER 0x00008000 | 73 | #define ACPI_DRIVER 0x00008000 |
74 | #define DT_COMPILER 0x00010000 | ||
74 | 75 | ||
75 | #define ACPI_ALL_COMPONENTS 0x0000FFFF | 76 | #define ACPI_ALL_COMPONENTS 0x0001FFFF |
76 | #define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS) | 77 | #define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS) |
77 | 78 | ||
78 | /* Component IDs reserved for ACPI drivers */ | 79 | /* Component IDs reserved for ACPI drivers */ |
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index a6ea2ac40b9c..c0786d446a00 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h | |||
@@ -47,7 +47,7 @@ | |||
47 | 47 | ||
48 | /* Current ACPICA subsystem version in YYYYMMDD format */ | 48 | /* Current ACPICA subsystem version in YYYYMMDD format */ |
49 | 49 | ||
50 | #define ACPI_CA_VERSION 0x20100428 | 50 | #define ACPI_CA_VERSION 0x20100702 |
51 | 51 | ||
52 | #include "actypes.h" | 52 | #include "actypes.h" |
53 | #include "actbl.h" | 53 | #include "actbl.h" |
@@ -63,7 +63,6 @@ extern u32 acpi_dbg_layer; | |||
63 | extern u8 acpi_gbl_enable_interpreter_slack; | 63 | extern u8 acpi_gbl_enable_interpreter_slack; |
64 | extern u8 acpi_gbl_all_methods_serialized; | 64 | extern u8 acpi_gbl_all_methods_serialized; |
65 | extern u8 acpi_gbl_create_osi_method; | 65 | extern u8 acpi_gbl_create_osi_method; |
66 | extern u8 acpi_gbl_leave_wake_gpes_disabled; | ||
67 | extern u8 acpi_gbl_use_default_register_widths; | 66 | extern u8 acpi_gbl_use_default_register_widths; |
68 | extern acpi_name acpi_gbl_trace_method_name; | 67 | extern acpi_name acpi_gbl_trace_method_name; |
69 | extern u32 acpi_gbl_trace_flags; | 68 | extern u32 acpi_gbl_trace_flags; |
@@ -282,16 +281,16 @@ acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status); | |||
282 | /* | 281 | /* |
283 | * GPE Interfaces | 282 | * GPE Interfaces |
284 | */ | 283 | */ |
285 | acpi_status acpi_set_gpe(acpi_handle gpe_device, u32 gpe_number, u8 action); | 284 | acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number); |
286 | 285 | ||
287 | acpi_status | 286 | acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number); |
288 | acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type); | ||
289 | 287 | ||
290 | acpi_status | 288 | acpi_status acpi_gpe_can_wake(acpi_handle gpe_device, u32 gpe_number); |
291 | acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type); | ||
292 | 289 | ||
293 | acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number); | 290 | acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number); |
294 | 291 | ||
292 | acpi_status acpi_gpe_wakeup(acpi_handle gpe_device, u32 gpe_number, u8 action); | ||
293 | |||
295 | acpi_status | 294 | acpi_status |
296 | acpi_get_gpe_status(acpi_handle gpe_device, | 295 | acpi_get_gpe_status(acpi_handle gpe_device, |
297 | u32 gpe_number, acpi_event_status *event_status); | 296 | u32 gpe_number, acpi_event_status *event_status); |
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index 95f4d0ef4819..d4136b28011f 100644 --- a/include/acpi/actbl2.h +++ b/include/acpi/actbl2.h | |||
@@ -77,8 +77,18 @@ | |||
77 | #define ACPI_SIG_UEFI "UEFI" /* Uefi Boot Optimization Table */ | 77 | #define ACPI_SIG_UEFI "UEFI" /* Uefi Boot Optimization Table */ |
78 | #define ACPI_SIG_WAET "WAET" /* Windows ACPI Emulated devices Table */ | 78 | #define ACPI_SIG_WAET "WAET" /* Windows ACPI Emulated devices Table */ |
79 | #define ACPI_SIG_WDAT "WDAT" /* Watchdog Action Table */ | 79 | #define ACPI_SIG_WDAT "WDAT" /* Watchdog Action Table */ |
80 | #define ACPI_SIG_WDDT "WDDT" /* Watchdog Timer Description Table */ | ||
80 | #define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */ | 81 | #define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */ |
81 | 82 | ||
83 | #ifdef ACPI_UNDEFINED_TABLES | ||
84 | /* | ||
85 | * These tables have been seen in the field, but no definition has been found | ||
86 | */ | ||
87 | #define ACPI_SIG_ATKG "ATKG" | ||
88 | #define ACPI_SIG_GSCI "GSCI" /* GMCH SCI table */ | ||
89 | #define ACPI_SIG_IEIT "IEIT" | ||
90 | #endif | ||
91 | |||
82 | /* | 92 | /* |
83 | * All tables must be byte-packed to match the ACPI specification, since | 93 | * All tables must be byte-packed to match the ACPI specification, since |
84 | * the tables are provided by the system BIOS. | 94 | * the tables are provided by the system BIOS. |
@@ -909,6 +919,44 @@ enum acpi_wdat_instructions { | |||
909 | 919 | ||
910 | /******************************************************************************* | 920 | /******************************************************************************* |
911 | * | 921 | * |
922 | * WDDT - Watchdog Descriptor Table | ||
923 | * Version 1 | ||
924 | * | ||
925 | * Conforms to "Using the Intel ICH Family Watchdog Timer (WDT)", | ||
926 | * Version 001, September 2002 | ||
927 | * | ||
928 | ******************************************************************************/ | ||
929 | |||
930 | struct acpi_table_wddt { | ||
931 | struct acpi_table_header header; /* Common ACPI table header */ | ||
932 | u16 spec_version; | ||
933 | u16 table_version; | ||
934 | u16 pci_vendor_id; | ||
935 | struct acpi_generic_address address; | ||
936 | u16 max_count; /* Maximum counter value supported */ | ||
937 | u16 min_count; /* Minimum counter value supported */ | ||
938 | u16 period; | ||
939 | u16 status; | ||
940 | u16 capability; | ||
941 | }; | ||
942 | |||
943 | /* Flags for Status field above */ | ||
944 | |||
945 | #define ACPI_WDDT_AVAILABLE (1) | ||
946 | #define ACPI_WDDT_ACTIVE (1<<1) | ||
947 | #define ACPI_WDDT_TCO_OS_OWNED (1<<2) | ||
948 | #define ACPI_WDDT_USER_RESET (1<<11) | ||
949 | #define ACPI_WDDT_WDT_RESET (1<<12) | ||
950 | #define ACPI_WDDT_POWER_FAIL (1<<13) | ||
951 | #define ACPI_WDDT_UNKNOWN_RESET (1<<14) | ||
952 | |||
953 | /* Flags for Capability field above */ | ||
954 | |||
955 | #define ACPI_WDDT_AUTO_RESET (1) | ||
956 | #define ACPI_WDDT_ALERT_SUPPORT (1<<1) | ||
957 | |||
958 | /******************************************************************************* | ||
959 | * | ||
912 | * WDRT - Watchdog Resource Table | 960 | * WDRT - Watchdog Resource Table |
913 | * Version 1 | 961 | * Version 1 |
914 | * | 962 | * |
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index d55f4a7b824d..5db8f472fec9 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h | |||
@@ -663,18 +663,12 @@ typedef u32 acpi_event_status; | |||
663 | #define ACPI_GPE_MAX 0xFF | 663 | #define ACPI_GPE_MAX 0xFF |
664 | #define ACPI_NUM_GPE 256 | 664 | #define ACPI_NUM_GPE 256 |
665 | 665 | ||
666 | /* Actions for acpi_set_gpe and acpi_hw_low_set_gpe */ | 666 | /* Actions for acpi_gpe_wakeup, acpi_hw_low_set_gpe */ |
667 | 667 | ||
668 | #define ACPI_GPE_ENABLE 0 | 668 | #define ACPI_GPE_ENABLE 0 |
669 | #define ACPI_GPE_DISABLE 1 | 669 | #define ACPI_GPE_DISABLE 1 |
670 | #define ACPI_GPE_COND_ENABLE 2 | 670 | #define ACPI_GPE_COND_ENABLE 2 |
671 | 671 | ||
672 | /* gpe_types for acpi_enable_gpe and acpi_disable_gpe */ | ||
673 | |||
674 | #define ACPI_GPE_TYPE_WAKE (u8) 0x01 | ||
675 | #define ACPI_GPE_TYPE_RUNTIME (u8) 0x02 | ||
676 | #define ACPI_GPE_TYPE_WAKE_RUN (u8) 0x03 | ||
677 | |||
678 | /* | 672 | /* |
679 | * GPE info flags - Per GPE | 673 | * GPE info flags - Per GPE |
680 | * +-------+---+-+-+ | 674 | * +-------+---+-+-+ |