1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef __NVDIMM_PMEM_H__ 3 #define __NVDIMM_PMEM_H__ 4 #include <linux/badblocks.h> 5 #include <linux/memremap.h> 6 #include <linux/types.h> 7 #include <linux/fs.h> 8 9 enum dax_access_mode; 10 11 /* this definition is in it's own header for tools/testing/nvdimm to consume */ 12 struct pmem_device { 13 /* One contiguous memory region per device */ 14 phys_addr_t phys_addr; 15 /* when non-zero this device is hosting a 'pfn' instance */ 16 phys_addr_t data_offset; 17 void *virt_addr; 18 /* immutable base size of the namespace */ 19 size_t size; 20 /* trim size when namespace capacity has been section aligned */ 21 u32 pfn_pad; 22 struct kernfs_node *bb_state; 23 struct badblocks bb; 24 struct dax_device *dax_dev; 25 struct gendisk *disk; 26 struct dev_pagemap pgmap; 27 }; 28 29 long __pmem_direct_access(struct pmem_device *pmem, pgoff_t pgoff, 30 long nr_pages, enum dax_access_mode mode, void **kaddr, 31 unsigned long *pfn); 32 33 #endif /* __NVDIMM_PMEM_H__ */ 34