Message ID | 20200505041317.307921-1-alex.hung@canonical.com |
---|---|
State | Accepted |
Headers | show |
Series | acpi/method: check reserved bits from _BBN return | expand |
On 05/05/2020 05:13, Alex Hung wrote: > Signed-off-by: Alex Hung <alex.hung@canonical.com> > --- > src/acpi/method/method.c | 28 +++++++++++++++++++++++++++- > 1 file changed, 27 insertions(+), 1 deletion(-) > > diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c > index 3641f94e..cd4d15c7 100644 > --- a/src/acpi/method/method.c > +++ b/src/acpi/method/method.c > @@ -1230,10 +1230,36 @@ static int method_test_STA(fwts_framework *fw) > /* > * Section 6.5 Other Objects and Controls > */ > +static void method_test_BBN_return( > + fwts_framework *fw, > + char *name, > + ACPI_BUFFER *buf, > + ACPI_OBJECT *obj, > + void *private) > +{ > + bool failed = false; > + FWTS_UNUSED(private); > + > + if (fwts_method_check_type(fw, name, buf, ACPI_TYPE_INTEGER) != FWTS_OK) > + return; > + > + if ((obj->Integer.Value & 0xffffff00)) { > + fwts_failed(fw, LOG_LEVEL_MEDIUM, > + "Method_BBNIllegalReserved", > + "%s returned value 0x%8.8" PRIx64 " and some of the " > + "reserved bits are set when they should be zero.", > + name, (uint64_t)obj->Integer.Value); > + failed = true; > + } > + > + if (!failed) > + fwts_method_passed_sane(fw, name, "integer"); > +} > + > static int method_test_BBN(fwts_framework *fw) > { > return method_evaluate_method(fw, METHOD_OPTIONAL, "_BBN", > - NULL, 0, fwts_method_test_integer_return, "_BBN"); > + NULL, 0, method_test_BBN_return, NULL); > } > > static int method_test_BDN(fwts_framework *fw) > Acked-by: Colin Ian King <colin.king@canonical.com>
On 5/5/20 12:13 PM, Alex Hung wrote: > Signed-off-by: Alex Hung <alex.hung@canonical.com> > --- > src/acpi/method/method.c | 28 +++++++++++++++++++++++++++- > 1 file changed, 27 insertions(+), 1 deletion(-) > > diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c > index 3641f94e..cd4d15c7 100644 > --- a/src/acpi/method/method.c > +++ b/src/acpi/method/method.c > @@ -1230,10 +1230,36 @@ static int method_test_STA(fwts_framework *fw) > /* > * Section 6.5 Other Objects and Controls > */ > +static void method_test_BBN_return( > + fwts_framework *fw, > + char *name, > + ACPI_BUFFER *buf, > + ACPI_OBJECT *obj, > + void *private) > +{ > + bool failed = false; > + FWTS_UNUSED(private); > + > + if (fwts_method_check_type(fw, name, buf, ACPI_TYPE_INTEGER) != FWTS_OK) > + return; > + > + if ((obj->Integer.Value & 0xffffff00)) { > + fwts_failed(fw, LOG_LEVEL_MEDIUM, > + "Method_BBNIllegalReserved", > + "%s returned value 0x%8.8" PRIx64 " and some of the " > + "reserved bits are set when they should be zero.", > + name, (uint64_t)obj->Integer.Value); > + failed = true; > + } > + > + if (!failed) > + fwts_method_passed_sane(fw, name, "integer"); > +} > + > static int method_test_BBN(fwts_framework *fw) > { > return method_evaluate_method(fw, METHOD_OPTIONAL, "_BBN", > - NULL, 0, fwts_method_test_integer_return, "_BBN"); > + NULL, 0, method_test_BBN_return, NULL); > } > > static int method_test_BDN(fwts_framework *fw) > Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c index 3641f94e..cd4d15c7 100644 --- a/src/acpi/method/method.c +++ b/src/acpi/method/method.c @@ -1230,10 +1230,36 @@ static int method_test_STA(fwts_framework *fw) /* * Section 6.5 Other Objects and Controls */ +static void method_test_BBN_return( + fwts_framework *fw, + char *name, + ACPI_BUFFER *buf, + ACPI_OBJECT *obj, + void *private) +{ + bool failed = false; + FWTS_UNUSED(private); + + if (fwts_method_check_type(fw, name, buf, ACPI_TYPE_INTEGER) != FWTS_OK) + return; + + if ((obj->Integer.Value & 0xffffff00)) { + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "Method_BBNIllegalReserved", + "%s returned value 0x%8.8" PRIx64 " and some of the " + "reserved bits are set when they should be zero.", + name, (uint64_t)obj->Integer.Value); + failed = true; + } + + if (!failed) + fwts_method_passed_sane(fw, name, "integer"); +} + static int method_test_BBN(fwts_framework *fw) { return method_evaluate_method(fw, METHOD_OPTIONAL, "_BBN", - NULL, 0, fwts_method_test_integer_return, "_BBN"); + NULL, 0, method_test_BBN_return, NULL); } static int method_test_BDN(fwts_framework *fw)
Signed-off-by: Alex Hung <alex.hung@canonical.com> --- src/acpi/method/method.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-)