Lines Matching full:nv
67 read_label_area_size(struct nvdimm_dev *nv) in read_label_area_size() argument
76 handle = nvdimm_root_get_acpi_handle(nv->nv_dev); in read_label_area_size()
91 nv->label_area_size = out[1]; in read_label_area_size()
92 nv->max_label_xfer = out[2]; in read_label_area_size()
102 read_label_area(struct nvdimm_dev *nv, uint8_t *dest, off_t offset, in read_label_area() argument
114 handle = nvdimm_root_get_acpi_handle(nv->nv_dev); in read_label_area()
116 offset + length > nv->label_area_size || in read_label_area()
126 to_read = MIN(length, nv->max_label_xfer); in read_label_area()
201 read_label(struct nvdimm_dev *nv, int num) in read_label() argument
208 offset = nv->label_index->label_offset + in read_label()
209 num * (128 << nv->label_index->label_size); in read_label()
211 error = read_label_area(nv, (uint8_t *)&entry->label, offset, in read_label()
226 if (SLIST_EMPTY(&nv->labels) || in read_label()
228 SLIST_FIRST(&nv->labels)->label.dimm_phys_addr) { in read_label()
229 SLIST_INSERT_HEAD(&nv->labels, entry, link); in read_label()
232 SLIST_FOREACH_SAFE(i, &nv->labels, link, next) { in read_label()
243 read_labels(struct nvdimm_dev *nv) in read_labels() argument
254 nv->label_area_size) in read_labels()
257 num_labels = (nv->label_area_size - index_size) / in read_labels()
261 error = read_label_area(nv, (void *)indices, 0, 2 * index_size); in read_labels()
288 nv->label_index = malloc(index_size, M_NVDIMM, M_WAITOK); in read_labels()
289 bcopy(index_0_valid ? indices : index1, nv->label_index, index_size); in read_labels()
291 bit_ffc_at((bitstr_t *)nv->label_index->free, 0, in read_labels()
292 nv->label_index->slot_cnt, &n); in read_labels()
294 read_label(nv, n); in read_labels()
295 bit_ffc_at((bitstr_t *)nv->label_index->free, n + 1, in read_labels()
296 nv->label_index->slot_cnt, &n); in read_labels()
311 struct nvdimm_dev *nv; in nvdimm_attach() local
322 nv = device_get_softc(dev); in nvdimm_attach()
327 nv->nv_dev = dev; in nvdimm_attach()
328 nv->nv_handle = nvdimm_root_get_device_handle(dev); in nvdimm_attach()
336 acpi_nfit_get_flush_addrs(nfitbl, nv->nv_handle, &nv->nv_flush_addr, in nvdimm_attach()
337 &nv->nv_flush_addr_cnt); in nvdimm_attach()
344 acpi_nfit_get_memory_maps_by_dimm(nfitbl, nv->nv_handle, &maps, in nvdimm_attach()
347 free(nv->nv_flush_addr, M_NVDIMM); in nvdimm_attach()
372 free(nv->nv_flush_addr, M_NVDIMM); in nvdimm_attach()
377 nv->nv_flags_str = strdup(sbuf_data(sb), M_NVDIMM); in nvdimm_attach()
380 CTLFLAG_RD | CTLFLAG_MPSAFE, nv->nv_flags_str, 0, in nvdimm_attach()
387 device_printf(dev, "flags: %s\n", nv->nv_flags_str); in nvdimm_attach()
390 error = read_label_area_size(nv); in nvdimm_attach()
396 read_labels(nv); in nvdimm_attach()
404 struct nvdimm_dev *nv; in nvdimm_detach() local
407 nv = device_get_softc(dev); in nvdimm_detach()
408 free(nv->nv_flags_str, M_NVDIMM); in nvdimm_detach()
409 free(nv->nv_flush_addr, M_NVDIMM); in nvdimm_detach()
410 free(nv->label_index, M_NVDIMM); in nvdimm_detach()
411 SLIST_FOREACH_SAFE(label, &nv->labels, link, next) { in nvdimm_detach()
412 SLIST_REMOVE_HEAD(&nv->labels, link); in nvdimm_detach()