summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2016-01-15 06:38:34 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2016-01-15 06:38:34 +0000
commit94e55666202c8cb217d25c98fad1f7b7b3a2cfef (patch)
treebb7ce32fdcabed80ae53671946f3641235bbeb7a /sys/dev
parentc76110d1b50a61e2d8d0c1e22f68a898b35cb48e (diff)
when enabling the controller, wait till CSTS.RDY lights up.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/nvme.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/dev/ic/nvme.c b/sys/dev/ic/nvme.c
index 908811c5895..c46c45287ca 100644
--- a/sys/dev/ic/nvme.c
+++ b/sys/dev/ic/nvme.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nvme.c,v 1.13 2016/01/15 06:34:19 dlg Exp $ */
+/* $OpenBSD: nvme.c,v 1.14 2016/01/15 06:38:33 dlg Exp $ */
/*
* Copyright (c) 2014 David Gwynne <dlg@openbsd.org>
@@ -206,15 +206,15 @@ nvme_enable(struct nvme_softc *sc, u_int mps)
if (ISSET(cc, NVME_CC_EN))
return (nvme_ready(sc, NVME_CSTS_RDY));
+ nvme_write4(sc, NVME_AQA, NVME_AQA_ACQS(sc->sc_admin_q->q_entries) |
+ NVME_AQA_ASQS(sc->sc_admin_q->q_entries));
+ nvme_barrier(sc, 0, sc->sc_ios, BUS_SPACE_BARRIER_WRITE);
+
nvme_write8(sc, NVME_ASQ, NVME_DMA_DVA(sc->sc_admin_q->q_sq_dmamem));
nvme_barrier(sc, 0, sc->sc_ios, BUS_SPACE_BARRIER_WRITE);
nvme_write8(sc, NVME_ACQ, NVME_DMA_DVA(sc->sc_admin_q->q_cq_dmamem));
nvme_barrier(sc, 0, sc->sc_ios, BUS_SPACE_BARRIER_WRITE);
- nvme_write4(sc, NVME_AQA, NVME_AQA_ACQS(sc->sc_admin_q->q_entries) |
- NVME_AQA_ASQS(sc->sc_admin_q->q_entries));
- nvme_barrier(sc, 0, sc->sc_ios, BUS_SPACE_BARRIER_WRITE);
-
CLR(cc, NVME_CC_IOCQES_MASK | NVME_CC_IOSQES_MASK | NVME_CC_SHN_MASK |
NVME_CC_AMS_MASK | NVME_CC_MPS_MASK | NVME_CC_CSS_MASK);
SET(cc, NVME_CC_IOSQES(ffs(64) - 1) | NVME_CC_IOCQES(ffs(16) - 1));
@@ -228,7 +228,7 @@ nvme_enable(struct nvme_softc *sc, u_int mps)
nvme_barrier(sc, 0, sc->sc_ios,
BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
- return (0);
+ return (nvme_ready(sc, NVME_CSTS_RDY));
}
int