From c14a868a5a14f385059f012e54291de95a538a02 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Thu, 18 Aug 2016 22:15:04 -0700 Subject: tools/testing/nvdimm: unit test for acpi_nfit_notify() We have had a couple bugs in this implementation in the past and before we add another ->notify() implementation for nvdimm devices, lets allow this routine to be exercised via nfit_test. Rewrite acpi_nfit_notify() in terms of a generic struct device and acpi_handle parameter, and then implement a mock acpi_evaluate_object() that returns a _FIT payload. Cc: Vishal Verma Reviewed-by: Vishal Verma Acked-by: Rafael J. Wysocki Signed-off-by: Dan Williams --- tools/testing/nvdimm/test/iomap.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tools/testing/nvdimm/test/iomap.c') diff --git a/tools/testing/nvdimm/test/iomap.c b/tools/testing/nvdimm/test/iomap.c index c29f8dca9e67..dae5b9b6d186 100644 --- a/tools/testing/nvdimm/test/iomap.c +++ b/tools/testing/nvdimm/test/iomap.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include "nfit_test.h" @@ -276,4 +277,20 @@ void __wrap___devm_release_region(struct device *dev, struct resource *parent, } EXPORT_SYMBOL(__wrap___devm_release_region); +acpi_status __wrap_acpi_evaluate_object(acpi_handle handle, acpi_string path, + struct acpi_object_list *p, struct acpi_buffer *buf) +{ + struct nfit_test_resource *nfit_res = get_nfit_res((long) handle); + union acpi_object **obj; + + if (!nfit_res || strcmp(path, "_FIT") || !buf) + return acpi_evaluate_object(handle, path, p, buf); + + obj = nfit_res->buf; + buf->length = sizeof(union acpi_object); + buf->pointer = *obj; + return AE_OK; +} +EXPORT_SYMBOL(__wrap_acpi_evaluate_object); + MODULE_LICENSE("GPL v2"); -- cgit v1.2.3-59-g8ed1b