From db8e7fe92a95756e61e03ae9d43fa54bfe9be143 Mon Sep 17 00:00:00 2001 From: Blue Swirl Date: Wed, 10 May 2006 23:00:34 +0000 Subject: [PATCH] merge more sparc32 code from: Blue Swirl git-svn-id: svn://coreboot.org/openbios/openbios-devel@16 f158a5a8-5612-0410-a976-696ce0be7e32 --- arch/sparc32/build.xml | 1 + arch/sparc32/elfload.c | 15 + arch/sparc32/openbios.c | 6 +- arch/sparc32/openprom.h | 257 +++++++++++++ arch/sparc32/romvec.c | 440 +++++++++++++++++++++++ arch/sparc32/tree.fs | 23 +- config/examples/cross-sparc32_config.xml | 7 +- config/examples/sparc32_config.xml | 6 +- drivers/esp.c | 6 +- drivers/iommu.c | 23 +- drivers/sbus.c | 2 +- include/openbios/bindings.h | 8 +- include/sparc32/io.h | 3 +- libc/misc.c | 2 +- modules/bindings.c | 12 +- modules/sun-parts.c | 15 +- 16 files changed, 782 insertions(+), 44 deletions(-) create mode 100644 arch/sparc32/openprom.h create mode 100644 arch/sparc32/romvec.c diff --git a/arch/sparc32/build.xml b/arch/sparc32/build.xml index 1107db3..74820ff 100644 --- a/arch/sparc32/build.xml +++ b/arch/sparc32/build.xml @@ -20,6 +20,7 @@ + diff --git a/arch/sparc32/elfload.c b/arch/sparc32/elfload.c index 9d0ed8a..ca6bce5 100644 --- a/arch/sparc32/elfload.c +++ b/arch/sparc32/elfload.c @@ -369,7 +369,22 @@ int elf_load(struct sys_info *info, const char *filename, const char *cmdline) debug("entry point is %#x\n", addr_fixup(ehdr.e_entry)); printf("Jumping to entry point...\n"); + +#if 1 + { + extern unsigned int qemu_mem_size; + void *init_openprom(unsigned long memsize, const char *cmdline, char boot_device); + + int (*entry)(const void *romvec, int p2, int p3, int p4, int p5); + const void *romvec; + + romvec = init_openprom(qemu_mem_size, NULL, 'c'); + entry = (void *) addr_fixup(ehdr.e_entry); + image_retval = entry(romvec, 0, 0, 0, 0); + } +#else image_retval = start_elf(addr_fixup(ehdr.e_entry), virt_to_phys(boot_notes)); +#endif // console_init(); FIXME printf("Image returned with return value %#x\n", image_retval); diff --git a/arch/sparc32/openbios.c b/arch/sparc32/openbios.c index baf5963..c1b4e47 100644 --- a/arch/sparc32/openbios.c +++ b/arch/sparc32/openbios.c @@ -23,6 +23,8 @@ static char intdict[256 * 1024]; static void init_memory(void) { + extern char _heap, _eheap; + /* push start and end of available memory to the stack * so that the forth word QUIT can initialize memory * management. For now we use hardcoded memory between @@ -30,8 +32,8 @@ static void init_memory(void) * than that we have serious bloat. */ - PUSH(0x10000); - PUSH(0x9FFFF); + PUSH((unsigned int)&_heap); + PUSH((unsigned int)&_eheap); } void exception(cell no) diff --git a/arch/sparc32/openprom.h b/arch/sparc32/openprom.h new file mode 100644 index 0000000..dec80d5 --- /dev/null +++ b/arch/sparc32/openprom.h @@ -0,0 +1,257 @@ +#ifndef __SPARC_OPENPROM_H +#define __SPARC_OPENPROM_H + +/* openprom.h: Prom structures and defines for access to the OPENBOOT + * prom routines and data areas. + * + * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) + */ + +// #include + +/* Empirical constants... */ +#define LINUX_OPPROM_MAGIC 0x10010407 + +#ifndef __ASSEMBLY__ +/* V0 prom device operations. */ +struct linux_dev_v0_funcs { + int (*v0_devopen)(char *device_str); + int (*v0_devclose)(int dev_desc); + int (*v0_rdblkdev)(int dev_desc, int num_blks, int blk_st, char *buf); + int (*v0_wrblkdev)(int dev_desc, int num_blks, int blk_st, char *buf); + int (*v0_wrnetdev)(int dev_desc, int num_bytes, char *buf); + int (*v0_rdnetdev)(int dev_desc, int num_bytes, char *buf); + int (*v0_rdchardev)(int dev_desc, int num_bytes, int dummy, char *buf); + int (*v0_wrchardev)(int dev_desc, int num_bytes, int dummy, char *buf); + int (*v0_seekdev)(int dev_desc, long logical_offst, int from); +}; + +/* V2 and later prom device operations. */ +struct linux_dev_v2_funcs { + int (*v2_inst2pkg)(int d); /* Convert ihandle to phandle */ + char * (*v2_dumb_mem_alloc)(char *va, unsigned sz); + void (*v2_dumb_mem_free)(char *va, unsigned sz); + + /* To map devices into virtual I/O space. */ + char * (*v2_dumb_mmap)(char *virta, int which_io, unsigned paddr, unsigned sz); + void (*v2_dumb_munmap)(char *virta, unsigned size); + + int (*v2_dev_open)(char *devpath); + void (*v2_dev_close)(int d); + int (*v2_dev_read)(int d, char *buf, int nbytes); + int (*v2_dev_write)(int d, char *buf, int nbytes); + int (*v2_dev_seek)(int d, int hi, int lo); + + /* Never issued (multistage load support) */ + void (*v2_wheee2)(void); + void (*v2_wheee3)(void); +}; + +struct linux_mlist_v0 { + struct linux_mlist_v0 *theres_more; + char *start_adr; + unsigned num_bytes; +}; + +struct linux_mem_v0 { + struct linux_mlist_v0 * const *v0_totphys; + struct linux_mlist_v0 * const *v0_prommap; + struct linux_mlist_v0 * const *v0_available; /* What we can use */ +}; + +/* Arguments sent to the kernel from the boot prompt. */ +struct linux_arguments_v0 { + const char *argv[8]; + char args[100]; + char boot_dev[2]; + int boot_dev_ctrl; + int boot_dev_unit; + int dev_partition; + const char *kernel_file_name; + void *aieee1; /* XXX */ +}; + +/* V2 and up boot things. */ +struct linux_bootargs_v2 { + const char **bootpath; + const char **bootargs; + const int *fd_stdin; + const int *fd_stdout; +}; + +/* The top level PROM vector. */ +struct linux_romvec { + /* Version numbers. */ + unsigned int pv_magic_cookie; + unsigned int pv_romvers; + unsigned int pv_plugin_revision; + unsigned int pv_printrev; + + /* Version 0 memory descriptors. */ + struct linux_mem_v0 pv_v0mem; + + /* Node operations. */ + const struct linux_nodeops *pv_nodeops; + + char **pv_bootstr; + struct linux_dev_v0_funcs pv_v0devops; + + const char *pv_stdin; + const char *pv_stdout; +#define PROMDEV_KBD 0 /* input from keyboard */ +#define PROMDEV_SCREEN 0 /* output to screen */ +#define PROMDEV_TTYA 1 /* in/out to ttya */ +#define PROMDEV_TTYB 2 /* in/out to ttyb */ + + /* Blocking getchar/putchar. NOT REENTRANT! (grr) */ + int (*pv_getchar)(void); + void (*pv_putchar)(int ch); + + /* Non-blocking variants. */ + int (*pv_nbgetchar)(void); + int (*pv_nbputchar)(int ch); + + void (*pv_putstr)(char *str, int len); + + /* Miscellany. */ + void (*pv_reboot)(char *bootstr); + void (*pv_printf)(__const__ char *fmt, ...); + void (*pv_abort)(void); + __volatile__ int *pv_ticks; + void (*pv_halt)(void); + void (**pv_synchook)(void); + + /* Evaluate a forth string, not different proto for V0 and V2->up. */ + union { + void (*v0_eval)(int len, char *str); + void (*v2_eval)(char *str); + } pv_fortheval; + + const struct linux_arguments_v0 * const *pv_v0bootargs; + + /* Get ether address. */ + unsigned int (*pv_enaddr)(int d, char *enaddr); + + struct linux_bootargs_v2 pv_v2bootargs; + struct linux_dev_v2_funcs pv_v2devops; + + int filler[15]; + + /* This one is sun4c/sun4 only. */ + void (*pv_setctxt)(int ctxt, char *va, int pmeg); + + /* Prom version 3 Multiprocessor routines. This stuff is crazy. + * No joke. Calling these when there is only one cpu probably + * crashes the machine, have to test this. :-) + */ + + /* v3_cpustart() will start the cpu 'whichcpu' in mmu-context + * 'thiscontext' executing at address 'prog_counter' + */ + int (*v3_cpustart)(unsigned int whichcpu, int ctxtbl_ptr, + int thiscontext, char *prog_counter); + + /* v3_cpustop() will cause cpu 'whichcpu' to stop executing + * until a resume cpu call is made. + */ + int (*v3_cpustop)(unsigned int whichcpu); + + /* v3_cpuidle() will idle cpu 'whichcpu' until a stop or + * resume cpu call is made. + */ + int (*v3_cpuidle)(unsigned int whichcpu); + + /* v3_cpuresume() will resume processor 'whichcpu' executing + * starting with whatever 'pc' and 'npc' were left at the + * last 'idle' or 'stop' call. + */ + int (*v3_cpuresume)(unsigned int whichcpu); +}; + +/* Routines for traversing the prom device tree. */ +struct linux_nodeops { + int (*no_nextnode)(int node); + int (*no_child)(int node); + int (*no_proplen)(int node, char *name); + int (*no_getprop)(int node, char *name, char *val); + int (*no_setprop)(int node, char *name, char *val, int len); + const char * (*no_nextprop)(int node, char *name); +}; + +/* More fun PROM structures for device probing. */ +#define PROMREG_MAX 16 +#define PROMVADDR_MAX 16 +#define PROMINTR_MAX 15 + +struct linux_prom_registers { + unsigned int which_io; /* is this in OBIO space? */ + unsigned int phys_addr; /* The physical address of this register */ + unsigned int reg_size; /* How many bytes does this register take up? */ +}; + +struct linux_prom_irqs { + int pri; /* IRQ priority */ + int vector; /* This is foobar, what does it do? */ +}; + +/* Element of the "ranges" vector */ +struct linux_prom_ranges { + unsigned int ot_child_space; + unsigned int ot_child_base; /* Bus feels this */ + unsigned int ot_parent_space; + unsigned int ot_parent_base; /* CPU looks from here */ + unsigned int or_size; +}; + +/* Ranges and reg properties are a bit different for PCI. */ +struct linux_prom_pci_registers { + /* + * We don't know what information this field contain. + * We guess, PCI device function is in bits 15:8 + * So, ... + */ + unsigned int which_io; /* Let it be which_io */ + + unsigned int phys_hi; + unsigned int phys_lo; + + unsigned int size_hi; + unsigned int size_lo; +}; + +struct linux_prom_pci_ranges { + unsigned int child_phys_hi; /* Only certain bits are encoded here. */ + unsigned int child_phys_mid; + unsigned int child_phys_lo; + + unsigned int parent_phys_hi; + unsigned int parent_phys_lo; + + unsigned int size_hi; + unsigned int size_lo; +}; + +struct linux_prom_pci_assigned_addresses { + unsigned int which_io; + + unsigned int phys_hi; + unsigned int phys_lo; + + unsigned int size_hi; + unsigned int size_lo; +}; + +struct linux_prom_ebus_ranges { + unsigned int child_phys_hi; + unsigned int child_phys_lo; + + unsigned int parent_phys_hi; + unsigned int parent_phys_mid; + unsigned int parent_phys_lo; + + unsigned int size; +}; + +#endif /* !(__ASSEMBLY__) */ + +#endif /* !(__SPARC_OPENPROM_H) */ diff --git a/arch/sparc32/romvec.c b/arch/sparc32/romvec.c new file mode 100644 index 0000000..ef6ba17 --- /dev/null +++ b/arch/sparc32/romvec.c @@ -0,0 +1,440 @@ +/* + * PROM interface support + * Copyright 1996 The Australian National University. + * Copyright 1996 Fujitsu Laboratories Limited + * Copyright 1999 Pete A. Zaitcev + * This software may be distributed under the terms of the Gnu + * Public License version 2 or later + */ + +#include "openprom.h" +#include "stdint.h" +#include "asm/io.h" +#include "asm/types.h" +#include "libc/vsprintf.h" +#include "openbios/config.h" +#include "openbios/bindings.h" +#include "openbios/kernel.h" +#include "openbios/sysinclude.h" + +//#define DEBUG_OBP + +#ifdef DEBUG_OBP +#define DPRINTF(fmt, args...) \ + do { printk(fmt , ##args); } while (0) +#else +#define DPRINTF(fmt, args...) +#endif + +#define PAGE_SIZE 4096 + +static struct linux_mlist_v0 totphys[1]; +static struct linux_mlist_v0 totmap[1]; +static struct linux_mlist_v0 totavail[1]; + +static struct linux_mlist_v0 *ptphys; +static struct linux_mlist_v0 *ptmap; +static struct linux_mlist_v0 *ptavail; +static char obp_stdin, obp_stdout; +static int obp_fd_stdin, obp_fd_stdout; + +static int obp_nextnode(int node); +static int obp_child(int node); +static int obp_proplen(int node, char *name); +static int obp_getprop(int node, char *name, char *val); +static int obp_setprop(int node, char *name, char *val, int len); +static const char *obp_nextprop(int node, char *name); + +static const struct linux_nodeops nodeops0 = { + obp_nextnode, /* int (*no_nextnode)(int node); */ + obp_child, /* int (*no_child)(int node); */ + obp_proplen, /* int (*no_proplen)(int node, char *name); */ + obp_getprop, /* int (*no_getprop)(int node,char *name,char *val); */ + obp_setprop, /* int (*no_setprop)(int node, char *name, + char *val, int len); */ + obp_nextprop /* char * (*no_nextprop)(int node, char *name); */ +}; + +static struct linux_arguments_v0 obp_arg; +static const struct linux_arguments_v0 * const obp_argp = &obp_arg; + +static void (*synch_hook)(void); + +static struct linux_romvec romvec0; +static int prop_mem_reg[3]; +static int prop_mem_avail[3]; +static int prop_vmem_avail[6]; + +static void doublewalk(unsigned ptab1, unsigned va) +{ +} + +static int obp_nextnode(int node) +{ + int peer; + + PUSH(node); + fword("peer"); + peer = POP(); + DPRINTF("obp_nextnode(%x) = %x\n", node, peer); + + return peer; +} + +static int obp_child(int node) +{ + int child; + + PUSH(node); + fword("child"); + child = POP(); + DPRINTF("obp_child(%x) = %x\n", node, child); + + return child; +} + +static int obp_proplen(int node, char *name) +{ + int notfound; + + push_str(name); + PUSH(node); + fword("get-package-property"); + notfound = POP(); + + if (notfound) { + DPRINTF("obp_proplen(%x, %s) (not found)\n", node, name); + (void) POP(); + (void) POP(); + + return -1; + } else { + int len; + + len = POP(); + (void) POP(); + DPRINTF("obp_proplen(%x, %s) = %d\n", node, name, len); + + return len; + } +} + +static int obp_getprop(int node, char *name, char *value) +{ + int notfound; + + if (!name) { + // NULL name means get first property + name = "NULL"; + push_str(""); + PUSH(node); + fword("next-property"); + notfound = POP(); + notfound = !notfound; // Different return value + } else { + push_str(name); + PUSH(node); + fword("get-package-property"); + notfound = POP(); + } + if (notfound) { + DPRINTF("obp_getprop(%x, %s) (not found)\n", node, name); + (void) POP(); + (void) POP(); + + return -1; + } else { + int len; + char *str; + + len = POP(); + str = (char *) POP(); + memcpy(value, str, len); + + DPRINTF("obp_getprop(%x, %s) = %s\n", node, name, str); + + return len; + } +} + +static int obp_setprop(__attribute__((unused)) int node, + __attribute__((unused)) char *name, + __attribute__((unused)) char *value, + __attribute__((unused)) int len) +{ + DPRINTF("obp_setprop(%x, %s) = %s (%d)\n", node, name, value, len); + + return -1; +} + +static const char *obp_nextprop(int node, char *name) +{ + if (!name || *name == '\0') { + // NULL name means get first property + DPRINTF("obp_nextprop(%x, NULL)\n", node); + return 0; + } + DPRINTF("obp_nextprop(%x, %s)\n", node, name); + + return 0; +} + +static int obp_nbgetchar(void) +{ + return 0; +} + +static int obp_nbputchar(int ch) +{ + putchar(ch); + + return 0; +} + +static void obp_reboot(char *str) +{ + printk("rebooting (%s)\n", str); + outb(0x71f00000, 1); + for (;;) {} +} + +static void obp_abort() +{ + printk("abort, power off\n"); + outb(0x71910000, 1); + for (;;) {} +} + +static void obp_halt() +{ + printk("halt, power off\n"); + outb(0x71910000, 1); + for (;;) {} +} + +static int obp_devopen(char *str) +{ + DPRINTF("obp_devopen(%s)\n", str); + + return 0; +} + +static int obp_devclose(__attribute__((unused)) int dev_desc) +{ + DPRINTF("obp_devclose %x\n", dev_desc); + + return 0; +} + +static int obp_rdblkdev(int dev_desc, int num_blks, int offset, char *buf) +{ + DPRINTF("obp_rdblkdev: fd %x, num_blks %d, offset %d, buf 0x%x\n", dev_desc, num_blks, offset, buf); + + return 0; +} + +static char *obp_dumb_mmap(char *va, __attribute__((unused)) int which_io, + unsigned int pa, unsigned int size) +{ + unsigned int npages; + unsigned int off; + unsigned int mva; + + DPRINTF("obp_dumb_mmap: virta %x, which_io %d, paddr %x, sz %d\n", va, which_io, pa, size); + off = pa & (PAGE_SIZE-1); + npages = (off + size + (PAGE_SIZE-1)) / PAGE_SIZE; + pa &= ~(PAGE_SIZE-1); + + mva = (unsigned int) va; + while (npages-- != 0) { + map_page(mva, pa, 1); + mva += PAGE_SIZE; + pa += PAGE_SIZE; + } + + return va; +} + +static void obp_dumb_munmap(__attribute__((unused)) char *va, + __attribute__((unused)) unsigned int size) +{ + DPRINTF("obp_dumb_munmap: virta %x, sz %d\n", va, size); +} + +static int obp_devread(int dev_desc, char *buf, int nbytes) +{ + DPRINTF("obp_devread: fd %d, nbytes %d\n", dev_desc, nbytes); + + return 0; +} + +static int obp_devwrite(int dev_desc, char *buf, int nbytes) +{ + DPRINTF("obp_devwrite: fd %d, buf %s, nbytes %d\n", dev_desc, buf, nbytes); + + return nbytes; +} + +static int obp_devseek(int dev_desc, __attribute__((unused)) int hi, int lo) +{ + DPRINTF("obp_devseek: fd %d, hi %d, lo %d\n", dev_desc, hi, lo); + + return 0; +} + +static int obp_inst2pkg(int dev_desc) +{ + DPRINTF("obp_inst2pkg: fd %d\n", dev_desc); + + return 0; +} + +static int obp_cpustart(unsigned int whichcpu, int ctxtbl_ptr, + int thiscontext, char *prog_counter) +{ + //int cpu, found; + struct linux_prom_registers *smp_ctable = (void *)ctxtbl_ptr; + + DPRINTF("obp_cpustart: cpu %d, ctxptr %x, ctx %d, pc %x\n", whichcpu, + smp_ctable->phys_addr, thiscontext, prog_counter); +#if 0 + found = obp_getprop(whichcpu, "mid", (char *)&cpu); + if (found == -1) + return -1; + st_bypass(PHYS_JJ_EEPROM + 0x38, (unsigned int)prog_counter); + st_bypass(PHYS_JJ_EEPROM + 0x3C, ((unsigned int)smp_ctable->phys_addr) >> 4); + st_bypass(PHYS_JJ_EEPROM + 0x40, thiscontext); + DPRINTF("obp_cpustart: sending interrupt to CPU %d\n", cpu); + st_bypass(PHYS_JJ_INTR0 + 0x1000 * cpu + 8, 0x40000000); +#endif + + return 0; +} + +static int obp_cpustop(__attribute__((unused)) unsigned int whichcpu) +{ + DPRINTF("obp_cpustop: cpu %d\n", whichcpu); + + return 0; +} + +static int obp_cpuidle(__attribute__((unused)) unsigned int whichcpu) +{ + DPRINTF("obp_cpuidle: cpu %d\n", whichcpu); + + return 0; +} + +static int obp_cpuresume(__attribute__((unused)) unsigned int whichcpu) +{ + DPRINTF("obp_cpuresume: cpu %d\n", whichcpu); + + return 0; +} + +void * +init_openprom(unsigned long memsize, const char *cmdline, char boot_device) +{ + ptphys = totphys; + ptmap = totmap; + ptavail = totavail; + + /* + * Form memory descriptors. + */ + totphys[0].theres_more = 0; + totphys[0].start_adr = (char *) 0; + totphys[0].num_bytes = memsize; + + totavail[0].theres_more = 0; + totavail[0].start_adr = (char*) 0; + totavail[0].num_bytes = memsize; + + totmap[0].theres_more = 0; + totmap[0].start_adr = &_start; + totmap[0].num_bytes = (unsigned long) &_iomem - (unsigned long) &_start; + + prop_mem_reg[0] = 0; + prop_mem_reg[1] = 0; + prop_mem_reg[2] = memsize; + prop_mem_avail[0] = 0; + prop_mem_avail[1] = 0; + prop_mem_avail[2] = va2pa((unsigned long)&_data); + prop_vmem_avail[0] = 0; + prop_vmem_avail[1] = 0; + prop_vmem_avail[2] = (unsigned long)&_start - 1; + prop_vmem_avail[3] = 0; + prop_vmem_avail[4] = 0xffe00000; + prop_vmem_avail[5] = 0x00200000; + + // Linux wants a R/W romvec table + romvec0.pv_magic_cookie = LINUX_OPPROM_MAGIC; + romvec0.pv_romvers = 0; + romvec0.pv_plugin_revision = 77; + romvec0.pv_printrev = 0x10203; + romvec0.pv_v0mem.v0_totphys = &ptphys; + romvec0.pv_v0mem.v0_prommap = &ptmap; + romvec0.pv_v0mem.v0_available = &ptavail; + romvec0.pv_nodeops = &nodeops0; + romvec0.pv_bootstr = (void *)doublewalk; + romvec0.pv_v0devops.v0_devopen = &obp_devopen; + romvec0.pv_v0devops.v0_devclose = &obp_devclose; + romvec0.pv_v0devops.v0_rdblkdev = &obp_rdblkdev; + romvec0.pv_stdin = &obp_stdin; + romvec0.pv_stdout = &obp_stdout; + romvec0.pv_getchar = obp_nbgetchar; + romvec0.pv_putchar = (void (*)(int))obp_nbputchar; + romvec0.pv_nbgetchar = obp_nbgetchar; + romvec0.pv_nbputchar = obp_nbputchar; + romvec0.pv_reboot = obp_reboot; + romvec0.pv_printf = (void (*)(const char *fmt, ...))printk; + romvec0.pv_abort = obp_abort; + romvec0.pv_halt = obp_halt; + romvec0.pv_synchook = &synch_hook; + romvec0.pv_v0bootargs = &obp_argp; + romvec0.pv_v2devops.v2_inst2pkg = obp_inst2pkg; + romvec0.pv_v2devops.v2_dumb_mmap = obp_dumb_mmap; + romvec0.pv_v2devops.v2_dumb_munmap = obp_dumb_munmap; + romvec0.pv_v2devops.v2_dev_open = obp_devopen; + romvec0.pv_v2devops.v2_dev_close = (void (*)(int))obp_devclose; + romvec0.pv_v2devops.v2_dev_read = obp_devread; + romvec0.pv_v2devops.v2_dev_write = obp_devwrite; + romvec0.pv_v2devops.v2_dev_seek = obp_devseek; + obp_arg.boot_dev_ctrl = 0; + obp_arg.boot_dev_unit = '0'; + obp_arg.argv[0] = "sd(0,0,0):d"; + + switch(boot_device) { + default: + case 'a': + obp_arg.argv[0] = "fd()"; + obp_arg.boot_dev[0] = 'f'; + obp_arg.boot_dev[1] = 'd'; + break; + case 'd': + obp_arg.boot_dev_unit = '2'; + obp_arg.argv[0] = "sd(0,2,0):d"; + // Fall through + case 'c': + obp_arg.boot_dev[0] = 's'; + obp_arg.boot_dev[1] = 'd'; + break; + case 'n': + obp_arg.argv[0] = "le()"; + obp_arg.boot_dev[0] = 'l'; + obp_arg.boot_dev[1] = 'e'; + break; + } + obp_arg.argv[1] = cmdline; + romvec0.pv_v2bootargs.bootpath = &obp_arg.argv[0]; + romvec0.pv_v2bootargs.bootargs = &cmdline; + romvec0.pv_v2bootargs.fd_stdin = &obp_fd_stdin; + romvec0.pv_v2bootargs.fd_stdout = &obp_fd_stdout; + + romvec0.v3_cpustart = obp_cpustart; + romvec0.v3_cpustop = obp_cpustop; + romvec0.v3_cpuidle = obp_cpuidle; + romvec0.v3_cpuresume = obp_cpuresume; + + return &romvec0; +} diff --git a/arch/sparc32/tree.fs b/arch/sparc32/tree.fs index 3b9f3e2..79c587c 100644 --- a/arch/sparc32/tree.fs +++ b/arch/sparc32/tree.fs @@ -3,14 +3,29 @@ 2 encode-int " #address-cells" property 1 encode-int " #size-cells" property " SUNW,SparcStation-5" encode-string " name" property - " " encode-string " idprom" property " SparcStation" encode-string " banner-name" property " sun4m" encode-string " compatible" property + h# 01800000 encode-int 0 encode-int encode+ 0 encode-int encode+ h# 00000081 encode-int encode+ + 0 encode-int encode+ 0 encode-int encode+ 0 encode-int encode+ 0 encode-int encode+ + " idprom" property \ XXX : encode-unit encode-unit-sbus ; : decode-unit decode-unit-sbus ; new-device " memory" device-name + h# 100000 encode-int " available" property \ XXX + h# 0 encode-int h# 10000000 encode-int encode+ h# 00000300 encode-int encode+ " reg" property \ XXX + external + : open true ; + : close ; + \ claim ( phys size align -- base ) + \ release ( phys size -- ) +finish-device + +new-device + " virtual-memory" device-name + h# 100000 encode-int " available" property \ XXX + h# 0 encode-int h# 10000000 encode-int encode+ h# 00000300 encode-int encode+ " reg" property \ XXX external : open true ; : close ; @@ -33,7 +48,7 @@ new-device 1 encode-int " #size-cells" property h# 0 encode-int h# 10000000 encode-int encode+ h# 00000300 encode-int encode+ " reg" property external - : open cr ." opening iommu" cr true ; + : open ( cr ." opening iommu" cr) true ; : close ; : encode-unit encode-unit-sbus ; : decode-unit decode-unit-sbus ; @@ -53,7 +68,7 @@ new-device " ranges" property h# 0 encode-int h# 10001000 encode-int encode+ h# 00000028 encode-int encode+ " reg" property external - : open cr ." opening SBus" cr true ; + : open ( cr ." opening SBus" cr) true ; : close ; : encode-unit encode-unit-sbus ; : decode-unit decode-unit-sbus ; @@ -157,7 +172,7 @@ new-device h# 0 encode-int h# 0 encode-int encode+ h# 0 encode-int encode+ h# 71000000 encode-int encode+ h# 01000000 encode-int encode+ " ranges" property external - : open cr ." opening obio" cr true ; + : open ( cr ." opening obio" cr) true ; : close ; : encode-unit encode-unit-sbus ; : decode-unit decode-unit-sbus ; diff --git a/config/examples/cross-sparc32_config.xml b/config/examples/cross-sparc32_config.xml index 3d434ec..657ffd5 100644 --- a/config/examples/cross-sparc32_config.xml +++ b/config/examples/cross-sparc32_config.xml @@ -26,7 +26,8 @@