编辑: bingyan8 | 2019-07-16 |
3 LSI SAS告警信息分析 我们分析一下打印语句的来源 mptbase: ioc0: LogInfo(0x30030501): Originator={IOP}, Code={Invalid Page}, SubCode(0x0501) cb_idx mptctl_reply . 在SAS控制器中断处理过程中,每次都会检查IOCStatus中是否有Log信息.若有Log信息,就打印出 相关Log代码. 00447: static void 00448: m mp pt t_ _r re ep pl ly y(MPT_ADAPTER *ioc, u32 pa) 00449: { 00450: MPT_FRAME_HDR *mf;
00451: MPT_FRAME_HDR *mr;
00452: u16 req_idx;
00453: u8 cb_idx;
00454: int freeme;
... ... 00481: / * Check/ log IOC log info 00482: */ 00483: ioc_stat = le16_to_cpu(mr- >
u.reply.IOCStatus);
00484: if (ioc_stat &
MPI_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE) { 00485: u32 log_info = le32_to_cpu(mr- >
u.reply.IOCLogInfo);
00486: if (ioc- >
bus_type == FC) 00487: mpt_fc_log_info(ioc, log_info);
00488: else if (ioc- >
bus_type == SPI) 00489: mpt_spi_log_info(ioc, log_info);
00490: else if (ioc- >
bus_type == SAS) 00491: mpt_sas_log_info(ioc, log_info, cb_idx);
00492: } ... .. LogInfo(0x30030501): Originator={IOP}, Code={Invalid Page}, SubCode(0x0501) ,这段语句来源 驱动模块mptbase,在文件drivers/message/fusion/mptbase.c,函数mpt_sas_log_info( )中打印. 函数完整源码如下: LSI SAS控制器驱动报告Invalid Page原因分析 http://www.ilinuxkernel.com 第8页共22 页08017: m mp pt t_ _s sa as s_ _l lo og g_ _i in nf fo o(MPT_ADAPTER *ioc, u32 log_info, u8 cb_idx) 08018: { 08019: union loginfo_type { 08020: u32 loginfo;
08021: struct { 08022: u32 subcode:16;
08023: u32 code:8;
08024: u32 originator:4;
08025: u32 bus_type:4;
08026: }dw;
08027: };
08028: union loginfo_type sas_loginfo;
08029: char *originator_desc = NULL;
08030: char *code_desc = NULL;
08031: char *sub_code_desc = NULL;
08032: 08033: sas_loginfo.loginfo = log_info;
08034: if ((sas_loginfo.dw.bus_type ! =
3 / *SAS*/ ) &
&
08035: (sas_loginfo.dw.originator <
ARRAY_SIZE(originator_str ))) 08036: return;
08037: 08038: originator_desc = originator_str [sas_loginfo.dw.originator];
08039: 08040: switch (sas_loginfo.dw.originator) { 08041: 08042: case 0: / * IOP */ 08043: if (sas_loginfo.dw.code <
08044: ARRAY_SIZE(iop_code_str )) 08045: code_desc = iop_code_str [sas_loginfo.dw.code];
08046: break;
08047: case 1: / * PL */ 08048: if (sas_loginfo.dw.code <
08049: ARRAY_SIZE(pl_code_str )) 08050: code_desc = pl_code_str [sas_loginfo.dw.code];
08051: break;
08052: case 2: / * IR */ 08053: if (sas_loginfo.dw.code >
= 08054: ARRAY_SIZE(ir_code_str )) 08055: break;
08056: code_desc = ir_code_str [sas_loginfo.dw.code];
08057: if (sas_loginfo.dw.subcode >
= 08058: ARRAY_SIZE(raid_sub_code_str )) 08059: break;
08060: if (sas_loginfo.dw.code == 0) 08061: sub_code_desc = 08062: raid_sub_code_str [sas_loginfo.dw.subcode];
08063: break;
08064: default: LSI SAS控制器驱动报告Invalid Page原因分析 http://www.ilinuxkernel.com 第9页共22 页08065: return;
08066: } ? end switch sas_loginfo.dw.origin...? 08067: 08068: if (sub_code_desc ! = NULL) 08069: printk(MYIOC_s_INFO_FMT 08070: LogInfo(0x%08x): Originator={%s}, Code={%s}, 08071: SubCode={%........