]>
Commit | Line | Data |
---|---|---|
111cd0dd DR |
1 | /** @file\r |
2 | Definitions based on NVMe spec. version 1.1.\r | |
3 | \r | |
4 | (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r | |
9dd14fc9 | 5 | Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.<BR>\r |
9344f092 | 6 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
111cd0dd DR |
7 | \r |
8 | @par Specification Reference:\r | |
9 | NVMe Specification 1.1\r | |
9dd14fc9 | 10 | NVMe Specification 1.4\r |
111cd0dd DR |
11 | \r |
12 | **/\r | |
13 | \r | |
14 | #ifndef __NVM_E_H__\r | |
15 | #define __NVM_E_H__\r | |
16 | \r | |
17 | #pragma pack(1)\r | |
18 | \r | |
19 | //\r | |
20 | // controller register offsets\r | |
21 | //\r | |
9dd14fc9 MC |
22 | #define NVME_CAP_OFFSET 0x0000 // Controller Capabilities\r |
23 | #define NVME_VER_OFFSET 0x0008 // Version\r | |
24 | #define NVME_INTMS_OFFSET 0x000c // Interrupt Mask Set\r | |
25 | #define NVME_INTMC_OFFSET 0x0010 // Interrupt Mask Clear\r | |
26 | #define NVME_CC_OFFSET 0x0014 // Controller Configuration\r | |
27 | #define NVME_CSTS_OFFSET 0x001c // Controller Status\r | |
28 | #define NVME_NSSR_OFFSET 0x0020 // NVM Subsystem Reset\r | |
29 | #define NVME_AQA_OFFSET 0x0024 // Admin Queue Attributes\r | |
30 | #define NVME_ASQ_OFFSET 0x0028 // Admin Submission Queue Base Address\r | |
31 | #define NVME_ACQ_OFFSET 0x0030 // Admin Completion Queue Base Address\r | |
32 | #define NVME_BPINFO_OFFSET 0x0040 // Boot Partition Information\r | |
33 | #define NVME_BPRSEL_OFFSET 0x0044 // Boot Partition Read Select\r | |
34 | #define NVME_BPMBL_OFFSET 0x0048 // Boot Partition Memory Buffer Location\r | |
35 | #define NVME_SQ0_OFFSET 0x1000 // Submission Queue 0 (admin) Tail Doorbell\r | |
36 | #define NVME_CQ0_OFFSET 0x1004 // Completion Queue 0 (admin) Head Doorbell\r | |
111cd0dd DR |
37 | \r |
38 | //\r | |
39 | // These register offsets are defined as 0x1000 + (N * (4 << CAP.DSTRD))\r | |
40 | // Get the doorbell stride bit shift value from the controller capabilities.\r | |
41 | //\r | |
2f88bd3a MK |
42 | #define NVME_SQTDBL_OFFSET(QID, DSTRD) 0x1000 + ((2 * (QID)) * (4 << (DSTRD))) // Submission Queue y (NVM) Tail Doorbell\r |
43 | #define NVME_CQHDBL_OFFSET(QID, DSTRD) 0x1000 + (((2 * (QID)) + 1) * (4 << (DSTRD))) // Completion Queue y (NVM) Head Doorbell\r | |
111cd0dd DR |
44 | \r |
45 | #pragma pack(1)\r | |
46 | \r | |
47 | //\r | |
48 | // 3.1.1 Offset 00h: CAP - Controller Capabilities\r | |
49 | //\r | |
50 | typedef struct {\r | |
2f88bd3a MK |
51 | UINT16 Mqes; // Maximum Queue Entries Supported\r |
52 | UINT8 Cqr : 1; // Contiguous Queues Required\r | |
53 | UINT8 Ams : 2; // Arbitration Mechanism Supported\r | |
54 | UINT8 Rsvd1 : 5;\r | |
55 | UINT8 To; // Timeout\r | |
56 | UINT16 Dstrd : 4;\r | |
57 | UINT16 Nssrs : 1; // NVM Subsystem Reset Supported NSSRS\r | |
9dd14fc9 MC |
58 | UINT16 Css : 8; // Command Sets Supported - Bit 37\r |
59 | UINT16 Bps : 1; // Boot Partition Support - Bit 45 in NVMe1.4\r | |
60 | UINT16 Rsvd3 : 2;\r | |
2f88bd3a MK |
61 | UINT8 Mpsmin : 4;\r |
62 | UINT8 Mpsmax : 4;\r | |
9dd14fc9 MC |
63 | UINT8 Pmrs : 1;\r |
64 | UINT8 Cmbs : 1;\r | |
65 | UINT8 Rsvd4 : 6;\r | |
111cd0dd DR |
66 | } NVME_CAP;\r |
67 | \r | |
68 | //\r | |
69 | // 3.1.2 Offset 08h: VS - Version\r | |
70 | //\r | |
71 | typedef struct {\r | |
2f88bd3a MK |
72 | UINT16 Mnr; // Minor version number\r |
73 | UINT16 Mjr; // Major version number\r | |
111cd0dd DR |
74 | } NVME_VER;\r |
75 | \r | |
76 | //\r | |
77 | // 3.1.5 Offset 14h: CC - Controller Configuration\r | |
78 | //\r | |
79 | typedef struct {\r | |
2f88bd3a MK |
80 | UINT16 En : 1; // Enable\r |
81 | UINT16 Rsvd1 : 3;\r | |
82 | UINT16 Css : 3; // I/O Command Set Selected\r | |
83 | UINT16 Mps : 4; // Memory Page Size\r | |
84 | UINT16 Ams : 3; // Arbitration Mechanism Selected\r | |
85 | UINT16 Shn : 2; // Shutdown Notification\r | |
86 | UINT8 Iosqes : 4; // I/O Submission Queue Entry Size\r | |
87 | UINT8 Iocqes : 4; // I/O Completion Queue Entry Size\r | |
88 | UINT8 Rsvd2;\r | |
111cd0dd | 89 | } NVME_CC;\r |
2f88bd3a MK |
90 | #define NVME_CC_SHN_NORMAL_SHUTDOWN 1\r |
91 | #define NVME_CC_SHN_ABRUPT_SHUTDOWN 2\r | |
111cd0dd DR |
92 | \r |
93 | //\r | |
94 | // 3.1.6 Offset 1Ch: CSTS - Controller Status\r | |
95 | //\r | |
96 | typedef struct {\r | |
2f88bd3a MK |
97 | UINT32 Rdy : 1; // Ready\r |
98 | UINT32 Cfs : 1; // Controller Fatal Status\r | |
99 | UINT32 Shst : 2; // Shutdown Status\r | |
100 | UINT32 Nssro : 1; // NVM Subsystem Reset Occurred\r | |
101 | UINT32 Rsvd1 : 27;\r | |
111cd0dd | 102 | } NVME_CSTS;\r |
2f88bd3a MK |
103 | #define NVME_CSTS_SHST_SHUTDOWN_OCCURRING 1\r |
104 | #define NVME_CSTS_SHST_SHUTDOWN_COMPLETED 2\r | |
111cd0dd DR |
105 | //\r |
106 | // 3.1.8 Offset 24h: AQA - Admin Queue Attributes\r | |
107 | //\r | |
108 | typedef struct {\r | |
2f88bd3a MK |
109 | UINT16 Asqs : 12; // Submission Queue Size\r |
110 | UINT16 Rsvd1 : 4;\r | |
111 | UINT16 Acqs : 12; // Completion Queue Size\r | |
112 | UINT16 Rsvd2 : 4;\r | |
111cd0dd DR |
113 | } NVME_AQA;\r |
114 | \r | |
115 | //\r | |
116 | // 3.1.9 Offset 28h: ASQ - Admin Submission Queue Base Address\r | |
117 | //\r | |
2f88bd3a | 118 | #define NVME_ASQ UINT64\r |
111cd0dd DR |
119 | //\r |
120 | // 3.1.10 Offset 30h: ACQ - Admin Completion Queue Base Address\r | |
121 | //\r | |
2f88bd3a | 122 | #define NVME_ACQ UINT64\r |
111cd0dd DR |
123 | \r |
124 | //\r | |
9dd14fc9 MC |
125 | // 3.1.13 Offset 40h: BPINFO - Boot Partition Information\r |
126 | //\r | |
127 | typedef struct {\r | |
128 | UINT32 Bpsz : 15; // Boot Partition Size\r | |
129 | UINT32 Rsvd1 : 9;\r | |
130 | UINT32 Brs : 2; // Boot Read Status\r | |
131 | UINT32 Rsvd2 : 5;\r | |
132 | UINT32 Abpid : 1; // Active Boot Partition ID\r | |
133 | } NVME_BPINFO;\r | |
134 | \r | |
135 | //\r | |
136 | // 3.1.14 Offset 44h: BPRSEL - Boot Partition Read Select\r | |
137 | //\r | |
138 | typedef struct {\r | |
139 | UINT32 Bprsz : 10; // Boot Partition Read Size\r | |
140 | UINT32 Bprof : 20; // Boot Partition Read Offset\r | |
141 | UINT32 Rsvd1 : 1;\r | |
142 | UINT32 Bpid : 1; // Boot Partition Identifier\r | |
143 | } NVME_BPRSEL;\r | |
144 | \r | |
145 | //\r | |
146 | // 3.1.15 Offset 48h: BPMBL - Boot Partition Memory Buffer Location (Optional)\r | |
147 | //\r | |
148 | typedef struct {\r | |
149 | UINT64 Rsvd1 : 12;\r | |
150 | UINT64 Bmbba : 52; // Boot Partition Memory Buffer Base Address\r | |
151 | } NVME_BPMBL;\r | |
152 | \r | |
153 | //\r | |
154 | // 3.1.25 Offset (1000h + ((2y) * (4 << CAP.DSTRD))): SQyTDBL - Submission Queue y Tail Doorbell\r | |
111cd0dd DR |
155 | //\r |
156 | typedef struct {\r | |
2f88bd3a MK |
157 | UINT16 Sqt;\r |
158 | UINT16 Rsvd1;\r | |
111cd0dd DR |
159 | } NVME_SQTDBL;\r |
160 | \r | |
161 | //\r | |
162 | // 3.1.12 Offset (1000h + ((2y + 1) * (4 << CAP.DSTRD))): CQyHDBL - Completion Queue y Head Doorbell\r | |
163 | //\r | |
164 | typedef struct {\r | |
2f88bd3a MK |
165 | UINT16 Cqh;\r |
166 | UINT16 Rsvd1;\r | |
111cd0dd DR |
167 | } NVME_CQHDBL;\r |
168 | \r | |
169 | //\r | |
170 | // NVM command set structures\r | |
171 | //\r | |
172 | // Read Command\r | |
173 | //\r | |
174 | typedef struct {\r | |
175 | //\r | |
176 | // CDW 10, 11\r | |
177 | //\r | |
2f88bd3a | 178 | UINT64 Slba; /* Starting Sector Address */\r |
111cd0dd DR |
179 | //\r |
180 | // CDW 12\r | |
181 | //\r | |
2f88bd3a MK |
182 | UINT16 Nlb; /* Number of Sectors */\r |
183 | UINT16 Rsvd1 : 10;\r | |
184 | UINT16 Prinfo : 4; /* Protection Info Check */\r | |
185 | UINT16 Fua : 1; /* Force Unit Access */\r | |
186 | UINT16 Lr : 1; /* Limited Retry */\r | |
111cd0dd DR |
187 | //\r |
188 | // CDW 13\r | |
189 | //\r | |
2f88bd3a MK |
190 | UINT32 Af : 4; /* Access Frequency */\r |
191 | UINT32 Al : 2; /* Access Latency */\r | |
192 | UINT32 Sr : 1; /* Sequential Request */\r | |
193 | UINT32 In : 1; /* Incompressible */\r | |
194 | UINT32 Rsvd2 : 24;\r | |
111cd0dd DR |
195 | //\r |
196 | // CDW 14\r | |
197 | //\r | |
2f88bd3a | 198 | UINT32 Eilbrt; /* Expected Initial Logical Block Reference Tag */\r |
111cd0dd DR |
199 | //\r |
200 | // CDW 15\r | |
201 | //\r | |
2f88bd3a MK |
202 | UINT16 Elbat; /* Expected Logical Block Application Tag */\r |
203 | UINT16 Elbatm; /* Expected Logical Block Application Tag Mask */\r | |
111cd0dd DR |
204 | } NVME_READ;\r |
205 | \r | |
206 | //\r | |
207 | // Write Command\r | |
208 | //\r | |
209 | typedef struct {\r | |
210 | //\r | |
211 | // CDW 10, 11\r | |
212 | //\r | |
2f88bd3a | 213 | UINT64 Slba; /* Starting Sector Address */\r |
111cd0dd DR |
214 | //\r |
215 | // CDW 12\r | |
216 | //\r | |
2f88bd3a MK |
217 | UINT16 Nlb; /* Number of Sectors */\r |
218 | UINT16 Rsvd1 : 10;\r | |
219 | UINT16 Prinfo : 4; /* Protection Info Check */\r | |
220 | UINT16 Fua : 1; /* Force Unit Access */\r | |
221 | UINT16 Lr : 1; /* Limited Retry */\r | |
111cd0dd DR |
222 | //\r |
223 | // CDW 13\r | |
224 | //\r | |
2f88bd3a MK |
225 | UINT32 Af : 4; /* Access Frequency */\r |
226 | UINT32 Al : 2; /* Access Latency */\r | |
227 | UINT32 Sr : 1; /* Sequential Request */\r | |
228 | UINT32 In : 1; /* Incompressible */\r | |
229 | UINT32 Rsvd2 : 24;\r | |
111cd0dd DR |
230 | //\r |
231 | // CDW 14\r | |
232 | //\r | |
2f88bd3a | 233 | UINT32 Ilbrt; /* Initial Logical Block Reference Tag */\r |
111cd0dd DR |
234 | //\r |
235 | // CDW 15\r | |
236 | //\r | |
2f88bd3a MK |
237 | UINT16 Lbat; /* Logical Block Application Tag */\r |
238 | UINT16 Lbatm; /* Logical Block Application Tag Mask */\r | |
111cd0dd DR |
239 | } NVME_WRITE;\r |
240 | \r | |
241 | //\r | |
242 | // Flush\r | |
243 | //\r | |
244 | typedef struct {\r | |
245 | //\r | |
246 | // CDW 10\r | |
247 | //\r | |
2f88bd3a | 248 | UINT32 Flush; /* Flush */\r |
111cd0dd DR |
249 | } NVME_FLUSH;\r |
250 | \r | |
251 | //\r | |
252 | // Write Uncorrectable command\r | |
253 | //\r | |
254 | typedef struct {\r | |
255 | //\r | |
256 | // CDW 10, 11\r | |
257 | //\r | |
2f88bd3a | 258 | UINT64 Slba; /* Starting LBA */\r |
111cd0dd DR |
259 | //\r |
260 | // CDW 12\r | |
261 | //\r | |
2f88bd3a MK |
262 | UINT32 Nlb : 16; /* Number of Logical Blocks */\r |
263 | UINT32 Rsvd1 : 16;\r | |
111cd0dd DR |
264 | } NVME_WRITE_UNCORRECTABLE;\r |
265 | \r | |
266 | //\r | |
267 | // Write Zeroes command\r | |
268 | //\r | |
269 | typedef struct {\r | |
270 | //\r | |
271 | // CDW 10, 11\r | |
272 | //\r | |
2f88bd3a | 273 | UINT64 Slba; /* Starting LBA */\r |
111cd0dd DR |
274 | //\r |
275 | // CDW 12\r | |
276 | //\r | |
2f88bd3a MK |
277 | UINT16 Nlb; /* Number of Logical Blocks */\r |
278 | UINT16 Rsvd1 : 10;\r | |
279 | UINT16 Prinfo : 4; /* Protection Info Check */\r | |
280 | UINT16 Fua : 1; /* Force Unit Access */\r | |
281 | UINT16 Lr : 1; /* Limited Retry */\r | |
111cd0dd DR |
282 | //\r |
283 | // CDW 13\r | |
284 | //\r | |
2f88bd3a | 285 | UINT32 Rsvd2;\r |
111cd0dd DR |
286 | //\r |
287 | // CDW 14\r | |
288 | //\r | |
2f88bd3a | 289 | UINT32 Ilbrt; /* Initial Logical Block Reference Tag */\r |
111cd0dd DR |
290 | //\r |
291 | // CDW 15\r | |
292 | //\r | |
2f88bd3a MK |
293 | UINT16 Lbat; /* Logical Block Application Tag */\r |
294 | UINT16 Lbatm; /* Logical Block Application Tag Mask */\r | |
111cd0dd DR |
295 | } NVME_WRITE_ZEROES;\r |
296 | \r | |
297 | //\r | |
298 | // Compare command\r | |
299 | //\r | |
300 | typedef struct {\r | |
301 | //\r | |
302 | // CDW 10, 11\r | |
303 | //\r | |
2f88bd3a | 304 | UINT64 Slba; /* Starting LBA */\r |
111cd0dd DR |
305 | //\r |
306 | // CDW 12\r | |
307 | //\r | |
2f88bd3a MK |
308 | UINT16 Nlb; /* Number of Logical Blocks */\r |
309 | UINT16 Rsvd1 : 10;\r | |
310 | UINT16 Prinfo : 4; /* Protection Info Check */\r | |
311 | UINT16 Fua : 1; /* Force Unit Access */\r | |
312 | UINT16 Lr : 1; /* Limited Retry */\r | |
111cd0dd DR |
313 | //\r |
314 | // CDW 13\r | |
315 | //\r | |
2f88bd3a | 316 | UINT32 Rsvd2;\r |
111cd0dd DR |
317 | //\r |
318 | // CDW 14\r | |
319 | //\r | |
2f88bd3a | 320 | UINT32 Eilbrt; /* Expected Initial Logical Block Reference Tag */\r |
111cd0dd DR |
321 | //\r |
322 | // CDW 15\r | |
323 | //\r | |
2f88bd3a MK |
324 | UINT16 Elbat; /* Expected Logical Block Application Tag */\r |
325 | UINT16 Elbatm; /* Expected Logical Block Application Tag Mask */\r | |
111cd0dd DR |
326 | } NVME_COMPARE;\r |
327 | \r | |
328 | typedef union {\r | |
329 | NVME_READ Read;\r | |
330 | NVME_WRITE Write;\r | |
331 | NVME_FLUSH Flush;\r | |
332 | NVME_WRITE_UNCORRECTABLE WriteUncorrectable;\r | |
333 | NVME_WRITE_ZEROES WriteZeros;\r | |
334 | NVME_COMPARE Compare;\r | |
335 | } NVME_CMD;\r | |
336 | \r | |
337 | typedef struct {\r | |
2f88bd3a MK |
338 | UINT16 Mp; /* Maximum Power */\r |
339 | UINT8 Rsvd1; /* Reserved as of Nvm Express 1.1 Spec */\r | |
340 | UINT8 Mps : 1; /* Max Power Scale */\r | |
341 | UINT8 Nops : 1; /* Non-Operational State */\r | |
342 | UINT8 Rsvd2 : 6; /* Reserved as of Nvm Express 1.1 Spec */\r | |
343 | UINT32 Enlat; /* Entry Latency */\r | |
344 | UINT32 Exlat; /* Exit Latency */\r | |
345 | UINT8 Rrt : 5; /* Relative Read Throughput */\r | |
346 | UINT8 Rsvd3 : 3; /* Reserved as of Nvm Express 1.1 Spec */\r | |
347 | UINT8 Rrl : 5; /* Relative Read Latency */\r | |
348 | UINT8 Rsvd4 : 3; /* Reserved as of Nvm Express 1.1 Spec */\r | |
349 | UINT8 Rwt : 5; /* Relative Write Throughput */\r | |
350 | UINT8 Rsvd5 : 3; /* Reserved as of Nvm Express 1.1 Spec */\r | |
351 | UINT8 Rwl : 5; /* Relative Write Latency */\r | |
352 | UINT8 Rsvd6 : 3; /* Reserved as of Nvm Express 1.1 Spec */\r | |
353 | UINT8 Rsvd7[16]; /* Reserved as of Nvm Express 1.1 Spec */\r | |
111cd0dd DR |
354 | } NVME_PSDESCRIPTOR;\r |
355 | \r | |
356 | //\r | |
357 | // Identify Controller Data\r | |
358 | //\r | |
359 | typedef struct {\r | |
360 | //\r | |
361 | // Controller Capabilities and Features 0-255\r | |
362 | //\r | |
2f88bd3a MK |
363 | UINT16 Vid; /* PCI Vendor ID */\r |
364 | UINT16 Ssvid; /* PCI sub-system vendor ID */\r | |
365 | UINT8 Sn[20]; /* Product serial number */\r | |
111cd0dd | 366 | \r |
2f88bd3a MK |
367 | UINT8 Mn[40]; /* Product model number */\r |
368 | UINT8 Fr[8]; /* Firmware Revision */\r | |
369 | UINT8 Rab; /* Recommended Arbitration Burst */\r | |
370 | UINT8 Ieee_oui[3]; /* Organization Unique Identifier */\r | |
371 | UINT8 Cmic; /* Multi-interface Capabilities */\r | |
372 | UINT8 Mdts; /* Maximum Data Transfer Size */\r | |
373 | UINT8 Cntlid[2]; /* Controller ID */\r | |
374 | UINT8 Rsvd1[176]; /* Reserved as of Nvm Express 1.1 Spec */\r | |
111cd0dd DR |
375 | //\r |
376 | // Admin Command Set Attributes\r | |
377 | //\r | |
2f88bd3a MK |
378 | UINT16 Oacs; /* Optional Admin Command Support */\r |
379 | #define NAMESPACE_MANAGEMENT_SUPPORTED BIT3\r | |
380 | #define FW_DOWNLOAD_ACTIVATE_SUPPORTED BIT2\r | |
381 | #define FORMAT_NVM_SUPPORTED BIT1\r | |
382 | #define SECURITY_SEND_RECEIVE_SUPPORTED BIT0\r | |
383 | UINT8 Acl; /* Abort Command Limit */\r | |
384 | UINT8 Aerl; /* Async Event Request Limit */\r | |
385 | UINT8 Frmw; /* Firmware updates */\r | |
386 | UINT8 Lpa; /* Log Page Attributes */\r | |
387 | UINT8 Elpe; /* Error Log Page Entries */\r | |
388 | UINT8 Npss; /* Number of Power States Support */\r | |
389 | UINT8 Avscc; /* Admin Vendor Specific Command Configuration */\r | |
390 | UINT8 Apsta; /* Autonomous Power State Transition Attributes */\r | |
443300be | 391 | //\r |
9dd14fc9 | 392 | // Below fields before Rsvd2 are defined in NVM Express 1.4 Spec\r |
443300be | 393 | //\r |
2f88bd3a MK |
394 | UINT16 Wctemp; /* Warning Composite Temperature Threshold */\r |
395 | UINT16 Cctemp; /* Critical Composite Temperature Threshold */\r | |
396 | UINT16 Mtfa; /* Maximum Time for Firmware Activation */\r | |
397 | UINT32 Hmpre; /* Host Memory Buffer Preferred Size */\r | |
398 | UINT32 Hmmin; /* Host Memory Buffer Minimum Size */\r | |
399 | UINT8 Tnvmcap[16]; /* Total NVM Capacity */\r | |
9dd14fc9 MC |
400 | UINT8 Unvmcap[16]; /* Unallocated NVM Capacity */\r |
401 | UINT32 Rpmbs; /* Replay Protected Memory Block Support */\r | |
402 | UINT16 Edstt; /* Extended Device Self-test Time */\r | |
403 | UINT8 Dsto; /* Device Self-test Options */\r | |
404 | UINT8 Fwug; /* Firmware Update Granularity */\r | |
405 | UINT8 Rsvd2[192]; /* Reserved as of Nvm Express 1.4 Spec */\r | |
111cd0dd DR |
406 | //\r |
407 | // NVM Command Set Attributes\r | |
408 | //\r | |
2f88bd3a MK |
409 | UINT8 Sqes; /* Submission Queue Entry Size */\r |
410 | UINT8 Cqes; /* Completion Queue Entry Size */\r | |
411 | UINT16 Rsvd3; /* Reserved as of Nvm Express 1.1 Spec */\r | |
412 | UINT32 Nn; /* Number of Namespaces */\r | |
413 | UINT16 Oncs; /* Optional NVM Command Support */\r | |
414 | UINT16 Fuses; /* Fused Operation Support */\r | |
415 | UINT8 Fna; /* Format NVM Attributes */\r | |
416 | UINT8 Vwc; /* Volatile Write Cache */\r | |
417 | UINT16 Awun; /* Atomic Write Unit Normal */\r | |
418 | UINT16 Awupf; /* Atomic Write Unit Power Fail */\r | |
419 | UINT8 Nvscc; /* NVM Vendor Specific Command Configuration */\r | |
420 | UINT8 Rsvd4; /* Reserved as of Nvm Express 1.1 Spec */\r | |
421 | UINT16 Acwu; /* Atomic Compare & Write Unit */\r | |
422 | UINT16 Rsvd5; /* Reserved as of Nvm Express 1.1 Spec */\r | |
423 | UINT32 Sgls; /* SGL Support */\r | |
424 | UINT8 Rsvd6[164]; /* Reserved as of Nvm Express 1.1 Spec */\r | |
111cd0dd DR |
425 | //\r |
426 | // I/O Command set Attributes\r | |
427 | //\r | |
2f88bd3a | 428 | UINT8 Rsvd7[1344]; /* Reserved as of Nvm Express 1.1 Spec */\r |
111cd0dd DR |
429 | //\r |
430 | // Power State Descriptors\r | |
431 | //\r | |
2f88bd3a | 432 | NVME_PSDESCRIPTOR PsDescriptor[32];\r |
111cd0dd | 433 | \r |
2f88bd3a | 434 | UINT8 VendorData[1024]; /* Vendor specific data */\r |
111cd0dd DR |
435 | } NVME_ADMIN_CONTROLLER_DATA;\r |
436 | \r | |
437 | typedef struct {\r | |
2f88bd3a MK |
438 | UINT16 Ms; /* Metadata Size */\r |
439 | UINT8 Lbads; /* LBA Data Size */\r | |
440 | UINT8 Rp : 2; /* Relative Performance */\r | |
441 | #define LBAF_RP_BEST 00b\r | |
442 | #define LBAF_RP_BETTER 01b\r | |
443 | #define LBAF_RP_GOOD 10b\r | |
444 | #define LBAF_RP_DEGRADED 11b\r | |
445 | UINT8 Rsvd1 : 6; /* Reserved as of Nvm Express 1.1 Spec */\r | |
111cd0dd DR |
446 | } NVME_LBAFORMAT;\r |
447 | \r | |
448 | //\r | |
449 | // Identify Namespace Data\r | |
450 | //\r | |
451 | typedef struct {\r | |
452 | //\r | |
453 | // NVM Command Set Specific\r | |
454 | //\r | |
2f88bd3a MK |
455 | UINT64 Nsze; /* Namespace Size (total number of blocks in formatted namespace) */\r |
456 | UINT64 Ncap; /* Namespace Capacity (max number of logical blocks) */\r | |
457 | UINT64 Nuse; /* Namespace Utilization */\r | |
458 | UINT8 Nsfeat; /* Namespace Features */\r | |
459 | UINT8 Nlbaf; /* Number of LBA Formats */\r | |
460 | UINT8 Flbas; /* Formatted LBA size */\r | |
461 | UINT8 Mc; /* Metadata Capabilities */\r | |
462 | UINT8 Dpc; /* End-to-end Data Protection capabilities */\r | |
463 | UINT8 Dps; /* End-to-end Data Protection Type Settings */\r | |
464 | UINT8 Nmic; /* Namespace Multi-path I/O and Namespace Sharing Capabilities */\r | |
465 | UINT8 Rescap; /* Reservation Capabilities */\r | |
466 | UINT8 Rsvd1[88]; /* Reserved as of Nvm Express 1.1 Spec */\r | |
467 | UINT64 Eui64; /* IEEE Extended Unique Identifier */\r | |
111cd0dd DR |
468 | //\r |
469 | // LBA Format\r | |
470 | //\r | |
2f88bd3a | 471 | NVME_LBAFORMAT LbaFormat[16];\r |
111cd0dd | 472 | \r |
2f88bd3a MK |
473 | UINT8 Rsvd2[192]; /* Reserved as of Nvm Express 1.1 Spec */\r |
474 | UINT8 VendorData[3712]; /* Vendor specific data */\r | |
111cd0dd DR |
475 | } NVME_ADMIN_NAMESPACE_DATA;\r |
476 | \r | |
9dd14fc9 MC |
477 | //\r |
478 | // RPMB Device Configuration Block Data Structure as of Nvm Express 1.4 Spec\r | |
479 | //\r | |
480 | typedef struct {\r | |
481 | UINT8 Bppe; /* Boot Partition Protection Enable */\r | |
482 | UINT8 Bpl; /* Boot Partition Lock */\r | |
483 | UINT8 Nwpac; /* Namespace Write Protection Authentication Control */\r | |
484 | UINT8 Rsvd1[509]; /* Reserved as of Nvm Express 1.4 Spec */\r | |
485 | } NVME_RPMB_CONFIGURATION_DATA;\r | |
486 | \r | |
487 | #define RPMB_FRAME_STUFF_BYTES 223\r | |
488 | \r | |
489 | //\r | |
490 | // RPMB Data Frame as of Nvm Express 1.4 Spec\r | |
491 | //\r | |
492 | typedef struct {\r | |
493 | UINT8 Sbakamc[RPMB_FRAME_STUFF_BYTES]; /* [222-N:00] Stuff Bytes */\r | |
494 | /* [222:222-(N-1)] Authentication Key or Message Authentication Code (MAC) */\r | |
495 | UINT8 Rpmbt; /* RPMB Target */\r | |
496 | UINT64 Nonce[2];\r | |
497 | UINT32 Wcounter; /* Write Counter */\r | |
498 | UINT32 Address; /* Starting address of data to be programmed to or read from the RPMB. */\r | |
499 | UINT32 Scount; /* Sector Count */\r | |
500 | UINT16 Result;\r | |
501 | UINT16 Rpmessage; /* Request/Response Message */\r | |
502 | // UINT8 *Data; /* Data to be written or read by signed access where M = 512 * Sector Count. */\r | |
503 | } NVME_RPMB_DATA_FRAME;\r | |
504 | \r | |
111cd0dd DR |
505 | //\r |
506 | // NvmExpress Admin Identify Cmd\r | |
507 | //\r | |
508 | typedef struct {\r | |
509 | //\r | |
510 | // CDW 10\r | |
511 | //\r | |
2f88bd3a MK |
512 | UINT32 Cns : 2;\r |
513 | UINT32 Rsvd1 : 30;\r | |
111cd0dd DR |
514 | } NVME_ADMIN_IDENTIFY;\r |
515 | \r | |
516 | //\r | |
517 | // NvmExpress Admin Create I/O Completion Queue\r | |
518 | //\r | |
519 | typedef struct {\r | |
520 | //\r | |
521 | // CDW 10\r | |
522 | //\r | |
2f88bd3a MK |
523 | UINT32 Qid : 16; /* Queue Identifier */\r |
524 | UINT32 Qsize : 16; /* Queue Size */\r | |
111cd0dd DR |
525 | \r |
526 | //\r | |
527 | // CDW 11\r | |
528 | //\r | |
2f88bd3a MK |
529 | UINT32 Pc : 1; /* Physically Contiguous */\r |
530 | UINT32 Ien : 1; /* Interrupts Enabled */\r | |
531 | UINT32 Rsvd1 : 14; /* reserved as of Nvm Express 1.1 Spec */\r | |
532 | UINT32 Iv : 16; /* Interrupt Vector for MSI-X or MSI*/\r | |
111cd0dd DR |
533 | } NVME_ADMIN_CRIOCQ;\r |
534 | \r | |
535 | //\r | |
536 | // NvmExpress Admin Create I/O Submission Queue\r | |
537 | //\r | |
538 | typedef struct {\r | |
539 | //\r | |
540 | // CDW 10\r | |
541 | //\r | |
2f88bd3a MK |
542 | UINT32 Qid : 16; /* Queue Identifier */\r |
543 | UINT32 Qsize : 16; /* Queue Size */\r | |
111cd0dd DR |
544 | \r |
545 | //\r | |
546 | // CDW 11\r | |
547 | //\r | |
2f88bd3a MK |
548 | UINT32 Pc : 1; /* Physically Contiguous */\r |
549 | UINT32 Qprio : 2; /* Queue Priority */\r | |
550 | UINT32 Rsvd1 : 13; /* Reserved as of Nvm Express 1.1 Spec */\r | |
551 | UINT32 Cqid : 16; /* Completion Queue ID */\r | |
111cd0dd DR |
552 | } NVME_ADMIN_CRIOSQ;\r |
553 | \r | |
554 | //\r | |
555 | // NvmExpress Admin Delete I/O Completion Queue\r | |
556 | //\r | |
557 | typedef struct {\r | |
558 | //\r | |
559 | // CDW 10\r | |
560 | //\r | |
2f88bd3a MK |
561 | UINT16 Qid;\r |
562 | UINT16 Rsvd1;\r | |
111cd0dd DR |
563 | } NVME_ADMIN_DEIOCQ;\r |
564 | \r | |
565 | //\r | |
566 | // NvmExpress Admin Delete I/O Submission Queue\r | |
567 | //\r | |
568 | typedef struct {\r | |
569 | //\r | |
570 | // CDW 10\r | |
571 | //\r | |
2f88bd3a MK |
572 | UINT16 Qid;\r |
573 | UINT16 Rsvd1;\r | |
111cd0dd DR |
574 | } NVME_ADMIN_DEIOSQ;\r |
575 | \r | |
576 | //\r | |
577 | // NvmExpress Admin Abort Command\r | |
578 | //\r | |
579 | typedef struct {\r | |
580 | //\r | |
581 | // CDW 10\r | |
582 | //\r | |
2f88bd3a MK |
583 | UINT32 Sqid : 16; /* Submission Queue identifier */\r |
584 | UINT32 Cid : 16; /* Command Identifier */\r | |
111cd0dd DR |
585 | } NVME_ADMIN_ABORT;\r |
586 | \r | |
587 | //\r | |
588 | // NvmExpress Admin Firmware Activate Command\r | |
589 | //\r | |
590 | typedef struct {\r | |
591 | //\r | |
592 | // CDW 10\r | |
593 | //\r | |
2f88bd3a MK |
594 | UINT32 Fs : 3; /* Submission Queue identifier */\r |
595 | UINT32 Aa : 2; /* Command Identifier */\r | |
596 | UINT32 Rsvd1 : 27;\r | |
111cd0dd DR |
597 | } NVME_ADMIN_FIRMWARE_ACTIVATE;\r |
598 | \r | |
599 | //\r | |
600 | // NvmExpress Admin Firmware Image Download Command\r | |
601 | //\r | |
602 | typedef struct {\r | |
603 | //\r | |
604 | // CDW 10\r | |
605 | //\r | |
2f88bd3a | 606 | UINT32 Numd; /* Number of Dwords */\r |
111cd0dd DR |
607 | //\r |
608 | // CDW 11\r | |
609 | //\r | |
2f88bd3a | 610 | UINT32 Ofst; /* Offset */\r |
111cd0dd DR |
611 | } NVME_ADMIN_FIRMWARE_IMAGE_DOWNLOAD;\r |
612 | \r | |
613 | //\r | |
614 | // NvmExpress Admin Get Features Command\r | |
615 | //\r | |
616 | typedef struct {\r | |
617 | //\r | |
618 | // CDW 10\r | |
619 | //\r | |
2f88bd3a MK |
620 | UINT32 Fid : 8; /* Feature Identifier */\r |
621 | UINT32 Sel : 3; /* Select */\r | |
622 | UINT32 Rsvd1 : 21;\r | |
111cd0dd DR |
623 | } NVME_ADMIN_GET_FEATURES;\r |
624 | \r | |
625 | //\r | |
626 | // NvmExpress Admin Get Log Page Command\r | |
627 | //\r | |
628 | typedef struct {\r | |
629 | //\r | |
630 | // CDW 10\r | |
631 | //\r | |
2f88bd3a MK |
632 | UINT32 Lid : 8; /* Log Page Identifier */\r |
633 | #define LID_ERROR_INFO 0x1\r | |
634 | #define LID_SMART_INFO 0x2\r | |
635 | #define LID_FW_SLOT_INFO 0x3\r | |
9dd14fc9 | 636 | #define LID_BP_INFO 0x15\r |
2f88bd3a MK |
637 | UINT32 Rsvd1 : 8;\r |
638 | UINT32 Numd : 12; /* Number of Dwords */\r | |
639 | UINT32 Rsvd2 : 4; /* Reserved as of Nvm Express 1.1 Spec */\r | |
111cd0dd DR |
640 | } NVME_ADMIN_GET_LOG_PAGE;\r |
641 | \r | |
642 | //\r | |
643 | // NvmExpress Admin Set Features Command\r | |
644 | //\r | |
645 | typedef struct {\r | |
646 | //\r | |
647 | // CDW 10\r | |
648 | //\r | |
2f88bd3a MK |
649 | UINT32 Fid : 8; /* Feature Identifier */\r |
650 | UINT32 Rsvd1 : 23;\r | |
651 | UINT32 Sv : 1; /* Save */\r | |
111cd0dd DR |
652 | } NVME_ADMIN_SET_FEATURES;\r |
653 | \r | |
654 | //\r | |
655 | // NvmExpress Admin Format NVM Command\r | |
656 | //\r | |
657 | typedef struct {\r | |
658 | //\r | |
659 | // CDW 10\r | |
660 | //\r | |
2f88bd3a MK |
661 | UINT32 Lbaf : 4; /* LBA Format */\r |
662 | UINT32 Ms : 1; /* Metadata Settings */\r | |
663 | UINT32 Pi : 3; /* Protection Information */\r | |
664 | UINT32 Pil : 1; /* Protection Information Location */\r | |
665 | UINT32 Ses : 3; /* Secure Erase Settings */\r | |
666 | UINT32 Rsvd1 : 20;\r | |
111cd0dd DR |
667 | } NVME_ADMIN_FORMAT_NVM;\r |
668 | \r | |
669 | //\r | |
670 | // NvmExpress Admin Security Receive Command\r | |
671 | //\r | |
672 | typedef struct {\r | |
673 | //\r | |
674 | // CDW 10\r | |
675 | //\r | |
2f88bd3a MK |
676 | UINT32 Rsvd1 : 8;\r |
677 | UINT32 Spsp : 16; /* SP Specific */\r | |
678 | UINT32 Secp : 8; /* Security Protocol */\r | |
111cd0dd DR |
679 | //\r |
680 | // CDW 11\r | |
681 | //\r | |
2f88bd3a | 682 | UINT32 Al; /* Allocation Length */\r |
111cd0dd DR |
683 | } NVME_ADMIN_SECURITY_RECEIVE;\r |
684 | \r | |
685 | //\r | |
686 | // NvmExpress Admin Security Send Command\r | |
687 | //\r | |
688 | typedef struct {\r | |
689 | //\r | |
690 | // CDW 10\r | |
691 | //\r | |
2f88bd3a MK |
692 | UINT32 Rsvd1 : 8;\r |
693 | UINT32 Spsp : 16; /* SP Specific */\r | |
694 | UINT32 Secp : 8; /* Security Protocol */\r | |
111cd0dd DR |
695 | //\r |
696 | // CDW 11\r | |
697 | //\r | |
2f88bd3a | 698 | UINT32 Tl; /* Transfer Length */\r |
111cd0dd DR |
699 | } NVME_ADMIN_SECURITY_SEND;\r |
700 | \r | |
701 | typedef union {\r | |
702 | NVME_ADMIN_IDENTIFY Identify;\r | |
703 | NVME_ADMIN_CRIOCQ CrIoCq;\r | |
704 | NVME_ADMIN_CRIOSQ CrIoSq;\r | |
705 | NVME_ADMIN_DEIOCQ DeIoCq;\r | |
706 | NVME_ADMIN_DEIOSQ DeIoSq;\r | |
707 | NVME_ADMIN_ABORT Abort;\r | |
708 | NVME_ADMIN_FIRMWARE_ACTIVATE Activate;\r | |
709 | NVME_ADMIN_FIRMWARE_IMAGE_DOWNLOAD FirmwareImageDownload;\r | |
710 | NVME_ADMIN_GET_FEATURES GetFeatures;\r | |
711 | NVME_ADMIN_GET_LOG_PAGE GetLogPage;\r | |
712 | NVME_ADMIN_SET_FEATURES SetFeatures;\r | |
713 | NVME_ADMIN_FORMAT_NVM FormatNvm;\r | |
714 | NVME_ADMIN_SECURITY_RECEIVE SecurityReceive;\r | |
715 | NVME_ADMIN_SECURITY_SEND SecuritySend;\r | |
716 | } NVME_ADMIN_CMD;\r | |
717 | \r | |
718 | typedef struct {\r | |
2f88bd3a MK |
719 | UINT32 Cdw10;\r |
720 | UINT32 Cdw11;\r | |
721 | UINT32 Cdw12;\r | |
722 | UINT32 Cdw13;\r | |
723 | UINT32 Cdw14;\r | |
724 | UINT32 Cdw15;\r | |
111cd0dd DR |
725 | } NVME_RAW;\r |
726 | \r | |
727 | typedef union {\r | |
2f88bd3a MK |
728 | NVME_ADMIN_CMD Admin; // Union of Admin commands\r |
729 | NVME_CMD Nvm; // Union of Nvm commands\r | |
730 | NVME_RAW Raw;\r | |
111cd0dd DR |
731 | } NVME_PAYLOAD;\r |
732 | \r | |
733 | //\r | |
734 | // Submission Queue\r | |
735 | //\r | |
736 | typedef struct {\r | |
737 | //\r | |
b219e2cd | 738 | // CDW 0, Common to all commands\r |
111cd0dd | 739 | //\r |
2f88bd3a MK |
740 | UINT8 Opc; // Opcode\r |
741 | UINT8 Fuse : 2; // Fused Operation\r | |
742 | UINT8 Rsvd1 : 5;\r | |
743 | UINT8 Psdt : 1; // PRP or SGL for Data Transfer\r | |
744 | UINT16 Cid; // Command Identifier\r | |
111cd0dd DR |
745 | \r |
746 | //\r | |
747 | // CDW 1\r | |
748 | //\r | |
2f88bd3a | 749 | UINT32 Nsid; // Namespace Identifier\r |
111cd0dd DR |
750 | \r |
751 | //\r | |
752 | // CDW 2,3\r | |
753 | //\r | |
2f88bd3a | 754 | UINT64 Rsvd2;\r |
111cd0dd DR |
755 | \r |
756 | //\r | |
757 | // CDW 4,5\r | |
758 | //\r | |
2f88bd3a | 759 | UINT64 Mptr; // Metadata Pointer\r |
111cd0dd DR |
760 | \r |
761 | //\r | |
762 | // CDW 6-9\r | |
763 | //\r | |
2f88bd3a | 764 | UINT64 Prp[2]; // First and second PRP entries\r |
111cd0dd | 765 | \r |
2f88bd3a | 766 | NVME_PAYLOAD Payload;\r |
111cd0dd DR |
767 | } NVME_SQ;\r |
768 | \r | |
769 | //\r | |
770 | // Completion Queue\r | |
771 | //\r | |
772 | typedef struct {\r | |
773 | //\r | |
774 | // CDW 0\r | |
775 | //\r | |
2f88bd3a | 776 | UINT32 Dword0;\r |
111cd0dd DR |
777 | //\r |
778 | // CDW 1\r | |
779 | //\r | |
2f88bd3a | 780 | UINT32 Rsvd1;\r |
111cd0dd DR |
781 | //\r |
782 | // CDW 2\r | |
783 | //\r | |
2f88bd3a MK |
784 | UINT16 Sqhd; // Submission Queue Head Pointer\r |
785 | UINT16 Sqid; // Submission Queue Identifier\r | |
111cd0dd DR |
786 | //\r |
787 | // CDW 3\r | |
788 | //\r | |
2f88bd3a MK |
789 | UINT16 Cid; // Command Identifier\r |
790 | UINT16 Pt : 1; // Phase Tag\r | |
791 | UINT16 Sc : 8; // Status Code\r | |
792 | UINT16 Sct : 3; // Status Code Type\r | |
793 | UINT16 Rsvd2 : 2;\r | |
794 | UINT16 Mo : 1; // More\r | |
795 | UINT16 Dnr : 1; // Do Not Retry\r | |
111cd0dd DR |
796 | } NVME_CQ;\r |
797 | \r | |
798 | //\r | |
799 | // Nvm Express Admin cmd opcodes\r | |
800 | //\r | |
2f88bd3a MK |
801 | #define NVME_ADMIN_DEIOSQ_CMD 0x00\r |
802 | #define NVME_ADMIN_CRIOSQ_CMD 0x01\r | |
803 | #define NVME_ADMIN_GET_LOG_PAGE_CMD 0x02\r | |
804 | #define NVME_ADMIN_DEIOCQ_CMD 0x04\r | |
805 | #define NVME_ADMIN_CRIOCQ_CMD 0x05\r | |
806 | #define NVME_ADMIN_IDENTIFY_CMD 0x06\r | |
807 | #define NVME_ADMIN_ABORT_CMD 0x08\r | |
808 | #define NVME_ADMIN_SET_FEATURES_CMD 0x09\r | |
809 | #define NVME_ADMIN_GET_FEATURES_CMD 0x0A\r | |
810 | #define NVME_ADMIN_ASYNC_EVENT_REQUEST_CMD 0x0C\r | |
811 | #define NVME_ADMIN_NAMESACE_MANAGEMENT_CMD 0x0D\r | |
812 | #define NVME_ADMIN_FW_COMMIT_CMD 0x10\r | |
813 | #define NVME_ADMIN_FW_IAMGE_DOWNLOAD_CMD 0x11\r | |
814 | #define NVME_ADMIN_NAMESACE_ATTACHMENT_CMD 0x15\r | |
815 | #define NVME_ADMIN_FORMAT_NVM_CMD 0x80\r | |
816 | #define NVME_ADMIN_SECURITY_SEND_CMD 0x81\r | |
817 | #define NVME_ADMIN_SECURITY_RECEIVE_CMD 0x82\r | |
818 | \r | |
819 | #define NVME_IO_FLUSH_OPC 0\r | |
820 | #define NVME_IO_WRITE_OPC 1\r | |
821 | #define NVME_IO_READ_OPC 2\r | |
111cd0dd DR |
822 | \r |
823 | typedef enum {\r | |
824 | DeleteIOSubmissionQueueOpcode = NVME_ADMIN_DEIOSQ_CMD,\r | |
825 | CreateIOSubmissionQueueOpcode = NVME_ADMIN_CRIOSQ_CMD,\r | |
2f88bd3a | 826 | GetLogPageOpcode = NVME_ADMIN_GET_LOG_PAGE_CMD,\r |
111cd0dd DR |
827 | DeleteIOCompletionQueueOpcode = NVME_ADMIN_DEIOCQ_CMD,\r |
828 | CreateIOCompletionQueueOpcode = NVME_ADMIN_CRIOCQ_CMD,\r | |
2f88bd3a MK |
829 | IdentifyOpcode = NVME_ADMIN_IDENTIFY_CMD,\r |
830 | AbortOpcode = NVME_ADMIN_ABORT_CMD,\r | |
831 | SetFeaturesOpcode = NVME_ADMIN_SET_FEATURES_CMD,\r | |
832 | GetFeaturesOpcode = NVME_ADMIN_GET_FEATURES_CMD,\r | |
833 | AsyncEventRequestOpcode = NVME_ADMIN_ASYNC_EVENT_REQUEST_CMD,\r | |
834 | NamespaceManagementOpcode = NVME_ADMIN_NAMESACE_MANAGEMENT_CMD,\r | |
835 | FirmwareCommitOpcode = NVME_ADMIN_FW_COMMIT_CMD,\r | |
836 | FirmwareImageDownloadOpcode = NVME_ADMIN_FW_IAMGE_DOWNLOAD_CMD,\r | |
837 | NamespaceAttachmentOpcode = NVME_ADMIN_NAMESACE_ATTACHMENT_CMD,\r | |
838 | FormatNvmOpcode = NVME_ADMIN_FORMAT_NVM_CMD,\r | |
839 | SecuritySendOpcode = NVME_ADMIN_SECURITY_SEND_CMD,\r | |
840 | SecurityReceiveOpcode = NVME_ADMIN_SECURITY_RECEIVE_CMD\r | |
111cd0dd DR |
841 | } NVME_ADMIN_COMMAND_OPCODE;\r |
842 | \r | |
843 | //\r | |
844 | // Controller or Namespace Structure (CNS) field\r | |
845 | // (ref. spec. v1.1 figure 82).\r | |
846 | //\r | |
847 | typedef enum {\r | |
2f88bd3a MK |
848 | IdentifyNamespaceCns = 0x0,\r |
849 | IdentifyControllerCns = 0x1,\r | |
850 | IdentifyActiveNsListCns = 0x2\r | |
111cd0dd DR |
851 | } NVME_ADMIN_IDENTIFY_CNS;\r |
852 | \r | |
853 | //\r | |
854 | // Commit Action\r | |
855 | // (ref. spec. 1.1 figure 60).\r | |
856 | //\r | |
857 | typedef enum {\r | |
2f88bd3a | 858 | ActivateActionReplace = 0x0,\r |
111cd0dd | 859 | ActivateActionReplaceActivate = 0x1,\r |
2f88bd3a | 860 | ActivateActionActivate = 0x2\r |
111cd0dd DR |
861 | } NVME_FW_ACTIVATE_ACTION;\r |
862 | \r | |
863 | //\r | |
864 | // Firmware Slot\r | |
865 | // (ref. spec. 1.1 Figure 60).\r | |
866 | //\r | |
867 | typedef enum {\r | |
868 | FirmwareSlotCtrlChooses = 0x0,\r | |
2f88bd3a MK |
869 | FirmwareSlot1 = 0x1,\r |
870 | FirmwareSlot2 = 0x2,\r | |
871 | FirmwareSlot3 = 0x3,\r | |
872 | FirmwareSlot4 = 0x4,\r | |
873 | FirmwareSlot5 = 0x5,\r | |
874 | FirmwareSlot6 = 0x6,\r | |
875 | FirmwareSlot7 = 0x7\r | |
111cd0dd DR |
876 | } NVME_FW_ACTIVATE_SLOT;\r |
877 | \r | |
878 | //\r | |
879 | // Get Log Page ? Log Page Identifiers\r | |
880 | // (ref. spec. v1.1 Figure 73).\r | |
881 | //\r | |
882 | typedef enum {\r | |
2f88bd3a MK |
883 | ErrorInfoLogID = LID_ERROR_INFO,\r |
884 | SmartHealthInfoLogID = LID_SMART_INFO,\r | |
111cd0dd DR |
885 | FirmwareSlotInfoLogID = LID_FW_SLOT_INFO\r |
886 | } NVME_LOG_ID;\r | |
887 | \r | |
888 | //\r | |
889 | // Get Log Page ? Firmware Slot Information Log\r | |
890 | // (ref. spec. v1.1 Figure 77).\r | |
891 | //\r | |
892 | typedef struct {\r | |
893 | //\r | |
894 | // Indicates the firmware slot from which the actively running firmware revision was loaded.\r | |
895 | //\r | |
2f88bd3a MK |
896 | UINT8 ActivelyRunningFwSlot : 3;\r |
897 | UINT8 : 1;\r | |
111cd0dd DR |
898 | //\r |
899 | // Indicates the firmware slot that is going to be activated at the next controller reset. If this field is 0h, then the controller does not indicate the firmware slot that is going to be activated at the next controller reset.\r | |
900 | //\r | |
2f88bd3a MK |
901 | UINT8 NextActiveFwSlot : 3;\r |
902 | UINT8 : 1;\r | |
111cd0dd DR |
903 | } NVME_ACTIVE_FW_INFO;\r |
904 | \r | |
905 | //\r | |
906 | // Get Log Page ? Firmware Slot Information Log\r | |
907 | // (ref. spec. v1.1 Figure 77).\r | |
908 | //\r | |
909 | typedef struct {\r | |
910 | //\r | |
911 | // Specifies information about the active firmware revision.\r | |
2f88bd3a MK |
912 | // s\r |
913 | NVME_ACTIVE_FW_INFO ActiveFwInfo;\r | |
914 | UINT8 Reserved1[7];\r | |
111cd0dd DR |
915 | //\r |
916 | // Contains the revision of the firmware downloaded to firmware slot 1/7. If no valid firmware revision is present or if this slot is unsupported, all zeros shall be returned.\r | |
917 | //\r | |
2f88bd3a MK |
918 | CHAR8 FwRevisionSlot[7][8];\r |
919 | UINT8 Reserved2[448];\r | |
111cd0dd DR |
920 | } NVME_FW_SLOT_INFO_LOG;\r |
921 | \r | |
922 | //\r | |
923 | // SMART / Health Information (Log Identifier 02h)\r | |
924 | // (ref. spec. v1.1 5.10.1.2)\r | |
925 | //\r | |
926 | typedef struct {\r | |
927 | //\r | |
928 | // This field indicates critical warnings for the state of the controller.\r | |
929 | //\r | |
2f88bd3a MK |
930 | UINT8 CriticalWarningAvailableSpare : 1;\r |
931 | UINT8 CriticalWarningTemperature : 1;\r | |
932 | UINT8 CriticalWarningReliability : 1;\r | |
933 | UINT8 CriticalWarningMediaReadOnly : 1;\r | |
934 | UINT8 CriticalWarningVolatileBackup : 1;\r | |
935 | UINT8 CriticalWarningReserved : 3;\r | |
111cd0dd DR |
936 | //\r |
937 | // Contains a value corresponding to a temperature in degrees Kelvin that represents the current composite temperature of the controller and namespace(s) associated with that controller. The manner in which this value is computed is implementation specific and may not represent the actual temperature of any physical point in the NVM subsystem.\r | |
938 | //\r | |
2f88bd3a | 939 | UINT16 CompositeTemp;\r |
111cd0dd DR |
940 | //\r |
941 | // Contains a normalized percentage (0 to 100%) of the remaining spare capacity available.\r | |
942 | //\r | |
2f88bd3a | 943 | UINT8 AvailableSpare;\r |
111cd0dd DR |
944 | //\r |
945 | // When the Available Spare falls below the threshold indicated in this field, an asynchronous event completion may occur. The value is indicated as a normalized percentage (0 to 100%).\r | |
946 | //\r | |
2f88bd3a | 947 | UINT8 AvailableSpareThreshold;\r |
111cd0dd | 948 | //\r |
b219e2cd | 949 | // Contains a vendor specific estimate of the percentage of NVM subsystem life used based on the actual usage and the manufacturer's prediction of NVM life. A value of 100 indicates that the estimated endurance of the NVM in the NVM subsystem has been consumed, but may not indicate an NVM subsystem failure. The value is allowed to exceed 100. Percentages greater than 254 shall be represented as 255. This value shall be updated once per power-on hour (when the controller is not in a sleep state).\r |
111cd0dd | 950 | //\r |
2f88bd3a MK |
951 | UINT8 PercentageUsed;\r |
952 | UINT8 Reserved1[26];\r | |
111cd0dd DR |
953 | //\r |
954 | // Contains the number of 512 byte data units the host has read from the controller; this value does not include metadata.\r | |
955 | //\r | |
2f88bd3a | 956 | UINT8 DataUnitsRead[16];\r |
111cd0dd DR |
957 | //\r |
958 | // Contains the number of 512 byte data units the host has written to the controller; this value does not include metadata.\r | |
959 | //\r | |
2f88bd3a | 960 | UINT8 DataUnitsWritten[16];\r |
111cd0dd DR |
961 | //\r |
962 | // Contains the number of read commands completed by the controller.\r | |
963 | //\r | |
2f88bd3a | 964 | UINT8 HostReadCommands[16];\r |
111cd0dd DR |
965 | //\r |
966 | // Contains the number of write commands completed by the controller.\r | |
967 | //\r | |
2f88bd3a | 968 | UINT8 HostWriteCommands[16];\r |
111cd0dd DR |
969 | //\r |
970 | // Contains the amount of time the controller is busy with I/O commands. This value is reported in minutes.\r | |
971 | //\r | |
2f88bd3a | 972 | UINT8 ControllerBusyTime[16];\r |
111cd0dd DR |
973 | //\r |
974 | // Contains the number of power cycles.\r | |
975 | //\r | |
2f88bd3a | 976 | UINT8 PowerCycles[16];\r |
111cd0dd DR |
977 | //\r |
978 | // Contains the number of power-on hours.\r | |
979 | //\r | |
2f88bd3a | 980 | UINT8 PowerOnHours[16];\r |
111cd0dd DR |
981 | //\r |
982 | // Contains the number of unsafe shutdowns.\r | |
983 | //\r | |
2f88bd3a | 984 | UINT8 UnsafeShutdowns[16];\r |
111cd0dd DR |
985 | //\r |
986 | // Contains the number of occurrences where the controller detected an unrecovered data integrity error.\r | |
987 | //\r | |
2f88bd3a | 988 | UINT8 MediaAndDataIntegrityErrors[16];\r |
111cd0dd DR |
989 | //\r |
990 | // Contains the number of Error Information log entries over the life of the controller.\r | |
991 | //\r | |
2f88bd3a | 992 | UINT8 NumberErrorInformationLogEntries[16];\r |
111cd0dd DR |
993 | //\r |
994 | // Contains the amount of time in minutes that the controller is operational and the Composite Temperature is greater than or equal to the Warning Composite Temperature Threshold (WCTEMP) field and less than the Critical Composite Temperature Threshold (CCTEMP) field in the Identify Controller data structure in Figure 90.\r | |
995 | //\r | |
2f88bd3a | 996 | UINT32 WarningCompositeTemperatureTime;\r |
111cd0dd DR |
997 | //\r |
998 | // Contains the amount of time in minutes that the controller is operational and the Composite Temperature is greater the Critical Composite Temperature Threshold (CCTEMP) field in the Identify Controller data structure in Figure 90.\r | |
999 | //\r | |
2f88bd3a | 1000 | UINT32 CriticalCompositeTemperatureTime;\r |
111cd0dd DR |
1001 | //\r |
1002 | // Contains the current temperature in degrees Kelvin reported by the temperature sensor. An implementation that does not implement the temperature sensor reports a temperature of zero degrees Kelvin.\r | |
1003 | //\r | |
2f88bd3a MK |
1004 | UINT16 TemperatureSensor[8];\r |
1005 | UINT8 Reserved2[296];\r | |
111cd0dd DR |
1006 | } NVME_SMART_HEALTH_INFO_LOG;\r |
1007 | \r | |
1008 | #pragma pack()\r | |
1009 | \r | |
1010 | #endif\r |