Index: openbios-quilt/arch/ppc/qemu/ldscript
===================================================================
--- openbios-quilt.orig/arch/ppc/qemu/ldscript	2009-02-07 11:25:05.000000000 +0000
+++ openbios-quilt/arch/ppc/qemu/ldscript	2009-02-07 11:25:27.000000000 +0000
@@ -7,7 +7,7 @@
 
 /* As NVRAM is at 0xfff04000, the .text needs to be after that
  */
-TEXT_ADDR = 0xfff06000;
+TEXT_ADDR = 0xfff08000;
 
 /* Hard reset vector address
  */
Index: openbios-quilt/drivers/macio.c
===================================================================
--- openbios-quilt.orig/drivers/macio.c	2009-02-07 11:25:06.000000000 +0000
+++ openbios-quilt/drivers/macio.c	2009-02-07 11:25:27.000000000 +0000
@@ -19,15 +19,23 @@
 #include "cuda.h"
 #include "escc.h"
 
-#define IO_NVRAM_SIZE   0x00020000
-#define IO_NVRAM_OFFSET 0x00060000
+#define OW_IO_NVRAM_SIZE   0x00020000
+#define OW_IO_NVRAM_OFFSET 0x00060000
+#define OW_IO_NVRAM_SHIFT  4
+
+#define NW_IO_NVRAM_SIZE   0x00004000
+#define NW_IO_NVRAM_OFFSET 0xfff04000
+#define NW_IO_NVRAM_SHIFT  1
 
 static char *nvram;
 
 int
 arch_nvram_size( void )
 {
-	return IO_NVRAM_SIZE>>4;
+        if (is_oldworld())
+                return OW_IO_NVRAM_SIZE >> OW_IO_NVRAM_SHIFT;
+        else
+                return NW_IO_NVRAM_SIZE >> NW_IO_NVRAM_SHIFT;
 }
 
 void macio_nvram_init(const char *path, uint32_t addr)
@@ -36,14 +44,28 @@
 	phandle_t dnode;
 	int props[2];
 	char buf[64];
+        unsigned long nvram_size, nvram_offset;
 
-	nvram = (char*)addr + IO_NVRAM_OFFSET;
+        if (is_oldworld()) {
+                nvram_offset = OW_IO_NVRAM_OFFSET;
+                nvram_size = OW_IO_NVRAM_SIZE;
+        } else {
+                nvram_offset = NW_IO_NVRAM_OFFSET;
+                nvram_size = NW_IO_NVRAM_SIZE;
+                push_str("/");
+                fword("find-device");
+                fword("new-device");
+                push_str("nvram");
+                fword("device-name");
+                fword("finish-device");
+        }
+	nvram = (char*)addr + nvram_offset;
         snprintf(buf, sizeof(buf), "%s/nvram", path);
 	nvram_init(buf);
 	dnode = find_dev(buf);
 	set_int_property(dnode, "#bytes", arch_nvram_size() );
-	props[0] = __cpu_to_be32(IO_NVRAM_OFFSET);
-	props[1] = __cpu_to_be32(IO_NVRAM_SIZE);
+	props[0] = __cpu_to_be32(nvram_offset);
+	props[1] = __cpu_to_be32(nvram_size);
 	set_property(dnode, "reg", (char *)&props, sizeof(props));
 	set_property(dnode, "device_type", "nvram", 6);
 
