xref: /OK3568_Linux_fs/kernel/drivers/nvdimm/pfn.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-only */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * Copyright (c) 2014-2015, Intel Corporation.
4*4882a593Smuzhiyun  */
5*4882a593Smuzhiyun 
6*4882a593Smuzhiyun #ifndef __NVDIMM_PFN_H
7*4882a593Smuzhiyun #define __NVDIMM_PFN_H
8*4882a593Smuzhiyun 
9*4882a593Smuzhiyun #include <linux/types.h>
10*4882a593Smuzhiyun #include <linux/mmzone.h>
11*4882a593Smuzhiyun 
12*4882a593Smuzhiyun #define PFN_SIG_LEN 16
13*4882a593Smuzhiyun #define PFN_SIG "NVDIMM_PFN_INFO\0"
14*4882a593Smuzhiyun #define DAX_SIG "NVDIMM_DAX_INFO\0"
15*4882a593Smuzhiyun 
16*4882a593Smuzhiyun struct nd_pfn_sb {
17*4882a593Smuzhiyun 	u8 signature[PFN_SIG_LEN];
18*4882a593Smuzhiyun 	u8 uuid[16];
19*4882a593Smuzhiyun 	u8 parent_uuid[16];
20*4882a593Smuzhiyun 	__le32 flags;
21*4882a593Smuzhiyun 	__le16 version_major;
22*4882a593Smuzhiyun 	__le16 version_minor;
23*4882a593Smuzhiyun 	__le64 dataoff; /* relative to namespace_base + start_pad */
24*4882a593Smuzhiyun 	__le64 npfns;
25*4882a593Smuzhiyun 	__le32 mode;
26*4882a593Smuzhiyun 	/* minor-version-1 additions for section alignment */
27*4882a593Smuzhiyun 	/**
28*4882a593Smuzhiyun 	 * @start_pad: Deprecated attribute to pad start-misaligned namespaces
29*4882a593Smuzhiyun 	 *
30*4882a593Smuzhiyun 	 * start_pad is deprecated because the original definition did
31*4882a593Smuzhiyun 	 * not comprehend that dataoff is relative to the base address
32*4882a593Smuzhiyun 	 * of the namespace not the start_pad adjusted base. The result
33*4882a593Smuzhiyun 	 * is that the dax path is broken, but the block-I/O path is
34*4882a593Smuzhiyun 	 * not. The kernel will no longer create namespaces using start
35*4882a593Smuzhiyun 	 * padding, but it still supports block-I/O for legacy
36*4882a593Smuzhiyun 	 * configurations mainly to allow a backup, reconfigure the
37*4882a593Smuzhiyun 	 * namespace, and restore flow to repair dax operation.
38*4882a593Smuzhiyun 	 */
39*4882a593Smuzhiyun 	__le32 start_pad;
40*4882a593Smuzhiyun 	__le32 end_trunc;
41*4882a593Smuzhiyun 	/* minor-version-2 record the base alignment of the mapping */
42*4882a593Smuzhiyun 	__le32 align;
43*4882a593Smuzhiyun 	/* minor-version-3 guarantee the padding and flags are zero */
44*4882a593Smuzhiyun 	/* minor-version-4 record the page size and struct page size */
45*4882a593Smuzhiyun 	__le32 page_size;
46*4882a593Smuzhiyun 	__le16 page_struct_size;
47*4882a593Smuzhiyun 	u8 padding[3994];
48*4882a593Smuzhiyun 	__le64 checksum;
49*4882a593Smuzhiyun };
50*4882a593Smuzhiyun 
51*4882a593Smuzhiyun #endif /* __NVDIMM_PFN_H */
52