On Mon, Sep 24, 2012 at 10:06:24PM +0400, Denis Lapshin wrote:
> Two years ago Marco issued a patch
> http://marc.info/?l=openbsd-tech&m=128612230314484&w=4 in order to
> prevent incorrect reading acpitz on HP Compaq (or any HP laptops with
> acpiec madness) by adding some delays to have data prepared to
> read/write.
>
> It has been tested and works perfectly fine on some HP laptops: 6510b,
> 8510p/w, 8710p/w.
>
> Please add this patch into the source tree to have it by default.
I don't like this approach. At all.
There should be proper locking done instead of these disgusting
timeouts. I'm working on the locking infrastructure but it's going to
take a while before I finish.
If people want this in now they better convince another developer to
commit it.
> Index: acpiec.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/acpi/acpiec.c,v
> retrieving revision 1.43
> diff -u -p -r1.43 acpiec.c
> --- acpiec.c 8 Aug 2010 17:25:41 -0000 1.43
> +++ acpiec.c 29 Sep 2010 04:24:13 -0000
> @@ -92,7 +92,7 @@ void
> acpiec_wait(struct acpiec_softc *sc, u_int8_t mask, u_int8_t val)
> {
> static int acpiecnowait;
> - u_int8_t stat;
> + volatile u_int8_t stat;
>
> dnprintf(40, "%s: EC wait_ns for: %b == %02x\n",
> DEVNAME(sc), (int)mask,
> @@ -104,8 +104,14 @@ acpiec_wait(struct acpiec_softc *sc, u_i
> if (cold || (stat & EC_STAT_BURST))
> delay(1);
> else
> - tsleep(&acpiecnowait, PWAIT, "acpiec", 1);
> + tsleep(&acpiecnowait, PWAIT, "ecstat", 1);
> }
> +
> + /* delay to make sure the data is actually ready */
> + if (cold)
> + delay(10);
> + else
> + tsleep(&acpiecnowait, PWAIT, "ecout", 1);
>
> dnprintf(40, "%s: EC wait_ns, stat: %b\n", DEVNAME(sc), (int)stat,
> "\20\x8IGN\x7SMI\x6SCI\05BURST\04CMD\03IGN\02IBF\01OBF");