Lines Matching refs:acpi_desc

89 static struct acpi_device *to_acpi_dev(struct acpi_nfit_desc *acpi_desc)  in to_acpi_dev()  argument
91 struct nvdimm_bus_descriptor *nd_desc = &acpi_desc->nd_desc; in to_acpi_dev()
101 return to_acpi_device(acpi_desc->dev); in to_acpi_dev()
440 struct acpi_nfit_desc *acpi_desc = to_acpi_desc(nd_desc); in acpi_nfit_ctl() local
444 struct device *dev = acpi_desc->dev; in acpi_nfit_ctl()
477 struct acpi_device *adev = to_acpi_dev(acpi_desc); in acpi_nfit_ctl()
488 dsm_mask = acpi_desc->family_dsm_mask[family]; in acpi_nfit_ctl()
491 dsm_mask = acpi_desc->bus_dsm_mask; in acpi_nfit_ctl()
698 static bool add_spa(struct acpi_nfit_desc *acpi_desc, in add_spa() argument
702 struct device *dev = acpi_desc->dev; in add_spa()
710 list_move_tail(&nfit_spa->list, &acpi_desc->spas); in add_spa()
721 list_add_tail(&nfit_spa->list, &acpi_desc->spas); in add_spa()
728 static bool add_memdev(struct acpi_nfit_desc *acpi_desc, in add_memdev() argument
732 struct device *dev = acpi_desc->dev; in add_memdev()
740 list_move_tail(&nfit_memdev->list, &acpi_desc->memdevs); in add_memdev()
750 list_add_tail(&nfit_memdev->list, &acpi_desc->memdevs); in add_memdev()
760 struct acpi_nfit_desc *acpi_desc; in nfit_get_smbios_id() local
765 list_for_each_entry(acpi_desc, &acpi_descs, list) { in nfit_get_smbios_id()
766 mutex_lock(&acpi_desc->init_mutex); in nfit_get_smbios_id()
767 list_for_each_entry(nfit_mem, &acpi_desc->dimms, list) { in nfit_get_smbios_id()
772 mutex_unlock(&acpi_desc->init_mutex); in nfit_get_smbios_id()
777 mutex_unlock(&acpi_desc->init_mutex); in nfit_get_smbios_id()
799 static bool add_dcr(struct acpi_nfit_desc *acpi_desc, in add_dcr() argument
803 struct device *dev = acpi_desc->dev; in add_dcr()
811 list_move_tail(&nfit_dcr->list, &acpi_desc->dcrs); in add_dcr()
821 list_add_tail(&nfit_dcr->list, &acpi_desc->dcrs); in add_dcr()
827 static bool add_bdw(struct acpi_nfit_desc *acpi_desc, in add_bdw() argument
831 struct device *dev = acpi_desc->dev; in add_bdw()
838 list_move_tail(&nfit_bdw->list, &acpi_desc->bdws); in add_bdw()
848 list_add_tail(&nfit_bdw->list, &acpi_desc->bdws); in add_bdw()
861 static bool add_idt(struct acpi_nfit_desc *acpi_desc, in add_idt() argument
865 struct device *dev = acpi_desc->dev; in add_idt()
876 list_move_tail(&nfit_idt->list, &acpi_desc->idts); in add_idt()
887 list_add_tail(&nfit_idt->list, &acpi_desc->idts); in add_idt()
900 static bool add_flush(struct acpi_nfit_desc *acpi_desc, in add_flush() argument
904 struct device *dev = acpi_desc->dev; in add_flush()
916 list_move_tail(&nfit_flush->list, &acpi_desc->flushes); in add_flush()
927 list_add_tail(&nfit_flush->list, &acpi_desc->flushes); in add_flush()
933 static bool add_platform_cap(struct acpi_nfit_desc *acpi_desc, in add_platform_cap() argument
936 struct device *dev = acpi_desc->dev; in add_platform_cap()
940 acpi_desc->platform_cap = pcap->capabilities & mask; in add_platform_cap()
941 dev_dbg(dev, "cap: %#x\n", acpi_desc->platform_cap); in add_platform_cap()
945 static void *add_table(struct acpi_nfit_desc *acpi_desc, in add_table() argument
948 struct device *dev = acpi_desc->dev; in add_table()
964 if (!add_spa(acpi_desc, prev, table)) in add_table()
968 if (!add_memdev(acpi_desc, prev, table)) in add_table()
972 if (!add_dcr(acpi_desc, prev, table)) in add_table()
976 if (!add_bdw(acpi_desc, prev, table)) in add_table()
980 if (!add_idt(acpi_desc, prev, table)) in add_table()
984 if (!add_flush(acpi_desc, prev, table)) in add_table()
991 if (!add_platform_cap(acpi_desc, table)) in add_table()
1002 static int __nfit_mem_init(struct acpi_nfit_desc *acpi_desc, in __nfit_mem_init() argument
1025 list_for_each_entry(nfit_memdev, &acpi_desc->memdevs, list) { in __nfit_mem_init()
1038 list_for_each_entry(nfit_mem, &acpi_desc->dimms, list) in __nfit_mem_init()
1048 nfit_mem = devm_kzalloc(acpi_desc->dev, 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()
1057 list_for_each_entry(nfit_dcr, &acpi_desc->dcrs, list) { in __nfit_mem_init()
1075 list_for_each_entry(nfit_flush, &acpi_desc->flushes, list) { in __nfit_mem_init()
1083 nfit_mem->flush_wpq = devm_kcalloc(acpi_desc->dev, in __nfit_mem_init()
1099 dev_err(acpi_desc->dev, "SPA %d missing DCR %d\n", in __nfit_mem_init()
1112 list_for_each_entry(nfit_idt, &acpi_desc->idts, list) { in __nfit_mem_init()
1148 static int nfit_mem_init(struct acpi_nfit_desc *acpi_desc) in nfit_mem_init() argument
1162 list_for_each_entry(nfit_spa, &acpi_desc->spas, list) { in nfit_mem_init()
1163 rc = __nfit_mem_init(acpi_desc, nfit_spa->spa); in nfit_mem_init()
1173 rc = __nfit_mem_init(acpi_desc, NULL); in nfit_mem_init()
1177 list_sort(NULL, &acpi_desc->dimms, nfit_mem_cmp); in nfit_mem_init()
1187 struct acpi_nfit_desc *acpi_desc = to_acpi_desc(nd_desc); in bus_dsm_mask_show() local
1189 return sysfs_emit(buf, "%#lx\n", acpi_desc->bus_dsm_mask); in bus_dsm_mask_show()
1199 struct acpi_nfit_desc *acpi_desc = to_acpi_desc(nd_desc); in revision_show() local
1201 return sysfs_emit(buf, "%d\n", acpi_desc->acpi_header.revision); in revision_show()
1210 struct acpi_nfit_desc *acpi_desc = to_acpi_desc(nd_desc); in hw_error_scrub_show() local
1212 return sysfs_emit(buf, "%d\n", acpi_desc->scrub_mode); in hw_error_scrub_show()
1236 struct acpi_nfit_desc *acpi_desc = to_acpi_desc(nd_desc); in hw_error_scrub_store() local
1240 acpi_desc->scrub_mode = HW_ERROR_SCRUB_ON; in hw_error_scrub_store()
1243 acpi_desc->scrub_mode = HW_ERROR_SCRUB_OFF; in hw_error_scrub_store()
1266 struct acpi_nfit_desc *acpi_desc; in scrub_show() local
1276 acpi_desc = to_acpi_desc(nd_desc); in scrub_show()
1278 mutex_lock(&acpi_desc->init_mutex); in scrub_show()
1279 busy = test_bit(ARS_BUSY, &acpi_desc->scrub_flags) in scrub_show()
1280 && !test_bit(ARS_CANCEL, &acpi_desc->scrub_flags); in scrub_show()
1281 rc = sysfs_emit(buf, "%d%s", acpi_desc->scrub_count, busy ? "+\n" : "\n"); in scrub_show()
1284 &acpi_desc->scrub_flags)) { in scrub_show()
1285 acpi_desc->scrub_tmo = 1; in scrub_show()
1286 mod_delayed_work(nfit_wq, &acpi_desc->dwork, HZ); in scrub_show()
1289 mutex_unlock(&acpi_desc->init_mutex); in scrub_show()
1310 struct acpi_nfit_desc *acpi_desc = to_acpi_desc(nd_desc); in scrub_store() local
1312 rc = acpi_nfit_ars_rescan(acpi_desc, ARS_REQ_LONG); in scrub_store()
1479 struct acpi_nfit_desc *acpi_desc; in format1_show() local
1484 acpi_desc = nfit_mem->acpi_desc; in format1_show()
1488 mutex_lock(&acpi_desc->init_mutex); in format1_show()
1489 list_for_each_entry(nfit_memdev, &acpi_desc->memdevs, list) { in format1_show()
1496 list_for_each_entry(nfit_dcr, &acpi_desc->dcrs, list) { in format1_show()
1508 mutex_unlock(&acpi_desc->init_mutex); in format1_show()
1655 static struct nvdimm *acpi_nfit_dimm_by_handle(struct acpi_nfit_desc *acpi_desc, in acpi_nfit_dimm_by_handle() argument
1660 list_for_each_entry(nfit_mem, &acpi_desc->dimms, list) in acpi_nfit_dimm_by_handle()
1670 struct acpi_nfit_desc *acpi_desc; in __acpi_nvdimm_notify() local
1681 acpi_desc = dev_get_drvdata(dev->parent); in __acpi_nvdimm_notify()
1682 if (!acpi_desc) in __acpi_nvdimm_notify()
1772 static int acpi_nfit_add_dimm(struct acpi_nfit_desc *acpi_desc, in acpi_nfit_add_dimm() argument
1775 struct nvdimm_bus_descriptor *nd_desc = &acpi_desc->nd_desc; in acpi_nfit_add_dimm()
1777 struct device *dev = acpi_desc->dev; in acpi_nfit_add_dimm()
1785 nfit_mem->dsm_mask = acpi_desc->dimm_cmd_force_en; in acpi_nfit_add_dimm()
1800 adev = to_acpi_dev(acpi_desc); in acpi_nfit_add_dimm()
1930 struct acpi_nfit_desc *acpi_desc = data; in shutdown_dimm_notify() local
1933 mutex_lock(&acpi_desc->init_mutex); in shutdown_dimm_notify()
1938 list_for_each_entry(nfit_mem, &acpi_desc->dimms, list) { in shutdown_dimm_notify()
1951 mutex_unlock(&acpi_desc->init_mutex); in shutdown_dimm_notify()
1968 struct acpi_nfit_desc *acpi_desc = nfit_mem->acpi_desc; in acpi_nfit_get_fw_ops() local
1969 struct nvdimm_bus_descriptor *nd_desc = &acpi_desc->nd_desc; in acpi_nfit_get_fw_ops()
1984 static int acpi_nfit_register_dimms(struct acpi_nfit_desc *acpi_desc) in acpi_nfit_register_dimms() argument
1990 list_for_each_entry(nfit_mem, &acpi_desc->dimms, list) { in acpi_nfit_register_dimms()
1998 nvdimm = acpi_nfit_dimm_by_handle(acpi_desc, device_handle); in acpi_nfit_register_dimms()
2005 list_for_each_entry(nfit_memdev, &acpi_desc->memdevs, list) { in acpi_nfit_register_dimms()
2019 rc = acpi_nfit_add_dimm(acpi_desc, nfit_mem, device_handle); in acpi_nfit_register_dimms()
2047 nvdimm = __nvdimm_create(acpi_desc->nvdimm_bus, nfit_mem, in acpi_nfit_register_dimms()
2062 dev_err(acpi_desc->dev, "Error found in NVDIMM %s flags:%s%s%s%s%s\n", in acpi_nfit_register_dimms()
2072 rc = nvdimm_bus_check_dimm_count(acpi_desc->nvdimm_bus, dimm_count); in acpi_nfit_register_dimms()
2080 list_for_each_entry(nfit_mem, &acpi_desc->dimms, list) { in acpi_nfit_register_dimms()
2093 dev_warn(acpi_desc->dev, "%s: notifications disabled\n", in acpi_nfit_register_dimms()
2097 return devm_add_action_or_reset(acpi_desc->dev, shutdown_dimm_notify, in acpi_nfit_register_dimms()
2098 acpi_desc); in acpi_nfit_register_dimms()
2112 static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc) in acpi_nfit_init_dsms() argument
2114 struct nvdimm_bus_descriptor *nd_desc = &acpi_desc->nd_desc; in acpi_nfit_init_dsms()
2124 if (acpi_desc->bus_cmd_force_en) { in acpi_nfit_init_dsms()
2125 nd_desc->cmd_mask = acpi_desc->bus_cmd_force_en; in acpi_nfit_init_dsms()
2127 if (acpi_desc->family_dsm_mask[NVDIMM_BUS_FAMILY_INTEL]) { in acpi_nfit_init_dsms()
2133 adev = to_acpi_dev(acpi_desc); in acpi_nfit_init_dsms()
2152 set_bit(i, &acpi_desc->bus_dsm_mask); in acpi_nfit_init_dsms()
2157 mask = &acpi_desc->family_dsm_mask[NVDIMM_BUS_FAMILY_INTEL]; in acpi_nfit_init_dsms()
2244 struct acpi_nfit_desc *acpi_desc, u16 range_index, int n) in memdev_from_spa() argument
2248 list_for_each_entry(nfit_memdev, &acpi_desc->memdevs, list) in memdev_from_spa()
2255 static int acpi_nfit_init_interleave_set(struct acpi_nfit_desc *acpi_desc, in acpi_nfit_init_interleave_set() argument
2264 struct device *dev = acpi_desc->dev; in acpi_nfit_init_interleave_set()
2283 memdev_from_spa(acpi_desc, spa->range_index, i); in acpi_nfit_init_interleave_set()
2340 static int ars_get_cap(struct acpi_nfit_desc *acpi_desc, in ars_get_cap() argument
2343 struct nvdimm_bus_descriptor *nd_desc = &acpi_desc->nd_desc; in ars_get_cap()
2356 static int ars_start(struct acpi_nfit_desc *acpi_desc, in ars_start() argument
2363 struct nvdimm_bus_descriptor *nd_desc = &acpi_desc->nd_desc; in ars_start()
2384 set_bit(ARS_VALID, &acpi_desc->scrub_flags); in ars_start()
2388 static int ars_continue(struct acpi_nfit_desc *acpi_desc) in ars_continue() argument
2392 struct nvdimm_bus_descriptor *nd_desc = &acpi_desc->nd_desc; in ars_continue()
2393 struct nd_cmd_ars_status *ars_status = acpi_desc->ars_status; in ars_continue()
2407 static int ars_get_status(struct acpi_nfit_desc *acpi_desc) in ars_get_status() argument
2409 struct nvdimm_bus_descriptor *nd_desc = &acpi_desc->nd_desc; in ars_get_status()
2410 struct nd_cmd_ars_status *ars_status = acpi_desc->ars_status; in ars_get_status()
2414 acpi_desc->max_ars, &cmd_rc); in ars_get_status()
2420 static void ars_complete(struct acpi_nfit_desc *acpi_desc, in ars_complete() argument
2423 struct nd_cmd_ars_status *ars_status = acpi_desc->ars_status; in ars_complete()
2428 lockdep_assert_held(&acpi_desc->init_mutex); in ars_complete()
2434 if (acpi_desc->scrub_spa != nfit_spa) in ars_complete()
2456 acpi_desc->scrub_spa = NULL; in ars_complete()
2461 dev = acpi_desc->dev; in ars_complete()
2465 static int ars_status_process_records(struct acpi_nfit_desc *acpi_desc) in ars_status_process_records() argument
2467 struct nvdimm_bus *nvdimm_bus = acpi_desc->nvdimm_bus; in ars_status_process_records()
2468 struct nd_cmd_ars_status *ars_status = acpi_desc->ars_status; in ars_status_process_records()
2483 if (!test_and_clear_bit(ARS_VALID, &acpi_desc->scrub_flags)) { in ars_status_process_records()
2484 dev_dbg(acpi_desc->dev, "skip %d stale records\n", in ars_status_process_records()
2501 dev_warn(acpi_desc->dev, "detected truncated ars results\n"); in ars_status_process_records()
2513 static int acpi_nfit_insert_resource(struct acpi_nfit_desc *acpi_desc, in acpi_nfit_insert_resource() argument
2525 res = devm_kzalloc(acpi_desc->dev, sizeof(*res), GFP_KERNEL); in acpi_nfit_insert_resource()
2539 ret = devm_add_action_or_reset(acpi_desc->dev, in acpi_nfit_insert_resource()
2548 static int acpi_nfit_init_mapping(struct acpi_nfit_desc *acpi_desc, in acpi_nfit_init_mapping() argument
2553 struct nvdimm *nvdimm = acpi_nfit_dimm_by_handle(acpi_desc, in acpi_nfit_init_mapping()
2558 dev_err(acpi_desc->dev, "spa%d dimm: %#x not found\n", in acpi_nfit_init_mapping()
2590 static int acpi_nfit_register_region(struct acpi_nfit_desc *acpi_desc, in acpi_nfit_register_region() argument
2605 dev_dbg(acpi_desc->dev, "detected invalid spa index\n"); in acpi_nfit_register_region()
2629 dev_info(acpi_desc->dev, "changing numa node from %d to %d for nfit region [%pa-%pa]", in acpi_nfit_register_region()
2634 dev_info(acpi_desc->dev, "changing target node from %d to %d for nfit region [%pa-%pa]", in acpi_nfit_register_region()
2643 if (acpi_desc->platform_cap & ACPI_NFIT_CAPABILITY_CACHE_FLUSH) in acpi_nfit_register_region()
2645 else if (acpi_desc->platform_cap & ACPI_NFIT_CAPABILITY_MEM_FLUSH) in acpi_nfit_register_region()
2648 list_for_each_entry(nfit_memdev, &acpi_desc->memdevs, list) { in acpi_nfit_register_region()
2658 dev_err(acpi_desc->dev, "spa%d exceeds max mappings %d\n", in acpi_nfit_register_region()
2663 rc = acpi_nfit_init_mapping(acpi_desc, mapping, ndr_desc, in acpi_nfit_register_region()
2671 rc = acpi_nfit_init_interleave_set(acpi_desc, ndr_desc, spa); in acpi_nfit_register_region()
2675 nvdimm_bus = acpi_desc->nvdimm_bus; in acpi_nfit_register_region()
2677 rc = acpi_nfit_insert_resource(acpi_desc, ndr_desc); in acpi_nfit_register_region()
2679 dev_warn(acpi_desc->dev, in acpi_nfit_register_region()
2703 dev_err(acpi_desc->dev, "failed to register spa range %d\n", in acpi_nfit_register_region()
2708 static int ars_status_alloc(struct acpi_nfit_desc *acpi_desc) in ars_status_alloc() argument
2710 struct device *dev = acpi_desc->dev; in ars_status_alloc()
2713 if (acpi_desc->ars_status) { in ars_status_alloc()
2714 memset(acpi_desc->ars_status, 0, acpi_desc->max_ars); in ars_status_alloc()
2718 ars_status = devm_kzalloc(dev, acpi_desc->max_ars, GFP_KERNEL); in ars_status_alloc()
2721 acpi_desc->ars_status = ars_status; in ars_status_alloc()
2725 static int acpi_nfit_query_poison(struct acpi_nfit_desc *acpi_desc) in acpi_nfit_query_poison() argument
2729 if (ars_status_alloc(acpi_desc)) in acpi_nfit_query_poison()
2732 rc = ars_get_status(acpi_desc); in acpi_nfit_query_poison()
2737 if (ars_status_process_records(acpi_desc)) in acpi_nfit_query_poison()
2738 dev_err(acpi_desc->dev, "Failed to process ARS records\n"); in acpi_nfit_query_poison()
2743 static int ars_register(struct acpi_nfit_desc *acpi_desc, in ars_register() argument
2749 return acpi_nfit_register_region(acpi_desc, nfit_spa); in ars_register()
2755 switch (acpi_nfit_query_poison(acpi_desc)) { in ars_register()
2759 rc = ars_start(acpi_desc, nfit_spa, ARS_REQ_SHORT); in ars_register()
2768 rc = acpi_nfit_query_poison(acpi_desc); in ars_register()
2771 acpi_desc->scrub_spa = nfit_spa; in ars_register()
2772 ars_complete(acpi_desc, nfit_spa); in ars_register()
2778 acpi_desc->scrub_spa = NULL; in ars_register()
2793 return acpi_nfit_register_region(acpi_desc, nfit_spa); in ars_register()
2796 static void ars_complete_all(struct acpi_nfit_desc *acpi_desc) in ars_complete_all() argument
2800 list_for_each_entry(nfit_spa, &acpi_desc->spas, list) { in ars_complete_all()
2803 ars_complete(acpi_desc, nfit_spa); in ars_complete_all()
2807 static unsigned int __acpi_nfit_scrub(struct acpi_nfit_desc *acpi_desc, in __acpi_nfit_scrub() argument
2810 unsigned int tmo = acpi_desc->scrub_tmo; in __acpi_nfit_scrub()
2811 struct device *dev = acpi_desc->dev; in __acpi_nfit_scrub()
2814 lockdep_assert_held(&acpi_desc->init_mutex); in __acpi_nfit_scrub()
2816 if (test_bit(ARS_CANCEL, &acpi_desc->scrub_flags)) in __acpi_nfit_scrub()
2825 ars_continue(acpi_desc); in __acpi_nfit_scrub()
2831 addr = acpi_desc->ars_status->address; in __acpi_nfit_scrub()
2832 end = addr + acpi_desc->ars_status->length; in __acpi_nfit_scrub()
2837 ars_complete_all(acpi_desc); in __acpi_nfit_scrub()
2838 list_for_each_entry(nfit_spa, &acpi_desc->spas, list) { in __acpi_nfit_scrub()
2852 rc = ars_start(acpi_desc, nfit_spa, req_type); in __acpi_nfit_scrub()
2866 dev_WARN_ONCE(dev, acpi_desc->scrub_spa, in __acpi_nfit_scrub()
2868 acpi_desc->scrub_spa->spa->range_index); in __acpi_nfit_scrub()
2870 acpi_desc->scrub_spa = nfit_spa; in __acpi_nfit_scrub()
2875 list_move_tail(&nfit_spa->list, &acpi_desc->spas); in __acpi_nfit_scrub()
2886 static void __sched_ars(struct acpi_nfit_desc *acpi_desc, unsigned int tmo) in __sched_ars() argument
2888 lockdep_assert_held(&acpi_desc->init_mutex); in __sched_ars()
2890 set_bit(ARS_BUSY, &acpi_desc->scrub_flags); in __sched_ars()
2893 acpi_desc->scrub_tmo = tmo; in __sched_ars()
2894 queue_delayed_work(nfit_wq, &acpi_desc->dwork, tmo * HZ); in __sched_ars()
2897 static void sched_ars(struct acpi_nfit_desc *acpi_desc) in sched_ars() argument
2899 __sched_ars(acpi_desc, 0); in sched_ars()
2902 static void notify_ars_done(struct acpi_nfit_desc *acpi_desc) in notify_ars_done() argument
2904 lockdep_assert_held(&acpi_desc->init_mutex); in notify_ars_done()
2906 clear_bit(ARS_BUSY, &acpi_desc->scrub_flags); in notify_ars_done()
2907 acpi_desc->scrub_count++; in notify_ars_done()
2908 if (acpi_desc->scrub_count_state) in notify_ars_done()
2909 sysfs_notify_dirent(acpi_desc->scrub_count_state); in notify_ars_done()
2914 struct acpi_nfit_desc *acpi_desc; in acpi_nfit_scrub() local
2918 acpi_desc = container_of(work, typeof(*acpi_desc), dwork.work); in acpi_nfit_scrub()
2919 mutex_lock(&acpi_desc->init_mutex); in acpi_nfit_scrub()
2920 query_rc = acpi_nfit_query_poison(acpi_desc); in acpi_nfit_scrub()
2921 tmo = __acpi_nfit_scrub(acpi_desc, query_rc); in acpi_nfit_scrub()
2923 __sched_ars(acpi_desc, tmo); in acpi_nfit_scrub()
2925 notify_ars_done(acpi_desc); in acpi_nfit_scrub()
2926 memset(acpi_desc->ars_status, 0, acpi_desc->max_ars); in acpi_nfit_scrub()
2927 clear_bit(ARS_POLL, &acpi_desc->scrub_flags); in acpi_nfit_scrub()
2928 mutex_unlock(&acpi_desc->init_mutex); in acpi_nfit_scrub()
2931 static void acpi_nfit_init_ars(struct acpi_nfit_desc *acpi_desc, in acpi_nfit_init_ars() argument
2940 rc = ars_get_cap(acpi_desc, &ars_cap, nfit_spa); in acpi_nfit_init_ars()
2953 acpi_desc->max_ars = max(nfit_spa->max_ars, acpi_desc->max_ars); in acpi_nfit_init_ars()
2957 static int acpi_nfit_register_regions(struct acpi_nfit_desc *acpi_desc) in acpi_nfit_register_regions() argument
2962 set_bit(ARS_VALID, &acpi_desc->scrub_flags); in acpi_nfit_register_regions()
2963 list_for_each_entry(nfit_spa, &acpi_desc->spas, list) { in acpi_nfit_register_regions()
2967 acpi_nfit_init_ars(acpi_desc, nfit_spa); in acpi_nfit_register_regions()
2972 list_for_each_entry(nfit_spa, &acpi_desc->spas, list) { in acpi_nfit_register_regions()
2977 rc = ars_register(acpi_desc, nfit_spa); in acpi_nfit_register_regions()
2997 rc = acpi_nfit_register_region(acpi_desc, nfit_spa); in acpi_nfit_register_regions()
3008 sched_ars(acpi_desc); in acpi_nfit_register_regions()
3012 static int acpi_nfit_check_deletions(struct acpi_nfit_desc *acpi_desc, in acpi_nfit_check_deletions() argument
3015 struct device *dev = acpi_desc->dev; in acpi_nfit_check_deletions()
3029 static int acpi_nfit_desc_init_scrub_attr(struct acpi_nfit_desc *acpi_desc) in acpi_nfit_desc_init_scrub_attr() argument
3031 struct device *dev = acpi_desc->dev; in acpi_nfit_desc_init_scrub_attr()
3035 if (!ars_supported(acpi_desc->nvdimm_bus)) in acpi_nfit_desc_init_scrub_attr()
3038 bus_dev = to_nvdimm_bus_dev(acpi_desc->nvdimm_bus); in acpi_nfit_desc_init_scrub_attr()
3044 acpi_desc->scrub_count_state = sysfs_get_dirent(nfit, "scrub"); in acpi_nfit_desc_init_scrub_attr()
3046 if (!acpi_desc->scrub_count_state) { in acpi_nfit_desc_init_scrub_attr()
3056 struct acpi_nfit_desc *acpi_desc = data; in acpi_nfit_unregister() local
3058 nvdimm_bus_unregister(acpi_desc->nvdimm_bus); in acpi_nfit_unregister()
3061 int acpi_nfit_init(struct acpi_nfit_desc *acpi_desc, void *data, acpi_size sz) in acpi_nfit_init() argument
3063 struct device *dev = acpi_desc->dev; in acpi_nfit_init()
3068 if (!acpi_desc->nvdimm_bus) { in acpi_nfit_init()
3069 acpi_nfit_init_dsms(acpi_desc); in acpi_nfit_init()
3071 acpi_desc->nvdimm_bus = nvdimm_bus_register(dev, in acpi_nfit_init()
3072 &acpi_desc->nd_desc); in acpi_nfit_init()
3073 if (!acpi_desc->nvdimm_bus) in acpi_nfit_init()
3077 acpi_desc); in acpi_nfit_init()
3081 rc = acpi_nfit_desc_init_scrub_attr(acpi_desc); in acpi_nfit_init()
3087 list_add_tail(&acpi_desc->list, &acpi_descs); in acpi_nfit_init()
3091 mutex_lock(&acpi_desc->init_mutex); in acpi_nfit_init()
3100 list_cut_position(&prev.spas, &acpi_desc->spas, in acpi_nfit_init()
3101 acpi_desc->spas.prev); in acpi_nfit_init()
3102 list_cut_position(&prev.memdevs, &acpi_desc->memdevs, in acpi_nfit_init()
3103 acpi_desc->memdevs.prev); in acpi_nfit_init()
3104 list_cut_position(&prev.dcrs, &acpi_desc->dcrs, in acpi_nfit_init()
3105 acpi_desc->dcrs.prev); in acpi_nfit_init()
3106 list_cut_position(&prev.bdws, &acpi_desc->bdws, in acpi_nfit_init()
3107 acpi_desc->bdws.prev); in acpi_nfit_init()
3108 list_cut_position(&prev.idts, &acpi_desc->idts, in acpi_nfit_init()
3109 acpi_desc->idts.prev); in acpi_nfit_init()
3110 list_cut_position(&prev.flushes, &acpi_desc->flushes, in acpi_nfit_init()
3111 acpi_desc->flushes.prev); in acpi_nfit_init()
3115 data = add_table(acpi_desc, &prev, data, end); in acpi_nfit_init()
3123 rc = acpi_nfit_check_deletions(acpi_desc, &prev); in acpi_nfit_init()
3127 rc = nfit_mem_init(acpi_desc); in acpi_nfit_init()
3131 rc = acpi_nfit_register_dimms(acpi_desc); in acpi_nfit_init()
3135 rc = acpi_nfit_register_regions(acpi_desc); in acpi_nfit_init()
3138 mutex_unlock(&acpi_desc->init_mutex); in acpi_nfit_init()
3145 struct acpi_nfit_desc *acpi_desc = to_acpi_desc(nd_desc); in acpi_nfit_flush_probe() local
3146 struct device *dev = acpi_desc->dev; in acpi_nfit_flush_probe()
3153 mutex_lock(&acpi_desc->init_mutex); in acpi_nfit_flush_probe()
3154 mutex_unlock(&acpi_desc->init_mutex); in acpi_nfit_flush_probe()
3162 struct acpi_nfit_desc *acpi_desc = to_acpi_desc(nd_desc); in __acpi_nfit_clear_to_send() local
3175 if (work_busy(&acpi_desc->dwork.work)) in __acpi_nfit_clear_to_send()
3207 int acpi_nfit_ars_rescan(struct acpi_nfit_desc *acpi_desc, in acpi_nfit_ars_rescan() argument
3210 struct device *dev = acpi_desc->dev; in acpi_nfit_ars_rescan()
3214 mutex_lock(&acpi_desc->init_mutex); in acpi_nfit_ars_rescan()
3215 if (test_bit(ARS_CANCEL, &acpi_desc->scrub_flags)) { in acpi_nfit_ars_rescan()
3216 mutex_unlock(&acpi_desc->init_mutex); in acpi_nfit_ars_rescan()
3220 list_for_each_entry(nfit_spa, &acpi_desc->spas, list) { in acpi_nfit_ars_rescan()
3234 sched_ars(acpi_desc); in acpi_nfit_ars_rescan()
3237 mutex_unlock(&acpi_desc->init_mutex); in acpi_nfit_ars_rescan()
3246 void acpi_nfit_desc_init(struct acpi_nfit_desc *acpi_desc, struct device *dev) in acpi_nfit_desc_init() argument
3250 dev_set_drvdata(dev, acpi_desc); in acpi_nfit_desc_init()
3251 acpi_desc->dev = dev; in acpi_nfit_desc_init()
3252 nd_desc = &acpi_desc->nd_desc; in acpi_nfit_desc_init()
3260 INIT_LIST_HEAD(&acpi_desc->spas); in acpi_nfit_desc_init()
3261 INIT_LIST_HEAD(&acpi_desc->dcrs); in acpi_nfit_desc_init()
3262 INIT_LIST_HEAD(&acpi_desc->bdws); in acpi_nfit_desc_init()
3263 INIT_LIST_HEAD(&acpi_desc->idts); in acpi_nfit_desc_init()
3264 INIT_LIST_HEAD(&acpi_desc->flushes); in acpi_nfit_desc_init()
3265 INIT_LIST_HEAD(&acpi_desc->memdevs); in acpi_nfit_desc_init()
3266 INIT_LIST_HEAD(&acpi_desc->dimms); in acpi_nfit_desc_init()
3267 INIT_LIST_HEAD(&acpi_desc->list); in acpi_nfit_desc_init()
3268 mutex_init(&acpi_desc->init_mutex); in acpi_nfit_desc_init()
3269 acpi_desc->scrub_tmo = 1; in acpi_nfit_desc_init()
3270 INIT_DELAYED_WORK(&acpi_desc->dwork, acpi_nfit_scrub); in acpi_nfit_desc_init()
3298 struct acpi_nfit_desc *acpi_desc = data; in acpi_nfit_shutdown() local
3299 struct device *bus_dev = to_nvdimm_bus_dev(acpi_desc->nvdimm_bus); in acpi_nfit_shutdown()
3306 list_del(&acpi_desc->list); in acpi_nfit_shutdown()
3309 mutex_lock(&acpi_desc->init_mutex); in acpi_nfit_shutdown()
3310 set_bit(ARS_CANCEL, &acpi_desc->scrub_flags); in acpi_nfit_shutdown()
3311 mutex_unlock(&acpi_desc->init_mutex); in acpi_nfit_shutdown()
3312 cancel_delayed_work_sync(&acpi_desc->dwork); in acpi_nfit_shutdown()
3329 struct acpi_nfit_desc *acpi_desc; in acpi_nfit_add() local
3364 acpi_desc = devm_kzalloc(dev, sizeof(*acpi_desc), GFP_KERNEL); in acpi_nfit_add()
3365 if (!acpi_desc) in acpi_nfit_add()
3367 acpi_nfit_desc_init(acpi_desc, &adev->dev); in acpi_nfit_add()
3370 acpi_desc->acpi_header = *tbl; in acpi_nfit_add()
3378 rc = acpi_nfit_init(acpi_desc, obj->buffer.pointer, in acpi_nfit_add()
3386 rc = acpi_nfit_init(acpi_desc, (void *) tbl in acpi_nfit_add()
3393 return devm_add_action_or_reset(dev, acpi_nfit_shutdown, acpi_desc); in acpi_nfit_add()
3398 struct acpi_nfit_desc *acpi_desc = dev_get_drvdata(dev); in acpi_nfit_update_notify() local
3410 if (!acpi_desc) { in acpi_nfit_update_notify()
3411 acpi_desc = devm_kzalloc(dev, sizeof(*acpi_desc), GFP_KERNEL); in acpi_nfit_update_notify()
3412 if (!acpi_desc) in acpi_nfit_update_notify()
3414 acpi_nfit_desc_init(acpi_desc, dev); in acpi_nfit_update_notify()
3432 ret = acpi_nfit_init(acpi_desc, obj->buffer.pointer, in acpi_nfit_update_notify()
3443 struct acpi_nfit_desc *acpi_desc = dev_get_drvdata(dev); in acpi_nfit_uc_error_notify() local
3445 if (acpi_desc->scrub_mode == HW_ERROR_SCRUB_ON) in acpi_nfit_uc_error_notify()
3446 acpi_nfit_ars_rescan(acpi_desc, ARS_REQ_LONG); in acpi_nfit_uc_error_notify()
3448 acpi_nfit_ars_rescan(acpi_desc, ARS_REQ_SHORT); in acpi_nfit_uc_error_notify()