Author: mav
Date: Sun Mar 11 06:30:09 2018
New Revision: 330760
URL: https://svnweb.freebsd.org/changeset/base/330760

Log:
  Add new opcodes and statuses from NVMe 1.3a.
  
  MFC after:    2 weeks
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/dev/nvme/nvme.h
  head/sys/dev/nvme/nvme_qpair.c

Modified: head/sys/dev/nvme/nvme.h
==============================================================================
--- head/sys/dev/nvme/nvme.h    Sun Mar 11 05:09:02 2018        (r330759)
+++ head/sys/dev/nvme/nvme.h    Sun Mar 11 06:30:09 2018        (r330760)
@@ -498,10 +498,31 @@ enum nvme_generic_command_status_code {
        NVME_SC_ABORTED_MISSING_FUSED           = 0x0a,
        NVME_SC_INVALID_NAMESPACE_OR_FORMAT     = 0x0b,
        NVME_SC_COMMAND_SEQUENCE_ERROR          = 0x0c,
+       NVME_SC_INVALID_SGL_SEGMENT_DESCR       = 0x0d,
+       NVME_SC_INVALID_NUMBER_OF_SGL_DESCR     = 0x0e,
+       NVME_SC_DATA_SGL_LENGTH_INVALID         = 0x0f,
+       NVME_SC_METADATA_SGL_LENGTH_INVALID     = 0x10,
+       NVME_SC_SGL_DESCRIPTOR_TYPE_INVALID     = 0x11,
+       NVME_SC_INVALID_USE_OF_CMB              = 0x12,
+       NVME_SC_PRP_OFFET_INVALID               = 0x13,
+       NVME_SC_ATOMIC_WRITE_UNIT_EXCEEDED      = 0x14,
+       NVME_SC_OPERATION_DENIED                = 0x15,
+       NVME_SC_SGL_OFFSET_INVALID              = 0x16,
+       /* 0x17 - reserved */
+       NVME_SC_HOST_ID_INCONSISTENT_FORMAT     = 0x18,
+       NVME_SC_KEEP_ALIVE_TIMEOUT_EXPIRED      = 0x19,
+       NVME_SC_KEEP_ALIVE_TIMEOUT_INVALID      = 0x1a,
+       NVME_SC_ABORTED_DUE_TO_PREEMPT          = 0x1b,
+       NVME_SC_SANITIZE_FAILED                 = 0x1c,
+       NVME_SC_SANITIZE_IN_PROGRESS            = 0x1d,
+       NVME_SC_SGL_DATA_BLOCK_GRAN_INVALID     = 0x1e,
+       NVME_SC_NOT_SUPPORTED_IN_CMB            = 0x1f,
 
        NVME_SC_LBA_OUT_OF_RANGE                = 0x80,
        NVME_SC_CAPACITY_EXCEEDED               = 0x81,
        NVME_SC_NAMESPACE_NOT_READY             = 0x82,
+       NVME_SC_RESERVATION_CONFLICT            = 0x83,
+       NVME_SC_FORMAT_IN_PROGRESS              = 0x84,
 };
 
 /* command specific status codes */
