12 #include <asm/timer.h>
13 #include <asm/traps.h>
14 #include <asm/pgalloc.h>
15 #include <asm/pgtable.h>
18 #include <asm/cacheflush.h>
111 #define SUN4M_INT_ENABLE 0x80000000
112 #define SUN4M_INT_E14 0x00000080
113 #define SUN4M_INT_E10 0x00080000
115 #define SUN4M_INT_MASKALL 0x80000000
116 #define SUN4M_INT_MODULE_ERR 0x40000000
117 #define SUN4M_INT_M2S_WRITE_ERR 0x20000000
118 #define SUN4M_INT_ECC_ERR 0x10000000
119 #define SUN4M_INT_VME_ERR 0x08000000
120 #define SUN4M_INT_FLOPPY 0x00400000
121 #define SUN4M_INT_MODULE 0x00200000
122 #define SUN4M_INT_VIDEO 0x00100000
123 #define SUN4M_INT_REALTIME 0x00080000
124 #define SUN4M_INT_SCSI 0x00040000
125 #define SUN4M_INT_AUDIO 0x00020000
126 #define SUN4M_INT_ETHERNET 0x00010000
127 #define SUN4M_INT_SERIAL 0x00008000
128 #define SUN4M_INT_KBDMS 0x00004000
129 #define SUN4M_INT_SBUSBITS 0x00003F80
130 #define SUN4M_INT_VMEBITS 0x0000007F
132 #define SUN4M_INT_ERROR (SUN4M_INT_MODULE_ERR | \
133 SUN4M_INT_M2S_WRITE_ERR | \
134 SUN4M_INT_ECC_ERR | \
137 #define SUN4M_INT_SBUS(x) (1 << (x+7))
138 #define SUN4M_INT_VME(x) (1 << (x))
141 #define OBP_INT_LEVEL_SOFT 0x10
142 #define OBP_INT_LEVEL_ONBOARD 0x20
143 #define OBP_INT_LEVEL_SBUS 0x30
144 #define OBP_INT_LEVEL_VME 0x40
146 #define SUN4M_TIMER_IRQ (OBP_INT_LEVEL_ONBOARD | 10)
147 #define SUN4M_PROFILE_IRQ (OBP_INT_LEVEL_ONBOARD | 14)
149 static unsigned long sun4m_imask[0x50] = {
192 if (handler_data->
mask) {
196 if (handler_data->
percpu) {
205 static void sun4m_unmask_irq(
struct irq_data *data)
210 if (handler_data->
mask) {
214 if (handler_data->
percpu) {
223 static unsigned int sun4m_startup_irq(
struct irq_data *data)
226 sun4m_unmask_irq(data);
230 static void sun4m_shutdown_irq(
struct irq_data *data)
232 sun4m_mask_irq(data);
236 static struct irq_chip sun4m_irq = {
238 .irq_startup = sun4m_startup_irq,
239 .irq_shutdown = sun4m_shutdown_irq,
240 .irq_mask = sun4m_mask_irq,
241 .irq_unmask = sun4m_unmask_irq,
246 unsigned int real_irq)
256 pil = (real_irq & 0xf);
262 handler_data = irq_get_handler_data(irq);
268 prom_printf(
"IRQ: kzalloc(sun4m_handler_data) failed.\n");
272 handler_data->
mask = sun4m_imask[real_irq];
301 static void sun4m_clear_clock_irq(
void)
308 unsigned long afsr, afar, si;
312 __asm__ __volatile__(
"mov 0x500, %%g1\n\t"
313 "lda [%%g1] 0x4, %0\n\t"
314 "mov 0x600, %%g1\n\t"
315 "lda [%%g1] 0x4, %1\n\t" :
316 "=r" (afsr),
"=r" (afar));
347 static void sun4m_load_profile_irq(
int cpu,
unsigned int limit)
349 unsigned int value = limit ? timer_value(limit) : 0;
350 sbus_writel(value, &timers_percpu[cpu]->l14_limit);
353 static void __init sun4m_init_timers(
void)
356 int i,
err,
len, num_cpu_timers;
372 num_cpu_timers = (len /
sizeof(
u32)) - 1;
373 for (i = 0; i < num_cpu_timers; i++) {
375 (
unsigned long) addr[
i];
377 timers_global = (
void __iomem *)
378 (
unsigned long) addr[num_cpu_timers];
405 for (i = 0; i < num_cpu_timers; i++)
407 if (num_cpu_timers == 4)
420 trap_table->
inst_one = lvl14_save[0];
421 trap_table->
inst_two = lvl14_save[1];
424 local_ops->cache_all();
433 int len,
i,
mid, num_cpu_iregs;
448 num_cpu_iregs = (len /
sizeof(
u32)) - 1;
449 for (i = 0; i < num_cpu_iregs; i++) {
450 sun4m_irq_percpu[
i] = (
void __iomem *)
451 (
unsigned long) addr[
i];
453 sun4m_irq_global = (
void __iomem *)
454 (
unsigned long) addr[num_cpu_iregs];
462 if (num_cpu_iregs == 4)