ACPI Fixes

Craig Dooley craig at xlnx-x.net
Thu Feb 19 08:31:47 PST 2004


Heres a couple small fixes.  A couple defines moved to the tops of files,
CPU throttling works now, and move ACPI out from splhigh and under it's
own token.  This also appears to fix hangs on my laptop when booting and
probing ec0.

-Craig
-- 
------------------------------------------------------------------------
Craig Dooley                                            craig at xxxxxxxxxx
------------------------------------------------------------------------
Index: dev/acpica/acpi.c
===================================================================
RCS file: /home/dcvs/src/sys/dev/acpica/acpi.c,v
retrieving revision 1.3
diff -u -r1.3 acpi.c
--- dev/acpica/acpi.c	13 Feb 2004 00:25:17 -0000	1.3
+++ dev/acpica/acpi.c	17 Feb 2004 14:13:48 -0000
@@ -99,6 +99,10 @@
 /* this has to be static, as the softc is gone when we need it */
 static int acpi_off_state = ACPI_STATE_S5;
 
+#if defined(__DragonFly__)
+struct lwkt_token acpi_token;
+#endif
+
 #if defined(__FreeBSD__) && __FreeBSD_version >= 500000
 struct mtx	acpi_mutex;
 #endif
Index: dev/acpica/acpi_acad.c
===================================================================
RCS file: /home/dcvs/src/sys/dev/acpica/acpi_acad.c,v
retrieving revision 1.1
diff -u -r1.1 acpi_acad.c
--- dev/acpica/acpi_acad.c	24 Sep 2003 03:32:16 -0000	1.1
+++ dev/acpica/acpi_acad.c	19 Feb 2004 15:57:15 -0000
@@ -50,6 +50,9 @@
 #define _COMPONENT	ACPI_AC_ADAPTER
 ACPI_MODULE_NAME("AC_ADAPTER")
 
+/* Number of times to retry initialization before giving up. */
+#define ACPI_ACAD_RETRY_MAX	6
+
 #define ACPI_DEVICE_CHECK_PNP		0x00
 #define ACPI_DEVICE_CHECK_EXISTENCE	0x01
 #define ACPI_POWERSOURCE_STAT_CHANGE	0x80
@@ -233,7 +236,6 @@
 	int		status;
 	device_t	dev = (device_t)arg;
 	struct acpi_acad_softc	*sc = device_get_softc(dev);
-#define ACPI_ACAD_RETRY_MAX	6
 
 	if (sc->initializing) {
 		return;
Index: dev/acpica/acpi_button.c
===================================================================
RCS file: /home/dcvs/src/sys/dev/acpica/acpi_button.c,v
retrieving revision 1.1
diff -u -r1.1 acpi_button.c
--- dev/acpica/acpi_button.c	24 Sep 2003 03:32:16 -0000	1.1
+++ dev/acpica/acpi_button.c	19 Feb 2004 15:56:06 -0000
@@ -52,6 +52,9 @@
     boolean_t	button_type;	/* Power or Sleep Button */
 };
 
+#define ACPI_NOTIFY_BUTTON_PRESSED_FOR_SLEEP	0x80
+#define ACPI_NOTIFY_BUTTON_PRESSED_FOR_WAKEUP	0x02
+
 static int	acpi_button_probe(device_t dev);
 static int	acpi_button_attach(device_t dev);
 static int	acpi_button_suspend(device_t dev);
@@ -166,7 +169,6 @@
     default:
 	break;		/* unknown button type */
     }
-    return_VOID;
 }
 
 static void
@@ -195,13 +197,8 @@
     default:
 	break;		/* unknown button type */
     }
-    return_VOID;
 }
 
-/* XXX maybe not here */
-#define ACPI_NOTIFY_BUTTON_PRESSED_FOR_SLEEP	0x80
-#define ACPI_NOTIFY_BUTTON_PRESSED_FOR_WAKEUP	0x02
-
 static void 
 acpi_button_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context)
 {
@@ -219,7 +216,6 @@
     default:
 	break;		/* unknown notification value */
     }
-    return_VOID;
 }
 
 
Index: dev/acpica/acpi_cpu.c
===================================================================
RCS file: /home/dcvs/src/sys/dev/acpica/acpi_cpu.c,v
retrieving revision 1.1
diff -u -r1.1 acpi_cpu.c
--- dev/acpica/acpi_cpu.c	24 Sep 2003 03:32:16 -0000	1.1
+++ dev/acpica/acpi_cpu.c	15 Feb 2004 20:26:16 -0000
@@ -330,7 +330,7 @@
 	if (speed < CPU_MAX_SPEED) {
 
 	    /* mask the old CLK_VAL off and or-in the new value */
-	    clk_val = CPU_MAX_SPEED << cpu_duty_offset;
+	    clk_val = (CPU_MAX_SPEED - 1) << cpu_duty_offset;
 	    p_cnt &= ~clk_val;
 	    p_cnt |= (speed << cpu_duty_offset);
 	
Index: dev/acpica/acpivar.h
===================================================================
RCS file: /home/dcvs/src/sys/dev/acpica/acpivar.h,v
retrieving revision 1.2
diff -u -r1.2 acpivar.h
--- dev/acpica/acpivar.h	13 Feb 2004 00:25:17 -0000	1.2
+++ dev/acpica/acpivar.h	17 Feb 2004 14:12:04 -0000
@@ -89,8 +89,16 @@
     struct resource_list	ad_rl;
 
 };
-
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
+#if defined(__DragonFly__)
+extern struct lwkt_token	acpi_token;
+# define ACPI_LOCK				lwkt_gettoken(&acpi_token)
+# define ACPI_UNLOCK			lwkt_reltoken(&acpi_token)
+# define ACPI_ASSERTLOCK
+# define ACPI_MSLEEP(a, b, c, d, e)	tsleep(a, c, d, e)
+# define ACPI_LOCK_DECL			int s
+# define kthread_create(a, b, c, d, e, f)	kthread_create(a, b, c, f)
+# define tc_init(a)			init_timecounter(a)
+#elif __FreeBSD_version < 500000
 /*
  * In 4.x, ACPI is protected by splhigh().
  */
Attachment:
pgp00006.pgp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgp00006.pgp
Type: application/octet-stream
Size: 187 bytes
Desc: "Description: PGP signature"
URL: <http://lists.dragonflybsd.org/pipermail/submit/attachments/20040219/db490137/attachment-0018.obj>


More information about the Submit mailing list