j
: Next unread message k
: Previous unread message j a
: Jump to all threads
j l
: Jump to MailingList overview
Author: mcayland Date: Sun Feb 16 17:26:28 2014 New Revision: 1263 URL: http://tracker.coreboot.org/trac/openbios/changeset/1263
Log: SPARC32: implement romvec.pv_ticks counter
romvec.pv_ticks is a pointer to an 'uptime' counter, calibrated in milliseconds.
We use the [1st] CPU timer, running at 100Hz, to increment (+10) the counter. This counter is used by NextStep to measure the 10 seconds delay during boot, when asking about boot options.
Signed-off-by: Olivier Danet odanet@caramail.com Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
Modified: trunk/openbios-devel/arch/sparc32/openbios.c trunk/openbios-devel/arch/sparc32/openprom.h trunk/openbios-devel/arch/sparc32/romvec.c trunk/openbios-devel/arch/sparc32/romvec.h trunk/openbios-devel/arch/sparc32/vectors.S trunk/openbios-devel/drivers/obio.c trunk/openbios-devel/drivers/obio.h
Modified: trunk/openbios-devel/arch/sparc32/openbios.c ============================================================================== --- trunk/openbios-devel/arch/sparc32/openbios.c Sun Feb 16 17:26:25 2014 (r1262) +++ trunk/openbios-devel/arch/sparc32/openbios.c Sun Feb 16 17:26:28 2014 (r1263) @@ -23,6 +23,7 @@ #include "boot.h" #include "romvec.h" #include "openprom.h" +#include "psr.h" #include "libopenbios/video.h" #define NO_QEMU_PROTOS #include "arch/common/fw_cfg.h" @@ -916,6 +917,11 @@ fword("find-device");
setup_uuid(); + + /* Enable interrupts */ + temp = get_psr(); + temp = (temp & ~PSR_PIL) | (13 << 8); /* Enable CPU timer interrupt (level 14) */ + put_psr(temp); }
extern struct _console_ops arch_console_ops;
Modified: trunk/openbios-devel/arch/sparc32/openprom.h ============================================================================== --- trunk/openbios-devel/arch/sparc32/openprom.h Sun Feb 16 17:26:25 2014 (r1262) +++ trunk/openbios-devel/arch/sparc32/openprom.h Sun Feb 16 17:26:28 2014 (r1263) @@ -117,7 +117,7 @@ void (*pv_reboot)(char *bootstr); void (*pv_printf)(__const__ char *fmt, ...); void (*pv_abort)(void); - __volatile__ int *pv_ticks; + __volatile__ unsigned int *pv_ticks; void (*pv_halt)(void); void (**pv_synchook)(void);
Modified: trunk/openbios-devel/arch/sparc32/romvec.c ============================================================================== --- trunk/openbios-devel/arch/sparc32/romvec.c Sun Feb 16 17:26:25 2014 (r1262) +++ trunk/openbios-devel/arch/sparc32/romvec.c Sun Feb 16 17:26:28 2014 (r1263) @@ -449,6 +449,8 @@ dstackcnt = dstacktmp; }
+volatile uint32_t obp_ticks; + void * init_openprom(void) { @@ -479,6 +481,11 @@ romvec0.pv_reboot = obp_reboot_handler; romvec0.pv_printf = obp_printf_handler; romvec0.pv_abort = obp_abort_handler; + + /* Reset the tick counter */ + obp_ticks = 0; + romvec0.pv_ticks = &obp_ticks; + romvec0.pv_halt = obp_halt_handler; romvec0.pv_synchook = &sync_hook; romvec0.pv_v0bootargs = &obp_argp;
Modified: trunk/openbios-devel/arch/sparc32/romvec.h ============================================================================== --- trunk/openbios-devel/arch/sparc32/romvec.h Sun Feb 16 17:26:25 2014 (r1262) +++ trunk/openbios-devel/arch/sparc32/romvec.h Sun Feb 16 17:26:28 2014 (r1263) @@ -2,6 +2,7 @@ * romvec main C function and handler declarations */
+extern volatile uint32_t obp_ticks; void *init_openprom(void);
int obp_devopen(char *str);
Modified: trunk/openbios-devel/arch/sparc32/vectors.S ============================================================================== --- trunk/openbios-devel/arch/sparc32/vectors.S Sun Feb 16 17:26:25 2014 (r1262) +++ trunk/openbios-devel/arch/sparc32/vectors.S Sun Feb 16 17:26:28 2014 (r1263) @@ -207,6 +207,10 @@ sethi %hi(counter_regs), %l7 ld [%l7 + %lo(counter_regs)], %l7 ld [%l7], %g0 + sethi %hi(obp_ticks), %l7 + ld [%l7 + %lo(obp_ticks)], %l6 + add %l6, 10, %l6 + st %l6, [%l7 + %lo(obp_ticks)] jmp %l1 rett %l2
Modified: trunk/openbios-devel/drivers/obio.c ============================================================================== --- trunk/openbios-devel/drivers/obio.c Sun Feb 16 17:26:25 2014 (r1262) +++ trunk/openbios-devel/drivers/obio.c Sun Feb 16 17:26:28 2014 (r1263) @@ -287,7 +287,7 @@
counter_regs = (struct sun4m_timer_regs *)ofmem_map_io(base + (uint64_t)offset, sizeof(*counter_regs)); - counter_regs->cfg = 0xffffffff; + counter_regs->cfg = 0xfffffffe; counter_regs->l10_timer_limit = 0; counter_regs->cpu_timers[0].l14_timer_limit = 0x9c4000; /* see comment in obio.h */ counter_regs->cpu_timers[0].cntrl = 1;
Modified: trunk/openbios-devel/drivers/obio.h ============================================================================== --- trunk/openbios-devel/drivers/obio.h Sun Feb 16 17:26:25 2014 (r1262) +++ trunk/openbios-devel/drivers/obio.h Sun Feb 16 17:26:28 2014 (r1263) @@ -88,7 +88,7 @@ * Registers of hardware timer in sun4m. */ struct sun4m_timer_percpu { - volatile unsigned int l14_timer_limit; /* Initial value is 0x009c4000 */ + volatile unsigned int l14_timer_limit; /* Initial value is 0x009c4000 = 10ms period*/ volatile unsigned int l14_cur_count; };