Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Dan Williams | f295e53 | 2016-06-17 11:08:06 -0700 | [diff] [blame] | 2 | #ifndef __NVDIMM_PMEM_H__ |
| 3 | #define __NVDIMM_PMEM_H__ |
| 4 | #include <linux/badblocks.h> |
| 5 | #include <linux/types.h> |
| 6 | #include <linux/pfn_t.h> |
| 7 | #include <linux/fs.h> |
| 8 | |
Dan Williams | f295e53 | 2016-06-17 11:08:06 -0700 | [diff] [blame] | 9 | /* this definition is in it's own header for tools/testing/nvdimm to consume */ |
| 10 | struct pmem_device { |
| 11 | /* One contiguous memory region per device */ |
| 12 | phys_addr_t phys_addr; |
| 13 | /* when non-zero this device is hosting a 'pfn' instance */ |
| 14 | phys_addr_t data_offset; |
| 15 | u64 pfn_flags; |
Dan Williams | 7a9eb20 | 2016-06-03 18:06:47 -0700 | [diff] [blame] | 16 | void *virt_addr; |
Dan Williams | f295e53 | 2016-06-17 11:08:06 -0700 | [diff] [blame] | 17 | /* immutable base size of the namespace */ |
| 18 | size_t size; |
| 19 | /* trim size when namespace capacity has been section aligned */ |
| 20 | u32 pfn_pad; |
Toshi Kani | 975750a | 2017-06-12 16:25:11 -0600 | [diff] [blame] | 21 | struct kernfs_node *bb_state; |
Dan Williams | f295e53 | 2016-06-17 11:08:06 -0700 | [diff] [blame] | 22 | struct badblocks bb; |
Dan Williams | c1d6e82 | 2017-01-24 23:02:09 -0800 | [diff] [blame] | 23 | struct dax_device *dax_dev; |
| 24 | struct gendisk *disk; |
Dan Williams | f295e53 | 2016-06-17 11:08:06 -0700 | [diff] [blame] | 25 | }; |
Dan Williams | c1d6e82 | 2017-01-24 23:02:09 -0800 | [diff] [blame] | 26 | |
| 27 | long __pmem_direct_access(struct pmem_device *pmem, pgoff_t pgoff, |
| 28 | long nr_pages, void **kaddr, pfn_t *pfn); |
Dan Williams | f295e53 | 2016-06-17 11:08:06 -0700 | [diff] [blame] | 29 | #endif /* __NVDIMM_PMEM_H__ */ |