Lines Matching refs:pfn_sb

206 		struct nd_pfn_sb *pfn_sb = nd_pfn->pfn_sb;  in resource_show()  local
207 u64 offset = __le64_to_cpu(pfn_sb->dataoff); in resource_show()
209 u32 start_pad = __le32_to_cpu(pfn_sb->start_pad); in resource_show()
232 struct nd_pfn_sb *pfn_sb = nd_pfn->pfn_sb; in size_show() local
233 u64 offset = __le64_to_cpu(pfn_sb->dataoff); in size_show()
235 u32 start_pad = __le32_to_cpu(pfn_sb->start_pad); in size_show()
236 u32 end_trunc = __le32_to_cpu(pfn_sb->end_trunc); in size_show()
369 struct nd_pfn_sb *pfn_sb = nd_pfn->pfn_sb; in nd_pfn_clear_memmap_errors() local
378 meta_start = (SZ_4K + sizeof(*pfn_sb)) >> 9; in nd_pfn_clear_memmap_errors()
379 meta_num = (le64_to_cpu(pfn_sb->dataoff) >> 9) - meta_start; in nd_pfn_clear_memmap_errors()
386 rc = devm_namespace_enable(&nd_pfn->dev, ndns, le64_to_cpu(pfn_sb->dataoff)); in nd_pfn_clear_memmap_errors()
458 struct nd_pfn_sb *pfn_sb = nd_pfn->pfn_sb; in nd_pfn_validate() local
462 if (!pfn_sb || !ndns) in nd_pfn_validate()
468 if (nvdimm_read_bytes(ndns, SZ_4K, pfn_sb, sizeof(*pfn_sb), 0)) in nd_pfn_validate()
471 if (memcmp(pfn_sb->signature, sig, PFN_SIG_LEN) != 0) in nd_pfn_validate()
474 checksum = le64_to_cpu(pfn_sb->checksum); in nd_pfn_validate()
475 pfn_sb->checksum = 0; in nd_pfn_validate()
476 if (checksum != nd_sb_checksum((struct nd_gen_sb *) pfn_sb)) in nd_pfn_validate()
478 pfn_sb->checksum = cpu_to_le64(checksum); in nd_pfn_validate()
480 if (memcmp(pfn_sb->parent_uuid, parent_uuid, 16) != 0) in nd_pfn_validate()
483 if (__le16_to_cpu(pfn_sb->version_minor) < 1) { in nd_pfn_validate()
484 pfn_sb->start_pad = 0; in nd_pfn_validate()
485 pfn_sb->end_trunc = 0; in nd_pfn_validate()
488 if (__le16_to_cpu(pfn_sb->version_minor) < 2) in nd_pfn_validate()
489 pfn_sb->align = 0; in nd_pfn_validate()
491 if (__le16_to_cpu(pfn_sb->version_minor) < 4) { in nd_pfn_validate()
492 pfn_sb->page_struct_size = cpu_to_le16(64); in nd_pfn_validate()
493 pfn_sb->page_size = cpu_to_le32(PAGE_SIZE); in nd_pfn_validate()
496 switch (le32_to_cpu(pfn_sb->mode)) { in nd_pfn_validate()
504 align = le32_to_cpu(pfn_sb->align); in nd_pfn_validate()
505 offset = le64_to_cpu(pfn_sb->dataoff); in nd_pfn_validate()
506 start_pad = le32_to_cpu(pfn_sb->start_pad); in nd_pfn_validate()
507 end_trunc = le32_to_cpu(pfn_sb->end_trunc); in nd_pfn_validate()
510 mode = le32_to_cpu(pfn_sb->mode); in nd_pfn_validate()
512 if ((le32_to_cpu(pfn_sb->page_size) > PAGE_SIZE) && in nd_pfn_validate()
516 le32_to_cpu(pfn_sb->page_size)); in nd_pfn_validate()
520 if ((le16_to_cpu(pfn_sb->page_struct_size) < sizeof(struct page)) && in nd_pfn_validate()
524 le16_to_cpu(pfn_sb->page_struct_size)); in nd_pfn_validate()
534 !memcmp(pfn_sb->signature, DAX_SIG, PFN_SIG_LEN)) { in nd_pfn_validate()
546 nd_pfn->uuid = kmemdup(pfn_sb->uuid, 16, GFP_KERNEL); in nd_pfn_validate()
556 if (memcmp(nd_pfn->uuid, pfn_sb->uuid, 16) != 0) in nd_pfn_validate()
627 struct nd_pfn_sb *pfn_sb; in nd_pfn_probe() local
647 pfn_sb = devm_kmalloc(dev, sizeof(*pfn_sb), GFP_KERNEL); in nd_pfn_probe()
649 nd_pfn->pfn_sb = pfn_sb; in nd_pfn_probe()
686 struct nd_pfn_sb *pfn_sb = nd_pfn->pfn_sb; in __nvdimm_setup_pfn() local
687 u64 offset = le64_to_cpu(pfn_sb->dataoff); in __nvdimm_setup_pfn()
688 u32 start_pad = __le32_to_cpu(pfn_sb->start_pad); in __nvdimm_setup_pfn()
689 u32 end_trunc = __le32_to_cpu(pfn_sb->end_trunc); in __nvdimm_setup_pfn()
709 nd_pfn->npfns = le64_to_cpu(pfn_sb->npfns); in __nvdimm_setup_pfn()
712 if (le64_to_cpu(nd_pfn->pfn_sb->npfns) > nd_pfn->npfns) in __nvdimm_setup_pfn()
715 le64_to_cpu(nd_pfn->pfn_sb->npfns), in __nvdimm_setup_pfn()
735 struct nd_pfn_sb *pfn_sb; in nd_pfn_init() local
741 pfn_sb = devm_kmalloc(&nd_pfn->dev, sizeof(*pfn_sb), GFP_KERNEL); in nd_pfn_init()
742 if (!pfn_sb) in nd_pfn_init()
745 nd_pfn->pfn_sb = pfn_sb; in nd_pfn_init()
758 memset(pfn_sb, 0, sizeof(*pfn_sb)); in nd_pfn_init()
826 pfn_sb->mode = cpu_to_le32(nd_pfn->mode); in nd_pfn_init()
827 pfn_sb->dataoff = cpu_to_le64(offset); in nd_pfn_init()
828 pfn_sb->npfns = cpu_to_le64(npfns); in nd_pfn_init()
829 memcpy(pfn_sb->signature, sig, PFN_SIG_LEN); in nd_pfn_init()
830 memcpy(pfn_sb->uuid, nd_pfn->uuid, 16); in nd_pfn_init()
831 memcpy(pfn_sb->parent_uuid, nd_dev_to_uuid(&ndns->dev), 16); in nd_pfn_init()
832 pfn_sb->version_major = cpu_to_le16(1); in nd_pfn_init()
833 pfn_sb->version_minor = cpu_to_le16(4); in nd_pfn_init()
834 pfn_sb->end_trunc = cpu_to_le32(end_trunc); in nd_pfn_init()
835 pfn_sb->align = cpu_to_le32(nd_pfn->align); in nd_pfn_init()
837 pfn_sb->page_struct_size = cpu_to_le16(sizeof(struct page)); in nd_pfn_init()
839 pfn_sb->page_struct_size = cpu_to_le16(MAX_STRUCT_PAGE_SIZE); in nd_pfn_init()
840 pfn_sb->page_size = cpu_to_le32(PAGE_SIZE); in nd_pfn_init()
841 checksum = nd_sb_checksum((struct nd_gen_sb *) pfn_sb); in nd_pfn_init()
842 pfn_sb->checksum = cpu_to_le64(checksum); in nd_pfn_init()
848 return nvdimm_write_bytes(ndns, SZ_4K, pfn_sb, sizeof(*pfn_sb), 0); in nd_pfn_init()