xref: /linux/tools/testing/nvdimm/test/nfit_test.h (revision e5c86679d5e864947a52fb31e45a425dea3e7fa9)
1 /*
2  * Copyright(c) 2013-2015 Intel Corporation. All rights reserved.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of version 2 of the GNU General Public License as
6  * published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * General Public License for more details.
12  */
13 #ifndef __NFIT_TEST_H__
14 #define __NFIT_TEST_H__
15 #include <linux/list.h>
16 #include <linux/ioport.h>
17 #include <linux/spinlock_types.h>
18 
19 struct nfit_test_request {
20 	struct list_head list;
21 	struct resource res;
22 };
23 
24 struct nfit_test_resource {
25 	struct list_head requests;
26 	struct list_head list;
27 	struct resource res;
28 	struct device *dev;
29 	spinlock_t lock;
30 	int req_count;
31 	void *buf;
32 };
33 
34 union acpi_object;
35 typedef void *acpi_handle;
36 
37 typedef struct nfit_test_resource *(*nfit_test_lookup_fn)(resource_size_t);
38 typedef union acpi_object *(*nfit_test_evaluate_dsm_fn)(acpi_handle handle,
39 		const u8 *uuid, u64 rev, u64 func, union acpi_object *argv4);
40 void __iomem *__wrap_ioremap_nocache(resource_size_t offset,
41 		unsigned long size);
42 void __wrap_iounmap(volatile void __iomem *addr);
43 void nfit_test_setup(nfit_test_lookup_fn lookup,
44 		nfit_test_evaluate_dsm_fn evaluate);
45 void nfit_test_teardown(void);
46 struct nfit_test_resource *get_nfit_res(resource_size_t resource);
47 #endif
48