pfn.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. #ifndef __NVDIMM_PFN_H
  14. #define __NVDIMM_PFN_H
  15. #include <linux/types.h>
  16. #include <linux/mmzone.h>
  17. #define PFN_SIG_LEN 16
  18. #define PFN_SIG "NVDIMM_PFN_INFO\0"
  19. struct nd_pfn_sb {
  20. u8 signature[PFN_SIG_LEN];
  21. u8 uuid[16];
  22. u8 parent_uuid[16];
  23. __le32 flags;
  24. __le16 version_major;
  25. __le16 version_minor;
  26. __le64 dataoff; /* relative to namespace_base + start_pad */
  27. __le64 npfns;
  28. __le32 mode;
  29. /* minor-version-1 additions for section alignment */
  30. __le32 start_pad;
  31. __le32 end_trunc;
  32. u8 padding[4004];
  33. __le64 checksum;
  34. };
  35. #ifdef CONFIG_SPARSEMEM
  36. #define PFN_SECTION_ALIGN_DOWN(x) SECTION_ALIGN_DOWN(x)
  37. #define PFN_SECTION_ALIGN_UP(x) SECTION_ALIGN_UP(x)
  38. #else
  39. /*
  40. * In this case ZONE_DEVICE=n and we will disable 'pfn' device support,
  41. * but we still want pmem to compile.
  42. */
  43. #define PFN_SECTION_ALIGN_DOWN(x) (x)
  44. #define PFN_SECTION_ALIGN_UP(x) (x)
  45. #endif
  46. #define PHYS_SECTION_ALIGN_DOWN(x) PFN_PHYS(PFN_SECTION_ALIGN_DOWN(PHYS_PFN(x)))
  47. #define PHYS_SECTION_ALIGN_UP(x) PFN_PHYS(PFN_SECTION_ALIGN_UP(PHYS_PFN(x)))
  48. #endif /* __NVDIMM_PFN_H */