PERFORCE change 174728 for review

Rafal Jaworowski raj at FreeBSD.org
Mon Feb 15 17:27:04 UTC 2010


http://p4web.freebsd.org/chv.cgi?CH=174728

Change 174728 by raj at raj_fdt on 2010/02/15 17:26:17

	Retrieve bus clock data from the DT blob and not from the [now] legacy
	bootinfo.

Affected files ...

.. //depot/projects/fdt/sys/powerpc/booke/platform_bare.c#4 edit

Differences ...

==== //depot/projects/fdt/sys/powerpc/booke/platform_bare.c#4 (text+ko) ====

@@ -45,6 +45,10 @@
 #include <machine/spr.h>
 #include <machine/vmparam.h>
 
+#include <dev/ofw/ofw_bus.h>
+#include <dev/ofw/ofw_bus_subr.h>
+#include <dev/ofw/openfirm.h>
+
 #include <powerpc/mpc85xx/mpc85xx.h>
 
 #include "platform_if.h"
@@ -155,12 +159,24 @@
 bare_timebase_freq(platform_t plat, struct cpuref *cpuref)
 {
 	u_long ticks = -1;
+	phandle_t cpus, child;
+	pcell_t freq;
+
+	if ((cpus = OF_finddevice("/cpus")) == 0)
+		goto out;
 
+	if ((child = OF_child(cpus)) == 0)
+		goto out;
+
+	if (OF_getprop(child, "bus-frequency", (void *)&freq,
+	    sizeof(freq)) <= 0)
+		goto out;
 	/*
 	 * Time Base and Decrementer are updated every 8 CCB bus clocks.
 	 * HID0[SEL_TBCLK] = 0
 	 */
-	ticks = bootinfo->bi_bus_clk / 8;
+	ticks = freq / 8;
+out:
 	if (ticks <= 0)
 		panic("Unable to determine timebase frequency!");
 


More information about the p4-projects mailing list