WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ppc-devel

[XenPPC] [pushed] [ppc] DART now uses global oftree to find itself

To: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Subject: [XenPPC] [pushed] [ppc] DART now uses global oftree to find itself
From: jimix@xxxxxxxxxxxxxx
Date: Fri, 19 May 2006 13:33:00 -0400
Delivery-date: Fri, 19 May 2006 10:32:20 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
changeset:   10376:cd1ac4d0bd1b5453c6d7240eb44040f44cf356ab
tag:         tip
user:        jimix@xxxxxxxxxxxxxxxxxxxxx
date:        Fri May 19 13:32:42 2006 -0400
files:       xen/arch/ppc/boot_of.c xen/arch/ppc/dart.c xen/arch/ppc/dart.h
description:
[ppc] DART now uses global oftree to find itself

mostly from: butrico@xxxxxxxxxxxxxx


diff -r d971225c2e61f4d58d6559b51e83fed1bcf7cceb -r 
cd1ac4d0bd1b5453c6d7240eb44040f44cf356ab xen/arch/ppc/boot_of.c
--- a/xen/arch/ppc/boot_of.c    Fri May 19 13:27:56 2006 -0400
+++ b/xen/arch/ppc/boot_of.c    Fri May 19 13:32:42 2006 -0400
@@ -27,7 +27,6 @@
 #include <public/of-devtree.h>
 #include <asm/page.h>
 #include <asm/io.h>
-#include "dart.h"
 
 static ulong of_vec;
 static ulong of_msr;
@@ -968,35 +967,6 @@ static int __init boot_of_rtas(void)
     return 1;
 }
 
-static void __init boot_of_dart(void)
-{
-    int n;
-
-    n = of_finddevice("/mambo");
-    if (n != OF_FAILURE) {
-        /* mambo had no dart */
-        return;
-    }
-
-    /* defaults */
-    dart_address = DART_DEF_BASE;
-    dart_model = DART_U3;
-
-    /* this is not great but is sufficient */
-    n = of_finddevice("/dart");
-    if (n != OF_FAILURE) {
-        char compat[128];
-
-        of_getprop(n, "reg", &dart_address, sizeof (dart_address));
-
-        compat[0] = '\0';
-        of_getprop(n, "compatible", compat, sizeof (compat));
-        if (strstr(compat, "u4")) {
-            dart_model = DART_U4;
-        }
-    }
-}
-
 multiboot_info_t __init *boot_of_init(
         ulong r3, ulong r4, ulong vec, ulong r6, ulong r7, ulong orig_msr)
 {
@@ -1033,7 +1003,6 @@ multiboot_info_t __init *boot_of_init(
     boot_of_module(r3, r4, &mbi);
     boot_of_cpus();
     boot_of_rtas();
-    boot_of_dart();
 
     /* end of OF */
     of_printf("closing OF stdout...\n");
diff -r d971225c2e61f4d58d6559b51e83fed1bcf7cceb -r 
cd1ac4d0bd1b5453c6d7240eb44040f44cf356ab xen/arch/ppc/dart.c
--- a/xen/arch/ppc/dart.c       Fri May 19 13:27:56 2006 -0400
+++ b/xen/arch/ppc/dart.c       Fri May 19 13:32:42 2006 -0400
@@ -20,9 +20,11 @@
 #include <xen/mm.h>
 #include <asm/cache.h>
 #include <xen/init.h>
+#include <public/of-devtree.h>
 #include "tce.h"
 #include "iommu.h"
 #include "dart.h"
+#include "oftree.h"
 
 #undef DEBUG
 #ifdef DEBUG
@@ -33,6 +35,12 @@ static int first_put;
 
 int dart_model;
 unsigned long dart_address;
+#define DART_DEF_BASE   0xf8033000UL
+#define DART_NONE 0
+#define DART_U3 3
+#define DART_U4 4
+#define DART_WRITE 0x1
+#define DART_READ 0x2
 
 static ulong dummy_page;
 static struct dart_ops *dops;
@@ -147,19 +155,63 @@ static int dart_put(ulong ioba, union tc
     return 0;
 }
 
+static int find_dart_simple_probe(void *oft_p)
+{
+    int rc;
+    char compat[128];
+    ofdn_t dart_node;
+
+    dart_address = DART_DEF_BASE;
+    dart_model = DART_U3;
+
+    dart_node = ofd_node_find(oft_p, "/dart");
+    if (dart_node < 0) {
+        return rc;
+    }
+
+    /* if the property does not exist, then the value of dart_address is
+     * unmodified */
+    rc = ofd_getprop(oft_p, dart_node, "reg", &dart_address,
+                    sizeof (dart_address));
+
+    rc = ofd_getprop(oft_p, dart_node, "compatible", compat, sizeof (compat));
+    if ( rc > 0 ) {
+        if (strstr(compat, "u4")) {
+            dart_model = DART_U4;
+        }
+    }
+
+
+    return 0;
+}
+
+static int find_dart()
+{
+    void *oft_p;
+    int rc;
+
+    if (on_mambo()) {
+        /* mambo has no dart */
+        return -1;
+    }
+
+    dart_address = (unsigned long) -1;
+    dart_model = 0;
+
+    oft_p = (void *) oftree;
+
+    rc = find_dart_simple_probe(oft_p);
+    /* TODO: find the dart in the canonical way */
+
+    return rc;
+}
+
 static int init_dart(void)
 {
     ulong tpgs;
 
-    switch (dart_model) {
-    case DART_U3: case DART_U4:
-        break;
-    default:
-        panic("unknown DART model: %d\n", dart_model);
-        /* FALLTHRU */
-    case 0:
+    if (find_dart())
         return 0;
-    }
 
     /* Max size of 512 pages == 2MB == 1<<21 */
     tpgs = DART_SHIFT - PAGE_SHIFT;
diff -r d971225c2e61f4d58d6559b51e83fed1bcf7cceb -r 
cd1ac4d0bd1b5453c6d7240eb44040f44cf356ab xen/arch/ppc/dart.h
--- a/xen/arch/ppc/dart.h       Fri May 19 13:27:56 2006 -0400
+++ b/xen/arch/ppc/dart.h       Fri May 19 13:32:42 2006 -0400
@@ -23,16 +23,6 @@
 #include <xen/config.h>
 #include <xen/types.h>
 
-#define DART_DEF_BASE   0xf8033000UL
-#define DART_NONE 0
-#define DART_U3 3
-#define DART_U4 4
-#define DART_WRITE 0x1
-#define DART_READ 0x2
-
-extern int dart_model;
-extern unsigned long dart_address;
-
 struct dart_ops {
     void (*do_inv_all)(void);
     void (*do_inv_entry)(ulong pg);



_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [XenPPC] [pushed] [ppc] DART now uses global oftree to find itself, jimix <=