|
11 | 11 | #include <stdlib.h> |
12 | 12 | #include <stdio.h> |
13 | 13 |
|
| 14 | +#include <ccan/array_size/array_size.h> |
14 | 15 | #include <ccan/endian/endian.h> |
15 | 16 |
|
16 | 17 | #include "log.h" |
@@ -1282,3 +1283,37 @@ nvme_mi_ctrl_t nvme_mi_next_ctrl(nvme_mi_ep_t ep, nvme_mi_ctrl_t c) |
1282 | 1283 | { |
1283 | 1284 | return c ? list_next(&ep->controllers, c, ep_entry) : NULL; |
1284 | 1285 | } |
| 1286 | + |
| 1287 | + |
| 1288 | +static const char *const mi_status[] = { |
| 1289 | + [NVME_MI_RESP_MPR] = "More Processing Required: The command message is in progress and requires more time to complete processing", |
| 1290 | + [NVME_MI_RESP_INTERNAL_ERR] = "Internal Error: The request message could not be processed due to a vendor-specific error", |
| 1291 | + [NVME_MI_RESP_INVALID_OPCODE] = "Invalid Command Opcode", |
| 1292 | + [NVME_MI_RESP_INVALID_PARAM] = "Invalid Parameter", |
| 1293 | + [NVME_MI_RESP_INVALID_CMD_SIZE] = "Invalid Command Size: The size of the message body of the request was different than expected", |
| 1294 | + [NVME_MI_RESP_INVALID_INPUT_SIZE] = "Invalid Command Input Data Size: The command requires data and contains too much or too little data", |
| 1295 | + [NVME_MI_RESP_ACCESS_DENIED] = "Access Denied. Processing prohibited due to a vendor-specific mechanism of the Command and Feature lockdown function", |
| 1296 | + [NVME_MI_RESP_VPD_UPDATES_EXCEEDED] = "VPD Updates Exceeded", |
| 1297 | + [NVME_MI_RESP_PCIE_INACCESSIBLE] = "PCIe Inaccessible. The PCIe functionality is not available at this time", |
| 1298 | + [NVME_MI_RESP_MEB_SANITIZED] = "Management Endpoint Buffer Cleared Due to Sanitize", |
| 1299 | + [NVME_MI_RESP_ENC_SERV_FAILURE] = "Enclosure Services Failure", |
| 1300 | + [NVME_MI_RESP_ENC_SERV_XFER_FAILURE] = "Enclosure Services Transfer Failure: Communication with the Enclosure Services Process has failed", |
| 1301 | + [NVME_MI_RESP_ENC_FAILURE] = "An unrecoverable enclosure failure has been detected by the Enclosuer Services Process", |
| 1302 | + [NVME_MI_RESP_ENC_XFER_REFUSED] = "Enclosure Services Transfer Refused: The NVM Subsystem or Enclosure Services Process indicated an error or an invalid format in communication", |
| 1303 | + [NVME_MI_RESP_ENC_FUNC_UNSUP] = "Unsupported Enclosure Function: An SES Send command has been attempted to a simple Subenclosure", |
| 1304 | + [NVME_MI_RESP_ENC_SERV_UNAVAIL] = "Enclosure Services Unavailable: The NVM Subsystem or Enclosure Services Process has encountered an error but may become available again", |
| 1305 | + [NVME_MI_RESP_ENC_DEGRADED] = "Enclosure Degraded: A noncritical failure has been detected by the Enclosure Services Process", |
| 1306 | + [NVME_MI_RESP_SANITIZE_IN_PROGRESS] = "Sanitize In Progress: The requested command is prohibited while a sanitize operation is in progress", |
| 1307 | +}; |
| 1308 | + |
| 1309 | +/* kept in mi.c while we have a split libnvme/libnvme-mi; consider moving |
| 1310 | + * to utils.c (with nvme_status_to_string) if we ever merge. */ |
| 1311 | +const char *nvme_mi_status_to_string(int status) |
| 1312 | +{ |
| 1313 | + const char *s = "Unknown status"; |
| 1314 | + |
| 1315 | + if (status < ARRAY_SIZE(mi_status) && mi_status[status]) |
| 1316 | + s = mi_status[status]; |
| 1317 | + |
| 1318 | + return s; |
| 1319 | +} |
0 commit comments