17aa4eb96SMatthew Dillon /* 27aa4eb96SMatthew Dillon * Copyright (c) 2016 The DragonFly Project. All rights reserved. 37aa4eb96SMatthew Dillon * 47aa4eb96SMatthew Dillon * This code is derived from software contributed to The DragonFly Project 57aa4eb96SMatthew Dillon * by Matthew Dillon <dillon@backplane.com> 67aa4eb96SMatthew Dillon * 77aa4eb96SMatthew Dillon * Redistribution and use in source and binary forms, with or without 87aa4eb96SMatthew Dillon * modification, are permitted provided that the following conditions 97aa4eb96SMatthew Dillon * are met: 107aa4eb96SMatthew Dillon * 117aa4eb96SMatthew Dillon * 1. Redistributions of source code must retain the above copyright 127aa4eb96SMatthew Dillon * notice, this list of conditions and the following disclaimer. 137aa4eb96SMatthew Dillon * 2. Redistributions in binary form must reproduce the above copyright 147aa4eb96SMatthew Dillon * notice, this list of conditions and the following disclaimer in 157aa4eb96SMatthew Dillon * the documentation and/or other materials provided with the 167aa4eb96SMatthew Dillon * distribution. 177aa4eb96SMatthew Dillon * 3. Neither the name of The DragonFly Project nor the names of its 187aa4eb96SMatthew Dillon * contributors may be used to endorse or promote products derived 197aa4eb96SMatthew Dillon * from this software without specific, prior written permission. 207aa4eb96SMatthew Dillon * 217aa4eb96SMatthew Dillon * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 227aa4eb96SMatthew Dillon * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 237aa4eb96SMatthew Dillon * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 247aa4eb96SMatthew Dillon * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 257aa4eb96SMatthew Dillon * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 267aa4eb96SMatthew Dillon * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, 277aa4eb96SMatthew Dillon * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 287aa4eb96SMatthew Dillon * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 297aa4eb96SMatthew Dillon * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 307aa4eb96SMatthew Dillon * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 317aa4eb96SMatthew Dillon * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 327aa4eb96SMatthew Dillon * SUCH DAMAGE. 337aa4eb96SMatthew Dillon */ 347aa4eb96SMatthew Dillon 357aa4eb96SMatthew Dillon #include <sys/types.h> 367aa4eb96SMatthew Dillon #include <sys/ioctl.h> 377aa4eb96SMatthew Dillon #include <dev/disk/nvme/nvme_fw.h> 387aa4eb96SMatthew Dillon #include <dev/disk/nvme/nvme_log.h> 397aa4eb96SMatthew Dillon #include <dev/disk/nvme/nvme_ident.h> 407aa4eb96SMatthew Dillon #include <dev/disk/nvme/nvme_ns.h> 417aa4eb96SMatthew Dillon #include <dev/disk/nvme/nvme_chipset.h> 427aa4eb96SMatthew Dillon #include <dev/disk/nvme/nvme_ioctl.h> 43*2c3b1d1bSSascha Wildner #include <fcntl.h> 447aa4eb96SMatthew Dillon #include <stdio.h> 457aa4eb96SMatthew Dillon #include <stdlib.h> 467aa4eb96SMatthew Dillon #include <unistd.h> 477aa4eb96SMatthew Dillon #include <string.h> 487aa4eb96SMatthew Dillon #include <errno.h> 497aa4eb96SMatthew Dillon #include <libutil.h> 507aa4eb96SMatthew Dillon 517aa4eb96SMatthew Dillon const char *format_number(uint64_t value); 521cdf60d5SMatthew Dillon const char *status_to_str(uint16_t status); 53