1 /* 2 * This file and its contents are supplied under the terms of the 3 * Common Development and Distribution License ("CDDL"), version 1.0. 4 * You may only use this file in accordance with the terms of version 5 * 1.0 of the CDDL. 6 * 7 * A full copy of the text of the CDDL should have accompanied this 8 * source. A copy of the CDDL is also available via the Internet at 9 * http://www.illumos.org/license/CDDL. 10 */ 11 12 /* 13 * Copyright 2024 Oxide Computer Company 14 */ 15 16 #ifndef _SYS_NVME_KIOXIA_CD8_H 17 #define _SYS_NVME_KIOXIA_CD8_H 18 19 /* 20 * This header defines vendor-specific NVMe interfaces and is not a committed 21 * interface. Its contents and existence are subject to change. 22 * 23 * Vendor-specific definitions for the Kioxia CD8 and CD8P. 24 */ 25 26 #include <sys/debug.h> 27 #include <sys/nvme/ocp.h> 28 29 #ifdef __cplusplus 30 extern "C" { 31 #endif 32 33 #define KIOXIA_CD8_DID 0x1f 34 #define KIOXIA_CD8P_DID 0x2b 35 36 typedef enum { 37 KIOXIA_CD8_LOG_OCP_SMART = OCP_LOG_DSSD_SMART, 38 KIOXIA_CD8_LOG_OCP_ERRREC = OCP_LOG_DSSD_ERROR_REC, 39 KIOXIA_CD8_LOG_OCP_FWACT = OCP_LOG_DSSD_FWACT, 40 KIOXIA_CD8_LOG_OCP_LATENCY = OCP_LOG_DSSD_LATENCY, 41 KIOXIA_CD8_LOG_OCP_DEV_CAP = OCP_LOG_DSSD_DEV_CAP, 42 KIOXIA_CD8_LOG_OCP_UNSUP = OCP_LOG_DSSD_UNSUP_REQ, 43 /* 44 * Uses the kioxia_vul_cd8_extsmart_t. 45 */ 46 KIOXIA_CD8_LOG_EXTSMART = 0xca 47 } kioxia_cd8_vul_t; 48 49 /* 50 * All data structures must be packed to account for the layout from the various 51 * programmer's manuals. 52 */ 53 #pragma pack(1) 54 typedef struct { 55 uint8_t kes_id; 56 uint8_t kes_rsvd1[2]; 57 uint8_t kse_norm; 58 uint8_t kes_rsvd4; 59 uint8_t kse_raw[6]; 60 uint8_t kse_rsvd11; 61 } kioxia_extsmart_ent_t; 62 63 /* 64 * These are the different type keys that exist for the kioxia_extsmart_ent_t 65 * above. Note, entries in the latter part of the log just use zero keys. 66 */ 67 typedef enum { 68 SOLIDIGM_SMART_TYPE_PROGRAM_FAIL = 0xab, 69 SOLIDIGM_SMART_TYPE_ERASE_FAIL = 0xac, 70 SOLIDIGM_SMART_TYPE_WEAR_LEVEL = 0xad, 71 SOLIDIGM_SMART_TYPE_E2E_ERROR_DET = 0xb8, 72 SOLIDIGM_SMART_TYPE_CRC_ERROR = 0xc7, 73 SOLIDIGM_SMART_TYPE_NAND_WRITE = 0xf4, 74 SOLIDIGM_SMART_TYPE_HOST_WRITE = 0xf5 75 } solidigm_smart_type_t; 76 77 78 typedef struct { 79 kioxia_extsmart_ent_t cds_prog_fail; 80 kioxia_extsmart_ent_t cds_erase_fail; 81 kioxia_extsmart_ent_t cds_wear_level; 82 kioxia_extsmart_ent_t cds_e2e_det; 83 kioxia_extsmart_ent_t cds_crc_error; 84 uint8_t cds_rvsd60[132 - 60]; 85 kioxia_extsmart_ent_t cds_nand_write; 86 kioxia_extsmart_ent_t cds_host_write; 87 uint8_t cds_rsvd156[256 - 156]; 88 kioxia_extsmart_ent_t cds_crit_warn; 89 kioxia_extsmart_ent_t cds_host_read; 90 kioxia_extsmart_ent_t cds_comp_temp; 91 kioxia_extsmart_ent_t cds_life_used; 92 kioxia_extsmart_ent_t cds_power_cycles; 93 kioxia_extsmart_ent_t cds_power_hours; 94 kioxia_extsmart_ent_t cds_unsafe_shut; 95 uint8_t cds_rsvd340[512 - 340]; 96 } kioxia_vul_cd8_smart_t; 97 #pragma pack() /* pack(1) */ 98 /* 99 * Our current version of smatch cannot handle packed structures. 100 */ 101 #ifndef __CHECKER__ 102 CTASSERT(sizeof (kioxia_extsmart_ent_t) == 12); 103 CTASSERT(sizeof (kioxia_vul_cd8_smart_t) == 512); 104 #endif /* __CHECKER__ */ 105 106 #ifdef __cplusplus 107 } 108 #endif 109 110 #endif /* _SYS_NVME_KIOXIA_CD8_H */ 111