[OpenBIOS] milliseconds isn't unique.

BALATON Zoltan balaton at eik.bme.hu
Sun Jun 8 14:02:52 CEST 2014


On Sun, 8 Jun 2014, Segher Boessenkool wrote:
>> The correct thing to do is similar to SPARC in that you create a 100Hz
>> interrupt (possibly using the PPC decrementer?) that should increment a
>> variable representing the number of ms elapsed. All you need to do is
>> then point the new code towards that variable and it will handle
>> get-msecs and milliseconds automatically.
>>
>> The interrupt routine is probably do-able in about 20 lines or less of
>> PPC asm but it's beyond my current PPC-fu. It would be a good project
>> for you though, and would probably fix the incorrect timing CIF
>> milliseconds with -M mac99 :)
>
> There is no reason at all to use the decrementer and interrupts, with
> all the problems inherent in that; just use the timebase, it's what
> it's for.  The decrementer and timebase tick at the same frequency.

That's what I thought and the current code already does that only using 
the wrong TBFREQ value. This could be easily fixed the same way as is done 
in arch/ppc/qemu/init.c:223:

/* From drivers/timer.c */
extern unsigned long timer_freq;

but probably it would be better to clean this up at the same time. The 
definition in drivers/timer.c:79 says:

/*
  * TODO: pass via lb table
  */
unsigned long timer_freq = 10000000 / 4;

What is the lb table and where is it?

Regards,
BALATON Zoltan



More information about the OpenBIOS mailing list