j
: Next unread message k
: Previous unread message j a
: Jump to all threads
j l
: Jump to MailingList overview
Author: blueswirl Date: 2007-12-25 09:26:21 +0100 (Tue, 25 Dec 2007) New Revision: 182
Modified: openbios-devel/arch/sparc32/vectors.S openbios-devel/drivers/obio.c Log: Add handlers for timer interrupts
Modified: openbios-devel/arch/sparc32/vectors.S =================================================================== --- openbios-devel/arch/sparc32/vectors.S 2007-12-10 20:06:58 UTC (rev 181) +++ openbios-devel/arch/sparc32/vectors.S 2007-12-25 08:26:21 UTC (rev 182) @@ -43,6 +43,12 @@
#define BTRAP(lvl) ba bug; mov lvl, %g1; nop; nop; #define BTRAPS(x) BTRAP(x) BTRAP(x+1) BTRAP(x+2) BTRAP(x+3) BTRAP(x+4) BTRAP(x+5) BTRAP(x+6) BTRAP(x+7) +#define TRAP_ENTRY_INTERRUPT(int_level) \ + sethi %hi(irq_entry ## int_level), %l7; \ + or %l7, %lo(irq_entry ## int_level), %l7; \ + jmp %l7; \ + nop + t_zero: b entry; nop; nop; nop; BTRAP(0x1) BTRAP(0x2) BTRAP(0x3) BTRAP(0x4) t_wovf: WINDOW_SPILL /* Window Overflow */ @@ -67,7 +73,12 @@ t_irq14: TRAP_ENTRY_INTERRUPT(14) /* IRQ Timer #2 */ t_nmi: BAD_TRAP(0x1f) /* Level 15 (NMI) */ #else - BTRAPS(0x10) BTRAPS(0x18) + BTRAPS(0x10) + BTRAP(0x18) BTRAP(0x19) +t_irq10: TRAP_ENTRY_INTERRUPT(10) /* IRQ Timer #1 (one we use) */ + BTRAP(0x1b) BTRAP(0x1c) BTRAP(0x1d) +t_irq14: TRAP_ENTRY_INTERRUPT(14) /* IRQ Timer #2 */ + BTRAP(0x1f) #endif BTRAPS(0x20) BTRAPS(0x28) BTRAPS(0x30) BTRAPS(0x38) @@ -174,6 +185,21 @@ b _forever ; nop
+irq_entry10: + sethi %hi(counter_regs), %l7 + ld [%l7 + %lo(counter_regs)], %l7 + sethi 0x10000, %l6 + ld [%l7 + %l6], %g0 + jmp %l1 + rett %l2 + +irq_entry14: + sethi %hi(counter_regs), %l7 + ld [%l7 + %lo(counter_regs)], %l7 + ld [%l7], %g0 + jmp %l1 + rett %l2 + /* Register window handlers */ #include "wof.S" #include "wuf.S"
Modified: openbios-devel/drivers/obio.c =================================================================== --- openbios-devel/drivers/obio.c 2007-12-10 20:06:58 UTC (rev 181) +++ openbios-devel/drivers/obio.c 2007-12-25 08:26:21 UTC (rev 182) @@ -1067,10 +1067,11 @@ fword("finish-device"); }
+volatile struct sun4m_timer_regs *counter_regs; + static void ob_counter_init(uint64_t base, unsigned long offset) { - volatile struct sun4m_timer_regs *regs; int i;
ob_new_obio_device("counter", NULL); @@ -1101,17 +1102,19 @@ fword("property");
- regs = map_io(base + (uint64_t)offset, sizeof(*regs)); - regs->l10_timer_limit = (((1000000/100) + 1) << 10); - regs->cpu_timers[0].l14_timer_limit = 0; + counter_regs = map_io(base + (uint64_t)offset, sizeof(*counter_regs)); + counter_regs->cfg = 0xffffffff; + counter_regs->l10_timer_limit = (((1000000/100) + 1) << 10); + counter_regs->cpu_timers[0].l14_timer_limit = 0; + counter_regs->cpu_timers[0].cntrl = 1;
for (i = 0; i < SUN4M_NCPU; i++) { - PUSH((unsigned long)®s->cpu_timers[i]); + PUSH((unsigned long)&counter_regs->cpu_timers[i]); fword("encode-int"); if (i != 0) fword("encode+"); } - PUSH((unsigned long)®s->l10_timer_limit); + PUSH((unsigned long)&counter_regs->l10_timer_limit); fword("encode-int"); fword("encode+"); push_str("address");