diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2016-04-13 12:14:13 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2016-04-13 12:14:13 +0000 |
commit | cf50217c0a6b442cb501dbd648f40978d9079133 (patch) | |
tree | c8f15ec333b138647c9dcaba36fa3acdd4f563bf /sys/dev | |
parent | 688a5c00b0352831e6801fca5d4f1d28a9f6d0c1 (diff) |
stash the controller identify and number of namespaces in the softc.
the nn is used to size the scsi bus, and the controller identify is used
to build responses for various scsi commands.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ic/nvme.c | 10 | ||||
-rw-r--r-- | sys/dev/ic/nvmevar.h | 7 |
2 files changed, 13 insertions, 4 deletions
diff --git a/sys/dev/ic/nvme.c b/sys/dev/ic/nvme.c index d54c8254fa8..0c6a8d373aa 100644 --- a/sys/dev/ic/nvme.c +++ b/sys/dev/ic/nvme.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nvme.c,v 1.22 2016/04/13 12:04:20 dlg Exp $ */ +/* $OpenBSD: nvme.c,v 1.23 2016/04/13 12:14:12 dlg Exp $ */ /* * Copyright (c) 2014 David Gwynne <dlg@openbsd.org> @@ -514,8 +514,6 @@ nvme_identify(struct nvme_softc *sc, u_int mps) if (mem == NULL) return (1); - identify = NVME_DMA_KVA(mem); - ccb->ccb_done = nvme_empty_done; ccb->ccb_cookie = mem; @@ -528,6 +526,8 @@ nvme_identify(struct nvme_softc *sc, u_int mps) if (rv != 0) goto done; + identify = NVME_DMA_KVA(mem); + scsi_strvis(sn, identify->sn, sizeof(identify->sn)); scsi_strvis(mn, identify->mn, sizeof(identify->mn)); scsi_strvis(fr, identify->fr, sizeof(identify->fr)); @@ -540,6 +540,10 @@ nvme_identify(struct nvme_softc *sc, u_int mps) sc->sc_mdts = mdts; } + sc->sc_nn = lemtoh32(&identify->nn); + + memcpy(&sc->sc_identify, identify, sizeof(sc->sc_identify)); + done: nvme_dmamem_free(sc, mem); diff --git a/sys/dev/ic/nvmevar.h b/sys/dev/ic/nvmevar.h index 2d024d6a2e1..42a829eab54 100644 --- a/sys/dev/ic/nvmevar.h +++ b/sys/dev/ic/nvmevar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: nvmevar.h,v 1.3 2016/04/13 12:07:03 dlg Exp $ */ +/* $OpenBSD: nvmevar.h,v 1.4 2016/04/13 12:14:12 dlg Exp $ */ /* * Copyright (c) 2014 David Gwynne <dlg@openbsd.org> @@ -72,6 +72,11 @@ struct nvme_softc { size_t sc_mdts; u_int sc_max_sgl; + struct nvm_identify_controller + sc_identify; + + u_int sc_nn; + struct nvme_queue *sc_admin_q; struct nvme_queue *sc_q; |