crime.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 2001, 2003 Keith M Wesolowski
  7. * Copyright (C) 2005 Ilya A. Volynets <ilya@total-knowledge.com>
  8. */
  9. #include <linux/types.h>
  10. #include <linux/init.h>
  11. #include <linux/kernel.h>
  12. #include <linux/interrupt.h>
  13. #include <linux/module.h>
  14. #include <asm/bootinfo.h>
  15. #include <asm/io.h>
  16. #include <asm/mipsregs.h>
  17. #include <asm/page.h>
  18. #include <asm/ip32/crime.h>
  19. #include <asm/ip32/mace.h>
  20. struct sgi_crime __iomem *crime;
  21. struct sgi_mace __iomem *mace;
  22. EXPORT_SYMBOL_GPL(mace);
  23. void __init crime_init(void)
  24. {
  25. unsigned int id, rev;
  26. const int field = 2 * sizeof(unsigned long);
  27. set_io_port_base((unsigned long) ioremap(MACEPCI_LOW_IO, 0x2000000));
  28. crime = ioremap(CRIME_BASE, sizeof(struct sgi_crime));
  29. mace = ioremap(MACE_BASE, sizeof(struct sgi_mace));
  30. id = crime->id;
  31. rev = id & CRIME_ID_REV;
  32. id = (id & CRIME_ID_IDBITS) >> 4;
  33. printk(KERN_INFO "CRIME id %1x rev %d at 0x%0*lx\n",
  34. id, rev, field, (unsigned long) CRIME_BASE);
  35. }
  36. irqreturn_t crime_memerr_intr(unsigned int irq, void *dev_id)
  37. {
  38. unsigned long stat, addr;
  39. int fatal = 0;
  40. stat = crime->mem_error_stat & CRIME_MEM_ERROR_STAT_MASK;
  41. addr = crime->mem_error_addr & CRIME_MEM_ERROR_ADDR_MASK;
  42. printk("CRIME memory error at 0x%08lx ST 0x%08lx<", addr, stat);
  43. if (stat & CRIME_MEM_ERROR_INV)
  44. printk("INV,");
  45. if (stat & CRIME_MEM_ERROR_ECC) {
  46. unsigned long ecc_syn =
  47. crime->mem_ecc_syn & CRIME_MEM_ERROR_ECC_SYN_MASK;
  48. unsigned long ecc_gen =
  49. crime->mem_ecc_chk & CRIME_MEM_ERROR_ECC_CHK_MASK;
  50. printk("ECC,SYN=0x%08lx,GEN=0x%08lx,", ecc_syn, ecc_gen);
  51. }
  52. if (stat & CRIME_MEM_ERROR_MULTIPLE) {
  53. fatal = 1;
  54. printk("MULTIPLE,");
  55. }
  56. if (stat & CRIME_MEM_ERROR_HARD_ERR) {
  57. fatal = 1;
  58. printk("HARD,");
  59. }
  60. if (stat & CRIME_MEM_ERROR_SOFT_ERR)
  61. printk("SOFT,");
  62. if (stat & CRIME_MEM_ERROR_CPU_ACCESS)
  63. printk("CPU,");
  64. if (stat & CRIME_MEM_ERROR_VICE_ACCESS)
  65. printk("VICE,");
  66. if (stat & CRIME_MEM_ERROR_GBE_ACCESS)
  67. printk("GBE,");
  68. if (stat & CRIME_MEM_ERROR_RE_ACCESS)
  69. printk("RE,REID=0x%02lx,", (stat & CRIME_MEM_ERROR_RE_ID)>>8);
  70. if (stat & CRIME_MEM_ERROR_MACE_ACCESS)
  71. printk("MACE,MACEID=0x%02lx,", stat & CRIME_MEM_ERROR_MACE_ID);
  72. crime->mem_error_stat = 0;
  73. if (fatal) {
  74. printk("FATAL>\n");
  75. panic("Fatal memory error.");
  76. } else
  77. printk("NONFATAL>\n");
  78. return IRQ_HANDLED;
  79. }
  80. irqreturn_t crime_cpuerr_intr(unsigned int irq, void *dev_id)
  81. {
  82. unsigned long stat = crime->cpu_error_stat & CRIME_CPU_ERROR_MASK;
  83. unsigned long addr = crime->cpu_error_addr & CRIME_CPU_ERROR_ADDR_MASK;
  84. addr <<= 2;
  85. printk("CRIME CPU error at 0x%09lx status 0x%08lx\n", addr, stat);
  86. crime->cpu_error_stat = 0;
  87. return IRQ_HANDLED;
  88. }