mirror of
https://gitlab.com/qemu-project/openbios.git
synced 2024-02-13 08:34:06 +08:00
Add handlers for timer interrupts
git-svn-id: svn://coreboot.org/openbios/openbios-devel@182 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
@@ -43,6 +43,12 @@ trap_table:
|
||||
|
||||
#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_irq13: TRAP_ENTRY_INTERRUPT(13) /* IRQ Audio Intr.
|
||||
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 @@ _forever:
|
||||
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"
|
||||
|
||||
@@ -1067,10 +1067,11 @@ ob_power_init(uint64_t base, uint64_t offset, int intr)
|
||||
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 @@ ob_counter_init(uint64_t base, unsigned long offset)
|
||||
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");
|
||||
|
||||
Reference in New Issue
Block a user