DragonFly BSD
DragonFly submit List (threaded) for 2003-12
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

ACPI 20031203


From: Craig Dooley <cd5697@xxxxxxxxxx>
Date: Thu, 11 Dec 2003 21:14:19 -0500

Heres the patches to get the dragonfly kernel using ACPICA 20031203.
Directions:

1. Download http://developer.intel.com/technology/iapc/acpi/downloads/acpica-unix-20031203.tar.gz
2. run sys/contrib/dev/acpica/acpica_prep.sh on the archive
3. import the prepped sources into CVS
4. apply these two patches

This patch does not currently fix my ec0 problems, but it does give more
verbose output.  This only imports the sources.  Next will be merging
some of the FreeBSD5 support.  This patch did not lose any functionality
for me, but I'd like to know of any bugs this causes for anyone else.
Thanks

-Craig
-- 
------------------------------------------------------------------------
Craig Dooley                                            craig@xxxxxxxxxx
------------------------------------------------------------------------
--- sys/contrib/dev/acpica/acfreebsd.h	Thu Dec 11 20:02:52 2003
+++ sys/contrib/dev/acpica/acfreebsd.h	Wed Dec  3 16:35:05 2003
@@ -133,7 +133,7 @@
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/libkern.h>
-#include <machine/varargs.h>
+#include <machine/stdarg.h>
 
 #define asm         __asm
 #define __cli()     disable_intr()
