From 49d3954458bed90ce3c52d37c9ae78e038e41af6 Mon Sep 17 00:00:00 2001 From: Blue Swirl Date: Mon, 5 Jan 2009 20:30:39 +0000 Subject: [PATCH] Mac-io cleanup (Laurent Vivier) git-svn-id: svn://coreboot.org/openbios/openbios-devel@356 f158a5a8-5612-0410-a976-696ce0be7e32 --- arch/ppc/qemu/qemu.c | 99 ---------------- config/examples/cross-ppc_config.xml | 1 + config/examples/ppc_config.xml | 1 + drivers/build.xml | 1 + drivers/cuda.c | 2 + drivers/cuda.h | 2 - drivers/macio.c | 162 +++++++++++++++++++++++++++ drivers/macio.h | 4 + drivers/pci.c | 25 +---- include/openbios/drivers.h | 3 - 10 files changed, 176 insertions(+), 124 deletions(-) create mode 100644 drivers/macio.c create mode 100644 drivers/macio.h diff --git a/arch/ppc/qemu/qemu.c b/arch/ppc/qemu/qemu.c index c5ba7d5..068f5bb 100644 --- a/arch/ppc/qemu/qemu.c +++ b/arch/ppc/qemu/qemu.c @@ -27,9 +27,6 @@ #include "qemu/qemu.h" #include -// FIXME -unsigned long virt_offset = 0; - //#define DUMP_NVRAM void @@ -52,11 +49,6 @@ panic( const char *err ) exit(0); } - -/************************************************************************/ -/* print using OSI interface */ -/************************************************************************/ - static int do_indent; int @@ -82,94 +74,3 @@ printk( const char *fmt, ... ) } return i; } - - -/************************************************************************/ -/* TTY iface */ -/************************************************************************/ - -/************************************************************************/ -/* briQ specific stuff */ -/************************************************************************/ - -#define IO_NVRAM_SIZE 0x00020000 -#define IO_NVRAM_OFFSET 0x00060000 - -static char *nvram; - -void macio_nvram_init(const char *path, uint32_t addr) -{ - phandle_t chosen, aliases; - phandle_t dnode; - int props[2]; - char buf[64]; - - nvram = (char*)addr + IO_NVRAM_OFFSET; - snprintf(buf, sizeof(buf), "%s/nvram", path); - nvram_init(buf); - dnode = find_dev(buf); - set_int_property(dnode, "#bytes", IO_NVRAM_SIZE >> 4); - set_property(dnode, "compatible", "nvram,flash", 12); - props[0] = __cpu_to_be32(IO_NVRAM_OFFSET); - props[1] = __cpu_to_be32(IO_NVRAM_SIZE); - set_property(dnode, "reg", (char *)&props, sizeof(props)); - set_property(dnode, "device_type", "nvram", 6); - - chosen = find_dev("/chosen"); - set_int_property(chosen, "nvram", dnode); - - aliases = find_dev("/aliases"); - set_property(aliases, "nvram", buf, strlen(buf) + 1); -} - -#ifdef DUMP_NVRAM -static void -dump_nvram(void) -{ - int i, j; - for (i = 0; i < 10; i++) - { - for (j = 0; j < 16; j++) - printk ("%02x ", nvram[(i*16+j)<<4]); - printk (" "); - for (j = 0; j < 16; j++) - if (isprint(nvram[(i*16+j)<<4])) - printk("%c", nvram[(i*16+j)<<4]); - else - printk("."); - printk ("\n"); - } -} -#endif - - -int -arch_nvram_size( void ) -{ - return IO_NVRAM_SIZE>>4; -} - -void -arch_nvram_put( char *buf ) -{ - int i; - for (i=0; i>4; i++) - nvram[i<<4]=buf[i]; -#ifdef DUMP_NVRAM - printk("new nvram:\n"); - dump_nvram(); -#endif -} - -void -arch_nvram_get( char *buf ) -{ - int i; - for (i=0; i>4; i++) - buf[i]=nvram[i<<4]; - -#ifdef DUMP_NVRAM - printk("current nvram:\n"); - dump_nvram(); -#endif -} diff --git a/config/examples/cross-ppc_config.xml b/config/examples/cross-ppc_config.xml index b6ba887..784ebc8 100644 --- a/config/examples/cross-ppc_config.xml +++ b/config/examples/cross-ppc_config.xml @@ -73,5 +73,6 @@