Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-8]: src Pull up following revision(s) (requested by ...
details: https://anonhg.NetBSD.org/src/rev/146dd6a6a324
branches: netbsd-8
changeset: 318370:146dd6a6a324
user: martin <martin%NetBSD.org@localhost>
date: Thu Apr 19 15:37:56 2018 +0000
description:
Pull up following revision(s) (requested by nonaka in ticket #781):
sbin/nvmectl/Makefile 1.4
sbin/nvmectl/bignum.c 1.2
sbin/nvmectl/devlist.c 1.3-1.5
sbin/nvmectl/firmware.c 1.3,1.4
sbin/nvmectl/identify.c 1.3-1.5
sbin/nvmectl/logpage.c 1.5-1.7
sbin/nvmectl/nvme.h 1.3
sbin/nvmectl/nvmectl.8 1.5
sbin/nvmectl/nvmectl.c 1.5-1.7
sbin/nvmectl/nvmectl.h 1.5-1.8
sbin/nvmectl/perftest.c 1.3-1.5
sbin/nvmectl/power.c 1.3,1.4
sbin/nvmectl/reset.c 1.2,1.3
sbin/nvmectl/util.c 1.1,1.2
sbin/nvmectl/wdc.c 1.2-1.4
sys/dev/ic/ld_nvme.c 1.20
sys/dev/ic/nvme.c 1.38,1.39
sys/dev/ic/nvmeio.h 1.2
sys/dev/ic/nvmereg.h 1.10,1.11
sys/dev/ic/nvmevar.h 1.16
sys/dev/pci/nvme_pci.c 1.20
nvmectl(8): Sync with FreeBSD nvmecontrol(8) r328763.
nvmectl(8): fix wdc command usage.
nvme(4): Added some delay before check RDY bit quirk when disabling device.
Pick from FreeBSD nvme(4) r326937.
Add some new structure fileds, opcodes and statuses from NVMe 1.3a.
nvmectl(8): Add big-endian support.
from FreeBSD nvmecontolr(8) r329824.
nvmectl(8): fix subcommand usage.
nvmectl(8): Remove some wdc subcommands from man page.
- wdc drive-log
- wdc get-crash-dump
- wdc purge
- wdc purge-monitor
Typos.
use setprogname()/getprogname(), do not hardcode the prognam name in fixed
strings
diffstat:
sbin/nvmectl/Makefile | 3 +-
sbin/nvmectl/bignum.c | 6 +-
sbin/nvmectl/devlist.c | 10 +-
sbin/nvmectl/firmware.c | 10 +-
sbin/nvmectl/identify.c | 24 ++++-
sbin/nvmectl/logpage.c | 198 +++++++++++++++++++++++++++---------------
sbin/nvmectl/nvme.h | 22 +----
sbin/nvmectl/nvmectl.8 | 22 +---
sbin/nvmectl/nvmectl.c | 64 +++----------
sbin/nvmectl/nvmectl.h | 38 ++++---
sbin/nvmectl/perftest.c | 10 +-
sbin/nvmectl/power.c | 12 +-
sbin/nvmectl/reset.c | 10 +-
sbin/nvmectl/util.c | 140 ++++++++++++++++++++++++++++++
sbin/nvmectl/wdc.c | 221 ++++++++---------------------------------------
sys/dev/ic/ld_nvme.c | 8 +-
sys/dev/ic/nvme.c | 98 +++++++++++++-------
sys/dev/ic/nvmeio.h | 104 ++++++++++++++++++++++-
sys/dev/ic/nvmereg.h | 162 ++++++++++++++++++++++++++++++++---
sys/dev/ic/nvmevar.h | 5 +-
sys/dev/pci/nvme_pci.c | 44 +++++++++-
21 files changed, 764 insertions(+), 447 deletions(-)
diffs (truncated from 2192 to 300 lines):
diff -r 73439e235595 -r 146dd6a6a324 sbin/nvmectl/Makefile
--- a/sbin/nvmectl/Makefile Wed Apr 18 14:50:39 2018 +0000
+++ b/sbin/nvmectl/Makefile Thu Apr 19 15:37:56 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.3 2017/04/29 00:06:40 nonaka Exp $
+# $NetBSD: Makefile,v 1.3.2.1 2018/04/19 15:37:56 martin Exp $
.include <bsd.own.mk>
@@ -11,6 +11,7 @@
SRCS+= perftest.c
SRCS+= power.c
SRCS+= reset.c
+SRCS+= util.c
SRCS+= wdc.c
SRCS+= bignum.c
SRCS+= humanize_bignum.c
diff -r 73439e235595 -r 146dd6a6a324 sbin/nvmectl/bignum.c
--- a/sbin/nvmectl/bignum.c Wed Apr 18 14:50:39 2018 +0000
+++ b/sbin/nvmectl/bignum.c Thu Apr 19 15:37:56 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bignum.c,v 1.1 2017/02/13 11:16:46 nonaka Exp $ */
+/* $NetBSD: bignum.c,v 1.1.8.1 2018/04/19 15:37:56 martin Exp $ */
/*-
* Copyright (c) 2012 Alistair Crooks <agc%NetBSD.org@localhost>
@@ -1649,7 +1649,7 @@
/* zero a as per default */
mp_zero(a);
- /* grow a to accomodate the single bit */
+ /* grow a to accommodate the single bit */
if ((res = mp_grow(a, b / DIGIT_BIT + 1)) != MP_OKAY) {
return res;
}
@@ -1683,7 +1683,7 @@
{
int x, res, oldused;
- /* grow to accomodate result */
+ /* grow to accommodate result */
if (b->alloc < a->used + 1) {
if ((res = mp_grow(b, a->used + 1)) != MP_OKAY) {
return res;
diff -r 73439e235595 -r 146dd6a6a324 sbin/nvmectl/devlist.c
--- a/sbin/nvmectl/devlist.c Wed Apr 18 14:50:39 2018 +0000
+++ b/sbin/nvmectl/devlist.c Thu Apr 19 15:37:56 2018 +0000
@@ -1,6 +1,8 @@
-/* $NetBSD: devlist.c,v 1.2 2016/06/04 20:59:49 joerg Exp $ */
+/* $NetBSD: devlist.c,v 1.2.8.1 2018/04/19 15:37:56 martin Exp $ */
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (C) 2012-2013 Intel Corporation
* All rights reserved.
*
@@ -28,9 +30,9 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: devlist.c,v 1.2 2016/06/04 20:59:49 joerg Exp $");
+__RCSID("$NetBSD: devlist.c,v 1.2.8.1 2018/04/19 15:37:56 martin Exp $");
#if 0
-__FBSDID("$FreeBSD: head/sbin/nvmecontrol/devlist.c 260381 2014-01-06 23:48:47Z jimharris $");
+__FBSDID("$FreeBSD: head/sbin/nvmecontrol/devlist.c 329824 2018-02-22 13:32:31Z wma $");
#endif
#endif
@@ -52,7 +54,7 @@
devlist_usage(void)
{
fprintf(stderr, "usage:\n");
- fprintf(stderr, DEVLIST_USAGE);
+ fprintf(stderr, "\t%s " DEVLIST_USAGE, getprogname());
exit(1);
}
diff -r 73439e235595 -r 146dd6a6a324 sbin/nvmectl/firmware.c
--- a/sbin/nvmectl/firmware.c Wed Apr 18 14:50:39 2018 +0000
+++ b/sbin/nvmectl/firmware.c Thu Apr 19 15:37:56 2018 +0000
@@ -1,6 +1,8 @@
-/* $NetBSD: firmware.c,v 1.2 2017/04/29 00:06:40 nonaka Exp $ */
+/* $NetBSD: firmware.c,v 1.2.2.1 2018/04/19 15:37:56 martin Exp $ */
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2013 EMC Corp.
* All rights reserved.
*
@@ -31,9 +33,9 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: firmware.c,v 1.2 2017/04/29 00:06:40 nonaka Exp $");
+__RCSID("$NetBSD: firmware.c,v 1.2.2.1 2018/04/19 15:37:56 martin Exp $");
#if 0
-__FBSDID("$FreeBSD: head/sbin/nvmecontrol/firmware.c 313188 2017-02-04 05:52:50Z imp $");
+__FBSDID("$FreeBSD: head/sbin/nvmecontrol/firmware.c 329824 2018-02-22 13:32:31Z wma $");
#endif
#endif
@@ -186,7 +188,7 @@
int fd = -1;
int a_flag, s_flag, f_flag;
int commit_action, reboot_required;
- int ch,
+ int ch;
char *p, *image = NULL;
char *controller = NULL, prompt[64];
void *buf = NULL;
diff -r 73439e235595 -r 146dd6a6a324 sbin/nvmectl/identify.c
--- a/sbin/nvmectl/identify.c Wed Apr 18 14:50:39 2018 +0000
+++ b/sbin/nvmectl/identify.c Thu Apr 19 15:37:56 2018 +0000
@@ -1,6 +1,8 @@
-/* $NetBSD: identify.c,v 1.2 2016/06/04 20:59:49 joerg Exp $ */
+/* $NetBSD: identify.c,v 1.2.8.1 2018/04/19 15:37:56 martin Exp $ */
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (C) 2012-2013 Intel Corporation
* All rights reserved.
*
@@ -28,9 +30,9 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: identify.c,v 1.2 2016/06/04 20:59:49 joerg Exp $");
+__RCSID("$NetBSD: identify.c,v 1.2.8.1 2018/04/19 15:37:56 martin Exp $");
#if 0
-__FBSDID("$FreeBSD: head/sbin/nvmecontrol/identify.c 253476 2013-07-19 21:40:57Z jimharris $");
+__FBSDID("$FreeBSD: head/sbin/nvmecontrol/identify.c 329824 2018-02-22 13:32:31Z wma $");
#endif
#endif
@@ -72,6 +74,7 @@
printf("Unlimited\n");
else
printf("%ld\n", sysconf(_SC_PAGESIZE) * (1 << cdata->mdts));
+ printf("Controller ID: 0x%02x\n", cdata->cntlid);
printf("\n");
printf("Admin Command Set Attributes\n");
@@ -85,6 +88,9 @@
printf("Firmware Activate/Download: %s\n",
(cdata->oacs & NVME_ID_CTRLR_OACS_FW) ?
"Supported" : "Not Supported");
+ printf("Namespace Managment: %s\n",
+ (cdata->oacs & NVME_ID_CTRLR_OACS_NS) ?
+ "Supported" : "Not Supported");
printf("Abort Command Limit: %d\n", cdata->acl+1);
printf("Async Event Request Limit: %d\n", cdata->aerl+1);
printf("Number of Firmware Slots: ");
@@ -139,6 +145,16 @@
printf("Volatile Write Cache: %s\n",
(cdata->vwc & NVME_ID_CTRLR_VWC_PRESENT) ?
"Present" : "Not Present");
+
+ if (cdata->oacs & NVME_ID_CTRLR_OACS_NS) {
+ printf("\n");
+ printf("Namespace Drive Attributes\n");
+ printf("==========================\n");
+ print_bignum("NVM total cap: ",
+ cdata->untncap.tnvmcap, "");
+ print_bignum("NVM unallocated cap: ",
+ cdata->untncap.unvmcap, "");
+ }
}
static void
@@ -170,7 +186,7 @@
identify_usage(void)
{
fprintf(stderr, "usage:\n");
- fprintf(stderr, IDENTIFY_USAGE);
+ fprintf(stderr, "\t%s " IDENTIFY_USAGE, getprogname());
exit(1);
}
diff -r 73439e235595 -r 146dd6a6a324 sbin/nvmectl/logpage.c
--- a/sbin/nvmectl/logpage.c Wed Apr 18 14:50:39 2018 +0000
+++ b/sbin/nvmectl/logpage.c Thu Apr 19 15:37:56 2018 +0000
@@ -1,6 +1,8 @@
-/* $NetBSD: logpage.c,v 1.4 2017/04/29 00:06:40 nonaka Exp $ */
+/* $NetBSD: logpage.c,v 1.4.2.1 2018/04/19 15:37:56 martin Exp $ */
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2013 EMC Corp.
* All rights reserved.
*
@@ -31,9 +33,9 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: logpage.c,v 1.4 2017/04/29 00:06:40 nonaka Exp $");
+__RCSID("$NetBSD: logpage.c,v 1.4.2.1 2018/04/19 15:37:56 martin Exp $");
#if 0
-__FBSDID("$FreeBSD: head/sbin/nvmecontrol/logpage.c 314230 2017-02-25 00:09:16Z imp $");
+__FBSDID("$FreeBSD: head/sbin/nvmecontrol/logpage.c 329824 2018-02-22 13:32:31Z wma $");
#endif
#endif
@@ -52,12 +54,12 @@
#include <unistd.h>
#include "nvmectl.h"
-#include "bn.h"
#define DEFAULT_SIZE (4096)
#define MAX_FW_SLOTS (7)
-typedef void (*print_fn_t)(void *buf, uint32_t size);
+typedef void (*print_fn_t)(const struct nvm_identify_controller *cdata, void *buf,
+ uint32_t size);
struct kv_name {
uint32_t key;
@@ -78,18 +80,17 @@
}
static void
-print_bin(void *data, uint32_t length)
+print_log_hex(const struct nvm_identify_controller *cdata __unused, void *data,
+ uint32_t length)
{
- write(STDOUT_FILENO, data, length);
+ print_hex(data, length);
}
-/* "Missing" from endian.h */
-static __inline uint64_t
-le48dec(const void *pp)
+static void
+print_bin(const struct nvm_identify_controller *cdata __unused, void *data,
+ uint32_t length)
{
- uint8_t const *p = (uint8_t const *)pp;
-
- return (((uint64_t)le16dec(p + 4) << 32) | le32dec(p));
+ write(STDOUT_FILENO, data, length);
}
static void *
@@ -127,11 +128,30 @@
}
static void
-print_log_error(void *buf, uint32_t size)
+nvme_error_information_entry_swapbytes(struct nvme_error_information_entry *e)
+{
+#if _BYTE_ORDER != _LITTLE_ENDIAN
+ e->error_count = le64toh(e->error_count);
+ e->sqid = le16toh(e->sqid);
+ e->cid = le16toh(e->cid);
+ e->status = le16toh(e->status);
+ e->error_location = le16toh(e->error_location);
+ e->lba = le64toh(e->lba);
+ e->nsid = le32toh(e->nsid);
+ e->command_specific = le64toh(e->command_specific);
+#endif
+}
+
+static void
+print_log_error(const struct nvm_identify_controller *cdata __unused, void *buf,
+ uint32_t size)
{
int i, nentries;
struct nvme_error_information_entry *entry = buf;
+ /* Convert data to host endian */
+ nvme_error_information_entry_swapbytes(entry);
+
printf("Error Information Log\n");
printf("=====================\n");
@@ -171,46 +191,6 @@
}
}
-#define METRIX_PREFIX_BUFSIZ 17
-#define NO_METRIX_PREFIX_BUFSIZ 42
-
-static void
-print_bignum(const char *title, uint64_t v[2], const char *suffix)
-{
- char buf[64];
- uint8_t tmp[16];
- uint64_t l = le64toh(v[0]);
- uint64_t h = le64toh(v[1]);
-
- tmp[ 0] = (h >> 56) & 0xff;
- tmp[ 1] = (h >> 48) & 0xff;
- tmp[ 2] = (h >> 40) & 0xff;
- tmp[ 3] = (h >> 32) & 0xff;
- tmp[ 4] = (h >> 24) & 0xff;
- tmp[ 5] = (h >> 16) & 0xff;
Home |
Main Index |
Thread Index |
Old Index