]>
Commit | Line | Data |
---|---|---|
f295e53b DW |
1 | #ifndef __NVDIMM_PMEM_H__ |
2 | #define __NVDIMM_PMEM_H__ | |
3 | #include <linux/badblocks.h> | |
4 | #include <linux/types.h> | |
5 | #include <linux/pfn_t.h> | |
6 | #include <linux/fs.h> | |
7 | ||
4e4f00a9 | 8 | #ifdef CONFIG_ARCH_HAS_PMEM_API |
ca6a4657 | 9 | #define ARCH_MEMREMAP_PMEM MEMREMAP_WB |
4e4f00a9 | 10 | void arch_wb_cache_pmem(void *addr, size_t size); |
f2b61257 | 11 | void arch_invalidate_pmem(void *addr, size_t size); |
4e4f00a9 | 12 | #else |
ca6a4657 | 13 | #define ARCH_MEMREMAP_PMEM MEMREMAP_WT |
4e4f00a9 DW |
14 | static inline void arch_wb_cache_pmem(void *addr, size_t size) |
15 | { | |
16 | } | |
f2b61257 DW |
17 | static inline void arch_invalidate_pmem(void *addr, size_t size) |
18 | { | |
19 | } | |
4e4f00a9 DW |
20 | #endif |
21 | ||
f295e53b DW |
22 | /* this definition is in it's own header for tools/testing/nvdimm to consume */ |
23 | struct pmem_device { | |
24 | /* One contiguous memory region per device */ | |
25 | phys_addr_t phys_addr; | |
26 | /* when non-zero this device is hosting a 'pfn' instance */ | |
27 | phys_addr_t data_offset; | |
28 | u64 pfn_flags; | |
7a9eb206 | 29 | void *virt_addr; |
f295e53b DW |
30 | /* immutable base size of the namespace */ |
31 | size_t size; | |
32 | /* trim size when namespace capacity has been section aligned */ | |
33 | u32 pfn_pad; | |
975750a9 | 34 | struct kernfs_node *bb_state; |
f295e53b | 35 | struct badblocks bb; |
c1d6e828 DW |
36 | struct dax_device *dax_dev; |
37 | struct gendisk *disk; | |
f295e53b | 38 | }; |
c1d6e828 DW |
39 | |
40 | long __pmem_direct_access(struct pmem_device *pmem, pgoff_t pgoff, | |
41 | long nr_pages, void **kaddr, pfn_t *pfn); | |
f295e53b | 42 | #endif /* __NVDIMM_PMEM_H__ */ |