mirror of
https://gitlab.com/qemu-project/openbios.git
synced 2024-02-13 08:34:06 +08:00
this makes linux on sparc32 boot :-)
git-svn-id: svn://coreboot.org/openbios/openbios-devel@23 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
@@ -57,6 +57,9 @@ arch_init( void )
|
|||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_DRIVER_ESP
|
#ifdef CONFIG_DRIVER_ESP
|
||||||
ob_esp_init();
|
ob_esp_init();
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_DRIVER_OBIO
|
||||||
|
ob_obio_init(0x71000000);
|
||||||
#endif
|
#endif
|
||||||
device_end();
|
device_end();
|
||||||
bind_func("platform-boot", boot );
|
bind_func("platform-boot", boot );
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ static int obp_nextnode(int node)
|
|||||||
PUSH(node);
|
PUSH(node);
|
||||||
fword("peer");
|
fword("peer");
|
||||||
peer = POP();
|
peer = POP();
|
||||||
DPRINTF("obp_nextnode(%x) = %x\n", node, peer);
|
DPRINTF("obp_nextnode(0x%x) = 0x%x\n", node, peer);
|
||||||
|
|
||||||
return peer;
|
return peer;
|
||||||
}
|
}
|
||||||
@@ -88,7 +88,7 @@ static int obp_child(int node)
|
|||||||
PUSH(node);
|
PUSH(node);
|
||||||
fword("child");
|
fword("child");
|
||||||
child = POP();
|
child = POP();
|
||||||
DPRINTF("obp_child(%x) = %x\n", node, child);
|
DPRINTF("obp_child(0x%x) = 0x%x\n", node, child);
|
||||||
|
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
@@ -103,9 +103,7 @@ static int obp_proplen(int node, char *name)
|
|||||||
notfound = POP();
|
notfound = POP();
|
||||||
|
|
||||||
if (notfound) {
|
if (notfound) {
|
||||||
DPRINTF("obp_proplen(%x, %s) (not found)\n", node, name);
|
DPRINTF("obp_proplen(0x%x, %s) (not found)\n", node, name);
|
||||||
(void) POP();
|
|
||||||
(void) POP();
|
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
@@ -113,7 +111,7 @@ static int obp_proplen(int node, char *name)
|
|||||||
|
|
||||||
len = POP();
|
len = POP();
|
||||||
(void) 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;
|
return len;
|
||||||
}
|
}
|
||||||
@@ -138,9 +136,7 @@ static int obp_getprop(int node, char *name, char *value)
|
|||||||
notfound = POP();
|
notfound = POP();
|
||||||
}
|
}
|
||||||
if (notfound) {
|
if (notfound) {
|
||||||
DPRINTF("obp_getprop(%x, %s) (not found)\n", node, name);
|
DPRINTF("obp_getprop(0x%x, %s) (not found)\n", node, name);
|
||||||
(void) POP();
|
|
||||||
(void) POP();
|
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
@@ -151,7 +147,7 @@ static int obp_getprop(int node, char *name, char *value)
|
|||||||
str = (char *) POP();
|
str = (char *) POP();
|
||||||
memcpy(value, str, len);
|
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;
|
return len;
|
||||||
}
|
}
|
||||||
@@ -162,14 +158,13 @@ static int obp_setprop(__attribute__((unused)) int node,
|
|||||||
__attribute__((unused)) char *value,
|
__attribute__((unused)) char *value,
|
||||||
__attribute__((unused)) int len)
|
__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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *obp_nextprop(int node, char *name)
|
static const char *obp_nextprop(int node, char *name)
|
||||||
{
|
{
|
||||||
char *ret;
|
|
||||||
int found;
|
int found;
|
||||||
|
|
||||||
if (!name || *name == '\0') {
|
if (!name || *name == '\0') {
|
||||||
@@ -183,11 +178,11 @@ static const char *obp_nextprop(int node, char *name)
|
|||||||
fword("next-property");
|
fword("next-property");
|
||||||
found = POP();
|
found = POP();
|
||||||
if (!found) {
|
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();
|
||||||
(void) POP();
|
(void) POP();
|
||||||
|
|
||||||
return NULL;
|
return "";
|
||||||
} else {
|
} else {
|
||||||
int len;
|
int len;
|
||||||
char *str;
|
char *str;
|
||||||
@@ -195,7 +190,7 @@ static const char *obp_nextprop(int node, char *name)
|
|||||||
len = POP();
|
len = POP();
|
||||||
str = (char *) 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;
|
return str;
|
||||||
}
|
}
|
||||||
@@ -271,7 +266,7 @@ static int obp_rdblkdev(int dev_desc, int num_blks, int offset, char *buf)
|
|||||||
|
|
||||||
ret = obp_devread(dev_desc, buf, num_blks * bs) / bs;
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -283,7 +278,7 @@ static char *obp_dumb_mmap(char *va, __attribute__((unused)) int which_io,
|
|||||||
unsigned int off;
|
unsigned int off;
|
||||||
unsigned int mva;
|
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);
|
off = pa & (PAGE_SIZE-1);
|
||||||
npages = (off + size + (PAGE_SIZE-1)) / PAGE_SIZE;
|
npages = (off + size + (PAGE_SIZE-1)) / PAGE_SIZE;
|
||||||
pa &= ~(PAGE_SIZE-1);
|
pa &= ~(PAGE_SIZE-1);
|
||||||
@@ -301,7 +296,7 @@ static char *obp_dumb_mmap(char *va, __attribute__((unused)) int which_io,
|
|||||||
static void obp_dumb_munmap(__attribute__((unused)) char *va,
|
static void obp_dumb_munmap(__attribute__((unused)) char *va,
|
||||||
__attribute__((unused)) unsigned int size)
|
__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)
|
static int obp_devread(int dev_desc, char *buf, int nbytes)
|
||||||
@@ -371,7 +366,7 @@ static int obp_cpustart(unsigned int whichcpu, int ctxtbl_ptr,
|
|||||||
//int cpu, found;
|
//int cpu, found;
|
||||||
struct linux_prom_registers *smp_ctable = (void *)ctxtbl_ptr;
|
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);
|
smp_ctable->phys_addr, thiscontext, prog_counter);
|
||||||
#if 0
|
#if 0
|
||||||
found = obp_getprop(whichcpu, "mid", (char *)&cpu);
|
found = obp_getprop(whichcpu, "mid", (char *)&cpu);
|
||||||
@@ -435,7 +430,7 @@ init_openprom(unsigned long memsize, const char *cmdline, char boot_device)
|
|||||||
prop_mem_reg[2] = memsize;
|
prop_mem_reg[2] = memsize;
|
||||||
prop_mem_avail[0] = 0;
|
prop_mem_avail[0] = 0;
|
||||||
prop_mem_avail[1] = 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[0] = 0;
|
||||||
prop_vmem_avail[1] = 0;
|
prop_vmem_avail[1] = 0;
|
||||||
prop_vmem_avail[2] = (unsigned long)&_start - 1;
|
prop_vmem_avail[2] = (unsigned long)&_start - 1;
|
||||||
@@ -506,6 +501,14 @@ init_openprom(unsigned long memsize, const char *cmdline, char boot_device)
|
|||||||
romvec0.pv_v2bootargs.bootargs = &cmdline;
|
romvec0.pv_v2bootargs.bootargs = &cmdline;
|
||||||
romvec0.pv_v2bootargs.fd_stdin = &obp_fd_stdin;
|
romvec0.pv_v2bootargs.fd_stdin = &obp_fd_stdin;
|
||||||
romvec0.pv_v2bootargs.fd_stdout = &obp_fd_stdout;
|
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_stdin = PROMDEV_TTYA;
|
||||||
obp_stdout = PROMDEV_TTYA;
|
obp_stdout = PROMDEV_TTYA;
|
||||||
|
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ new-device
|
|||||||
" SUNW,tcx" device-name
|
" SUNW,tcx" device-name
|
||||||
" display" device-type
|
" display" device-type
|
||||||
h# 1d encode-int " vbporch" property
|
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# 06 encode-int " vsync" property
|
||||||
h# 88 encode-int " hsync" property
|
h# 88 encode-int " hsync" property
|
||||||
h# 03 encode-int " vfporch" property
|
h# 03 encode-int " vfporch" property
|
||||||
@@ -111,7 +111,7 @@ new-device
|
|||||||
5 encode-int 0 encode-int encode+ " intr" property
|
5 encode-int 0 encode-int encode+ " intr" property
|
||||||
5 encode-int " interrupts" property
|
5 encode-int " interrupts" property
|
||||||
2 encode-int h# 00800000 encode-int encode+ h# 00100000 encode-int encode+
|
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# 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# 06000000 encode-int encode+ h# 00800000 encode-int encode+
|
||||||
2 encode-int encode+ h# 0a000000 encode-int encode+ h# 00000001 encode-int encode+
|
2 encode-int encode+ h# 0a000000 encode-int encode+ h# 00000001 encode-int encode+
|
||||||
@@ -235,8 +235,8 @@ new-device
|
|||||||
h# 0 encode-int h# 00000000 encode-int encode+ h# 00000008 encode-int encode+ " reg" property
|
h# 0 encode-int h# 00000000 encode-int encode+ h# 00000008 encode-int encode+ " reg" property
|
||||||
1 encode-int " slave" property
|
1 encode-int " slave" property
|
||||||
h# 2c encode-int 0 encode-int encode+ " intr" property
|
h# 2c encode-int 0 encode-int encode+ " intr" property
|
||||||
1 encode-int " keyboard" property
|
-1 encode-int " keyboard" property
|
||||||
1 encode-int " mouse" property
|
-1 encode-int " mouse" property
|
||||||
finish-device
|
finish-device
|
||||||
|
|
||||||
" /obio" find-device
|
" /obio" find-device
|
||||||
|
|||||||
@@ -67,6 +67,7 @@
|
|||||||
|
|
||||||
<!-- Drivers -->
|
<!-- Drivers -->
|
||||||
<option name="CONFIG_DRIVER_SBUS" type="boolean" value="true"/>
|
<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_ESP" type="boolean" value="true"/>
|
||||||
<option name="CONFIG_DRIVER_FLOPPY" type="boolean" value="false"/>
|
<option name="CONFIG_DRIVER_FLOPPY" type="boolean" value="false"/>
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,7 @@
|
|||||||
|
|
||||||
<!-- Drivers -->
|
<!-- Drivers -->
|
||||||
<option name="CONFIG_DRIVER_SBUS" type="boolean" value="true"/>
|
<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_ESP" type="boolean" value="true"/>
|
||||||
<option name="CONFIG_DRIVER_FLOPPY" type="boolean" value="false"/>
|
<option name="CONFIG_DRIVER_FLOPPY" type="boolean" value="false"/>
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
<object source="iommu.c" condition="DRIVER_SBUS"/>
|
<object source="iommu.c" condition="DRIVER_SBUS"/>
|
||||||
<object source="sbus.c" condition="DRIVER_SBUS"/>
|
<object source="sbus.c" condition="DRIVER_SBUS"/>
|
||||||
<object source="esp.c" condition="DRIVER_ESP"/>
|
<object source="esp.c" condition="DRIVER_ESP"/>
|
||||||
|
<object source="obio.c" condition="DRIVER_OBIO"/>
|
||||||
</library>
|
</library>
|
||||||
|
|
||||||
<dictionary name="openbios" target="forth">
|
<dictionary name="openbios" target="forth">
|
||||||
|
|||||||
@@ -363,6 +363,14 @@ ob_esp_initialize(__attribute__((unused)) esp_private_t **esp)
|
|||||||
fword("encode+");
|
fword("encode+");
|
||||||
push_str("reg");
|
push_str("reg");
|
||||||
fword("property");
|
fword("property");
|
||||||
|
|
||||||
|
PUSH(0x24);
|
||||||
|
fword("encode-int");
|
||||||
|
PUSH(0);
|
||||||
|
fword("encode-int");
|
||||||
|
fword("encode+");
|
||||||
|
push_str("intr");
|
||||||
|
fword("property");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
85
drivers/obio.c
Normal file
85
drivers/obio.c
Normal file
@@ -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;
|
||||||
|
}
|
||||||
@@ -23,4 +23,7 @@ int ob_ide_init(void);
|
|||||||
#ifdef CONFIG_DRIVER_ESP
|
#ifdef CONFIG_DRIVER_ESP
|
||||||
int ob_esp_init(void);
|
int ob_esp_init(void);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef CONFIG_DRIVER_OBIO
|
||||||
|
int ob_obio_init(unsigned long slavio_base);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user