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

This commit is contained in:
mlelstv 2019-04-24 23:39:23 +00:00
parent c3c6e74f96
commit 9653889b03
2 changed files with 9 additions and 3 deletions

View File

@ -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 @@ nvme_rescan(device_t self, const char *attr, const int *flags)
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 @@ nvme_identify(struct nvme_softc *sc, u_int mps)
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)

View File

@ -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 @@ struct nvme_softc {
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 @@ struct nvme_attach_args {
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 *);