mca.h 5.9 KB

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