From cf50217c0a6b442cb501dbd648f40978d9079133 Mon Sep 17 00:00:00 2001 From: David Gwynne Date: Wed, 13 Apr 2016 12:14:13 +0000 Subject: 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. --- sys/dev/ic/nvme.c | 10 +++++++--- sys/dev/ic/nvmevar.h | 7 ++++++- 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'sys/dev') 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 @@ -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 @@ -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; -- cgit v1.2.3