[OpenBIOS] [RFC PATCH 2/2] implement /uni-n node

Amadeusz Sławiński amade at asmblr.net
Sun Feb 24 01:24:36 CET 2013


it is required by xnu to boot on newworld machines

there are still two thing to investigate

1. reg property, seems to have different size on real machine than in qemu
http://web.archive.org/web/20090107151044/http://penguinppc.org/historical/dev-trees-html/g4_agp_500_2.html
0x01000000 vs 0x00001000

2. which value to put in device-rev property
According to
http://www.opensource.apple.com/source/AppleCore99PE/AppleCore99PE-121.0.2/Core99.h
there are 3 possible values 3, 7, 10 and depending on them kernel takes different codepaths just look for "kUniNVersion" in:
http://www.opensource.apple.com/source/AppleCore99PE/AppleCore99PE-121.0.2/Core99.cpp 

Signed-off-by: Amadeusz Sławiński <amade at asmblr.net>
---
 arch/ppc/qemu/init.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/arch/ppc/qemu/init.c b/arch/ppc/qemu/init.c
index 5a11610..7f93d82 100644
--- a/arch/ppc/qemu/init.c
+++ b/arch/ppc/qemu/init.c
@@ -639,6 +639,56 @@ static void ffilll(void)
     }   
 }
 
+static void uni_n_init(void)
+{
+    push_str("/");
+    fword("find-device");
+
+    fword("new-device");
+    push_str("uni-n");
+    fword("device-name");
+
+    push_str("APPL,uninorth");
+    fword("encode-string");
+    push_str("model");
+    fword("property");
+
+    push_str("memory-controller");
+    fword("encode-string");
+    push_str("device_type");
+    fword("property");
+
+    push_str("uni-north");
+    fword("encode-string");
+    push_str("compatible");
+    fword("property");
+
+    PUSH(1);
+    fword("encode-int");
+    push_str("#address-cells");
+    fword("property");
+
+    PUSH(1);
+    fword("encode-int");
+    push_str("#size-cells");
+    fword("property");
+
+    PUSH(0xf8000000);
+    fword("encode-int");
+    PUSH(0x00001000); // XXX: check this on qemu is 0x1000 on net is 0x1000000
+    fword("encode-int");
+    fword("encode+");
+    push_str("reg");
+    fword("property");
+
+    PUSH(0);
+    fword("encode-int");
+    push_str("device-rev");
+    fword("property");
+
+    fword("finish-device");
+}
+
 void
 arch_of_init(void)
 {
@@ -908,4 +958,8 @@ arch_of_init(void)
     
     bind_func("platform-boot", boot);
     bind_func("(go)", go);
+
+    if (is_newworld()) {
+        uni_n_init();
+    }
 }
-- 
1.8.1.4




More information about the OpenBIOS mailing list