Message ID | 1409565715-32145-2-git-send-email-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
On Mon, Sep 1, 2014 at 6:01 PM, Colin King <colin.king@canonical.com> wrote: > From: Colin Ian King <colin.king@canonical.com> > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/acpi/method/method.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 56 insertions(+) > > diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c > index 628f03e..4ccc094 100644 > --- a/src/acpi/method/method.c > +++ b/src/acpi/method/method.c > @@ -80,6 +80,7 @@ > * _DMA 6.2.4 Y > * _DOD B.4.2 Y > * _DOS B.4.1 Y > + * _DSD 6.2.5 Y > * _DSM 9.14.1 N > * _DSS B.6.8 Y > * _DSW 7.2.1 Y > @@ -1904,6 +1905,60 @@ static int method_test_FIX(fwts_framework *fw) > "_FIX", NULL, 0, method_test_FIX_return, NULL); > } > > +/* > + * Section 6.2.5 _DSD Device Specific Data, ACPI 5.1 > + */ > +static void method_test_DSD_return( > + fwts_framework *fw, > + char *name, > + ACPI_BUFFER *buf, > + ACPI_OBJECT *obj, > + void *private) > +{ > + uint32_t i; > + > + FWTS_UNUSED(private); > + > + if (method_check_type(fw, name, buf, ACPI_TYPE_PACKAGE) != FWTS_OK) > + return; > + > + /* Must be an even number of items in package */ > + if (obj->Package.Count & 1) { > + fwts_failed(fw, LOG_LEVEL_HIGH, "Method_DSDElementCount", > + "There must be an even number of items in the %s " > + "package, instead, got %" PRIu32 " elements.", > + name, obj->Package.Count); > + return; > + } > + for (i = 0; i < obj->Package.Count; i += 2) { > + /* UUID should be a buffer */ > + if (!method_type_matches(obj->Package.Elements[i].Type, ACPI_TYPE_BUFFER)) { > + fwts_failed(fw, LOG_LEVEL_MEDIUM, "Method_DSDElementBuffer", > + "%s package element %" PRIu32 " was not the expected " > + "type '%s', was instead type '%s'.", > + name, i, > + method_type_name(ACPI_TYPE_BUFFER), > + method_type_name(obj->Package.Elements[i].Type)); > + } > + > + /* Data should be a package */ > + if (!method_type_matches(obj->Package.Elements[i + 1].Type, ACPI_TYPE_PACKAGE)) { > + fwts_failed(fw, LOG_LEVEL_MEDIUM, "Method_DSDElementPackage", > + "%s package element %" PRIu32 " was not the expected " > + "type '%s', was instead type '%s'.", > + name, i + 1, > + method_type_name(ACPI_TYPE_PACKAGE), > + method_type_name(obj->Package.Elements[i + 1].Type)); > + } > + } > +} > + > +static int method_test_DSD(fwts_framework *fw) > +{ > + return method_evaluate_method(fw, METHOD_OPTIONAL, > + "_DSD", NULL, 0, method_test_DSD_return, NULL); > +} > + > static int method_test_DIS(fwts_framework *fw) > { > return method_evaluate_method(fw, METHOD_OPTIONAL, > @@ -4939,6 +4994,7 @@ static fwts_framework_minor_test method_tests[] = { > > { method_test_CDM, "Test _CDM (Clock Domain)." }, > { method_test_CRS, "Test _CRS (Current Resource Settings)." }, > + { method_test_DSD, "Test _DSD (Device Specific Data)." }, > { method_test_DIS, "Test _DIS (Disable)." }, > { method_test_DMA, "Test _DMA (Direct Memory Access)." }, > { method_test_FIX, "Test _FIX (Fixed Register Resource Provider)." }, > -- > 2.1.0 > > Acked-by: Keng-Yu Lin <kengyu@canonical.com>
On 09/01/2014 06:01 PM, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/acpi/method/method.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 56 insertions(+) > > diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c > index 628f03e..4ccc094 100644 > --- a/src/acpi/method/method.c > +++ b/src/acpi/method/method.c > @@ -80,6 +80,7 @@ > * _DMA 6.2.4 Y > * _DOD B.4.2 Y > * _DOS B.4.1 Y > + * _DSD 6.2.5 Y > * _DSM 9.14.1 N > * _DSS B.6.8 Y > * _DSW 7.2.1 Y > @@ -1904,6 +1905,60 @@ static int method_test_FIX(fwts_framework *fw) > "_FIX", NULL, 0, method_test_FIX_return, NULL); > } > > +/* > + * Section 6.2.5 _DSD Device Specific Data, ACPI 5.1 > + */ > +static void method_test_DSD_return( > + fwts_framework *fw, > + char *name, > + ACPI_BUFFER *buf, > + ACPI_OBJECT *obj, > + void *private) > +{ > + uint32_t i; > + > + FWTS_UNUSED(private); > + > + if (method_check_type(fw, name, buf, ACPI_TYPE_PACKAGE) != FWTS_OK) > + return; > + > + /* Must be an even number of items in package */ > + if (obj->Package.Count & 1) { > + fwts_failed(fw, LOG_LEVEL_HIGH, "Method_DSDElementCount", > + "There must be an even number of items in the %s " > + "package, instead, got %" PRIu32 " elements.", > + name, obj->Package.Count); > + return; > + } > + for (i = 0; i < obj->Package.Count; i += 2) { > + /* UUID should be a buffer */ > + if (!method_type_matches(obj->Package.Elements[i].Type, ACPI_TYPE_BUFFER)) { > + fwts_failed(fw, LOG_LEVEL_MEDIUM, "Method_DSDElementBuffer", > + "%s package element %" PRIu32 " was not the expected " > + "type '%s', was instead type '%s'.", > + name, i, > + method_type_name(ACPI_TYPE_BUFFER), > + method_type_name(obj->Package.Elements[i].Type)); > + } > + > + /* Data should be a package */ > + if (!method_type_matches(obj->Package.Elements[i + 1].Type, ACPI_TYPE_PACKAGE)) { > + fwts_failed(fw, LOG_LEVEL_MEDIUM, "Method_DSDElementPackage", > + "%s package element %" PRIu32 " was not the expected " > + "type '%s', was instead type '%s'.", > + name, i + 1, > + method_type_name(ACPI_TYPE_PACKAGE), > + method_type_name(obj->Package.Elements[i + 1].Type)); > + } > + } > +} > + > +static int method_test_DSD(fwts_framework *fw) > +{ > + return method_evaluate_method(fw, METHOD_OPTIONAL, > + "_DSD", NULL, 0, method_test_DSD_return, NULL); > +} > + > static int method_test_DIS(fwts_framework *fw) > { > return method_evaluate_method(fw, METHOD_OPTIONAL, > @@ -4939,6 +4994,7 @@ static fwts_framework_minor_test method_tests[] = { > > { method_test_CDM, "Test _CDM (Clock Domain)." }, > { method_test_CRS, "Test _CRS (Current Resource Settings)." }, > + { method_test_DSD, "Test _DSD (Device Specific Data)." }, > { method_test_DIS, "Test _DIS (Disable)." }, > { method_test_DMA, "Test _DMA (Direct Memory Access)." }, > { method_test_FIX, "Test _FIX (Fixed Register Resource Provider)." }, > Acked-by: Alex Hung <alex.hung@canonical.com>
diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c index 628f03e..4ccc094 100644 --- a/src/acpi/method/method.c +++ b/src/acpi/method/method.c @@ -80,6 +80,7 @@ * _DMA 6.2.4 Y * _DOD B.4.2 Y * _DOS B.4.1 Y + * _DSD 6.2.5 Y * _DSM 9.14.1 N * _DSS B.6.8 Y * _DSW 7.2.1 Y @@ -1904,6 +1905,60 @@ static int method_test_FIX(fwts_framework *fw) "_FIX", NULL, 0, method_test_FIX_return, NULL); } +/* + * Section 6.2.5 _DSD Device Specific Data, ACPI 5.1 + */ +static void method_test_DSD_return( + fwts_framework *fw, + char *name, + ACPI_BUFFER *buf, + ACPI_OBJECT *obj, + void *private) +{ + uint32_t i; + + FWTS_UNUSED(private); + + if (method_check_type(fw, name, buf, ACPI_TYPE_PACKAGE) != FWTS_OK) + return; + + /* Must be an even number of items in package */ + if (obj->Package.Count & 1) { + fwts_failed(fw, LOG_LEVEL_HIGH, "Method_DSDElementCount", + "There must be an even number of items in the %s " + "package, instead, got %" PRIu32 " elements.", + name, obj->Package.Count); + return; + } + for (i = 0; i < obj->Package.Count; i += 2) { + /* UUID should be a buffer */ + if (!method_type_matches(obj->Package.Elements[i].Type, ACPI_TYPE_BUFFER)) { + fwts_failed(fw, LOG_LEVEL_MEDIUM, "Method_DSDElementBuffer", + "%s package element %" PRIu32 " was not the expected " + "type '%s', was instead type '%s'.", + name, i, + method_type_name(ACPI_TYPE_BUFFER), + method_type_name(obj->Package.Elements[i].Type)); + } + + /* Data should be a package */ + if (!method_type_matches(obj->Package.Elements[i + 1].Type, ACPI_TYPE_PACKAGE)) { + fwts_failed(fw, LOG_LEVEL_MEDIUM, "Method_DSDElementPackage", + "%s package element %" PRIu32 " was not the expected " + "type '%s', was instead type '%s'.", + name, i + 1, + method_type_name(ACPI_TYPE_PACKAGE), + method_type_name(obj->Package.Elements[i + 1].Type)); + } + } +} + +static int method_test_DSD(fwts_framework *fw) +{ + return method_evaluate_method(fw, METHOD_OPTIONAL, + "_DSD", NULL, 0, method_test_DSD_return, NULL); +} + static int method_test_DIS(fwts_framework *fw) { return method_evaluate_method(fw, METHOD_OPTIONAL, @@ -4939,6 +4994,7 @@ static fwts_framework_minor_test method_tests[] = { { method_test_CDM, "Test _CDM (Clock Domain)." }, { method_test_CRS, "Test _CRS (Current Resource Settings)." }, + { method_test_DSD, "Test _DSD (Device Specific Data)." }, { method_test_DIS, "Test _DIS (Disable)." }, { method_test_DMA, "Test _DMA (Direct Memory Access)." }, { method_test_FIX, "Test _FIX (Fixed Register Resource Provider)." },