Index: sys/dev/acpica/acpi.c
===================================================================
RCS file: /usr/srcs/dcvs/src/sys/dev/acpica/acpi.c,v
retrieving revision 1.2
diff -u -r1.2 acpi.c
--- sys/dev/acpica/acpi.c	9 Nov 2003 02:22:34 -0000	1.2
+++ sys/dev/acpica/acpi.c	12 Dec 2003 00:52:59 -0000
@@ -712,7 +712,8 @@
 acpi_isa_get_logicalid(device_t dev)
 {
     ACPI_HANDLE		h;
-    ACPI_DEVICE_INFO	devinfo;
+    ACPI_DEVICE_INFO devinfo;
+    ACPI_BUFFER		buf = {sizeof(devinfo), &devinfo};
     ACPI_STATUS		error;
     u_int32_t		pnpid;
     ACPI_LOCK_DECL;
@@ -725,12 +726,14 @@
     /* fetch and validate the HID */
     if ((h = acpi_get_handle(dev)) == NULL)
 	goto out;
-    if (ACPI_FAILURE(error = AcpiGetObjectInfo(h, &devinfo)))
+    error = AcpiGetObjectInfo(h, &buf);
+    if (ACPI_FAILURE(error))
 	goto out;
-    if (!(devinfo.Valid & ACPI_VALID_HID))
+    if ((devinfo.Valid & ACPI_VALID_HID) == 0)
 	goto out;
 
-    pnpid = PNP_EISAID(devinfo.HardwareId);
+    pnpid = PNP_EISAID(devinfo.HardwareId.Value);
+
 out:
     ACPI_UNLOCK;
     return_VALUE(pnpid);
@@ -740,7 +743,6 @@
 acpi_isa_get_compatid(device_t dev)
 {
     ACPI_HANDLE		h;
-    ACPI_DEVICE_INFO	devinfo;
     ACPI_STATUS		error;
     u_int32_t		pnpid;
     ACPI_LOCK_DECL;
@@ -753,8 +755,6 @@
     /* fetch and validate the HID */
     if ((h = acpi_get_handle(dev)) == NULL)
 	goto out;
-    if (ACPI_FAILURE(error = AcpiGetObjectInfo(h, &devinfo)))
-	goto out;
     if (ACPI_FAILURE(error = acpi_EvaluateInteger(h, "_CID", &pnpid)))
 	goto out;
 
@@ -965,21 +965,21 @@
 
     /* Enable and clear fixed events and install handlers. */
     if ((AcpiGbl_FADT != NULL) && (AcpiGbl_FADT->PwrButton == 0)) {
-	AcpiEnableEvent(ACPI_EVENT_POWER_BUTTON, ACPI_EVENT_FIXED, 0);
-	AcpiClearEvent(ACPI_EVENT_POWER_BUTTON, ACPI_EVENT_FIXED);
+	AcpiEnableEvent(ACPI_EVENT_POWER_BUTTON, 0);
+	AcpiClearEvent(ACPI_EVENT_POWER_BUTTON);
 	AcpiInstallFixedEventHandler(ACPI_EVENT_POWER_BUTTON,
 				     acpi_eventhandler_power_button_for_sleep, sc);
 	if (first_time) {
-	    device_printf(sc->acpi_dev, MSGFORMAT, "power");
+	    device_printf(sc->acpi_dev, "Power Button (fixed)\n");
 	}
     }
     if ((AcpiGbl_FADT != NULL) && (AcpiGbl_FADT->SleepButton == 0)) {
-	AcpiEnableEvent(ACPI_EVENT_SLEEP_BUTTON, ACPI_EVENT_FIXED, 0);
-	AcpiClearEvent(ACPI_EVENT_SLEEP_BUTTON, ACPI_EVENT_FIXED);
+	AcpiEnableEvent(ACPI_EVENT_SLEEP_BUTTON, 0);
+	AcpiClearEvent(ACPI_EVENT_SLEEP_BUTTON);
 	AcpiInstallFixedEventHandler(ACPI_EVENT_SLEEP_BUTTON,
 				     acpi_eventhandler_sleep_button_for_sleep, sc);
 	if (first_time) {
-	    device_printf(sc->acpi_dev, MSGFORMAT, "sleep");
+	    device_printf(sc->acpi_dev, "Sleep Button (fixed)\n");
 	}
     }
 
@@ -996,13 +996,14 @@
 {
     ACPI_HANDLE		h;
     ACPI_DEVICE_INFO	devinfo;
+    ACPI_BUFFER		buf = {sizeof(devinfo), &devinfo};
     ACPI_STATUS		error;
 
     ACPI_ASSERTLOCK;
     
     if ((h = acpi_get_handle(dev)) == NULL)
 	return(FALSE);
-    if (ACPI_FAILURE(error = AcpiGetObjectInfo(h, &devinfo)))
+    if (ACPI_FAILURE(error = AcpiGetObjectInfo(h, &buf)))
 	return(FALSE);
     /* if no _STA method, must be present */
     if (!(devinfo.Valid & ACPI_VALID_STA))
@@ -1021,13 +1022,14 @@
 {
     ACPI_HANDLE		h;
     ACPI_DEVICE_INFO	devinfo;
+    ACPI_BUFFER		buf = {sizeof(devinfo), &devinfo};
     ACPI_STATUS		error;
 
     ACPI_ASSERTLOCK;
     
     if ((h = acpi_get_handle(dev)) == NULL)
 	return(FALSE);
-    if (ACPI_FAILURE(error = AcpiGetObjectInfo(h, &devinfo)))
+    if (ACPI_FAILURE(error = AcpiGetObjectInfo(h, &buf)))
 	return(FALSE);
     /* if no _STA method, must be present */
     if (!(devinfo.Valid & ACPI_VALID_STA))
@@ -1046,6 +1048,7 @@
 {
     ACPI_HANDLE		h;
     ACPI_DEVICE_INFO	devinfo;
+    ACPI_BUFFER		buf = {sizeof(devinfo), &devinfo};
     ACPI_STATUS		error;
     int			cid;
 
@@ -1055,9 +1058,9 @@
 	return(FALSE);
     if ((h = acpi_get_handle(dev)) == NULL)
 	return(FALSE);
-    if (ACPI_FAILURE(error = AcpiGetObjectInfo(h, &devinfo)))
+    if (ACPI_FAILURE(error = AcpiGetObjectInfo(h, &buf)))
 	return(FALSE);
-    if ((devinfo.Valid & ACPI_VALID_HID) && !strcmp(hid, devinfo.HardwareId))
+    if ((devinfo.Valid & ACPI_VALID_HID) && !strcmp(hid, devinfo.HardwareId.Value))
 	return(TRUE);
     if (ACPI_FAILURE(error = acpi_EvaluateInteger(h, "_CID", &cid)))
 	return(FALSE);
@@ -1405,7 +1408,7 @@
 	    acpi_sleep_machdep(sc, state);
 
 	    /* AcpiEnterSleepState() maybe incompleted, unlock here if locked. */
-	    if (AcpiGbl_AcpiMutexInfo[ACPI_MTX_HARDWARE].OwnerId != ACPI_MUTEX_NOT_ACQUIRED) {
+	    if (AcpiGbl_MutexInfo[ACPI_MTX_HARDWARE].OwnerId != ACPI_MUTEX_NOT_ACQUIRED) {
 		AcpiUtReleaseMutex(ACPI_MTX_HARDWARE);
 	    }
 
@@ -1752,8 +1755,8 @@
 	 * enabled for the wake event.
 	 */
 
-	status = AcpiEnableEvent(res->Package.Elements[0].Integer.Value,
-				 ACPI_EVENT_GPE, ACPI_EVENT_WAKE_ENABLE);
+	status = AcpiEnableGpe(NULL, res->Package.Elements[0].Integer.Value,
+				 ACPI_EVENT_WAKE_ENABLE);
 	if (ACPI_FAILURE(status))
             printf("%s: EnableEvent Failed\n", __func__);
 	break;
@@ -1797,7 +1800,7 @@
 {
     TAILQ_ENTRY(acpi_ioctl_hook)	link;
     u_long				cmd;
-    int					(* fn)(u_long cmd, caddr_t addr, void *arg);
+    acpi_ioctl_fn			fn;
     void				*arg;
 };
 
@@ -1808,7 +1811,7 @@
  * Register an ioctl handler.
  */
 int
-acpi_register_ioctl(u_long cmd, int (* fn)(u_long cmd, caddr_t addr, void *arg), void *arg)
+acpi_register_ioctl(u_long cmd, acpi_ioctl_fn fn, void *arg)
 {
     struct acpi_ioctl_hook	*hp;
 
@@ -1829,7 +1832,7 @@
  * Deregister an ioctl handler.
  */
 void	
-acpi_deregister_ioctl(u_long cmd, int (* fn)(u_long cmd, caddr_t addr, void *arg))
+acpi_deregister_ioctl(u_long cmd, acpi_ioctl_fn fn)
 {
     struct acpi_ioctl_hook	*hp;
 
Index: sys/dev/acpica/acpi_ec.c
===================================================================
RCS file: /usr/srcs/dcvs/src/sys/dev/acpica/acpi_ec.c,v
retrieving revision 1.1
diff -u -r1.1 acpi_ec.c
--- sys/dev/acpica/acpi_ec.c	24 Sep 2003 03:32:16 -0000	1.1
+++ sys/dev/acpica/acpi_ec.c	12 Dec 2003 00:52:59 -0000
@@ -221,6 +221,26 @@
 #define EC_SET_CSR(sc, v)						\
 	bus_space_write_1((sc)->ec_csr_tag, (sc)->ec_csr_handle, 0, (v))
 
+/* Embedded Controller Boot Resources Table (ECDT) */
+typedef struct {
+    ACPI_TABLE_HEADER		header;
+    ACPI_GENERIC_ADDRESS	control;
+    ACPI_GENERIC_ADDRESS	data;
+    UINT32			uid;
+    UINT8			gpe_bit;
+    char			ec_id[0];
+} ACPI_TABLE_ECDT;
+
+/* Indicate that this device has already been probed via ECDT. */
+#define DEV_ECDT(x)		(acpi_get_private(x) == &acpi_ec_devclass)
+
+/* Indicate that this device should use the global lock. */
+#define DEV_GLK_FLAG		0x40000000
+
+/* Get/set GPE bit value in the magic ivar. */
+#define DEV_GET_GPEBIT(x)	((x) & 0xff)
+#define DEV_SET_GPEBIT(x, y)	((x) = ((x) & ~0xff) | ((y) & 0xff))
+
 /*
  * Driver softc.
  */
@@ -239,6 +259,7 @@
     bus_space_tag_t	ec_csr_tag;
     bus_space_handle_t	ec_csr_handle;
 
+    int			ec_glk;
     int			ec_locked;
     int			ec_lockhandle;
     int			ec_pendquery;
@@ -342,17 +363,89 @@
 static int
 acpi_ec_probe(device_t dev)
 {
+    ACPI_HANDLE h;
+    ACPI_STATUS status;
+    device_t	peer;
+    char	desc[64];
+    int		magic, uid, glk, gpebit, ret = ENXIO;
+
+    /* Check that this is a device and that EC is not disabled. */
+    if (acpi_get_type(dev) != ACPI_TYPE_DEVICE || acpi_disabled("ec"))
+	return (ENXIO);
+
+    /*
+     * If probed via ECDT, set description and continue.  Otherwise,
+     * we can access the namespace and make sure this is not a
+     * duplicate probe.
+     */
+    magic = acpi_get_magic(dev);
+    if (DEV_ECDT(dev)) {
+	snprintf(desc, sizeof(desc), "Embedded Controller: ECDT, GPE %#x, GLK",
+		 DEV_GET_GPEBIT(magic));
+	device_set_desc_copy(dev, desc);
+	ret = 0;
+    } else if (acpi_MatchHid(dev, "PNP0C09")) {
+	h = acpi_get_handle(dev);
 
-    if (acpi_get_type(dev) == ACPI_TYPE_DEVICE && !acpi_disabled("ec") &&
-	acpi_MatchHid(dev, "PNP0C09")) {
+	/*
+	 * Read the unit ID to check for duplicate attach and the
+	 * global lock value to see if we should acquire it when
+	 * accessing the EC.
+	 */
+	status = acpi_EvaluateInteger(h, "_UID", &uid);
+	if (ACPI_FAILURE(status))
+	    uid = 0;
+	status = acpi_EvaluateInteger(h, "_GLK", &glk);
+	if (ACPI_FAILURE(status))
+	    glk = 0;
 
 	/*
-	 * Set device description 
+	 * Evaluate the _GPE method to find the GPE bit used by the EC to
+	 * signal status (SCI).  Note that we don't handle the case where
+	 * it can return a package instead of an int.
 	 */
-	device_set_desc(dev, "embedded controller");
-	return (0);
+	status = acpi_EvaluateInteger(h, "_GPE", &gpebit);
+	if (ACPI_FAILURE(status)) {
+	    device_printf(dev, "can't evaluate _GPE - %s\n",
+			  AcpiFormatException(status));
+	    return (ENXIO);
+	}
+
+	/* Store the values we got from the namespace for attach. */
+	magic = glk != 0 ? DEV_GLK_FLAG : 0;
+	DEV_SET_GPEBIT(magic, gpebit);
+	acpi_set_magic(dev, magic);
+
+	/*
+	 * Check for a duplicate probe.  This can happen when a probe
+	 * via ECDT succeeded already.  If there is a duplicate, override
+	 * its value for GLK in the peer's softc since the ECDT case
+	 * always enables the global lock to be safe.  Otherwise, just
+	 * continue on to attach.
+	 */
+	peer = devclass_get_device(acpi_ec_devclass, uid);
+	if (peer == NULL || !device_is_alive(peer)) {
+	    snprintf(desc, sizeof(desc), "Embedded Controller: GPE %#x%s",
+		     gpebit, glk != 0 ? ", GLK" : "");
+	    device_set_desc_copy(dev, desc);
+	    ret = 0;
+	} else {
+	    struct acpi_ec_softc *sc;
+
+	    /*
+	     * Set the peer's sc->ec_glk with locks held so we won't
+	     * override it between another thread's lock/unlock calls.
+	     */
+	    sc = device_get_softc(peer);
+	    if (sc->ec_glk != glk) {
+		ACPI_VPRINT(peer, acpi_device_get_parent_softc(peer),
+		    "Changing GLK from %d to %d\n", sc->ec_glk, glk);
+		sc->ec_glk = glk != 0 ? 1 : 0;
+	    }
+	}
     }
-    return (ENXIO);
+
+    return (ret);
 }
 
 static int
@@ -420,7 +513,7 @@
      * events we cause while performing a transaction (e.g. IBE/OBF) get 
      * cleared before re-enabling the GPE.
      */
-    Status = AcpiInstallGpeHandler(sc->ec_gpebit,
+    Status = AcpiInstallGpeHandler(NULL, sc->ec_gpebit,
 		ACPI_EVENT_LEVEL_TRIGGERED | ACPI_EVENT_EDGE_TRIGGERED, 
 		EcGpeHandler, sc);
     if (ACPI_FAILURE(Status)) {
@@ -512,9 +605,9 @@
 	}
     }
         /* I know I request Level trigger cleanup */
-    if (ACPI_FAILURE(AcpiClearEvent(sc->ec_gpebit, ACPI_EVENT_GPE)))
-	printf("EcGpeQueryHandler:ClearEvent Failed\n");
-    if (ACPI_FAILURE(AcpiEnableEvent(sc->ec_gpebit, ACPI_EVENT_GPE, 0)))
+    /*if (ACPI_FAILURE(AcpiClearGpe(sc->ec_gpebit, ACPI_EVENT_GPE)))
+	printf("EcGpeQueryHandler:ClearEvent Failed\n"); */
+    if (ACPI_FAILURE(AcpiEnableGpe(NULL, sc->ec_gpebit, ACPI_NOT_ISR)))
 	printf("EcGpeQueryHandler:EnableEvent Failed\n");
 }
 
@@ -769,11 +862,11 @@
 	sc->ec_pendquery = 0;
     }
 
-    if (ACPI_FAILURE(AcpiClearEvent(sc->ec_gpebit, ACPI_EVENT_GPE))) {
+    /*if (ACPI_FAILURE(AcpiClearEvent(sc->ec_gpebit, ACPI_EVENT_GPE))) {
 	ACPI_VPRINT(sc->ec_dev, acpi_device_get_parent_softc(sc->ec_dev),
 	    "EcRequest: Unable to clear the EC GPE.\n");
-    }
-    if (ACPI_FAILURE(AcpiEnableEvent(sc->ec_gpebit, ACPI_EVENT_GPE, 0))) {
+    }*/
+    if (ACPI_FAILURE(AcpiEnableGpe(NULL, sc->ec_gpebit, ACPI_NOT_ISR))) {
 	ACPI_VPRINT(sc->ec_dev, acpi_device_get_parent_softc(sc->ec_dev),
 	    "EcRequest: Unable to re-enable the EC GPE.\n");
     }
Index: sys/dev/acpica/acpiio.h
===================================================================
RCS file: /usr/srcs/dcvs/src/sys/dev/acpica/acpiio.h,v
retrieving revision 1.1
diff -u -r1.1 acpiio.h
--- sys/dev/acpica/acpiio.h	24 Sep 2003 03:32:16 -0000	1.1
+++ sys/dev/acpica/acpiio.h	12 Dec 2003 00:52:59 -0000
@@ -102,6 +102,7 @@
 #define ACPIIO_ACAD_GET_STATUS	_IOR('A', 1, int)
 
 #ifdef _KERNEL
-extern int	acpi_register_ioctl(u_long cmd, int (* fn)(u_long cmd, caddr_t addr, void *arg), void *arg);
-extern void	acpi_deregister_ioctl(u_long cmd, int (* fn)(u_long cmd, caddr_t addr, void *arg));
+typedef int	(*acpi_ioctl_fn)(u_long cmd, caddr_t addr, void *arg);
+extern int	acpi_register_ioctl(u_long cmd, acpi_ioctl_fn fn, void *arg);
+extern void	acpi_deregister_ioctl(u_long cmd, acpi_ioctl_fn fn);
 #endif
Index: sys/dev/acpica/Osd/OsdHardware.c
===================================================================
RCS file: /usr/srcs/dcvs/src/sys/dev/acpica/Osd/OsdHardware.c,v
retrieving revision 1.1
diff -u -r1.1 OsdHardware.c
--- sys/dev/acpica/Osd/OsdHardware.c	24 Sep 2003 03:32:16 -0000	1.1
+++ sys/dev/acpica/Osd/OsdHardware.c	12 Dec 2003 00:52:59 -0000
@@ -69,19 +69,19 @@
 
 ACPI_STATUS
 AcpiOsReadPort (
-    ACPI_IO_ADDRESS	InPort,
-    void		*Value,
+    ACPI_IO_ADDRESS	Address,
+    UINT32		*Value,
     UINT32		Width)
 {
     switch (Width) {
     case 8:
-        *(u_int8_t *)Value = bus_space_read_1(ACPI_BUS_SPACE_IO, ACPI_BUS_HANDLE, InPort);
+        *(u_int8_t *)Value = bus_space_read_1(ACPI_BUS_SPACE_IO, ACPI_BUS_HANDLE, Address);
         break;
     case 16:
-        *(u_int16_t *)Value = bus_space_read_2(ACPI_BUS_SPACE_IO, ACPI_BUS_HANDLE, InPort);
+        *(u_int16_t *)Value = bus_space_read_2(ACPI_BUS_SPACE_IO, ACPI_BUS_HANDLE, Address);
         break;
     case 32:
-        *(u_int32_t *)Value = bus_space_read_4(ACPI_BUS_SPACE_IO, ACPI_BUS_HANDLE, InPort);
+        *(u_int32_t *)Value = bus_space_read_4(ACPI_BUS_SPACE_IO, ACPI_BUS_HANDLE, Address);
         break;
     default:
         /* debug trap goes here */
@@ -93,19 +93,19 @@
 
 ACPI_STATUS
 AcpiOsWritePort (
-    ACPI_IO_ADDRESS	OutPort,
-    ACPI_INTEGER	Value,
+    ACPI_IO_ADDRESS	Address,
+    UINT32		Value,
     UINT32		Width)
 {
     switch (Width) {
     case 8:
-        bus_space_write_1(ACPI_BUS_SPACE_IO, ACPI_BUS_HANDLE, OutPort, Value);
+        bus_space_write_1(ACPI_BUS_SPACE_IO, ACPI_BUS_HANDLE, Address, Value);
         break;
     case 16:
-        bus_space_write_2(ACPI_BUS_SPACE_IO, ACPI_BUS_HANDLE, OutPort, Value);
+        bus_space_write_2(ACPI_BUS_SPACE_IO, ACPI_BUS_HANDLE, Address, Value);
         break;
     case 32:
-        bus_space_write_4(ACPI_BUS_SPACE_IO, ACPI_BUS_HANDLE, OutPort, Value);
+        bus_space_write_4(ACPI_BUS_SPACE_IO, ACPI_BUS_HANDLE, Address, Value);
         break;
     default:
         /* debug trap goes here */
Index: sys/dev/acpica/Osd/OsdMemory.c
===================================================================
RCS file: /usr/srcs/dcvs/src/sys/dev/acpica/Osd/OsdMemory.c,v
retrieving revision 1.1
diff -u -r1.1 OsdMemory.c
--- sys/dev/acpica/Osd/OsdMemory.c	24 Sep 2003 03:32:16 -0000	1.1
+++ sys/dev/acpica/Osd/OsdMemory.c	12 Dec 2003 00:52:59 -0000
@@ -95,7 +95,7 @@
 ACPI_STATUS
 AcpiOsReadMemory (
     ACPI_PHYSICAL_ADDRESS	Address,
-    void			*Value,
+    UINT32			*Value,
     UINT32			Width)
 {
     void	*LogicalAddress;
@@ -130,7 +130,7 @@
 ACPI_STATUS
 AcpiOsWriteMemory (
     ACPI_PHYSICAL_ADDRESS	Address,
-    ACPI_INTEGER		Value,
+    UINT32			Value,
     UINT32			Width)
 {
     void	*LogicalAddress;
Index: sys/dev/acpica/Osd/OsdSynch.c
===================================================================
RCS file: /usr/srcs/dcvs/src/sys/dev/acpica/Osd/OsdSynch.c,v
retrieving revision 1.1
diff -u -r1.1 OsdSynch.c
--- sys/dev/acpica/Osd/OsdSynch.c	24 Sep 2003 03:32:16 -0000	1.1
+++ sys/dev/acpica/Osd/OsdSynch.c	12 Dec 2003 00:52:59 -0000
@@ -38,8 +38,8 @@
 #include <sys/kernel.h>
 #include <sys/malloc.h>
 #include <sys/sysctl.h>
-#if __FreeBSD_version >= 500000
 #include <sys/lock.h>
+#if __FreeBSD_version >= 500000
 #include <sys/mutex.h>
 #endif
 
@@ -338,4 +338,52 @@
 #else
     return(AE_OK);
 #endif
+}
+
+ACPI_STATUS
+AcpiOsCreateLock (ACPI_HANDLE *OutHandle)
+{
+     struct spinlock *spl;
+
+    if (OutHandle == NULL)
+	return (AE_BAD_PARAMETER);
+    spl = malloc(sizeof(*spl), M_ACPISEM, M_NOWAIT | M_ZERO);
+    if (spl == NULL)
+	return (AE_NO_MEMORY);
+
+    spin_lock_init(spl);
+    *OutHandle = (ACPI_HANDLE)spl;
+    return (AE_OK);
+}
+
+void
+AcpiOsDeleteLock (ACPI_HANDLE Handle)
+{
+    free((struct spinlock *)Handle, M_ACPISEM);
+    return;
+}
+
+/*
+ * The Flags parameter seems to state whether or not caller is an ISR
+ * (and thus can't block) but since we have ithreads, we don't worry
+ * about potentially blocking.
+ */
+void
+AcpiOsAcquireLock (ACPI_HANDLE Handle, UINT32 Flags)
+{
+    struct spinlock *spl = (struct spinlock *)Handle;
+
+    if (Handle == NULL)
+        return;
+    spin_lock(spl);
+}
+
+void
+AcpiOsReleaseLock (ACPI_HANDLE Handle, UINT32 Flags)
+{
+    struct spinlock *spl = (struct spinlock *)Handle;
+
+    if (Handle == NULL)
+        return;
+    spin_lock(spl);
 }


[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]