aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2026-02-17 21:08:46 +0000
committerWarner Losh <imp@FreeBSD.org>2026-02-18 16:40:06 +0000
commit8aa560491cfad7953c7c089f4847951e867ef47c (patch)
tree6d5b7db04f6c8f1f86e5e935743df8f6ad681755
parentc8d63d63679fc0d8a67b33499a2a2edd444c8e2e (diff)
nvme: Fix sim unit number to match nvme device
The CAM sim unit numbner should match the nvme device number. We need this to match unit numbers in some wiring scenarios. For example: hint.nvme.0.at="UEFI:PciRoot(0x3)/Pci(0x1,0x1)/Pci(0x0,0x0)" hint.nvme.1.at="UEFI:PciRoot(0x3)/Pci(0x1,0x2)/Pci(0x0,0x0)" hint.nvme.2.at="UEFI:PciRoot(0x3)/Pci(0x1,0x3)/Pci(0x0,0x0)" hint.nvme.3.at="UEFI:PciRoot(0x3)/Pci(0x1,0x4)/Pci(0x0,0x0)" hint.scbus.33.at="nvme0" hint.nda.0.at="scbus33" hint.scbus.34.at="nvme1" hint.nda.1.at="scbus34" hint.scbus.35.at="nvme2" hint.nda.2.at="scbus35" hint.scbus.36.at="nvme3" hint.nda.3.at="scbus36" If the devices that are nvme0 and nvme3 are the only ones populated, you still want them associated with nda0 and nda3. The nvme_sim device changes meant we were passing the wrong device's unit number to cam_sim_alloc. This fixes the problem. Sponsored by: Netflix
-rw-r--r--sys/dev/nvme/nvme_sim.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/dev/nvme/nvme_sim.c b/sys/dev/nvme/nvme_sim.c
index a59823847c39..f7db4a9ff4fb 100644
--- a/sys/dev/nvme/nvme_sim.c
+++ b/sys/dev/nvme/nvme_sim.c
@@ -343,7 +343,7 @@ nvme_sim_attach(device_t dev)
sc->s_ctrlr = ctrlr;
sc->s_sim = cam_sim_alloc(nvme_sim_action, nvme_sim_poll,
- "nvme", sc, device_get_unit(dev),
+ "nvme", sc, device_get_unit(ctrlr->dev),
NULL, max_trans, max_trans, devq);
if (sc->s_sim == NULL) {
device_printf(dev, "Failed to allocate a sim\n");