Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/powerpc/oea add quick path for timebase-frequency d...



details:   https://anonhg.NetBSD.org/src/rev/add88938800c
branches:  trunk
changeset: 356389:add88938800c
user:      macallan <macallan%NetBSD.org@localhost>
date:      Fri Sep 22 04:45:56 2017 +0000

description:
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

diffstat:

 sys/arch/powerpc/oea/ofwoea_machdep.c |  24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)

diffs (59 lines):

diff -r acdda2b99ded -r add88938800c sys/arch/powerpc/oea/ofwoea_machdep.c
--- a/sys/arch/powerpc/oea/ofwoea_machdep.c     Fri Sep 22 04:11:24 2017 +0000
+++ b/sys/arch/powerpc/oea/ofwoea_machdep.c     Fri Sep 22 04:45:56 2017 +0000
@@ -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 @@
 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 @@
                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 @@
                        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;
        }



Home | Main Index | Thread Index | Old Index