xref: /linux/tools/testing/nvdimm/test/ndtest.h (revision 55d0969c451159cff86949b38c39171cab962069)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #ifndef NDTEST_H
3 #define NDTEST_H
4 
5 #include <linux/platform_device.h>
6 #include <linux/libnvdimm.h>
7 
8 struct ndtest_config;
9 
10 struct ndtest_priv {
11 	struct platform_device pdev;
12 	struct device_node *dn;
13 	struct list_head resources;
14 	struct nvdimm_bus_descriptor bus_desc;
15 	struct nvdimm_bus *bus;
16 	struct ndtest_config *config;
17 
18 	dma_addr_t *dcr_dma;
19 	dma_addr_t *label_dma;
20 	dma_addr_t *dimm_dma;
21 };
22 
23 struct ndtest_blk_mmio {
24 	void __iomem *base;
25 	u64 size;
26 	u64 base_offset;
27 	u32 line_size;
28 	u32 num_lines;
29 	u32 table_size;
30 };
31 
32 struct ndtest_dimm {
33 	struct device *dev;
34 	struct nvdimm *nvdimm;
35 	struct ndtest_blk_mmio *mmio;
36 	struct nd_region *blk_region;
37 
38 	dma_addr_t address;
39 	unsigned long long flags;
40 	unsigned long config_size;
41 	void *label_area;
42 	char *uuid_str;
43 
44 	unsigned int size;
45 	unsigned int handle;
46 	unsigned int fail_cmd;
47 	unsigned int physical_id;
48 	unsigned int num_formats;
49 	int id;
50 	int fail_cmd_code;
51 	u8 no_alias;
52 };
53 
54 struct ndtest_mapping {
55 	u64 start;
56 	u64 size;
57 	u8 position;
58 	u8 dimm;
59 };
60 
61 struct ndtest_region {
62 	struct nd_region *region;
63 	struct ndtest_mapping *mapping;
64 	u64 size;
65 	u8 type;
66 	u8 num_mappings;
67 	u8 range_index;
68 };
69 
70 struct ndtest_config {
71 	struct ndtest_dimm *dimms;
72 	struct ndtest_region *regions;
73 	unsigned int dimm_count;
74 	unsigned int dimm_start;
75 	u8 num_regions;
76 };
77 
78 #endif /* NDTEST_H */
79