forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/drivers/acpi/acpica/evevent.c
....@@ -3,7 +3,7 @@
33 *
44 * Module Name: evevent - Fixed Event handling and dispatch
55 *
6
- * Copyright (C) 2000 - 2018, Intel Corp.
6
+ * Copyright (C) 2000 - 2020, Intel Corp.
77 *
88 *****************************************************************************/
99
....@@ -130,7 +130,7 @@
130130
131131 /*
132132 * Initialize the structure that keeps track of fixed event handlers and
133
- * enable the fixed events.
133
+ * disable all of the fixed events.
134134 */
135135 for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
136136 acpi_gbl_fixed_event_handlers[i].handler = NULL;
....@@ -265,4 +265,49 @@
265265 handler) (acpi_gbl_fixed_event_handlers[event].context));
266266 }
267267
268
+/*******************************************************************************
269
+ *
270
+ * FUNCTION: acpi_any_fixed_event_status_set
271
+ *
272
+ * PARAMETERS: None
273
+ *
274
+ * RETURN: TRUE or FALSE
275
+ *
276
+ * DESCRIPTION: Checks the PM status register for active fixed events
277
+ *
278
+ ******************************************************************************/
279
+
280
+u32 acpi_any_fixed_event_status_set(void)
281
+{
282
+ acpi_status status;
283
+ u32 in_status;
284
+ u32 in_enable;
285
+ u32 i;
286
+
287
+ status = acpi_hw_register_read(ACPI_REGISTER_PM1_ENABLE, &in_enable);
288
+ if (ACPI_FAILURE(status)) {
289
+ return (FALSE);
290
+ }
291
+
292
+ status = acpi_hw_register_read(ACPI_REGISTER_PM1_STATUS, &in_status);
293
+ if (ACPI_FAILURE(status)) {
294
+ return (FALSE);
295
+ }
296
+
297
+ /*
298
+ * Check for all possible Fixed Events and dispatch those that are active
299
+ */
300
+ for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
301
+
302
+ /* Both the status and enable bits must be on for this event */
303
+
304
+ if ((in_status & acpi_gbl_fixed_event_info[i].status_bit_mask) &&
305
+ (in_enable & acpi_gbl_fixed_event_info[i].enable_bit_mask)) {
306
+ return (TRUE);
307
+ }
308
+ }
309
+
310
+ return (FALSE);
311
+}
312
+
268313 #endif /* !ACPI_REDUCED_HARDWARE */