]> git.ipfire.org Git - thirdparty/kernel/stable.git/blob - drivers/nvdimm/pfn.h
libnvdimm/pfn: fix fsdax-mode namespace info-block zero-fields
[thirdparty/kernel/stable.git] / drivers / nvdimm / pfn.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Copyright (c) 2014-2015, Intel Corporation.
4 */
5
6 #ifndef __NVDIMM_PFN_H
7 #define __NVDIMM_PFN_H
8
9 #include <linux/types.h>
10 #include <linux/mmzone.h>
11
12 #define PFN_SIG_LEN 16
13 #define PFN_SIG "NVDIMM_PFN_INFO\0"
14 #define DAX_SIG "NVDIMM_DAX_INFO\0"
15
16 struct nd_pfn_sb {
17 u8 signature[PFN_SIG_LEN];
18 u8 uuid[16];
19 u8 parent_uuid[16];
20 __le32 flags;
21 __le16 version_major;
22 __le16 version_minor;
23 __le64 dataoff; /* relative to namespace_base + start_pad */
24 __le64 npfns;
25 __le32 mode;
26 /* minor-version-1 additions for section alignment */
27 __le32 start_pad;
28 __le32 end_trunc;
29 /* minor-version-2 record the base alignment of the mapping */
30 __le32 align;
31 /* minor-version-3 guarantee the padding and flags are zero */
32 u8 padding[4000];
33 __le64 checksum;
34 };
35
36 #ifdef CONFIG_SPARSEMEM
37 #define PFN_SECTION_ALIGN_DOWN(x) SECTION_ALIGN_DOWN(x)
38 #define PFN_SECTION_ALIGN_UP(x) SECTION_ALIGN_UP(x)
39 #else
40 /*
41 * In this case ZONE_DEVICE=n and we will disable 'pfn' device support,
42 * but we still want pmem to compile.
43 */
44 #define PFN_SECTION_ALIGN_DOWN(x) (x)
45 #define PFN_SECTION_ALIGN_UP(x) (x)
46 #endif
47
48 #define PHYS_SECTION_ALIGN_DOWN(x) PFN_PHYS(PFN_SECTION_ALIGN_DOWN(PHYS_PFN(x)))
49 #define PHYS_SECTION_ALIGN_UP(x) PFN_PHYS(PFN_SECTION_ALIGN_UP(PHYS_PFN(x)))
50 #endif /* __NVDIMM_PFN_H */