mca.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. /*
  2. * File: mca.h
  3. * Purpose: Machine check handling specific defines
  4. *
  5. * Copyright (C) 1999, 2004 Silicon Graphics, Inc.
  6. * Copyright (C) Vijay Chander <vijay@engr.sgi.com>
  7. * Copyright (C) Srinivasa Thirumalachar <sprasad@engr.sgi.com>
  8. * Copyright (C) Russ Anderson <rja@sgi.com>
  9. */
  10. #ifndef _ASM_IA64_MCA_H
  11. #define _ASM_IA64_MCA_H
  12. #if !defined(__ASSEMBLY__)
  13. #include <linux/interrupt.h>
  14. #include <linux/types.h>
  15. #include <asm/param.h>
  16. #include <asm/sal.h>
  17. #include <asm/processor.h>
  18. #include <asm/mca_asm.h>
  19. #define IA64_MCA_RENDEZ_TIMEOUT (20 * 1000) /* value in milliseconds - 20 seconds */
  20. typedef struct ia64_fptr {
  21. unsigned long fp;
  22. unsigned long gp;
  23. } ia64_fptr_t;
  24. typedef union cmcv_reg_u {
  25. u64 cmcv_regval;
  26. struct {
  27. u64 cmcr_vector : 8;
  28. u64 cmcr_reserved1 : 4;
  29. u64 cmcr_ignored1 : 1;
  30. u64 cmcr_reserved2 : 3;
  31. u64 cmcr_mask : 1;
  32. u64 cmcr_ignored2 : 47;
  33. } cmcv_reg_s;
  34. } cmcv_reg_t;
  35. #define cmcv_mask cmcv_reg_s.cmcr_mask
  36. #define cmcv_vector cmcv_reg_s.cmcr_vector
  37. enum {
  38. IA64_MCA_RENDEZ_CHECKIN_NOTDONE = 0x0,
  39. IA64_MCA_RENDEZ_CHECKIN_DONE = 0x1,
  40. IA64_MCA_RENDEZ_CHECKIN_INIT = 0x2,
  41. IA64_MCA_RENDEZ_CHECKIN_CONCURRENT_MCA = 0x3,
  42. };
  43. /* Information maintained by the MC infrastructure */
  44. typedef struct ia64_mc_info_s {
  45. u64 imi_mca_handler;
  46. size_t imi_mca_handler_size;
  47. u64 imi_monarch_init_handler;
  48. size_t imi_monarch_init_handler_size;
  49. u64 imi_slave_init_handler;
  50. size_t imi_slave_init_handler_size;
  51. u8 imi_rendez_checkin[NR_CPUS];
  52. } ia64_mc_info_t;
  53. /* Handover state from SAL to OS and vice versa, for both MCA and INIT events.
  54. * Besides the handover state, it also contains some saved registers from the
  55. * time of the event.
  56. * Note: mca_asm.S depends on the precise layout of this structure.
  57. */
  58. struct ia64_sal_os_state {
  59. /* SAL to OS */
  60. unsigned long os_gp; /* GP of the os registered with the SAL, physical */
  61. unsigned long pal_proc; /* PAL_PROC entry point, physical */
  62. unsigned long sal_proc; /* SAL_PROC entry point, physical */
  63. unsigned long rv_rc; /* MCA - Rendezvous state, INIT - reason code */
  64. unsigned long proc_state_param; /* from R18 */
  65. unsigned long monarch; /* 1 for a monarch event, 0 for a slave */
  66. /* common */
  67. unsigned long sal_ra; /* Return address in SAL, physical */
  68. unsigned long sal_gp; /* GP of the SAL - physical */
  69. pal_min_state_area_t *pal_min_state; /* from R17. physical in asm, virtual in C */
  70. /* Previous values of IA64_KR(CURRENT) and IA64_KR(CURRENT_STACK).
  71. * Note: if the MCA/INIT recovery code wants to resume to a new context
  72. * then it must change these values to reflect the new kernel stack.
  73. */
  74. unsigned long prev_IA64_KR_CURRENT; /* previous value of IA64_KR(CURRENT) */
  75. unsigned long prev_IA64_KR_CURRENT_STACK;
  76. struct task_struct *prev_task; /* previous task, NULL if it is not useful */
  77. /* Some interrupt registers are not saved in minstate, pt_regs or
  78. * switch_stack. Because MCA/INIT can occur when interrupts are
  79. * disabled, we need to save the additional interrupt registers over
  80. * MCA/INIT and resume.
  81. */
  82. unsigned long isr;
  83. unsigned long ifa;
  84. unsigned long itir;
  85. unsigned long iipa;
  86. unsigned long iim;
  87. unsigned long iha;
  88. /* OS to SAL */
  89. unsigned long os_status; /* OS status to SAL, enum below */
  90. unsigned long context; /* 0 if return to same context
  91. 1 if return to new context */
  92. /* I-resources */
  93. unsigned long iip;
  94. unsigned long ipsr;
  95. unsigned long ifs;
  96. };
  97. enum {
  98. IA64_MCA_CORRECTED = 0x0, /* Error has been corrected by OS_MCA */
  99. IA64_MCA_WARM_BOOT = -1, /* Warm boot of the system need from SAL */
  100. IA64_MCA_COLD_BOOT = -2, /* Cold boot of the system need from SAL */
  101. IA64_MCA_HALT = -3 /* System to be halted by SAL */
  102. };
  103. enum {
  104. IA64_INIT_RESUME = 0x0, /* Resume after return from INIT */
  105. IA64_INIT_WARM_BOOT = -1, /* Warm boot of the system need from SAL */
  106. };
  107. enum {
  108. IA64_MCA_SAME_CONTEXT = 0x0, /* SAL to return to same context */
  109. IA64_MCA_NEW_CONTEXT = -1 /* SAL to return to new context */
  110. };
  111. /* Per-CPU MCA state that is too big for normal per-CPU variables. */
  112. struct ia64_mca_cpu {
  113. u64 mca_stack[KERNEL_STACK_SIZE/8];
  114. u64 init_stack[KERNEL_STACK_SIZE/8];
  115. };
  116. /* Array of physical addresses of each CPU's MCA area. */
  117. extern unsigned long __per_cpu_mca[NR_CPUS];
  118. extern int cpe_vector;
  119. extern int ia64_cpe_irq;
  120. extern void ia64_mca_init(void);
  121. extern void ia64_mca_irq_init(void);
  122. extern void ia64_mca_cpu_init(void *);
  123. extern void ia64_os_mca_dispatch(void);
  124. extern void ia64_os_mca_dispatch_end(void);
  125. extern void ia64_mca_ucmc_handler(struct pt_regs *, struct ia64_sal_os_state *);
  126. extern void ia64_init_handler(struct pt_regs *,
  127. struct switch_stack *,
  128. struct ia64_sal_os_state *);
  129. extern void ia64_os_init_on_kdump(void);
  130. extern void ia64_monarch_init_handler(void);
  131. extern void ia64_slave_init_handler(void);
  132. extern void ia64_mca_cmc_vector_setup(void);
  133. extern int ia64_reg_MCA_extension(int (*fn)(void *, struct ia64_sal_os_state *));
  134. extern void ia64_unreg_MCA_extension(void);
  135. extern unsigned long ia64_get_rnat(unsigned long *);
  136. extern void ia64_set_psr_mc(void);
  137. extern void ia64_mca_printk(const char * fmt, ...)
  138. __attribute__ ((format (printf, 1, 2)));
  139. struct ia64_mca_notify_die {
  140. struct ia64_sal_os_state *sos;
  141. int *monarch_cpu;
  142. int *data;
  143. };
  144. DECLARE_PER_CPU(u64, ia64_mca_pal_base);
  145. #else /* __ASSEMBLY__ */
  146. #define IA64_MCA_CORRECTED 0x0 /* Error has been corrected by OS_MCA */
  147. #define IA64_MCA_WARM_BOOT -1 /* Warm boot of the system need from SAL */
  148. #define IA64_MCA_COLD_BOOT -2 /* Cold boot of the system need from SAL */
  149. #define IA64_MCA_HALT -3 /* System to be halted by SAL */
  150. #define IA64_INIT_RESUME 0x0 /* Resume after return from INIT */
  151. #define IA64_INIT_WARM_BOOT -1 /* Warm boot of the system need from SAL */
  152. #define IA64_MCA_SAME_CONTEXT 0x0 /* SAL to return to same context */
  153. #define IA64_MCA_NEW_CONTEXT -1 /* SAL to return to new context */
  154. #endif /* !__ASSEMBLY__ */
  155. #endif /* _ASM_IA64_MCA_H */