Author: stepan Date: 2008-11-24 13:19:05 +0100 (Mon, 24 Nov 2008) New Revision: 254
Added: openbios-devel/include/openbios/pci.h Modified: openbios-devel/arch/ppc/briq/init.c openbios-devel/arch/ppc/mol/init.c openbios-devel/arch/ppc/pearpc/init.c openbios-devel/arch/ppc/qemu/init.c openbios-devel/include/ppc/io.h openbios-devel/kernel/forth.c Log: Define the ISA io base according machine type.
Signed-off-by: Laurent Vivier Laurent@lvivier.info Acked-by: Stefan Reinauer stepan@coresystems.de
Modified: openbios-devel/arch/ppc/briq/init.c =================================================================== --- openbios-devel/arch/ppc/briq/init.c 2008-11-24 12:16:22 UTC (rev 253) +++ openbios-devel/arch/ppc/briq/init.c 2008-11-24 12:19:05 UTC (rev 254) @@ -53,9 +53,13 @@ ; }
+uint32_t isa_io_base; + void entry( void ) { + isa_io_base = 0x80000000; + printk("\n"); printk("=============================================================\n"); printk("OpenBIOS %s [%s]\n", OPENBIOS_RELEASE, OPENBIOS_BUILD_DATE );
Modified: openbios-devel/arch/ppc/mol/init.c =================================================================== --- openbios-devel/arch/ppc/mol/init.c 2008-11-24 12:16:22 UTC (rev 253) +++ openbios-devel/arch/ppc/mol/init.c 2008-11-24 12:19:05 UTC (rev 254) @@ -48,9 +48,13 @@ ; }
+uint32_t isa_io_base; + void entry( void ) { + isa_io_base = 0x80000000; + printk("\n"); printk("=============================================================\n"); printk("OpenBIOS %s [%s]\n", OPENBIOS_RELEASE, OPENBIOS_BUILD_DATE );
Modified: openbios-devel/arch/ppc/pearpc/init.c =================================================================== --- openbios-devel/arch/ppc/pearpc/init.c 2008-11-24 12:16:22 UTC (rev 253) +++ openbios-devel/arch/ppc/pearpc/init.c 2008-11-24 12:19:05 UTC (rev 254) @@ -56,9 +56,13 @@ ; }
+uint32_t isa_io_base; + void entry( void ) { + isa_io_base = 0x80000000; + printk("\n"); printk("=============================================================\n"); printk("OpenBIOS %s [%s]\n", OPENBIOS_RELEASE, OPENBIOS_BUILD_DATE );
Modified: openbios-devel/arch/ppc/qemu/init.c =================================================================== --- openbios-devel/arch/ppc/qemu/init.c 2008-11-24 12:16:22 UTC (rev 253) +++ openbios-devel/arch/ppc/qemu/init.c 2008-11-24 12:19:05 UTC (rev 254) @@ -22,6 +22,7 @@
#include "openbios/config.h" #include "openbios/bindings.h" +#include "openbios/pci.h" #include "openbios/nvram.h" #include "qemu/qemu.h" #include "ofmem.h" @@ -33,21 +34,6 @@ extern void ob_adb_init( void ); extern void setup_timers( void );
-#if 0 -int -get_bool_res( const char *res ) -{ - char buf[8], *p; - - p = BootHGetStrRes( res, buf, sizeof(buf) ); - if( !p ) - return -1; - if( !strcasecmp(p,"true") || !strcasecmp(p,"yes") || !strcasecmp(p,"1") ) - return 1; - return 0; -} -#endif - void unexpected_excep( int vector ) { @@ -56,9 +42,34 @@ ; }
+enum { + ARCH_PREP = 0, + ARCH_MAC99, + ARCH_HEATHROW, +}; + +pci_arch_t known_arch[] = { + [ARCH_PREP] = { "PREP", 0x1057, 0x4801, 0x80800000, 0x800c0000, + 0x80000000, 0x00100000, 0xf0000000, 0x10000000, + 0x80000000, 0x00010000, 0x00000000, 0x00400000, + }, + [ARCH_MAC99] = { "MAC99", 0x106b, 0x001F, 0xf2800000, 0xf2c00000, + 0xf2000000, 0x02000000, 0x80000000, 0x10000000, + 0xf2000000, 0x00800000, 0x00000000, 0x01000000, + }, + [ARCH_HEATHROW] = { "HEATHROW", 0x1057, 0x0002, 0xfec00000, 0xfee00000, + 0x80000000, 0x7f000000, 0x80000000, 0x01000000, + 0xfe000000, 0x00800000, 0xfd000000, 0x01000000, + }, +}; +pci_arch_t *arch; +uint32_t isa_io_base; + void entry( void ) { + arch = &known_arch[ARCH_HEATHROW]; + isa_io_base = arch->io_base; printk("\n"); printk("=============================================================\n"); printk("OpenBIOS %s [%s]\n", OPENBIOS_RELEASE, OPENBIOS_BUILD_DATE ); @@ -115,10 +126,9 @@ set_property( ph, "rtas-size", (char*)&size, sizeof(size) ); } #endif - #if 0 /* tweak boot settings */ - autoboot = !!get_bool_res("autoboot"); + autoboot = !!getbool("autoboot?"); #endif autoboot = 0; if( !autoboot ) @@ -127,7 +137,7 @@ setenv("boot-command", "qemuboot");
#if 0 - if( get_bool_res("tty-interface") == 1 ) + if( getbool("tty-interface?") == 1 ) #endif fword("activate-tty-interface");
Added: openbios-devel/include/openbios/pci.h =================================================================== --- openbios-devel/include/openbios/pci.h (rev 0) +++ openbios-devel/include/openbios/pci.h 2008-11-24 12:19:05 UTC (rev 254) @@ -0,0 +1,22 @@ +#ifndef _H_PCI +#define _H_PCI + +typedef struct pci_arch_t pci_arch_t; + +struct pci_arch_t { + char * name; + uint16_t vendor_id; + uint16_t device_id; + uint32_t cfg_addr; + uint32_t cfg_data; + uint32_t cfg_base; + uint32_t cfg_len; + uint32_t mem_base; + uint32_t mem_len; + uint32_t io_base; + uint32_t io_len; + uint32_t rbase; + uint32_t rlen; +}; + +#endif /* _H_PCI */
Modified: openbios-devel/include/ppc/io.h =================================================================== --- openbios-devel/include/ppc/io.h 2008-11-24 12:16:22 UTC (rev 253) +++ openbios-devel/include/ppc/io.h 2008-11-24 12:19:05 UTC (rev 254) @@ -10,9 +10,7 @@
#ifndef BOOTSTRAP
-#ifndef _IO_BASE -#define _IO_BASE 0x80000000 -#endif +extern uint32_t isa_io_base;
/* * The insw/outsw/insl/outsl macros don't do byte-swapping. @@ -20,15 +18,15 @@ * are arrays of bytes, and byte-swapping is not appropriate in * that case. - paulus */ -#define insw(port, buf, ns) _insw_ns((uint16_t *)((port)+_IO_BASE), (buf), (ns)) -#define outsw(port, buf, ns) _outsw_ns((uint16_t *)((port)+_IO_BASE), (buf), (ns)) +#define insw(port, buf, ns) _insw((uint16_t *)((port)+isa_io_base), (buf), (ns)) +#define outsw(port, buf, ns) _outsw((uint16_t *)((port)+isa_io_base), (buf), (ns))
-#define inb(port) in_8((uint8_t *)((port)+_IO_BASE)) -#define outb(val, port) out_8((uint8_t *)((port)+_IO_BASE), (val)) -#define inw(port) in_le16((uint16_t *)((port)+_IO_BASE)) -#define outw(val, port) out_le16((uint16_t *)((port)+_IO_BASE), (val)) -#define inl(port) in_le32((uint32_t *)((port)+_IO_BASE)) -#define outl(val, port) out_le32((uint32_t *)((port)+_IO_BASE), (val)) +#define inb(port) in_8((uint8_t *)((port)+isa_io_base)) +#define outb(val, port) out_8((uint8_t *)((port)+isa_io_base), (val)) +#define inw(port) in_le16((uint16_t *)((port)+isa_io_base)) +#define outw(val, port) out_le16((uint16_t *)((port)+isa_io_base), (val)) +#define inl(port) in_le32((uint32_t *)((port)+isa_io_base)) +#define outl(val, port) out_le32((uint32_t *)((port)+isa_io_base), (val))
/* * 8, 16 and 32 bit, big and little endian I/O operations, with barrier.
Modified: openbios-devel/kernel/forth.c =================================================================== --- openbios-devel/kernel/forth.c 2008-11-24 12:16:22 UTC (rev 253) +++ openbios-devel/kernel/forth.c 2008-11-24 12:19:05 UTC (rev 254) @@ -6,6 +6,7 @@ * the copyright and warranty status of this work. */
+extern uint32_t isa_io_base;
/* * dup ( x -- x x )