ACPICA 20050211 update

Craig Dooley xlnxminusx at gmail.com
Wed Mar 2 12:13:03 PST 2005


Here is a patch that I put together to update acpica to the 20050211
distribution.  The only changes are matching to API changes.  This
requires a commiter to download the source latest source from intel at
http://developer.intel.com/technology/iapc/acpi/downloads/acpica-unix-20050211.tar.gz
and import it based on the instructions in
/usr/src/sys/contrib/dev/acpica-unix-20040527/README.DRAGONFLY

It was tested on an hp pavilion zt3000 and under vmware.
Someone should look at my logic in AcpiOsSleep just as a double check
of my logic to make sure all my times aren't off by 10x or something
like that.

-Craig

-- 
-----------------------------------------------------------------------
Craig Dooley <xlnxminusx at xxxxxxxxx>
Index: Makefile.inc
===================================================================
RCS file: /home/dcvs/src/sys/dev/acpica5/Makefile.inc,v
retrieving revision 1.2
diff -u -r1.2 Makefile.inc
--- Makefile.inc	5 Jul 2004 00:07:35 -0000	1.2
+++ Makefile.inc	2 Mar 2005 13:15:10 -0000
@@ -1,4 +1,4 @@
 # $DragonFly: src/sys/dev/acpica5/Makefile.inc,v 1.2 2004/07/05 00:07:35 dillon Exp $
 
-SYSACPICA_VERSION?=	20040527
+SYSACPICA_VERSION?=	20050211
 SYSACPICA?= contrib/dev/acpica-unix-${SYSACPICA_VERSION}
Index: acpi_acad.c
===================================================================
RCS file: /home/dcvs/src/sys/dev/acpica5/acpi_acad.c,v
retrieving revision 1.4
diff -u -r1.4 acpi_acad.c
--- acpi_acad.c	2 Aug 2004 19:51:07 -0000	1.4
+++ acpi_acad.c	2 Mar 2005 13:18:12 -0000
@@ -248,7 +248,7 @@
 	acpi_acad_get_status(dev);
 	if (status != sc->status)
 	    break;
-	AcpiOsSleep(0, 10);
+	AcpiOsSleep(10);
     }
 
     sc->initializing = 0;
Index: acpi_cmbat.c
===================================================================
RCS file: /home/dcvs/src/sys/dev/acpica5/acpi_cmbat.c,v
retrieving revision 1.5
diff -u -r1.5 acpi_cmbat.c
--- acpi_cmbat.c	2 Aug 2004 19:51:07 -0000	1.5
+++ acpi_cmbat.c	2 Mar 2005 13:18:55 -0000
@@ -583,7 +583,7 @@
     ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
 		"battery initialization start\n");
 
-    for (retry = 0; retry < ACPI_CMBAT_RETRY_MAX; retry++, AcpiOsSleep(0, 10)) {
+    for (retry = 0; retry < ACPI_CMBAT_RETRY_MAX; retry++, AcpiOsSleep(10)) {
 	sc->present = acpi_BatteryIsPresent(dev);
 	if (!sc->present)
 	    continue;
Index: acpi_thermal.c
===================================================================
RCS file: /home/dcvs/src/sys/dev/acpica5/acpi_thermal.c,v
retrieving revision 1.3
diff -u -r1.3 acpi_thermal.c
--- acpi_thermal.c	5 Jul 2004 00:07:35 -0000	1.3
+++ acpi_thermal.c	2 Mar 2005 13:23:36 -0000
@@ -690,7 +690,7 @@
     case TZ_NOTIFY_LEVELS:
 	/* Zone devices/setpoints changed */
 	AcpiOsQueueForExecution(OSD_PRIORITY_HIGH,
-				(OSD_EXECUTION_CALLBACK)acpi_tz_establish, sc);
+				(ACPI_OSD_EXEC_CALLBACK)acpi_tz_establish, sc);
 	break;
     default:
 	ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev),
@@ -761,7 +761,7 @@
 	} else {
 	    /* We have to re-evaluate the entire zone now */
 	    AcpiOsQueueForExecution(OSD_PRIORITY_HIGH,
-				    (OSD_EXECUTION_CALLBACK)acpi_tz_establish,
+				    (ACPI_OSD_EXEC_CALLBACK)acpi_tz_establish,
 				    sc);
 	}
     }
