Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/acpi acpi: ged: Mask interrupts before dispatching h...
details: https://anonhg.NetBSD.org/src/rev/ae04bdef32aa
branches: trunk
changeset: 359585:ae04bdef32aa
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Tue Jan 11 10:53:08 2022 +0000
description:
acpi: ged: Mask interrupts before dispatching handler
For the benefit of GEDs backed by level interrupts, mask the interrupt
source before dispatching the handler to a worker thread and unmask it
after it has been handled.
diffstat:
sys/dev/acpi/acpi_event.c | 26 +++++++++++++++++++++++---
sys/dev/acpi/acpi_event.h | 3 ++-
sys/dev/acpi/acpi_ged.c | 5 +++--
3 files changed, 28 insertions(+), 6 deletions(-)
diffs (115 lines):
diff -r c9afcc398414 -r ae04bdef32aa sys/dev/acpi/acpi_event.c
--- a/sys/dev/acpi/acpi_event.c Tue Jan 11 10:07:23 2022 +0000
+++ b/sys/dev/acpi/acpi_event.c Tue Jan 11 10:53:08 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_event.c,v 1.1 2018/10/22 22:29:35 jmcneill Exp $ */
+/* $NetBSD: acpi_event.c,v 1.2 2022/01/11 10:53:08 jmcneill Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_event.c,v 1.1 2018/10/22 22:29:35 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_event.c,v 1.2 2022/01/11 10:53:08 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -40,12 +40,14 @@
#include <dev/acpi/acpireg.h>
#include <dev/acpi/acpivar.h>
#include <dev/acpi/acpi_event.h>
+#include <dev/acpi/acpi_intr.h>
struct acpi_event {
device_t ev_dev;
ACPI_HANDLE ev_method;
bool ev_method_evt;
UINT16 ev_data;
+ void *ev_intrcookie;
};
struct acpi_event_gpio_context {
@@ -68,6 +70,7 @@
ev->ev_method = NULL;
ev->ev_method_evt = false;
ev->ev_data = data;
+ ev->ev_intrcookie = NULL;
if (data <= 255) {
snprintf(namebuf, sizeof(namebuf), "_%c%02X", trigchar, data);
@@ -169,13 +172,30 @@
}
rv = AcpiEvaluateObject(ev->ev_method, NULL, arg, NULL);
- if (ACPI_FAILURE(rv))
+ if (ACPI_FAILURE(rv)) {
device_printf(ev->ev_dev, "failed to handle %s event: %s\n",
acpi_name(ev->ev_method), AcpiFormatException(rv));
+ }
+
+ if (ev->ev_intrcookie != NULL) {
+ acpi_intr_unmask(ev->ev_intrcookie);
+ }
}
ACPI_STATUS
acpi_event_notify(struct acpi_event *ev)
{
+ if (ev->ev_intrcookie != NULL) {
+ acpi_intr_mask(ev->ev_intrcookie);
+ }
+
return AcpiOsExecute(OSL_NOTIFY_HANDLER, acpi_event_invoke, ev);
}
+
+void
+acpi_event_set_intrcookie(struct acpi_event *ev, void *intrcookie)
+{
+ KASSERT(ev->ev_intrcookie == NULL);
+
+ ev->ev_intrcookie = intrcookie;
+}
diff -r c9afcc398414 -r ae04bdef32aa sys/dev/acpi/acpi_event.h
--- a/sys/dev/acpi/acpi_event.h Tue Jan 11 10:07:23 2022 +0000
+++ b/sys/dev/acpi/acpi_event.h Tue Jan 11 10:53:08 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_event.h,v 1.1 2018/10/22 22:29:35 jmcneill Exp $ */
+/* $NetBSD: acpi_event.h,v 1.2 2022/01/11 10:53:08 jmcneill Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -39,5 +39,6 @@
ACPI_STATUS acpi_event_create_int(device_t, ACPI_HANDLE,
void (*)(void *, struct acpi_event *, struct acpi_irq *), void *);
ACPI_STATUS acpi_event_notify(struct acpi_event *);
+void acpi_event_set_intrcookie(struct acpi_event *, void *);
#endif /* !_DEV_ACPI_ACPI_EVENT_H */
diff -r c9afcc398414 -r ae04bdef32aa sys/dev/acpi/acpi_ged.c
--- a/sys/dev/acpi/acpi_ged.c Tue Jan 11 10:07:23 2022 +0000
+++ b/sys/dev/acpi/acpi_ged.c Tue Jan 11 10:53:08 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_ged.c,v 1.3 2021/01/29 15:49:55 thorpej Exp $ */
+/* $NetBSD: acpi_ged.c,v 1.4 2022/01/11 10:53:08 jmcneill Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_ged.c,v 1.3 2021/01/29 15:49:55 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_ged.c,v 1.4 2022/01/11 10:53:08 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -87,6 +87,7 @@
aprint_error_dev(dev, "couldn't establish interrupt (irq %d)\n", irq->ar_irq);
return;
}
+ acpi_event_set_intrcookie(ev, ih);
}
static int
Home |
Main Index |
Thread Index |
Old Index