summaryrefslogtreecommitdiff
path: root/sys/dev/ic
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2016-04-13 12:28:58 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2016-04-13 12:28:58 +0000
commit32c4290e19217c25d97cf713afe652ac204b903a (patch)
tree67e7c5c0910efec7f6a0b20031781a86d478f985 /sys/dev/ic
parentc72e8191bf9c5d8d0aaf4d22d6ee110244e64b62 (diff)
wire up the scsi midlayer. scsibus should appear after this.
Diffstat (limited to 'sys/dev/ic')
-rw-r--r--sys/dev/ic/nvme.c17
-rw-r--r--sys/dev/ic/nvmevar.h5
2 files changed, 20 insertions, 2 deletions
diff --git a/sys/dev/ic/nvme.c b/sys/dev/ic/nvme.c
index b5a6e96e739..c95afd8dc79 100644
--- a/sys/dev/ic/nvme.c
+++ b/sys/dev/ic/nvme.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nvme.c,v 1.24 2016/04/13 12:21:15 dlg Exp $ */
+/* $OpenBSD: nvme.c,v 1.25 2016/04/13 12:28:57 dlg Exp $ */
/*
* Copyright (c) 2014 David Gwynne <dlg@openbsd.org>
@@ -270,6 +270,7 @@ nvme_disable(struct nvme_softc *sc)
int
nvme_attach(struct nvme_softc *sc)
{
+ struct scsibus_attach_args saa;
u_int64_t cap;
u_int32_t reg;
u_int dstrd;
@@ -329,6 +330,20 @@ nvme_attach(struct nvme_softc *sc)
sc->sc_namespaces = mallocarray(sc->sc_nn, sizeof(*sc->sc_namespaces),
M_DEVBUF, M_WAITOK|M_ZERO);
+ sc->sc_link.adapter = &nvme_switch;
+ sc->sc_link.adapter_softc = sc;
+ sc->sc_link.adapter_buswidth = sc->sc_nn;
+ sc->sc_link.luns = 1;
+ sc->sc_link.adapter_target = sc->sc_nn;
+ sc->sc_link.openings = 1; /* XXX */
+ sc->sc_link.pool = &sc->sc_iopool;
+
+ memset(&saa, 0, sizeof(saa));
+ saa.saa_sc_link = &sc->sc_link;
+
+ sc->sc_scsibus = (struct scsibus_softc *)config_found(&sc->sc_dev,
+ &saa, scsiprint);
+
return (0);
disable:
diff --git a/sys/dev/ic/nvmevar.h b/sys/dev/ic/nvmevar.h
index 974687e37f5..7fef4c06b7d 100644
--- a/sys/dev/ic/nvmevar.h
+++ b/sys/dev/ic/nvmevar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: nvmevar.h,v 1.5 2016/04/13 12:21:15 dlg Exp $ */
+/* $OpenBSD: nvmevar.h,v 1.6 2016/04/13 12:28:57 dlg Exp $ */
/*
* Copyright (c) 2014 David Gwynne <dlg@openbsd.org>
@@ -89,6 +89,9 @@ struct nvme_softc {
struct nvme_ccb *sc_ccbs;
struct nvme_ccb_list sc_ccb_list;
struct scsi_iopool sc_iopool;
+
+ struct scsi_link sc_link;
+ struct scsibus_softc *sc_scsibus;
};
int nvme_attach(struct nvme_softc *);