Index: Osd/OsdInterrupt.c
===================================================================
RCS file: /home/dcvs/src/sys/dev/acpica5/Osd/OsdInterrupt.c,v
retrieving revision 1.2
diff -u -r1.2 OsdInterrupt.c
--- Osd/OsdInterrupt.c	27 Jun 2004 08:52:42 -0000	1.2
+++ Osd/OsdInterrupt.c	2 Mar 2005 13:29:03 -0000
@@ -47,12 +47,12 @@
 
 static void		InterruptWrapper(void *arg);
 
-static OSD_HANDLER	InterruptHandler;
+static ACPI_OSD_HANDLER	InterruptHandler;
 static UINT32		InterruptOverride = 0;
 
 ACPI_STATUS
 AcpiOsInstallInterruptHandler(UINT32 InterruptNumber,
-    OSD_HANDLER ServiceRoutine, void *Context)
+    ACPI_OSD_HANDLER ServiceRoutine, void *Context)
 {
     struct acpi_softc	*sc;
 
@@ -115,7 +115,7 @@
 }
 
 ACPI_STATUS
-AcpiOsRemoveInterruptHandler(UINT32 InterruptNumber, OSD_HANDLER ServiceRoutine)
+AcpiOsRemoveInterruptHandler(UINT32 InterruptNumber, ACPI_OSD_HANDLER ServiceRoutine)
 {
     struct acpi_softc	*sc;
 
Index: Osd/OsdSchedule.c
===================================================================
RCS file: /home/dcvs/src/sys/dev/acpica5/Osd/OsdSchedule.c,v
retrieving revision 1.4
diff -u -r1.4 OsdSchedule.c
--- Osd/OsdSchedule.c	2 Aug 2004 19:51:09 -0000	1.4
+++ Osd/OsdSchedule.c	2 Mar 2005 13:52:23 -0000
@@ -66,7 +66,7 @@
 
 struct acpi_task {
     struct lwkt_msg		at_msg;
-    OSD_EXECUTION_CALLBACK	at_function;
+    ACPI_OSD_EXEC_CALLBACK	at_function;
     void			*at_context;
     int				at_priority;
 };
@@ -93,12 +93,12 @@
 static void
 acpi_task_thread(void *arg)
 {
-    OSD_EXECUTION_CALLBACK func;
+    ACPI_OSD_EXEC_CALLBACK func;
     struct acpi_task *at;
 
     for (;;) {
 	at = (void *)lwkt_waitport(&curthread->td_msgport, NULL);
-	func = (OSD_EXECUTION_CALLBACK)at->at_function;
+	func = (ACPI_OSD_EXEC_CALLBACK)at->at_function;
 	func((void *)at->at_context);
 	lwkt_replymsg(&at->at_msg, 0);
     }
@@ -111,7 +111,7 @@
  * to automatically free the message.
  */
 ACPI_STATUS
-AcpiOsQueueForExecution(UINT32 Priority, OSD_EXECUTION_CALLBACK Function,
+AcpiOsQueueForExecution(UINT32 Priority, ACPI_OSD_EXEC_CALLBACK Function,
     void *Context)
 {
     struct acpi_task	*at;
@@ -159,16 +159,27 @@
     free(msg, M_ACPITASK);
 }
 
+UINT64
+AcpiOsGetTimer (void)
+{
+    struct timeval  time;
+
+    microtime(&time);
+
+    /* Seconds * 10^7 = 100ns(10^-7), Microseconds(10^-6) * 10^1 = 100ns */
+
+    return (((UINT64) time.tv_sec * 10000000) + ((UINT64) time.tv_usec * 10));
+}
 
 void
-AcpiOsSleep(UINT32 Seconds, UINT32 Milliseconds)
+AcpiOsSleep(UINT64 Milliseconds)
 {
     int		timo;
     static int	dummy;
 
     ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
 
-    timo = (Seconds * hz) + Milliseconds * hz / 1000;
+    timo = Milliseconds * hz / 1000;
 
     /* 
      * If requested sleep time is less than our hz resolution, or if
@@ -176,13 +187,13 @@
      * use DELAY instead for better granularity.
      */
     if (clocks_running == 0) {
-	while (Seconds) {
+	while (timo > 1000000) {
 	    DELAY(1000000);
-	    --Seconds;
+	    timo -= 1000000;
 	}
-	if (Milliseconds)
-	    DELAY(Milliseconds * 1000);
-    } else if (timo > 0) {
+	if (timo)
+	    DELAY(timo * 1000);
+    } else if (timo > 1000) {
 	tsleep(&dummy, 0, "acpislp", timo);
     } else {
 	DELAY(Milliseconds * 1000);




More information about the Submit mailing list