Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic nvme(4): Mask non relevant bits when pritting ver...
details: https://anonhg.NetBSD.org/src/rev/08f20cf5a170
branches: trunk
changeset: 824240:08f20cf5a170
user: nonaka <nonaka%NetBSD.org@localhost>
date: Mon May 29 02:20:34 2017 +0000
description:
nvme(4): Mask non relevant bits when pritting version number.
from OpenBSD nvme.c r1.52.
diffstat:
sys/dev/ic/nvme.c | 38 ++++++++------------------------------
sys/dev/ic/nvmereg.h | 9 +++------
2 files changed, 11 insertions(+), 36 deletions(-)
diffs (96 lines):
diff -r cf92bbb9f290 -r 08f20cf5a170 sys/dev/ic/nvme.c
--- a/sys/dev/ic/nvme.c Mon May 29 01:51:55 2017 +0000
+++ b/sys/dev/ic/nvme.c Mon May 29 02:20:34 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nvme.c,v 1.26 2017/04/05 20:15:49 jdolecek Exp $ */
+/* $NetBSD: nvme.c,v 1.27 2017/05/29 02:20:34 nonaka 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.26 2017/04/05 20:15:49 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.27 2017/05/29 02:20:34 nonaka Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -50,7 +50,6 @@
static int nvme_disable(struct nvme_softc *);
static int nvme_shutdown(struct nvme_softc *);
-static void nvme_version(struct nvme_softc *, uint32_t);
#ifdef NVME_DEBUG
static void nvme_dumpregs(struct nvme_softc *);
#endif
@@ -162,32 +161,6 @@
#define nvme_barrier(_s, _r, _l, _f) \
bus_space_barrier((_s)->sc_iot, (_s)->sc_ioh, (_r), (_l), (_f))
-static void
-nvme_version(struct nvme_softc *sc, uint32_t ver)
-{
- const char *v = NULL;
-
- switch (ver) {
- case NVME_VS_1_0:
- v = "1.0";
- break;
- case NVME_VS_1_1:
- v = "1.1";
- break;
- case NVME_VS_1_2:
- v = "1.2";
- break;
- case NVME_VS_1_2_1:
- v = "1.2.1";
- break;
- default:
- aprint_error_dev(sc->sc_dev, "unknown version 0x%08x\n", ver);
- return;
- }
-
- aprint_normal_dev(sc->sc_dev, "NVMe %s\n", v);
-}
-
#ifdef NVME_DEBUG
static __used void
nvme_dumpregs(struct nvme_softc *sc)
@@ -353,7 +326,12 @@
return 1;
}
- nvme_version(sc, reg);
+ if (NVME_VS_TER(reg) == 0)
+ aprint_normal_dev(sc->sc_dev, "NVMe %d.%d\n", NVME_VS_MJR(reg),
+ NVME_VS_MNR(reg));
+ else
+ aprint_normal_dev(sc->sc_dev, "NVMe %d.%d.%d\n", NVME_VS_MJR(reg),
+ NVME_VS_MNR(reg), NVME_VS_TER(reg));
cap = nvme_read8(sc, NVME_CAP);
dstrd = NVME_CAP_DSTRD(cap);
diff -r cf92bbb9f290 -r 08f20cf5a170 sys/dev/ic/nvmereg.h
--- a/sys/dev/ic/nvmereg.h Mon May 29 01:51:55 2017 +0000
+++ b/sys/dev/ic/nvmereg.h Mon May 29 02:20:34 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nvmereg.h,v 1.8 2017/02/28 20:53:50 jdolecek Exp $ */
+/* $NetBSD: nvmereg.h,v 1.9 2017/05/29 02:20:34 nonaka Exp $ */
/* $OpenBSD: nvmereg.h,v 1.10 2016/04/14 11:18:32 dlg Exp $ */
/*
@@ -37,11 +37,8 @@
#define NVME_CAP_HI 0x0004
#define NVME_VS 0x0008 /* Version */
#define NVME_VS_MJR(_r) (((_r) >> 16) & 0xffff)
-#define NVME_VS_MNR(_r) ((_r) & 0xffff)
-#define NVME_VS_1_0 0x00010000
-#define NVME_VS_1_1 0x00010100
-#define NVME_VS_1_2 0x00010200
-#define NVME_VS_1_2_1 0x00010201
+#define NVME_VS_MNR(_r) (((_r) >> 8) & 0xff)
+#define NVME_VS_TER(_r) ((_r) & 0xff)
#define NVME_INTMS 0x000c /* Interrupt Mask Set */
#define NVME_INTMC 0x0010 /* Interrupt Mask Clear */
#define NVME_CC 0x0014 /* Controller Configuration */
Home |
Main Index |
Thread Index |
Old Index