Commit | Line | Data |
---|---|---|
4d88a97a DW |
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 __ND_H__ | |
14 | #define __ND_H__ | |
1f7df6f8 | 15 | #include <linux/libnvdimm.h> |
4d88a97a DW |
16 | #include <linux/device.h> |
17 | #include <linux/mutex.h> | |
18 | #include <linux/ndctl.h> | |
19 | ||
20 | struct nvdimm_drvdata { | |
21 | struct device *dev; | |
22 | struct nd_cmd_get_config_size nsarea; | |
23 | void *data; | |
24 | }; | |
25 | ||
3d88002e DW |
26 | struct nd_region_namespaces { |
27 | int count; | |
28 | int active; | |
29 | }; | |
30 | ||
1f7df6f8 DW |
31 | struct nd_region { |
32 | struct device dev; | |
33 | u16 ndr_mappings; | |
34 | u64 ndr_size; | |
35 | u64 ndr_start; | |
36 | int id; | |
37 | void *provider_data; | |
eaf96153 | 38 | struct nd_interleave_set *nd_set; |
1f7df6f8 DW |
39 | struct nd_mapping mapping[0]; |
40 | }; | |
41 | ||
4d88a97a DW |
42 | enum nd_async_mode { |
43 | ND_SYNC, | |
44 | ND_ASYNC, | |
45 | }; | |
46 | ||
47 | void nd_device_register(struct device *dev); | |
48 | void nd_device_unregister(struct device *dev, enum nd_async_mode mode); | |
49 | int __init nvdimm_init(void); | |
3d88002e | 50 | int __init nd_region_init(void); |
4d88a97a | 51 | void nvdimm_exit(void); |
3d88002e | 52 | void nd_region_exit(void); |
4d88a97a DW |
53 | int nvdimm_init_nsarea(struct nvdimm_drvdata *ndd); |
54 | int nvdimm_init_config_data(struct nvdimm_drvdata *ndd); | |
3d88002e DW |
55 | struct nd_region *to_nd_region(struct device *dev); |
56 | int nd_region_to_nstype(struct nd_region *nd_region); | |
57 | int nd_region_register_namespaces(struct nd_region *nd_region, int *err); | |
58 | void nvdimm_bus_lock(struct device *dev); | |
59 | void nvdimm_bus_unlock(struct device *dev); | |
60 | bool is_nvdimm_bus_locked(struct device *dev); | |
4d88a97a | 61 | #endif /* __ND_H__ */ |