mirror of
https://gitlab.com/qemu-project/openbios.git
synced 2024-02-13 08:34:06 +08:00
The current implementation of the milliseconds prom call on PowerPC is totally buggy: - The timer frequency returned by get_timer_freq() does not correspond to the timer which is read. - The dividend and the divisor of the division are swapped - If called very often, this function is not precise - Depending on the timer frequency and of the frequency of the calls, the variable overflow after a few dozen of seconds. Please find in this patch a totally new implementation. This fixes the problem observed with the quik when a timeout is defined. The timer frequency is defined using #define, I wonder if there is a better place to put it. It reads both low and high part of the timer to make sure there is no overflow. It also removes the function that returns 0 on the first call as this is not needed according to IEEE 1275-1994. Finally it computes the real value of the timer each time, instead of adding a small value to a variable at each function calls, in order to get a correct precision if this method is call very often. (Aurelien Jarno) git-svn-id: svn://coreboot.org/openbios/openbios-devel@407 f158a5a8-5612-0410-a976-696ce0be7e32