blob: 06db4f18e453b04924310cfebe1c14b10a89bf92 [file] [log] [blame]
David S. Miller3d5ae6b2008-03-25 21:51:40 -07001#ifndef _ENTRY_H
2#define _ENTRY_H
3
David S. Millerbfdf9eb2008-03-26 00:46:21 -07004#include <linux/kernel.h>
David S. Miller99cd2202008-03-26 00:19:43 -07005#include <linux/types.h>
David S. Millerbfdf9eb2008-03-26 00:46:21 -07006#include <linux/init.h>
David S. Miller3d5ae6b2008-03-25 21:51:40 -07007
Sam Ravnborg8d74e322008-12-08 01:04:59 -08008#ifdef CONFIG_SPARC32
9/* traps */
10extern void do_hw_interrupt(struct pt_regs *regs, unsigned long type);
11extern void do_illegal_instruction(struct pt_regs *regs, unsigned long pc,
12 unsigned long npc, unsigned long psr);
13
14extern void do_priv_instruction(struct pt_regs *regs, unsigned long pc,
15 unsigned long npc, unsigned long psr);
16extern void do_memaccess_unaligned(struct pt_regs *regs, unsigned long pc,
17 unsigned long npc,
18 unsigned long psr);
19extern void do_fpd_trap(struct pt_regs *regs, unsigned long pc,
20 unsigned long npc, unsigned long psr);
21extern void do_fpe_trap(struct pt_regs *regs, unsigned long pc,
22 unsigned long npc, unsigned long psr);
23extern void handle_tag_overflow(struct pt_regs *regs, unsigned long pc,
24 unsigned long npc, unsigned long psr);
25extern void handle_watchpoint(struct pt_regs *regs, unsigned long pc,
26 unsigned long npc, unsigned long psr);
27extern void handle_reg_access(struct pt_regs *regs, unsigned long pc,
28 unsigned long npc, unsigned long psr);
29extern void handle_cp_disabled(struct pt_regs *regs, unsigned long pc,
30 unsigned long npc, unsigned long psr);
31extern void handle_cp_exception(struct pt_regs *regs, unsigned long pc,
32 unsigned long npc, unsigned long psr);
33
34
35
36/* entry.S */
37extern void fpsave(unsigned long *fpregs, unsigned long *fsr,
38 void *fpqueue, unsigned long *fpqdepth);
39extern void fpload(unsigned long *fpregs, unsigned long *fsr);
40
41#else /* CONFIG_SPARC32 */
David S. Miller3d5ae6b2008-03-25 21:51:40 -070042extern void __init per_cpu_patch(void);
43extern void __init sun4v_patch(void);
44extern void __init boot_cpu_id_too_large(int cpu);
45extern unsigned int dcache_parity_tl1_occurred;
46extern unsigned int icache_parity_tl1_occurred;
47
David S. Miller207ddd02008-03-26 01:43:29 -070048extern asmlinkage void update_perfctrs(void);
49extern asmlinkage void sparc_breakpoint(struct pt_regs *regs);
David S. Millercf3d7c12008-03-26 01:11:55 -070050extern void timer_interrupt(int irq, struct pt_regs *regs);
51
David S. Miller062ea6d2008-03-26 01:52:18 -070052extern void do_notify_resume(struct pt_regs *regs,
53 unsigned long orig_i0,
David S. Miller062ea6d2008-03-26 01:52:18 -070054 unsigned long thread_info_flags);
55
David S. Millerfe06cca2008-08-24 20:10:23 -070056extern asmlinkage int syscall_trace_enter(struct pt_regs *regs);
57extern asmlinkage void syscall_trace_leave(struct pt_regs *regs);
David S. Millerbfdf9eb2008-03-26 00:46:21 -070058
David S. Miller99cd2202008-03-26 00:19:43 -070059extern void bad_trap_tl1(struct pt_regs *regs, long lvl);
60
61extern void do_fpe_common(struct pt_regs *regs);
62extern void do_fpieee(struct pt_regs *regs);
63extern void do_fpother(struct pt_regs *regs);
64extern void do_tof(struct pt_regs *regs);
65extern void do_div0(struct pt_regs *regs);
66extern void do_illegal_instruction(struct pt_regs *regs);
67extern void mem_address_unaligned(struct pt_regs *regs,
68 unsigned long sfar,
69 unsigned long sfsr);
70extern void sun4v_do_mna(struct pt_regs *regs,
71 unsigned long addr,
72 unsigned long type_ctx);
73extern void do_privop(struct pt_regs *regs);
74extern void do_privact(struct pt_regs *regs);
75extern void do_cee(struct pt_regs *regs);
76extern void do_cee_tl1(struct pt_regs *regs);
77extern void do_dae_tl1(struct pt_regs *regs);
78extern void do_iae_tl1(struct pt_regs *regs);
79extern void do_div0_tl1(struct pt_regs *regs);
80extern void do_fpdis_tl1(struct pt_regs *regs);
81extern void do_fpieee_tl1(struct pt_regs *regs);
82extern void do_fpother_tl1(struct pt_regs *regs);
83extern void do_ill_tl1(struct pt_regs *regs);
84extern void do_irq_tl1(struct pt_regs *regs);
85extern void do_lddfmna_tl1(struct pt_regs *regs);
86extern void do_stdfmna_tl1(struct pt_regs *regs);
87extern void do_paw(struct pt_regs *regs);
88extern void do_paw_tl1(struct pt_regs *regs);
89extern void do_vaw(struct pt_regs *regs);
90extern void do_vaw_tl1(struct pt_regs *regs);
91extern void do_tof_tl1(struct pt_regs *regs);
92extern void do_getpsr(struct pt_regs *regs);
93
94extern void spitfire_insn_access_exception(struct pt_regs *regs,
95 unsigned long sfsr,
96 unsigned long sfar);
97extern void spitfire_insn_access_exception_tl1(struct pt_regs *regs,
98 unsigned long sfsr,
99 unsigned long sfar);
100extern void spitfire_data_access_exception(struct pt_regs *regs,
101 unsigned long sfsr,
102 unsigned long sfar);
103extern void spitfire_data_access_exception_tl1(struct pt_regs *regs,
104 unsigned long sfsr,
105 unsigned long sfar);
106extern void spitfire_access_error(struct pt_regs *regs,
107 unsigned long status_encoded,
108 unsigned long afar);
109
110extern void cheetah_fecc_handler(struct pt_regs *regs,
111 unsigned long afsr,
112 unsigned long afar);
113extern void cheetah_cee_handler(struct pt_regs *regs,
114 unsigned long afsr,
115 unsigned long afar);
116extern void cheetah_deferred_handler(struct pt_regs *regs,
117 unsigned long afsr,
118 unsigned long afar);
119extern void cheetah_plus_parity_error(int type, struct pt_regs *regs);
120
121extern void sun4v_insn_access_exception(struct pt_regs *regs,
122 unsigned long addr,
123 unsigned long type_ctx);
124extern void sun4v_insn_access_exception_tl1(struct pt_regs *regs,
125 unsigned long addr,
126 unsigned long type_ctx);
127extern void sun4v_data_access_exception(struct pt_regs *regs,
128 unsigned long addr,
129 unsigned long type_ctx);
130extern void sun4v_data_access_exception_tl1(struct pt_regs *regs,
131 unsigned long addr,
132 unsigned long type_ctx);
133extern void sun4v_resum_error(struct pt_regs *regs,
134 unsigned long offset);
135extern void sun4v_resum_overflow(struct pt_regs *regs);
136extern void sun4v_nonresum_error(struct pt_regs *regs,
137 unsigned long offset);
138extern void sun4v_nonresum_overflow(struct pt_regs *regs);
139
140extern unsigned long sun4v_err_itlb_vaddr;
141extern unsigned long sun4v_err_itlb_ctx;
142extern unsigned long sun4v_err_itlb_pte;
143extern unsigned long sun4v_err_itlb_error;
144
145extern void sun4v_itlb_error_report(struct pt_regs *regs, int tl);
146
147extern unsigned long sun4v_err_dtlb_vaddr;
148extern unsigned long sun4v_err_dtlb_ctx;
149extern unsigned long sun4v_err_dtlb_pte;
150extern unsigned long sun4v_err_dtlb_error;
151
152extern void sun4v_dtlb_error_report(struct pt_regs *regs, int tl);
153extern void hypervisor_tlbop_error(unsigned long err,
154 unsigned long op);
155extern void hypervisor_tlbop_error_xcall(unsigned long err,
156 unsigned long op);
157
158/* WARNING: The error trap handlers in assembly know the precise
159 * layout of the following structure.
160 *
161 * C-level handlers in traps.c use this information to log the
162 * error and then determine how to recover (if possible).
163 */
164struct cheetah_err_info {
165/*0x00*/u64 afsr;
166/*0x08*/u64 afar;
167
168 /* D-cache state */
169/*0x10*/u64 dcache_data[4]; /* The actual data */
170/*0x30*/u64 dcache_index; /* D-cache index */
171/*0x38*/u64 dcache_tag; /* D-cache tag/valid */
172/*0x40*/u64 dcache_utag; /* D-cache microtag */
173/*0x48*/u64 dcache_stag; /* D-cache snooptag */
174
175 /* I-cache state */
176/*0x50*/u64 icache_data[8]; /* The actual insns + predecode */
177/*0x90*/u64 icache_index; /* I-cache index */
178/*0x98*/u64 icache_tag; /* I-cache phys tag */
179/*0xa0*/u64 icache_utag; /* I-cache microtag */
180/*0xa8*/u64 icache_stag; /* I-cache snooptag */
181/*0xb0*/u64 icache_upper; /* I-cache upper-tag */
182/*0xb8*/u64 icache_lower; /* I-cache lower-tag */
183
184 /* E-cache state */
185/*0xc0*/u64 ecache_data[4]; /* 32 bytes from staging registers */
186/*0xe0*/u64 ecache_index; /* E-cache index */
187/*0xe8*/u64 ecache_tag; /* E-cache tag/state */
188
189/*0xf0*/u64 __pad[32 - 30];
190};
191#define CHAFSR_INVALID ((u64)-1L)
192
193/* This is allocated at boot time based upon the largest hardware
194 * cpu ID in the system. We allocate two entries per cpu, one for
195 * TL==0 logging and one for TL >= 1 logging.
196 */
197extern struct cheetah_err_info *cheetah_error_log;
198
David S. Millerd91aa122008-03-26 00:37:51 -0700199/* UPA nodes send interrupt packet to UltraSparc with first data reg
200 * value low 5 (7 on Starfire) bits holding the IRQ identifier being
201 * delivered. We must translate this into a non-vector IRQ so we can
202 * set the softint on this cpu.
203 *
204 * To make processing these packets efficient and race free we use
205 * an array of irq buckets below. The interrupt vector handler in
206 * entry.S feeds incoming packets into per-cpu pil-indexed lists.
207 *
208 * If you make changes to ino_bucket, please update hand coded assembler
209 * of the vectored interrupt trap handler(s) in entry.S and sun4v_ivec.S
210 */
211struct ino_bucket {
212/*0x00*/unsigned long __irq_chain_pa;
213
214 /* Virtual interrupt number assigned to this INO. */
215/*0x08*/unsigned int __virt_irq;
216/*0x0c*/unsigned int __pad;
217};
218
219extern struct ino_bucket *ivector_table;
220extern unsigned long ivector_table_pa;
221
222extern void handler_irq(int irq, struct pt_regs *regs);
223extern void init_irqwork_curcpu(void);
224extern void __cpuinit sun4v_register_mondo_queues(int this_cpu);
225
Sam Ravnborg8d74e322008-12-08 01:04:59 -0800226#endif /* CONFIG_SPARC32 */
David S. Miller3d5ae6b2008-03-25 21:51:40 -0700227#endif /* _ENTRY_H */