> Date: Fri, 12 Aug 2016 08:58:19 -0500
> From: joshua stein <[email protected]>
> 
> On Fri, 08 Jul 2016 at 18:51:17 -0500, joshua stein wrote:
> > If the EC fails to go into burst mode for whatever reason, the Burst
> > Acknowledge byte will not be there to read, which means the status
> > won't have EC_STAT_OBF, which means acpiec_wait will spin forever,
> > hanging the machine.
> > 
> > This at least gets us moving again, ignoring the failure to enter
> > burst mode.
> 
> That patch was put into the latest snapshot (but not yet in CVS) and
> some people are seeing fallout from it like strange thermal and
> battery status readings.
> 
> This is a different patch which just doesn't bother with burst mode
> unless the transfer is big.  This should match how Linux and FreeBSD
> behave.  I have at least one confirmation that this fixes things on
> the ThinkPad X260.
> 
> Anyone else that is seeing strangeness on the latest snapshot, I ask
> that you try this patch against -current and see if your issues go
> away.

FWIW, tis diff makes sense to me.  There is no real point in enabling
burst mode if you're only going to do a single read or write.  And I
wouldn't be surprised if some ECs protested against this.

No apparent issues with this diff on an x220 and an x1 gen3.

ok kettenis@

> Index: sys/dev/acpi/acpiec.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/acpi/acpiec.c,v
> retrieving revision 1.53
> diff -u -p -u -r1.53 acpiec.c
> --- sys/dev/acpi/acpiec.c     7 May 2016 18:03:36 -0000       1.53
> +++ sys/dev/acpi/acpiec.c     11 Aug 2016 20:06:54 -0000
> @@ -218,10 +218,12 @@ acpiec_read(struct acpiec_softc *sc, u_i
>        */
>       dnprintf(20, "%s: read %d, %d\n", DEVNAME(sc), (int)addr, len);
>       sc->sc_ecbusy = 1;
> -     acpiec_burst_enable(sc);
> +     if (len > 1)
> +             acpiec_burst_enable(sc);
>       for (reg = 0; reg < len; reg++)
>               buffer[reg] = acpiec_read_1(sc, addr + reg);
> -     acpiec_burst_disable(sc);
> +     if (len > 1)
> +             acpiec_burst_disable(sc);
>       sc->sc_ecbusy = 0;
>  }
>  
> @@ -237,10 +239,12 @@ acpiec_write(struct acpiec_softc *sc, u_
>        */
>       dnprintf(20, "%s: write %d, %d\n", DEVNAME(sc), (int)addr, len);
>       sc->sc_ecbusy = 1;
> -     acpiec_burst_enable(sc);
> +     if (len > 1)
> +             acpiec_burst_enable(sc);
>       for (reg = 0; reg < len; reg++)
>               acpiec_write_1(sc, addr + reg, buffer[reg]);
> -     acpiec_burst_disable(sc);
> +     if (len > 1)
> +             acpiec_burst_disable(sc);
>       sc->sc_ecbusy = 0;
>  }
>  
> 
> 

Reply via email to