Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ENTRY_H
0003 #define _ENTRY_H
0004 
0005 #include <linux/kernel.h>
0006 #include <linux/types.h>
0007 #include <linux/init.h>
0008 
0009 /* irq */
0010 void handler_irq(int irq, struct pt_regs *regs);
0011 
0012 #ifdef CONFIG_SPARC32
0013 /* traps */
0014 void do_hw_interrupt(struct pt_regs *regs, unsigned long type);
0015 void do_illegal_instruction(struct pt_regs *regs, unsigned long pc,
0016                             unsigned long npc, unsigned long psr);
0017 
0018 void do_priv_instruction(struct pt_regs *regs, unsigned long pc,
0019                          unsigned long npc, unsigned long psr);
0020 void do_memaccess_unaligned(struct pt_regs *regs, unsigned long pc,
0021                             unsigned long npc, unsigned long psr);
0022 void do_fpd_trap(struct pt_regs *regs, unsigned long pc,
0023                  unsigned long npc, unsigned long psr);
0024 void do_fpe_trap(struct pt_regs *regs, unsigned long pc,
0025                  unsigned long npc, unsigned long psr);
0026 void handle_tag_overflow(struct pt_regs *regs, unsigned long pc,
0027                          unsigned long npc, unsigned long psr);
0028 void handle_watchpoint(struct pt_regs *regs, unsigned long pc,
0029                        unsigned long npc, unsigned long psr);
0030 void handle_reg_access(struct pt_regs *regs, unsigned long pc,
0031                        unsigned long npc, unsigned long psr);
0032 void handle_cp_disabled(struct pt_regs *regs, unsigned long pc,
0033                         unsigned long npc, unsigned long psr);
0034 void handle_cp_exception(struct pt_regs *regs, unsigned long pc,
0035                          unsigned long npc, unsigned long psr);
0036 
0037 
0038 
0039 /* entry.S */
0040 void fpsave(unsigned long *fpregs, unsigned long *fsr,
0041             void *fpqueue, unsigned long *fpqdepth);
0042 void fpload(unsigned long *fpregs, unsigned long *fsr);
0043 
0044 #else /* CONFIG_SPARC32 */
0045 
0046 #include <asm/trap_block.h>
0047 
0048 struct popc_3insn_patch_entry {
0049     unsigned int    addr;
0050     unsigned int    insns[3];
0051 };
0052 extern struct popc_3insn_patch_entry __popc_3insn_patch,
0053     __popc_3insn_patch_end;
0054 
0055 struct popc_6insn_patch_entry {
0056     unsigned int    addr;
0057     unsigned int    insns[6];
0058 };
0059 extern struct popc_6insn_patch_entry __popc_6insn_patch,
0060     __popc_6insn_patch_end;
0061 
0062 struct pause_patch_entry {
0063     unsigned int    addr;
0064     unsigned int    insns[3];
0065 };
0066 extern struct pause_patch_entry __pause_3insn_patch,
0067     __pause_3insn_patch_end;
0068 
0069 void sun4v_patch_1insn_range(struct sun4v_1insn_patch_entry *,
0070                  struct sun4v_1insn_patch_entry *);
0071 void sun4v_patch_2insn_range(struct sun4v_2insn_patch_entry *,
0072                  struct sun4v_2insn_patch_entry *);
0073 void sun_m7_patch_2insn_range(struct sun4v_2insn_patch_entry *,
0074                  struct sun4v_2insn_patch_entry *);
0075 extern unsigned int dcache_parity_tl1_occurred;
0076 extern unsigned int icache_parity_tl1_occurred;
0077 
0078 asmlinkage void sparc_breakpoint(struct pt_regs *regs);
0079 void timer_interrupt(int irq, struct pt_regs *regs);
0080 
0081 void do_notify_resume(struct pt_regs *regs,
0082               unsigned long orig_i0,
0083               unsigned long thread_info_flags);
0084 
0085 asmlinkage int syscall_trace_enter(struct pt_regs *regs);
0086 asmlinkage void syscall_trace_leave(struct pt_regs *regs);
0087 
0088 void bad_trap_tl1(struct pt_regs *regs, long lvl);
0089 
0090 void do_fpieee(struct pt_regs *regs);
0091 void do_fpother(struct pt_regs *regs);
0092 void do_tof(struct pt_regs *regs);
0093 void do_div0(struct pt_regs *regs);
0094 void do_illegal_instruction(struct pt_regs *regs);
0095 void mem_address_unaligned(struct pt_regs *regs,
0096                unsigned long sfar,
0097                unsigned long sfsr);
0098 void sun4v_do_mna(struct pt_regs *regs,
0099           unsigned long addr,
0100           unsigned long type_ctx);
0101 void do_privop(struct pt_regs *regs);
0102 void do_privact(struct pt_regs *regs);
0103 void do_cee(struct pt_regs *regs);
0104 void do_div0_tl1(struct pt_regs *regs);
0105 void do_fpieee_tl1(struct pt_regs *regs);
0106 void do_fpother_tl1(struct pt_regs *regs);
0107 void do_ill_tl1(struct pt_regs *regs);
0108 void do_irq_tl1(struct pt_regs *regs);
0109 void do_lddfmna_tl1(struct pt_regs *regs);
0110 void do_stdfmna_tl1(struct pt_regs *regs);
0111 void do_paw(struct pt_regs *regs);
0112 void do_paw_tl1(struct pt_regs *regs);
0113 void do_vaw(struct pt_regs *regs);
0114 void do_vaw_tl1(struct pt_regs *regs);
0115 void do_tof_tl1(struct pt_regs *regs);
0116 void do_getpsr(struct pt_regs *regs);
0117 
0118 void spitfire_insn_access_exception(struct pt_regs *regs,
0119                     unsigned long sfsr,
0120                     unsigned long sfar);
0121 void spitfire_insn_access_exception_tl1(struct pt_regs *regs,
0122                         unsigned long sfsr,
0123                         unsigned long sfar);
0124 void spitfire_data_access_exception(struct pt_regs *regs,
0125                     unsigned long sfsr,
0126                     unsigned long sfar);
0127 void spitfire_data_access_exception_tl1(struct pt_regs *regs,
0128                         unsigned long sfsr,
0129                         unsigned long sfar);
0130 void spitfire_access_error(struct pt_regs *regs,
0131                unsigned long status_encoded,
0132                unsigned long afar);
0133 
0134 void cheetah_fecc_handler(struct pt_regs *regs,
0135               unsigned long afsr,
0136               unsigned long afar);
0137 void cheetah_cee_handler(struct pt_regs *regs,
0138              unsigned long afsr,
0139              unsigned long afar);
0140 void cheetah_deferred_handler(struct pt_regs *regs,
0141                   unsigned long afsr,
0142                   unsigned long afar);
0143 void cheetah_plus_parity_error(int type, struct pt_regs *regs);
0144 
0145 void sun4v_insn_access_exception(struct pt_regs *regs,
0146                  unsigned long addr,
0147                  unsigned long type_ctx);
0148 void sun4v_insn_access_exception_tl1(struct pt_regs *regs,
0149                      unsigned long addr,
0150                      unsigned long type_ctx);
0151 void sun4v_data_access_exception(struct pt_regs *regs,
0152                  unsigned long addr,
0153                  unsigned long type_ctx);
0154 void sun4v_data_access_exception_tl1(struct pt_regs *regs,
0155                      unsigned long addr,
0156                      unsigned long type_ctx);
0157 void sun4v_resum_error(struct pt_regs *regs,
0158                unsigned long offset);
0159 void sun4v_resum_overflow(struct pt_regs *regs);
0160 void sun4v_nonresum_error(struct pt_regs *regs,
0161               unsigned long offset);
0162 void sun4v_nonresum_overflow(struct pt_regs *regs);
0163 void sun4v_mem_corrupt_detect_precise(struct pt_regs *regs,
0164                       unsigned long addr,
0165                       unsigned long context);
0166 
0167 extern unsigned long sun4v_err_itlb_vaddr;
0168 extern unsigned long sun4v_err_itlb_ctx;
0169 extern unsigned long sun4v_err_itlb_pte;
0170 extern unsigned long sun4v_err_itlb_error;
0171 
0172 void sun4v_itlb_error_report(struct pt_regs *regs, int tl);
0173 
0174 extern unsigned long sun4v_err_dtlb_vaddr;
0175 extern unsigned long sun4v_err_dtlb_ctx;
0176 extern unsigned long sun4v_err_dtlb_pte;
0177 extern unsigned long sun4v_err_dtlb_error;
0178 
0179 void sun4v_dtlb_error_report(struct pt_regs *regs, int tl);
0180 void hypervisor_tlbop_error(unsigned long err,
0181                 unsigned long op);
0182 void hypervisor_tlbop_error_xcall(unsigned long err,
0183                   unsigned long op);
0184 
0185 /* WARNING: The error trap handlers in assembly know the precise
0186  *      layout of the following structure.
0187  *
0188  * C-level handlers in traps.c use this information to log the
0189  * error and then determine how to recover (if possible).
0190  */
0191 struct cheetah_err_info {
0192 /*0x00*/u64 afsr;
0193 /*0x08*/u64 afar;
0194 
0195     /* D-cache state */
0196 /*0x10*/u64 dcache_data[4]; /* The actual data  */
0197 /*0x30*/u64 dcache_index;   /* D-cache index    */
0198 /*0x38*/u64 dcache_tag;     /* D-cache tag/valid    */
0199 /*0x40*/u64 dcache_utag;    /* D-cache microtag */
0200 /*0x48*/u64 dcache_stag;    /* D-cache snooptag */
0201 
0202     /* I-cache state */
0203 /*0x50*/u64 icache_data[8]; /* The actual insns + predecode */
0204 /*0x90*/u64 icache_index;   /* I-cache index    */
0205 /*0x98*/u64 icache_tag;     /* I-cache phys tag */
0206 /*0xa0*/u64 icache_utag;    /* I-cache microtag */
0207 /*0xa8*/u64 icache_stag;    /* I-cache snooptag */
0208 /*0xb0*/u64 icache_upper;   /* I-cache upper-tag    */
0209 /*0xb8*/u64 icache_lower;   /* I-cache lower-tag    */
0210 
0211     /* E-cache state */
0212 /*0xc0*/u64 ecache_data[4]; /* 32 bytes from staging registers */
0213 /*0xe0*/u64 ecache_index;   /* E-cache index    */
0214 /*0xe8*/u64 ecache_tag;     /* E-cache tag/state    */
0215 
0216 /*0xf0*/u64 __pad[32 - 30];
0217 };
0218 #define CHAFSR_INVALID      ((u64)-1L)
0219 
0220 /* This is allocated at boot time based upon the largest hardware
0221  * cpu ID in the system.  We allocate two entries per cpu, one for
0222  * TL==0 logging and one for TL >= 1 logging.
0223  */
0224 extern struct cheetah_err_info *cheetah_error_log;
0225 
0226 /* UPA nodes send interrupt packet to UltraSparc with first data reg
0227  * value low 5 (7 on Starfire) bits holding the IRQ identifier being
0228  * delivered.  We must translate this into a non-vector IRQ so we can
0229  * set the softint on this cpu.
0230  *
0231  * To make processing these packets efficient and race free we use
0232  * an array of irq buckets below.  The interrupt vector handler in
0233  * entry.S feeds incoming packets into per-cpu pil-indexed lists.
0234  *
0235  * If you make changes to ino_bucket, please update hand coded assembler
0236  * of the vectored interrupt trap handler(s) in entry.S and sun4v_ivec.S
0237  */
0238 struct ino_bucket {
0239 /*0x00*/unsigned long __irq_chain_pa;
0240 
0241     /* Interrupt number assigned to this INO.  */
0242 /*0x08*/unsigned int __irq;
0243 /*0x0c*/unsigned int __pad;
0244 };
0245 
0246 extern struct ino_bucket *ivector_table;
0247 extern unsigned long ivector_table_pa;
0248 
0249 void init_irqwork_curcpu(void);
0250 void sun4v_register_mondo_queues(int this_cpu);
0251 
0252 #endif /* CONFIG_SPARC32 */
0253 #endif /* _ENTRY_H */