diff -Nru openbios-ppc-1.0+svn1060/.gitignore openbios-ppc-1.1/.gitignore --- openbios-ppc-1.0+svn1060/.gitignore 2009-12-05 10:17:25.000000000 +0000 +++ openbios-ppc-1.1/.gitignore 2013-05-06 19:09:54.000000000 +0000 @@ -1,2 +1,3 @@ obj-* .stgit-* +config-host.mak diff -Nru openbios-ppc-1.0+svn1060/Makefile openbios-ppc-1.1/Makefile --- openbios-ppc-1.0+svn1060/Makefile 2009-12-05 10:17:25.000000000 +0000 +++ openbios-ppc-1.1/Makefile 2013-05-06 19:09:54.000000000 +0000 @@ -1,5 +1,4 @@ -ODIRS=$(wildcard obj-*) -TARGETS=$(subst obj-,,$(ODIRS)) +include config-host.mak all: requirements info build @@ -16,18 +15,24 @@ $(MAKE) -C $$dir clean; \ done -build: - @printf "Building..." +build: start-build @for dir in $(ODIRS); do \ $(MAKE) -C $$dir > $$dir/build.log 2>&1 && echo "ok." || \ ( echo "error:"; tail -15 $$dir/build.log; exit 1 ) \ done -build-verbose: +SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGETS)) +SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory) + +quiet-command = $(if $(V),$1,$(if $(2),@echo $2 && $1, @$1)) + +build-verbose: start-build $(SUBDIR_RULES) + +subdir-%: + $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C obj-$* V="$(V)" all,) + +start-build: @echo "Building..." - @for dir in $(ODIRS); do \ - $(MAKE) -C $$dir || exit 1; \ - done run: @echo "Running..." diff -Nru openbios-ppc-1.0+svn1060/Makefile.target openbios-ppc-1.1/Makefile.target --- openbios-ppc-1.0+svn1060/Makefile.target 2011-01-06 16:11:49.000000000 +0000 +++ openbios-ppc-1.1/Makefile.target 2013-05-06 19:09:54.000000000 +0000 @@ -6,7 +6,6 @@ include config.mak ODIR := . -SRCDIR := .. HOSTCC := gcc HOSTCFLAGS+= -O2 -g -DFCOMPILER -DBOOTSTRAP $(CROSSCFLAGS) @@ -38,6 +37,10 @@ quiet-command = $(if $(V),$1,$(if $(2),@echo $2 && $1, @$1)) +VPATH_SUFFIXES = %.c %.h %.S %.fs +set-vpath = $(if $1,$(foreach PATTERN,$(VPATH_SUFFIXES),$(eval vpath $(PATTERN) $1))) +$(call set-vpath, $(SRCDIR)) + # # pre rules # diff -Nru openbios-ppc-1.0+svn1060/VERSION openbios-ppc-1.1/VERSION --- openbios-ppc-1.0+svn1060/VERSION 2009-12-05 10:17:25.000000000 +0000 +++ openbios-ppc-1.1/VERSION 2013-05-06 19:09:54.000000000 +0000 @@ -1 +1 @@ -1.0 +1.1 diff -Nru openbios-ppc-1.0+svn1060/arch/ppc/ppc.fs openbios-ppc-1.1/arch/ppc/ppc.fs --- openbios-ppc-1.0+svn1060/arch/ppc/ppc.fs 2009-03-08 13:07:57.000000000 +0000 +++ openbios-ppc-1.1/arch/ppc/ppc.fs 2013-05-06 19:09:54.000000000 +0000 @@ -1,3 +1,6 @@ +\ ------------------------------------------------------------------------- +\ registers +\ ------------------------------------------------------------------------- 0 value %cr 0 value %ctr @@ -45,3 +48,10 @@ 0 value %sprg1 0 value %sprg2 0 value %sprg3 + +\ ------------------------------------------------------------------------- +\ other +\ ------------------------------------------------------------------------- + +\ Set by BootX when booting Mac OS X +defer spin diff -Nru openbios-ppc-1.0+svn1060/arch/ppc/qemu/init.c openbios-ppc-1.1/arch/ppc/qemu/init.c --- openbios-ppc-1.0+svn1060/arch/ppc/qemu/init.c 2012-01-04 09:41:45.000000000 +0000 +++ openbios-ppc-1.1/arch/ppc/qemu/init.c 2013-05-06 19:09:54.000000000 +0000 @@ -59,6 +59,14 @@ } } +extern void __divide_error(void); + +void +__divide_error(void) +{ + return; +} + enum { ARCH_PREP = 0, ARCH_MAC99, @@ -68,7 +76,7 @@ int is_apple(void) { - return 1; + return is_oldworld() || is_newworld(); } int is_oldworld(void) @@ -144,7 +152,7 @@ .cfg_len = 0x7f000000, .host_mem_base = 0x80000000, .pci_mem_base = 0x80000000, - .mem_len = 0x01000000, + .mem_len = 0x10000000, .io_base = 0xfe000000, .io_len = 0x00800000, .rbase = 0xfd000000, @@ -613,6 +621,22 @@ fword("finish-device"); } +/* + * filll ( addr bytes quad -- ) + */ + +static void ffilll(void) +{ + const u32 longval = POP(); + u32 bytes = POP(); + u32 *laddr = (u32 *)cell2pointer(POP()); + u32 len; + + for (len = 0; len < bytes / sizeof(u32); len++) { + *laddr++ = longval; + } +} + void arch_of_init(void) { @@ -831,7 +855,7 @@ } /* Setup default boot devices */ - snprintf(buf, sizeof(buf), "%s:,\\\\:tbxi %s:,\\ppc\\bootinfo.txt", boot_path, boot_path); + snprintf(buf, sizeof(buf), "%s:,\\\\:tbxi %s:,\\ppc\\bootinfo.txt %s:,%%BOOT", boot_path, boot_path, boot_path); push_str(buf); fword("encode-string"); push_str("boot-device"); @@ -877,6 +901,9 @@ device_end(); + /* Implementation of filll word (required by BootX) */ + bind_func("filll", ffilll); + bind_func("platform-boot", boot); bind_func("(go)", go); } diff -Nru openbios-ppc-1.0+svn1060/arch/ppc/qemu/ldscript openbios-ppc-1.1/arch/ppc/qemu/ldscript --- openbios-ppc-1.0+svn1060/arch/ppc/qemu/ldscript 2009-08-18 14:16:50.000000000 +0000 +++ openbios-ppc-1.1/arch/ppc/qemu/ldscript 2013-05-06 19:09:54.000000000 +0000 @@ -1,5 +1,5 @@ OUTPUT_FORMAT(elf32-powerpc) -OUTPUT_ARCH(powerpc) +OUTPUT_ARCH(powerpc:common) /* Initial load address */ diff -Nru openbios-ppc-1.0+svn1060/arch/ppc/qemu/main.c openbios-ppc-1.1/arch/ppc/qemu/main.c --- openbios-ppc-1.0+svn1060/arch/ppc/qemu/main.c 2011-01-06 16:11:49.000000000 +0000 +++ openbios-ppc-1.1/arch/ppc/qemu/main.c 2013-05-06 19:09:54.000000000 +0000 @@ -39,141 +39,6 @@ #define ELF_DPRINTF(fmt, args...) SUBSYS_DPRINTF("ELF", fmt, ##args) #define NEWWORLD_DPRINTF(fmt, args...) SUBSYS_DPRINTF("NEWWORLD", fmt, ##args) -static char * -get_device( const char *path ) -{ - int i; - static char buf[1024]; - - for (i = 0; i < sizeof(buf) && path[i] && path[i] != ':'; i++) - buf[i] = path[i]; - buf[i] = 0; - - return buf; -} - -static int -get_partition( const char *path ) -{ - while ( *path && *path != ':' ) - path++; - - if (!*path) - return -1; - path++; - - if (!strchr(path, ',')) /* check if there is a ',' */ - return -1; - - return atol(path); -} - -static char * -get_filename( const char * path , char **dirname) -{ - static char buf[1024]; - char *filename; - - while ( *path && *path != ':' ) - path++; - - if (!*path) { - *dirname = NULL; - return NULL; - } - path++; - - while ( *path && isdigit(*path) ) - path++; - - if (*path == ',') - path++; - - strncpy(buf, path, sizeof(buf)); - buf[sizeof(buf) - 1] = 0; - - filename = strrchr(buf, '\\'); - if (filename) { - *dirname = buf; - (*filename++) = 0; - } else { - *dirname = NULL; - filename = buf; - } - - return filename; -} - - -static void -encode_bootpath( const char *spec, const char *args ) -{ - char path[1024]; - phandle_t chosen_ph = find_dev("/chosen"); - char *filename, *directory; - int partition; - - if (spec) - return; - - filename = get_filename(spec, &directory); - partition = get_partition(spec); - if (partition == -1) - snprintf(path, sizeof(path), "%s:,%s\\%s", get_device(spec), - directory, filename); - else - snprintf(path, sizeof(path), "%s:%d,%s\\%s", get_device(spec), - partition, directory, filename); - - ELF_DPRINTF("bootpath %s bootargs %s\n", path, args); - set_property( chosen_ph, "bootpath", path, strlen(path)+1 ); - if (args) - set_property( chosen_ph, "bootargs", args, strlen(args)+1 ); -} - -#define OLDWORLD_BOOTCODE_BASEADDR (0x3f4000) - -static void -oldworld_boot( void ) -{ - int fd; - int len, total; - const char *path = "hd:,%BOOT"; - char *bootcode; - - if ((fd = open_io(path)) == -1) { - ELF_DPRINTF("Can't open %s\n", path); - return; - } - - - total = 0; - bootcode = (char*)OLDWORLD_BOOTCODE_BASEADDR; - while(1) { - if (seek_io(fd, total) == -1) - break; - len = read_io(fd, bootcode, 512); - bootcode += len; - total += len; - } - - close_io( fd ); - - if (total == 0) { - ELF_DPRINTF("Can't read %s\n", path); - return; - } - - encode_bootpath(path, "Linux"); - - if( ofmem_claim( OLDWORLD_BOOTCODE_BASEADDR, total, 0 ) == -1 ) - fatal_error("Claim failed!\n"); - - call_elf(0, 0, OLDWORLD_BOOTCODE_BASEADDR); - - return; -} - static void check_preloaded_kernel(void) { unsigned long kernel_image, kernel_size; @@ -213,9 +78,5 @@ check_preloaded_kernel(); } - if (boot_device == 'c') { - oldworld_boot(); - } - update_nvram(); } diff -Nru openbios-ppc-1.0+svn1060/arch/ppc/qemu/ofmem.c openbios-ppc-1.1/arch/ppc/qemu/ofmem.c --- openbios-ppc-1.0+svn1060/arch/ppc/qemu/ofmem.c 2012-06-09 12:05:49.000000000 +0000 +++ openbios-ppc-1.1/arch/ppc/qemu/ofmem.c 2013-05-06 19:09:54.000000000 +0000 @@ -311,10 +311,32 @@ return phys; } +/* Converts a global variable (from .data or .bss) into a pointer that + can be accessed from real mode */ +static void * +global_ptr_real(void *p) +{ + return (void*)((uintptr_t)p - OF_CODE_START + get_rom_base()); +} + +/* Return the next slot to evict, in the range of [0..7] */ +static int +next_evicted_slot(void) +{ + static int next_grab_slot; + int *next_grab_slot_va; + int r; + + next_grab_slot_va = global_ptr_real(&next_grab_slot); + r = *next_grab_slot_va; + *next_grab_slot_va = (r + 1) % 8; + + return r; +} + static void hash_page_64(unsigned long ea, phys_addr_t phys, ucell mode) { - static int next_grab_slot = 0; uint64_t vsid_mask, page_mask, pgidx, hash; uint64_t htab_mask, mask, avpn; unsigned long pgaddr; @@ -349,10 +371,8 @@ found = 1; /* out of slots, just evict one */ - if (!found) { - i = next_grab_slot + 1; - next_grab_slot = (next_grab_slot + 1) % 8; - } + if (!found) + i = next_evicted_slot() + 1; i--; { mPTE_64_t p = { @@ -381,7 +401,6 @@ hash_page_32(unsigned long ea, phys_addr_t phys, ucell mode) { #ifndef __powerpc64__ - static int next_grab_slot = 0; unsigned long *upte, cmp, hash1; int i, vsid, found; mPTE_t *pp; @@ -407,10 +426,8 @@ found = 1; /* out of slots, just evict one */ - if (!found) { - i = next_grab_slot + 1; - next_grab_slot = (next_grab_slot + 1) % 8; - } + if (!found) + i = next_evicted_slot() + 1; i--; upte[i * 2] = cmp; upte[i * 2 + 1] = (phys & ~0xfff) | mode; @@ -532,11 +549,22 @@ { ofmem_t *ofmem = ofmem_arch_get_private(); - ofmem_claim_phys(0, get_ram_bottom(), 0); - ofmem_claim_virt(0, get_ram_bottom(), 0); - ofmem_map(0, 0, get_ram_bottom(), 0); - - ofmem_claim_phys(get_ram_top(), ofmem->ramsize - get_ram_top(), 0); - ofmem_claim_virt(get_ram_top(), ofmem->ramsize - get_ram_top(), 0); - ofmem_map(get_ram_top(), get_ram_top(), ofmem->ramsize - get_ram_top(), 0); + /* Map the memory (don't map page 0 to allow catching of NULL dereferences) */ + ofmem_claim_phys(PAGE_SIZE, get_ram_bottom() - PAGE_SIZE, 0); + ofmem_claim_virt(PAGE_SIZE, get_ram_bottom() - PAGE_SIZE, 0); + ofmem_map(PAGE_SIZE, PAGE_SIZE, get_ram_bottom() - PAGE_SIZE, 0); + + /* Mark the first page as non-free */ + ofmem_claim_phys(0, PAGE_SIZE, 0); + ofmem_claim_virt(0, PAGE_SIZE, 0); + + /* Map everything at the top of physical RAM 1:1, minus the OpenBIOS ROM in RAM copy */ + ofmem_claim_phys(get_ram_top(), get_hash_base() + HASH_SIZE - get_ram_top(), 0); + ofmem_claim_virt(get_ram_top(), get_hash_base() + HASH_SIZE - get_ram_top(), 0); + ofmem_map(get_ram_top(), get_ram_top(), get_hash_base() + HASH_SIZE - get_ram_top(), 0); + + /* Map the OpenBIOS ROM in RAM copy */ + ofmem_claim_phys(ofmem->ramsize - OF_CODE_SIZE, OF_CODE_SIZE, 0); + ofmem_claim_virt(OF_CODE_START, OF_CODE_SIZE, 0); + ofmem_map(ofmem->ramsize - OF_CODE_SIZE, OF_CODE_START, OF_CODE_SIZE, 0); } diff -Nru openbios-ppc-1.0+svn1060/arch/ppc/qemu/qemu.fs openbios-ppc-1.1/arch/ppc/qemu/qemu.fs --- openbios-ppc-1.0+svn1060/arch/ppc/qemu/qemu.fs 2010-07-31 04:23:45.000000000 +0000 +++ openbios-ppc-1.1/arch/ppc/qemu/qemu.fs 2013-05-06 19:09:54.000000000 +0000 @@ -46,6 +46,39 @@ then ; +variable keyboard-phandle 0 keyboard-phandle ! + +: (find-keyboard-device) ( phandle -- ) + recursive + keyboard-phandle @ 0= if \ Return first match + >dn.child @ + begin ?dup while + dup dup " device_type" rot get-package-property 0= if + drop dup cstrlen + " keyboard" strcmp 0= if + dup to keyboard-phandle + then + then + (find-keyboard-device) + >dn.peer @ + repeat + else + drop + then +; + +\ create the keyboard devalias +:noname + device-tree @ (find-keyboard-device) + keyboard-phandle @ if + active-package + " /aliases" find-device + keyboard-phandle @ get-package-path + encode-string " keyboard" property + active-package! + then +; SYSTEM-initializer + \ ------------------------------------------------------------------------- \ pre-booting \ ------------------------------------------------------------------------- diff -Nru openbios-ppc-1.0+svn1060/arch/ppc/qemu/start.S openbios-ppc-1.1/arch/ppc/qemu/start.S --- openbios-ppc-1.0+svn1060/arch/ppc/qemu/start.S 2012-06-09 12:05:49.000000000 +0000 +++ openbios-ppc-1.1/arch/ppc/qemu/start.S 2013-05-06 19:09:54.000000000 +0000 @@ -295,8 +295,15 @@ exception_return: EXCEPTION_EPILOGUE -_GLOBAL(__divide_error): trap_error: + lis r1, 0x8000 /* r1=0x80000000 */ + add. r1,r1,r1 /* r1=r1+r1 (high 32bit !0) */ + beq 1f + + mfmsr r1 /* unset MSR_SF */ + clrldi r1,r1,1 + mtmsrd r1 +1: mflr r3 LOAD_REG_FUNC(r4, unexpected_excep) mtctr r4 diff -Nru openbios-ppc-1.0+svn1060/arch/sparc32/entry.S openbios-ppc-1.1/arch/sparc32/entry.S --- openbios-ppc-1.0+svn1060/arch/sparc32/entry.S 2012-06-09 12:05:49.000000000 +0000 +++ openbios-ppc-1.1/arch/sparc32/entry.S 2013-05-06 19:09:54.000000000 +0000 @@ -452,6 +452,7 @@ wr %g3, PSR_ET, %psr WRITE_PAUSE + set 0, %fp call __switch_context_nosave nop diff -Nru openbios-ppc-1.0+svn1060/arch/sparc32/init.fs openbios-ppc-1.1/arch/sparc32/init.fs --- openbios-ppc-1.0+svn1060/arch/sparc32/init.fs 2009-03-08 13:07:58.000000000 +0000 +++ openbios-ppc-1.1/arch/sparc32/init.fs 2013-05-06 19:09:54.000000000 +0000 @@ -32,7 +32,7 @@ \ preopen device nodes (and store the ihandles under /chosen) :noname " memory" " /memory" preopen - " mmu" " /cpus/@0" preopen + " mmu" " /virtual-memory" preopen ; SYSTEM-initializer device-end diff -Nru openbios-ppc-1.0+svn1060/arch/sparc32/lib.c openbios-ppc-1.1/arch/sparc32/lib.c --- openbios-ppc-1.0+svn1060/arch/sparc32/lib.c 2012-06-09 12:05:49.000000000 +0000 +++ openbios-ppc-1.1/arch/sparc32/lib.c 2013-05-06 19:09:54.000000000 +0000 @@ -269,6 +269,8 @@ phys_addr_t phys; ucell virt; + DPRINTF("obp_memalloc: virta 0x%x, sz %d, align %d\n", (unsigned int)va, size, align); + /* Claim physical memory */ phys = ofmem_claim_phys(-1, size, align); @@ -283,26 +285,14 @@ char *obp_dumb_memalloc(char *va, unsigned int size) { - unsigned long align; - int i; + unsigned long align = size; + + DPRINTF("obp_dumb_memalloc: virta 0x%x, sz %d\n", (unsigned int)va, size); + + /* Solaris seems to assume that the returned value is physically aligned to size. + e.g. it is used for setting up page tables. Fortunately this is now handled by + ofmem_claim_phys() above. */ - /* Solaris seems to assume that the returned value is physically aligned to size. For - example, not having this here causes the Solaris 8 kernel to fault because the - IOMMU page table base address is calculated incorrectly. */ - - /* Enforce a minimum alignment of CONFIG_OFMEM_MALLOC_ALIGN, and choose an alignment - which is the next power of 2 higher than the specified size */ - align = size; - if (align <= CONFIG_OFMEM_MALLOC_ALIGN) { - align = CONFIG_OFMEM_MALLOC_ALIGN; - } else { - align--; - for (i = 1; i < sizeof(unsigned long) * 8; i<<=1) { - align |= align >> i; - } - align++; - } - return obp_memalloc(va, size, align); } @@ -401,9 +391,11 @@ size = (unsigned long)&_end - (unsigned long)&_start; pa = va2pa(va); ofmem_arch_map_pages(pa, va, size, ofmem_arch_default_translation_mode(pa)); + ofmem_map_page_range(pa, va, size, ofmem_arch_default_translation_mode(pa)); - // 1:1 mapping for RAM - ofmem_arch_map_pages(0, 0, LOWMEMSZ, ofmem_arch_default_translation_mode(0)); + // 1:1 mapping for RAM (don't map page 0 to allow catching of NULL dereferences) + ofmem_arch_map_pages(PAGE_SIZE, PAGE_SIZE, LOWMEMSZ - PAGE_SIZE, ofmem_arch_default_translation_mode(0)); + ofmem_map_page_range(PAGE_SIZE, PAGE_SIZE, LOWMEMSZ - PAGE_SIZE, ofmem_arch_default_translation_mode(0)); /* * Flush cache diff -Nru openbios-ppc-1.0+svn1060/arch/sparc32/ofmem_sparc32.c openbios-ppc-1.1/arch/sparc32/ofmem_sparc32.c --- openbios-ppc-1.0+svn1060/arch/sparc32/ofmem_sparc32.c 2012-06-09 12:05:49.000000000 +0000 +++ openbios-ppc-1.1/arch/sparc32/ofmem_sparc32.c 2013-05-06 19:09:54.000000000 +0000 @@ -61,7 +61,7 @@ ucell ofmem_arch_get_virt_top(void) { - return (ucell)TOP_OF_RAM; + return (ucell)OFMEM_VIRT_TOP; } phys_addr_t ofmem_arch_get_phys_top(void) @@ -238,6 +238,9 @@ memset(&s_ofmem_data, 0, sizeof(s_ofmem_data)); s_ofmem_data.ofmem.ramsize = qemu_mem_size; + /* Mark the first page as non-free */ + ofmem_claim_virt(0, PAGE_SIZE, 0); + /* Claim reserved physical addresses at top of RAM */ ofmem_claim_phys(ofmem_arch_get_phys_top(), s_ofmem_data.ofmem.ramsize - ofmem_arch_get_phys_top(), 0); diff -Nru openbios-ppc-1.0+svn1060/arch/sparc32/openbios.c openbios-ppc-1.1/arch/sparc32/openbios.c --- openbios-ppc-1.0+svn1060/arch/sparc32/openbios.c 2012-06-09 12:05:49.000000000 +0000 +++ openbios-ppc-1.1/arch/sparc32/openbios.c 2013-05-06 19:09:54.000000000 +0000 @@ -25,9 +25,9 @@ #include "packages/video.h" #define NO_QEMU_PROTOS #include "arch/common/fw_cfg.h" -#include "libopenbios/ofmem.h" +#include "arch/sparc32/ofmem_sparc32.h" -#define MEMORY_SIZE (512*1024) /* 512K ram for hosted system */ +#define MEMORY_SIZE (128*1024) /* 128K ram for hosted system */ #define UUID_FMT "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x" #define FW_CFG_SUN4M_DEPTH (FW_CFG_ARCH_LOCAL + 0x00) @@ -244,9 +244,9 @@ .iu_version = 0x04 << 24, /* Impl 0, ver 4 */ .name = "FMI,MB86904", .psr_impl = 0, - .psr_vers = 5, + .psr_vers = 4, .impl = 0, - .vers = 5, + .vers = 4, .dcache_line_size = 0x10, .dcache_lines = 0x200, .dcache_assoc = 1, @@ -813,7 +813,7 @@ if (!phys) printk("panic: not enough physical memory on host system.\n"); - virt = ofmem_claim_virt(-1, MEMORY_SIZE, PAGE_SIZE); + virt = ofmem_claim_virt(OF_CODE_START - MEMORY_SIZE, MEMORY_SIZE, 0); if (!virt) printk("panic: not enough virtual memory on host system.\n"); @@ -832,8 +832,7 @@ static void arch_init( void ) { - static char cmdline[128]; - int size = 0; + char *cmdline; const char *kernel_cmdline; uint32_t temp; uint16_t machine_id; @@ -894,11 +893,11 @@ kernel_cmdline = (const char *) fw_cfg_read_i32(FW_CFG_KERNEL_CMDLINE); if (kernel_cmdline) { - size = strlen(kernel_cmdline); - memcpy(cmdline, kernel_cmdline, size); + cmdline = strdup(kernel_cmdline); obp_arg.argv[1] = cmdline; - } - cmdline[size] = '\0'; + } else { + cmdline = strdup(""); + } qemu_cmdline = (uint32_t)cmdline; /* Setup nvram variables */ diff -Nru openbios-ppc-1.0+svn1060/arch/sparc32/wuf.S openbios-ppc-1.1/arch/sparc32/wuf.S --- openbios-ppc-1.0+svn1060/arch/sparc32/wuf.S 2009-03-08 13:07:58.000000000 +0000 +++ openbios-ppc-1.1/arch/sparc32/wuf.S 2013-05-06 19:09:54.000000000 +0000 @@ -131,6 +131,7 @@ /* LOCATION: Window 'O' */ restore %g0, %g0, %g0 + WRITE_PAUSE /* LOCATION: Window 'W' */ diff -Nru openbios-ppc-1.0+svn1060/arch/sparc64/openbios.c openbios-ppc-1.1/arch/sparc64/openbios.c --- openbios-ppc-1.0+svn1060/arch/sparc64/openbios.c 2012-06-09 12:05:49.000000000 +0000 +++ openbios-ppc-1.1/arch/sparc64/openbios.c 2013-05-06 19:09:54.000000000 +0000 @@ -42,9 +42,6 @@ #define NVRAM_OB_START (0) #define NVRAM_OB_SIZE ((0x1fd0 - NVRAM_OB_START) & ~15) -#define OBIO_CMDLINE_MAX 256 -static char obio_cmdline[OBIO_CMDLINE_MAX]; - static uint8_t idprom[NVRAM_IDPROM_SIZE]; struct hwdef { @@ -370,6 +367,7 @@ void arch_nvram_get(char *data) { + char *obio_cmdline; uint32_t size = 0; const struct cpudef *cpu; char buf[256]; @@ -401,12 +399,13 @@ kernel_image = fw_cfg_read_i64(FW_CFG_KERNEL_ADDR); size = fw_cfg_read_i32(FW_CFG_CMDLINE_SIZE); - if (size > OBIO_CMDLINE_MAX - 1) - size = OBIO_CMDLINE_MAX - 1; if (size) { + obio_cmdline = (char *)malloc(size + 1); fw_cfg_read(FW_CFG_CMDLINE_DATA, obio_cmdline, size); + obio_cmdline[size] = '\0'; + } else { + obio_cmdline = strdup(""); } - obio_cmdline[size] = '\0'; qemu_cmdline = (uint64_t)obio_cmdline; cmdline_size = size; boot_device = fw_cfg_read_i16(FW_CFG_BOOT_DEVICE); @@ -548,6 +547,9 @@ void udelay(unsigned int usecs) { + volatile int i; + + for (i = 0; i < usecs * 100; i++); } static void init_memory(void) diff -Nru openbios-ppc-1.0+svn1060/config/examples/ppc_config.xml openbios-ppc-1.1/config/examples/ppc_config.xml --- openbios-ppc-1.0+svn1060/config/examples/ppc_config.xml 2011-01-06 16:11:49.000000000 +0000 +++ openbios-ppc-1.1/config/examples/ppc_config.xml 2013-05-06 19:09:54.000000000 +0000 @@ -26,6 +26,7 @@