Dan Williams | e145574 | 2015-07-30 17:57:47 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2014-2015, Intel Corporation. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify it |
| 5 | * under the terms and conditions of the GNU General Public License, |
| 6 | * version 2, as published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope it will be useful, but WITHOUT |
| 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 11 | * more details. |
| 12 | */ |
| 13 | |
| 14 | #ifndef __NVDIMM_PFN_H |
| 15 | #define __NVDIMM_PFN_H |
| 16 | |
| 17 | #include <linux/types.h> |
Dan Williams | d9cbe09 | 2016-03-03 09:14:36 -0800 | [diff] [blame] | 18 | #include <linux/mmzone.h> |
Dan Williams | e145574 | 2015-07-30 17:57:47 -0400 | [diff] [blame] | 19 | |
| 20 | #define PFN_SIG_LEN 16 |
| 21 | #define PFN_SIG "NVDIMM_PFN_INFO\0" |
Dan Williams | c5ed926 | 2016-05-18 14:50:12 -0700 | [diff] [blame] | 22 | #define DAX_SIG "NVDIMM_DAX_INFO\0" |
Dan Williams | e145574 | 2015-07-30 17:57:47 -0400 | [diff] [blame] | 23 | |
| 24 | struct nd_pfn_sb { |
| 25 | u8 signature[PFN_SIG_LEN]; |
| 26 | u8 uuid[16]; |
| 27 | u8 parent_uuid[16]; |
| 28 | __le32 flags; |
| 29 | __le16 version_major; |
| 30 | __le16 version_minor; |
Dan Williams | cfe30b8 | 2016-03-03 09:38:00 -0800 | [diff] [blame] | 31 | __le64 dataoff; /* relative to namespace_base + start_pad */ |
Dan Williams | e145574 | 2015-07-30 17:57:47 -0400 | [diff] [blame] | 32 | __le64 npfns; |
| 33 | __le32 mode; |
Dan Williams | cfe30b8 | 2016-03-03 09:38:00 -0800 | [diff] [blame] | 34 | /* minor-version-1 additions for section alignment */ |
| 35 | __le32 start_pad; |
| 36 | __le32 end_trunc; |
Dan Williams | 45a0dac | 2016-03-31 15:41:18 -0700 | [diff] [blame] | 37 | /* minor-version-2 record the base alignment of the mapping */ |
| 38 | __le32 align; |
Dan Williams | c3d7a20 | 2019-07-18 15:58:36 -0700 | [diff] [blame] | 39 | /* minor-version-3 guarantee the padding and flags are zero */ |
Dan Williams | 45a0dac | 2016-03-31 15:41:18 -0700 | [diff] [blame] | 40 | u8 padding[4000]; |
Dan Williams | e145574 | 2015-07-30 17:57:47 -0400 | [diff] [blame] | 41 | __le64 checksum; |
| 42 | }; |
Dan Williams | d9cbe09 | 2016-03-03 09:14:36 -0800 | [diff] [blame] | 43 | |
| 44 | #ifdef CONFIG_SPARSEMEM |
| 45 | #define PFN_SECTION_ALIGN_DOWN(x) SECTION_ALIGN_DOWN(x) |
| 46 | #define PFN_SECTION_ALIGN_UP(x) SECTION_ALIGN_UP(x) |
| 47 | #else |
| 48 | /* |
| 49 | * In this case ZONE_DEVICE=n and we will disable 'pfn' device support, |
| 50 | * but we still want pmem to compile. |
| 51 | */ |
| 52 | #define PFN_SECTION_ALIGN_DOWN(x) (x) |
| 53 | #define PFN_SECTION_ALIGN_UP(x) (x) |
| 54 | #endif |
Dan Williams | cfe30b8 | 2016-03-03 09:38:00 -0800 | [diff] [blame] | 55 | |
| 56 | #define PHYS_SECTION_ALIGN_DOWN(x) PFN_PHYS(PFN_SECTION_ALIGN_DOWN(PHYS_PFN(x))) |
| 57 | #define PHYS_SECTION_ALIGN_UP(x) PFN_PHYS(PFN_SECTION_ALIGN_UP(PHYS_PFN(x))) |
Dan Williams | e145574 | 2015-07-30 17:57:47 -0400 | [diff] [blame] | 58 | #endif /* __NVDIMM_PFN_H */ |