aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/libnvdimm.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/libnvdimm.h')
-rw-r--r--include/linux/libnvdimm.h24
1 files changed, 18 insertions, 6 deletions
diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h
index 0c3c30cbbea5..b519e137b9b7 100644
--- a/include/linux/libnvdimm.h
+++ b/include/linux/libnvdimm.h
@@ -52,6 +52,7 @@ typedef int (*ndctl_fn)(struct nvdimm_bus_descriptor *nd_desc,
52 52
53struct nd_namespace_label; 53struct nd_namespace_label;
54struct nvdimm_drvdata; 54struct nvdimm_drvdata;
55
55struct nd_mapping { 56struct nd_mapping {
56 struct nvdimm *nvdimm; 57 struct nvdimm *nvdimm;
57 struct nd_namespace_label **labels; 58 struct nd_namespace_label **labels;
@@ -69,6 +70,7 @@ struct nd_mapping {
69struct nvdimm_bus_descriptor { 70struct nvdimm_bus_descriptor {
70 const struct attribute_group **attr_groups; 71 const struct attribute_group **attr_groups;
71 unsigned long cmd_mask; 72 unsigned long cmd_mask;
73 struct module *module;
72 char *provider_name; 74 char *provider_name;
73 ndctl_fn ndctl; 75 ndctl_fn ndctl;
74 int (*flush_probe)(struct nvdimm_bus_descriptor *nd_desc); 76 int (*flush_probe)(struct nvdimm_bus_descriptor *nd_desc);
@@ -99,13 +101,21 @@ struct nd_region_desc {
99 unsigned long flags; 101 unsigned long flags;
100}; 102};
101 103
104struct device;
105void *devm_nvdimm_memremap(struct device *dev, resource_size_t offset,
106 size_t size, unsigned long flags);
107static inline void __iomem *devm_nvdimm_ioremap(struct device *dev,
108 resource_size_t offset, size_t size)
109{
110 return (void __iomem *) devm_nvdimm_memremap(dev, offset, size, 0);
111}
112
102struct nvdimm_bus; 113struct nvdimm_bus;
103struct module; 114struct module;
104struct device; 115struct device;
105struct nd_blk_region; 116struct nd_blk_region;
106struct nd_blk_region_desc { 117struct nd_blk_region_desc {
107 int (*enable)(struct nvdimm_bus *nvdimm_bus, struct device *dev); 118 int (*enable)(struct nvdimm_bus *nvdimm_bus, struct device *dev);
108 void (*disable)(struct nvdimm_bus *nvdimm_bus, struct device *dev);
109 int (*do_io)(struct nd_blk_region *ndbr, resource_size_t dpa, 119 int (*do_io)(struct nd_blk_region *ndbr, resource_size_t dpa,
110 void *iobuf, u64 len, int rw); 120 void *iobuf, u64 len, int rw);
111 struct nd_region_desc ndr_desc; 121 struct nd_region_desc ndr_desc;
@@ -119,22 +129,22 @@ static inline struct nd_blk_region_desc *to_blk_region_desc(
119} 129}
120 130
121int nvdimm_bus_add_poison(struct nvdimm_bus *nvdimm_bus, u64 addr, u64 length); 131int nvdimm_bus_add_poison(struct nvdimm_bus *nvdimm_bus, u64 addr, u64 length);
122struct nvdimm_bus *__nvdimm_bus_register(struct device *parent, 132struct nvdimm_bus *nvdimm_bus_register(struct device *parent,
123 struct nvdimm_bus_descriptor *nfit_desc, struct module *module); 133 struct nvdimm_bus_descriptor *nfit_desc);
124#define nvdimm_bus_register(parent, desc) \
125 __nvdimm_bus_register(parent, desc, THIS_MODULE)
126void nvdimm_bus_unregister(struct nvdimm_bus *nvdimm_bus); 134void nvdimm_bus_unregister(struct nvdimm_bus *nvdimm_bus);
127struct nvdimm_bus *to_nvdimm_bus(struct device *dev); 135struct nvdimm_bus *to_nvdimm_bus(struct device *dev);
128struct nvdimm *to_nvdimm(struct device *dev); 136struct nvdimm *to_nvdimm(struct device *dev);
129struct nd_region *to_nd_region(struct device *dev); 137struct nd_region *to_nd_region(struct device *dev);
130struct nd_blk_region *to_nd_blk_region(struct device *dev); 138struct nd_blk_region *to_nd_blk_region(struct device *dev);
131struct nvdimm_bus_descriptor *to_nd_desc(struct nvdimm_bus *nvdimm_bus); 139struct nvdimm_bus_descriptor *to_nd_desc(struct nvdimm_bus *nvdimm_bus);
140struct device *to_nvdimm_bus_dev(struct nvdimm_bus *nvdimm_bus);
132const char *nvdimm_name(struct nvdimm *nvdimm); 141const char *nvdimm_name(struct nvdimm *nvdimm);
133unsigned long nvdimm_cmd_mask(struct nvdimm *nvdimm); 142unsigned long nvdimm_cmd_mask(struct nvdimm *nvdimm);
134void *nvdimm_provider_data(struct nvdimm *nvdimm); 143void *nvdimm_provider_data(struct nvdimm *nvdimm);
135struct nvdimm *nvdimm_create(struct nvdimm_bus *nvdimm_bus, void *provider_data, 144struct nvdimm *nvdimm_create(struct nvdimm_bus *nvdimm_bus, void *provider_data,
136 const struct attribute_group **groups, unsigned long flags, 145 const struct attribute_group **groups, unsigned long flags,
137 unsigned long cmd_mask); 146 unsigned long cmd_mask, int num_flush,
147 struct resource *flush_wpq);
138const struct nd_cmd_desc *nd_cmd_dimm_desc(int cmd); 148const struct nd_cmd_desc *nd_cmd_dimm_desc(int cmd);
139const struct nd_cmd_desc *nd_cmd_bus_desc(int cmd); 149const struct nd_cmd_desc *nd_cmd_bus_desc(int cmd);
140u32 nd_cmd_in_size(struct nvdimm *nvdimm, int cmd, 150u32 nd_cmd_in_size(struct nvdimm *nvdimm, int cmd,
@@ -156,4 +166,6 @@ struct nvdimm *nd_blk_region_to_dimm(struct nd_blk_region *ndbr);
156unsigned int nd_region_acquire_lane(struct nd_region *nd_region); 166unsigned int nd_region_acquire_lane(struct nd_region *nd_region);
157void nd_region_release_lane(struct nd_region *nd_region, unsigned int lane); 167void nd_region_release_lane(struct nd_region *nd_region, unsigned int lane);
158u64 nd_fletcher64(void *addr, size_t len, bool le); 168u64 nd_fletcher64(void *addr, size_t len, bool le);
169void nvdimm_flush(struct nd_region *nd_region);
170int nvdimm_has_flush(struct nd_region *nd_region);
159#endif /* __LIBNVDIMM_H__ */ 171#endif /* __LIBNVDIMM_H__ */