@@ -518,6 +539,29 @@ enum nvme_command_specific_status_code {
        NVME_SC_INVALID_LOG_PAGE                = 0x09,
        NVME_SC_INVALID_FORMAT                  = 0x0a,
        NVME_SC_FIRMWARE_REQUIRES_RESET         = 0x0b,
+       NVME_SC_INVALID_QUEUE_DELETION          = 0x0c,
+       NVME_SC_FEATURE_NOT_SAVEABLE            = 0x0d,
+       NVME_SC_FEATURE_NOT_CHANGEABLE          = 0x0e,
+       NVME_SC_FEATURE_NOT_NS_SPECIFIC         = 0x0f,
+       NVME_SC_FW_ACT_REQUIRES_NVMS_RESET      = 0x10,
+       NVME_SC_FW_ACT_REQUIRES_RESET           = 0x11,
+       NVME_SC_FW_ACT_REQUIRES_TIME            = 0x12,
+       NVME_SC_FW_ACT_PROHIBITED               = 0x13,
+       NVME_SC_OVERLAPPING_RANGE               = 0x14,
+       NVME_SC_NS_INSUFFICIENT_CAPACITY        = 0x15,
+       NVME_SC_NS_ID_UNAVAILABLE               = 0x16,
+       /* 0x17 - reserved */
+       NVME_SC_NS_ALREADY_ATTACHED             = 0x18,
+       NVME_SC_NS_IS_PRIVATE                   = 0x19,
+       NVME_SC_NS_NOT_ATTACHED                 = 0x1a,
+       NVME_SC_THIN_PROV_NOT_SUPPORTED         = 0x1b,
+       NVME_SC_CTRLR_LIST_INVALID              = 0x1c,
+       NVME_SC_SELT_TEST_IN_PROGRESS           = 0x1d,
+       NVME_SC_BOOT_PART_WRITE_PROHIB          = 0x1e,
+       NVME_SC_INVALID_CTRLR_ID                = 0x1f,
+       NVME_SC_INVALID_SEC_CTRLR_STATE         = 0x20,
+       NVME_SC_INVALID_NUM_OF_CTRLR_RESRC      = 0x21,
+       NVME_SC_INVALID_RESOURCE_ID             = 0x22,
 
        NVME_SC_CONFLICTING_ATTRIBUTES          = 0x80,
        NVME_SC_INVALID_PROTECTION_INFO         = 0x81,
@@ -533,6 +577,7 @@ enum nvme_media_error_status_code {
        NVME_SC_REFERENCE_TAG_CHECK_ERROR       = 0x84,
        NVME_SC_COMPARE_FAILURE                 = 0x85,
        NVME_SC_ACCESS_DENIED                   = 0x86,
+       NVME_SC_DEALLOCATED_OR_UNWRITTEN        = 0x87,
 };
 
 /* admin opcodes */
@@ -554,11 +599,20 @@ enum nvme_admin_opcode {
        /* 0x0e-0x0f - reserved */
        NVME_OPC_FIRMWARE_ACTIVATE              = 0x10,
        NVME_OPC_FIRMWARE_IMAGE_DOWNLOAD        = 0x11,
+       NVME_OPC_DEVICE_SELF_TEST               = 0x14,
        NVME_OPC_NAMESPACE_ATTACHMENT           = 0x15,
+       NVME_OPC_KEEP_ALIVE                     = 0x18,
+       NVME_OPC_DIRECTIVE_SEND                 = 0x19,
+       NVME_OPC_DIRECTIVE_RECEIVE              = 0x1a,
+       NVME_OPC_VIRTUALIZATION_MANAGEMENT      = 0x1c,
+       NVME_OPC_NVME_MI_SEND                   = 0x1d,
+       NVME_OPC_NVME_MI_RECEIVE                = 0x1e,
+       NVME_OPC_DOORBELL_BUFFER_CONFIG         = 0x7c,
 
        NVME_OPC_FORMAT_NVM                     = 0x80,
        NVME_OPC_SECURITY_SEND                  = 0x81,
        NVME_OPC_SECURITY_RECEIVE               = 0x82,
+       NVME_OPC_SANITIZE                       = 0x84,
 };
 
 /* nvme nvm opcodes */
@@ -569,8 +623,17 @@ enum nvme_nvm_opcode {
        /* 0x03 - reserved */
        NVME_OPC_WRITE_UNCORRECTABLE            = 0x04,
        NVME_OPC_COMPARE                        = 0x05,
-       /* 0x06-0x07 - reserved */
+       /* 0x06 - reserved */
+       NVME_OPC_WRITE_ZEROES                   = 0x08,
+       /* 0x07 - reserved */
        NVME_OPC_DATASET_MANAGEMENT             = 0x09,
+       /* 0x0a-0x0c - reserved */
+       NVME_OPC_RESERVATION_REGISTER           = 0x0d,
+       NVME_OPC_RESERVATION_REPORT             = 0x0e,
+       /* 0x0f-0x10 - reserved */
+       NVME_OPC_RESERVATION_ACQUIRE            = 0x11,
+       /* 0x12-0x14 - reserved */
+       NVME_OPC_RESERVATION_RELEASE            = 0x15,
 };
 
 enum nvme_feature {

Modified: head/sys/dev/nvme/nvme_qpair.c
==============================================================================
--- head/sys/dev/nvme/nvme_qpair.c      Sun Mar 11 05:09:02 2018        
(r330759)
+++ head/sys/dev/nvme/nvme_qpair.c      Sun Mar 11 06:30:09 2018        
(r330760)
@@ -59,9 +59,19 @@ static struct nvme_opcode_string admin_opcode[] = {
        { NVME_OPC_ASYNC_EVENT_REQUEST, "ASYNC EVENT REQUEST" },
        { NVME_OPC_FIRMWARE_ACTIVATE, "FIRMWARE ACTIVATE" },
        { NVME_OPC_FIRMWARE_IMAGE_DOWNLOAD, "FIRMWARE IMAGE DOWNLOAD" },
+       { NVME_OPC_DEVICE_SELF_TEST, "DEVICE SELF-TEST" },
+       { NVME_OPC_NAMESPACE_ATTACHMENT, "NAMESPACE ATTACHMENT" },
+       { NVME_OPC_KEEP_ALIVE, "KEEP ALIVE" },
+       { NVME_OPC_DIRECTIVE_SEND, "DIRECTIVE SEND" },
+       { NVME_OPC_DIRECTIVE_RECEIVE, "DIRECTIVE RECEIVE" },
+       { NVME_OPC_VIRTUALIZATION_MANAGEMENT, "VIRTUALIZATION MANAGEMENT" },
+       { NVME_OPC_NVME_MI_SEND, "NVME-MI SEND" },
+       { NVME_OPC_NVME_MI_RECEIVE, "NVME-MI RECEIVE" },
+       { NVME_OPC_DOORBELL_BUFFER_CONFIG, "DOORBELL BUFFER CONFIG" },
        { NVME_OPC_FORMAT_NVM, "FORMAT NVM" },
        { NVME_OPC_SECURITY_SEND, "SECURITY SEND" },
        { NVME_OPC_SECURITY_RECEIVE, "SECURITY RECEIVE" },
+       { NVME_OPC_SANITIZE, "SANITIZE" },
        { 0xFFFF, "ADMIN COMMAND" }
 };
 
@@ -71,7 +81,12 @@ static struct nvme_opcode_string io_opcode[] = {
        { NVME_OPC_READ, "READ" },
        { NVME_OPC_WRITE_UNCORRECTABLE, "WRITE UNCORRECTABLE" },
        { NVME_OPC_COMPARE, "COMPARE" },
+       { NVME_OPC_WRITE_ZEROES, "WRITE ZEROES" },
        { NVME_OPC_DATASET_MANAGEMENT, "DATASET MANAGEMENT" },
+       { NVME_OPC_RESERVATION_REGISTER, "RESERVATION REGISTER" },
+       { NVME_OPC_RESERVATION_REPORT, "RESERVATION REPORT" },
+       { NVME_OPC_RESERVATION_ACQUIRE, "RESERVATION ACQUIRE" },
+       { NVME_OPC_RESERVATION_RELEASE, "RESERVATION RELEASE" },
        { 0xFFFF, "IO COMMAND" }
 };
 
@@ -131,6 +146,7 @@ nvme_io_qpair_print_command(struct nvme_qpair *qpair,
        case NVME_OPC_READ:
        case NVME_OPC_WRITE_UNCORRECTABLE:
        case NVME_OPC_COMPARE:
+       case NVME_OPC_WRITE_ZEROES:
                nvme_printf(qpair->ctrlr, "%s sqid:%d cid:%d nsid:%d "
                    "lba:%llu len:%d\n",
                    get_io_opcode_string(opc), qpair->id, cmd->cid, 
le32toh(cmd->nsid),
@@ -139,6 +155,10 @@ nvme_io_qpair_print_command(struct nvme_qpair *qpair,
                break;
        case NVME_OPC_FLUSH:
        case NVME_OPC_DATASET_MANAGEMENT:
+       case NVME_OPC_RESERVATION_REGISTER:
+       case NVME_OPC_RESERVATION_REPORT:
+       case NVME_OPC_RESERVATION_ACQUIRE:
+       case NVME_OPC_RESERVATION_RELEASE:
                nvme_printf(qpair->ctrlr, "%s sqid:%d cid:%d nsid:%d\n",
                    get_io_opcode_string(opc), qpair->id, cmd->cid, 
le32toh(cmd->nsid));
                break;
@@ -179,9 +199,30 @@ static struct nvme_status_string generic_status[] = {
        { NVME_SC_ABORTED_MISSING_FUSED, "ABORTED - MISSING FUSED" },
        { NVME_SC_INVALID_NAMESPACE_OR_FORMAT, "INVALID NAMESPACE OR FORMAT" },
        { NVME_SC_COMMAND_SEQUENCE_ERROR, "COMMAND SEQUENCE ERROR" },
+       { NVME_SC_INVALID_SGL_SEGMENT_DESCR, "INVALID SGL SEGMENT DESCRIPTOR" },
+       { NVME_SC_INVALID_NUMBER_OF_SGL_DESCR, "INVALID NUMBER OF SGL 
DESCRIPTORS" },
+       { NVME_SC_DATA_SGL_LENGTH_INVALID, "DATA SGL LENGTH INVALID" },
+       { NVME_SC_METADATA_SGL_LENGTH_INVALID, "METADATA SGL LENGTH INVALID" },
+       { NVME_SC_SGL_DESCRIPTOR_TYPE_INVALID, "SGL DESCRIPTOR TYPE INVALID" },
+       { NVME_SC_INVALID_USE_OF_CMB, "INVALID USE OF CONTROLLER MEMORY BUFFER" 
},
+       { NVME_SC_PRP_OFFET_INVALID, "PRP OFFET INVALID" },
+       { NVME_SC_ATOMIC_WRITE_UNIT_EXCEEDED, "ATOMIC WRITE UNIT EXCEEDED" },
+       { NVME_SC_OPERATION_DENIED, "OPERATION DENIED" },
+       { NVME_SC_SGL_OFFSET_INVALID, "SGL OFFSET INVALID" },
+       { NVME_SC_HOST_ID_INCONSISTENT_FORMAT, "HOST IDENTIFIER INCONSISTENT 
FORMAT" },
+       { NVME_SC_KEEP_ALIVE_TIMEOUT_EXPIRED, "KEEP ALIVE TIMEOUT EXPIRED" },
+       { NVME_SC_KEEP_ALIVE_TIMEOUT_INVALID, "KEEP ALIVE TIMEOUT INVALID" },
+       { NVME_SC_ABORTED_DUE_TO_PREEMPT, "COMMAND ABORTED DUE TO PREEMPT AND 
ABORT" },
+       { NVME_SC_SANITIZE_FAILED, "SANITIZE FAILED" },
+       { NVME_SC_SANITIZE_IN_PROGRESS, "SANITIZE IN PROGRESS" },
+       { NVME_SC_SGL_DATA_BLOCK_GRAN_INVALID, 
"SGL_DATA_BLOCK_GRANULARITY_INVALID" },
+       { NVME_SC_NOT_SUPPORTED_IN_CMB, "COMMAND NOT SUPPORTED FOR QUEUE IN 
CMB" },
+
        { NVME_SC_LBA_OUT_OF_RANGE, "LBA OUT OF RANGE" },
        { NVME_SC_CAPACITY_EXCEEDED, "CAPACITY EXCEEDED" },
        { NVME_SC_NAMESPACE_NOT_READY, "NAMESPACE NOT READY" },
+       { NVME_SC_RESERVATION_CONFLICT, "RESERVATION CONFLICT" },
+       { NVME_SC_FORMAT_IN_PROGRESS, "FORMAT IN PROGRESS" },
        { 0xFFFF, "GENERIC" }
 };
 
@@ -197,6 +238,29 @@ static struct nvme_status_string command_specific_stat
        { NVME_SC_INVALID_LOG_PAGE, "INVALID LOG PAGE" },
        { NVME_SC_INVALID_FORMAT, "INVALID FORMAT" },
        { NVME_SC_FIRMWARE_REQUIRES_RESET, "FIRMWARE REQUIRES RESET" },
+       { NVME_SC_INVALID_QUEUE_DELETION, "INVALID QUEUE DELETION" },
+       { NVME_SC_FEATURE_NOT_SAVEABLE, "FEATURE IDENTIFIER NOT SAVEABLE" },
+       { NVME_SC_FEATURE_NOT_CHANGEABLE, "FEATURE NOT CHANGEABLE" },
+       { NVME_SC_FEATURE_NOT_NS_SPECIFIC, "FEATURE NOT NAMESPACE SPECIFIC" },
+       { NVME_SC_FW_ACT_REQUIRES_NVMS_RESET, "FIRMWARE ACTIVATION REQUIRES NVM 
SUBSYSTEM RESET" },
+       { NVME_SC_FW_ACT_REQUIRES_RESET, "FIRMWARE ACTIVATION REQUIRES RESET" },
+       { NVME_SC_FW_ACT_REQUIRES_TIME, "FIRMWARE ACTIVATION REQUIRES MAXIMUM 
TIME VIOLATION" },
+       { NVME_SC_FW_ACT_PROHIBITED, "FIRMWARE ACTIVATION PROHIBITED" },
+       { NVME_SC_OVERLAPPING_RANGE, "OVERLAPPING RANGE" },
+       { NVME_SC_NS_INSUFFICIENT_CAPACITY, "NAMESPACE INSUFFICIENT CAPACITY" },
+       { NVME_SC_NS_ID_UNAVAILABLE, "NAMESPACE IDENTIFIER UNAVAILABLE" },
+       { NVME_SC_NS_ALREADY_ATTACHED, "NAMESPACE ALREADY ATTACHED" },
+       { NVME_SC_NS_IS_PRIVATE, "NAMESPACE IS PRIVATE" },
+       { NVME_SC_NS_NOT_ATTACHED, "NS NOT ATTACHED" },
+       { NVME_SC_THIN_PROV_NOT_SUPPORTED, "THIN PROVISIONING NOT SUPPORTED" },
+       { NVME_SC_CTRLR_LIST_INVALID, "CONTROLLER LIST INVALID" },
+       { NVME_SC_SELT_TEST_IN_PROGRESS, "DEVICE SELT-TEST IN PROGRESS" },
+       { NVME_SC_BOOT_PART_WRITE_PROHIB, "BOOT PARTITION WRITE PROHIBITED" },
+       { NVME_SC_INVALID_CTRLR_ID, "INVALID CONTROLLER IDENTIFIER" },
+       { NVME_SC_INVALID_SEC_CTRLR_STATE, "INVALID SECONDARY CONTROLLER STATE" 
},
+       { NVME_SC_INVALID_NUM_OF_CTRLR_RESRC, "INVALID NUMBER OF CONTROLLER 
RESOURCES" },
+       { NVME_SC_INVALID_RESOURCE_ID, "INVALID RESOURCE IDENTIFIER" },
+
        { NVME_SC_CONFLICTING_ATTRIBUTES, "CONFLICTING ATTRIBUTES" },
        { NVME_SC_INVALID_PROTECTION_INFO, "INVALID PROTECTION INFO" },
        { NVME_SC_ATTEMPTED_WRITE_TO_RO_PAGE, "WRITE TO RO PAGE" },
@@ -211,6 +275,7 @@ static struct nvme_status_string media_error_status[] 
        { NVME_SC_REFERENCE_TAG_CHECK_ERROR, "REFERENCE TAG CHECK ERROR" },
        { NVME_SC_COMPARE_FAILURE, "COMPARE FAILURE" },
        { NVME_SC_ACCESS_DENIED, "ACCESS DENIED" },
+       { NVME_SC_DEALLOCATED_OR_UNWRITTEN, "DEALLOCATED OR UNWRITTEN LOGICAL 
BLOCK" },
        { 0xFFFF, "MEDIA ERROR" }
 };
 
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to