Lines Matching refs:nvstore

328 	struct pci_nvme_blockstore nvstore;  member
582 if (sc->nvstore.deallocate) in pci_nvme_init_ctrldata()
605 pci_nvme_init_nsdata_size(struct pci_nvme_blockstore *nvstore, in pci_nvme_init_nsdata_size() argument
610 nd->nsze = nvstore->size / nvstore->sectsz; in pci_nvme_init_nsdata_size()
618 struct pci_nvme_blockstore *nvstore) in pci_nvme_init_nsdata() argument
621 pci_nvme_init_nsdata_size(nvstore, nd); in pci_nvme_init_nsdata()
623 if (nvstore->type == NVME_STOR_BLOCKIF) in pci_nvme_init_nsdata()
624 nvstore->deallocate = blockif_candelete(nvstore->ctx); in pci_nvme_init_nsdata()
630 if (nvstore->eui64 == 0) { in pci_nvme_init_nsdata()
632 uint64_t eui64 = nvstore->eui64; in pci_nvme_init_nsdata()
642 nvstore->eui64 = (eui64 << 16) | (nsid & 0xffff); in pci_nvme_init_nsdata()
644 be64enc(nd->eui64, nvstore->eui64); in pci_nvme_init_nsdata()
647 nd->lbaf[0] = NVMEF(NVME_NS_DATA_LBAF_LBADS, nvstore->sectsz_bits); in pci_nvme_init_nsdata()
1937 if (sc->nvstore.type == NVME_STOR_RAM) { in nvme_opc_format_nvm()
1938 if (sc->nvstore.ctx) in nvme_opc_format_nvm()
1939 free(sc->nvstore.ctx); in nvme_opc_format_nvm()
1940 sc->nvstore.ctx = calloc(1, sc->nvstore.size); in nvme_opc_format_nvm()
1960 req->io_req.br_resid = sc->nvstore.size; in nvme_opc_format_nvm()
1963 err = blockif_delete(sc->nvstore.ctx, &req->io_req); in nvme_opc_format_nvm()
2185 pci_nvme_out_of_range(struct pci_nvme_blockstore *nvstore, uint64_t slba, in pci_nvme_out_of_range() argument
2191 if (slba >> (64 - nvstore->sectsz_bits)) in pci_nvme_out_of_range()
2194 offset = slba << nvstore->sectsz_bits; in pci_nvme_out_of_range()
2195 bytes = nblocks << nvstore->sectsz_bits; in pci_nvme_out_of_range()
2198 if ((nvstore->size <= offset) || ((nvstore->size - offset) < bytes)) in pci_nvme_out_of_range()
2370 struct pci_nvme_blockstore *nvstore, in nvme_opc_flush() argument
2376 if (nvstore->type == NVME_STOR_RAM) { in nvme_opc_flush()
2383 err = blockif_flush(nvstore->ctx, &req->io_req); in nvme_opc_flush()
2401 struct pci_nvme_blockstore *nvstore, in nvme_write_read_ram() argument
2406 uint8_t *buf = nvstore->ctx; in nvme_write_read_ram()
2428 struct pci_nvme_blockstore *nvstore, in nvme_write_read_blockif() argument
2491 err = blockif_write(nvstore->ctx, &req->io_req); in nvme_write_read_blockif()
2493 err = blockif_read(nvstore->ctx, &req->io_req); in nvme_write_read_blockif()
2504 struct pci_nvme_blockstore *nvstore, in nvme_opc_write_read() argument
2515 bytes = nblocks << nvstore->sectsz_bits; in nvme_opc_write_read()
2522 if (pci_nvme_out_of_range(nvstore, lba, nblocks)) { in nvme_opc_write_read()
2529 offset = lba << nvstore->sectsz_bits; in nvme_opc_write_read()
2538 if (nvstore->type == NVME_STOR_RAM) { in nvme_opc_write_read()
2539 *status = nvme_write_read_ram(sc, nvstore, cmd->prp1, in nvme_opc_write_read()
2542 *status = nvme_write_read_blockif(sc, nvstore, req, in nvme_opc_write_read()
2577 if (blockif_delete(sc->nvstore.ctx, &req->io_req)) { in pci_nvme_dealloc_sm()
2594 struct pci_nvme_blockstore *nvstore, in nvme_opc_dataset_mgmt() argument
2622 if (pci_nvme_out_of_range(nvstore, in nvme_opc_dataset_mgmt()
2633 int sectsz_bits = sc->nvstore.sectsz_bits; in nvme_opc_dataset_mgmt()
2639 if (!nvstore->deallocate) { in nvme_opc_dataset_mgmt()
2680 if ((nvstore->size - offset) < bytes) { in nvme_opc_dataset_mgmt()
2699 err = blockif_delete(nvstore->ctx, &req->io_req); in nvme_opc_dataset_mgmt()
2762 pending = nvme_opc_flush(sc, cmd, &sc->nvstore, in pci_nvme_handle_io_cmd()
2767 pending = nvme_opc_write_read(sc, cmd, &sc->nvstore, in pci_nvme_handle_io_cmd()
2777 pending = nvme_opc_dataset_mgmt(sc, cmd, &sc->nvstore, in pci_nvme_handle_io_cmd()
3216 sc->nvstore.eui64 = htobe64(strtoull(value, NULL, 0)); in pci_nvme_parse_config()
3239 sc->nvstore.type = NVME_STOR_RAM; in pci_nvme_parse_config()
3240 sc->nvstore.size = sz * 1024 * 1024; in pci_nvme_parse_config()
3241 sc->nvstore.ctx = calloc(1, sc->nvstore.size); in pci_nvme_parse_config()
3242 sc->nvstore.sectsz = 4096; in pci_nvme_parse_config()
3243 sc->nvstore.sectsz_bits = 12; in pci_nvme_parse_config()
3244 if (sc->nvstore.ctx == NULL) { in pci_nvme_parse_config()
3251 sc->nvstore.ctx = blockif_open(nvl, bident); in pci_nvme_parse_config()
3252 if (sc->nvstore.ctx == NULL) { in pci_nvme_parse_config()
3257 sc->nvstore.type = NVME_STOR_BLOCKIF; in pci_nvme_parse_config()
3258 sc->nvstore.size = blockif_size(sc->nvstore.ctx); in pci_nvme_parse_config()
3262 sc->nvstore.sectsz = sectsz; in pci_nvme_parse_config()
3263 else if (sc->nvstore.type != NVME_STOR_RAM) in pci_nvme_parse_config()
3264 sc->nvstore.sectsz = blockif_sectsz(sc->nvstore.ctx); in pci_nvme_parse_config()
3265 for (sc->nvstore.sectsz_bits = 9; in pci_nvme_parse_config()
3266 (1U << sc->nvstore.sectsz_bits) < sc->nvstore.sectsz; in pci_nvme_parse_config()
3267 sc->nvstore.sectsz_bits++); in pci_nvme_parse_config()
3280 struct pci_nvme_blockstore *nvstore; in pci_nvme_resized() local
3284 nvstore = &sc->nvstore; in pci_nvme_resized()
3287 nvstore->size = new_size; in pci_nvme_resized()
3288 pci_nvme_init_nsdata_size(nvstore, nd); in pci_nvme_resized()
3363 blockif_register_resize_callback(sc->nvstore.ctx, pci_nvme_resized, sc); in pci_nvme_init()
3370 pci_nvme_init_nsdata(sc, &sc->nsdata, 1, &sc->nvstore); in pci_nvme_init()