Lines Matching refs:nfit_mem
189 struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); in xlat_nvdimm_status() local
197 if (test_bit(NFIT_MEM_LSR, &nfit_mem->flags)) in xlat_nvdimm_status()
204 if (test_bit(NFIT_MEM_LSR, &nfit_mem->flags) in xlat_nvdimm_status()
209 if (test_bit(NFIT_MEM_LSW, &nfit_mem->flags) in xlat_nvdimm_status()
395 struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); in payload_dumpable() local
397 if (nfit_mem && nfit_mem->family == NVDIMM_FAMILY_INTEL in payload_dumpable()
404 static int cmd_to_func(struct nfit_mem *nfit_mem, unsigned int cmd, in cmd_to_func() argument
410 if (nfit_mem && nfit_mem->family != call_pkg->nd_family) in cmd_to_func()
421 if (!nfit_mem) in cmd_to_func()
425 if (nfit_mem->family == NVDIMM_FAMILY_INTEL) in cmd_to_func()
439 struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); in acpi_nfit_ctl() local
457 func = cmd_to_func(nfit_mem, cmd, call_pkg, &family); in acpi_nfit_ctl()
462 struct acpi_device *adev = nfit_mem->adev; in acpi_nfit_ctl()
470 dsm_mask = nfit_mem->dsm_mask; in acpi_nfit_ctl()
472 guid = to_nfit_uuid(nfit_mem->family); in acpi_nfit_ctl()
534 && test_bit(NFIT_MEM_LSR, &nfit_mem->flags)) in acpi_nfit_ctl()
537 && test_bit(NFIT_MEM_LSR, &nfit_mem->flags)) { in acpi_nfit_ctl()
542 && test_bit(NFIT_MEM_LSW, &nfit_mem->flags)) { in acpi_nfit_ctl()
551 revid = nfit_dsm_revid(nfit_mem->family, func); in acpi_nfit_ctl()
747 struct nfit_mem *nfit_mem; in nfit_get_smbios_id() local
753 list_for_each_entry(nfit_mem, &acpi_desc->dimms, list) { in nfit_get_smbios_id()
754 memdev = __to_nfit_memdev(nfit_mem); in nfit_get_smbios_id()
989 struct nfit_mem *nfit_mem) in nfit_mem_find_spa_bdw() argument
991 u32 device_handle = __to_nfit_memdev(nfit_mem)->device_handle; in nfit_mem_find_spa_bdw()
992 u16 dcr = nfit_mem->dcr->region_index; in nfit_mem_find_spa_bdw()
1011 nfit_mem->spa_bdw = nfit_spa->spa; in nfit_mem_find_spa_bdw()
1017 nfit_mem->spa_dcr->range_index); in nfit_mem_find_spa_bdw()
1018 nfit_mem->bdw = NULL; in nfit_mem_find_spa_bdw()
1022 struct nfit_mem *nfit_mem, struct acpi_nfit_system_address *spa) in nfit_mem_init_bdw() argument
1024 u16 dcr = __to_nfit_memdev(nfit_mem)->region_index; in nfit_mem_init_bdw()
1033 nfit_mem->bdw = nfit_bdw->bdw; in nfit_mem_init_bdw()
1037 if (!nfit_mem->bdw) in nfit_mem_init_bdw()
1040 nfit_mem_find_spa_bdw(acpi_desc, nfit_mem); in nfit_mem_init_bdw()
1042 if (!nfit_mem->spa_bdw) in nfit_mem_init_bdw()
1045 range_index = nfit_mem->spa_bdw->range_index; in nfit_mem_init_bdw()
1050 nfit_mem->memdev_bdw = nfit_memdev->memdev; in nfit_mem_init_bdw()
1055 nfit_mem->idt_bdw = nfit_idt->idt; in nfit_mem_init_bdw()
1065 struct nfit_mem *nfit_mem, *found; in __nfit_mem_init() local
1098 list_for_each_entry(nfit_mem, &acpi_desc->dimms, list) in __nfit_mem_init()
1099 if (__to_nfit_memdev(nfit_mem)->device_handle in __nfit_mem_init()
1101 found = nfit_mem; in __nfit_mem_init()
1106 nfit_mem = found; in __nfit_mem_init()
1108 nfit_mem = devm_kzalloc(acpi_desc->dev, in __nfit_mem_init()
1109 sizeof(*nfit_mem), GFP_KERNEL); in __nfit_mem_init()
1110 if (!nfit_mem) in __nfit_mem_init()
1112 INIT_LIST_HEAD(&nfit_mem->list); in __nfit_mem_init()
1113 nfit_mem->acpi_desc = acpi_desc; in __nfit_mem_init()
1114 list_add(&nfit_mem->list, &acpi_desc->dimms); in __nfit_mem_init()
1127 if (!nfit_mem->dcr) in __nfit_mem_init()
1128 nfit_mem->dcr = nfit_dcr->dcr; in __nfit_mem_init()
1129 else if (nfit_mem->dcr->windows == 0 in __nfit_mem_init()
1131 nfit_mem->dcr = nfit_dcr->dcr; in __nfit_mem_init()
1141 nfit_mem->nfit_flush = nfit_flush; in __nfit_mem_init()
1143 nfit_mem->flush_wpq = devm_kcalloc(acpi_desc->dev, in __nfit_mem_init()
1147 if (!nfit_mem->flush_wpq) in __nfit_mem_init()
1150 struct resource *res = &nfit_mem->flush_wpq[i]; in __nfit_mem_init()
1158 if (dcr && !nfit_mem->dcr) { in __nfit_mem_init()
1169 nfit_mem->spa_dcr = spa; in __nfit_mem_init()
1170 nfit_mem->memdev_dcr = nfit_memdev->memdev; in __nfit_mem_init()
1175 nfit_mem->idt_dcr = nfit_idt->idt; in __nfit_mem_init()
1178 nfit_mem_init_bdw(acpi_desc, nfit_mem, spa); in __nfit_mem_init()
1185 nfit_mem->memdev_pmem = nfit_memdev->memdev; in __nfit_mem_init()
1187 nfit_mem->memdev_dcr = nfit_memdev->memdev; in __nfit_mem_init()
1195 struct nfit_mem *a = container_of(_a, typeof(*a), list); in nfit_mem_cmp()
1196 struct nfit_mem *b = container_of(_b, typeof(*b), list); in nfit_mem_cmp()
1427 struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); in to_nfit_memdev() local
1429 return __to_nfit_memdev(nfit_mem); in to_nfit_memdev()
1435 struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); in to_nfit_dcr() local
1437 return nfit_mem->dcr; in to_nfit_dcr()
1515 struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); in num_nvdimm_formats() local
1518 if (nfit_mem->memdev_pmem) in num_nvdimm_formats()
1520 if (nfit_mem->memdev_bdw) in num_nvdimm_formats()
1539 struct nfit_mem *nfit_mem; in format1_show() local
1545 nfit_mem = nvdimm_provider_data(nvdimm); in format1_show()
1546 acpi_desc = nfit_mem->acpi_desc; in format1_show()
1597 struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); in family_show() local
1599 if (nfit_mem->family < 0) in family_show()
1601 return sprintf(buf, "%d\n", nfit_mem->family); in family_show()
1609 struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); in dsm_mask_show() local
1611 if (nfit_mem->family < 0) in dsm_mask_show()
1613 return sprintf(buf, "%#lx\n", nfit_mem->dsm_mask); in dsm_mask_show()
1621 struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); in flags_show() local
1622 u16 flags = __to_nfit_memdev(nfit_mem)->flags; in flags_show()
1624 if (test_bit(NFIT_MEM_DIRTY, &nfit_mem->flags)) in flags_show()
1642 struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); in id_show() local
1644 return sprintf(buf, "%s\n", nfit_mem->id); in id_show()
1652 struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); in dirty_shutdown_show() local
1654 return sprintf(buf, "%d\n", nfit_mem->dirty_shutdown); in dirty_shutdown_show()
1684 struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); in acpi_nfit_dimm_attr_visible() local
1699 if (!test_bit(NFIT_MEM_DIRTY_COUNT, &nfit_mem->flags) in acpi_nfit_dimm_attr_visible()
1720 struct nfit_mem *nfit_mem; in acpi_nfit_dimm_by_handle() local
1722 list_for_each_entry(nfit_mem, &acpi_desc->dimms, list) in acpi_nfit_dimm_by_handle()
1723 if (__to_nfit_memdev(nfit_mem)->device_handle == device_handle) in acpi_nfit_dimm_by_handle()
1724 return nfit_mem->nvdimm; in acpi_nfit_dimm_by_handle()
1731 struct nfit_mem *nfit_mem; in __acpi_nvdimm_notify() local
1751 nfit_mem = dev_get_drvdata(dev); in __acpi_nvdimm_notify()
1752 if (nfit_mem && nfit_mem->flags_attr) in __acpi_nvdimm_notify()
1753 sysfs_notify_dirent(nfit_mem->flags_attr); in __acpi_nvdimm_notify()
1779 __weak void nfit_intel_shutdown_status(struct nfit_mem *nfit_mem) in nfit_intel_shutdown_status() argument
1781 struct device *dev = &nfit_mem->adev->dev; in nfit_intel_shutdown_status()
1793 const guid_t *guid = to_nfit_uuid(nfit_mem->family); in nfit_intel_shutdown_status()
1794 u8 revid = nfit_dsm_revid(nfit_mem->family, func); in nfit_intel_shutdown_status()
1795 struct acpi_device *adev = nfit_mem->adev; in nfit_intel_shutdown_status()
1799 if ((nfit_mem->dsm_mask & (1 << func)) == 0) in nfit_intel_shutdown_status()
1815 set_bit(NFIT_MEM_DIRTY, &nfit_mem->flags); in nfit_intel_shutdown_status()
1819 set_bit(NFIT_MEM_DIRTY_COUNT, &nfit_mem->flags); in nfit_intel_shutdown_status()
1820 nfit_mem->dirty_shutdown = smart.shutdown_count; in nfit_intel_shutdown_status()
1824 static void populate_shutdown_status(struct nfit_mem *nfit_mem) in populate_shutdown_status() argument
1831 if (nfit_mem->family == NVDIMM_FAMILY_INTEL) in populate_shutdown_status()
1832 nfit_intel_shutdown_status(nfit_mem); in populate_shutdown_status()
1836 struct nfit_mem *nfit_mem, u32 device_handle) in acpi_nfit_add_dimm() argument
1845 struct acpi_nfit_control_region *dcr = nfit_mem->dcr; in acpi_nfit_add_dimm()
1848 nfit_mem->dsm_mask = acpi_desc->dimm_cmd_force_en; in acpi_nfit_add_dimm()
1849 nfit_mem->family = NVDIMM_FAMILY_INTEL; in acpi_nfit_add_dimm()
1853 sprintf(nfit_mem->id, "%04x-%02x-%04x-%08x", in acpi_nfit_add_dimm()
1859 sprintf(nfit_mem->id, "%04x-%08x", in acpi_nfit_add_dimm()
1866 populate_shutdown_status(nfit_mem); in acpi_nfit_add_dimm()
1871 nfit_mem->adev = adev_dimm; in acpi_nfit_add_dimm()
1888 dev_set_drvdata(&adev_dimm->dev, nfit_mem); in acpi_nfit_add_dimm()
1912 nfit_mem->family = family; in acpi_nfit_add_dimm()
1915 else if (nfit_mem->family == NVDIMM_FAMILY_INTEL) { in acpi_nfit_add_dimm()
1919 } else if (nfit_mem->family == NVDIMM_FAMILY_HPE1) { in acpi_nfit_add_dimm()
1921 } else if (nfit_mem->family == NVDIMM_FAMILY_HPE2) { in acpi_nfit_add_dimm()
1925 } else if (nfit_mem->family == NVDIMM_FAMILY_MSFT) { in acpi_nfit_add_dimm()
1927 } else if (nfit_mem->family == NVDIMM_FAMILY_HYPERV) { in acpi_nfit_add_dimm()
1931 nfit_mem->family = -1; in acpi_nfit_add_dimm()
1943 guid = to_nfit_uuid(nfit_mem->family); in acpi_nfit_add_dimm()
1946 nfit_dsm_revid(nfit_mem->family, i), in acpi_nfit_add_dimm()
1948 set_bit(i, &nfit_mem->dsm_mask); in acpi_nfit_add_dimm()
1963 set_bit(NFIT_MEM_LSR, &nfit_mem->flags); in acpi_nfit_add_dimm()
1966 if (test_bit(NFIT_MEM_LSR, &nfit_mem->flags) in acpi_nfit_add_dimm()
1969 set_bit(NFIT_MEM_LSW, &nfit_mem->flags); in acpi_nfit_add_dimm()
1976 if (!test_bit(NFIT_MEM_LSW, &nfit_mem->flags) in acpi_nfit_add_dimm()
1980 clear_bit(NFIT_MEM_LSR, &nfit_mem->flags); in acpi_nfit_add_dimm()
1986 populate_shutdown_status(nfit_mem); in acpi_nfit_add_dimm()
1994 struct nfit_mem *nfit_mem; in shutdown_dimm_notify() local
2001 list_for_each_entry(nfit_mem, &acpi_desc->dimms, list) { in shutdown_dimm_notify()
2002 struct acpi_device *adev_dimm = nfit_mem->adev; in shutdown_dimm_notify()
2004 if (nfit_mem->flags_attr) { in shutdown_dimm_notify()
2005 sysfs_put(nfit_mem->flags_attr); in shutdown_dimm_notify()
2006 nfit_mem->flags_attr = NULL; in shutdown_dimm_notify()
2028 struct nfit_mem *nfit_mem) in acpi_nfit_get_fw_ops() argument
2031 struct acpi_nfit_desc *acpi_desc = nfit_mem->acpi_desc; in acpi_nfit_get_fw_ops()
2037 if (nfit_mem->family != NVDIMM_FAMILY_INTEL) in acpi_nfit_get_fw_ops()
2040 mask = nfit_mem->dsm_mask & NVDIMM_INTEL_FW_ACTIVATE_CMDMASK; in acpi_nfit_get_fw_ops()
2049 struct nfit_mem *nfit_mem; in acpi_nfit_register_dimms() local
2053 list_for_each_entry(nfit_mem, &acpi_desc->dimms, list) { in acpi_nfit_register_dimms()
2060 device_handle = __to_nfit_memdev(nfit_mem)->device_handle; in acpi_nfit_register_dimms()
2067 if (nfit_mem->bdw && nfit_mem->memdev_pmem) { in acpi_nfit_register_dimms()
2076 dimm_memdev = __to_nfit_memdev(nfit_mem); in acpi_nfit_register_dimms()
2083 mem_flags = __to_nfit_memdev(nfit_mem)->flags; in acpi_nfit_register_dimms()
2087 rc = acpi_nfit_add_dimm(acpi_desc, nfit_mem, device_handle); in acpi_nfit_register_dimms()
2097 if (nfit_mem->family == NVDIMM_FAMILY_INTEL) { in acpi_nfit_register_dimms()
2103 cmd_mask |= nfit_mem->dsm_mask & NVDIMM_STANDARD_CMDMASK; in acpi_nfit_register_dimms()
2107 if (nfit_mem->family == NVDIMM_FAMILY_HYPERV) in acpi_nfit_register_dimms()
2110 if (test_bit(NFIT_MEM_LSR, &nfit_mem->flags)) { in acpi_nfit_register_dimms()
2114 if (test_bit(NFIT_MEM_LSW, &nfit_mem->flags)) in acpi_nfit_register_dimms()
2117 flush = nfit_mem->nfit_flush ? nfit_mem->nfit_flush->flush in acpi_nfit_register_dimms()
2119 nvdimm = __nvdimm_create(acpi_desc->nvdimm_bus, nfit_mem, in acpi_nfit_register_dimms()
2122 nfit_mem->flush_wpq, &nfit_mem->id[0], in acpi_nfit_register_dimms()
2123 acpi_nfit_get_security_ops(nfit_mem->family), in acpi_nfit_register_dimms()
2124 acpi_nfit_get_fw_ops(nfit_mem)); in acpi_nfit_register_dimms()
2128 nfit_mem->nvdimm = nvdimm; in acpi_nfit_register_dimms()
2152 list_for_each_entry(nfit_mem, &acpi_desc->dimms, list) { in acpi_nfit_register_dimms()
2155 nvdimm = nfit_mem->nvdimm; in acpi_nfit_register_dimms()
2161 nfit_mem->flags_attr = sysfs_get_dirent(nfit_kernfs, in acpi_nfit_register_dimms()
2164 if (!nfit_mem->flags_attr) in acpi_nfit_register_dimms()
2372 struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); in acpi_nfit_init_interleave_set() local
2375 struct acpi_nfit_control_region *dcr = nfit_mem->dcr; in acpi_nfit_init_interleave_set()
2377 if (!memdev || !nfit_mem->dcr) { in acpi_nfit_init_interleave_set()
2415 struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); in acpi_nfit_init_interleave_set() local
2416 struct acpi_nfit_control_region *dcr = nfit_mem->dcr; in acpi_nfit_init_interleave_set()
2611 struct nfit_mem *nfit_mem; in acpi_nfit_blk_region_enable() local
2616 nfit_mem = nvdimm_provider_data(nvdimm); in acpi_nfit_blk_region_enable()
2617 if (!nfit_mem || !nfit_mem->dcr || !nfit_mem->bdw) { in acpi_nfit_blk_region_enable()
2619 nfit_mem ? "" : " nfit_mem", in acpi_nfit_blk_region_enable()
2620 (nfit_mem && nfit_mem->dcr) ? "" : " dcr", in acpi_nfit_blk_region_enable()
2621 (nfit_mem && nfit_mem->bdw) ? "" : " bdw"); in acpi_nfit_blk_region_enable()
2632 nfit_blk->bdw_offset = nfit_mem->bdw->offset; in acpi_nfit_blk_region_enable()
2634 mmio->addr.base = devm_nvdimm_memremap(dev, nfit_mem->spa_bdw->address, in acpi_nfit_blk_region_enable()
2635 nfit_mem->spa_bdw->length, nd_blk_memremap_flags(ndbr)); in acpi_nfit_blk_region_enable()
2641 mmio->size = nfit_mem->bdw->size; in acpi_nfit_blk_region_enable()
2642 mmio->base_offset = nfit_mem->memdev_bdw->region_offset; in acpi_nfit_blk_region_enable()
2643 mmio->idt = nfit_mem->idt_bdw; in acpi_nfit_blk_region_enable()
2644 mmio->spa = nfit_mem->spa_bdw; in acpi_nfit_blk_region_enable()
2645 rc = nfit_blk_init_interleave(mmio, nfit_mem->idt_bdw, in acpi_nfit_blk_region_enable()
2646 nfit_mem->memdev_bdw->interleave_ways); in acpi_nfit_blk_region_enable()
2654 nfit_blk->cmd_offset = nfit_mem->dcr->command_offset; in acpi_nfit_blk_region_enable()
2655 nfit_blk->stat_offset = nfit_mem->dcr->status_offset; in acpi_nfit_blk_region_enable()
2657 mmio->addr.base = devm_nvdimm_ioremap(dev, nfit_mem->spa_dcr->address, in acpi_nfit_blk_region_enable()
2658 nfit_mem->spa_dcr->length); in acpi_nfit_blk_region_enable()
2664 mmio->size = nfit_mem->dcr->window_size; in acpi_nfit_blk_region_enable()
2665 mmio->base_offset = nfit_mem->memdev_dcr->region_offset; in acpi_nfit_blk_region_enable()
2666 mmio->idt = nfit_mem->idt_dcr; in acpi_nfit_blk_region_enable()
2667 mmio->spa = nfit_mem->spa_dcr; in acpi_nfit_blk_region_enable()
2668 rc = nfit_blk_init_interleave(mmio, nfit_mem->idt_dcr, in acpi_nfit_blk_region_enable()
2669 nfit_mem->memdev_dcr->interleave_ways); in acpi_nfit_blk_region_enable()
2919 struct nfit_mem *nfit_mem; in acpi_nfit_init_mapping() local
2936 nfit_mem = nvdimm_provider_data(nvdimm); in acpi_nfit_init_mapping()
2937 if (!nfit_mem || !nfit_mem->bdw) { in acpi_nfit_init_mapping()
2943 mapping->size = nfit_mem->bdw->capacity; in acpi_nfit_init_mapping()
2944 mapping->start = nfit_mem->bdw->start_address; in acpi_nfit_init_mapping()
2945 ndr_desc->num_lanes = nfit_mem->bdw->windows; in acpi_nfit_init_mapping()