[OpenBIOS] [RFC PATCH 1/2] add power-mgt node under /pci/mac-io/via-cuda

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


xnu needs power-mgt node otherwise it panics
http://www.opensource.apple.com/source/AppleCore99PE/AppleCore99PE-121.0.2/Core99.cpp

I see two possible locations
either /pci/mac-io/power-mgt
http://web.archive.org/web/20090107152212/http://penguinppc.org/historical/dev-trees-html/g3bw_350.html
or /pci/mac-io/via-cuda/power-mgt
http://web.archive.org/web/20090107144433/http://penguinppc.org/historical/dev-trees-html/g3_beige_300.html

also seen it under /pci/pci-bridge/mac-io/via-pmu/power-mgt
http://web.archive.org/web/20090107151044/http://penguinppc.org/historical/dev-trees-html/g4_agp_500_2.html

Seems like it is basically used to fake powermanagement

Signed-off-by: Amadeusz Sławiński <amade at asmblr.net>
---
 arch/ppc/qemu/init.c |  6 ++++--
 drivers/cuda.c       | 15 +++++++++++++++
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/arch/ppc/qemu/init.c b/arch/ppc/qemu/init.c
index a8fc320..5a11610 100644
--- a/arch/ppc/qemu/init.c
+++ b/arch/ppc/qemu/init.c
@@ -258,12 +258,14 @@ cpu_generic_init(const struct cpudef *cpu)
     push_str("icache-block-size");
     fword("property");
 
-    PUSH(fw_cfg_read_i32(FW_CFG_PPC_TBFREQ));
+    //PUSH(fw_cfg_read_i32(FW_CFG_PPC_TBFREQ));
+    PUSH(0x017c0f93);
     fword("encode-int");
     push_str("timebase-frequency");
     fword("property");
 
-    PUSH(fw_cfg_read_i32(FW_CFG_PPC_CPUFREQ));
+    //PUSH(fw_cfg_read_i32(FW_CFG_PPC_CPUFREQ));
+    PUSH(0x1dcd6500);
     fword("encode-int");
     push_str("clock-frequency");
     fword("property");
diff --git a/drivers/cuda.c b/drivers/cuda.c
index 3a57c7d..9555dea 100644
--- a/drivers/cuda.c
+++ b/drivers/cuda.c
@@ -369,6 +369,20 @@ rtc_init(char *path)
 
 }
 
+static void
+powermgt_init(char *path)
+{
+	phandle_t ph;
+	char buf[64];
+
+        snprintf(buf, sizeof(buf), "%s/power-mgt", path);
+	REGISTER_NAMED_NODE(rtc, buf);
+
+	ph = find_dev(buf);
+	set_property(ph, "device_type", "power-mgt", 10);
+	set_property(ph, "compatible", "power-mgt", 10);
+}
+
 cuda_t *cuda_init (const char *path, phys_addr_t base)
 {
 	cuda_t *cuda;
@@ -399,6 +413,7 @@ cuda_t *cuda_init (const char *path, phys_addr_t base)
 #endif
 
 	rtc_init(buf);
+	powermgt_init(buf);
 
         main_cuda = cuda;
 
-- 
1.8.1.4




More information about the OpenBIOS mailing list