e752x_edac.c
来自「linux 内核源代码」· C语言 代码 · 共 1,153 行 · 第 1/3 页
C
1,153 行
{ *error_found = 1; if (handle_error) do_process_ded_retry(mci, error, retry_add);}static inline void process_threshold_ce(struct mem_ctl_info *mci, u16 error, int *error_found, int handle_error){ *error_found = 1; if (handle_error) e752x_mc_printk(mci, KERN_WARNING, "Memory threshold CE\n");}static char *global_message[11] = { "PCI Express C1", "PCI Express C", "PCI Express B1", "PCI Express B", "PCI Express A1", "PCI Express A", "DMA Controler", "HUB Interface", "System Bus", "DRAM Controler", "Internal Buffer"};static char *fatal_message[2] = { "Non-Fatal ", "Fatal " };static void do_global_error(int fatal, u32 errors){ int i; for (i = 0; i < 11; i++) { if (errors & (1 << i)) e752x_printk(KERN_WARNING, "%sError %s\n", fatal_message[fatal], global_message[i]); }}static inline void global_error(int fatal, u32 errors, int *error_found, int handle_error){ *error_found = 1; if (handle_error) do_global_error(fatal, errors);}static char *hub_message[7] = { "HI Address or Command Parity", "HI Illegal Access", "HI Internal Parity", "Out of Range Access", "HI Data Parity", "Enhanced Config Access", "Hub Interface Target Abort"};static void do_hub_error(int fatal, u8 errors){ int i; for (i = 0; i < 7; i++) { if (errors & (1 << i)) e752x_printk(KERN_WARNING, "%sError %s\n", fatal_message[fatal], hub_message[i]); }}static inline void hub_error(int fatal, u8 errors, int *error_found, int handle_error){ *error_found = 1; if (handle_error) do_hub_error(fatal, errors);}static char *membuf_message[4] = { "Internal PMWB to DRAM parity", "Internal PMWB to System Bus Parity", "Internal System Bus or IO to PMWB Parity", "Internal DRAM to PMWB Parity"};static void do_membuf_error(u8 errors){ int i; for (i = 0; i < 4; i++) { if (errors & (1 << i)) e752x_printk(KERN_WARNING, "Non-Fatal Error %s\n", membuf_message[i]); }}static inline void membuf_error(u8 errors, int *error_found, int handle_error){ *error_found = 1; if (handle_error) do_membuf_error(errors);}static char *sysbus_message[10] = { "Addr or Request Parity", "Data Strobe Glitch", "Addr Strobe Glitch", "Data Parity", "Addr Above TOM", "Non DRAM Lock Error", "MCERR", "BINIT", "Memory Parity", "IO Subsystem Parity"};static void do_sysbus_error(int fatal, u32 errors){ int i; for (i = 0; i < 10; i++) { if (errors & (1 << i)) e752x_printk(KERN_WARNING, "%sError System Bus %s\n", fatal_message[fatal], sysbus_message[i]); }}static inline void sysbus_error(int fatal, u32 errors, int *error_found, int handle_error){ *error_found = 1; if (handle_error) do_sysbus_error(fatal, errors);}static void e752x_check_hub_interface(struct e752x_error_info *info, int *error_found, int handle_error){ u8 stat8; //pci_read_config_byte(dev,E752X_HI_FERR,&stat8); stat8 = info->hi_ferr; if (stat8 & 0x7f) { /* Error, so process */ stat8 &= 0x7f; if (stat8 & 0x2b) hub_error(1, stat8 & 0x2b, error_found, handle_error); if (stat8 & 0x54) hub_error(0, stat8 & 0x54, error_found, handle_error); } //pci_read_config_byte(dev,E752X_HI_NERR,&stat8); stat8 = info->hi_nerr; if (stat8 & 0x7f) { /* Error, so process */ stat8 &= 0x7f; if (stat8 & 0x2b) hub_error(1, stat8 & 0x2b, error_found, handle_error); if (stat8 & 0x54) hub_error(0, stat8 & 0x54, error_found, handle_error); }}static void e752x_check_sysbus(struct e752x_error_info *info, int *error_found, int handle_error){ u32 stat32, error32; //pci_read_config_dword(dev,E752X_SYSBUS_FERR,&stat32); stat32 = info->sysbus_ferr + (info->sysbus_nerr << 16); if (stat32 == 0) return; /* no errors */ error32 = (stat32 >> 16) & 0x3ff; stat32 = stat32 & 0x3ff; if (stat32 & 0x087) sysbus_error(1, stat32 & 0x087, error_found, handle_error); if (stat32 & 0x378) sysbus_error(0, stat32 & 0x378, error_found, handle_error); if (error32 & 0x087) sysbus_error(1, error32 & 0x087, error_found, handle_error); if (error32 & 0x378) sysbus_error(0, error32 & 0x378, error_found, handle_error);}static void e752x_check_membuf(struct e752x_error_info *info, int *error_found, int handle_error){ u8 stat8; stat8 = info->buf_ferr; if (stat8 & 0x0f) { /* Error, so process */ stat8 &= 0x0f; membuf_error(stat8, error_found, handle_error); } stat8 = info->buf_nerr; if (stat8 & 0x0f) { /* Error, so process */ stat8 &= 0x0f; membuf_error(stat8, error_found, handle_error); }}static void e752x_check_dram(struct mem_ctl_info *mci, struct e752x_error_info *info, int *error_found, int handle_error){ u16 error_one, error_next; error_one = info->dram_ferr; error_next = info->dram_nerr; /* decode and report errors */ if (error_one & 0x0101) /* check first error correctable */ process_ce(mci, error_one, info->dram_sec1_add, info->dram_sec1_syndrome, error_found, handle_error); if (error_next & 0x0101) /* check next error correctable */ process_ce(mci, error_next, info->dram_sec2_add, info->dram_sec2_syndrome, error_found, handle_error); if (error_one & 0x4040) process_ue_no_info_wr(mci, error_found, handle_error); if (error_next & 0x4040) process_ue_no_info_wr(mci, error_found, handle_error); if (error_one & 0x2020) process_ded_retry(mci, error_one, info->dram_retr_add, error_found, handle_error); if (error_next & 0x2020) process_ded_retry(mci, error_next, info->dram_retr_add, error_found, handle_error); if (error_one & 0x0808) process_threshold_ce(mci, error_one, error_found, handle_error); if (error_next & 0x0808) process_threshold_ce(mci, error_next, error_found, handle_error); if (error_one & 0x0606) process_ue(mci, error_one, info->dram_ded_add, info->dram_scrb_add, error_found, handle_error); if (error_next & 0x0606) process_ue(mci, error_next, info->dram_ded_add, info->dram_scrb_add, error_found, handle_error);}static void e752x_get_error_info(struct mem_ctl_info *mci, struct e752x_error_info *info){ struct pci_dev *dev; struct e752x_pvt *pvt; memset(info, 0, sizeof(*info)); pvt = (struct e752x_pvt *)mci->pvt_info; dev = pvt->dev_d0f1; pci_read_config_dword(dev, E752X_FERR_GLOBAL, &info->ferr_global); if (info->ferr_global) { pci_read_config_byte(dev, E752X_HI_FERR, &info->hi_ferr); pci_read_config_word(dev, E752X_SYSBUS_FERR, &info->sysbus_ferr); pci_read_config_byte(dev, E752X_BUF_FERR, &info->buf_ferr); pci_read_config_word(dev, E752X_DRAM_FERR, &info->dram_ferr); pci_read_config_dword(dev, E752X_DRAM_SEC1_ADD, &info->dram_sec1_add); pci_read_config_word(dev, E752X_DRAM_SEC1_SYNDROME, &info->dram_sec1_syndrome); pci_read_config_dword(dev, E752X_DRAM_DED_ADD, &info->dram_ded_add); pci_read_config_dword(dev, E752X_DRAM_SCRB_ADD, &info->dram_scrb_add); pci_read_config_dword(dev, E752X_DRAM_RETR_ADD, &info->dram_retr_add); if (info->hi_ferr & 0x7f) pci_write_config_byte(dev, E752X_HI_FERR, info->hi_ferr); if (info->sysbus_ferr) pci_write_config_word(dev, E752X_SYSBUS_FERR, info->sysbus_ferr); if (info->buf_ferr & 0x0f) pci_write_config_byte(dev, E752X_BUF_FERR, info->buf_ferr); if (info->dram_ferr) pci_write_bits16(pvt->bridge_ck, E752X_DRAM_FERR, info->dram_ferr, info->dram_ferr); pci_write_config_dword(dev, E752X_FERR_GLOBAL, info->ferr_global); } pci_read_config_dword(dev, E752X_NERR_GLOBAL, &info->nerr_global); if (info->nerr_global) { pci_read_config_byte(dev, E752X_HI_NERR, &info->hi_nerr); pci_read_config_word(dev, E752X_SYSBUS_NERR, &info->sysbus_nerr); pci_read_config_byte(dev, E752X_BUF_NERR, &info->buf_nerr); pci_read_config_word(dev, E752X_DRAM_NERR, &info->dram_nerr); pci_read_config_dword(dev, E752X_DRAM_SEC2_ADD, &info->dram_sec2_add); pci_read_config_word(dev, E752X_DRAM_SEC2_SYNDROME, &info->dram_sec2_syndrome); if (info->hi_nerr & 0x7f) pci_write_config_byte(dev, E752X_HI_NERR, info->hi_nerr); if (info->sysbus_nerr) pci_write_config_word(dev, E752X_SYSBUS_NERR, info->sysbus_nerr); if (info->buf_nerr & 0x0f) pci_write_config_byte(dev, E752X_BUF_NERR, info->buf_nerr); if (info->dram_nerr) pci_write_bits16(pvt->bridge_ck, E752X_DRAM_NERR, info->dram_nerr, info->dram_nerr); pci_write_config_dword(dev, E752X_NERR_GLOBAL, info->nerr_global); }}static int e752x_process_error_info(struct mem_ctl_info *mci, struct e752x_error_info *info, int handle_errors){ u32 error32, stat32; int error_found; error_found = 0; error32 = (info->ferr_global >> 18) & 0x3ff; stat32 = (info->ferr_global >> 4) & 0x7ff; if (error32) global_error(1, error32, &error_found, handle_errors); if (stat32) global_error(0, stat32, &error_found, handle_errors); error32 = (info->nerr_global >> 18) & 0x3ff; stat32 = (info->nerr_global >> 4) & 0x7ff; if (error32) global_error(1, error32, &error_found, handle_errors); if (stat32) global_error(0, stat32, &error_found, handle_errors); e752x_check_hub_interface(info, &error_found, handle_errors); e752x_check_sysbus(info, &error_found, handle_errors); e752x_check_membuf(info, &error_found, handle_errors); e752x_check_dram(mci, info, &error_found, handle_errors); return error_found;}static void e752x_check(struct mem_ctl_info *mci){ struct e752x_error_info info; debugf3("%s()\n", __func__); e752x_get_error_info(mci, &info); e752x_process_error_info(mci, &info, 1);}/* Return 1 if dual channel mode is active. Else return 0. */static inline int dual_channel_active(u16 ddrcsr){
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?