Lines Matching refs:ndd

44 static int validate_dimm(struct nvdimm_drvdata *ndd)  in validate_dimm()  argument
48 if (!ndd) in validate_dimm()
51 rc = nvdimm_check_config_data(ndd->dev); in validate_dimm()
53 dev_dbg(ndd->dev, "%ps: %s error: %d\n", in validate_dimm()
62 int nvdimm_init_nsarea(struct nvdimm_drvdata *ndd) in nvdimm_init_nsarea() argument
64 struct nd_cmd_get_config_size *cmd = &ndd->nsarea; in nvdimm_init_nsarea()
65 struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(ndd->dev); in nvdimm_init_nsarea()
67 int rc = validate_dimm(ndd); in nvdimm_init_nsarea()
78 rc = nd_desc->ndctl(nd_desc, to_nvdimm(ndd->dev), in nvdimm_init_nsarea()
85 int nvdimm_get_config_data(struct nvdimm_drvdata *ndd, void *buf, in nvdimm_get_config_data() argument
88 struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(ndd->dev); in nvdimm_get_config_data()
90 int rc = validate_dimm(ndd), cmd_rc = 0; in nvdimm_get_config_data()
97 if (offset + len > ndd->nsarea.config_size) in nvdimm_get_config_data()
100 max_cmd_size = min_t(u32, len, ndd->nsarea.max_xfer); in nvdimm_get_config_data()
114 rc = nd_desc->ndctl(nd_desc, to_nvdimm(ndd->dev), in nvdimm_get_config_data()
131 int nvdimm_set_config_data(struct nvdimm_drvdata *ndd, size_t offset, in nvdimm_set_config_data() argument
136 int rc = validate_dimm(ndd), cmd_rc = 0; in nvdimm_set_config_data()
137 struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(ndd->dev); in nvdimm_set_config_data()
143 if (offset + len > ndd->nsarea.config_size) in nvdimm_set_config_data()
146 max_cmd_size = min_t(u32, len, ndd->nsarea.max_xfer); in nvdimm_set_config_data()
162 rc = nd_desc->ndctl(nd_desc, to_nvdimm(ndd->dev), in nvdimm_set_config_data()
242 struct nvdimm_drvdata *ndd = container_of(kref, typeof(*ndd), kref); in nvdimm_drvdata_release() local
243 struct device *dev = ndd->dev; in nvdimm_drvdata_release()
248 for_each_dpa_resource_safe(ndd, res, _r) in nvdimm_drvdata_release()
249 nvdimm_free_dpa(ndd, res); in nvdimm_drvdata_release()
252 kvfree(ndd->data); in nvdimm_drvdata_release()
253 kfree(ndd); in nvdimm_drvdata_release()
257 void get_ndd(struct nvdimm_drvdata *ndd) in get_ndd() argument
259 kref_get(&ndd->kref); in get_ndd()
262 void put_ndd(struct nvdimm_drvdata *ndd) in put_ndd() argument
264 if (ndd) in put_ndd()
265 kref_put(&ndd->kref, nvdimm_drvdata_release); in put_ndd()
341 struct nvdimm_drvdata *ndd = dev_get_drvdata(dev); in available_slots_show() local
345 if (!ndd) in available_slots_show()
349 nfree = nd_label_nfree(ndd); in available_slots_show()
705 struct nvdimm_drvdata *ndd; in alias_dpa_busy() local
723 ndd = to_ndd(nd_mapping); in alias_dpa_busy()
749 for_each_dpa_resource(ndd, res) { in alias_dpa_busy()
792 struct nvdimm_drvdata *ndd = to_ndd(nd_mapping); in nd_blk_available_dpa() local
801 if (!ndd) in nd_blk_available_dpa()
810 for_each_dpa_resource(ndd, res) { in nd_blk_available_dpa()
835 struct nvdimm_drvdata *ndd = to_ndd(nd_mapping); in nd_pmem_max_contiguous_dpa() local
842 if (!ndd) in nd_pmem_max_contiguous_dpa()
849 nvdimm_bus = walk_to_nvdimm_bus(ndd->dev); in nd_pmem_max_contiguous_dpa()
852 for_each_dpa_resource(ndd, res) { in nd_pmem_max_contiguous_dpa()
888 struct nvdimm_drvdata *ndd = to_ndd(nd_mapping); in nd_pmem_available_dpa() local
893 if (!ndd) in nd_pmem_available_dpa()
903 for_each_dpa_resource(ndd, res) { in nd_pmem_available_dpa()
941 nd_dbg_dpa(nd_region, ndd, res, "%s\n", reason); in nd_pmem_available_dpa()
945 void nvdimm_free_dpa(struct nvdimm_drvdata *ndd, struct resource *res) in nvdimm_free_dpa() argument
947 WARN_ON_ONCE(!is_nvdimm_bus_locked(ndd->dev)); in nvdimm_free_dpa()
949 __release_region(&ndd->dpa, res->start, resource_size(res)); in nvdimm_free_dpa()
952 struct resource *nvdimm_allocate_dpa(struct nvdimm_drvdata *ndd, in nvdimm_allocate_dpa() argument
962 WARN_ON_ONCE(!is_nvdimm_bus_locked(ndd->dev)); in nvdimm_allocate_dpa()
963 res = __request_region(&ndd->dpa, start, n, name, 0); in nvdimm_allocate_dpa()
974 resource_size_t nvdimm_allocated_dpa(struct nvdimm_drvdata *ndd, in nvdimm_allocated_dpa() argument
980 for_each_dpa_resource(ndd, res) in nvdimm_allocated_dpa()