Module Name:    src
Committed By:   macallan
Date:           Fri Sep 22 04:45:56 UTC 2017

Modified Files:
        src/sys/arch/powerpc/oea: ofwoea_machdep.c

Log Message:
add quick path for timebase-frequency detection
deal with differences in /u4 reg property encoding vs. /uni-n, so this works
on my G5 now


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/powerpc/oea/ofwoea_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/powerpc/oea/ofwoea_machdep.c
diff -u src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.40 src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.41
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.40	Fri Sep 15 21:27:46 2017
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c	Fri Sep 22 04:45:56 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.40 2017/09/15 21:27:46 macallan Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.41 2017/09/22 04:45:56 macallan Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.40 2017/09/15 21:27:46 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.41 2017/09/22 04:45:56 macallan Exp $");
 
 #include "opt_ppcarch.h"
 #include "opt_compat_netbsd.h"
@@ -309,7 +309,7 @@ ofwoea_initppc(u_int startkernel, u_int 
 void
 set_timebase(void)
 {
-	int qhandle, phandle, msr, scratch;
+	int qhandle, phandle, msr, scratch, node;
 	char type[32];
 
 	if (timebase_freq != 0) {
@@ -317,7 +317,14 @@ set_timebase(void)
 		goto found;
 	}
 
-	for (qhandle = OF_peer(0); qhandle; qhandle = phandle) {
+	node = OF_finddevice("/cpus/@0");
+	if (OF_getprop(node, "timebase-frequency",
+			&ticks_per_sec, sizeof ticks_per_sec) > 0) {
+		goto found;
+	}
+
+	node = OF_finddevice("/");
+	for (qhandle = node; qhandle; qhandle = phandle) {
 		if (OF_getprop(qhandle, "device_type", type, sizeof type) > 0
 		    && strcmp(type, "cpu") == 0
 		    && OF_getprop(qhandle, "timebase-frequency",
@@ -621,8 +628,13 @@ find_ranges(int base, rangemap_t *region
 			break;
 		case RANGE_TYPE_MACIO:
 			regions[*cur].type = RANGE_MEM;
-			regions[*cur].size = map[1];
-			regions[*cur].addr = map[0];
+			if (len == 8) {
+				regions[*cur].size = map[1];
+				regions[*cur].addr = map[0];
+			} else {
+				regions[*cur].size = map[2];
+				regions[*cur].addr = map[1];
+			}				
 			(*cur)++;		
 			break;
 	}

Reply via email to