nvme.h: add support for ns write protect definitions

Add various definitions from NVMe 1.3 TP 4005.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
Chaitanya Kulkarni 2018-08-07 23:01:05 -07:00 committed by Christoph Hellwig
parent 8b92d0e3d4
commit 93045d5942
1 changed files with 15 additions and 2 deletions

View File

@ -259,7 +259,7 @@ struct nvme_id_ctrl {
__le16 awun;
__le16 awupf;
__u8 nvscc;
__u8 rsvd531;
__u8 nwpc;
__le16 acwu;
__u8 rsvd534[2];
__le32 sgls;
@ -320,7 +320,9 @@ struct nvme_id_ns {
__u8 nvmcap[16];
__u8 rsvd64[28];
__le32 anagrpid;
__u8 rsvd96[8];
__u8 rsvd96[3];
__u8 nsattr;
__u8 rsvd100[4];
__u8 nguid[16];
__u8 eui64[8];
struct nvme_lbaf lbaf[16];
@ -794,6 +796,7 @@ enum {
NVME_FEAT_HOST_ID = 0x81,
NVME_FEAT_RESV_MASK = 0x82,
NVME_FEAT_RESV_PERSIST = 0x83,
NVME_FEAT_WRITE_PROTECT = 0x84,
NVME_LOG_ERROR = 0x01,
NVME_LOG_SMART = 0x02,
NVME_LOG_FW_SLOT = 0x03,
@ -807,6 +810,14 @@ enum {
NVME_FWACT_ACTV = (2 << 3),
};
/* NVMe Namespace Write Protect State */
enum {
NVME_NS_NO_WRITE_PROTECT = 0,
NVME_NS_WRITE_PROTECT,
NVME_NS_WRITE_PROTECT_POWER_CYCLE,
NVME_NS_WRITE_PROTECT_PERMANENT,
};
#define NVME_MAX_CHANGED_NAMESPACES 1024
struct nvme_identify {
@ -1153,6 +1164,8 @@ enum {
NVME_SC_SGL_INVALID_OFFSET = 0x16,
NVME_SC_SGL_INVALID_SUBTYPE = 0x17,
NVME_SC_NS_WRITE_PROTECTED = 0x20,
NVME_SC_LBA_RANGE = 0x80,
NVME_SC_CAP_EXCEEDED = 0x81,
NVME_SC_NS_NOT_READY = 0x82,