Lines Matching refs:nvme_ctrlr

28 	struct nvme_controller *nvme_ctrlr = dev->data;  in nvme_controller_wait_for_ready()  local
31 k_ms_to_ticks_ceil32(nvme_ctrlr->ready_timeout_in_ms); in nvme_controller_wait_for_ready()
97 struct nvme_controller *nvme_ctrlr = dev->data; in nvme_controller_enable() local
132 cc |= nvme_ctrlr->mps << NVME_CC_REG_MPS_SHIFT; in nvme_controller_enable()
141 struct nvme_controller *nvme_ctrlr = dev->data; in nvme_controller_setup_admin_queues() local
145 nvme_cmd_qpair_reset(nvme_ctrlr->adminq); in nvme_controller_setup_admin_queues()
148 if (nvme_cmd_qpair_setup(nvme_ctrlr->adminq, nvme_ctrlr, 0) != 0) { in nvme_controller_setup_admin_queues()
153 nvme_mmio_write_8(regs, asq, nvme_ctrlr->adminq->cmd_bus_addr); in nvme_controller_setup_admin_queues()
154 nvme_mmio_write_8(regs, acq, nvme_ctrlr->adminq->cpl_bus_addr); in nvme_controller_setup_admin_queues()
169 struct nvme_controller *nvme_ctrlr = dev->data; in nvme_controller_setup_io_queues() local
177 ret = nvme_ctrlr_cmd_set_num_queues(nvme_ctrlr, in nvme_controller_setup_io_queues()
178 nvme_ctrlr->num_io_queues, in nvme_controller_setup_io_queues()
187 nvme_ctrlr->num_io_queues); in nvme_controller_setup_io_queues()
205 nvme_ctrlr->num_io_queues = MIN(nvme_ctrlr->num_io_queues, in nvme_controller_setup_io_queues()
207 nvme_ctrlr->num_io_queues = MIN(nvme_ctrlr->num_io_queues, in nvme_controller_setup_io_queues()
210 for (idx = 0; idx < nvme_ctrlr->num_io_queues; idx++) { in nvme_controller_setup_io_queues()
211 io_qpair = &nvme_ctrlr->ioq[idx]; in nvme_controller_setup_io_queues()
212 if (nvme_cmd_qpair_setup(io_qpair, nvme_ctrlr, idx+1) != 0) { in nvme_controller_setup_io_queues()
221 ret = nvme_ctrlr_cmd_create_io_cq(nvme_ctrlr, io_qpair, in nvme_controller_setup_io_queues()
237 ret = nvme_ctrlr_cmd_create_io_sq(nvme_ctrlr, io_qpair, in nvme_controller_setup_io_queues()
257 struct nvme_controller *nvme_ctrlr = dev->data; in nvme_controller_gather_info() local
262 nvme_ctrlr->cap_lo = cap_lo = nvme_mmio_read_4(regs, cap_lo); in nvme_controller_gather_info()
272 nvme_ctrlr->cap_hi = cap_hi = nvme_mmio_read_4(regs, cap_hi); in nvme_controller_gather_info()
301 nvme_ctrlr->dstrd = NVME_CAP_HI_DSTRD(cap_hi) + 2; in nvme_controller_gather_info()
303 nvme_ctrlr->mps = NVME_CAP_HI_MPSMIN(cap_hi); in nvme_controller_gather_info()
304 nvme_ctrlr->page_size = 1 << (NVME_MPS_SHIFT + nvme_ctrlr->mps); in nvme_controller_gather_info()
307 nvme_ctrlr->mps, nvme_ctrlr->page_size); in nvme_controller_gather_info()
311 nvme_ctrlr->ready_timeout_in_ms = to * 500; in nvme_controller_gather_info()
317 nvme_ctrlr->max_xfer_size = nvme_ctrlr->page_size / in nvme_controller_gather_info()
318 8 * nvme_ctrlr->page_size; in nvme_controller_gather_info()
320 LOG_DBG("Max transfer size: %u bytes", nvme_ctrlr->max_xfer_size); in nvme_controller_gather_info()
326 struct nvme_controller *nvme_ctrlr = dev->data; in nvme_controller_pcie_configure() local
354 nvme_ctrlr->vectors, in nvme_controller_pcie_configure()
364 nvme_ctrlr->vectors, n_vectors, 0)) { in nvme_controller_pcie_configure()
372 static int nvme_controller_identify(struct nvme_controller *nvme_ctrlr) in nvme_controller_identify() argument
377 nvme_ctrlr_cmd_identify_controller(nvme_ctrlr, in nvme_controller_identify()
386 nvme_controller_data_swapbytes(&nvme_ctrlr->cdata); in nvme_controller_identify()
392 if (nvme_ctrlr->cdata.mdts > 0) { in nvme_controller_identify()
393 nvme_ctrlr->max_xfer_size = in nvme_controller_identify()
394 MIN(nvme_ctrlr->max_xfer_size, in nvme_controller_identify()
395 1 << (nvme_ctrlr->cdata.mdts + NVME_MPS_SHIFT + in nvme_controller_identify()
396 NVME_CAP_HI_MPSMIN(nvme_ctrlr->cap_hi))); in nvme_controller_identify()
402 static void nvme_controller_setup_namespaces(struct nvme_controller *nvme_ctrlr) in nvme_controller_setup_namespaces() argument
407 i < MIN(nvme_ctrlr->cdata.nn, CONFIG_NVME_MAX_NAMESPACES); i++) { in nvme_controller_setup_namespaces()
408 struct nvme_namespace *ns = &nvme_ctrlr->ns[i]; in nvme_controller_setup_namespaces()
410 if (nvme_namespace_construct(ns, i+1, nvme_ctrlr) != 0) { in nvme_controller_setup_namespaces()
420 struct nvme_controller *nvme_ctrlr = dev->data; in nvme_controller_init() local
423 k_mutex_init(&nvme_ctrlr->lock); in nvme_controller_init()
427 nvme_ctrlr->dev = dev; in nvme_controller_init()
458 ret = nvme_controller_identify(nvme_ctrlr); in nvme_controller_init()
463 nvme_controller_setup_namespaces(nvme_ctrlr); in nvme_controller_init()