summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorpirofti <pirofti@openbsd.org>2013-01-18 06:02:51 +0000
committerpirofti <pirofti@openbsd.org>2013-01-18 06:02:51 +0000
commit8051d9981347f1d29f4543fab1ab9120d21e883a (patch)
tree3bb273a8c2832efd32ac05e9d46f6b6ae6acc5c9 /sys
parentConvert RAID1 to new ccb functions. (diff)
downloadwireguard-openbsd-8051d9981347f1d29f4543fab1ab9120d21e883a.tar.xz
wireguard-openbsd-8051d9981347f1d29f4543fab1ab9120d21e883a.zip
acpi: add acpiec_lock and acpi_unlock routines.
The routines check if the AML requires us to acquire the global lock by checking a flag stored in the soft state at attach and locks or unlocks if true. This is just building locking framework and is not hooked in any way to the kernel. Okay kettenis@.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/acpi/acpiec.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/sys/dev/acpi/acpiec.c b/sys/dev/acpi/acpiec.c
index e6a5e01854a..52ff105ee8f 100644
--- a/sys/dev/acpi/acpiec.c
+++ b/sys/dev/acpi/acpiec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpiec.c,v 1.46 2012/07/13 10:37:40 pirofti Exp $ */
+/* $OpenBSD: acpiec.c,v 1.47 2013/01/18 06:02:51 pirofti Exp $ */
/*
* Copyright (c) 2006 Can Erkin Acar <canacar@openbsd.org>
*
@@ -59,6 +59,9 @@ void acpiec_get_events(struct acpiec_softc *);
int acpiec_gpehandler(struct acpi_softc *, int, void *);
+void acpiec_lock(struct acpiec_softc *);
+void acpiec_unlock(struct acpiec_softc *);
+
/* EC Status bits */
#define EC_STAT_SMI_EVT 0x40 /* SMI event pending */
#define EC_STAT_SCI_EVT 0x20 /* SCI event pending */
@@ -524,3 +527,27 @@ acpiec_reg(struct acpiec_softc *sc)
return (0);
}
+
+void
+acpiec_lock(struct acpiec_softc *sc)
+{
+ KASSERT(sc->sc_ecbusy == 0);
+
+ sc->sc_ecbusy = 1;
+
+ if (sc->sc_glk) {
+ acpi_glk_enter();
+ }
+}
+
+void
+acpiec_unlock(struct acpiec_softc *sc)
+{
+ KASSERT(sc->sc_ecbusy == 1);
+
+ if (sc->sc_glk) {
+ acpi_glk_leave();
+ }
+
+ sc->sc_ecbusy = 0;
+}