Lines Matching refs:pfn_sb
204 struct nd_pfn_sb *pfn_sb = nd_pfn->pfn_sb; in resource_show() local
205 u64 offset = __le64_to_cpu(pfn_sb->dataoff); in resource_show()
207 u32 start_pad = __le32_to_cpu(pfn_sb->start_pad); in resource_show()
230 struct nd_pfn_sb *pfn_sb = nd_pfn->pfn_sb; in size_show() local
231 u64 offset = __le64_to_cpu(pfn_sb->dataoff); in size_show()
233 u32 start_pad = __le32_to_cpu(pfn_sb->start_pad); in size_show()
234 u32 end_trunc = __le32_to_cpu(pfn_sb->end_trunc); in size_show()
367 struct nd_pfn_sb *pfn_sb = nd_pfn->pfn_sb; in nd_pfn_clear_memmap_errors() local
376 meta_start = (SZ_4K + sizeof(*pfn_sb)) >> 9; in nd_pfn_clear_memmap_errors()
377 meta_num = (le64_to_cpu(pfn_sb->dataoff) >> 9) - meta_start; in nd_pfn_clear_memmap_errors()
384 rc = devm_namespace_enable(&nd_pfn->dev, ndns, le64_to_cpu(pfn_sb->dataoff)); in nd_pfn_clear_memmap_errors()
455 struct nd_pfn_sb *pfn_sb = nd_pfn->pfn_sb; in nd_pfn_validate() local
459 if (!pfn_sb || !ndns) in nd_pfn_validate()
465 if (nvdimm_read_bytes(ndns, SZ_4K, pfn_sb, sizeof(*pfn_sb), 0)) in nd_pfn_validate()
468 if (memcmp(pfn_sb->signature, sig, PFN_SIG_LEN) != 0) in nd_pfn_validate()
471 checksum = le64_to_cpu(pfn_sb->checksum); in nd_pfn_validate()
472 pfn_sb->checksum = 0; in nd_pfn_validate()
473 if (checksum != nd_sb_checksum((struct nd_gen_sb *) pfn_sb)) in nd_pfn_validate()
475 pfn_sb->checksum = cpu_to_le64(checksum); in nd_pfn_validate()
477 if (memcmp(pfn_sb->parent_uuid, parent_uuid, 16) != 0) in nd_pfn_validate()
480 if (__le16_to_cpu(pfn_sb->version_minor) < 1) { in nd_pfn_validate()
481 pfn_sb->start_pad = 0; in nd_pfn_validate()
482 pfn_sb->end_trunc = 0; in nd_pfn_validate()
485 if (__le16_to_cpu(pfn_sb->version_minor) < 2) in nd_pfn_validate()
486 pfn_sb->align = 0; in nd_pfn_validate()
488 if (__le16_to_cpu(pfn_sb->version_minor) < 4) { in nd_pfn_validate()
489 pfn_sb->page_struct_size = cpu_to_le16(64); in nd_pfn_validate()
490 pfn_sb->page_size = cpu_to_le32(PAGE_SIZE); in nd_pfn_validate()
493 switch (le32_to_cpu(pfn_sb->mode)) { in nd_pfn_validate()
501 align = le32_to_cpu(pfn_sb->align); in nd_pfn_validate()
502 offset = le64_to_cpu(pfn_sb->dataoff); in nd_pfn_validate()
503 start_pad = le32_to_cpu(pfn_sb->start_pad); in nd_pfn_validate()
506 mode = le32_to_cpu(pfn_sb->mode); in nd_pfn_validate()
508 if ((le32_to_cpu(pfn_sb->page_size) > PAGE_SIZE) && in nd_pfn_validate()
512 le32_to_cpu(pfn_sb->page_size)); in nd_pfn_validate()
516 if ((le16_to_cpu(pfn_sb->page_struct_size) < sizeof(struct page)) && in nd_pfn_validate()
520 le16_to_cpu(pfn_sb->page_struct_size)); in nd_pfn_validate()
530 !memcmp(pfn_sb->signature, DAX_SIG, PFN_SIG_LEN)) { in nd_pfn_validate()
542 nd_pfn->uuid = kmemdup(pfn_sb->uuid, 16, GFP_KERNEL); in nd_pfn_validate()
552 if (memcmp(nd_pfn->uuid, pfn_sb->uuid, 16) != 0) in nd_pfn_validate()
599 if (!IS_ALIGNED(res->start + le32_to_cpu(pfn_sb->start_pad), in nd_pfn_validate()
605 if (!IS_ALIGNED(res->end + 1 - le32_to_cpu(pfn_sb->end_trunc), in nd_pfn_validate()
620 struct nd_pfn_sb *pfn_sb; in nd_pfn_probe() local
640 pfn_sb = devm_kmalloc(dev, sizeof(*pfn_sb), GFP_KERNEL); in nd_pfn_probe()
642 nd_pfn->pfn_sb = pfn_sb; in nd_pfn_probe()
679 struct nd_pfn_sb *pfn_sb = nd_pfn->pfn_sb; in __nvdimm_setup_pfn() local
680 u64 offset = le64_to_cpu(pfn_sb->dataoff); in __nvdimm_setup_pfn()
681 u32 start_pad = __le32_to_cpu(pfn_sb->start_pad); in __nvdimm_setup_pfn()
682 u32 end_trunc = __le32_to_cpu(pfn_sb->end_trunc); in __nvdimm_setup_pfn()
702 nd_pfn->npfns = le64_to_cpu(pfn_sb->npfns); in __nvdimm_setup_pfn()
705 if (le64_to_cpu(nd_pfn->pfn_sb->npfns) > nd_pfn->npfns) in __nvdimm_setup_pfn()
708 le64_to_cpu(nd_pfn->pfn_sb->npfns), in __nvdimm_setup_pfn()
728 struct nd_pfn_sb *pfn_sb; in nd_pfn_init() local
734 pfn_sb = devm_kmalloc(&nd_pfn->dev, sizeof(*pfn_sb), GFP_KERNEL); in nd_pfn_init()
735 if (!pfn_sb) in nd_pfn_init()
738 nd_pfn->pfn_sb = pfn_sb; in nd_pfn_init()
751 memset(pfn_sb, 0, sizeof(*pfn_sb)); in nd_pfn_init()
811 pfn_sb->mode = cpu_to_le32(nd_pfn->mode); in nd_pfn_init()
812 pfn_sb->dataoff = cpu_to_le64(offset); in nd_pfn_init()
813 pfn_sb->npfns = cpu_to_le64(npfns); in nd_pfn_init()
814 memcpy(pfn_sb->signature, sig, PFN_SIG_LEN); in nd_pfn_init()
815 memcpy(pfn_sb->uuid, nd_pfn->uuid, 16); in nd_pfn_init()
816 memcpy(pfn_sb->parent_uuid, nd_dev_to_uuid(&ndns->dev), 16); in nd_pfn_init()
817 pfn_sb->version_major = cpu_to_le16(1); in nd_pfn_init()
818 pfn_sb->version_minor = cpu_to_le16(4); in nd_pfn_init()
819 pfn_sb->end_trunc = cpu_to_le32(end_trunc); in nd_pfn_init()
820 pfn_sb->align = cpu_to_le32(nd_pfn->align); in nd_pfn_init()
821 pfn_sb->page_struct_size = cpu_to_le16(MAX_STRUCT_PAGE_SIZE); in nd_pfn_init()
822 pfn_sb->page_size = cpu_to_le32(PAGE_SIZE); in nd_pfn_init()
823 checksum = nd_sb_checksum((struct nd_gen_sb *) pfn_sb); in nd_pfn_init()
824 pfn_sb->checksum = cpu_to_le64(checksum); in nd_pfn_init()
830 return nvdimm_write_bytes(ndns, SZ_4K, pfn_sb, sizeof(*pfn_sb), 0); in nd_pfn_init()