On Tue, Jan 16, 2018 at 02:28:11AM -0700, Anthony J. Bentley wrote:
> Hi,
>
> The 2015 Chromebook Pixel has a broken ACPI that doesn't support
> burst mode and will hang on boot when it's tried.
>
> Rev 1.54 of acpiec.c disabled it for single-byte reads and writes,
> which fixed this machine, but broke others. So it got reverted, with
> the note:
>
> "A machine/bios-dependent check could be added later to disable
> bursting on certain machines."
>
> jcs later sent me such a diff, and I've been using it for several
> months. I'm starting to tire of compiling my own kernels, so I'd
> like to get it in if possible.
>
> ok?
Besides the fact that it would make more sense to call the flag
cantburst and only set it when a broken machine was detected, OK.
>
>
> Index: sys/dev/acpi/acpidev.h
> ===================================================================
> RCS file: /cvs/src/sys/dev/acpi/acpidev.h,v
> retrieving revision 1.42
> diff -u -p -r1.42 acpidev.h
> --- sys/dev/acpi/acpidev.h 6 Sep 2017 13:01:48 -0000 1.42
> +++ sys/dev/acpi/acpidev.h 16 Jan 2018 09:19:54 -0000
> @@ -374,6 +374,7 @@ struct acpiec_softc {
> struct acpiec_event sc_events[ACPIEC_MAX_EVENTS];
> int sc_gotsci;
> int sc_glk;
> + int sc_canburst;
> };
>
> void acpibtn_disable_psw(void);
> Index: sys/dev/acpi/acpiec.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/acpi/acpiec.c,v
> retrieving revision 1.56
> diff -u -p -r1.56 acpiec.c
> --- sys/dev/acpi/acpiec.c 11 Mar 2017 21:46:32 -0000 1.56
> +++ sys/dev/acpi/acpiec.c 16 Jan 2018 09:19:54 -0000
> @@ -77,6 +77,8 @@ void acpiec_unlock(struct acpiec_softc
>
> int acpiec_reg(struct acpiec_softc *);
>
> +extern char *hw_vendor, *hw_prod;
> +
> struct cfattach acpiec_ca = {
> sizeof(struct acpiec_softc), acpiec_match, acpiec_attach
> };
> @@ -195,6 +197,9 @@ acpiec_write_1(struct acpiec_softc *sc,
> void
> acpiec_burst_enable(struct acpiec_softc *sc)
> {
> + if (!sc->sc_canburst)
> + return;
> +
> acpiec_write_cmd(sc, EC_CMD_BE);
> acpiec_read_data(sc);
> }
> @@ -202,6 +207,9 @@ acpiec_burst_enable(struct acpiec_softc
> void
> acpiec_burst_disable(struct acpiec_softc *sc)
> {
> + if (!sc->sc_canburst)
> + return;
> +
> if ((acpiec_status(sc) & EC_STAT_BURST) == EC_STAT_BURST)
> acpiec_write_cmd(sc, EC_CMD_BD);
> }
> @@ -273,6 +281,7 @@ acpiec_attach(struct device *parent, str
>
> sc->sc_acpi = (struct acpi_softc *)parent;
> sc->sc_devnode = aa->aaa_node;
> + sc->sc_canburst = 1;
>
> if (aml_evalinteger(sc->sc_acpi, sc->sc_devnode, "_STA", 0, NULL, &st))
> st = STA_PRESENT | STA_ENABLED | STA_DEV_OK;
> @@ -293,6 +302,16 @@ acpiec_attach(struct device *parent, str
> printf("%s: Failed to register address space\n", DEVNAME(sc));
> return;
> }
> +
> + /*
> + * Some Chromebooks using the Google EC do not support burst mode and
> + * cause us to spin forever waiting for the acknowledgment. Don't use
> + * burst mode at all on these machines.
> + */
> + if (hw_vendor != NULL && hw_prod != NULL &&
> + strcmp(hw_vendor, "GOOGLE") == 0 &&
> + strcmp(hw_prod, "Samus") == 0)
> + sc->sc_canburst = 0;
>
> acpiec_get_events(sc);
>