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 Racktop Systems, Inc. 14 */ 15 #ifndef _MFI_EVT_H 16 #define _MFI_EVT_H 17 18 #include <sys/types.h> 19 #include <sys/debug.h> 20 21 #include <sys/scsi/adapters/mfi/mfi.h> 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 28 typedef struct mfi_aen mfi_aen_t; 29 30 typedef struct mfi_evt mfi_evt_t; 31 typedef struct mfi_evt_log_info mfi_evt_log_info_t; 32 typedef struct mfi_evt_detail mfi_evt_detail_t; 33 typedef struct mfi_evt_list mfi_evt_list_t; 34 35 typedef struct mfi_evtarg_cdb_sense mfi_evtarg_cdb_sense_t; 36 typedef struct mfi_evtarg_ld mfi_evtarg_ld_t; 37 typedef struct mfi_evtarg_ld_count mfi_evtarg_ld_count_t; 38 typedef struct mfi_evtarg_ld_lba mfi_evtarg_ld_lba_t; 39 typedef struct mfi_evtarg_ld_owner mfi_evtarg_ld_owner_t; 40 typedef struct mfi_evtarg_ld_lba_pd_lba mfi_evtarg_ld_lba_pd_lba_t; 41 typedef struct mfi_evtarg_ld_progress mfi_evtarg_ld_progress_t; 42 typedef struct mfi_evtarg_ld_state mfi_evtarg_ld_state_t; 43 typedef struct mfi_evtarg_ld_strip mfi_evtarg_ld_strip_t; 44 typedef struct mfi_evtarg_pd mfi_evtarg_pd_t; 45 typedef struct mfi_evtarg_pd_err mfi_evtarg_pd_err_t; 46 typedef struct mfi_evtarg_pd_lba mfi_evtarg_pd_lba_t; 47 typedef struct mfi_evtarg_pd_lba_ld mfi_evtarg_pd_lba_ld_t; 48 typedef struct mfi_evtarg_pd_progress mfi_evtarg_pd_progress_t; 49 typedef struct mfi_evtarg_pd_state mfi_evtarg_pd_state_t; 50 typedef struct mfi_evtarg_pci mfi_evtarg_pci_t; 51 typedef struct mfi_evtarg_time mfi_evtarg_time_t; 52 typedef struct mfi_evtarg_ecc mfi_evtarg_ecc_t; 53 54 55 /* 56 * Asynchronous Event Notifications 57 */ 58 #define MFI_EVT_CFG_CLEARED 0x0004 59 #define MFI_EVT_CTRL_PATROL_READ_COMPLETE 0x0023 60 #define MFI_EVT_CTRL_PATROL_READ_RESUMED 0x0026 61 #define MFI_EVT_CTRL_PATROL_READ_START 0x0027 62 #define MFI_EVT_LD_BG_INIT_PROGRESS 0x0034 63 #define MFI_EVT_LD_CC_COMPLETE 0x003a 64 #define MFI_EVT_LD_CC_PROGRESS 0x0041 65 #define MFI_EVT_LD_CC_STARTED 0x0042 66 #define MFI_EVT_LD_INIT_ABORTED 0x0043 67 #define MFI_EVT_LD_INIT_PROGRESS 0x0045 68 #define MFI_EVT_LD_FAST_INIT_STARTED 0x0046 69 #define MFI_EVT_LD_FULL_INIT_STARTED 0x0047 70 #define MFI_EVT_LD_INIT_COMPLETE 0x0048 71 #define MFI_EVT_LD_PROP_CHANGED 0x0049 72 #define MFI_EVT_LD_STATE_CHANGE 0x0051 73 #define MFI_EVT_PD_INSERTED 0x005b 74 #define MFI_EVT_PD_PATROL_READ_PROGRESS 0x005e 75 #define MFI_EVT_PD_REMOVED 0x0070 76 #define MFI_EVT_PD_CHANGED 0x0072 77 #define MFI_EVT_LD_CREATED 0x008a 78 #define MFI_EVT_LD_DELETED 0x008b 79 #define MFI_EVT_FOREIGN_CFG_IMPORTED 0x00db 80 #define MFI_EVT_LD_OPTIMAL 0x00f9 81 #define MFI_EVT_LD_OFFLINE 0x00fc 82 #define MFI_EVT_PD_RESET 0x010c 83 #define MFI_EVT_CTRL_PATROL_READ_CANT_START 0x0124 84 #define MFI_EVT_CTRL_PROP_CHANGED 0x012f 85 #define MFI_EVT_LD_BBT_CLEARED 0x014f 86 #define MFI_EVT_CTRL_HOST_BUS_SCAN_REQD 0x0152 87 #define MFI_EVT_LD_AVAILABLE 0x0172 88 #define MFI_EVT_CTRL_PERF_COLLECTION 0x017e 89 #define MFI_EVT_CTRL_BOOTDEV_SET 0x01ec 90 #define MFI_EVT_CTRL_BOOTDEV_RESET 0x01f3 91 #define MFI_EVT_CTRL_PERSONALITY_CHANGE 0x0206 92 #define MFI_EVT_CTRL_PERSONALITY_CHANGE_PEND 0x0222 93 #define MFI_EVT_CTRL_NR_OF_VALID_SNAPDUMP 0x024e 94 95 #define MFI_EVT_CLASS_DEBUG (int8_t)-2 96 #define MFI_EVT_CLASS_PROGRESS (int8_t)-1 97 #define MFI_EVT_CLASS_INFO 0 98 #define MFI_EVT_CLASS_WARNING 1 99 #define MFI_EVT_CLASS_CRITICAL 2 100 #define MFI_EVT_CLASS_FATAL 3 101 #define MFI_EVT_CLASS_DEAD 4 102 103 #define MFI_EVT_LOCALE_LD 0x0001 104 #define MFI_EVT_LOCALE_PD 0x0002 105 #define MFI_EVT_LOCALE_ENCL 0x0004 106 #define MFI_EVT_LOCALE_BBU 0x0008 107 #define MFI_EVT_LOCALE_SAS 0x0010 108 #define MFI_EVT_LOCALE_CTRL 0x0020 109 #define MFI_EVT_LOCALE_CONFIG 0x0040 110 #define MFI_EVT_LOCALE_CLUSTER 0x0080 111 #define MFI_EVT_LOCALE_ALL 0xffff 112 113 #define MFI_EVT_ARGS_NONE 0 114 #define MFI_EVT_ARGS_CDB_SENSE 1 115 #define MFI_EVT_ARGS_LD 2 116 #define MFI_EVT_ARGS_LD_COUNT 3 117 #define MFI_EVT_ARGS_LD_LBA 4 118 #define MFI_EVT_ARGS_LD_OWNER 5 119 #define MFI_EVT_ARGS_LD_LBA_PD_LBA 6 120 #define MFI_EVT_ARGS_LD_PROG 7 121 #define MFI_EVT_ARGS_LD_STATE 8 122 #define MFI_EVT_ARGS_LD_STRIP 9 123 #define MFI_EVT_ARGS_PD 10 124 #define MFI_EVT_ARGS_PD_ERR 11 125 #define MFI_EVT_ARGS_PD_LBA 12 126 #define MFI_EVT_ARGS_PD_LBA_LD 13 127 #define MFI_EVT_ARGS_PD_PROG 14 128 #define MFI_EVT_ARGS_PD_STATE 15 129 #define MFI_EVT_ARGS_PCI 16 130 #define MFI_EVT_ARGS_RATE 17 131 #define MFI_EVT_ARGS_STR 18 132 #define MFI_EVT_ARGS_TIME 19 133 #define MFI_EVT_ARGS_ECC 20 134 135 #pragma pack(1) 136 137 struct mfi_aen { 138 uint16_t aen_host_no; 139 uint16_t aen_cmd_status; 140 uint32_t aen_seqnum; 141 uint32_t aen_class_locale_word; 142 }; 143 144 struct mfi_evt { 145 uint16_t evt_locale; 146 uint8_t evt_rsvd; 147 int8_t evt_class; 148 }; 149 150 struct mfi_evt_log_info { 151 uint32_t eli_newest_seqnum; 152 uint32_t eli_oldest_seqnum; 153 uint32_t eli_clear_seqnum; 154 uint32_t eli_shutdown_seqnum; 155 uint32_t eli_boot_seqnum; 156 }; 157 158 struct mfi_evtarg_ld { 159 uint16_t el_tgtid; 160 uint8_t el_ld_id; 161 uint8_t el_rsvd; 162 }; 163 164 struct mfi_evtarg_pd { 165 uint16_t ep_dev_id; 166 uint8_t ep_enc_idx; 167 uint8_t ep_slot; 168 }; 169 170 struct mfi_evtarg_cdb_sense { 171 mfi_evtarg_pd_t cs_pd; 172 uint8_t cs_cdb_len; 173 uint8_t cs_sense_len; 174 uint8_t cs_rsvd[2]; 175 uint8_t cs_cdb[16]; 176 uint8_t cs_sense[64]; 177 }; 178 179 struct mfi_evtarg_ld_count { 180 mfi_evtarg_ld_t lc_ld; 181 uint64_t lc_count; 182 }; 183 184 struct mfi_evtarg_ld_lba { 185 uint64_t ll_lba; 186 mfi_evtarg_ld_t ll_ld; 187 }; 188 189 struct mfi_evtarg_ld_owner { 190 mfi_evtarg_ld_t lo_ld; 191 uint32_t lo_prev_owner; 192 uint32_t lo_new_owner; 193 }; 194 195 struct mfi_evtarg_ld_lba_pd_lba { 196 uint64_t llpl_ld_lba; 197 uint64_t llpl_pd_lba; 198 mfi_evtarg_ld_t llpl_ld; 199 mfi_evtarg_pd_t llpl_pd; 200 }; 201 202 struct mfi_evtarg_ld_progress { 203 mfi_evtarg_ld_t lp_ld; 204 mfi_progress_t lp_progress; 205 }; 206 207 struct mfi_evtarg_ld_state { 208 mfi_evtarg_ld_t ls_ld; 209 uint32_t ls_prev_state; 210 uint32_t ls_new_state; 211 }; 212 213 struct mfi_evtarg_ld_strip { 214 uint64_t ls_strip; 215 mfi_evtarg_ld_t ls_ld; 216 }; 217 218 struct mfi_evtarg_pd_err { 219 mfi_evtarg_pd_t pe_pd; 220 uint64_t pe_err; 221 }; 222 223 struct mfi_evtarg_pd_lba { 224 uint64_t pl_lba; 225 mfi_evtarg_pd_t pl_pd; 226 }; 227 228 struct mfi_evtarg_pd_lba_ld { 229 uint64_t pll_lba; 230 mfi_evtarg_pd_t pll_pd; 231 mfi_evtarg_ld_t pll_ld; 232 }; 233 234 struct mfi_evtarg_pd_progress { 235 mfi_evtarg_pd_t pp_pd; 236 mfi_progress_t pp_progress; 237 }; 238 239 struct mfi_evtarg_pd_state { 240 mfi_evtarg_pd_t ps_pd; 241 uint32_t ps_prev_state; 242 uint32_t ps_new_state; 243 }; 244 245 struct mfi_evtarg_pci { 246 uint16_t pci_vendor_id; 247 uint16_t pci_device_id; 248 uint16_t pci_sub_vendor_id; 249 uint16_t pci_sub_device_id; 250 }; 251 252 struct mfi_evtarg_time { 253 uint32_t t_rtc; 254 uint16_t t_elapsed; 255 }; 256 257 struct mfi_evtarg_ecc { 258 uint32_t ecc_ecar; 259 uint32_t ecc_elog; 260 char ecc_str[64]; 261 }; 262 263 struct mfi_evt_detail { 264 uint32_t evt_seqnum; 265 uint32_t evt_timestamp; 266 uint32_t evt_code; 267 mfi_evt_t evt_cl; 268 uint8_t evt_argtype; 269 uint8_t evt_rsvd2[15]; 270 union { 271 mfi_evtarg_cdb_sense_t evt_cdb_sense; 272 mfi_evtarg_ld_t evt_ld; 273 mfi_evtarg_ld_count_t evt_ld_count; 274 mfi_evtarg_ld_lba_t evt_ld_lba; 275 mfi_evtarg_ld_owner_t evt_ld_owner; 276 mfi_evtarg_ld_lba_pd_lba_t evt_ld_lba_pd_lba; 277 mfi_evtarg_ld_progress_t evt_ld_progress; 278 mfi_evtarg_ld_state_t evt_ld_state; 279 mfi_evtarg_ld_strip_t evt_ld_strip; 280 mfi_evtarg_pd_t evt_pd; 281 mfi_evtarg_pd_err_t evt_pd_err; 282 mfi_evtarg_pd_lba_t evt_pd_lba; 283 mfi_evtarg_pd_lba_ld_t evt_pd_lba_ld; 284 mfi_evtarg_pd_progress_t evt_pd_progress; 285 mfi_evtarg_pd_state_t evt_pd_state; 286 mfi_evtarg_pci_t evt_pci; 287 uint32_t evt_rebuild_rate; 288 mfi_evtarg_time_t evt_time; 289 mfi_evtarg_ecc_t evt_ecc; 290 291 char evt_str[96]; 292 }; 293 char evt_descr[128]; 294 }; 295 CTASSERT(sizeof (mfi_evt_detail_t) == 256); 296 297 struct mfi_evt_list { 298 uint32_t el_count; 299 uint32_t el_rsvd; 300 mfi_evt_detail_t el_evt[0]; 301 }; 302 303 #pragma pack(0) 304 305 306 #ifdef __cplusplus 307 } 308 #endif 309 310 #endif /* _MFI_EVT_H */ 311