Lines Matching refs:nvstore

335 	struct pci_nvme_blockstore nvstore;  member
589 if (sc->nvstore.deallocate) in pci_nvme_init_ctrldata()
619 pci_nvme_init_nsdata_size(struct pci_nvme_blockstore *nvstore, in pci_nvme_init_nsdata_size() argument
624 nd->nsze = nvstore->size / nvstore->sectsz; in pci_nvme_init_nsdata_size()
632 struct pci_nvme_blockstore *nvstore) in pci_nvme_init_nsdata() argument
635 pci_nvme_init_nsdata_size(nvstore, nd); in pci_nvme_init_nsdata()
637 if (nvstore->type == NVME_STOR_BLOCKIF) in pci_nvme_init_nsdata()
638 nvstore->deallocate = blockif_candelete(nvstore->ctx); in pci_nvme_init_nsdata()
644 if (nvstore->eui64 == 0) { in pci_nvme_init_nsdata()
646 uint64_t eui64 = nvstore->eui64; in pci_nvme_init_nsdata()
656 nvstore->eui64 = (eui64 << 16) | (nsid & 0xffff); in pci_nvme_init_nsdata()
658 be64enc(nd->eui64, nvstore->eui64); in pci_nvme_init_nsdata()
661 nd->lbaf[0] = NVMEF(NVME_NS_DATA_LBAF_LBADS, nvstore->sectsz_bits); in pci_nvme_init_nsdata()
1957 if (sc->nvstore.type == NVME_STOR_RAM) { in nvme_opc_format_nvm()
1958 if (sc->nvstore.ctx) in nvme_opc_format_nvm()
1959 free(sc->nvstore.ctx); in nvme_opc_format_nvm()
1960 sc->nvstore.ctx = calloc(1, sc->nvstore.size); in nvme_opc_format_nvm()
1980 req->io_req.br_resid = sc->nvstore.size; in nvme_opc_format_nvm()
1983 err = blockif_delete(sc->nvstore.ctx, &req->io_req); in nvme_opc_format_nvm()
2205 pci_nvme_out_of_range(struct pci_nvme_blockstore *nvstore, uint64_t slba, in pci_nvme_out_of_range() argument
2211 if (slba >> (64 - nvstore->sectsz_bits)) in pci_nvme_out_of_range()
2214 offset = slba << nvstore->sectsz_bits; in pci_nvme_out_of_range()
2215 bytes = nblocks << nvstore->sectsz_bits; in pci_nvme_out_of_range()
2218 if ((nvstore->size <= offset) || ((nvstore->size - offset) < bytes)) in pci_nvme_out_of_range()
2390 struct pci_nvme_blockstore *nvstore, in nvme_opc_flush() argument
2396 if (nvstore->type == NVME_STOR_RAM) { in nvme_opc_flush()
2403 err = blockif_flush(nvstore->ctx, &req->io_req); in nvme_opc_flush()
2421 struct pci_nvme_blockstore *nvstore, in nvme_write_read_ram() argument
2426 uint8_t *buf = nvstore->ctx; in nvme_write_read_ram()
2448 struct pci_nvme_blockstore *nvstore, in nvme_write_read_blockif() argument
2511 err = blockif_write(nvstore->ctx, &req->io_req); in nvme_write_read_blockif()
2513 err = blockif_read(nvstore->ctx, &req->io_req); in nvme_write_read_blockif()
2524 struct pci_nvme_blockstore *nvstore, in nvme_opc_write_read() argument
2535 bytes = nblocks << nvstore->sectsz_bits; in nvme_opc_write_read()
2542 if (pci_nvme_out_of_range(nvstore, lba, nblocks)) { in nvme_opc_write_read()
2549 offset = lba << nvstore->sectsz_bits; in nvme_opc_write_read()
2558 if (nvstore->type == NVME_STOR_RAM) { in nvme_opc_write_read()
2559 *status = nvme_write_read_ram(sc, nvstore, cmd->prp1, in nvme_opc_write_read()
2562 *status = nvme_write_read_blockif(sc, nvstore, req, in nvme_opc_write_read()
2597 if (blockif_delete(sc->nvstore.ctx, &req->io_req)) { in pci_nvme_dealloc_sm()
2614 struct pci_nvme_blockstore *nvstore, in nvme_opc_dataset_mgmt() argument
2648 if (pci_nvme_out_of_range(nvstore, in nvme_opc_dataset_mgmt()
2659 int sectsz_bits = sc->nvstore.sectsz_bits; in nvme_opc_dataset_mgmt()
2665 if (!nvstore->deallocate) { in nvme_opc_dataset_mgmt()
2706 if ((nvstore->size - offset) < bytes) { in nvme_opc_dataset_mgmt()
2725 err = blockif_delete(nvstore->ctx, &req->io_req); in nvme_opc_dataset_mgmt()
2788 pending = nvme_opc_flush(sc, cmd, &sc->nvstore, in pci_nvme_handle_io_cmd()
2793 pending = nvme_opc_write_read(sc, cmd, &sc->nvstore, in pci_nvme_handle_io_cmd()
2803 pending = nvme_opc_dataset_mgmt(sc, cmd, &sc->nvstore, in pci_nvme_handle_io_cmd()
3247 sc->nvstore.eui64 = htobe64(strtoull(value, NULL, 0)); in pci_nvme_parse_config()
3270 sc->nvstore.type = NVME_STOR_RAM; in pci_nvme_parse_config()
3271 sc->nvstore.size = sz * 1024 * 1024; in pci_nvme_parse_config()
3272 sc->nvstore.ctx = calloc(1, sc->nvstore.size); in pci_nvme_parse_config()
3273 sc->nvstore.sectsz = 4096; in pci_nvme_parse_config()
3274 sc->nvstore.sectsz_bits = 12; in pci_nvme_parse_config()
3275 if (sc->nvstore.ctx == NULL) { in pci_nvme_parse_config()
3282 sc->nvstore.ctx = blockif_open(nvl, bident); in pci_nvme_parse_config()
3283 if (sc->nvstore.ctx == NULL) { in pci_nvme_parse_config()
3288 sc->nvstore.type = NVME_STOR_BLOCKIF; in pci_nvme_parse_config()
3289 sc->nvstore.size = blockif_size(sc->nvstore.ctx); in pci_nvme_parse_config()
3293 sc->nvstore.sectsz = sectsz; in pci_nvme_parse_config()
3294 else if (sc->nvstore.type != NVME_STOR_RAM) in pci_nvme_parse_config()
3295 sc->nvstore.sectsz = blockif_sectsz(sc->nvstore.ctx); in pci_nvme_parse_config()
3296 for (sc->nvstore.sectsz_bits = 9; in pci_nvme_parse_config()
3297 (1U << sc->nvstore.sectsz_bits) < sc->nvstore.sectsz; in pci_nvme_parse_config()
3298 sc->nvstore.sectsz_bits++); in pci_nvme_parse_config()
3311 struct pci_nvme_blockstore *nvstore; in pci_nvme_resized() local
3315 nvstore = &sc->nvstore; in pci_nvme_resized()
3318 nvstore->size = new_size; in pci_nvme_resized()
3319 pci_nvme_init_nsdata_size(nvstore, nd); in pci_nvme_resized()
3394 blockif_register_resize_callback(sc->nvstore.ctx, pci_nvme_resized, sc); in pci_nvme_init()
3401 pci_nvme_init_nsdata(sc, &sc->nsdata, 1, &sc->nvstore); in pci_nvme_init()