diff -r 2c4956f3947b xen/arch/ppc/boot_of.c
--- a/xen/arch/ppc/boot_of.c Fri May 19 07:01:47 2006 -0400
+++ b/xen/arch/ppc/boot_of.c Fri May 19 12:52:10 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;
@@ -934,35 +933,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)
{
@@ -998,7 +968,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 2c4956f3947b xen/arch/ppc/dart.c
--- a/xen/arch/ppc/dart.c Fri May 19 07:01:47 2006 -0400
+++ b/xen/arch/ppc/dart.c Fri May 19 12:52:10 2006 -0400
@@ -20,6 +20,7 @@
#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"
@@ -147,9 +148,81 @@ static int dart_put(ulong ioba, union tc
return 0;
}
-static int init_dart(void)
+/*
+ * This really belongs in compatible/platform, but we don't have that yet
+ */
+static int on_mambo(void *oft_p)
+{
+ ofdn_t node;
+
+ node = ofd_node(oft_p, "/mambo");
+ if ( node ) {
+ /* mambo had no dart */
+ return 1;
+ } else {
+ 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_getnode(oft_p, "/dart"); // do this
+
+ 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(unsigned long oftree)
+{
+ void *oft_p;
+ int rc;
+
+ dart_address = (unsigned long) -1;
+ dart_model = 0;
+
+ oft_p = (void *) oftree;
+ rc = on_mambo(oft_p);
+ if (rc) {
+ /* mambo has not dart */
+ return -1;
+ }
+
+ rc = find_dart_simple_probe(oft_p);
+ /* TODO: find the dart in the canonical way */
+
+ return rc;
+}
+
+static int init_dart(unsigned long oftree)
{
ulong tpgs;
+
+ if (find_dart(oftree)) {
+ return 0;
+ }
switch (dart_model) {
case DART_U3: case DART_U4:
_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel
|