⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mca.c

📁 嵌入式系统设计与实验教材二源码linux内核移植与编译
💻 C
📖 第 1 页 / 共 4 页
字号:
 */voidia64_log_prt_oem_data (int header_len, int sect_len, u8 *p_data, prfunc_t prfunc){	int oem_data_len, i;	if ((oem_data_len = header_len - sect_len) > 0) {		prfunc(" OEM Specific Data:");		for (i = 0; i < oem_data_len; i++, p_data++)			prfunc(" %02x", *p_data);	}	prfunc("\n");}/* *  ia64_log_rec_header_print * *  Log info from the SAL error record header. * *  Inputs  :   lh *    (ptr to SAL log error record header) *              prfunc  (fn ptr of log output function to use) *  Outputs :   None */voidia64_log_rec_header_print (sal_log_record_header_t *lh, prfunc_t prfunc){	char str_buf[32];	sprintf(str_buf, "%2d.%02d",		(lh->revision.major >> 4) * 10 + (lh->revision.major & 0xf),		(lh->revision.minor >> 4) * 10 + (lh->revision.minor & 0xf));	prfunc("+Err Record ID: %d    SAL Rev: %s\n", lh->id, str_buf);	sprintf(str_buf, "%02d/%02d/%04d/ %02d:%02d:%02d",		(lh->timestamp.slh_month >> 4) * 10 +		(lh->timestamp.slh_month & 0xf),		(lh->timestamp.slh_day >> 4) * 10 +		(lh->timestamp.slh_day & 0xf),		(lh->timestamp.slh_century >> 4) * 1000 +		(lh->timestamp.slh_century & 0xf) * 100 +		(lh->timestamp.slh_year >> 4) * 10 +		(lh->timestamp.slh_year & 0xf),		(lh->timestamp.slh_hour >> 4) * 10 +		(lh->timestamp.slh_hour & 0xf),		(lh->timestamp.slh_minute >> 4) * 10 +		(lh->timestamp.slh_minute & 0xf),		(lh->timestamp.slh_second >> 4) * 10 +		(lh->timestamp.slh_second & 0xf));	prfunc("+Time: %s    Severity %d\n", str_buf, lh->severity);}/* * ia64_log_processor_regs_print *	Print the contents of the saved processor register(s) in the format *		<reg_prefix>[<index>] <value> * * Inputs	:	regs		(Register save buffer) *			reg_num	(# of registers) *			reg_class	(application/banked/control/bank1_general) *			reg_prefix	(ar/br/cr/b1_gr) * Outputs	:	None * */voidia64_log_processor_regs_print(u64	*regs,			      int	reg_num,			      char	*reg_class,			      char	*reg_prefix,			      prfunc_t	prfunc){	int i;	prfunc("+%s Registers\n", reg_class);	for (i = 0; i < reg_num; i++)		prfunc("+ %s[%d] 0x%lx\n", reg_prefix, i, regs[i]);}/* * ia64_log_processor_fp_regs_print *  Print the contents of the saved floating page register(s) in the format *      <reg_prefix>[<index>] <value> * * Inputs:  ia64_fpreg  (Register save buffer) *          reg_num     (# of registers) *          reg_class   (application/banked/control/bank1_general) *          reg_prefix  (ar/br/cr/b1_gr) * Outputs: None * */voidia64_log_processor_fp_regs_print (struct ia64_fpreg *regs,                                  int               reg_num,                                  char              *reg_class,                                  char              *reg_prefix,                                  prfunc_t          prfunc){	int i;	prfunc("+%s Registers\n", reg_class);	for (i = 0; i < reg_num; i++)		prfunc("+ %s[%d] 0x%lx%016lx\n", reg_prefix, i, regs[i].u.bits[1],		       regs[i].u.bits[0]);}static char *pal_mesi_state[] = {	"Invalid",	"Shared",	"Exclusive",	"Modified",	"Reserved1",	"Reserved2",	"Reserved3",	"Reserved4"};static char *pal_cache_op[] = {	"Unknown",	"Move in",	"Cast out",	"Coherency check",	"Internal",	"Instruction fetch",	"Implicit Writeback",	"Reserved"};/* * ia64_log_cache_check_info_print *	Display the machine check information related to cache error(s). * Inputs:  i           (Multiple errors are logged, i - index of logged error) *          cc_info *   (Ptr to cache check info logged by the PAL and later *					 captured by the SAL) *          prfunc      (fn ptr of print function to be used for output) * Outputs: None */voidia64_log_cache_check_info_print (int                      i,                                 sal_log_mod_error_info_t *cache_check_info,				 prfunc_t		prfunc){	pal_cache_check_info_t  *info;	u64                     target_addr;	if (!cache_check_info->valid.check_info) {		IA64_MCA_DEBUG("ia64_mca_log_print: invalid cache_check_info[%d]\n",i);		return;                 /* If check info data not valid, skip it */	}	info        = (pal_cache_check_info_t *)&cache_check_info->check_info;	target_addr = cache_check_info->target_identifier;	prfunc("+ Cache check info[%d]\n+", i);	prfunc("  Level: L%d,",info->level);	if (info->mv)		prfunc(" Mesi: %s,",pal_mesi_state[info->mesi]);	prfunc(" Index: %d,", info->index);	if (info->ic)		prfunc(" Cache: Instruction,");	if (info->dc)		prfunc(" Cache: Data,");	if (info->tl)		prfunc(" Line: Tag,");	if (info->dl)		prfunc(" Line: Data,");	prfunc(" Operation: %s,", pal_cache_op[info->op]);	if (info->wv)		prfunc(" Way: %d,", info->way);	if (cache_check_info->valid.target_identifier)		/* Hope target address is saved in target_identifier */		if (info->tv)			prfunc(" Target Addr: 0x%lx,", target_addr);	if (info->mc)		prfunc(" MC: Corrected");	prfunc("\n");}/* * ia64_log_tlb_check_info_print *	Display the machine check information related to tlb error(s). * Inputs:  i           (Multiple errors are logged, i - index of logged error) *          tlb_info *  (Ptr to machine check info logged by the PAL and later *					 captured by the SAL) *          prfunc      (fn ptr of print function to be used for output) * Outputs: None */voidia64_log_tlb_check_info_print (int                      i,                               sal_log_mod_error_info_t *tlb_check_info,                               prfunc_t                 prfunc){	pal_tlb_check_info_t    *info;	if (!tlb_check_info->valid.check_info) {		IA64_MCA_DEBUG("ia64_mca_log_print: invalid tlb_check_info[%d]\n", i);		return;                 /* If check info data not valid, skip it */	}	info = (pal_tlb_check_info_t *)&tlb_check_info->check_info;	prfunc("+ TLB Check Info [%d]\n+", i);	if (info->itc)		prfunc("  Failure: Instruction Translation Cache");	if (info->dtc)		prfunc("  Failure: Data Translation Cache");	if (info->itr) {		prfunc("  Failure: Instruction Translation Register");		prfunc(" ,Slot: %d", info->tr_slot);	}	if (info->dtr) {		prfunc("  Failure: Data Translation Register");		prfunc(" ,Slot: %d", info->tr_slot);	}	if (info->mc)		prfunc(" ,MC: Corrected");	prfunc("\n");}/* * ia64_log_bus_check_info_print *	Display the machine check information related to bus error(s). * Inputs:  i           (Multiple errors are logged, i - index of logged error) *          bus_info *  (Ptr to machine check info logged by the PAL and later *					 captured by the SAL) *          prfunc      (fn ptr of print function to be used for output) * Outputs: None */voidia64_log_bus_check_info_print (int                      i,                               sal_log_mod_error_info_t *bus_check_info,                               prfunc_t                 prfunc){	pal_bus_check_info_t *info;	u64         req_addr;   /* Address of the requestor of the transaction */	u64         resp_addr;  /* Address of the responder of the transaction */	u64         targ_addr;  /* Address where the data was to be delivered to */	/* or obtained from */	if (!bus_check_info->valid.check_info) {		IA64_MCA_DEBUG("ia64_mca_log_print: invalid bus_check_info[%d]\n", i);		return;                 /* If check info data not valid, skip it */	}	info      = (pal_bus_check_info_t *)&bus_check_info->check_info;	req_addr  = bus_check_info->requestor_identifier;	resp_addr = bus_check_info->responder_identifier;	targ_addr = bus_check_info->target_identifier;	prfunc("+ BUS Check Info [%d]\n+", i);	prfunc(" Status Info: %d", info->bsi);	prfunc(" ,Severity: %d", info->sev);	prfunc(" ,Transaction Type: %d", info->type);	prfunc(" ,Transaction Size: %d", info->size);	if (info->cc)		prfunc(" ,Cache-cache-transfer");	if (info->ib)		prfunc(" ,Error: Internal");	if (info->eb)		prfunc(" ,Error: External");	if (info->mc)		prfunc(" ,MC: Corrected");	if (info->tv)		prfunc(" ,Target Address: 0x%lx", targ_addr);	if (info->rq)		prfunc(" ,Requestor Address: 0x%lx", req_addr);	if (info->tv)		prfunc(" ,Responder Address: 0x%lx", resp_addr);	prfunc("\n");}/* *  ia64_log_mem_dev_err_info_print * *  Format and log the platform memory device error record section data. * *  Inputs:  mem_dev_err_info * (Ptr to memory device error record section *                               returned by SAL) *           prfunc             (fn ptr of print function to be used for output) *  Outputs: None */voidia64_log_mem_dev_err_info_print (sal_log_mem_dev_err_info_t *mdei,                                 prfunc_t                   prfunc){	prfunc("+ Mem Error Detail: ");	if (mdei->valid.error_status)		prfunc(" Error Status: %#lx,", mdei->error_status);	if (mdei->valid.physical_addr)		prfunc(" Physical Address: %#lx,", mdei->physical_addr);	if (mdei->valid.addr_mask)		prfunc(" Address Mask: %#lx,", mdei->addr_mask);	if (mdei->valid.node)		prfunc(" Node: %d,", mdei->node);	if (mdei->valid.card)		prfunc(" Card: %d,", mdei->card);	if (mdei->valid.module)		prfunc(" Module: %d,", mdei->module);	if (mdei->valid.bank)		prfunc(" Bank: %d,", mdei->bank);	if (mdei->valid.device)		prfunc(" Device: %d,", mdei->device);	if (mdei->valid.row)		prfunc(" Row: %d,", mdei->row);	if (mdei->valid.column)		prfunc(" Column: %d,", mdei->column);	if (mdei->valid.bit_position)		prfunc(" Bit Position: %d,", mdei->bit_position);	if (mdei->valid.target_id)		prfunc(" ,Target Address: %#lx,", mdei->target_id);	if (mdei->valid.requestor_id)		prfunc(" ,Requestor Address: %#lx,", mdei->requestor_id);	if (mdei->valid.responder_id)		prfunc(" ,Responder Address: %#lx,", mdei->responder_id);	if (mdei->valid.bus_spec_data)		prfunc(" Bus Specific Data: %#lx,", mdei->bus_spec_data);	prfunc("\n");	if (mdei->valid.oem_id) {		u8  *p_data = &(mdei->oem_id[0]);		int i;		prfunc(" OEM Memory Controller ID:");		for (i = 0; i < 16; i++, p_data++)			prfunc(" %02x", *p_data);		prfunc("\n");	}	if (mdei->valid.oem_data) {		ia64_log_prt_oem_data((int)mdei->header.len,				      (int)sizeof(sal_log_mem_dev_err_info_t) - 1,				      &(mdei->oem_data[0]), prfunc);	}}/* *  ia64_log_sel_dev_err_info_print * *  Format and log the platform SEL device error record section data. * *  Inputs:  sel_dev_err_info * (Ptr to the SEL device error record section *                               returned by SAL) *           prfunc             (fn ptr of print function to be used for output) *  Outputs: None */voidia64_log_sel_dev_err_info_print (sal_log_sel_dev_err_info_t *sdei,                                 prfunc_t                   prfunc){	int     i;	prfunc("+ SEL Device Error Detail: ");	if (sdei->valid.record_id)		prfunc(" Record ID: %#x", sdei->record_id);	if (sdei->valid.record_type)		prfunc(" Record Type: %#x", sdei->record_type);	prfunc(" Time Stamp: ");	for (i = 0; i < 4; i++)		prfunc("%1d", sdei->timestamp[i]);	if (sdei->valid.generator_id)		prfunc(" Generator ID: %#x", sdei->generator_id);	if (sdei->valid.evm_rev)		prfunc(" Message Format Version: %#x", sdei->evm_rev);	if (sdei->valid.sensor_type)		prfunc(" Sensor Type: %#x", sdei->sensor_type);	if (sdei->valid.sensor_num)		prfunc(" Sensor Number: %#x", sdei->sensor_num);	if (sdei->valid.event_dir)		prfunc(" Event Direction Type: %#x", sdei->event_dir);	if (sdei->valid.event_data1)		prfunc(" Data1: %#x", sdei->event_data1);	if (sdei->valid.event_data2)		prfunc(" Data2: %#x", sdei->event_data2);	if (sdei->valid.event_data3)		prfunc(" Data3: %#x", sdei->event_data3);	prfunc("\n");}/* *  ia64_log_pci_bus_err_info_print * *  Format and log the platform PCI bus error record section data. * *  Inputs:  pci_bus_err_info * (Ptr to the PCI bus error record section *                               returned by SAL) *           prfunc             (fn ptr of print function to be used for output) *  Outputs: None */voidia64_log_pci_bus_err_info_print (sal_log_pci_bus_err_info_t *pbei,                                 prfunc_t                   prfunc){	prfunc("+ PCI Bus Error Detail: ");	if (pbei->valid.err_status)		prfunc(" Error Status: %#lx", pbei->err_status);	if (pbei->valid.err_type)		prfunc(" Error Type: %#x", pbei->err_type);	if (pbei->valid.bus_id)		prfunc(" Bus ID: %#x", pbei->bus_id);	if (pbei->valid.bus_address)		prfunc(" Bus Address: %#lx", pbei->bus_address);	if (pbei->valid.bus_data)		prfunc(" Bus Data: %#lx", pbei->bus_data);	if (pbei->valid.bus_cmd)		prfunc(" Bus Command: %#lx", pbei->bus_cmd);	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.oem_data)		prfunc("\n");	if (pbei->valid.oem_data) {		ia64_log_prt_oem_data((int)pbei->header.len,				      (int)sizeof(sal_log_pci_bus_err_info_t) - 1,				      &(pbei->oem_data[0]), prfunc);	}}/* *  ia64_log_smbios_dev_err_info_print * *  Format and log the platform SMBIOS device error record section data. * *  Inputs:  smbios_dev_err_info * (Ptr to the SMBIOS device error record *                                  section returned by SAL) *           prfunc             (fn ptr of print function to be used for output) *  Outputs: None */voidia64_log_smbios_dev_err_info_print (sal_log_smbios_dev_err_info_t *sdei,                                    prfunc_t                      prfunc){	u8      i;	prfunc("+ SMBIOS Device Error Detail: ");	if (sdei->valid.event_type)		prfunc(" Event Type: %#x", sdei->event_type);	if (sdei->valid.time_stamp) {		prfunc(" Time Stamp: ");		for (i = 0; i < 6; i++)			prfunc("%d", sdei->time_stamp[i]);	}	if ((sdei->valid.data) && (sdei->valid.length)) {		prfunc(" Data: ");		for (i = 0; i < sdei->length; i++)			prfunc(" %02x", sdei->data[i]);	}	prfunc("\n");}/* *  ia64_log_pci_comp_err_info_print * *  Format and log the platform PCI component error record section data. * *  Inputs:  pci_comp_err_info * (Ptr to the PCI component error record section *                                returned by SAL) *           prfunc             (fn ptr of print function to be used for output) *  Outputs: None */voidia64_log_pci_comp_err_info_print(sal_log_pci_comp_err_info_t *pcei,				 prfunc_t                     prfunc){	u32     n_mem_regs, n_io_regs;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -