Re: make acpiec _GLK aware
On Thu, Jul 12, 2012 at 09:56:40AM -0700, Matthew Dempsky wrote: > On Thu, Jul 12, 2012 at 9:48 AM, Paul Irofti wrote: > > + if (aml_evalname(sc->sc_acpi, sc->sc_devnode, "_GLK", 0, NULL, > > &res)) > > + sc->sc_glk = 0; > > + if (res.type != AML_OBJTYPE_INTEGER) > > + sc->sc_glk = 0; > > + else > > + sc->sc_glk = res.v_integer ? 1 : 0; > > The second "if" should be an "else if", no? Or is res.type guaranteed > to be initialized even if aml_evalname() fails? Yup, there's a need for an else if there. Thanks!
Re: make acpiec _GLK aware
> Date: Thu, 12 Jul 2012 19:46:27 +0200 (CEST) > From: Mark Kettenis > > With that change this is ok kettenis@ Except for the thing that matthwe@ pointed out of course.
Re: make acpiec _GLK aware
> Date: Thu, 12 Jul 2012 19:48:33 +0300 > From: Paul Irofti > > This is a preparation diff making acpiec(4) global lock aware. > > Others will build on it when doing reads and writes. > > Okay? Makes sense to me, except for: > Index: acpidev.h > === > RCS file: /cvs/src/sys/dev/acpi/acpidev.h,v > retrieving revision 1.32 > diff -u -p -r1.32 acpidev.h > --- acpidev.h 6 Aug 2010 21:12:27 - 1.32 > +++ acpidev.h 12 Jul 2012 16:37:18 - > @@ -332,6 +332,7 @@ struct acpiec_softc { > u_int32_t sc_gpe; > struct acpiec_event sc_events[ACPIEC_MAX_EVENTS]; > int sc_gotsci; > + charsc_glk; ..using char here is a bit weird. It won't save any space and it makes more sense to use int like we already do for sc_gotsci. With that change this is ok kettenis@
Re: make acpiec _GLK aware
On Thu, Jul 12, 2012 at 9:48 AM, Paul Irofti wrote: > + if (aml_evalname(sc->sc_acpi, sc->sc_devnode, "_GLK", 0, NULL, &res)) > + sc->sc_glk = 0; > + if (res.type != AML_OBJTYPE_INTEGER) > + sc->sc_glk = 0; > + else > + sc->sc_glk = res.v_integer ? 1 : 0; The second "if" should be an "else if", no? Or is res.type guaranteed to be initialized even if aml_evalname() fails?
make acpiec _GLK aware
This is a preparation diff making acpiec(4) global lock aware. Others will build on it when doing reads and writes. Okay? Index: acpiec.c === RCS file: /cvs/src/sys/dev/acpi/acpiec.c,v retrieving revision 1.45 diff -u -p -r1.45 acpiec.c --- acpiec.c10 Mar 2012 21:27:07 - 1.45 +++ acpiec.c12 Jul 2012 16:37:18 - @@ -253,7 +253,8 @@ acpiec_match(struct device *parent, void struct acpi_softc *acpisc = (struct acpi_softc *)parent; /* Check for early ECDT table attach */ - if (ecdt && !memcmp(ecdt->hdr.signature, ECDT_SIG, sizeof(ECDT_SIG) - 1)) + if (ecdt && + !memcmp(ecdt->hdr.signature, ECDT_SIG, sizeof(ECDT_SIG) - 1)) return (1); if (acpisc->sc_ec) return (0); @@ -267,6 +268,7 @@ acpiec_attach(struct device *parent, str { struct acpiec_softc *sc = (struct acpiec_softc *)self; struct acpi_attach_args *aa = aux; + struct aml_value res; sc->sc_acpi = (struct acpi_softc *)parent; sc->sc_devnode = aa->aaa_node; @@ -291,6 +293,13 @@ acpiec_attach(struct device *parent, str acpi_set_gpehandler(sc->sc_acpi, sc->sc_gpe, acpiec_gpehandler, sc, 1); #endif + + if (aml_evalname(sc->sc_acpi, sc->sc_devnode, "_GLK", 0, NULL, &res)) + sc->sc_glk = 0; + if (res.type != AML_OBJTYPE_INTEGER) + sc->sc_glk = 0; + else + sc->sc_glk = res.v_integer ? 1 : 0; printf("\n"); } Index: acpidev.h === RCS file: /cvs/src/sys/dev/acpi/acpidev.h,v retrieving revision 1.32 diff -u -p -r1.32 acpidev.h --- acpidev.h 6 Aug 2010 21:12:27 - 1.32 +++ acpidev.h 12 Jul 2012 16:37:18 - @@ -332,6 +332,7 @@ struct acpiec_softc { u_int32_t sc_gpe; struct acpiec_event sc_events[ACPIEC_MAX_EVENTS]; int sc_gotsci; + charsc_glk; }; void acpibtn_disable_psw(void);