Lines Matching refs:nfit_mem
190 struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); in xlat_nvdimm_status() local
198 if (test_bit(NFIT_MEM_LSR, &nfit_mem->flags)) in xlat_nvdimm_status()
205 if (test_bit(NFIT_MEM_LSR, &nfit_mem->flags) in xlat_nvdimm_status()
210 if (test_bit(NFIT_MEM_LSW, &nfit_mem->flags) in xlat_nvdimm_status()
397 struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); in payload_dumpable() local
399 if (nfit_mem && nfit_mem->family == NVDIMM_FAMILY_INTEL in payload_dumpable()
406 static int cmd_to_func(struct nfit_mem *nfit_mem, unsigned int cmd, in cmd_to_func() argument
412 if (nfit_mem && nfit_mem->family != call_pkg->nd_family) in cmd_to_func()
423 if (!nfit_mem) in cmd_to_func()
427 if (nfit_mem->family == NVDIMM_FAMILY_INTEL) in cmd_to_func()
441 struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); in acpi_nfit_ctl() local
459 func = cmd_to_func(nfit_mem, cmd, call_pkg, &family); in acpi_nfit_ctl()
464 struct acpi_device *adev = nfit_mem->adev; in acpi_nfit_ctl()
472 dsm_mask = nfit_mem->dsm_mask; in acpi_nfit_ctl()
474 guid = to_nfit_uuid(nfit_mem->family); in acpi_nfit_ctl()
539 && test_bit(NFIT_MEM_LSR, &nfit_mem->flags)) in acpi_nfit_ctl()
542 && test_bit(NFIT_MEM_LSR, &nfit_mem->flags)) { in acpi_nfit_ctl()
547 && test_bit(NFIT_MEM_LSW, &nfit_mem->flags)) { in acpi_nfit_ctl()
556 revid = nfit_dsm_revid(nfit_mem->family, func); in acpi_nfit_ctl()
761 struct nfit_mem *nfit_mem; in nfit_get_smbios_id() local
767 list_for_each_entry(nfit_mem, &acpi_desc->dimms, list) { in nfit_get_smbios_id()
768 memdev = __to_nfit_memdev(nfit_mem); in nfit_get_smbios_id()
1005 struct nfit_mem *nfit_mem, *found; in __nfit_mem_init() local
1038 list_for_each_entry(nfit_mem, &acpi_desc->dimms, list) in __nfit_mem_init()
1039 if (__to_nfit_memdev(nfit_mem)->device_handle in __nfit_mem_init()
1041 found = nfit_mem; in __nfit_mem_init()
1046 nfit_mem = found; in __nfit_mem_init()
1048 nfit_mem = devm_kzalloc(acpi_desc->dev, in __nfit_mem_init()
1049 sizeof(*nfit_mem), GFP_KERNEL); in __nfit_mem_init()
1050 if (!nfit_mem) in __nfit_mem_init()
1052 INIT_LIST_HEAD(&nfit_mem->list); in __nfit_mem_init()
1053 nfit_mem->acpi_desc = acpi_desc; in __nfit_mem_init()
1054 list_add(&nfit_mem->list, &acpi_desc->dimms); in __nfit_mem_init()
1067 if (!nfit_mem->dcr) in __nfit_mem_init()
1068 nfit_mem->dcr = nfit_dcr->dcr; in __nfit_mem_init()
1069 else if (nfit_mem->dcr->windows == 0 in __nfit_mem_init()
1071 nfit_mem->dcr = nfit_dcr->dcr; in __nfit_mem_init()
1081 nfit_mem->nfit_flush = nfit_flush; in __nfit_mem_init()
1083 nfit_mem->flush_wpq = devm_kcalloc(acpi_desc->dev, in __nfit_mem_init()
1087 if (!nfit_mem->flush_wpq) in __nfit_mem_init()
1090 struct resource *res = &nfit_mem->flush_wpq[i]; in __nfit_mem_init()
1098 if (dcr && !nfit_mem->dcr) { in __nfit_mem_init()
1109 nfit_mem->spa_dcr = spa; in __nfit_mem_init()
1110 nfit_mem->memdev_dcr = nfit_memdev->memdev; in __nfit_mem_init()
1115 nfit_mem->idt_dcr = nfit_idt->idt; in __nfit_mem_init()
1124 nfit_mem->memdev_pmem = nfit_memdev->memdev; in __nfit_mem_init()
1126 nfit_mem->memdev_dcr = nfit_memdev->memdev; in __nfit_mem_init()
1135 struct nfit_mem *a = container_of(_a, typeof(*a), list); in nfit_mem_cmp()
1136 struct nfit_mem *b = container_of(_b, typeof(*b), list); in nfit_mem_cmp()
1367 struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); in to_nfit_memdev() local
1369 return __to_nfit_memdev(nfit_mem); in to_nfit_memdev()
1375 struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); in to_nfit_dcr() local
1377 return nfit_mem->dcr; in to_nfit_dcr()
1455 struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); in num_nvdimm_formats() local
1458 if (nfit_mem->memdev_pmem) in num_nvdimm_formats()
1477 struct nfit_mem *nfit_mem; in format1_show() local
1483 nfit_mem = nvdimm_provider_data(nvdimm); in format1_show()
1484 acpi_desc = nfit_mem->acpi_desc; in format1_show()
1535 struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); in family_show() local
1537 if (nfit_mem->family < 0) in family_show()
1539 return sprintf(buf, "%d\n", nfit_mem->family); in family_show()
1547 struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); in dsm_mask_show() local
1549 if (nfit_mem->family < 0) in dsm_mask_show()
1551 return sprintf(buf, "%#lx\n", nfit_mem->dsm_mask); in dsm_mask_show()
1559 struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); in flags_show() local
1560 u16 flags = __to_nfit_memdev(nfit_mem)->flags; in flags_show()
1562 if (test_bit(NFIT_MEM_DIRTY, &nfit_mem->flags)) in flags_show()
1580 struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); in id_show() local
1582 return sprintf(buf, "%s\n", nfit_mem->id); in id_show()
1590 struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); in dirty_shutdown_show() local
1592 return sprintf(buf, "%d\n", nfit_mem->dirty_shutdown); in dirty_shutdown_show()
1622 struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); in acpi_nfit_dimm_attr_visible() local
1637 if (!test_bit(NFIT_MEM_DIRTY_COUNT, &nfit_mem->flags) in acpi_nfit_dimm_attr_visible()
1658 struct nfit_mem *nfit_mem; in acpi_nfit_dimm_by_handle() local
1660 list_for_each_entry(nfit_mem, &acpi_desc->dimms, list) in acpi_nfit_dimm_by_handle()
1661 if (__to_nfit_memdev(nfit_mem)->device_handle == device_handle) in acpi_nfit_dimm_by_handle()
1662 return nfit_mem->nvdimm; in acpi_nfit_dimm_by_handle()
1669 struct nfit_mem *nfit_mem; in __acpi_nvdimm_notify() local
1689 nfit_mem = dev_get_drvdata(dev); in __acpi_nvdimm_notify()
1690 if (nfit_mem && nfit_mem->flags_attr) in __acpi_nvdimm_notify()
1691 sysfs_notify_dirent(nfit_mem->flags_attr); in __acpi_nvdimm_notify()
1717 __weak void nfit_intel_shutdown_status(struct nfit_mem *nfit_mem) in nfit_intel_shutdown_status() argument
1719 struct device *dev = &nfit_mem->adev->dev; in nfit_intel_shutdown_status()
1731 const guid_t *guid = to_nfit_uuid(nfit_mem->family); in nfit_intel_shutdown_status()
1732 u8 revid = nfit_dsm_revid(nfit_mem->family, func); in nfit_intel_shutdown_status()
1733 struct acpi_device *adev = nfit_mem->adev; in nfit_intel_shutdown_status()
1737 if ((nfit_mem->dsm_mask & (1 << func)) == 0) in nfit_intel_shutdown_status()
1753 set_bit(NFIT_MEM_DIRTY, &nfit_mem->flags); in nfit_intel_shutdown_status()
1757 set_bit(NFIT_MEM_DIRTY_COUNT, &nfit_mem->flags); in nfit_intel_shutdown_status()
1758 nfit_mem->dirty_shutdown = smart.shutdown_count; in nfit_intel_shutdown_status()
1762 static void populate_shutdown_status(struct nfit_mem *nfit_mem) in populate_shutdown_status() argument
1769 if (nfit_mem->family == NVDIMM_FAMILY_INTEL) in populate_shutdown_status()
1770 nfit_intel_shutdown_status(nfit_mem); in populate_shutdown_status()
1774 struct nfit_mem *nfit_mem, u32 device_handle) in acpi_nfit_add_dimm() argument
1783 struct acpi_nfit_control_region *dcr = nfit_mem->dcr; in acpi_nfit_add_dimm()
1786 nfit_mem->dsm_mask = acpi_desc->dimm_cmd_force_en; in acpi_nfit_add_dimm()
1787 nfit_mem->family = NVDIMM_FAMILY_INTEL; in acpi_nfit_add_dimm()
1791 sprintf(nfit_mem->id, "%04x-%02x-%04x-%08x", in acpi_nfit_add_dimm()
1797 sprintf(nfit_mem->id, "%04x-%08x", in acpi_nfit_add_dimm()
1804 populate_shutdown_status(nfit_mem); in acpi_nfit_add_dimm()
1809 nfit_mem->adev = adev_dimm; in acpi_nfit_add_dimm()
1826 dev_set_drvdata(&adev_dimm->dev, nfit_mem); in acpi_nfit_add_dimm()
1850 nfit_mem->family = family; in acpi_nfit_add_dimm()
1853 else if (nfit_mem->family == NVDIMM_FAMILY_INTEL) { in acpi_nfit_add_dimm()
1857 } else if (nfit_mem->family == NVDIMM_FAMILY_HPE1) { in acpi_nfit_add_dimm()
1859 } else if (nfit_mem->family == NVDIMM_FAMILY_HPE2) { in acpi_nfit_add_dimm()
1863 } else if (nfit_mem->family == NVDIMM_FAMILY_MSFT) { in acpi_nfit_add_dimm()
1865 } else if (nfit_mem->family == NVDIMM_FAMILY_HYPERV) { in acpi_nfit_add_dimm()
1869 nfit_mem->family = -1; in acpi_nfit_add_dimm()
1881 guid = to_nfit_uuid(nfit_mem->family); in acpi_nfit_add_dimm()
1884 nfit_dsm_revid(nfit_mem->family, i), in acpi_nfit_add_dimm()
1886 set_bit(i, &nfit_mem->dsm_mask); in acpi_nfit_add_dimm()
1901 set_bit(NFIT_MEM_LSR, &nfit_mem->flags); in acpi_nfit_add_dimm()
1904 if (test_bit(NFIT_MEM_LSR, &nfit_mem->flags) in acpi_nfit_add_dimm()
1907 set_bit(NFIT_MEM_LSW, &nfit_mem->flags); in acpi_nfit_add_dimm()
1914 if (!test_bit(NFIT_MEM_LSW, &nfit_mem->flags) in acpi_nfit_add_dimm()
1918 clear_bit(NFIT_MEM_LSR, &nfit_mem->flags); in acpi_nfit_add_dimm()
1924 populate_shutdown_status(nfit_mem); in acpi_nfit_add_dimm()
1932 struct nfit_mem *nfit_mem; in shutdown_dimm_notify() local
1939 list_for_each_entry(nfit_mem, &acpi_desc->dimms, list) { in shutdown_dimm_notify()
1940 struct acpi_device *adev_dimm = nfit_mem->adev; in shutdown_dimm_notify()
1942 if (nfit_mem->flags_attr) { in shutdown_dimm_notify()
1943 sysfs_put(nfit_mem->flags_attr); in shutdown_dimm_notify()
1944 nfit_mem->flags_attr = NULL; in shutdown_dimm_notify()
1966 struct nfit_mem *nfit_mem) in acpi_nfit_get_fw_ops() argument
1969 struct acpi_nfit_desc *acpi_desc = nfit_mem->acpi_desc; in acpi_nfit_get_fw_ops()
1975 if (nfit_mem->family != NVDIMM_FAMILY_INTEL) in acpi_nfit_get_fw_ops()
1978 mask = nfit_mem->dsm_mask & NVDIMM_INTEL_FW_ACTIVATE_CMDMASK; in acpi_nfit_get_fw_ops()
1987 struct nfit_mem *nfit_mem; in acpi_nfit_register_dimms() local
1991 list_for_each_entry(nfit_mem, &acpi_desc->dimms, list) { in acpi_nfit_register_dimms()
1998 device_handle = __to_nfit_memdev(nfit_mem)->device_handle; in acpi_nfit_register_dimms()
2009 dimm_memdev = __to_nfit_memdev(nfit_mem); in acpi_nfit_register_dimms()
2016 mem_flags = __to_nfit_memdev(nfit_mem)->flags; in acpi_nfit_register_dimms()
2020 rc = acpi_nfit_add_dimm(acpi_desc, nfit_mem, device_handle); in acpi_nfit_register_dimms()
2030 if (nfit_mem->family == NVDIMM_FAMILY_INTEL) { in acpi_nfit_register_dimms()
2036 cmd_mask |= nfit_mem->dsm_mask & NVDIMM_STANDARD_CMDMASK; in acpi_nfit_register_dimms()
2039 if (test_bit(NFIT_MEM_LSR, &nfit_mem->flags)) { in acpi_nfit_register_dimms()
2043 if (test_bit(NFIT_MEM_LSW, &nfit_mem->flags)) in acpi_nfit_register_dimms()
2046 flush = nfit_mem->nfit_flush ? nfit_mem->nfit_flush->flush in acpi_nfit_register_dimms()
2048 nvdimm = __nvdimm_create(acpi_desc->nvdimm_bus, nfit_mem, in acpi_nfit_register_dimms()
2051 nfit_mem->flush_wpq, &nfit_mem->id[0], in acpi_nfit_register_dimms()
2052 acpi_nfit_get_security_ops(nfit_mem->family), in acpi_nfit_register_dimms()
2053 acpi_nfit_get_fw_ops(nfit_mem)); in acpi_nfit_register_dimms()
2057 nfit_mem->nvdimm = nvdimm; in acpi_nfit_register_dimms()
2081 list_for_each_entry(nfit_mem, &acpi_desc->dimms, list) { in acpi_nfit_register_dimms()
2084 nvdimm = nfit_mem->nvdimm; in acpi_nfit_register_dimms()
2090 nfit_mem->flags_attr = sysfs_get_dirent(nfit_kernfs, in acpi_nfit_register_dimms()
2093 if (!nfit_mem->flags_attr) in acpi_nfit_register_dimms()
2283 struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); in acpi_nfit_init_interleave_set() local
2288 struct acpi_nfit_control_region *dcr = nfit_mem->dcr; in acpi_nfit_init_interleave_set()
2290 if (!memdev || !nfit_mem->dcr) { in acpi_nfit_init_interleave_set()
2325 struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); in acpi_nfit_init_interleave_set() local
2326 struct acpi_nfit_control_region *dcr = nfit_mem->dcr; in acpi_nfit_init_interleave_set()