j
: Next unread message k
: Previous unread message j a
: Jump to all threads
j l
: Jump to MailingList overview
Author: agraf Date: Fri May 30 14:11:44 2014 New Revision: 1306 URL: http://tracker.coreboot.org/trac/openbios/changeset/1306
Log: PPC: Pass real tbfreq to udelay
The IDE code waits for some operations to finish within a certain amount of time. That waiting code delays based on the timebase, but doesn't know about the frequency of the timebase.
In cases where we know the frequency - like via QEMU's fwcfg interface - base the calculation on that frequency value.
This fixes issues where OpenBIOS thought it ran into IDE timeouts.
Signed-off-by: Alexander Graf agraf@suse.de
Modified: trunk/openbios-devel/arch/ppc/qemu/init.c trunk/openbios-devel/drivers/timer.c
Modified: trunk/openbios-devel/arch/ppc/qemu/init.c ============================================================================== --- trunk/openbios-devel/arch/ppc/qemu/init.c Thu May 29 00:15:33 2014 (r1305) +++ trunk/openbios-devel/arch/ppc/qemu/init.c Fri May 30 14:11:44 2014 (r1306) @@ -220,6 +220,9 @@ #endif }
+/* From drivers/timer.c */ +extern unsigned long timer_freq; + static void cpu_generic_init(const struct cpudef *cpu) { @@ -279,7 +282,8 @@ push_str("tlb-size"); fword("property");
- PUSH(fw_cfg_read_i32(FW_CFG_PPC_TBFREQ)); + timer_freq = fw_cfg_read_i32(FW_CFG_PPC_TBFREQ); + PUSH(timer_freq); fword("encode-int"); push_str("timebase-frequency"); fword("property");
Modified: trunk/openbios-devel/drivers/timer.c ============================================================================== --- trunk/openbios-devel/drivers/timer.c Thu May 29 00:15:33 2014 (r1305) +++ trunk/openbios-devel/drivers/timer.c Fri May 30 14:11:44 2014 (r1306) @@ -79,15 +79,11 @@ /* * TODO: pass via lb table */ - -unsigned long get_timer_freq(void) -{ - return 10000000 / 4; -} +unsigned long timer_freq = 10000000 / 4;
void udelay(unsigned int usecs) { - unsigned long ticksperusec = get_timer_freq() / 1000000; + unsigned long ticksperusec = timer_freq / 1000000; _wait_ticks(ticksperusec * usecs); }