[OpenBIOS] [commit] r1161 - trunk/openbios-devel/drivers

repository service svn at openbios.org
Tue Jun 25 18:11:58 CEST 2013


Author: agraf
Date: Tue Jun 25 18:11:57 2013
New Revision: 1161
URL: http://tracker.coreboot.org/trac/openbios/changeset/1161

Log:
Mac99: Add power-mgt node to via-cuda

Instead of spawning a half-broken via-pmu device tree node, let's
create a power-mgt node below out already existing via-cuda node
instead.

This patch is inspired by a patch from

  Amadeusz Sławiński <amade at asmblr.net>

Signed-off-by: Alexander Graf <agraf at suse.de>

Modified:
   trunk/openbios-devel/drivers/cuda.c
   trunk/openbios-devel/drivers/macio.c

Modified: trunk/openbios-devel/drivers/cuda.c
==============================================================================
--- trunk/openbios-devel/drivers/cuda.c	Tue Jun 25 03:55:45 2013	(r1160)
+++ trunk/openbios-devel/drivers/cuda.c	Tue Jun 25 18:11:57 2013	(r1161)
@@ -369,6 +369,20 @@
 
 }
 
+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 @@
 #endif
 
 	rtc_init(buf);
+	powermgt_init(buf);
 
         main_cuda = cuda;
 

Modified: trunk/openbios-devel/drivers/macio.c
==============================================================================
--- trunk/openbios-devel/drivers/macio.c	Tue Jun 25 03:55:45 2013	(r1160)
+++ trunk/openbios-devel/drivers/macio.c	Tue Jun 25 18:11:57 2013	(r1161)
@@ -43,34 +43,6 @@
                 return NW_IO_NVRAM_SIZE >> NW_IO_NVRAM_SHIFT;
 }
 
-/* XXX this is barely enough to make Mac OS happy, we really should just
-       emulate an actual PMU and have that behind the mac-io */
-static void
-macio_pmu_init(const char *path)
-{
-	phandle_t dnode;
-	char buf[128];
-
-        push_str(path);
-        fword("find-device");
-        fword("new-device");
-        push_str("via-pmu");
-        fword("device-name");
-        fword("finish-device");
-
-	snprintf(buf, sizeof(buf), "%s/via-pmu", path);
-        push_str(buf);
-        fword("find-device");
-        fword("new-device");
-        push_str("power-mgt");
-        fword("device-name");
-
-        snprintf(buf, sizeof(buf), "%s/via-pmu/power-mgt", path);
-        dnode = find_dev(buf);
-        set_property(dnode, "compatible", "via-pmu-99", 11);
-        fword("finish-device");
-}
-
 void macio_nvram_init(const char *path, phys_addr_t addr)
 {
 	phandle_t chosen, aliases;
@@ -320,6 +292,5 @@
         escc_init(path, addr);
         macio_ide_init(path, addr, 3);
         openpic_init(path, addr);
-	macio_pmu_init(path);
 	ob_unin_init();
 }



More information about the OpenBIOS mailing list