📄 mca.c
字号:
u64 i, n_pci_data; u64 *p_reg_data; u8 *p_oem_data; prfunc("+ PCI Component Error Detail: "); if (pcei->valid.err_status) prfunc(" Error Status: %#lx\n", pcei->err_status); if (pcei->valid.comp_info) prfunc(" Component Info: Vendor Id = %#x, Device Id = %#x," " Class Code = %#x, Seg/Bus/Dev/Func = %d/%d/%d/%d\n", pcei->comp_info.vendor_id, pcei->comp_info.device_id, pcei->comp_info.class_code, pcei->comp_info.seg_num, pcei->comp_info.bus_num, pcei->comp_info.dev_num, pcei->comp_info.func_num); n_mem_regs = (pcei->valid.num_mem_regs) ? pcei->num_mem_regs : 0; n_io_regs = (pcei->valid.num_io_regs) ? pcei->num_io_regs : 0; p_reg_data = &(pcei->reg_data_pairs[0]); p_oem_data = (u8 *)p_reg_data + (n_mem_regs + n_io_regs) * 2 * sizeof(u64); n_pci_data = p_oem_data - (u8 *)pcei; if (n_pci_data > pcei->header.len) { prfunc(" Invalid PCI Component Error Record format: length = %ld, " " Size PCI Data = %d, Num Mem-Map/IO-Map Regs = %ld/%ld\n", pcei->header.len, n_pci_data, n_mem_regs, n_io_regs); return; } if (n_mem_regs) { prfunc(" Memory Mapped Registers\n Address \tValue\n"); for (i = 0; i < pcei->num_mem_regs; i++) { prfunc(" %#lx %#lx\n", p_reg_data[0], p_reg_data[1]); p_reg_data += 2; } } if (n_io_regs) { prfunc(" I/O Mapped Registers\n Address \tValue\n"); for (i = 0; i < pcei->num_io_regs; i++) { prfunc(" %#lx %#lx\n", p_reg_data[0], p_reg_data[1]); p_reg_data += 2; } } if (pcei->valid.oem_data) { ia64_log_prt_oem_data((int)pcei->header.len, n_pci_data, p_oem_data, prfunc); prfunc("\n"); }}/* * ia64_log_plat_specific_err_info_print * * Format and log the platform specifie error record section data. * * Inputs: sel_dev_err_info * (Ptr to the platform specific error record * section returned by SAL) * prfunc (fn ptr of print function to be used for output) * Outputs: None */voidia64_log_plat_specific_err_info_print (sal_log_plat_specific_err_info_t *psei, prfunc_t prfunc){ prfunc("+ Platform Specific Error Detail: "); if (psei->valid.err_status) prfunc(" Error Status: %#lx", psei->err_status); if (psei->valid.guid) { prfunc(" GUID: "); ia64_log_prt_guid(&psei->guid, prfunc); } if (psei->valid.oem_data) { ia64_log_prt_oem_data((int)psei->header.len, (int)sizeof(sal_log_plat_specific_err_info_t) - 1, &(psei->oem_data[0]), prfunc); } prfunc("\n");}/* * ia64_log_host_ctlr_err_info_print * * Format and log the platform host controller error record section data. * * Inputs: host_ctlr_err_info * (Ptr to the host controller error record * section returned by SAL) * prfunc (fn ptr of print function to be used for output) * Outputs: None */voidia64_log_host_ctlr_err_info_print (sal_log_host_ctlr_err_info_t *hcei, prfunc_t prfunc){ prfunc("+ Host Controller Error Detail: "); if (hcei->valid.err_status) prfunc(" Error Status: %#lx", hcei->err_status); if (hcei->valid.requestor_id) prfunc(" Requestor ID: %#lx", hcei->requestor_id); if (hcei->valid.responder_id) prfunc(" Responder ID: %#lx", hcei->responder_id); if (hcei->valid.target_id) prfunc(" Target ID: %#lx", hcei->target_id); if (hcei->valid.bus_spec_data) prfunc(" Bus Specific Data: %#lx", hcei->bus_spec_data); if (hcei->valid.oem_data) { ia64_log_prt_oem_data((int)hcei->header.len, (int)sizeof(sal_log_host_ctlr_err_info_t) - 1, &(hcei->oem_data[0]), prfunc); } prfunc("\n");}/* * ia64_log_plat_bus_err_info_print * * Format and log the platform bus error record section data. * * Inputs: plat_bus_err_info * (Ptr to the platform bus error record section * returned by SAL) * prfunc (fn ptr of print function to be used for output) * Outputs: None */voidia64_log_plat_bus_err_info_print (sal_log_plat_bus_err_info_t *pbei, prfunc_t prfunc){ prfunc("+ Platform Bus Error Detail: "); if (pbei->valid.err_status) prfunc(" Error Status: %#lx", pbei->err_status); if (pbei->valid.requestor_id) prfunc(" Requestor ID: %#lx", pbei->requestor_id); if (pbei->valid.responder_id) prfunc(" Responder ID: %#lx", pbei->responder_id); if (pbei->valid.target_id) prfunc(" Target ID: %#lx", pbei->target_id); if (pbei->valid.bus_spec_data) prfunc(" Bus Specific Data: %#lx", pbei->bus_spec_data); if (pbei->valid.oem_data) { ia64_log_prt_oem_data((int)pbei->header.len, (int)sizeof(sal_log_plat_bus_err_info_t) - 1, &(pbei->oem_data[0]), prfunc); } prfunc("\n");}/* * ia64_log_proc_dev_err_info_print * * Display the processor device error record. * * Inputs: sal_log_processor_info_t * (Ptr to processor device error record * section body). * prfunc (fn ptr of print function to be used * for output). * Outputs: None */voidia64_log_proc_dev_err_info_print (sal_log_processor_info_t *slpi, prfunc_t prfunc){#ifdef MCA_PRT_XTRA_DATA size_t d_len = slpi->header.len - sizeof(sal_log_section_hdr_t);#endif sal_processor_static_info_t *spsi; int i; sal_log_mod_error_info_t *p_data; prfunc("+Processor Device Error Info Section\n");#ifdef MCA_PRT_XTRA_DATA // for test only @FVL { char *p_data = (char *)&slpi->valid; prfunc("SAL_PROC_DEV_ERR SECTION DATA: Data buffer = %p, " "Data size = %ld\n", (void *)p_data, d_len); ia64_log_hexdump(p_data, d_len, prfunc); prfunc("End of SAL_PROC_DEV_ERR SECTION DATA\n"); }#endif // MCA_PRT_XTRA_DATA for test only @FVL if (slpi->valid.proc_error_map) prfunc(" Processor Error Map: %#lx\n", slpi->proc_error_map); if (slpi->valid.proc_state_param) prfunc(" Processor State Param: %#lx\n", slpi->proc_state_parameter); if (slpi->valid.proc_cr_lid) prfunc(" Processor LID: %#lx\n", slpi->proc_cr_lid); /* * Note: March 2001 SAL spec states that if the number of elements in any * of the MOD_ERROR_INFO_STRUCT arrays is zero, the entire array is * absent. Also, current implementations only allocate space for number of * elements used. So we walk the data pointer from here on. */ p_data = &slpi->cache_check_info[0]; /* Print the cache check information if any*/ for (i = 0 ; i < slpi->valid.num_cache_check; i++, p_data++) ia64_log_cache_check_info_print(i, p_data, prfunc); /* Print the tlb check information if any*/ for (i = 0 ; i < slpi->valid.num_tlb_check; i++, p_data++) ia64_log_tlb_check_info_print(i, p_data, prfunc); /* Print the bus check information if any*/ for (i = 0 ; i < slpi->valid.num_bus_check; i++, p_data++) ia64_log_bus_check_info_print(i, p_data, prfunc); /* Print the reg file check information if any*/ for (i = 0 ; i < slpi->valid.num_reg_file_check; i++, p_data++) ia64_log_hexdump((u8 *)p_data, sizeof(sal_log_mod_error_info_t), prfunc); /* Just hex dump for now */ /* Print the ms check information if any*/ for (i = 0 ; i < slpi->valid.num_ms_check; i++, p_data++) ia64_log_hexdump((u8 *)p_data, sizeof(sal_log_mod_error_info_t), prfunc); /* Just hex dump for now */ /* Print CPUID registers if any*/ if (slpi->valid.cpuid_info) { u64 *p = (u64 *)p_data; prfunc(" CPUID Regs: %#lx %#lx %#lx %#lx\n", p[0], p[1], p[2], p[3]); p_data++; } /* Print processor static info if any */ if (slpi->valid.psi_static_struct) { spsi = (sal_processor_static_info_t *)p_data; /* Print branch register contents if valid */ if (spsi->valid.br) ia64_log_processor_regs_print(spsi->br, 8, "Branch", "br", prfunc); /* Print control register contents if valid */ if (spsi->valid.cr) ia64_log_processor_regs_print(spsi->cr, 128, "Control", "cr", prfunc); /* Print application register contents if valid */ if (spsi->valid.ar) ia64_log_processor_regs_print(spsi->ar, 128, "Application", "ar", prfunc); /* Print region register contents if valid */ if (spsi->valid.rr) ia64_log_processor_regs_print(spsi->rr, 8, "Region", "rr", prfunc); /* Print floating-point register contents if valid */ if (spsi->valid.fr) ia64_log_processor_fp_regs_print(spsi->fr, 128, "Floating-point", "fr", prfunc); }}/* * ia64_log_processor_info_print * * Display the processor-specific information logged by PAL as a part * of MCA or INIT or CMC. * * Inputs : lh (Pointer of the sal log header which specifies the * format of SAL state info as specified by the SAL spec). * prfunc (fn ptr of print function to be used for output). * Outputs : None */voidia64_log_processor_info_print(sal_log_record_header_t *lh, prfunc_t prfunc){ sal_log_section_hdr_t *slsh; int n_sects; int ercd_pos; if (!lh) return;#ifdef MCA_PRT_XTRA_DATA // for test only @FVL ia64_log_prt_record_header(lh, prfunc);#endif // MCA_PRT_XTRA_DATA for test only @FVL if ((ercd_pos = sizeof(sal_log_record_header_t)) >= lh->len) { IA64_MCA_DEBUG("ia64_mca_log_print: " "truncated SAL CMC error record. len = %d\n", lh->len); return; } /* Print record header info */ ia64_log_rec_header_print(lh, prfunc); for (n_sects = 0; (ercd_pos < lh->len); n_sects++, ercd_pos += slsh->len) { /* point to next section header */ slsh = (sal_log_section_hdr_t *)((char *)lh + ercd_pos);#ifdef MCA_PRT_XTRA_DATA // for test only @FVL ia64_log_prt_section_header(slsh, prfunc);#endif // MCA_PRT_XTRA_DATA for test only @FVL if (verify_guid((void *)&slsh->guid, (void *)&(SAL_PROC_DEV_ERR_SECT_GUID))) { IA64_MCA_DEBUG("ia64_mca_log_print: unsupported record section\n"); continue; } /* * Now process processor device error record section */ ia64_log_proc_dev_err_info_print((sal_log_processor_info_t *)slsh, printk); } IA64_MCA_DEBUG("ia64_mca_log_print: " "found %d sections in SAL CMC error record. len = %d\n", n_sects, lh->len); if (!n_sects) { prfunc("No Processor Device Error Info Section found\n"); return; }}/* * ia64_log_platform_info_print * * Format and Log the SAL Platform Error Record. * * Inputs : lh (Pointer to the sal error record header with format * specified by the SAL spec). * prfunc (fn ptr of log output function to use) * Outputs : None */voidia64_log_platform_info_print (sal_log_record_header_t *lh, prfunc_t prfunc){ sal_log_section_hdr_t *slsh; int n_sects; int ercd_pos; if (!lh) return;#ifdef MCA_PRT_XTRA_DATA // for test only @FVL ia64_log_prt_record_header(lh, prfunc);#endif // MCA_PRT_XTRA_DATA for test only @FVL if ((ercd_pos = sizeof(sal_log_record_header_t)) >= lh->len) { IA64_MCA_DEBUG("ia64_mca_log_print: " "truncated SAL error record. len = %d\n", lh->len); return; } /* Print record header info */ ia64_log_rec_header_print(lh, prfunc); for (n_sects = 0; (ercd_pos < lh->len); n_sects++, ercd_pos += slsh->len) { /* point to next section header */ slsh = (sal_log_section_hdr_t *)((char *)lh + ercd_pos);#ifdef MCA_PRT_XTRA_DATA // for test only @FVL ia64_log_prt_section_header(slsh, prfunc); if (efi_guidcmp(slsh->guid, SAL_PROC_DEV_ERR_SECT_GUID) != 0) { size_t d_len = slsh->len - sizeof(sal_log_section_hdr_t); char *p_data = (char *)&((sal_log_mem_dev_err_info_t *)slsh)->valid; prfunc("Start of Platform Err Data Section: Data buffer = %p, " "Data size = %ld\n", (void *)p_data, d_len); ia64_log_hexdump(p_data, d_len, prfunc); prfunc("End of Platform Err Data Section\n"); }#endif // MCA_PRT_XTRA_DATA for test only @FVL /* * Now process CPE error record section */ if (efi_guidcmp(slsh->guid, SAL_PROC_DEV_ERR_SECT_GUID) == 0) { ia64_log_proc_dev_err_info_print((sal_log_processor_info_t *)slsh, prfunc); } else if (efi_guidcmp(slsh->guid, SAL_PLAT_MEM_DEV_ERR_SECT_GUID) == 0) { prfunc("+Platform Memory Device Error Info Section\n"); ia64_log_mem_dev_err_info_print((sal_log_mem_dev_err_info_t *)slsh, prfunc); } else if (efi_guidcmp(slsh->guid, SAL_PLAT_SEL_DEV_ERR_SECT_GUID) == 0) { prfunc("+Platform SEL Device Error Info Section\n"); ia64_log_sel_dev_err_info_print((sal_log_sel_dev_err_info_t *)slsh, prfunc); } else if (efi_guidcmp(slsh->guid, SAL_PLAT_PCI_BUS_ERR_SECT_GUID) == 0) { prfunc("+Platform PCI Bus Error Info Section\n"); ia64_log_pci_bus_err_info_print((sal_log_pci_bus_err_info_t *)slsh, prfunc); } else if (efi_guidcmp(slsh->guid, SAL_PLAT_SMBIOS_DEV_ERR_SECT_GUID) == 0) { prfunc("+Platform SMBIOS Device Error Info Section\n"); ia64_log_smbios_dev_err_info_print((sal_log_smbios_dev_err_info_t *)slsh, prfunc); } else if (efi_guidcmp(slsh->guid, SAL_PLAT_PCI_COMP_ERR_SECT_GUID) == 0) { prfunc("+Platform PCI Component Error Info Section\n"); ia64_log_pci_comp_err_info_print((sal_log_pci_comp_err_info_t *)slsh, prfunc); } else if (efi_guidcmp(slsh->guid, SAL_PLAT_SPECIFIC_ERR_SECT_GUID) == 0) { prfunc("+Platform Specific Error Info Section\n"); ia64_log_plat_specific_err_info_print((sal_log_plat_specific_err_info_t *) slsh, prfunc); } else if (efi_guidcmp(slsh->guid, SAL_PLAT_HOST_CTLR_ERR_SECT_GUID) == 0) { prfunc("+Platform Host Controller Error Info Section\n"); ia64_log_host_ctlr_err_info_print((sal_log_host_ctlr_err_info_t *)slsh, prfunc); } else if (efi_guidcmp(slsh->guid, SAL_PLAT_BUS_ERR_SECT_GUID) == 0) { prfunc("+Platform Bus Error Info Section\n"); ia64_log_plat_bus_err_info_print((sal_log_plat_bus_err_info_t *)slsh, prfunc); } else { IA64_MCA_DEBUG("ia64_mca_log_print: unsupported record section\n"); continue; } } IA64_MCA_DEBUG("ia64_mca_log_print: found %d sections in SAL error record. len = %d\n", n_sects, lh->len); if (!n_sects) { prfunc("No Platform Error Info Sections found\n"); return; }}/* * ia64_log_print * * Displays the contents of the OS error log information * * Inputs : info_type (SAL_INFO_TYPE_{MCA,INIT,CMC,CPE}) * prfunc (fn ptr of log output function to use) * Outputs : None */voidia64_log_print(int sal_info_type, prfunc_t prfunc){ switch(sal_info_type) { case SAL_INFO_TYPE_MCA: prfunc("+BEGIN HARDWARE ERROR STATE AT MCA\n"); ia64_log_platform_info_print(IA64_LOG_CURR_BUFFER(sal_info_type), prfunc); prfunc("+END HARDWARE ERROR STATE AT MCA\n"); break; case SAL_INFO_TYPE_INIT: prfunc("+MCA INIT ERROR LOG (UNIMPLEMENTED)\n"); break; case SAL_INFO_TYPE_CMC: prfunc("+BEGIN HARDWARE ERROR STATE AT CMC\n"); ia64_log_processor_info_print(IA64_LOG_CURR_BUFFER(sal_info_type), prfunc); prfunc("+END HARDWARE ERROR STATE AT CMC\n"); break; case SAL_INFO_TYPE_CPE: prfunc("+BEGIN HARDWARE ERROR STATE AT CPE\n"); ia64_log_platform_info_print(IA64_LOG_CURR_BUFFER(sal_info_type), prfunc); prfunc("+END HARDWARE ERROR STATE AT CPE\n"); break; default: prfunc("+MCA UNKNOWN ERROR LOG (UNIMPLEMENTED)\n"); break; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -