xref: /dflybsd-src/sys/dev/disk/nvme/nvme_ident.h (revision 70394f3fc7eef7464f17a594fdb1761670f93860)
197a077a0SMatthew Dillon /*
297a077a0SMatthew Dillon  * Copyright (c) 2016 The DragonFly Project.  All rights reserved.
397a077a0SMatthew Dillon  *
497a077a0SMatthew Dillon  * This code is derived from software contributed to The DragonFly Project
597a077a0SMatthew Dillon  * by Matthew Dillon <dillon@backplane.com>
697a077a0SMatthew Dillon  *
797a077a0SMatthew Dillon  * Redistribution and use in source and binary forms, with or without
897a077a0SMatthew Dillon  * modification, are permitted provided that the following conditions
997a077a0SMatthew Dillon  * are met:
1097a077a0SMatthew Dillon  *
1197a077a0SMatthew Dillon  * 1. Redistributions of source code must retain the above copyright
1297a077a0SMatthew Dillon  *    notice, this list of conditions and the following disclaimer.
1397a077a0SMatthew Dillon  * 2. Redistributions in binary form must reproduce the above copyright
1497a077a0SMatthew Dillon  *    notice, this list of conditions and the following disclaimer in
1597a077a0SMatthew Dillon  *    the documentation and/or other materials provided with the
1697a077a0SMatthew Dillon  *    distribution.
1797a077a0SMatthew Dillon  * 3. Neither the name of The DragonFly Project nor the names of its
1897a077a0SMatthew Dillon  *    contributors may be used to endorse or promote products derived
1997a077a0SMatthew Dillon  *    from this software without specific, prior written permission.
2097a077a0SMatthew Dillon  *
2197a077a0SMatthew Dillon  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2297a077a0SMatthew Dillon  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2397a077a0SMatthew Dillon  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
2497a077a0SMatthew Dillon  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
2597a077a0SMatthew Dillon  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
2697a077a0SMatthew Dillon  * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
2797a077a0SMatthew Dillon  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
2897a077a0SMatthew Dillon  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
2997a077a0SMatthew Dillon  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
3097a077a0SMatthew Dillon  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
3197a077a0SMatthew Dillon  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3297a077a0SMatthew Dillon  * SUCH DAMAGE.
3397a077a0SMatthew Dillon  */
3497a077a0SMatthew Dillon 
3597a077a0SMatthew Dillon typedef struct {
3697a077a0SMatthew Dillon 	/* TODO (Fig 91 - Identify Power State Descriptor Data Structure) */
3797a077a0SMatthew Dillon 	uint8_t		filler[32];
3897a077a0SMatthew Dillon } __packed nvme_pwstate_data_t;
3997a077a0SMatthew Dillon 
4097a077a0SMatthew Dillon /*
4197a077a0SMatthew Dillon  * NVME Identify Command data response structures
4297a077a0SMatthew Dillon  */
4397a077a0SMatthew Dillon typedef struct {
4497a077a0SMatthew Dillon 	/*
4597a077a0SMatthew Dillon 	 * Controller Capabilities and Features
4697a077a0SMatthew Dillon 	 */
4797a077a0SMatthew Dillon 	uint16_t	pci_vendor;
4897a077a0SMatthew Dillon 	uint16_t	pci_subsys;
4997a077a0SMatthew Dillon 	uint8_t		serialno[20];	/* ascii string */
5097a077a0SMatthew Dillon 	uint8_t		modelno[40];	/* ascii string */
5197a077a0SMatthew Dillon 
5297a077a0SMatthew Dillon 	uint64_t	fwrev;		/* firmware revision */
5397a077a0SMatthew Dillon 	uint8_t		arb_burst;	/* recommended arbitration burst */
5497a077a0SMatthew Dillon 	uint8_t		ieee_oui[3];	/* IEEE OUI identifier */
5597a077a0SMatthew Dillon 	uint8_t		cmic_caps;	/* multi-path / ns sharing caps */
5697a077a0SMatthew Dillon 	uint8_t		mdts;		/* max data xfer size 2^N x mempgsiz */
5797a077a0SMatthew Dillon 
5897a077a0SMatthew Dillon 	uint16_t	cntlid;		/* unique controller id */
5997a077a0SMatthew Dillon 	uint32_t	vers;		/* (copy of version register) */
6097a077a0SMatthew Dillon 	uint32_t	rtd3r;		/* typical resume latency uS */
6197a077a0SMatthew Dillon 	uint32_t	rtd3e;		/* typical entry latency uS */
6297a077a0SMatthew Dillon 	uint32_t	async_cap;	/* (opt) async capabilities */
6397a077a0SMatthew Dillon 	uint8_t		reserved96[144];
6497a077a0SMatthew Dillon 
6597a077a0SMatthew Dillon 	char		mgmt_ifc[16];	/* NVMe Manage Interface spec */
6697a077a0SMatthew Dillon 
6797a077a0SMatthew Dillon 	/*
6897a077a0SMatthew Dillon 	 * Admin Command Set Attributes and Optional Controller Capabilities
6997a077a0SMatthew Dillon 	 */
7097a077a0SMatthew Dillon 	uint16_t	admin_cap;
7197a077a0SMatthew Dillon 	uint8_t		abort_lim;	/* max concurrent aborts */
7297a077a0SMatthew Dillon 	uint8_t		async_lim;	/* max concurrent async event reqs */
7397a077a0SMatthew Dillon 	uint8_t		fwupd_caps;	/* firmware update capabilities */
7497a077a0SMatthew Dillon 	uint8_t		logpg_attr;
7597a077a0SMatthew Dillon 	uint8_t		logpg_error_entries; /* #of error log ent supported */
7697a077a0SMatthew Dillon 	uint8_t		num_power_states; /* number of power states supported*/
7797a077a0SMatthew Dillon 	uint8_t		avscc;		/* formatting convention for vendor */
7897a077a0SMatthew Dillon 					/* specific commands */
7997a077a0SMatthew Dillon 	uint8_t		apsta;		/* autonomous power states supported */
8097a077a0SMatthew Dillon 	uint16_t	warn_comp_temp;	/* warning comp temp threshold 0=unimp*/
8197a077a0SMatthew Dillon 	uint16_t	crit_comp_temp;	/* warning comp temp threshold 0=unimp*/
8297a077a0SMatthew Dillon 	uint16_t	fw_act_maxtime;	/* max act time N x 100ms, 0=unknown */
8397a077a0SMatthew Dillon 	uint32_t	hmpre;		/* host mem buf requested size */
8497a077a0SMatthew Dillon 	uint32_t	hmmin;		/* host mem buf minimum size */
8597a077a0SMatthew Dillon 	uint64_t	total_capacity[2]; /* 16-byte field, cap in bytes */
8697a077a0SMatthew Dillon 	uint64_t	unalloc_capacity[2]; /* 16-byte field, avail to alloc */
8797a077a0SMatthew Dillon 					     /* for namespace attachment */
8897a077a0SMatthew Dillon #if _BYTE_ORDER == _LITTLE_ENDIAN
8997a077a0SMatthew Dillon 	uint16_t	reply_flags;
9097a077a0SMatthew Dillon 	uint8_t		replay_tot_size; /* each RPMB in 128KB units, 0=128KB */
9197a077a0SMatthew Dillon 	uint8_t		replay_acc_size; /* each RPMB security send/recv */
9297a077a0SMatthew Dillon 					 /*  in 512B units, 0=512B */
9397a077a0SMatthew Dillon #else
9497a077a0SMatthew Dillon 	uint8_t		replay_acc_size;
9597a077a0SMatthew Dillon 	uint8_t		replay_tot_size;
9697a077a0SMatthew Dillon 	uint16_t	reply_flags;
9797a077a0SMatthew Dillon #endif
9897a077a0SMatthew Dillon 	uint8_t		reserved316[196];
9997a077a0SMatthew Dillon 
10097a077a0SMatthew Dillon 	/*
10197a077a0SMatthew Dillon 	 * NVM Command Set Attributes (starting at offset 512)
10297a077a0SMatthew Dillon 	 */
10397a077a0SMatthew Dillon 	uint8_t		subq_entry_size;	/* see defines */
10497a077a0SMatthew Dillon 	uint8_t		comq_entry_size;	/* see defines */
10597a077a0SMatthew Dillon 	uint8_t		reserved514;
10697a077a0SMatthew Dillon 	uint8_t		reserved515;
10797a077a0SMatthew Dillon 	uint32_t	ns_count;		/* number of valid namespaces */
10897a077a0SMatthew Dillon 	uint16_t	nvm_opt_cap;		/* optional nvm I/O cmds */
10997a077a0SMatthew Dillon 	uint16_t	nvm_fuse_cap;		/* optional nvm fuse cmds */
11097a077a0SMatthew Dillon 	uint8_t		nvm_format_cap;
11197a077a0SMatthew Dillon 	uint8_t		vwc_flags;		/* volatile write cache caps */
11297a077a0SMatthew Dillon 	uint16_t	atomic_wun;		/* atomic write guarantee */
11397a077a0SMatthew Dillon 						/* log blocks, 0 = 1 block */
11497a077a0SMatthew Dillon 	uint16_t	atomic_wupf;		/* guarante during power fail*/
11597a077a0SMatthew Dillon 						/* log blocks, 0 = 1 block */
11697a077a0SMatthew Dillon 	uint8_t		nvscc;			/* convention for vendor */
11797a077a0SMatthew Dillon 						/* specific NVM commands */
11897a077a0SMatthew Dillon 	uint8_t		reserved531;
11997a077a0SMatthew Dillon 	uint16_t	atomic_cwu;		/* atomic comp+write guarantee*/
12097a077a0SMatthew Dillon 	uint16_t	reserved534;
12197a077a0SMatthew Dillon 	uint32_t	sgls;			/* SGL support */
12297a077a0SMatthew Dillon 	uint8_t		reserved540[164];
12397a077a0SMatthew Dillon 
12497a077a0SMatthew Dillon 	/*
12597a077a0SMatthew Dillon 	 * I/O Command Set Attributes (offset 704)
12697a077a0SMatthew Dillon 	 */
12797a077a0SMatthew Dillon 	uint8_t		reserved704[1344];
12897a077a0SMatthew Dillon 
12997a077a0SMatthew Dillon 	/*
13097a077a0SMatthew Dillon 	 * Power State Descriptors (offset 2048)
13197a077a0SMatthew Dillon 	 */
13297a077a0SMatthew Dillon 	nvme_pwstate_data_t pwrdescs[32];
13397a077a0SMatthew Dillon 
13497a077a0SMatthew Dillon 	/*
13597a077a0SMatthew Dillon 	 * Vendor Specific (offset 3072)
13697a077a0SMatthew Dillon 	 */
13797a077a0SMatthew Dillon 	uint8_t		vendor3072[1024];
13897a077a0SMatthew Dillon } __packed nvme_ident_ctlr_data_t;
13997a077a0SMatthew Dillon 
140*70394f3fSMatthew Dillon /*
141*70394f3fSMatthew Dillon  * Controller list format
142*70394f3fSMatthew Dillon  */
143*70394f3fSMatthew Dillon typedef struct {
144*70394f3fSMatthew Dillon 	uint16_t	idcount;	/* 2047 max */
145*70394f3fSMatthew Dillon 	uint16_t	ctlrids[2047];	/* N controller ids */
146*70394f3fSMatthew Dillon } __packed nvme_ident_ctlr_list_t;
147*70394f3fSMatthew Dillon 
148*70394f3fSMatthew Dillon typedef struct {
149*70394f3fSMatthew Dillon 	uint32_t	nsids[1024];	/* N namespace ids */
150*70394f3fSMatthew Dillon } __packed nvme_ident_ns_list_t;
151*70394f3fSMatthew Dillon 
15297a077a0SMatthew Dillon #define NVME_CMIC_80		0x80
15397a077a0SMatthew Dillon #define NVME_CMIC_40		0x40
15497a077a0SMatthew Dillon #define NVME_CMIC_20		0x20
15597a077a0SMatthew Dillon #define NVME_CMIC_10		0x10
15697a077a0SMatthew Dillon #define NVME_CMIC_08		0x08
15797a077a0SMatthew Dillon #define NVME_CMIC_CTLR_VIRTUAL	0x04	/* controller assoc w/virtual funct */
15897a077a0SMatthew Dillon #define NVME_CMIC_MULTI_CTLR	0x02	/* subsystem has 2+ controllers */
15997a077a0SMatthew Dillon #define NVME_CMIC_MULTI_PCI	0x01	/* subsystem has 2+ PCIe ports */
16097a077a0SMatthew Dillon 
16197a077a0SMatthew Dillon #define NVME_ASYNC_NSATTRCHG	0x00000100U /* supports ns attr chg event */
16297a077a0SMatthew Dillon 
163*70394f3fSMatthew Dillon #define NVME_ADMIN_NSMANAGE	0x0008U	/* admin_cap */
16497a077a0SMatthew Dillon #define NVME_ADMIN_FWIMG	0x0004U
16597a077a0SMatthew Dillon #define NVME_ADMIN_FORMAT	0x0002U
16697a077a0SMatthew Dillon #define NVME_ADMIN_SECURITY	0x0001U
16797a077a0SMatthew Dillon 
16897a077a0SMatthew Dillon #define NVME_FWUPD_FWACT_NORST	0x10	/* fw activation without reset */
16997a077a0SMatthew Dillon #define NVME_FWUPD_SLTCNT_MASK	0x0E	/* fw slots */
17097a077a0SMatthew Dillon #define NVME_FWUPD_SLOT1RO	0x01	/* slot 1 (first slot) is RO */
17197a077a0SMatthew Dillon 
17297a077a0SMatthew Dillon #define NVME_FWUPD_SLTCNT_GET(data)	\
17397a077a0SMatthew Dillon 		(((data) & NVME_FWUPD_SLTCNT_MASK) >> 1)
17497a077a0SMatthew Dillon 
17597a077a0SMatthew Dillon #define NVME_LOGPG_ATTR_CMDEFF	0x02	/* supports command effects log pg */
17697a077a0SMatthew Dillon #define NVME_LOGPG_ATTR_SMART	0x01	/* supports SMART log pg */
17797a077a0SMatthew Dillon 
17897a077a0SMatthew Dillon #define NVME_AVSCC_ALLUSEFIG13	0x01	/* all use standard format (fig13) */
17997a077a0SMatthew Dillon 
18097a077a0SMatthew Dillon #define NVME_APSTA_SUPPORTED	0x01	/* supports autonomous transitions */
18197a077a0SMatthew Dillon 
18297a077a0SMatthew Dillon #define NVME_REPLAY_AUTH_MASK	0x0038
18397a077a0SMatthew Dillon #define NVME_REPLAY_RPMB_MASK	0x0007
18497a077a0SMatthew Dillon 
18597a077a0SMatthew Dillon #define NVME_REPLAY_RPMB_GET(data)	\
18697a077a0SMatthew Dillon 		((data) & NVME_REPLAY_RPMB_MASK)
18797a077a0SMatthew Dillon #define NVME_REPLAY_AUTH_GET(data)	\
18897a077a0SMatthew Dillon 		(((data) & NVME_REPLAY_AUTH_MASK) >> 3)
18997a077a0SMatthew Dillon 
19097a077a0SMatthew Dillon #define NVME_REPLY_AUTH_HMAC_SHA256	0
19197a077a0SMatthew Dillon 					/* 1-7 reserved */
19297a077a0SMatthew Dillon 
19397a077a0SMatthew Dillon /*
19497a077a0SMatthew Dillon  * Defines for NVM Command set Attributes
19597a077a0SMatthew Dillon  */
19697a077a0SMatthew Dillon #define NVME_QENTRY_MAX_MASK	0xF0	/* subq_entry_size & comq_entry_size */
19797a077a0SMatthew Dillon #define NVME_QENTRY_REQ_MASK	0x0F	/* subq_entry_size & comq_entry_size */
19897a077a0SMatthew Dillon 
19997a077a0SMatthew Dillon #define NVME_QENTRY_MAX_GET(data)	\
20097a077a0SMatthew Dillon 		(1 << (((data) & NVME_QENTRY_MAX_MASK) >> 4))
20197a077a0SMatthew Dillon #define NVME_QENTRY_REQ_GET(data)	\
20297a077a0SMatthew Dillon 		(1 << ((data) & NVME_QENTRY_REQ_MASK))
20397a077a0SMatthew Dillon 
20497a077a0SMatthew Dillon #define NVME_NVMCAP_RESERVATIONS	0x0020
20597a077a0SMatthew Dillon #define NVME_NVMCAP_SETFEATSAVE		0x0010
20697a077a0SMatthew Dillon #define NVME_NVMCAP_WRITEZEROS		0x0008
20797a077a0SMatthew Dillon #define NVME_NVMCAP_DSETMGMT		0x0004
20897a077a0SMatthew Dillon #define NVME_NVMCAP_WRITEUNCORR		0x0002
20997a077a0SMatthew Dillon #define NVME_NVMCAP_COMPARE		0x0001
21097a077a0SMatthew Dillon 
21197a077a0SMatthew Dillon #define NVME_FUSECAP_CMPWRITE		0x0001
21297a077a0SMatthew Dillon 
21397a077a0SMatthew Dillon #define NVME_FORMATCAP_CRYPTO		0x04	/* supported as part of secure*/
21497a077a0SMatthew Dillon 						/* erase functionality */
21597a077a0SMatthew Dillon #define NVME_FORMATCAP_CRYPTOALLNS	0x02	/* crypto erase to all ns's */
21697a077a0SMatthew Dillon #define NVME_FORMATCAP_FMTALLNS		0x01	/* fmt applies to all ns's */
21797a077a0SMatthew Dillon 
21897a077a0SMatthew Dillon #define NVME_VWC_PRESENT		0x01
21997a077a0SMatthew Dillon 
22097a077a0SMatthew Dillon #define NVME_SGLS_EXCESS_SUPP		0x00040000U
22197a077a0SMatthew Dillon #define NVME_SGLS_META_BYTE_CONTIG_SUPP	0x00020000U
22297a077a0SMatthew Dillon #define NVME_SGLS_BITBUCKET_SUPP	0x00010000U
22397a077a0SMatthew Dillon #define NVME_SGLS_NVM_SUPP		0x00000001U
22497a077a0SMatthew Dillon 
22597a077a0SMatthew Dillon /*
22697a077a0SMatthew Dillon  * For lba_fmt[] field below.
22797a077a0SMatthew Dillon  *
22897a077a0SMatthew Dillon  * NOTE: If protection is enabled, the first or last 8 bytes of the meta-data
22997a077a0SMatthew Dillon  *	 holds the protection information (in-band with the meta-data).
23097a077a0SMatthew Dillon  */
23197a077a0SMatthew Dillon typedef struct {
23297a077a0SMatthew Dillon #if _BYTE_ORDER == _LITTLE_ENDIAN
23397a077a0SMatthew Dillon 	uint16_t	ms;		/* meta-dta bytes per lba */
23497a077a0SMatthew Dillon 	uint8_t		sect_size;	/* sector size 1 << n */
23597a077a0SMatthew Dillon 	uint8_t		flags;
23697a077a0SMatthew Dillon #else
23797a077a0SMatthew Dillon 	uint8_t		flags;
23897a077a0SMatthew Dillon 	uint8_t		lbads;		/* sector size 1 << n */
23997a077a0SMatthew Dillon 	uint16_t	ms;		/* meta-dta bytes per lba */
24097a077a0SMatthew Dillon #endif
24197a077a0SMatthew Dillon } __packed nvme_lba_fmt_data_t;
24297a077a0SMatthew Dillon 
24397a077a0SMatthew Dillon /* flags field */
24497a077a0SMatthew Dillon #define NVME_LBAFMT_PERF_MASK		0x03
24597a077a0SMatthew Dillon #define NVME_LBAFMT_PERF_BEST		0x00
24697a077a0SMatthew Dillon #define NVME_LBAFMT_PERF_BETTER		0x01
24797a077a0SMatthew Dillon #define NVME_LBAFMT_PERF_GOOD		0x02
24897a077a0SMatthew Dillon #define NVME_LBAFMT_PERF_DEGRADED	0x03
24997a077a0SMatthew Dillon 
25097a077a0SMatthew Dillon /*
25197a077a0SMatthew Dillon  * NVME Identify Namespace data response structures (4096 bytes)
25297a077a0SMatthew Dillon  */
25397a077a0SMatthew Dillon typedef struct {
25497a077a0SMatthew Dillon 	uint64_t	size;		/* in logical blocks */
25597a077a0SMatthew Dillon 	uint64_t	capacity;	/* in logical blocks (for thin prov) */
25697a077a0SMatthew Dillon 	uint64_t	util;		/* in logical blocks */
25797a077a0SMatthew Dillon 	uint8_t		features;
25897a077a0SMatthew Dillon 	uint8_t		nlbaf;		/* #lba formats avail */
25997a077a0SMatthew Dillon 	uint8_t		flbas;		/* lba fmt used by current ns */
26097a077a0SMatthew Dillon 	uint8_t		mc;		/* meta-data capabilities */
26197a077a0SMatthew Dillon 	uint8_t		dpc;		/* data-protection caps */
26297a077a0SMatthew Dillon 	uint8_t		dps;		/* data-protection type settings */
26397a077a0SMatthew Dillon 	uint8_t		nmic;		/* (opt) mpath I/O / ns sharing */
26497a077a0SMatthew Dillon 	uint8_t		res_cap;	/* (opt) reservation capabilities */
26597a077a0SMatthew Dillon 	uint8_t		fmt_progress;	/* (opt) format progress */
26697a077a0SMatthew Dillon 	uint8_t		reserved33;
26797a077a0SMatthew Dillon 	uint16_t	natomic_wun;	/* (opt) atomic overrides for ns */
26897a077a0SMatthew Dillon 	uint16_t	natomic_wupf;	/* (opt) atomic overrides for ns */
26997a077a0SMatthew Dillon 	uint16_t	natomic_cwu;	/* (opt) atomic overrides for ns */
27097a077a0SMatthew Dillon 	uint16_t	natomic_bsn;	/* (opt) atomic overrides for ns */
27197a077a0SMatthew Dillon 	uint16_t	natomic_bo;	/* (opt) atomic overrides for ns */
27297a077a0SMatthew Dillon 	uint16_t	natomic_bspf;	/* (opt) atomic overrides for ns */
27397a077a0SMatthew Dillon 	uint16_t	reserved46;
27497a077a0SMatthew Dillon 	uint64_t	nvm_capacity[2];/* (opt) total size in bytes of the */
27597a077a0SMatthew Dillon 					/* nvm allocated to this namespace */
27697a077a0SMatthew Dillon 	uint8_t		reserved64[40];
27797a077a0SMatthew Dillon 	uint64_t	nguid[2];	/* ns global uuid */
27897a077a0SMatthew Dillon 	uint64_t	eui64;		/* ieee ext unique id */
27997a077a0SMatthew Dillon 	nvme_lba_fmt_data_t lba_fmt[16];/* format 0 [0] is mandatory */
28097a077a0SMatthew Dillon 	uint8_t		reserved192[192];
28197a077a0SMatthew Dillon 	uint8_t		reserved384[3712];
28297a077a0SMatthew Dillon } __packed nvme_ident_ns_data_t;
28397a077a0SMatthew Dillon 
28497a077a0SMatthew Dillon #define NVME_NSFEAT_DEALLOC		0x04	/* support deallocation */
28597a077a0SMatthew Dillon #define NVME_NSFEAT_NATOMICS		0x02	/* use NAWUN, NAWUPF, NACWU */
28697a077a0SMatthew Dillon #define NVME_NSFEAT_THIN		0x01	/* thin provisioning avail */
28797a077a0SMatthew Dillon 
28897a077a0SMatthew Dillon #define NVME_FLBAS_META_INLINE		0x10	/* inline w/data, 0=separate */
28997a077a0SMatthew Dillon #define NVME_FLBAS_SEL_MASK		0x0F
29097a077a0SMatthew Dillon #define NVME_FLBAS_SEL_GET(data)	\
29197a077a0SMatthew Dillon 		((data) & NVME_FLBAS_SEL_MASK)
29297a077a0SMatthew Dillon 
29397a077a0SMatthew Dillon #define NVME_MC_INLINE			0x02	/* can xfer meta inline */
29497a077a0SMatthew Dillon #define NVME_MC_EXTLBA			0x01	/* can xfer meta separately */
29597a077a0SMatthew Dillon 
29697a077a0SMatthew Dillon 
29797a077a0SMatthew Dillon #define NVME_DPC_META_L8		0x10
29897a077a0SMatthew Dillon #define NVME_DPC_META_F8		0x08
29997a077a0SMatthew Dillon #define NVME_DPC_TYPE3			0x04
30097a077a0SMatthew Dillon #define NVME_DPC_TYPE2			0x02
30197a077a0SMatthew Dillon #define NVME_DPC_TYPE1			0x01
30297a077a0SMatthew Dillon 
30397a077a0SMatthew Dillon #define NVME_DPS_PROT_MASK		0x07
30497a077a0SMatthew Dillon 
30597a077a0SMatthew Dillon #define NVME_DPS_PROT_GET(data)		\
30697a077a0SMatthew Dillon 		((data) & NVME_DPS_PROT_MASK)
30797a077a0SMatthew Dillon 
30897a077a0SMatthew Dillon #define NVME_DPS_PROT_NONE		0
30997a077a0SMatthew Dillon #define NVME_DPS_PROT_TYPE1		1
31097a077a0SMatthew Dillon #define NVME_DPS_PROT_TYPE2		2
31197a077a0SMatthew Dillon #define NVME_DPS_PROT_TYPE3		3
31297a077a0SMatthew Dillon 					/* 4-7 reserved */
31397a077a0SMatthew Dillon 
31497a077a0SMatthew Dillon #define NVME_NMIC_SHARED		0x01
315