mca_drv.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /*
  2. * File: mca_drv.h
  3. * Purpose: Define helpers for Generic MCA handling
  4. *
  5. * Copyright (C) 2004 FUJITSU LIMITED
  6. * Copyright (C) 2004 Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
  7. */
  8. /*
  9. * Processor error section:
  10. *
  11. * +-sal_log_processor_info_t *info-------------+
  12. * | sal_log_section_hdr_t header; |
  13. * | ... |
  14. * | sal_log_mod_error_info_t info[0]; |
  15. * +-+----------------+-------------------------+
  16. * | CACHE_CHECK | ^ num_cache_check v
  17. * +----------------+
  18. * | TLB_CHECK | ^ num_tlb_check v
  19. * +----------------+
  20. * | BUS_CHECK | ^ num_bus_check v
  21. * +----------------+
  22. * | REG_FILE_CHECK | ^ num_reg_file_check v
  23. * +----------------+
  24. * | MS_CHECK | ^ num_ms_check v
  25. * +-struct cpuid_info *id----------------------+
  26. * | regs[5]; |
  27. * | reserved; |
  28. * +-sal_processor_static_info_t *regs----------+
  29. * | valid; |
  30. * | ... |
  31. * | fr[128]; |
  32. * +--------------------------------------------+
  33. */
  34. /* peidx: index of processor error section */
  35. typedef struct peidx_table {
  36. sal_log_processor_info_t *info;
  37. struct sal_cpuid_info *id;
  38. sal_processor_static_info_t *regs;
  39. } peidx_table_t;
  40. #define peidx_head(p) (((p)->info))
  41. #define peidx_mid(p) (((p)->id))
  42. #define peidx_bottom(p) (((p)->regs))
  43. #define peidx_psp(p) (&(peidx_head(p)->proc_state_parameter))
  44. #define peidx_field_valid(p) (&(peidx_head(p)->valid))
  45. #define peidx_minstate_area(p) (&(peidx_bottom(p)->min_state_area))
  46. #define peidx_cache_check_num(p) (peidx_head(p)->valid.num_cache_check)
  47. #define peidx_tlb_check_num(p) (peidx_head(p)->valid.num_tlb_check)
  48. #define peidx_bus_check_num(p) (peidx_head(p)->valid.num_bus_check)
  49. #define peidx_reg_file_check_num(p) (peidx_head(p)->valid.num_reg_file_check)
  50. #define peidx_ms_check_num(p) (peidx_head(p)->valid.num_ms_check)
  51. #define peidx_cache_check_idx(p, n) (n)
  52. #define peidx_tlb_check_idx(p, n) (peidx_cache_check_idx(p, peidx_cache_check_num(p)) + n)
  53. #define peidx_bus_check_idx(p, n) (peidx_tlb_check_idx(p, peidx_tlb_check_num(p)) + n)
  54. #define peidx_reg_file_check_idx(p, n) (peidx_bus_check_idx(p, peidx_bus_check_num(p)) + n)
  55. #define peidx_ms_check_idx(p, n) (peidx_reg_file_check_idx(p, peidx_reg_file_check_num(p)) + n)
  56. #define peidx_mod_error_info(p, name, n) \
  57. ({ int __idx = peidx_##name##_idx(p, n); \
  58. sal_log_mod_error_info_t *__ret = NULL; \
  59. if (peidx_##name##_num(p) > n) /*BUG*/ \
  60. __ret = &(peidx_head(p)->info[__idx]); \
  61. __ret; })
  62. #define peidx_cache_check(p, n) peidx_mod_error_info(p, cache_check, n)
  63. #define peidx_tlb_check(p, n) peidx_mod_error_info(p, tlb_check, n)
  64. #define peidx_bus_check(p, n) peidx_mod_error_info(p, bus_check, n)
  65. #define peidx_reg_file_check(p, n) peidx_mod_error_info(p, reg_file_check, n)
  66. #define peidx_ms_check(p, n) peidx_mod_error_info(p, ms_check, n)
  67. #define peidx_check_info(proc, name, n) \
  68. ({ \
  69. sal_log_mod_error_info_t *__info = peidx_mod_error_info(proc, name, n);\
  70. u64 __temp = __info && __info->valid.check_info \
  71. ? __info->check_info : 0; \
  72. __temp; })
  73. /* slidx: index of SAL log error record */
  74. typedef struct slidx_list {
  75. struct list_head list;
  76. sal_log_section_hdr_t *hdr;
  77. } slidx_list_t;
  78. typedef struct slidx_table {
  79. sal_log_record_header_t *header;
  80. int n_sections; /* # of section headers */
  81. struct list_head proc_err;
  82. struct list_head mem_dev_err;
  83. struct list_head sel_dev_err;
  84. struct list_head pci_bus_err;
  85. struct list_head smbios_dev_err;
  86. struct list_head pci_comp_err;
  87. struct list_head plat_specific_err;
  88. struct list_head host_ctlr_err;
  89. struct list_head plat_bus_err;
  90. struct list_head unsupported; /* list of unsupported sections */
  91. } slidx_table_t;
  92. #define slidx_foreach_entry(pos, head) \
  93. list_for_each_entry(pos, head, list)
  94. #define slidx_first_entry(head) \
  95. (((head)->next != (head)) ? list_entry((head)->next, typeof(slidx_list_t), list) : NULL)
  96. #define slidx_count(slidx, sec) \
  97. ({ int __count = 0; \
  98. slidx_list_t *__pos; \
  99. slidx_foreach_entry(__pos, &((slidx)->sec)) { __count++; }\
  100. __count; })
  101. struct mca_table_entry {
  102. int start_addr; /* location-relative starting address of MCA recoverable range */
  103. int end_addr; /* location-relative ending address of MCA recoverable range */
  104. };
  105. extern const struct mca_table_entry *search_mca_tables (unsigned long addr);
  106. extern int mca_recover_range(unsigned long);
  107. extern void ia64_mlogbuf_dump(void);