aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLv Zheng <lv.zheng@intel.com>2014-10-09 22:39:57 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-10-20 18:39:40 -0400
commita08f813e58169a8edd01e13d73f60d8561f3ecea (patch)
treed5babccd094445f556edc325f9520273c4b5257a
parent1809919a309dc8c8faad3c048bfda9a9f3fa0443 (diff)
ACPICA: Events: Reduce source code difference for the ACPI_EVENT_FLAG_HANDLE support.
This patch is a partial linuxized result of the following ACPICA commit: ACPICA commit: a73b66c6aa1846d055bb6390d9c9b9902f7d804d Subject: Add "has handler" flag to event/gpe status interfaces. This change adds a new flag, ACPI_EVENT_FLAGS_HAS_HANDLER to the acpi_get_event_status and acpi_get_gpe_status external interfaces. It is set if the event/gpe currently has a handler associated with it. This commit back ports ACPI_EVENT_FLAG_HANDLE from Linux upstream to ACPICA, the flag along with its support code currently can only be found in the Linux upstream and is used by the ACPI sysfs GPE interfaces and the ACPI bus scanning support. Link: https://github.com/acpica/acpica/commit/a73b66c6 Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/acpi/acpica/evxfevnt.c40
-rw-r--r--drivers/acpi/acpica/evxfgpe.c3
-rw-r--r--drivers/acpi/acpica/hwgpe.c7
-rw-r--r--include/acpi/actypes.h4
4 files changed, 35 insertions, 19 deletions
diff --git a/drivers/acpi/acpica/evxfevnt.c b/drivers/acpi/acpica/evxfevnt.c
index e286640ad4ff..a8a077c97187 100644
--- a/drivers/acpi/acpica/evxfevnt.c
+++ b/drivers/acpi/acpica/evxfevnt.c
@@ -324,8 +324,9 @@ ACPI_EXPORT_SYMBOL(acpi_clear_event)
324 ******************************************************************************/ 324 ******************************************************************************/
325acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status) 325acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status)
326{ 326{
327 acpi_status status = AE_OK; 327 acpi_status status;
328 u32 value; 328 acpi_event_status local_event_status = 0;
329 u32 in_byte;
329 330
330 ACPI_FUNCTION_TRACE(acpi_get_event_status); 331 ACPI_FUNCTION_TRACE(acpi_get_event_status);
331 332
@@ -339,29 +340,40 @@ acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status)
339 return_ACPI_STATUS(AE_BAD_PARAMETER); 340 return_ACPI_STATUS(AE_BAD_PARAMETER);
340 } 341 }
341 342
342 /* Get the status of the requested fixed event */ 343 /* Fixed event currently can be dispatched? */
344
345 if (acpi_gbl_fixed_event_handlers[event].handler) {
346 local_event_status |= ACPI_EVENT_FLAG_HANDLE;
347 }
348
349 /* Fixed event currently enabled? */
343 350
344 status = 351 status =
345 acpi_read_bit_register(acpi_gbl_fixed_event_info[event]. 352 acpi_read_bit_register(acpi_gbl_fixed_event_info[event].
346 enable_register_id, &value); 353 enable_register_id, &in_byte);
347 if (ACPI_FAILURE(status)) 354 if (ACPI_FAILURE(status)) {
348 return_ACPI_STATUS(status); 355 return_ACPI_STATUS(status);
356 }
349 357
350 *event_status = value; 358 if (in_byte) {
359 local_event_status |= ACPI_EVENT_FLAG_ENABLED;
360 }
361
362 /* Fixed event currently active? */
351 363
352 status = 364 status =
353 acpi_read_bit_register(acpi_gbl_fixed_event_info[event]. 365 acpi_read_bit_register(acpi_gbl_fixed_event_info[event].
354 status_register_id, &value); 366 status_register_id, &in_byte);
355 if (ACPI_FAILURE(status)) 367 if (ACPI_FAILURE(status)) {
356 return_ACPI_STATUS(status); 368 return_ACPI_STATUS(status);
369 }
357 370
358 if (value) 371 if (in_byte) {
359 *event_status |= ACPI_EVENT_FLAG_SET; 372 local_event_status |= ACPI_EVENT_FLAG_SET;
360 373 }
361 if (acpi_gbl_fixed_event_handlers[event].handler)
362 *event_status |= ACPI_EVENT_FLAG_HANDLE;
363 374
364 return_ACPI_STATUS(status); 375 (*event_status) = local_event_status;
376 return_ACPI_STATUS(AE_OK);
365} 377}
366 378
367ACPI_EXPORT_SYMBOL(acpi_get_event_status) 379ACPI_EXPORT_SYMBOL(acpi_get_event_status)
diff --git a/drivers/acpi/acpica/evxfgpe.c b/drivers/acpi/acpica/evxfgpe.c
index 2529d3c1c6b7..e889a5304abd 100644
--- a/drivers/acpi/acpica/evxfgpe.c
+++ b/drivers/acpi/acpica/evxfgpe.c
@@ -523,9 +523,6 @@ acpi_get_gpe_status(acpi_handle gpe_device,
523 523
524 status = acpi_hw_get_gpe_status(gpe_event_info, event_status); 524 status = acpi_hw_get_gpe_status(gpe_event_info, event_status);
525 525
526 if (gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK)
527 *event_status |= ACPI_EVENT_FLAG_HANDLE;
528
529unlock_and_exit: 526unlock_and_exit:
530 acpi_os_release_lock(acpi_gbl_gpe_lock, flags); 527 acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
531 return_ACPI_STATUS(status); 528 return_ACPI_STATUS(status);
diff --git a/drivers/acpi/acpica/hwgpe.c b/drivers/acpi/acpica/hwgpe.c
index aa884d42361c..0302bc36287b 100644
--- a/drivers/acpi/acpica/hwgpe.c
+++ b/drivers/acpi/acpica/hwgpe.c
@@ -216,6 +216,13 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info,
216 return (AE_BAD_PARAMETER); 216 return (AE_BAD_PARAMETER);
217 } 217 }
218 218
219 /* GPE currently handled? */
220
221 if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) !=
222 ACPI_GPE_DISPATCH_NONE) {
223 local_event_status |= ACPI_EVENT_FLAG_HANDLE;
224 }
225
219 /* Get the info block for the entire GPE register */ 226 /* Get the info block for the entire GPE register */
220 227
221 gpe_register_info = gpe_event_info->register_info; 228 gpe_register_info = gpe_event_info->register_info;
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index ac03ec81d342..857830d8989b 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -721,7 +721,7 @@ typedef u32 acpi_event_type;
721 * | | | +--- Enabled for wake? 721 * | | | +--- Enabled for wake?
722 * | | +----- Set? 722 * | | +----- Set?
723 * | +------- Has a handler? 723 * | +------- Has a handler?
724 * +----------- <Reserved> 724 * +------------- <Reserved>
725 */ 725 */
726typedef u32 acpi_event_status; 726typedef u32 acpi_event_status;
727 727
@@ -729,7 +729,7 @@ typedef u32 acpi_event_status;
729#define ACPI_EVENT_FLAG_ENABLED (acpi_event_status) 0x01 729#define ACPI_EVENT_FLAG_ENABLED (acpi_event_status) 0x01
730#define ACPI_EVENT_FLAG_WAKE_ENABLED (acpi_event_status) 0x02 730#define ACPI_EVENT_FLAG_WAKE_ENABLED (acpi_event_status) 0x02
731#define ACPI_EVENT_FLAG_SET (acpi_event_status) 0x04 731#define ACPI_EVENT_FLAG_SET (acpi_event_status) 0x04
732#define ACPI_EVENT_FLAG_HANDLE (acpi_event_status) 0x08 732#define ACPI_EVENT_FLAG_HANDLE (acpi_event_status) 0x08
733 733
734/* Actions for acpi_set_gpe, acpi_gpe_wakeup, acpi_hw_low_set_gpe */ 734/* Actions for acpi_set_gpe, acpi_gpe_wakeup, acpi_hw_low_set_gpe */
735 735