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 2025 Oxide Computer Company 14 */ 15 16 #ifndef _SYS_NVME_MICRON_H 17 #define _SYS_NVME_MICRON_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 * This header contains all of the current vendor-specific entries for known 24 * Micron devices as well as common structures and definitions that are shared 25 * across multiple device families. 26 */ 27 28 #include <sys/nvme/micron_7300.h> 29 #include <sys/nvme/micron_74x0.h> 30 #include <sys/nvme/micron_x500.h> 31 #include <sys/nvme/micron_9550.h> 32 33 #ifdef __cplusplus 34 extern "C" { 35 #endif 36 37 #define MICRON_PCI_VID 0x1344 38 39 /* 40 * All data structures must be packed to account for the layout from the various 41 * programmer's manuals. 42 */ 43 #pragma pack(1) 44 45 /* 46 * Micron has a common extended SMART log that is used between multiple device 47 * families. Some fields have been added in newer device generations and they 48 * are reserved otherwise. Starting in the 6500/7500+ generation, the structure 49 * was extended in size and is defined in its device-specific section. 50 */ 51 typedef struct { 52 uint8_t mes_rsvd0[12]; 53 uint32_t mes_gbb; 54 uint32_t mes_max_erase; 55 uint32_t mes_power_on; 56 uint8_t mes_rsvd24[24]; 57 uint32_t mes_wp_reason; 58 uint8_t mes_rsvd52[12]; 59 uint64_t mes_cap; 60 uint8_t mes_rsvd72[8]; 61 uint64_t mes_erase_count; 62 uint64_t mes_use_rate; 63 /* 64 * Begin 7400+ specific fields. 65 */ 66 uint64_t mes_erase_fail; 67 uint8_t mes_rsvd104[8]; 68 uint64_t mes_uecc; 69 uint8_t mes_rsvd120[24]; 70 uint8_t mes_prog_fail[16]; 71 uint8_t mes_read_bytes[16]; 72 uint8_t mes_write_bytes[16]; 73 uint8_t mes_rsvd192[16]; 74 /* 75 * End 7400+ specific fields. 76 */ 77 uint32_t mes_trans_size; 78 uint32_t mes_bs_total; 79 uint32_t mes_bs_free; 80 uint64_t mes_bs_cap; 81 uint8_t mes_rsvd228[16]; 82 uint32_t mes_user_erase_min; 83 uint32_t mes_user_erase_avg; 84 uint32_t mes_user_erase_max; 85 } micron_vul_ext_smart_t; 86 87 typedef enum { 88 MICRON_VUL_WP_R_DRAM_DOUBLE_BIT = 1 << 0, 89 MICRON_VUL_WP_R_LOW_SPARE_BLOCKS = 1 << 1, 90 MICRON_VUL_WP_R_CAP_FAILURE = 1 << 2, 91 MICRON_VUL_WP_R_NVRAM_CKSUM = 1 << 3, 92 MICRON_VUL_WP_R_DRAM_RANGE = 1 << 4, 93 MICRON_VUL_WP_R_OVERTEMP = 1 << 5 94 } micron_vul_wp_reason_t; 95 96 /* 97 * Smatch can't handle packed structure sizeof calculations correctly, 98 * unfortunately. 99 */ 100 #ifndef __CHECKER__ 101 CTASSERT(sizeof (micron_vul_ext_smart_t) == 0x100); 102 #endif 103 104 #pragma pack() /* pack(1) */ 105 106 #ifdef __cplusplus 107 } 108 #endif 109 110 #endif /* _SYS_NVME_MICRON_H */ 111