Message ID | 1524200997-28824-1-git-send-email-alex.hung@canonical.com |
---|---|
State | Accepted |
Headers | show |
Series | [1/2] acpi: method: add test for _CLS control method | expand |
On 20/04/18 06:09, Alex Hung wrote: > While the document of PCI class code is not available, the format of > return package can still be checked. > > Signed-off-by: Alex Hung <alex.hung@canonical.com> > --- > src/acpi/method/method.c | 31 +++++++++++++++++++++++++++++-- > 1 file changed, 29 insertions(+), 2 deletions(-) > > diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c > index db50c7c..9cc7501 100644 > --- a/src/acpi/method/method.c > +++ b/src/acpi/method/method.c > @@ -65,7 +65,7 @@ > * _CCA Y > * _CDM Y > * _CID Y > - * _CLS N requires PCI SIG class info > + * _CLS Y > * _CPC Y > * _CR3 Y > * _CRS Y > @@ -765,6 +765,33 @@ static int method_test_PIC(fwts_framework *fw) > /* > * Section 6.1 Device Identification Objects > */ > +static void method_test_CLS_return( > + fwts_framework *fw, > + char *name, > + ACPI_BUFFER *buf, > + ACPI_OBJECT *obj, > + void *private) > +{ > + FWTS_UNUSED(private); > + > + if (fwts_method_check_type(fw, name, buf, ACPI_TYPE_PACKAGE) != FWTS_OK) > + return; > + > + if (fwts_method_package_count_equal(fw, name, "_CLS", obj, 3) != FWTS_OK) > + return; > + > + if (fwts_method_package_elements_all_type(fw, name, "_CLS", obj, ACPI_TYPE_INTEGER) != FWTS_OK) > + return; > + > + fwts_method_passed_sane(fw, name, "package"); > +} > + > +static int method_test_CLS(fwts_framework *fw) > +{ > + return method_evaluate_method(fw, METHOD_OPTIONAL, > + "_CLS", NULL, 0, method_test_CLS_return, NULL); > +} > + > static int method_test_DDN(fwts_framework *fw) > { > return method_evaluate_method(fw, METHOD_OPTIONAL, > @@ -6018,7 +6045,7 @@ static fwts_framework_minor_test method_tests[] = { > /* Section 6.1 Device Identification Objects */ > > { method_test_CID, "Test _CID (Compatible ID)." }, > - /* { method_test_CLS, "Test _CLS (Class Code)." }, */ > + { method_test_CLS, "Test _CLS (Class Code)." }, > { method_test_DDN, "Test _DDN (DOS Device Name)." }, > { method_test_HID, "Test _HID (Hardware ID)." }, > { method_test_HRV, "Test _HRV (Hardware Revision Number)." }, > Acked-by: Colin Ian King <colin.king@canonical.com>
On 04/20/2018 01:09 PM, Alex Hung wrote: > While the document of PCI class code is not available, the format of > return package can still be checked. > > Signed-off-by: Alex Hung <alex.hung@canonical.com> > --- > src/acpi/method/method.c | 31 +++++++++++++++++++++++++++++-- > 1 file changed, 29 insertions(+), 2 deletions(-) > > diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c > index db50c7c..9cc7501 100644 > --- a/src/acpi/method/method.c > +++ b/src/acpi/method/method.c > @@ -65,7 +65,7 @@ > * _CCA Y > * _CDM Y > * _CID Y > - * _CLS N requires PCI SIG class info > + * _CLS Y > * _CPC Y > * _CR3 Y > * _CRS Y > @@ -765,6 +765,33 @@ static int method_test_PIC(fwts_framework *fw) > /* > * Section 6.1 Device Identification Objects > */ > +static void method_test_CLS_return( > + fwts_framework *fw, > + char *name, > + ACPI_BUFFER *buf, > + ACPI_OBJECT *obj, > + void *private) > +{ > + FWTS_UNUSED(private); > + > + if (fwts_method_check_type(fw, name, buf, ACPI_TYPE_PACKAGE) != FWTS_OK) > + return; > + > + if (fwts_method_package_count_equal(fw, name, "_CLS", obj, 3) != FWTS_OK) > + return; > + > + if (fwts_method_package_elements_all_type(fw, name, "_CLS", obj, ACPI_TYPE_INTEGER) != FWTS_OK) > + return; > + > + fwts_method_passed_sane(fw, name, "package"); > +} > + > +static int method_test_CLS(fwts_framework *fw) > +{ > + return method_evaluate_method(fw, METHOD_OPTIONAL, > + "_CLS", NULL, 0, method_test_CLS_return, NULL); > +} > + > static int method_test_DDN(fwts_framework *fw) > { > return method_evaluate_method(fw, METHOD_OPTIONAL, > @@ -6018,7 +6045,7 @@ static fwts_framework_minor_test method_tests[] = { > /* Section 6.1 Device Identification Objects */ > > { method_test_CID, "Test _CID (Compatible ID)." }, > - /* { method_test_CLS, "Test _CLS (Class Code)." }, */ > + { method_test_CLS, "Test _CLS (Class Code)." }, > { method_test_DDN, "Test _DDN (DOS Device Name)." }, > { method_test_HID, "Test _HID (Hardware ID)." }, > { method_test_HRV, "Test _HRV (Hardware Revision Number)." }, > Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c index db50c7c..9cc7501 100644 --- a/src/acpi/method/method.c +++ b/src/acpi/method/method.c @@ -65,7 +65,7 @@ * _CCA Y * _CDM Y * _CID Y - * _CLS N requires PCI SIG class info + * _CLS Y * _CPC Y * _CR3 Y * _CRS Y @@ -765,6 +765,33 @@ static int method_test_PIC(fwts_framework *fw) /* * Section 6.1 Device Identification Objects */ +static void method_test_CLS_return( + fwts_framework *fw, + char *name, + ACPI_BUFFER *buf, + ACPI_OBJECT *obj, + void *private) +{ + FWTS_UNUSED(private); + + if (fwts_method_check_type(fw, name, buf, ACPI_TYPE_PACKAGE) != FWTS_OK) + return; + + if (fwts_method_package_count_equal(fw, name, "_CLS", obj, 3) != FWTS_OK) + return; + + if (fwts_method_package_elements_all_type(fw, name, "_CLS", obj, ACPI_TYPE_INTEGER) != FWTS_OK) + return; + + fwts_method_passed_sane(fw, name, "package"); +} + +static int method_test_CLS(fwts_framework *fw) +{ + return method_evaluate_method(fw, METHOD_OPTIONAL, + "_CLS", NULL, 0, method_test_CLS_return, NULL); +} + static int method_test_DDN(fwts_framework *fw) { return method_evaluate_method(fw, METHOD_OPTIONAL, @@ -6018,7 +6045,7 @@ static fwts_framework_minor_test method_tests[] = { /* Section 6.1 Device Identification Objects */ { method_test_CID, "Test _CID (Compatible ID)." }, - /* { method_test_CLS, "Test _CLS (Class Code)." }, */ + { method_test_CLS, "Test _CLS (Class Code)." }, { method_test_DDN, "Test _DDN (DOS Device Name)." }, { method_test_HID, "Test _HID (Hardware ID)." }, { method_test_HRV, "Test _HRV (Hardware Revision Number)." },
While the document of PCI class code is not available, the format of return package can still be checked. Signed-off-by: Alex Hung <alex.hung@canonical.com> --- src/acpi/method/method.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-)