Module Name: src Committed By: jmcneill Date: Sat Oct 19 12:34:10 UTC 2024
Modified Files: src/sys/arch/evbppc/wii: machdep.c src/sys/arch/powerpc/powerpc: clock.c Log Message: Improve delay() accuracy on Nintendo Wii. The PowerPC delay() implementation converts the timebase frequency to a number of nanoseconds per tick and uses that value to compute the delay interval. On the Wii's Broadway processor with a timebase frequency of 60.75 MHz, some precision is lost as each tick is approximately 16.46 nanoseconds. The end result is that we sleep for approximately 2.875% longer than necessary. This also has an impact on CPU speed calculation on Broadway, which incorrectly reports itself as 750MHz instead of 729MHz (2.875% faster). Fix this by introducing an (optional) ticks_per_msec variable that can be set by the platform and allows delay() to improve the accuracy of longer delays. Measured CPU frequency before this change: [ 1.000000] cpu0: 750.00 MHz, 256KB WB with ECC L2 cache Measured CPU frequency after this change: [ 1.000000] cpu0: 729.00 MHz, 256KB WB with ECC L2 cache To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbppc/wii/machdep.c cvs rdiff -u -r1.18 -r1.19 src/sys/arch/powerpc/powerpc/clock.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.