From 1c02b4c9fb8b743966488f37bd7b12d978f05768 Mon Sep 17 00:00:00 2001 From: Nathan Whitehorn Date: Wed, 23 Oct 2013 14:34:04 +0000 Subject: [PATCH] A quick addendum: the standard says that timebase-frequency can be either 32 or 64 bits, so allow either. --- sys/powerpc/booke/platform_bare.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/sys/powerpc/booke/platform_bare.c b/sys/powerpc/booke/platform_bare.c index a3d9df7d69a..743a157ae3a 100644 --- a/sys/powerpc/booke/platform_bare.c +++ b/sys/powerpc/booke/platform_bare.c @@ -188,9 +188,24 @@ bare_timebase_freq(platform_t plat, struct cpuref *cpuref) if ((child = OF_child(cpus)) == 0) goto out; - if (OF_getprop(child, "timebase-frequency", (void *)&ticks, - sizeof(ticks)) == sizeof(ticks)) - goto out; + switch (OF_getproplen(child, "timebase-frequency")) { + case 4: + { + uint32_t tbase; + OF_getprop(child, "timebase-frequency", &tbase, sizeof(tbase)); + ticks = tbase; + return (ticks); + } + case 8: + { + uint64_t tbase; + OF_getprop(child, "timebase-frequency", &tbase, sizeof(tbase)); + ticks = tbase; + return (ticks); + } + default: + break; + } freq = 0; if (OF_getprop(child, "bus-frequency", (void *)&freq, -- 2.45.2