[PATCH] acpi: fix incorrect parameter to fwts_acpi_reserved_bits_check
Alex Hung
alex.hung at canonical.com
Sat Dec 19 03:51:44 UTC 2020
Last parameter should be "passed" but "failed" was past in some cases in
method.c.
Moving common functions used in both method.c and nvdimm.c to library
while fixing fwts_acpi_reserved_bits_check too.
Signed-off-by: Alex Hung <alex.hung at canonical.com>
---
src/acpi/devices/nvdimm/nvdimm.c | 173 +-----------------
src/acpi/method/method.c | 225 ++----------------------
src/lib/include/fwts_acpi_object_eval.h | 6 +
src/lib/src/fwts_acpi_object_eval.c | 203 +++++++++++++++++++++
4 files changed, 228 insertions(+), 379 deletions(-)
diff --git a/src/acpi/devices/nvdimm/nvdimm.c b/src/acpi/devices/nvdimm/nvdimm.c
index 26c42d6c..c76b6452 100644
--- a/src/acpi/devices/nvdimm/nvdimm.c
+++ b/src/acpi/devices/nvdimm/nvdimm.c
@@ -77,190 +77,34 @@ static int acpi_nvdimm_init(fwts_framework *fw)
return FWTS_OK;
}
-static void check_nvdimm_status(
- fwts_framework *fw,
- char *name,
- uint16_t status,
- bool *failed)
-{
- if (status > 6) {
- *failed = true;
- fwts_failed(fw, LOG_LEVEL_MEDIUM,
- "MethodBadStatus",
- "%s: Expected Status to be 0..6, got %" PRIx16,
- name, status);
- }
-}
-
-static void check_nvdimm_extended_status(
- fwts_framework *fw,
- char *name,
- uint16_t ext_status,
- uint16_t expected,
- bool *failed)
-{
- if (ext_status != expected) {
- *failed = true;
- fwts_failed(fw, LOG_LEVEL_MEDIUM,
- "MethodBadExtendedStatus",
- "%s: Expected Extended Status to be %" PRIx16
- ", got %" PRIx16, name, expected, ext_status);
- }
-}
-
-static void method_test_NCH_return(
- fwts_framework *fw,
- char *name,
- ACPI_BUFFER *buf,
- ACPI_OBJECT *obj,
- void *private)
-{
- bool failed = false;
- nch_return_t *ret;
-
- FWTS_UNUSED(private);
-
- if (fwts_method_check_type(fw, name, buf, ACPI_TYPE_BUFFER) != FWTS_OK)
- return;
-
- if (fwts_method_buffer_size(fw, name, obj, 64) != FWTS_OK)
- failed = true;
-
- ret = (nch_return_t *) obj->Buffer.Pointer;
- check_nvdimm_status(fw, name, ret->status, &failed);
- check_nvdimm_extended_status(fw, name, ret->extended_status, 0, &failed);
- fwts_acpi_reserved_bits_check(fw, "_NCH", "Validation Flags",
- ret->extended_status, sizeof(uint16_t), 2, 15, &failed);
-
- /* Health Status Flags [2..7], [11.15], [19..31] are reserved */
- fwts_acpi_reserved_bits_check(fw, "_NCH", "Health Status Flags",
- ret->health_status_flags, sizeof(uint32_t), 2, 7, &failed);
- fwts_acpi_reserved_bits_check(fw, "_NCH", "Health Status Flags",
- ret->health_status_flags, sizeof(uint32_t), 11, 15, &failed);
- fwts_acpi_reserved_bits_check(fw, "_NCH", "Health Status Flags",
- ret->health_status_flags, sizeof(uint32_t), 19, 31, &failed);
-
- fwts_acpi_reserved_bits_check(fw, "_NCH", "Health Status Attributes",
- ret->health_status_attributes, sizeof(uint32_t), 1, 31, &failed);
-
- if (!failed)
- fwts_method_passed_sane(fw, name, "buffer");
-}
-
static int method_test_NCH(fwts_framework *fw)
{
return fwts_evaluate_method(fw, METHOD_MANDATORY, &device,
- "_NCH", NULL, 0, method_test_NCH_return, NULL);
-}
-
-static void method_test_NBS_return(
- fwts_framework *fw,
- char *name,
- ACPI_BUFFER *buf,
- ACPI_OBJECT *obj,
- void *private)
-{
- bool failed = false;
- nbs_return_t *ret;
-
- FWTS_UNUSED(private);
-
- if (fwts_method_check_type(fw, name, buf, ACPI_TYPE_BUFFER) != FWTS_OK)
- return;
-
- if (fwts_method_buffer_size(fw, name, obj, 64) != FWTS_OK)
- failed = true;
-
- ret = (nbs_return_t *) obj->Buffer.Pointer;
- check_nvdimm_status(fw, name, ret->status, &failed);
- check_nvdimm_extended_status(fw, name, ret->extended_status, 0, &failed);
- fwts_acpi_reserved_bits_check(fw, "_NBS", "Validation Flags",
- ret->validation_flags, sizeof(uint16_t), 1, 15, &failed);
-
- if (!failed)
- fwts_method_passed_sane(fw, name, "buffer");
+ "_NCH", NULL, 0, fwts_method_test_NCH_return, NULL);
}
static int method_test_NBS(fwts_framework *fw)
{
return fwts_evaluate_method(fw, METHOD_MANDATORY, &device,
- "_NBS", NULL, 0, method_test_NBS_return, NULL);
-}
-
-static void method_test_NIC_return(
- fwts_framework *fw,
- char *name,
- ACPI_BUFFER *buf,
- ACPI_OBJECT *obj,
- void *private)
-{
- bool failed = false;
- nic_return_t *ret;
-
- FWTS_UNUSED(private);
-
- if (fwts_method_check_type(fw, name, buf, ACPI_TYPE_BUFFER) != FWTS_OK)
- return;
-
- if (fwts_method_buffer_size(fw, name, obj, 64) != FWTS_OK)
- failed = true;
-
- ret = (nic_return_t *) obj->Buffer.Pointer;
- check_nvdimm_status(fw, name, ret->status, &failed);
- check_nvdimm_extended_status(fw, name, ret->extended_status, 0, &failed);
-
- /* Health Error Injection Capabilities [2..7], [11.15], [19..31] are reserved */
- fwts_acpi_reserved_bits_check(fw, "_NIC", "Health Error Injection Capabilities",
- ret->health_error_injection, sizeof(uint32_t), 2, 7, &failed);
- fwts_acpi_reserved_bits_check(fw, "_NIC", "Health Error Injection Capabilities",
- ret->health_error_injection, sizeof(uint32_t), 11, 15, &failed);
- fwts_acpi_reserved_bits_check(fw, "_NIC", "Health Error Injection Capabilities",
- ret->health_error_injection, sizeof(uint32_t), 19, 31, &failed);
-
- fwts_acpi_reserved_bits_check(fw, "_NIC", "Health Status Attributes Capabilities",
- ret->health_status_attributes, sizeof(uint32_t), 1, 31, &failed);
-
- if (!failed)
- fwts_method_passed_sane(fw, name, "buffer");
+ "_NBS", NULL, 0, fwts_method_test_NBS_return, NULL);
}
static int method_test_NIC(fwts_framework *fw)
{
return fwts_evaluate_method(fw, METHOD_MANDATORY, &device,
- "_NIC", NULL, 0, method_test_NIC_return, NULL);
+ "_NIC", NULL, 0, fwts_method_test_NIC_return, NULL);
}
-
-static void method_test_NIH_return(
- fwts_framework *fw,
- char *name,
- ACPI_BUFFER *buf,
- ACPI_OBJECT *obj,
- void *private)
+static int method_test_NIH(fwts_framework *fw)
{
- bool failed = false;
- nih_return_t *ret;
-
- FWTS_UNUSED(private);
-
- if (fwts_method_check_type(fw, name, buf, ACPI_TYPE_BUFFER) != FWTS_OK)
- return;
-
- if (fwts_method_buffer_size(fw, name, obj, 64) != FWTS_OK)
- failed = true;
-
- ret = (nih_return_t *) obj->Buffer.Pointer;
- check_nvdimm_status(fw, name, ret->status, &failed);
- check_nvdimm_extended_status(fw, name, ret->extended_status, 1, &failed);
-
- if (!failed)
- fwts_method_passed_sane(fw, name, "buffer");
+ return fwts_evaluate_method(fw, METHOD_MANDATORY, &device,
+ "_NIH", NULL, 0, fwts_method_test_NIH_return, NULL);
}
-static int method_test_NIH(fwts_framework *fw)
+static int method_test_NIG(fwts_framework *fw)
{
return fwts_evaluate_method(fw, METHOD_MANDATORY, &device,
- "_NIH", NULL, 0, method_test_NIH_return, NULL);
+ "_NIG", NULL, 0, fwts_method_test_NIG_return, NULL);
}
/* Evaluate Device Identification Objects - all are optional */
@@ -275,6 +119,7 @@ static fwts_framework_minor_test acpi_nvdimm_tests[] = {
{ method_test_NBS, "Test _NBS (NVDIMM Boot Status)." },
{ method_test_NIC, "Test _NIC (NVDIMM Health Error Injection Capabilities)." },
{ method_test_NIH, "Test _NIH (NVDIMM Inject/Clear Health Errors)." },
+ { method_test_NIG, "Test _NIG (NVDIMM Inject Health Error Status)." },
/* Device Identification Objects - all are optional */
{ method_test_HID, "Test _HID (Hardware ID)." },
{ NULL, NULL }
diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
index b34c4afe..1e84d92e 100644
--- a/src/acpi/method/method.c
+++ b/src/acpi/method/method.c
@@ -1183,7 +1183,7 @@ static void method_test_STA_return(
ACPI_OBJECT *obj,
void *private)
{
- bool failed = false;
+ bool passed = true;
FWTS_UNUSED(private);
@@ -1195,17 +1195,12 @@ static void method_test_STA_return(
"Method_STAEnabledNotPresent",
"%s indicates that the device is enabled "
"but not present, which is impossible.", name);
- failed = true;
- }
- if ((obj->Integer.Value & ~0x1f) != 0) {
- fwts_failed(fw, LOG_LEVEL_MEDIUM,
- "Method_STAReservedBitsSet",
- "%s is returning non-zero reserved "
- "bits 5-31. These should be zero.", name);
- failed = true;
+ passed = false;
}
+ fwts_acpi_reserved_bits_check(fw, "_STA", "Reserved Bits",
+ obj->Integer.Value, sizeof(uint32_t), 5, 31, &passed);
- if (!failed)
+ if (passed)
fwts_method_passed_sane_uint64(fw, name, obj->Integer.Value);
}
@@ -3388,183 +3383,22 @@ static int method_test_TIV(fwts_framework *fw)
/*
* Section 9.20 NVDIMM Devices
*/
-static void check_nvdimm_status(
- fwts_framework *fw,
- char *name,
- uint16_t status,
- bool *failed)
-{
- if (status > 6) {
- *failed = true;
- fwts_failed(fw, LOG_LEVEL_MEDIUM,
- "MethodBadStatus",
- "%s: Expected Status to be 0..6, got %" PRIx16,
- name, status);
- }
-}
-
-static void check_nvdimm_extended_status(
- fwts_framework *fw,
- char *name,
- uint16_t ext_status,
- uint16_t expected,
- bool *failed)
-{
- if (ext_status != expected) {
- *failed = true;
- fwts_failed(fw, LOG_LEVEL_MEDIUM,
- "MethodBadExtendedStatus",
- "%s: Expected Extended Status to be %" PRIx16
- ", got %" PRIx16, name, expected, ext_status);
- }
-}
-
-static void method_test_NBS_return(
- fwts_framework *fw,
- char *name,
- ACPI_BUFFER *buf,
- ACPI_OBJECT *obj,
- void *private)
-{
- bool failed = false;
- nbs_return_t *ret;
-
- FWTS_UNUSED(private);
-
- if (fwts_method_check_type(fw, name, buf, ACPI_TYPE_BUFFER) != FWTS_OK)
- return;
-
- if (fwts_method_buffer_size(fw, name, obj, 64) != FWTS_OK)
- failed = true;
-
- ret = (nbs_return_t *) obj->Buffer.Pointer;
- check_nvdimm_status(fw, name, ret->status, &failed);
- check_nvdimm_extended_status(fw, name, ret->extended_status, 0, &failed);
- fwts_acpi_reserved_bits_check(fw, "_NBS", "Validation Flags",
- ret->validation_flags, sizeof(uint16_t), 1, 15, &failed);
-
- if (!failed)
- fwts_method_passed_sane(fw, name, "buffer");
-}
-
static int method_test_NBS(fwts_framework *fw)
{
return method_evaluate_method(fw, METHOD_OPTIONAL,
- "_NBS", NULL, 0, method_test_NBS_return, NULL);
-}
-
-static void method_test_NCH_return(
- fwts_framework *fw,
- char *name,
- ACPI_BUFFER *buf,
- ACPI_OBJECT *obj,
- void *private)
-{
- bool failed = false;
- nch_return_t *ret;
-
- FWTS_UNUSED(private);
-
- if (fwts_method_check_type(fw, name, buf, ACPI_TYPE_BUFFER) != FWTS_OK)
- return;
-
- if (fwts_method_buffer_size(fw, name, obj, 64) != FWTS_OK)
- failed = true;
-
- ret = (nch_return_t *) obj->Buffer.Pointer;
- check_nvdimm_status(fw, name, ret->status, &failed);
- check_nvdimm_extended_status(fw, name, ret->extended_status, 0, &failed);
- fwts_acpi_reserved_bits_check(fw, "_NCH", "Validation Flags",
- ret->extended_status, sizeof(uint16_t), 2, 15, &failed);
-
- /* Health Status Flags [2..7], [11.15], [19..31] are reserved */
- fwts_acpi_reserved_bits_check(fw, "_NCH", "Health Status Flags",
- ret->health_status_flags, sizeof(uint32_t), 2, 7, &failed);
- fwts_acpi_reserved_bits_check(fw, "_NCH", "Health Status Flags",
- ret->health_status_flags, sizeof(uint32_t), 11, 15, &failed);
- fwts_acpi_reserved_bits_check(fw, "_NCH", "Health Status Flags",
- ret->health_status_flags, sizeof(uint32_t), 19, 31, &failed);
-
- fwts_acpi_reserved_bits_check(fw, "_NCH", "Health Status Attributes",
- ret->health_status_attributes, sizeof(uint32_t), 1, 31, &failed);
-
- if (!failed)
- fwts_method_passed_sane(fw, name, "buffer");
+ "_NBS", NULL, 0, fwts_method_test_NBS_return, NULL);
}
static int method_test_NCH(fwts_framework *fw)
{
return method_evaluate_method(fw, METHOD_OPTIONAL,
- "_NCH", NULL, 0, method_test_NCH_return, NULL);
-}
-
-static void method_test_NIC_return(
- fwts_framework *fw,
- char *name,
- ACPI_BUFFER *buf,
- ACPI_OBJECT *obj,
- void *private)
-{
- bool failed = false;
- nic_return_t *ret;
-
- FWTS_UNUSED(private);
-
- if (fwts_method_check_type(fw, name, buf, ACPI_TYPE_BUFFER) != FWTS_OK)
- return;
-
- if (fwts_method_buffer_size(fw, name, obj, 64) != FWTS_OK)
- failed = true;
-
- ret = (nic_return_t *) obj->Buffer.Pointer;
- check_nvdimm_status(fw, name, ret->status, &failed);
- check_nvdimm_extended_status(fw, name, ret->extended_status, 0, &failed);
-
- /* Health Error Injection Capabilities [2..7], [11.15], [19..31] are reserved */
- fwts_acpi_reserved_bits_check(fw, "_NIC", "Health Error Injection Capabilities",
- ret->health_error_injection, sizeof(uint32_t), 2, 7, &failed);
- fwts_acpi_reserved_bits_check(fw, "_NIC", "Health Error Injection Capabilities",
- ret->health_error_injection, sizeof(uint32_t), 11, 15, &failed);
- fwts_acpi_reserved_bits_check(fw, "_NIC", "Health Error Injection Capabilities",
- ret->health_error_injection, sizeof(uint32_t), 19, 31, &failed);
-
- fwts_acpi_reserved_bits_check(fw, "_NIC", "Health Status Attributes Capabilities",
- ret->health_status_attributes, sizeof(uint32_t), 1, 31, &failed);
-
- if (!failed)
- fwts_method_passed_sane(fw, name, "buffer");
+ "_NCH", NULL, 0, fwts_method_test_NCH_return, NULL);
}
static int method_test_NIC(fwts_framework *fw)
{
return method_evaluate_method(fw, METHOD_OPTIONAL,
- "_NIC", NULL, 0, method_test_NIC_return, NULL);
-}
-
-static void method_test_NIH_return(
- fwts_framework *fw,
- char *name,
- ACPI_BUFFER *buf,
- ACPI_OBJECT *obj,
- void *private)
-{
- bool failed = false;
- nih_return_t *ret;
-
- FWTS_UNUSED(private);
-
- if (fwts_method_check_type(fw, name, buf, ACPI_TYPE_BUFFER) != FWTS_OK)
- return;
-
- if (fwts_method_buffer_size(fw, name, obj, 64) != FWTS_OK)
- failed = true;
-
- ret = (nih_return_t *) obj->Buffer.Pointer;
- check_nvdimm_status(fw, name, ret->status, &failed);
- check_nvdimm_extended_status(fw, name, ret->extended_status, 1, &failed);
-
- if (!failed)
- fwts_method_passed_sane(fw, name, "buffer");
+ "_NIC", NULL, 0, fwts_method_test_NIC_return, NULL);
}
static int method_test_NIH(fwts_framework *fw)
@@ -3590,7 +3424,7 @@ static int method_test_NIH(fwts_framework *fw)
data[8] = j;
result = method_evaluate_method(fw, METHOD_OPTIONAL,
- "_NIH", &arg0, 1, method_test_NIH_return, NULL);
+ "_NIH", &arg0, 1, fwts_method_test_NIH_return, NULL);
if (result != FWTS_OK)
return result;
@@ -3600,49 +3434,10 @@ static int method_test_NIH(fwts_framework *fw)
return FWTS_OK;
}
-static void method_test_NIG_return(
- fwts_framework *fw,
- char *name,
- ACPI_BUFFER *buf,
- ACPI_OBJECT *obj,
- void *private)
-{
- bool failed = false;
- nig_return_t *ret;
-
- FWTS_UNUSED(private);
-
- if (fwts_method_check_type(fw, name, buf, ACPI_TYPE_BUFFER) != FWTS_OK)
- return;
-
- if (fwts_method_buffer_size(fw, name, obj, 64) != FWTS_OK)
- failed = true;
-
- ret = (nig_return_t *) obj->Buffer.Pointer;
- check_nvdimm_status(fw, name, ret->status, &failed);
- check_nvdimm_extended_status(fw, name, ret->extended_status, 0, &failed);
- fwts_acpi_reserved_bits_check(fw, "_NIG", "Validation Flags",
- ret->validation_flags, sizeof(uint16_t), 2, 15, &failed);
-
- /* Injected Health Status Errors [2..7], [11.15], [19..31] are reserved */
- fwts_acpi_reserved_bits_check(fw, "_NIG", "Injected Health Status Errors",
- ret->health_status_errors, sizeof(uint32_t), 2, 7, &failed);
- fwts_acpi_reserved_bits_check(fw, "_NIG", "Injected Health Status Errors",
- ret->health_status_errors, sizeof(uint32_t), 11, 15, &failed);
- fwts_acpi_reserved_bits_check(fw, "_NIG", "Injected Health Status Errors",
- ret->health_status_errors, sizeof(uint32_t), 19, 31, &failed);
-
- fwts_acpi_reserved_bits_check(fw, "_NIG", "Health Status Attributes of Injected Errors",
- ret->health_status_attributes, sizeof(uint32_t), 1, 31, &failed);
-
- if (!failed)
- fwts_method_passed_sane(fw, name, "buffer");
-}
-
static int method_test_NIG(fwts_framework *fw)
{
return method_evaluate_method(fw, METHOD_OPTIONAL,
- "_NIG", NULL, 0, method_test_NIG_return, NULL);
+ "_NIG", NULL, 0, fwts_method_test_NIG_return, NULL);
}
/*
diff --git a/src/lib/include/fwts_acpi_object_eval.h b/src/lib/include/fwts_acpi_object_eval.h
index 0687562f..af738354 100644
--- a/src/lib/include/fwts_acpi_object_eval.h
+++ b/src/lib/include/fwts_acpi_object_eval.h
@@ -167,4 +167,10 @@ void fwts_method_test_PLD_return(fwts_framework *fw, char *name, ACPI_BUFFER *bu
void fwts_method_test_SUB_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
void fwts_method_test_UID_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
+void fwts_method_test_NBS_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
+void fwts_method_test_NCH_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
+void fwts_method_test_NIC_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
+void fwts_method_test_NIH_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
+void fwts_method_test_NIG_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
+
#endif
diff --git a/src/lib/src/fwts_acpi_object_eval.c b/src/lib/src/fwts_acpi_object_eval.c
index e8b2e8d5..af21f132 100644
--- a/src/lib/src/fwts_acpi_object_eval.c
+++ b/src/lib/src/fwts_acpi_object_eval.c
@@ -2335,4 +2335,207 @@ void fwts_method_test_BMD_return(
fwts_method_passed_sane(fw, name, "package");
}
+/*
+ * Section 9.20 NVDIMM Devices
+ */
+static void check_nvdimm_status(
+ fwts_framework *fw,
+ char *name,
+ uint16_t status,
+ bool *passed)
+{
+ if (status > 6) {
+ *passed = false;
+ fwts_failed(fw, LOG_LEVEL_MEDIUM,
+ "MethodBadStatus",
+ "%s: Expected Status to be 0..6, got %" PRIx16,
+ name, status);
+ }
+}
+
+static void check_nvdimm_extended_status(
+ fwts_framework *fw,
+ char *name,
+ uint16_t ext_status,
+ uint16_t expected,
+ bool *passed)
+{
+ if (ext_status != expected) {
+ *passed = false;
+ fwts_failed(fw, LOG_LEVEL_MEDIUM,
+ "MethodBadExtendedStatus",
+ "%s: Expected Extended Status to be %" PRIx16
+ ", got %" PRIx16, name, expected, ext_status);
+ }
+}
+
+void fwts_method_test_NBS_return(
+ fwts_framework *fw,
+ char *name,
+ ACPI_BUFFER *buf,
+ ACPI_OBJECT *obj,
+ void *private)
+{
+ bool passed = true;
+ nbs_return_t *ret;
+
+ FWTS_UNUSED(private);
+
+ if (fwts_method_check_type(fw, name, buf, ACPI_TYPE_BUFFER) != FWTS_OK)
+ return;
+
+ if (fwts_method_buffer_size(fw, name, obj, 64) != FWTS_OK)
+ passed = false;
+
+ ret = (nbs_return_t *) obj->Buffer.Pointer;
+ check_nvdimm_status(fw, name, ret->status, &passed);
+ check_nvdimm_extended_status(fw, name, ret->extended_status, 0, &passed);
+ fwts_acpi_reserved_bits_check(fw, "_NBS", "Validation Flags",
+ ret->validation_flags, sizeof(uint16_t), 1, 15, &passed);
+
+ if (passed)
+ fwts_method_passed_sane(fw, name, "buffer");
+}
+
+void fwts_method_test_NCH_return(
+ fwts_framework *fw,
+ char *name,
+ ACPI_BUFFER *buf,
+ ACPI_OBJECT *obj,
+ void *private)
+{
+ bool passed = true;
+ nch_return_t *ret;
+
+ FWTS_UNUSED(private);
+
+ if (fwts_method_check_type(fw, name, buf, ACPI_TYPE_BUFFER) != FWTS_OK)
+ return;
+
+ if (fwts_method_buffer_size(fw, name, obj, 64) != FWTS_OK)
+ passed = false;
+
+ ret = (nch_return_t *) obj->Buffer.Pointer;
+ check_nvdimm_status(fw, name, ret->status, &passed);
+ check_nvdimm_extended_status(fw, name, ret->extended_status, 0, &passed);
+ fwts_acpi_reserved_bits_check(fw, "_NCH", "Validation Flags",
+ ret->extended_status, sizeof(uint16_t), 2, 15, &passed);
+
+ /* Health Status Flags [2..7], [11.15], [19..31] are reserved */
+ fwts_acpi_reserved_bits_check(fw, "_NCH", "Health Status Flags",
+ ret->health_status_flags, sizeof(uint32_t), 2, 7, &passed);
+ fwts_acpi_reserved_bits_check(fw, "_NCH", "Health Status Flags",
+ ret->health_status_flags, sizeof(uint32_t), 11, 15, &passed);
+ fwts_acpi_reserved_bits_check(fw, "_NCH", "Health Status Flags",
+ ret->health_status_flags, sizeof(uint32_t), 19, 31, &passed);
+
+ fwts_acpi_reserved_bits_check(fw, "_NCH", "Health Status Attributes",
+ ret->health_status_attributes, sizeof(uint32_t), 1, 31, &passed);
+
+ if (passed)
+ fwts_method_passed_sane(fw, name, "buffer");
+}
+
+void fwts_method_test_NIC_return(
+ fwts_framework *fw,
+ char *name,
+ ACPI_BUFFER *buf,
+ ACPI_OBJECT *obj,
+ void *private)
+{
+ bool passed = true;
+ nic_return_t *ret;
+
+ FWTS_UNUSED(private);
+
+ if (fwts_method_check_type(fw, name, buf, ACPI_TYPE_BUFFER) != FWTS_OK)
+ return;
+
+ if (fwts_method_buffer_size(fw, name, obj, 64) != FWTS_OK)
+ passed = false;
+
+ ret = (nic_return_t *) obj->Buffer.Pointer;
+ check_nvdimm_status(fw, name, ret->status, &passed);
+ check_nvdimm_extended_status(fw, name, ret->extended_status, 0, &passed);
+
+ /* Health Error Injection Capabilities [2..7], [11.15], [19..31] are reserved */
+ fwts_acpi_reserved_bits_check(fw, "_NIC", "Health Error Injection Capabilities",
+ ret->health_error_injection, sizeof(uint32_t), 2, 7, &passed);
+ fwts_acpi_reserved_bits_check(fw, "_NIC", "Health Error Injection Capabilities",
+ ret->health_error_injection, sizeof(uint32_t), 11, 15, &passed);
+ fwts_acpi_reserved_bits_check(fw, "_NIC", "Health Error Injection Capabilities",
+ ret->health_error_injection, sizeof(uint32_t), 19, 31, &passed);
+
+ fwts_acpi_reserved_bits_check(fw, "_NIC", "Health Status Attributes Capabilities",
+ ret->health_status_attributes, sizeof(uint32_t), 1, 31, &passed);
+
+ if (passed)
+ fwts_method_passed_sane(fw, name, "buffer");
+}
+
+void fwts_method_test_NIH_return(
+ fwts_framework *fw,
+ char *name,
+ ACPI_BUFFER *buf,
+ ACPI_OBJECT *obj,
+ void *private)
+{
+ bool passed = true;
+ nih_return_t *ret;
+
+ FWTS_UNUSED(private);
+
+ if (fwts_method_check_type(fw, name, buf, ACPI_TYPE_BUFFER) != FWTS_OK)
+ return;
+
+ if (fwts_method_buffer_size(fw, name, obj, 64) != FWTS_OK)
+ passed = false;
+
+ ret = (nih_return_t *) obj->Buffer.Pointer;
+ check_nvdimm_status(fw, name, ret->status, &passed);
+ check_nvdimm_extended_status(fw, name, ret->extended_status, 1, &passed);
+
+ if (passed)
+ fwts_method_passed_sane(fw, name, "buffer");
+}
+
+void fwts_method_test_NIG_return(
+ fwts_framework *fw,
+ char *name,
+ ACPI_BUFFER *buf,
+ ACPI_OBJECT *obj,
+ void *private)
+{
+ bool passed = true;
+ nig_return_t *ret;
+
+ FWTS_UNUSED(private);
+
+ if (fwts_method_check_type(fw, name, buf, ACPI_TYPE_BUFFER) != FWTS_OK)
+ return;
+
+ if (fwts_method_buffer_size(fw, name, obj, 64) != FWTS_OK)
+ passed = false;
+
+ ret = (nig_return_t *) obj->Buffer.Pointer;
+ check_nvdimm_status(fw, name, ret->status, &passed);
+ check_nvdimm_extended_status(fw, name, ret->extended_status, 0, &passed);
+ fwts_acpi_reserved_bits_check(fw, "_NIG", "Validation Flags",
+ ret->validation_flags, sizeof(uint16_t), 2, 15, &passed);
+
+ /* Injected Health Status Errors [2..7], [11.15], [19..31] are reserved */
+ fwts_acpi_reserved_bits_check(fw, "_NIG", "Injected Health Status Errors",
+ ret->health_status_errors, sizeof(uint32_t), 2, 7, &passed);
+ fwts_acpi_reserved_bits_check(fw, "_NIG", "Injected Health Status Errors",
+ ret->health_status_errors, sizeof(uint32_t), 11, 15, &passed);
+ fwts_acpi_reserved_bits_check(fw, "_NIG", "Injected Health Status Errors",
+ ret->health_status_errors, sizeof(uint32_t), 19, 31, &passed);
+
+ fwts_acpi_reserved_bits_check(fw, "_NIG", "Health Status Attributes of Injected Errors",
+ ret->health_status_attributes, sizeof(uint32_t), 1, 31, &passed);
+
+ if (passed)
+ fwts_method_passed_sane(fw, name, "buffer");
+}
+
#endif
--
2.25.1
More information about the fwts-devel
mailing list