summaryrefslogtreecommitdiff
path: root/sys/dev/ic/nvme.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/ic/nvme.c')
-rw-r--r--sys/dev/ic/nvme.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/sys/dev/ic/nvme.c b/sys/dev/ic/nvme.c
index ac6fb74..822b085 100644
--- a/sys/dev/ic/nvme.c
+++ b/sys/dev/ic/nvme.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora Team.
+ * Copyright (c) 2023-2025 Ian Marco Moffett and the Osmora Team.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -219,7 +219,7 @@ nvme_stop_ctrl(struct nvme_bar *bar)
mmio_write32(&bar->config, config);
if (nvme_poll_reg(bar, &bar->status, STATUS_RDY, false) < 0) {
- pr_error("Controller reset timeout\n");
+ pr_error("controller reset timeout\n");
return -ETIME;
}
@@ -246,7 +246,7 @@ nvme_start_ctrl(struct nvme_bar *bar)
mmio_write32(&bar->config, config);
if (nvme_poll_reg(bar, &bar->status, STATUS_RDY, true) < 0) {
- pr_error("Controller startup timeout\n");
+ pr_error("controller startup timeout\n");
return -ETIME;
}
@@ -292,7 +292,7 @@ nvme_poll_submit_cmd(struct nvme_queue *q, struct nvme_cmd cmd)
/* Check for timeout */
if (spins > 5) {
- pr_error("Hang while polling phase bit, giving up\n");
+ pr_error("hang while polling phase bit, giving up\n");
return -ETIME;
}
@@ -350,9 +350,9 @@ nvme_log_ctrl_id(struct nvme_id *id)
sn[i] = id->sn[i];
}
- pr_trace("Model number: %s\n", mn);
- pr_trace("Serial number: %s\n", sn);
- pr_trace("Firmware revision: %s\n", fr);
+ pr_trace("model number: %s\n", mn);
+ pr_trace("serial number: %s\n", sn);
+ pr_trace("firmware revision: %s\n", fr);
}
/*
@@ -425,7 +425,7 @@ nvme_dev_rw(dev_t dev, struct sio_txn *sio, bool write)
*/
ns = nvme_get_ns(dev);
if (__unlikely(ns == NULL))
- return -EIO;
+ return -ENODEV;
/* Calculate the block count and offset */
block_count = ALIGN_UP(sio->len, ns->lba_bsize);
@@ -601,7 +601,7 @@ nvme_init_ctrl(struct nvme_bar *bar)
}
if (nvme_init_ns(&ctrl, nsids[i]) != 0) {
- pr_error("Failed to initialize NSID %d\n", nsids[i]);
+ pr_error("failed to initialize NSID %d\n", nsids[i]);
}
}
@@ -625,21 +625,25 @@ nvme_init(void)
return -ENODEV;
}
+ pr_trace("NVMe storage ctrl <hba? at pci%d:%x.%x.%d>\n",
+ nvme_dev->bus, nvme_dev->device_id, nvme_dev->func,
+ nvme_dev->slot);
+
/* Try to request a general purpose timer */
if (req_timer(TIMER_GP, &tmr) != TMRR_SUCCESS) {
- pr_error("Failed to fetch general purpose timer\n");
+ pr_error("failed to fetch general purpose timer\n");
return -ENODEV;
}
/* Ensure it has get_time_usec() */
if (tmr.get_time_usec == NULL) {
- pr_error("General purpose timer has no get_time_usec()\n");
+ pr_error("general purpose timer has no get_time_usec()\n");
return -ENODEV;
}
/* We also need msleep() */
if (tmr.msleep == NULL) {
- pr_error("General purpose timer has no msleep()\n");
+ pr_error("general purpose timer has no msleep()\n");
return -ENODEV;
}
@@ -658,4 +662,4 @@ static struct bdevsw nvme_bdevsw = {
.write = nowrite
};
-DRIVER_EXPORT(nvme_init);
+DRIVER_DEFER(nvme_init);