[PATCH] acpi: method: add check for _ALR
Alex Hung
alex.hung at canonical.com
Tue Oct 7 08:15:24 UTC 2014
Thanks Colin. I also found it can be improved a little be in addition to
the continue. I will send the patch v2 shortly.
On Tue, Oct 7, 2014 at 3:14 PM, Colin Ian King <colin.king at canonical.com>
wrote:
> On 07/10/14 07:43, Alex Hung wrote:
> > Signed-off-by: Alex Hung <alex.hung at canonical.com>
> > ---
> > src/acpi/method/method.c | 78
> ++++++++++++++++++++++++++++++++++++++++++++++--
> > 1 file changed, 75 insertions(+), 3 deletions(-)
> >
> > diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
> > index cb873cb..879e072 100644
> > --- a/src/acpi/method/method.c
> > +++ b/src/acpi/method/method.c
> > @@ -38,7 +38,7 @@
> > * _ALC 9.2.5 Y
> > * _ALI 9.2.2 Y
> > * _ALP 9.2.6 Y
> > - * _ALR 9.2.5 N
> > + * _ALR 9.2.5 Y
> > * _ALT 9.2.3 Y
> > * _ALx 11.4.2 N
> > * _ART 11.4.3 Y
> > @@ -3555,7 +3555,79 @@ method_test_integer(_ALC, METHOD_OPTIONAL)
> > method_test_integer(_ALI, METHOD_OPTIONAL)
> > method_test_integer(_ALT, METHOD_OPTIONAL)
> >
> > -/* TODO _ALR */
> > +static void method_test_ALR_return(
> > + fwts_framework *fw,
> > + char *name,
> > + ACPI_BUFFER *buf,
> > + ACPI_OBJECT *obj,
> > + void *private)
> > +{
> > + uint32_t i;
> > + bool failed = false;
> > +
> > + FWTS_UNUSED(private);
> > +
> > + if (method_check_type(fw, name, buf, ACPI_TYPE_PACKAGE) != FWTS_OK)
> > + return;
> > +
> > + /* Could be one or more sub-packages */
> > + for (i = 0; i < obj->Package.Count; i++) {
> > + ACPI_OBJECT *pkg;
> > + uint32_t adjustment = 0, illuminance = 0;
> > + bool elements_ok = true;
> > +
> > + pkg = &obj->Package.Elements[i];
> > + if (pkg->Package.Count != 2) {
> > + fwts_failed(fw, LOG_LEVEL_MEDIUM,
> > + "Method_ALRBadSubPackageElementCount",
> > + "%s sub-package %" PRIu32 " was expected
> to "
> > + "have 2 elements, got %" PRIu32 " elements
> instead.",
> > + name, i, pkg->Package.Count);
> > + failed = true;
> > + continue;
> > + } else {
> > + /* elements should be listed in monotonically
> increasing order */
> > + if (pkg->Package.Elements[0].Type !=
> ACPI_TYPE_INTEGER ||
> > + adjustment >
> pkg->Package.Elements[0].Integer.Value) {
> > + fwts_failed(fw, LOG_LEVEL_MEDIUM,
> > +
> "Method_ALRBadSubPackageReturnType",
> > + "%s sub-package %" PRIu32
> > + " element 0 is an invalid
> integer.",
> > + name, i);
> > + elements_ok = false;
> > + }
> > +
> > + if (pkg->Package.Elements[1].Type !=
> ACPI_TYPE_INTEGER ||
> > + illuminance >
> pkg->Package.Elements[1].Integer.Value) {
> > + fwts_failed(fw, LOG_LEVEL_MEDIUM,
> > +
> "Method_ALRBadSubPackageReturnType",
> > + "%s sub-package %" PRIu32
> > + " element 1 is an invalid
> integer.",
> > + name, i);
> > + elements_ok = false;
> > + }
> > + adjustment =
> pkg->Package.Elements[0].Integer.Value;
> > + illuminance =
> pkg->Package.Elements[1].Integer.Value;
> > +
> > + }
> > +
> > + if (!elements_ok) {
> > + failed = true;
> > + continue;
>
> minor point, we don't really need the continue; I think it is redundant
>
> > + }
> > + }
> > +
> > + if (!failed)
> > + method_passed_sane(fw, name, "package");
> > +
> > + method_passed_sane(fw, name, "package");
> > +}
> > +
> > +static int method_test_ALR(fwts_framework *fw)
> > +{
> > + return method_evaluate_method(fw, METHOD_OPTIONAL,
> > + "_ALR", NULL, 0, method_test_ALR_return, NULL);
> > +}
> >
> > static int method_test_ALP(fwts_framework *fw)
> > {
> > @@ -5825,7 +5897,7 @@ static fwts_framework_minor_test method_tests[] = {
> > { method_test_ALI, "Test _ALI (Ambient Light Illuminance)." },
> > { method_test_ALT, "Test _ALT (Ambient Light Temperature)." },
> > { method_test_ALP, "Test _ALP (Ambient Light Polling). "},
> > - /* { method_test_ALR, "Test _ALR (Ambient Light Response). "}, */
> > + { method_test_ALR, "Test _ALR (Ambient Light Response). "},
> >
> > /* Section 9.3 Battery Device */
> >
> >
>
>
> --
> fwts-devel mailing list
> fwts-devel at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/fwts-devel
>
--
Cheers,
Alex Hung
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/fwts-devel/attachments/20141007/9301df64/attachment.html>
More information about the fwts-devel
mailing list