summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2014-04-16 01:28:03 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2014-04-16 01:28:03 +0000
commit086561214bf6f46d6b4f6ab5558ca53078c3af2c (patch)
treead76cbb4f64e30a42a45253201effa1d087a4983 /sys/dev
parentc2d854e198fbd99d4ab02b51fc3b7d8655e08178 (diff)
set ourselves up to respect the max data transfer size.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/nvme.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/dev/ic/nvme.c b/sys/dev/ic/nvme.c
index 740b41ca62a..59f7fb9f881 100644
--- a/sys/dev/ic/nvme.c
+++ b/sys/dev/ic/nvme.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nvme.c,v 1.3 2014/04/16 00:26:59 dlg Exp $ */
+/* $OpenBSD: nvme.c,v 1.4 2014/04/16 01:28:02 dlg Exp $ */
/*
* Copyright (c) 2014 David Gwynne <dlg@openbsd.org>
@@ -46,7 +46,7 @@ int nvme_disable(struct nvme_softc *);
void nvme_version(struct nvme_softc *, u_int32_t);
void nvme_dumpregs(struct nvme_softc *);
-int nvme_identify(struct nvme_softc *);
+int nvme_identify(struct nvme_softc *, u_int);
void nvme_fill_identify(struct nvme_softc *,
struct nvme_ccb *, void *);
@@ -299,7 +299,7 @@ nvme_attach(struct nvme_softc *sc)
goto free_ccbs;
}
- if (nvme_identify(sc) != 0) {
+ if (nvme_identify(sc, NVME_CAP_MPSMIN(cap)) != 0) {
printf("%s: unable to identify controller\n", DEVNAME(sc));
goto disable;
}
@@ -445,12 +445,13 @@ nvme_q_complete(struct nvme_softc *sc, struct nvme_queue *q)
}
int
-nvme_identify(struct nvme_softc *sc)
+nvme_identify(struct nvme_softc *sc, u_int mps)
{
char sn[41], mn[81], fr[17];
struct nvm_identify_controller *identify;
struct nvme_dmamem *mem;
struct nvme_ccb *ccb;
+ u_int mdts;
int rv = 1;
ccb = nvme_ccb_get(sc);
@@ -481,6 +482,12 @@ nvme_identify(struct nvme_softc *sc)
printf("%s: %s, firmware %s, serial %s\n", DEVNAME(sc), mn, fr, sn);
+ if (identify->mdts > 0) {
+ mdts = (1 << identify->mdts) * (1 << mps);
+ if (mdts < sc->sc_mdts)
+ sc->sc_mdts = mdts;
+ }
+
done:
nvme_dmamem_free(sc, mem);