Print this page
MFV: illumos-gate@48d370f1e98a10b1bdf160dd83a49e0f49f6c1b7
9809 nvme driver should attach to all NVMe 1.x devices
9810 Update parts of NVMe headers for newer specs
9811 nvmeadm(1M) should have ctf
Reviewed by: Hans Rosenfeld <hans.rosenfeld@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Yuri Pankov <yuripv@yuripv.net>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Reviewed by: Andy Fiddaman <omnios@citrus-it.co.uk>
Approved by: Dan McDonald <danmcd@joyent.com>
Author: Robert Mustacchi <rm@joyent.com>
NEX-7237 nvme CSTS register definition is wrong
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Dan Fields <dan.fields@nexenta.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
NEX-4431 want NVMe management utility
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
NEX-2182 need driver for Intel NVM Express (nvme) (preview)
Reviewed by: Dan Fields <dan.fields@nexenta.com>
   1 /*
   2  * This file and its contents are supplied under the terms of the
   3  * Common Development and Distribution License ("CDDL"), version 1.0.
   4  * You may only use this file in accordance with the terms of version
   5  * 1.0 of the CDDL.
   6  *
   7  * A full copy of the text of the CDDL should have accompanied this
   8  * source.  A copy of the CDDL is also available via the Internet at
   9  * http://www.illumos.org/license/CDDL.
  10  */
  11 
  12 /*
  13  * Copyright 2016 Nexenta Systems, Inc. All rights reserved.

  14  */
  15 
  16 /*
  17  * NVMe hardware interface
  18  */
  19 
  20 #ifndef _NVME_REG_H
  21 #define _NVME_REG_H
  22 
  23 #include <sys/nvme.h>
  24 
  25 #pragma pack(1)
  26 
  27 #ifdef __cplusplus
  28 extern "C" {
  29 #endif
  30 
  31 
  32 /*
  33  * NVMe constants
  34  */
  35 #define NVME_MAX_ADMIN_QUEUE_LEN        4096
  36 
  37 /*
  38  * NVMe registers and register fields
  39  */
  40 #define NVME_REG_CAP    0x0             /* Controller Capabilities */
  41 #define NVME_REG_VS     0x8             /* Version */
  42 #define NVME_REG_INTMS  0xc             /* Interrupt Mask Set */
  43 #define NVME_REG_INTMC  0x10            /* Interrupt Mask Clear */
  44 #define NVME_REG_CC     0x14            /* Controller Configuration */
  45 #define NVME_REG_CSTS   0x1c            /* Controller Status */
  46 #define NVME_REG_NSSR   0x20            /* NVM Subsystem Reset */
  47 #define NVME_REG_AQA    0x24            /* Admin Queue Attributes */
  48 #define NVME_REG_ASQ    0x28            /* Admin Submission Queue */
  49 #define NVME_REG_ACQ    0x30            /* Admin Completion Qeueu */





  50 #define NVME_REG_SQTDBL(nvme, n) \
  51         (0x1000 + ((2 * (n)) * nvme->n_doorbell_stride))
  52 #define NVME_REG_CQHDBL(nvme, n) \
  53         (0x1000 + ((2 * (n) + 1) * nvme->n_doorbell_stride))
  54 
  55 #define  NVME_CAP_CSS_NVM       1       /* NVM Command Set */
  56 #define  NVME_CAP_AMS_WRR       1       /* Weighted Round-Robin */
  57 
  58 /* CAP -- Controller Capabilities */
  59 typedef union {
  60         struct {
  61                 uint16_t cap_mqes;      /* Maximum Queue Entries Supported */
  62                 uint8_t cap_cqr:1;      /* Contiguous Queues Required */
  63                 uint8_t cap_ams:2;      /* Arbitration Mechanisms Supported */
  64                 uint8_t cap_rsvd1:5;
  65                 uint8_t cap_to;         /* Timeout */
  66                 uint16_t cap_dstrd:4;   /* Doorbell Stride */
  67                 uint16_t cap_nssrs:1;   /* NVM Subsystem Reset Supported */
  68                 uint16_t cap_css:8;     /* Command Sets Supported */
  69                 uint16_t cap_rsvd2:3;

  70                 uint8_t cap_mpsmin:4;   /* Memory Page Size Minimum */
  71                 uint8_t cap_mpsmax:4;   /* Memory Page Size Maximum */
  72                 uint8_t cap_rsvd3;
  73         } b;
  74         uint64_t r;
  75 } nvme_reg_cap_t;
  76 
  77 /* VS -- Version */
  78 typedef union {
  79         struct {
  80                 uint8_t vs_rsvd;
  81                 uint8_t vs_mnr;         /* Minor Version Number */
  82                 uint16_t vs_mjr;        /* Major Version Number */
  83         } b;
  84         uint32_t r;
  85 } nvme_reg_vs_t;
  86 
  87 /* CC -- Controller Configuration */
  88 #define NVME_CC_SHN_NORMAL      1       /* Normal Shutdown Notification */
  89 #define NVME_CC_SHN_ABRUPT      2       /* Abrupt Shutdown Notification */


  96                 uint16_t cc_mps:4;      /* Memory Page Size */
  97                 uint16_t cc_ams:3;      /* Arbitration Mechanism Selected */
  98                 uint16_t cc_shn:2;      /* Shutdown Notification */
  99                 uint8_t cc_iosqes:4;    /* I/O Submission Queue Entry Size */
 100                 uint8_t cc_iocqes:4;    /* I/O Completion Queue Entry Size */
 101                 uint8_t cc_rsvd2;
 102         } b;
 103         uint32_t r;
 104 } nvme_reg_cc_t;
 105 
 106 /* CSTS -- Controller Status */
 107 #define NVME_CSTS_SHN_OCCURING  1       /* Shutdown Processing Occuring */
 108 #define NVME_CSTS_SHN_COMPLETE  2       /* Shutdown Processing Complete */
 109 
 110 typedef union {
 111         struct {
 112                 uint32_t csts_rdy:1;    /* Ready */
 113                 uint32_t csts_cfs:1;    /* Controller Fatal Status */
 114                 uint32_t csts_shst:2;   /* Shutdown Status */
 115                 uint32_t csts_nssro:1;  /* NVM Subsystem Reset Occured */
 116                 uint32_t csts_rsvd:27;

 117         } b;
 118         uint32_t r;
 119 } nvme_reg_csts_t;
 120 
 121 /* NSSR -- NVM Subsystem Reset */
 122 #define NVME_NSSR_NSSRC 0x4e564d65      /* NSSR magic value */
 123 typedef uint32_t nvme_reg_nssr_t;
 124 
 125 /* AQA -- Admin Queue Attributes */
 126 typedef union {
 127         struct {
 128                 uint16_t aqa_asqs:12;   /* Admin Submission Queue Size */
 129                 uint16_t aqa_rsvd1:4;
 130                 uint16_t aqa_acqs:12;   /* Admin Completion Queue Size */
 131                 uint16_t aqa_rsvd2:4;
 132         } b;
 133         uint32_t r;
 134 } nvme_reg_aqa_t;
 135 
 136 /*
 137  * The spec specifies the lower 12 bits of ASQ and ACQ as reserved, which is
 138  * probably a specification bug. The full 64bit regs are used as base address,
 139  * and the lower bits must be zero to ensure alignment on the page size
 140  * specified in CC.MPS.
 141  */
 142 /* ASQ -- Admin Submission Queue Base Address */
 143 typedef uint64_t nvme_reg_asq_t;        /* Admin Submission Queue Base */
 144 
 145 /* ACQ -- Admin Completion Queue Base Address */
 146 typedef uint64_t nvme_reg_acq_t;        /* Admin Completion Queue Base */
 147 



















































 148 /* SQyTDBL -- Submission Queue y Tail Doorbell */
 149 typedef union {
 150         struct {
 151                 uint16_t sqtdbl_sqt;    /* Submission Queue Tail */
 152                 uint16_t sqtdbl_rsvd;
 153         } b;
 154         uint32_t r;
 155 } nvme_reg_sqtdbl_t;
 156 
 157 /* CQyHDBL -- Completion Queue y Head Doorbell */
 158 typedef union {
 159         struct {
 160                 uint16_t cqhdbl_cqh;    /* Completion Queue Head */
 161                 uint16_t cqhdbl_rsvd;
 162         } b;
 163         uint32_t r;
 164 } nvme_reg_cqhdbl_t;
 165 
 166 /*
 167  * NVMe submission queue entries


 202         } sqe_dptr;                     /* Data Pointer */
 203         uint32_t sqe_cdw10;             /* Number of Dwords in Data Transfer */
 204         uint32_t sqe_cdw11;             /* Number of Dwords in Metadata Xfer */
 205         uint32_t sqe_cdw12;
 206         uint32_t sqe_cdw13;
 207         uint32_t sqe_cdw14;
 208         uint32_t sqe_cdw15;
 209 } nvme_sqe_t;
 210 
 211 /* NVMe admin command opcodes */
 212 #define NVME_OPC_DELETE_SQUEUE  0x0
 213 #define NVME_OPC_CREATE_SQUEUE  0x1
 214 #define NVME_OPC_GET_LOG_PAGE   0x2
 215 #define NVME_OPC_DELETE_CQUEUE  0x4
 216 #define NVME_OPC_CREATE_CQUEUE  0x5
 217 #define NVME_OPC_IDENTIFY       0x6
 218 #define NVME_OPC_ABORT          0x8
 219 #define NVME_OPC_SET_FEATURES   0x9
 220 #define NVME_OPC_GET_FEATURES   0xa
 221 #define NVME_OPC_ASYNC_EVENT    0xc

 222 #define NVME_OPC_FW_ACTIVATE    0x10
 223 #define NVME_OPC_FW_IMAGE_LOAD  0x11









 224 
 225 /* NVMe NVM command set specific admin command opcodes */
 226 #define NVME_OPC_NVM_FORMAT     0x80
 227 #define NVME_OPC_NVM_SEC_SEND   0x81
 228 #define NVME_OPC_NVM_SEC_RECV   0x82
 229 
 230 /* NVMe NVM command opcodes */
 231 #define NVME_OPC_NVM_FLUSH      0x0
 232 #define NVME_OPC_NVM_WRITE      0x1
 233 #define NVME_OPC_NVM_READ       0x2
 234 #define NVME_OPC_NVM_WRITE_UNC  0x4
 235 #define NVME_OPC_NVM_COMPARE    0x5
 236 #define NVME_OPC_NVM_WRITE_ZERO 0x8
 237 #define NVME_OPC_NVM_DSET_MGMT  0x9
 238 #define NVME_OPC_NVM_RESV_REG   0xd
 239 #define NVME_OPC_NVM_RESV_REPRT 0xe
 240 #define NVME_OPC_NVM_RESV_ACQ   0x11
 241 #define NVME_OPC_NVM_RESV_REL   0x12
 242 
 243 /*


 368 
 369 typedef union {
 370         struct {
 371                 uint16_t sq_pc:1;               /* Physically Contiguous */
 372                 uint16_t sq_qprio:2;            /* Queue Priority */
 373                 uint16_t sq_rsvd:13;
 374                 uint16_t sq_cqid;               /* Completion Queue ID */
 375         } b;
 376         uint32_t r;
 377 } nvme_create_sq_dw11_t;
 378 
 379 /*
 380  * NVMe Identify
 381  */
 382 
 383 /* NVMe Identify parameters (cdw10) */
 384 #define NVME_IDENTIFY_NSID      0x0     /* Identify Namespace */
 385 #define NVME_IDENTIFY_CTRL      0x1     /* Identify Controller */
 386 #define NVME_IDENTIFY_LIST      0x2     /* Identify List Namespaces */
 387 





 388 
 389 /*
 390  * NVMe Abort Command
 391  */
 392 typedef union {
 393         struct {
 394                 uint16_t ac_sqid;       /* Submission Queue ID */
 395                 uint16_t ac_cid;        /* Command ID */
 396         } b;
 397         uint32_t r;
 398 } nvme_abort_cmd_t;
 399 
 400 
 401 /*
 402  * NVMe Get Log Page
 403  */
 404 typedef union {
 405         struct {
 406                 uint8_t lp_lid;         /* Log Page Identifier */
 407                 uint8_t lp_rsvd1;
   1 /*
   2  * This file and its contents are supplied under the terms of the
   3  * Common Development and Distribution License ("CDDL"), version 1.0.
   4  * You may only use this file in accordance with the terms of version
   5  * 1.0 of the CDDL.
   6  *
   7  * A full copy of the text of the CDDL should have accompanied this
   8  * source.  A copy of the CDDL is also available via the Internet at
   9  * http://www.illumos.org/license/CDDL.
  10  */
  11 
  12 /*
  13  * Copyright 2016 Nexenta Systems, Inc. All rights reserved.
  14  * Copyright (c) 2018, Joyent, Inc.
  15  */
  16 
  17 /*
  18  * NVMe hardware interface
  19  */
  20 
  21 #ifndef _NVME_REG_H
  22 #define _NVME_REG_H
  23 
  24 #include <sys/nvme.h>
  25 
  26 #pragma pack(1)
  27 
  28 #ifdef __cplusplus
  29 extern "C" {
  30 #endif
  31 
  32 
  33 /*
  34  * NVMe constants
  35  */
  36 #define NVME_MAX_ADMIN_QUEUE_LEN        4096
  37 
  38 /*
  39  * NVMe registers and register fields
  40  */
  41 #define NVME_REG_CAP    0x0             /* Controller Capabilities */
  42 #define NVME_REG_VS     0x8             /* Version */
  43 #define NVME_REG_INTMS  0xc             /* Interrupt Mask Set */
  44 #define NVME_REG_INTMC  0x10            /* Interrupt Mask Clear */
  45 #define NVME_REG_CC     0x14            /* Controller Configuration */
  46 #define NVME_REG_CSTS   0x1c            /* Controller Status */
  47 #define NVME_REG_NSSR   0x20            /* NVM Subsystem Reset */
  48 #define NVME_REG_AQA    0x24            /* Admin Queue Attributes */
  49 #define NVME_REG_ASQ    0x28            /* Admin Submission Queue */
  50 #define NVME_REG_ACQ    0x30            /* Admin Completion Qeueu */
  51 #define NVME_REG_CMBLOC 0x38            /* Controller Memory Buffer Location */
  52 #define NVME_REG_CMBSZ  0x3C            /* Controller Memory Buffer Size */
  53 #define NVME_REG_BPINFO 0x40            /* Boot Partition Information */
  54 #define NVME_REG_BPRSEL 0x44            /* Boot Partition Read Select */
  55 #define NVME_REG_BPMBL  0x48            /* Boot Partition Memory Buffer Loc */
  56 #define NVME_REG_SQTDBL(nvme, n) \
  57         (0x1000 + ((2 * (n)) * nvme->n_doorbell_stride))
  58 #define NVME_REG_CQHDBL(nvme, n) \
  59         (0x1000 + ((2 * (n) + 1) * nvme->n_doorbell_stride))
  60 
  61 #define  NVME_CAP_CSS_NVM       1       /* NVM Command Set */
  62 #define  NVME_CAP_AMS_WRR       1       /* Weighted Round-Robin */
  63 
  64 /* CAP -- Controller Capabilities */
  65 typedef union {
  66         struct {
  67                 uint16_t cap_mqes;      /* Maximum Queue Entries Supported */
  68                 uint8_t cap_cqr:1;      /* Contiguous Queues Required */
  69                 uint8_t cap_ams:2;      /* Arbitration Mechanisms Supported */
  70                 uint8_t cap_rsvd1:5;
  71                 uint8_t cap_to;         /* Timeout */
  72                 uint16_t cap_dstrd:4;   /* Doorbell Stride */
  73                 uint16_t cap_nssrs:1;   /* NVM Subsystem Reset Supported */
  74                 uint16_t cap_css:8;     /* Command Sets Supported */
  75                 uint16_t cap_rsvd2:2;
  76                 uint8_t cap_bps:1;      /* Boot Partition Support */
  77                 uint8_t cap_mpsmin:4;   /* Memory Page Size Minimum */
  78                 uint8_t cap_mpsmax:4;   /* Memory Page Size Maximum */
  79                 uint8_t cap_rsvd3;
  80         } b;
  81         uint64_t r;
  82 } nvme_reg_cap_t;
  83 
  84 /* VS -- Version */
  85 typedef union {
  86         struct {
  87                 uint8_t vs_rsvd;
  88                 uint8_t vs_mnr;         /* Minor Version Number */
  89                 uint16_t vs_mjr;        /* Major Version Number */
  90         } b;
  91         uint32_t r;
  92 } nvme_reg_vs_t;
  93 
  94 /* CC -- Controller Configuration */
  95 #define NVME_CC_SHN_NORMAL      1       /* Normal Shutdown Notification */
  96 #define NVME_CC_SHN_ABRUPT      2       /* Abrupt Shutdown Notification */


 103                 uint16_t cc_mps:4;      /* Memory Page Size */
 104                 uint16_t cc_ams:3;      /* Arbitration Mechanism Selected */
 105                 uint16_t cc_shn:2;      /* Shutdown Notification */
 106                 uint8_t cc_iosqes:4;    /* I/O Submission Queue Entry Size */
 107                 uint8_t cc_iocqes:4;    /* I/O Completion Queue Entry Size */
 108                 uint8_t cc_rsvd2;
 109         } b;
 110         uint32_t r;
 111 } nvme_reg_cc_t;
 112 
 113 /* CSTS -- Controller Status */
 114 #define NVME_CSTS_SHN_OCCURING  1       /* Shutdown Processing Occuring */
 115 #define NVME_CSTS_SHN_COMPLETE  2       /* Shutdown Processing Complete */
 116 
 117 typedef union {
 118         struct {
 119                 uint32_t csts_rdy:1;    /* Ready */
 120                 uint32_t csts_cfs:1;    /* Controller Fatal Status */
 121                 uint32_t csts_shst:2;   /* Shutdown Status */
 122                 uint32_t csts_nssro:1;  /* NVM Subsystem Reset Occured */
 123                 uint32_t csts_pp:1;     /* Processing Paused */
 124                 uint32_t csts_rsvd:26;
 125         } b;
 126         uint32_t r;
 127 } nvme_reg_csts_t;
 128 
 129 /* NSSR -- NVM Subsystem Reset */
 130 #define NVME_NSSR_NSSRC 0x4e564d65      /* NSSR magic value */
 131 typedef uint32_t nvme_reg_nssr_t;
 132 
 133 /* AQA -- Admin Queue Attributes */
 134 typedef union {
 135         struct {
 136                 uint16_t aqa_asqs:12;   /* Admin Submission Queue Size */
 137                 uint16_t aqa_rsvd1:4;
 138                 uint16_t aqa_acqs:12;   /* Admin Completion Queue Size */
 139                 uint16_t aqa_rsvd2:4;
 140         } b;
 141         uint32_t r;
 142 } nvme_reg_aqa_t;
 143 
 144 /*
 145  * The spec specifies the lower 12 bits of ASQ and ACQ as reserved, which is
 146  * probably a specification bug. The full 64bit regs are used as base address,
 147  * and the lower bits must be zero to ensure alignment on the page size
 148  * specified in CC.MPS.
 149  */
 150 /* ASQ -- Admin Submission Queue Base Address */
 151 typedef uint64_t nvme_reg_asq_t;        /* Admin Submission Queue Base */
 152 
 153 /* ACQ -- Admin Completion Queue Base Address */
 154 typedef uint64_t nvme_reg_acq_t;        /* Admin Completion Queue Base */
 155 
 156 /* CMBLOC - Controller Memory Buffer Location */
 157 typedef union {
 158         struct {
 159                 uint32_t cmbloc_bir:3;          /* Base Indicator Register */
 160                 uint32_t cmbloc_rsvd:9;
 161                 uint32_t cmbloc_ofst:20;        /* Offset */
 162         } b;
 163         uint32_t r;
 164 } nvme_reg_cmbloc_t;
 165 
 166 /* CMBSZ - Controller Memory Buffer Size */
 167 typedef union {
 168         struct {
 169                 uint32_t cmbsz_sqs:1;   /* Submission Queue Support */
 170                 uint32_t cmbsz_cqs:1;   /* Completion Queue Support */
 171                 uint32_t cmbsz_lists:1; /* PRP SGL List Support */
 172                 uint32_t cmbsz_rds:1;   /* Read Data Support */
 173                 uint32_t cmbsz_wds:1;   /* Write Data Support */
 174                 uint32_t cmbsz_rsvd:3;
 175                 uint32_t cmbsz_szu:4;   /* Size Units */
 176                 uint32_t cmbsz_sz:20;   /* Size */
 177         } b;
 178         uint32_t r;
 179 } nvme_reg_cmbsz_t;
 180 
 181 /* BPINFO - Boot Partition Information */
 182 typedef union {
 183         struct {
 184                 uint32_t bpinfo_bpsz:15;        /* Boot Partition Size */
 185                 uint32_t bpinfo_rsvd:9;
 186                 uint32_t bpinfo_brs:2;          /* Boot Read Status */
 187                 uint32_t bpinfo_rsvd2:5;
 188                 uint32_t bpinfo_abpid:1;        /* Active Boot Partition ID */
 189         } b;
 190         uint32_t r;
 191 } nvme_reg_bpinfo_t;
 192 
 193 /* BPRSEL - Boot Partition Read Select */
 194 typedef union {
 195         struct {
 196                 uint32_t bprsel_bprsz:10;       /* Boot Partition Read Size */
 197                 uint32_t bprsel_bprof:20;       /* Boot Partition Read Offset */
 198                 uint32_t bprsel_rsvd:1;
 199                 uint32_t bprsel_bpid:1;         /* Boot Partition Identifier */
 200         } b;
 201         uint32_t r;
 202 } nvme_reg_bprsel_t;
 203 
 204 /* BPMBL - Boot Partition Memory Location Buffer Location */
 205 typedef uint64_t nvme_reg_bpbml_t;      /* Memory Buffer Base Address */
 206 
 207 /* SQyTDBL -- Submission Queue y Tail Doorbell */
 208 typedef union {
 209         struct {
 210                 uint16_t sqtdbl_sqt;    /* Submission Queue Tail */
 211                 uint16_t sqtdbl_rsvd;
 212         } b;
 213         uint32_t r;
 214 } nvme_reg_sqtdbl_t;
 215 
 216 /* CQyHDBL -- Completion Queue y Head Doorbell */
 217 typedef union {
 218         struct {
 219                 uint16_t cqhdbl_cqh;    /* Completion Queue Head */
 220                 uint16_t cqhdbl_rsvd;
 221         } b;
 222         uint32_t r;
 223 } nvme_reg_cqhdbl_t;
 224 
 225 /*
 226  * NVMe submission queue entries


 261         } sqe_dptr;                     /* Data Pointer */
 262         uint32_t sqe_cdw10;             /* Number of Dwords in Data Transfer */
 263         uint32_t sqe_cdw11;             /* Number of Dwords in Metadata Xfer */
 264         uint32_t sqe_cdw12;
 265         uint32_t sqe_cdw13;
 266         uint32_t sqe_cdw14;
 267         uint32_t sqe_cdw15;
 268 } nvme_sqe_t;
 269 
 270 /* NVMe admin command opcodes */
 271 #define NVME_OPC_DELETE_SQUEUE  0x0
 272 #define NVME_OPC_CREATE_SQUEUE  0x1
 273 #define NVME_OPC_GET_LOG_PAGE   0x2
 274 #define NVME_OPC_DELETE_CQUEUE  0x4
 275 #define NVME_OPC_CREATE_CQUEUE  0x5
 276 #define NVME_OPC_IDENTIFY       0x6
 277 #define NVME_OPC_ABORT          0x8
 278 #define NVME_OPC_SET_FEATURES   0x9
 279 #define NVME_OPC_GET_FEATURES   0xa
 280 #define NVME_OPC_ASYNC_EVENT    0xc
 281 #define NVME_OPC_NS_MGMT        0xd     /* 1.2 */
 282 #define NVME_OPC_FW_ACTIVATE    0x10
 283 #define NVME_OPC_FW_IMAGE_LOAD  0x11
 284 #define NVME_OPC_SELF_TEST      0x14    /* 1.3 */
 285 #define NVME_OPC_NS_ATTACH      0x15    /* 1.2 */
 286 #define NVME_OPC_KEEP_ALIVE     0x18    /* 1.3 */
 287 #define NVME_OPC_DIRECTIVE_SEND 0x19    /* 1.3 */
 288 #define NVME_OPC_DIRECTIVE_RECV 0x1A    /* 1.3 */
 289 #define NVME_OPC_VIRT_MGMT      0x1C    /* 1.3 */
 290 #define NVME_OPC_NVMEMI_SEND    0x1D    /* 1.3 */
 291 #define NVME_OPC_NVMEMI_RECV    0x1E    /* 1.3 */
 292 #define NVME_OPC_DB_CONFIG      0x7C    /* 1.3 */
 293 
 294 /* NVMe NVM command set specific admin command opcodes */
 295 #define NVME_OPC_NVM_FORMAT     0x80
 296 #define NVME_OPC_NVM_SEC_SEND   0x81
 297 #define NVME_OPC_NVM_SEC_RECV   0x82
 298 
 299 /* NVMe NVM command opcodes */
 300 #define NVME_OPC_NVM_FLUSH      0x0
 301 #define NVME_OPC_NVM_WRITE      0x1
 302 #define NVME_OPC_NVM_READ       0x2
 303 #define NVME_OPC_NVM_WRITE_UNC  0x4
 304 #define NVME_OPC_NVM_COMPARE    0x5
 305 #define NVME_OPC_NVM_WRITE_ZERO 0x8
 306 #define NVME_OPC_NVM_DSET_MGMT  0x9
 307 #define NVME_OPC_NVM_RESV_REG   0xd
 308 #define NVME_OPC_NVM_RESV_REPRT 0xe
 309 #define NVME_OPC_NVM_RESV_ACQ   0x11
 310 #define NVME_OPC_NVM_RESV_REL   0x12
 311 
 312 /*


 437 
 438 typedef union {
 439         struct {
 440                 uint16_t sq_pc:1;               /* Physically Contiguous */
 441                 uint16_t sq_qprio:2;            /* Queue Priority */
 442                 uint16_t sq_rsvd:13;
 443                 uint16_t sq_cqid;               /* Completion Queue ID */
 444         } b;
 445         uint32_t r;
 446 } nvme_create_sq_dw11_t;
 447 
 448 /*
 449  * NVMe Identify
 450  */
 451 
 452 /* NVMe Identify parameters (cdw10) */
 453 #define NVME_IDENTIFY_NSID      0x0     /* Identify Namespace */
 454 #define NVME_IDENTIFY_CTRL      0x1     /* Identify Controller */
 455 #define NVME_IDENTIFY_LIST      0x2     /* Identify List Namespaces */
 456 
 457 #define NVME_IDENTIFY_NSID_ALLOC_LIST   0x10    /* List Allocated NSID */
 458 #define NVME_IDENTIFY_NSID_ALLOC        0x11    /* Identify Allocated NSID */
 459 #define NVME_IDENTIFY_NSID_CTRL_LIST    0x12    /* List Controllers on NSID */
 460 #define NVME_IDENTIFY_CTRL_LIST         0x13    /* Controller List */
 461 #define NVME_IDENTIFY_PRIMARY_CAPS      0x14    /* Primary Controller Caps */
 462 
 463 /*
 464  * NVMe Abort Command
 465  */
 466 typedef union {
 467         struct {
 468                 uint16_t ac_sqid;       /* Submission Queue ID */
 469                 uint16_t ac_cid;        /* Command ID */
 470         } b;
 471         uint32_t r;
 472 } nvme_abort_cmd_t;
 473 
 474 
 475 /*
 476  * NVMe Get Log Page
 477  */
 478 typedef union {
 479         struct {
 480                 uint8_t lp_lid;         /* Log Page Identifier */
 481                 uint8_t lp_rsvd1;