diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-02-10 15:34:55 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-02-18 15:00:48 +0100 |
commit | 46b3858b27d78e14a220f8d251fd7ab28a5244f4 (patch) | |
tree | 95e29e1fdafe3d709895f30df44a6716652041c9 /freebsd/sbin/nvmecontrol | |
parent | epoch01: Update due to API changes (diff) | |
download | rtems-libbsd-46b3858b27d78e14a220f8d251fd7ab28a5244f4.tar.bz2 |
Update to FreeBSD stable/12 2020-02-10
Git mirror commit 0d1c391321b34b3025cf0e72f2231d836ff76da8.
Diffstat (limited to 'freebsd/sbin/nvmecontrol')
-rw-r--r-- | freebsd/sbin/nvmecontrol/comnd.c | 2 | ||||
-rw-r--r-- | freebsd/sbin/nvmecontrol/identify.c | 33 | ||||
-rw-r--r-- | freebsd/sbin/nvmecontrol/identify_ext.c | 25 | ||||
-rw-r--r-- | freebsd/sbin/nvmecontrol/logpage.c | 2 | ||||
-rw-r--r-- | freebsd/sbin/nvmecontrol/modules/wdc/wdc.c | 3 | ||||
-rw-r--r-- | freebsd/sbin/nvmecontrol/nc_util.c | 3 | ||||
-rw-r--r-- | freebsd/sbin/nvmecontrol/ns.c | 2 | ||||
-rw-r--r-- | freebsd/sbin/nvmecontrol/nvmecontrol_ext.h | 2 | ||||
-rw-r--r-- | freebsd/sbin/nvmecontrol/power.c | 3 |
9 files changed, 46 insertions, 29 deletions
diff --git a/freebsd/sbin/nvmecontrol/comnd.c b/freebsd/sbin/nvmecontrol/comnd.c index a4fa686f..06af943d 100644 --- a/freebsd/sbin/nvmecontrol/comnd.c +++ b/freebsd/sbin/nvmecontrol/comnd.c @@ -207,7 +207,7 @@ arg_parse(int argc, char * const * argv, const struct cmd *f) if (lopts == NULL) err(1, "option memory"); #ifndef __rtems__ - p = shortopts = malloc((2 * n + 2) * sizeof(char)); + p = shortopts = malloc((n + 3) * sizeof(char)); #else /* __rtems__ */ p = shortopts = malloc((2 * n + 3) * sizeof(char)); #endif /* __rtems__ */ diff --git a/freebsd/sbin/nvmecontrol/identify.c b/freebsd/sbin/nvmecontrol/identify.c index e494fb59..452494ef 100644 --- a/freebsd/sbin/nvmecontrol/identify.c +++ b/freebsd/sbin/nvmecontrol/identify.c @@ -67,6 +67,7 @@ static struct options { void print_namespace(struct nvme_namespace_data *nsdata) { + char cbuf[UINT128_DIG + 1]; uint32_t i; uint32_t lbaf, lbads, ms, rp; uint8_t thin_prov, ptype; @@ -78,15 +79,12 @@ print_namespace(struct nvme_namespace_data *nsdata) flbas_fmt = (nsdata->flbas >> NVME_NS_DATA_FLBAS_FORMAT_SHIFT) & NVME_NS_DATA_FLBAS_FORMAT_MASK; - printf("Size (in LBAs): %lld (%lldM)\n", - (long long)nsdata->nsze, - (long long)nsdata->nsze / 1024 / 1024); - printf("Capacity (in LBAs): %lld (%lldM)\n", - (long long)nsdata->ncap, - (long long)nsdata->ncap / 1024 / 1024); - printf("Utilization (in LBAs): %lld (%lldM)\n", - (long long)nsdata->nuse, - (long long)nsdata->nuse / 1024 / 1024); + printf("Size: %lld blocks\n", + (long long)nsdata->nsze); + printf("Capacity: %lld blocks\n", + (long long)nsdata->ncap); + printf("Utilization: %lld blocks\n", + (long long)nsdata->nuse); printf("Thin Provisioning: %s\n", thin_prov ? "Supported" : "Not Supported"); printf("Number of LBA Formats: %d\n", nsdata->nlbaf+1); @@ -153,7 +151,22 @@ print_namespace(struct nvme_namespace_data *nsdata) NVME_NS_DATA_DLFEAT_DWZ_MASK ? ", Write Zero" : "", (nsdata->dlfeat >> NVME_NS_DATA_DLFEAT_GCRC_SHIFT) & NVME_NS_DATA_DLFEAT_GCRC_MASK ? ", Guard CRC" : ""); - printf("Optimal I/O Boundary (LBAs): %u\n", nsdata->noiob); + printf("Optimal I/O Boundary: %u blocks\n", nsdata->noiob); + printf("NVM Capacity: %s bytes\n", + uint128_to_str(to128(nsdata->nvmcap), cbuf, sizeof(cbuf))); + if ((nsdata->nsfeat >> NVME_NS_DATA_NSFEAT_NPVALID_SHIFT) & + NVME_NS_DATA_NSFEAT_NPVALID_MASK) { + printf("Preferred Write Granularity: %u blocks", + nsdata->npwg + 1); + printf("Preferred Write Alignment: %u blocks", + nsdata->npwa + 1); + printf("Preferred Deallocate Granul: %u blocks", + nsdata->npdg + 1); + printf("Preferred Deallocate Align: %u blocks", + nsdata->npda + 1); + printf("Optimal Write Size: %u blocks", + nsdata->nows + 1); + } printf("Globally Unique Identifier: "); for (i = 0; i < sizeof(nsdata->nguid); i++) printf("%02x", nsdata->nguid[i]); diff --git a/freebsd/sbin/nvmecontrol/identify_ext.c b/freebsd/sbin/nvmecontrol/identify_ext.c index 44e0011b..bb0a0d51 100644 --- a/freebsd/sbin/nvmecontrol/identify_ext.c +++ b/freebsd/sbin/nvmecontrol/identify_ext.c @@ -126,7 +126,7 @@ nvme_print_controller(struct nvme_controller_data *cdata) if (cdata->mdts == 0) printf("Unlimited\n"); else - printf("%ld\n", PAGE_SIZE * (1L << cdata->mdts)); + printf("%ld bytes\n", PAGE_SIZE * (1L << cdata->mdts)); printf("Controller ID: 0x%04x\n", cdata->ctrlr_id); printf("Version: %d.%d.%d\n", (cdata->ver >> 16) & 0xffff, (cdata->ver >> 8) & 0xff, @@ -189,6 +189,18 @@ nvme_print_controller(struct nvme_controller_data *cdata) ns_smart ? "Yes" : "No"); printf("Error Log Page Entries: %d\n", cdata->elpe+1); printf("Number of Power States: %d\n", cdata->npss+1); + if (cdata->ver >= 0x010200) { + printf("Total NVM Capacity: %s bytes\n", + uint128_to_str(to128(cdata->untncap.tnvmcap), + cbuf, sizeof(cbuf))); + printf("Unallocated NVM Capacity: %s bytes\n", + uint128_to_str(to128(cdata->untncap.unvmcap), + cbuf, sizeof(cbuf))); + } + printf("Host Buffer Preferred Size: %llu bytes\n", + (long long unsigned)cdata->hmpre * 4096); + printf("Host Buffer Minimum Size: %llu bytes\n", + (long long unsigned)cdata->hmmin * 4096); printf("\n"); printf("NVM Command Set Attributes\n"); @@ -240,13 +252,6 @@ nvme_print_controller(struct nvme_controller_data *cdata) (t == NVME_CTRLR_DATA_VWC_ALL_NO) ? ", no flush all" : (t == NVME_CTRLR_DATA_VWC_ALL_YES) ? ", flush all" : ""); - if (nsmgmt) { - printf("\n"); - printf("Namespace Drive Attributes\n"); - printf("==========================\n"); - printf("NVM total cap: %s\n", - uint128_to_str(to128(cdata->untncap.tnvmcap), cbuf, sizeof(cbuf))); - printf("NVM unallocated cap: %s\n", - uint128_to_str(to128(cdata->untncap.unvmcap), cbuf, sizeof(cbuf))); - } + if (cdata->ver >= 0x010201) + printf("\nNVM Subsystem Name: %.256s\n", cdata->subnqn); } diff --git a/freebsd/sbin/nvmecontrol/logpage.c b/freebsd/sbin/nvmecontrol/logpage.c index 8ab50bea..6765efdd 100644 --- a/freebsd/sbin/nvmecontrol/logpage.c +++ b/freebsd/sbin/nvmecontrol/logpage.c @@ -1,3 +1,5 @@ +#include <machine/rtems-bsd-user-space.h> + /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * diff --git a/freebsd/sbin/nvmecontrol/modules/wdc/wdc.c b/freebsd/sbin/nvmecontrol/modules/wdc/wdc.c index 3cd5cdb7..81546676 100644 --- a/freebsd/sbin/nvmecontrol/modules/wdc/wdc.c +++ b/freebsd/sbin/nvmecontrol/modules/wdc/wdc.c @@ -1,8 +1,7 @@ #include <machine/rtems-bsd-user-space.h> /*- - * Copyright (c) 2017 Netflix, Inc - * All rights reserved. + * Copyright (c) 2017 Netflix, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/freebsd/sbin/nvmecontrol/nc_util.c b/freebsd/sbin/nvmecontrol/nc_util.c index f2818871..3a349c6d 100644 --- a/freebsd/sbin/nvmecontrol/nc_util.c +++ b/freebsd/sbin/nvmecontrol/nc_util.c @@ -1,8 +1,7 @@ #include <machine/rtems-bsd-user-space.h> /*- - * Copyright (c) 2017 Netflix, Inc - * All rights reserved. + * Copyright (c) 2017 Netflix, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/freebsd/sbin/nvmecontrol/ns.c b/freebsd/sbin/nvmecontrol/ns.c index 841c1a87..f01d3213 100644 --- a/freebsd/sbin/nvmecontrol/ns.c +++ b/freebsd/sbin/nvmecontrol/ns.c @@ -3,7 +3,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2017 Netflix, Inc + * Copyright (c) 2017 Netflix, Inc. * Copyright (C) 2018-2019 Alexander Motin <mav@FreeBSD.org> * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sbin/nvmecontrol/nvmecontrol_ext.h b/freebsd/sbin/nvmecontrol/nvmecontrol_ext.h index 43042dfa..d60fcd4d 100644 --- a/freebsd/sbin/nvmecontrol/nvmecontrol_ext.h +++ b/freebsd/sbin/nvmecontrol/nvmecontrol_ext.h @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (C) 2018 Netflix + * Copyright (C) 2018 Netflix, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/freebsd/sbin/nvmecontrol/power.c b/freebsd/sbin/nvmecontrol/power.c index 9f6eeda4..2194d9f6 100644 --- a/freebsd/sbin/nvmecontrol/power.c +++ b/freebsd/sbin/nvmecontrol/power.c @@ -1,8 +1,7 @@ #include <machine/rtems-bsd-user-space.h> /*- - * Copyright (c) 2016 Netflix, Inc - * All rights reserved. + * Copyright (c) 2016 Netflix, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions |