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-8020 illumos nvme changes
Reviewed by: Dan Fields <dan.fields@nexenta.com>
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
NEX-5792 support NVMe namespace EUI64
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
NEX-6132 nvmeadm(1M) get-feature command could use some cleanup
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
NEX-6130 basic NVMe 1.1 support
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
NEX-4431 want NVMe management utility
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/sys/nvme.h
          +++ new/usr/src/uts/common/sys/nvme.h
↓ open down ↓ 3 lines elided ↑ open up ↑
   4    4   * You may only use this file in accordance with the terms of version
   5    5   * 1.0 of the CDDL.
   6    6   *
   7    7   * A full copy of the text of the CDDL should have accompanied this
   8    8   * source.  A copy of the CDDL is also available via the Internet at
   9    9   * http://www.illumos.org/license/CDDL.
  10   10   */
  11   11  
  12   12  /*
  13   13   * Copyright 2016 Nexenta Systems, Inc.
       14 + * Copyright (c) 2018, Joyent, Inc.
  14   15   */
  15   16  
  16   17  #ifndef _SYS_NVME_H
  17   18  #define _SYS_NVME_H
  18   19  
  19   20  #include <sys/types.h>
  20   21  
  21   22  #ifdef _KERNEL
  22   23  #include <sys/types32.h>
  23   24  #else
