Author: stepan Date: 2006-05-18 23:57:08 +0200 (Thu, 18 May 2006) New Revision: 23
Added: openbios-devel/drivers/obio.c Modified: openbios-devel/arch/sparc32/openbios.c openbios-devel/arch/sparc32/romvec.c openbios-devel/arch/sparc32/tree.fs openbios-devel/config/examples/cross-sparc32_config.xml openbios-devel/config/examples/sparc32_config.xml openbios-devel/drivers/build.xml openbios-devel/drivers/esp.c openbios-devel/include/openbios/drivers.h Log: this makes linux on sparc32 boot :-)
Modified: openbios-devel/arch/sparc32/openbios.c =================================================================== --- openbios-devel/arch/sparc32/openbios.c 2006-05-17 12:30:12 UTC (rev 22) +++ openbios-devel/arch/sparc32/openbios.c 2006-05-18 21:57:08 UTC (rev 23) @@ -58,6 +58,9 @@ #ifdef CONFIG_DRIVER_ESP ob_esp_init(); #endif +#ifdef CONFIG_DRIVER_OBIO + ob_obio_init(0x71000000); +#endif device_end(); bind_func("platform-boot", boot ); }
Modified: openbios-devel/arch/sparc32/romvec.c =================================================================== --- openbios-devel/arch/sparc32/romvec.c 2006-05-17 12:30:12 UTC (rev 22) +++ openbios-devel/arch/sparc32/romvec.c 2006-05-18 21:57:08 UTC (rev 23) @@ -76,7 +76,7 @@ PUSH(node); fword("peer"); peer = POP(); - DPRINTF("obp_nextnode(%x) = %x\n", node, peer); + DPRINTF("obp_nextnode(0x%x) = 0x%x\n", node, peer);
return peer; } @@ -88,7 +88,7 @@ PUSH(node); fword("child"); child = POP(); - DPRINTF("obp_child(%x) = %x\n", node, child); + DPRINTF("obp_child(0x%x) = 0x%x\n", node, child);
return child; } @@ -103,9 +103,7 @@ notfound = POP();
if (notfound) { - DPRINTF("obp_proplen(%x, %s) (not found)\n", node, name); - (void) POP(); - (void) POP(); + DPRINTF("obp_proplen(0x%x, %s) (not found)\n", node, name);
return -1; } else { @@ -113,7 +111,7 @@
len = POP(); (void) POP(); - DPRINTF("obp_proplen(%x, %s) = %d\n", node, name, len); + DPRINTF("obp_proplen(0x%x, %s) = %d\n", node, name, len);
return len; } @@ -138,9 +136,7 @@ notfound = POP(); } if (notfound) { - DPRINTF("obp_getprop(%x, %s) (not found)\n", node, name); - (void) POP(); - (void) POP(); + DPRINTF("obp_getprop(0x%x, %s) (not found)\n", node, name);
return -1; } else { @@ -151,7 +147,7 @@ str = (char *) POP(); memcpy(value, str, len);
- DPRINTF("obp_getprop(%x, %s) = %s\n", node, name, str); + DPRINTF("obp_getprop(0x%x, %s) = %s\n", node, name, str);
return len; } @@ -162,14 +158,13 @@ __attribute__((unused)) char *value, __attribute__((unused)) int len) { - DPRINTF("obp_setprop(%x, %s) = %s (%d)\n", node, name, value, len); + DPRINTF("obp_setprop(0x%x, %s) = %s (%d)\n", node, name, value, len);
return -1; }
static const char *obp_nextprop(int node, char *name) { - char *ret; int found;
if (!name || *name == '\0') { @@ -183,11 +178,11 @@ fword("next-property"); found = POP(); if (!found) { - DPRINTF("obp_nextprop(%x, %s) (not found)\n", node, name); + DPRINTF("obp_nextprop(0x%x, %s) (not found)\n", node, name); (void) POP(); (void) POP();
- return NULL; + return ""; } else { int len; char *str; @@ -195,7 +190,7 @@ len = POP(); str = (char *) POP();
- DPRINTF("obp_nextprop(%x, %s) = %s\n", node, name, str); + DPRINTF("obp_nextprop(0x%x, %s) = %s\n", node, name, str);
return str; } @@ -271,7 +266,7 @@
ret = obp_devread(dev_desc, buf, num_blks * bs) / bs;
- DPRINTF("obp_rdblkdev(fd %x, num_blks %d, offset %d (hi %d lo %d), buf 0x%x) = %d\n", dev_desc, num_blks, offset, hi, lo, (int)buf, ret); + DPRINTF("obp_rdblkdev(fd 0x%x, num_blks %d, offset %d (hi %d lo %d), buf 0x%x) = %d\n", dev_desc, num_blks, offset, hi, lo, (int)buf, ret);
return ret; } @@ -283,7 +278,7 @@ 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); + DPRINTF("obp_dumb_mmap: virta 0x%x, which_io %d, paddr 0x%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); @@ -301,7 +296,7 @@ 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); + DPRINTF("obp_dumb_munmap: virta 0x%x, sz %d\n", va, size); }
static int obp_devread(int dev_desc, char *buf, int nbytes) @@ -371,7 +366,7 @@ //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, + DPRINTF("obp_cpustart: cpu %d, ctxptr 0x%x, ctx %d, pc 0x%x\n", whichcpu, smp_ctable->phys_addr, thiscontext, prog_counter); #if 0 found = obp_getprop(whichcpu, "mid", (char *)&cpu); @@ -435,7 +430,7 @@ prop_mem_reg[2] = memsize; prop_mem_avail[0] = 0; prop_mem_avail[1] = 0; - prop_mem_avail[2] = va2pa((unsigned long)&_data); + prop_mem_avail[2] = va2pa((unsigned long)&_data) - 1; prop_vmem_avail[0] = 0; prop_vmem_avail[1] = 0; prop_vmem_avail[2] = (unsigned long)&_start - 1; @@ -506,6 +501,14 @@ romvec0.pv_v2bootargs.bootargs = &cmdline; romvec0.pv_v2bootargs.fd_stdin = &obp_fd_stdin; romvec0.pv_v2bootargs.fd_stdout = &obp_fd_stdout; + + push_str("/builtin/console"); + fword("open-dev"); + obp_fd_stdin = POP(); + push_str("/builtin/console"); + fword("open-dev"); + obp_fd_stdout = POP(); + obp_stdin = PROMDEV_TTYA; obp_stdout = PROMDEV_TTYA;
Modified: openbios-devel/arch/sparc32/tree.fs =================================================================== --- openbios-devel/arch/sparc32/tree.fs 2006-05-17 12:30:12 UTC (rev 22) +++ openbios-devel/arch/sparc32/tree.fs 2006-05-18 21:57:08 UTC (rev 23) @@ -96,7 +96,7 @@ " SUNW,tcx" device-name " display" device-type h# 1d encode-int " vbporch" property - h# 90 encode-int " hbporch" property + h# a0 encode-int " hbporch" property h# 06 encode-int " vsync" property h# 88 encode-int " hsync" property h# 03 encode-int " vfporch" property @@ -111,7 +111,7 @@ 5 encode-int 0 encode-int encode+ " intr" property 5 encode-int " interrupts" property 2 encode-int h# 00800000 encode-int encode+ h# 00100000 encode-int encode+ - 2 encode-int encode+ h# 02000000 encode-int encode+ h# 00000001 encode-int encode+ + 2 encode-int encode+ h# 02000000 encode-int encode+ h# 00000001 encode-int encode+ 2 encode-int encode+ h# 04000000 encode-int encode+ h# 00800000 encode-int encode+ 2 encode-int encode+ h# 06000000 encode-int encode+ h# 00800000 encode-int encode+ 2 encode-int encode+ h# 0a000000 encode-int encode+ h# 00000001 encode-int encode+ @@ -235,8 +235,8 @@ h# 0 encode-int h# 00000000 encode-int encode+ h# 00000008 encode-int encode+ " reg" property 1 encode-int " slave" property h# 2c encode-int 0 encode-int encode+ " intr" property - 1 encode-int " keyboard" property - 1 encode-int " mouse" property + -1 encode-int " keyboard" property + -1 encode-int " mouse" property finish-device
" /obio" find-device
Modified: openbios-devel/config/examples/cross-sparc32_config.xml =================================================================== --- openbios-devel/config/examples/cross-sparc32_config.xml 2006-05-17 12:30:12 UTC (rev 22) +++ openbios-devel/config/examples/cross-sparc32_config.xml 2006-05-18 21:57:08 UTC (rev 23) @@ -67,6 +67,7 @@
<!-- Drivers --> <option name="CONFIG_DRIVER_SBUS" type="boolean" value="true"/> + <option name="CONFIG_DRIVER_OBIO" type="boolean" value="true"/> <option name="CONFIG_DRIVER_ESP" type="boolean" value="true"/> <option name="CONFIG_DRIVER_FLOPPY" type="boolean" value="false"/>
Modified: openbios-devel/config/examples/sparc32_config.xml =================================================================== --- openbios-devel/config/examples/sparc32_config.xml 2006-05-17 12:30:12 UTC (rev 22) +++ openbios-devel/config/examples/sparc32_config.xml 2006-05-18 21:57:08 UTC (rev 23) @@ -67,6 +67,7 @@
<!-- Drivers --> <option name="CONFIG_DRIVER_SBUS" type="boolean" value="true"/> + <option name="CONFIG_DRIVER_OBIO" type="boolean" value="true"/> <option name="CONFIG_DRIVER_ESP" type="boolean" value="true"/> <option name="CONFIG_DRIVER_FLOPPY" type="boolean" value="false"/>
Modified: openbios-devel/drivers/build.xml =================================================================== --- openbios-devel/drivers/build.xml 2006-05-17 12:30:12 UTC (rev 22) +++ openbios-devel/drivers/build.xml 2006-05-18 21:57:08 UTC (rev 23) @@ -11,6 +11,7 @@ <object source="iommu.c" condition="DRIVER_SBUS"/> <object source="sbus.c" condition="DRIVER_SBUS"/> <object source="esp.c" condition="DRIVER_ESP"/> + <object source="obio.c" condition="DRIVER_OBIO"/> </library>
<dictionary name="openbios" target="forth">
Modified: openbios-devel/drivers/esp.c =================================================================== --- openbios-devel/drivers/esp.c 2006-05-17 12:30:12 UTC (rev 22) +++ openbios-devel/drivers/esp.c 2006-05-18 21:57:08 UTC (rev 23) @@ -363,6 +363,14 @@ fword("encode+"); push_str("reg"); fword("property"); + + PUSH(0x24); + fword("encode-int"); + PUSH(0); + fword("encode-int"); + fword("encode+"); + push_str("intr"); + fword("property"); }
static void
Added: openbios-devel/drivers/obio.c =================================================================== --- openbios-devel/drivers/obio.c (rev 0) +++ openbios-devel/drivers/obio.c 2006-05-18 21:57:08 UTC (rev 23) @@ -0,0 +1,85 @@ +/* + * OpenBIOS Sparc OBIO driver + * + * (C) 2004 Stefan Reinauer stepan@openbios.org + * (C) 2005 Ed Schouten ed@fxq.nl + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 + * + */ + +#include "openbios/config.h" +#include "openbios/bindings.h" +#include "openbios/kernel.h" +#include "libc/byteorder.h" +#include "libc/vsprintf.h" + +#include "openbios/drivers.h" + +static void +ob_zs_init(unsigned long slavio_base) +{ + unsigned long zs_addr; + + zs_addr = (unsigned long)map_io(slavio_base + 0x0, 8); + push_str("/obio/zs@0,0"); + fword("find-device"); + + PUSH(zs_addr); + fword("encode-int"); + PUSH(sizeof(zs_addr)); + fword("encode-int"); + fword("encode+"); + push_str("address"); + fword("property"); + + zs_addr = (unsigned long)map_io(slavio_base + 0x00100000, 8); + push_str("/obio/zs@0,100000"); + fword("find-device"); + + PUSH(zs_addr); + fword("encode-int"); + PUSH(sizeof(zs_addr)); + fword("encode-int"); + fword("encode+"); + push_str("address"); + fword("property"); +} + +static void +ob_obio_open(int *idx) +{ + int ret=1; + RET ( -ret ); +} + +static void +ob_obio_close(int *idx) +{ + selfword("close-deblocker"); +} + +static void +ob_obio_initialize(int *idx) +{ +} + + +NODE_METHODS(ob_obio_node) = { + { NULL, ob_obio_initialize }, + { "open", ob_obio_open }, + { "close", ob_obio_close }, +}; + + +int ob_obio_init(unsigned long slavio_base) +{ + + //printk("Initializing OBIO devices...\n"); + + ob_zs_init(slavio_base); + + return 0; +}
Modified: openbios-devel/include/openbios/drivers.h =================================================================== --- openbios-devel/include/openbios/drivers.h 2006-05-17 12:30:12 UTC (rev 22) +++ openbios-devel/include/openbios/drivers.h 2006-05-18 21:57:08 UTC (rev 23) @@ -23,4 +23,7 @@ #ifdef CONFIG_DRIVER_ESP int ob_esp_init(void); #endif +#ifdef CONFIG_DRIVER_OBIO +int ob_obio_init(unsigned long slavio_base); +#endif