Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Expose device type. You can query it with e.g. dr...



details:   https://anonhg.NetBSD.org/src/rev/35e8233650dc
branches:  trunk
changeset: 450759:35e8233650dc
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Wed Apr 24 23:39:23 2019 +0000

description:
Expose device type. You can query it with e.g. drvctl -p ld0 disk-info/type.

diffstat:

 sys/dev/ic/nvme.c    |  7 +++++--
 sys/dev/ic/nvmevar.h |  5 ++++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diffs (61 lines):

diff -r f66c30ccfa44 -r 35e8233650dc sys/dev/ic/nvme.c
--- a/sys/dev/ic/nvme.c Wed Apr 24 21:41:15 2019 +0000
+++ b/sys/dev/ic/nvme.c Wed Apr 24 23:39:23 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nvme.c,v 1.41 2018/12/01 15:07:58 jdolecek Exp $       */
+/*     $NetBSD: nvme.c,v 1.42 2019/04/24 23:39:23 mlelstv Exp $        */
 /*     $OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.41 2018/12/01 15:07:58 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.42 2019/04/24 23:39:23 mlelstv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -479,6 +479,7 @@
                naa.naa_nsid = i + 1;
                naa.naa_qentries = (ioq_entries - 1) * sc->sc_nq;
                naa.naa_maxphys = sc->sc_mdts;
+               naa.naa_typename = sc->sc_modelname;
                sc->sc_namespaces[i].dev = config_found(sc->sc_dev, &naa,
                    nvme_print);
        }
@@ -1449,6 +1450,8 @@
        aprint_normal_dev(sc->sc_dev, "%s, firmware %s, serial %s\n", mn, fr,
            sn);
 
+       strlcpy(sc->sc_modelname, mn, sizeof(sc->sc_modelname));
+
        if (sc->sc_identify.mdts > 0) {
                mdts = (1 << sc->sc_identify.mdts) * (1 << mps);
                if (mdts < sc->sc_mdts)
diff -r f66c30ccfa44 -r 35e8233650dc sys/dev/ic/nvmevar.h
--- a/sys/dev/ic/nvmevar.h      Wed Apr 24 21:41:15 2019 +0000
+++ b/sys/dev/ic/nvmevar.h      Wed Apr 24 23:39:23 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nvmevar.h,v 1.18 2018/12/01 15:07:58 jdolecek Exp $    */
+/*     $NetBSD: nvmevar.h,v 1.19 2019/04/24 23:39:23 mlelstv Exp $     */
 /*     $OpenBSD: nvmevar.h,v 1.8 2016/04/14 11:18:32 dlg Exp $ */
 
 /*
@@ -139,6 +139,8 @@
 
        uint32_t                sc_quirks;
 #define        NVME_QUIRK_DELAY_B4_CHK_RDY     __BIT(0)
+
+       char                    sc_modelname[81];
 };
 
 #define        lemtoh16(p)     le16toh(*((uint16_t *)(p)))
@@ -152,6 +154,7 @@
        uint16_t        naa_nsid;
        uint32_t        naa_qentries;   /* total number of queue slots */
        uint32_t        naa_maxphys;    /* maximum device transfer size */
+       const char      *naa_typename;  /* identifier */
 };
 
 int    nvme_attach(struct nvme_softc *);



Home | Main Index | Thread Index | Old Index