↓ open down ↓ 91 lines elided ↑ open up ↑
 115  116          uint32_t psd_enlat;             /* Entry Latency */
 116  117          uint32_t psd_exlat;             /* Exit Latency */
 117  118          uint8_t psd_rrt:5;              /* Relative Read Throughput */
 118  119          uint8_t psd_rsvd3:3;
 119  120          uint8_t psd_rrl:5;              /* Relative Read Latency */
 120  121          uint8_t psd_rsvd4:3;
 121  122          uint8_t psd_rwt:5;              /* Relative Write Throughput */
 122  123          uint8_t psd_rsvd5:3;
 123  124          uint8_t psd_rwl:5;              /* Relative Write Latency */
 124  125          uint8_t psd_rsvd6:3;
 125      -        uint8_t psd_rsvd7[16];
      126 +        uint16_t psd_idlp;              /* Idle Power (1.2) */
      127 +        uint8_t psd_rsvd7:6;
      128 +        uint8_t psd_ips:2;              /* Idle Power Scale (1.2) */
      129 +        uint8_t psd_rsvd8;
      130 +        uint16_t psd_actp;              /* Active Power (1.2) */
      131 +        uint8_t psd_apw:3;              /* Active Power Workload (1.2) */
      132 +        uint8_t psd_rsvd9:3;
      133 +        uint8_t psd_aps:2;              /* Active Power Scale */
      134 +        uint8_t psd_rsvd10[9];
 126  135  } nvme_idctl_psd_t;
 127  136  
 128  137  /* NVMe Identify Controller Data Structure */
 129  138  typedef struct {
 130  139          /* Controller Capabilities & Features */
 131  140          uint16_t id_vid;                /* PCI vendor ID */
 132      -        uint16_t id_ssvid;              /* PCI subsystem vendor ID */
      141 +        uint16_t id_ssvid;              /* PCI subsystem vendor ID */
 133  142          char id_serial[20];             /* Serial Number */
 134  143          char id_model[40];              /* Model Number */
 135  144          char id_fwrev[8];               /* Firmware Revision */
 136  145          uint8_t id_rab;                 /* Recommended Arbitration Burst */
 137  146          uint8_t id_oui[3];              /* vendor IEEE OUI */
 138  147          struct {                        /* Multi-Interface Capabilities */
 139  148                  uint8_t m_multi_pci:1;  /* HW has multiple PCIe interfaces */
 140  149                  uint8_t m_multi_ctrl:1; /* HW has multiple controllers (1.1) */
 141  150                  uint8_t m_sr_iov:1;     /* controller is SR-IOV virt fn (1.1) */
 142  151                  uint8_t m_rsvd:5;
 143  152          } id_mic;
 144  153          uint8_t id_mdts;                /* Maximum Data Transfer Size */
 145  154          uint16_t id_cntlid;             /* Unique Controller Identifier (1.1) */
 146      -        uint8_t id_rsvd_cc[256 - 80];
      155 +        /* Added in NVMe 1.2 */
      156 +        uint32_t id_ver;                /* Version */
      157 +        uint32_t id_rtd3r;              /* RTD3 Resume Latency */
      158 +        uint32_t id_rtd3e;              /* RTD3 Entry Latency */
      159 +        uint32_t id_oaes;               /* Optional Asynchronous Events */
      160 +        /* Added in NVMe 1.3 */
      161 +        uint32_t id_ctratt;             /* Controller Attributes */
      162 +        uint8_t id_rsvd_cc[12];
      163 +        uint8_t id_frguid[16];          /* FRU GUID */
      164 +        uint8_t id_rsvd2_cc[240 - 128];
      165 +        uint8_t id_rsvd_nvmemi[255 - 240];
      166 +        uint8_t id_mec;                 /* Management Endpiont Capabilities */
 147  167  
 148  168          /* Admin Command Set Attributes */
 149  169          struct {                        /* Optional Admin Command Support */
 150  170                  uint16_t oa_security:1; /* Security Send & Receive */
 151  171                  uint16_t oa_format:1;   /* Format NVM */
 152  172                  uint16_t oa_firmware:1; /* Firmware Activate & Download */
 153  173                  uint16_t oa_rsvd:13;
 154  174          } id_oacs;
 155  175          uint8_t id_acl;                 /* Abort Command Limit */
 156  176          uint8_t id_aerl;                /* Asynchronous Event Request Limit */
↓ open down ↓ 9 lines elided ↑ open up ↑
 166  186          uint8_t id_elpe;                /* Error Log Page Entries */
 167  187          uint8_t id_npss;                /* Number of Power States */
 168  188          struct {                        /* Admin Vendor Specific Command Conf */
 169  189                  uint8_t av_spec:1;      /* use format from spec */
 170  190                  uint8_t av_rsvd:7;
 171  191          } id_avscc;
 172  192          struct {                        /* Autonomous Power State Trans (1.1) */
 173  193                  uint8_t ap_sup:1;       /* APST supported (1.1) */
 174  194                  uint8_t ap_rsvd:7;
 175  195          } id_apsta;
 176      -        uint8_t id_rsvd_ac[256 - 10];
      196 +        /* Added in NVMe 1.2 */
      197 +        uint16_t ap_wctemp;             /* Warning Composite Temperature */
      198 +        uint16_t ap_cctemp;             /* Critical Composite Temperature */
      199 +        uint16_t ap_mtfa;               /* Maximum Firmware Activation Time */
      200 +        uint32_t ap_hmpre;              /* Host Memory Buffer Preferred Size */
      201 +        uint32_t ap_hmmin;              /* Host Memory Buffer Min Size */
      202 +        uint8_t ap_tnvmcap[16];         /* Total NVM Capacity in Bytes */
      203 +        uint8_t ap_unvmcap[16];         /* Unallocated NVM Capacity */
      204 +        uint32_t ap_rpmbs;              /* Replay Protected Memory Block */
      205 +        /* Added in NVMe 1.3 */
      206 +        uint16_t ap_edstt;              /* Extended Device Self-test time */
      207 +        uint8_t ap_dsto;                /* Device Self-test Options */
      208 +        uint8_t ap_fwug;                /* Firmware Update Granularity */
      209 +        uint16_t ap_kas;                /* Keep Alive Support */
      210 +        uint16_t ap_hctma;              /* Host Thermal Management */
      211 +        uint16_t ap_mntmt;              /* Minimum Thermal Temperature */
      212 +        uint16_t ap_mxtmt;              /* Maximum Thermal Temperature */
      213 +        uint32_t ap_sanitize;           /* Sanitize Caps */
      214 +        uint8_t id_rsvd_ac[512 - 332];
 177  215  
 178  216          /* NVM Command Set Attributes */
 179  217          nvme_idctl_qes_t id_sqes;       /* Submission Queue Entry Size */
 180  218          nvme_idctl_qes_t id_cqes;       /* Completion Queue Entry Size */
 181      -        uint16_t id_rsvd_nc_1;
      219 +        uint16_t id_maxcmd;             /* Max Outstanding Commands (1.3) */
 182  220          uint32_t id_nn;                 /* Number of Namespaces */
 183  221          struct {                        /* Optional NVM Command Support */
 184  222                  uint16_t on_compare:1;  /* Compare */
 185  223                  uint16_t on_wr_unc:1;   /* Write Uncorrectable */
 186  224                  uint16_t on_dset_mgmt:1; /* Dataset Management */
 187  225                  uint16_t on_wr_zero:1;  /* Write Zeros (1.1) */
 188  226                  uint16_t on_save:1;     /* Save/Select in Get/Set Feat (1.1) */
 189  227                  uint16_t on_reserve:1;  /* Reservations (1.1) */
 190  228                  uint16_t on_rsvd:10;
 191  229          } id_oncs;
↓ open down ↓ 19 lines elided ↑ open up ↑
 211  249          } id_nvscc;
 212  250          uint8_t id_rsvd_nc_2;
 213  251          uint16_t id_acwu;               /* Atomic Compare & Write Unit (1.1) */
 214  252          uint16_t id_rsvd_nc_3;
 215  253          struct {                        /* SGL Support (1.1) */
 216  254                  uint16_t sgl_sup:1;     /* SGL Supported in NVM cmds (1.1) */
 217  255                  uint16_t sgl_rsvd1:15;
 218  256                  uint16_t sgl_bucket:1;  /* SGL Bit Bucket supported (1.1) */
 219  257                  uint16_t sgl_rsvd2:15;
 220  258          } id_sgls;
 221      -        uint8_t id_rsvd_nc_4[192 - 28];
      259 +        uint8_t id_rsvd_nc_4[768 - 540];
 222  260  
 223  261          /* I/O Command Set Attributes */
 224      -        uint8_t id_rsvd_ioc[1344];
      262 +        uint8_t id_subnqn[1024 - 768];  /* Subsystem Qualified Name (1.2.1+) */
      263 +        uint8_t id_rsvd_ioc[1792 - 1024];
      264 +        uint8_t id_nvmof[2048 - 1792];  /* NVMe over Fabrics */
 225  265  
 226  266          /* Power State Descriptors */
 227  267          nvme_idctl_psd_t id_psd[32];
 228  268  
 229  269          /* Vendor Specific */
 230  270          uint8_t id_vs[1024];
 231  271  } nvme_identify_ctrl_t;
 232  272  
 233  273  /* NVMe Identify Namespace LBA Format */
 234  274  typedef struct {
↓ open down ↓ 43 lines elided ↑ open up ↑
 278  318          struct {                        /* Reservation Capabilities (1.1) */
 279  319                  uint8_t rc_persist:1;   /* Persist Through Power Loss (1.1) */
 280  320                  uint8_t rc_wr_excl:1;   /* Write Exclusive (1.1) */
 281  321                  uint8_t rc_excl:1;      /* Exclusive Access (1.1) */
 282  322                  uint8_t rc_wr_excl_r:1; /* Wr Excl - Registrants Only (1.1) */
 283  323                  uint8_t rc_excl_r:1;    /* Excl Acc - Registrants Only (1.1) */
 284  324                  uint8_t rc_wr_excl_a:1; /* Wr Excl - All Registrants (1.1) */
 285  325                  uint8_t rc_excl_a:1;    /* Excl Acc - All Registrants (1.1) */
 286  326                  uint8_t rc_rsvd:1;
 287  327          } id_rescap;
 288      -        uint8_t id_rsvd1[120 - 32];
      328 +        uint8_t id_fpi;                 /* Format Progress Indicator (1.2) */
      329 +        uint8_t id_dfleat;              /* Deallocate Log. Block (1.3) */
      330 +        uint16_t id_nawun;              /* Atomic Write Unit Normal (1.2) */
      331 +        uint16_t id_nawupf;             /* Atomic Write Unit Power Fail (1.2) */
      332 +        uint16_t id_nacwu;              /* Atomic Compare & Write Unit (1.2) */
      333 +        uint16_t id_nabsn;              /* Atomic Boundary Size Normal (1.2) */
      334 +        uint16_t id_nbao;               /* Atomic Boundary Offset (1.2) */
      335 +        uint16_t id_nabspf;             /* Atomic Boundary Size Fail (1.2) */
      336 +        uint16_t id_noiob;              /* Optimal I/O Bondary (1.3) */
      337 +        uint8_t id_nvmcap[16];          /* NVM Capacity */
      338 +        uint8_t id_rsvd1[104 - 64];
      339 +        uint8_t id_nguid[16];           /* Namespace GUID (1.2) */
 289  340          uint8_t id_eui64[8];            /* IEEE Extended Unique Id (1.1) */
 290  341          nvme_idns_lbaf_t id_lbaf[16];   /* LBA Formats */
 291  342  
 292      -        uint8_t id_rsvd2[192];
      343 +        uint8_t id_rsvd2[384 - 192];
 293  344  
 294      -        uint8_t id_vs[3712];            /* Vendor Specific */
      345 +        uint8_t id_vs[4096 - 384];      /* Vendor Specific */
 295  346  } nvme_identify_nsid_t;
 296  347  
      348 +/* NVMe Identify Primary Controller Capabilities */
      349 +typedef struct {
      350 +        uint16_t        nipc_cntlid;    /* Controller ID */
      351 +        uint16_t        nipc_portid;    /* Port Identifier */
      352 +        uint8_t         nipc_crt;       /* Controller Resource Types */
      353 +        uint8_t         nipc_rsvd0[32 - 5];
      354 +        uint32_t        nipc_vqfrt;     /* VQ Resources Flexible Total */
      355 +        uint32_t        nipc_vqrfa;     /* VQ Resources Flexible Assigned */
      356 +        uint16_t        nipc_vqrfap;    /* VQ Resources to Primary */
      357 +        uint16_t        nipc_vqprt;     /* VQ Resources Private Total */
      358 +        uint16_t        nipc_vqfrsm;    /* VQ Resources Secondary Max */
      359 +        uint16_t        nipc_vqgran;    /* VQ Flexible Resource Gran */
      360 +        uint8_t         nipc_rvsd1[64 - 48];
      361 +        uint32_t        nipc_vifrt;     /* VI Flexible total */
      362 +        uint32_t        nipc_virfa;     /* VI Flexible Assigned */
      363 +        uint16_t        nipc_virfap;    /* VI Flexible Allocatd to Primary */
      364 +        uint16_t        nipc_viprt;     /* VI Resources Private Total */
      365 +        uint16_t        nipc_vifrsm;    /* VI Resources Secondary Max */
      366 +        uint16_t        nipc_vigran;    /* VI Flexible Granularity */
      367 +        uint8_t         nipc_rsvd2[4096 - 80];
      368 +} nvme_identify_primary_caps_t;
 297  369  
 298  370  /*
 299  371   * NVMe completion queue entry status field
 300  372   */
 301  373  typedef struct {
 302  374          uint16_t sf_p:1;                /* Phase Tag */
 303  375          uint16_t sf_sc:8;               /* Status Code */
 304  376          uint16_t sf_sct:3;              /* Status Code Type */
 305  377          uint16_t sf_rsvd2:2;
 306  378          uint16_t sf_m:1;                /* More */
↓ open down ↓ 268 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX