acpi_ec patch/problem attaching on boot
Brock Johnson
wildefire at isentry.homelinux.org
Tue Mar 1 19:21:40 PST 2005
Hey all,
I got a new laptop about a month ago, promptly put DragonFly on it, and
acpi worked fine with GENERIC. However, once I switched to a custom
kernel config (mostly removing unused drivers), acpi_ec wouldn't always
attach, sometimes it would, sometimes it wouldn't, I started playing
around with my kernel configs and couldnt find anything definitive,
though it seemed to be a timing issue, dependant upon the size of the
kernel binary. So, I went digging through the FreeBSD commit logs for
anything to do with timing and saw the message from revision 1.56
"date: 2004-07-01 00:51:31 +0000; author: njl; state: Exp; lines: +35 -48
Rework the code that waits for a response from the EC. Use an sx lock
instead of a mutex so we do not unblock it in msleep(). If we do this,
another event could occur, resetting the status register since reads
reset it. While I'm here, remove the backoff approach. Instead, sleep
in 10 ms chunks for up to the configured timeout using either DELAY (if
we aren't booted yet) or tsleep."
Looking at the commit, we already had similiar logic in EcWaitEvent() in
our acpi_ec.c, however, the check to determine if acpi was up or not,
wasn't in ours. So, I brought this over and presto!, acpi_ec attaches
everytime now. I'm not sure this is correct though, and I didn't take
the time to go through the acpi code to figure out if this was the
"right thing"(tm), so I'm hoping an acpi guru will read this and comment.
Thanks,
Brock
Index: acpi_ec.c
===================================================================
RCS file: /home/dcvs/src/sys/dev/acpica5/acpi_ec.c,v
retrieving revision 1.4
diff -u -r1.4 acpi_ec.c
--- acpi_ec.c 5 Jul 2004 00:07:35 -0000 1.4
+++ acpi_ec.c 24 Feb 2005 05:13:18 -0000
@@ -138,7 +138,7 @@
*****************************************************************************/
/*
* $FreeBSD: src/sys/dev/acpica/acpi_ec.c,v 1.51 2004/05/30 20:08:23 phk Exp $
- * $DragonFly: src/sys/dev/acpica5/acpi_ec.c,v 1.4 2004/07/05 00:07:35 dillon Exp $
+ * $DragonFly$
*
*/
@@ -865,7 +865,10 @@
Status = AE_OK;
break;
}
- retval = tsleep(&sc->ec_csrvalue, 0, "ecpoll", 1 + hz / 100);
+ if (!cold)
+ retval = tsleep(&sc->ec_csrvalue, 0, "ecpoll", 1 + hz / 100);
+ else
+ AcpiOsStall(10000);
}
}
More information about the Submit
mailing list