@@ -81,8 +103,15 @@
 arch_nvram_put( char *buf )
 {
 	int i;
+        unsigned int it_shift;
+
+        if (is_oldworld())
+                it_shift = OW_IO_NVRAM_SHIFT;
+        else
+                it_shift = NW_IO_NVRAM_SHIFT;
+
 	for (i=0; i< arch_nvram_size() ; i++)
-		nvram[i<<4]=buf[i];
+		nvram[i << it_shift] = buf[i];
 #ifdef DUMP_NVRAM
 	printk("new nvram:\n");
 	dump_nvram();
@@ -93,8 +122,15 @@
 arch_nvram_get( char *buf )
 {
 	int i;
+        unsigned int it_shift;
+
+        if (is_oldworld())
+                it_shift = OW_IO_NVRAM_SHIFT;
+        else
+                it_shift = NW_IO_NVRAM_SHIFT;
+
 	for (i=0; i< arch_nvram_size(); i++)
-		buf[i]=nvram[i<<4];
+                buf[i] = nvram[i << it_shift];
 
 #ifdef DUMP_NVRAM
 	printk("current nvram:\n");
@@ -103,7 +139,7 @@
 }
 
 void
-ob_macio_init(const char *path, uint32_t addr)
+ob_macio_heathrow_init(const char *path, uint32_t addr)
 {
         phandle_t aliases;
 
@@ -115,3 +151,18 @@
         escc_init(path, addr);
 	macio_ide_init(path, addr, 1);
 }
+
+void
+ob_macio_keylargo_init(const char *path, uint32_t addr)
+{
+        phandle_t aliases;
+
+        aliases = find_dev("/aliases");
+        set_property(aliases, "mac-io", path, strlen(path) + 1);
+
+        cuda_init(path, addr);
+        /* The NewWorld NVRAM is not located in the MacIO device */
+        macio_nvram_init("", 0);
+        escc_init(path, addr);
+        macio_ide_init(path, addr, 3);
+}
Index: openbios-quilt/drivers/macio.h
===================================================================
--- openbios-quilt.orig/drivers/macio.h	2009-02-07 11:25:06.000000000 +0000
+++ openbios-quilt/drivers/macio.h	2009-02-07 11:25:27.000000000 +0000
@@ -1,4 +1,5 @@
 extern phandle_t pic_handle;
 
-void ob_macio_init(const char *path, uint32_t addr);
+void ob_macio_heathrow_init(const char *path, uint32_t addr);
+void ob_macio_keylargo_init(const char *path, uint32_t addr);
 void macio_nvram_init(const char *path, uint32_t addr);
Index: openbios-quilt/drivers/pci.c
===================================================================
--- openbios-quilt.orig/drivers/pci.c	2009-02-07 11:25:06.000000000 +0000
+++ openbios-quilt/drivers/pci.c	2009-02-07 11:25:27.000000000 +0000
@@ -419,16 +419,26 @@
 	set_property(dev, "ranges", (char *)props, ncells * sizeof(cell));
 }
 
-int macio_config_cb (const pci_config_t *config)
+int macio_heathrow_config_cb (const pci_config_t *config)
 {
 	pci_set_ranges(config);
 
 #ifdef CONFIG_DRIVER_MACIO
-	ob_macio_init(config->path, config->assigned[0] & ~0x0000000F);
+        ob_macio_heathrow_init(config->path, config->assigned[0] & ~0x0000000F);
 #endif
 	return 0;
 }
 
+int macio_keylargo_config_cb (const pci_config_t *config)
+{
+        pci_set_ranges(config);
+
+#ifdef CONFIG_DRIVER_MACIO
+        ob_macio_keylargo_init(config->path, config->assigned[0] & ~0x0000000F);
+#endif
+        return 0;
+}
+
 int vga_config_cb (const pci_config_t *config)
 {
 	if (config->assigned[0] != 0x00000000)
Index: openbios-quilt/drivers/pci_database.c
===================================================================
--- openbios-quilt.orig/drivers/pci_database.c	2009-02-07 11:25:06.000000000 +0000
+++ openbios-quilt/drivers/pci_database.c	2009-02-07 11:25:27.000000000 +0000
@@ -1071,21 +1071,21 @@
         PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_343S1201,
         "mac-io", "mac-io", "AAPL,343S1201", "heathrow\0",
         1, 1, 1,
-        &macio_config_cb, NULL,
+        &macio_heathrow_config_cb, NULL,
     },
     /* Paddington Mac I/O */
     {
         PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_343S1211,
         "mac-io", "mac-io", "AAPL,343S1211", "paddington\0heathrow\0",
         1, 1, 1,
-        &macio_config_cb, NULL,
+        &macio_heathrow_config_cb, NULL,
     },
     /* KeyLargo Mac I/O */
     {
         PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_UNI_N_KEYL,
         "mac-io", "mac-io", "AAPL,Keylargo", "Keylargo\0",
         1, 1, 2,
-        &macio_config_cb, NULL,
+        &macio_keylargo_config_cb, NULL,
     },
     {
         0xFFFF, 0xFFFF,
Index: openbios-quilt/drivers/pci_database.h
===================================================================
--- openbios-quilt.orig/drivers/pci_database.h	2009-02-07 11:25:06.000000000 +0000
+++ openbios-quilt/drivers/pci_database.h	2009-02-07 11:25:27.000000000 +0000
@@ -27,7 +27,8 @@
 
 extern int ide_config_cb2(const pci_config_t *config);
 extern int eth_config_cb(const pci_config_t *config);
-extern int macio_config_cb(const pci_config_t *config);
+extern int macio_heathrow_config_cb(const pci_config_t *config);
+extern int macio_keylargo_config_cb(const pci_config_t *config);
 extern int vga_config_cb(const pci_config_t *config);
 extern int host_config_cb(const pci_config_t *config);
 extern int bridge_config_cb(const pci_config_t *config);
