Re: [OpenBIOS] Fix boot-script parsing for openSUSE ppc media
by laurent@vivier.eu
>> Fix boot-script parsing for openSUSE ppc media
>
>applied, thanks
I've applied it, as it breaks nothing and allows to use Suse, but a better fix should be:
- correctly parse the script to replace &device; by the boot device ("cd:", and not "cd:0", which is "&bootdevice;:&partition;")
- correctly manage CD partition to be able to use ":1" instead of ":0" (in fact, for the moment, we use mac partition on CD and ":0" to use the entire disk).
Regards,
Laurent
10 years, 10 months
r436 - openbios-devel/kernel
by svn@openbios.org
Author: blueswirl
Date: 2009-01-31 17:42:01 +0100 (Sat, 31 Jan 2009)
New Revision: 436
Modified:
openbios-devel/kernel/bootstrap.c
openbios-devel/kernel/cross.h
openbios-devel/kernel/dict.c
openbios-devel/kernel/forth.c
Log:
Fix Sparc64 cross compilation in 32 bit environment, closes #17
Modified: openbios-devel/kernel/bootstrap.c
===================================================================
--- openbios-devel/kernel/bootstrap.c 2009-01-31 13:33:07 UTC (rev 435)
+++ openbios-devel/kernel/bootstrap.c 2009-01-31 16:42:01 UTC (rev 436)
@@ -116,7 +116,7 @@
bit=i&~(-BITS);
if(d1[i]==d2[i]) {
- reloc_table[pos] &= target_ucell(~((ucell)1UL<<bit));
+ reloc_table[pos] &= target_ucell(~((ucell)1ULL << bit));
// This check might bring false positives in data.
//if(d1[i] >= pointer2cell(dict_one) &&
@@ -124,7 +124,7 @@
// printk("\nWARNING: inconsistent relocation (%x:%x)!\n", d1[i], d2[i]);
} else {
/* This is a pointer, it needs relocation, d2==dict */
- reloc_table[pos] |= target_ucell((ucell)1UL<<bit);
+ reloc_table[pos] |= target_ucell((ucell)1ULL << bit);
d2[i] = target_ucell(target_ucell(d2[i]) - pointer2cell(d2));
}
}
@@ -175,8 +175,9 @@
.checksum = 0,
.compression = 0,
.relocation = -1,
- .length = target_ulong(dicthead),
- .last = target_ucell(((unsigned long)last-(unsigned long)dict)),
+ .length = target_ulong((uint32_t)dicthead),
+ .last = target_ucell((ucell)((unsigned long)last
+ - (unsigned long)dict)),
.reserved[0] = 0,
.reserved[1] = 0,
.reserved[2] = 0,
@@ -464,7 +465,7 @@
{
FILE *f;
char tib[160];
- long num;
+ cell num;
char *test;
const ucell SEMIS = (ucell)findword("(semis)");
@@ -627,11 +628,12 @@
u8 flags = read_byte((u8*)cell2pointer(res) -
sizeof(cell) - 1);
#ifdef CONFIG_DEBUG_INTERPRETER
- printk("%s is 0x%p\n", tib, (ucell) res);
+ printk("%s is 0x%" FMT_CELL_x "\n", tib, (ucell) res);
#endif
if (!(*state) || (flags & 3)) {
#ifdef CONFIG_DEBUG_INTERPRETER
- printk("executing %s, %p (flags: %s %s)\n",
+ printk("executing %s, %" FMT_CELL_d
+ " (flags: %s %s)\n",
tib, res,
(flags & 1) ? "immediate" : "",
(flags & 2) ? "compile-only" : "");
@@ -649,9 +651,9 @@
/* if not look if it's a number */
if (tib[0] == '-')
- num = strtol(tib, &test, read_ucell(base));
+ num = strtoll(tib, &test, read_ucell(base));
else
- num = strtoul(tib, &test, read_ucell(base));
+ num = strtoull(tib, &test, read_ucell(base));
if (*test != 0) {
@@ -667,12 +669,12 @@
if (*state == 0) {
#ifdef CONFIG_DEBUG_INTERPRETER
- printk("pushed %x to stack\n\n", num);
+ printk("pushed %" FMT_CELL_x " to stack\n\n", num);
#endif
PUSH(num);
} else {
#ifdef CONFIG_DEBUG_INTERPRETER
- printk("writing lit, %x to dict\n\n", num);
+ printk("writing lit, %" FMT_CELL_x " to dict\n\n", num);
#endif
writecell(LIT); /* lit */
writecell(num);
Modified: openbios-devel/kernel/cross.h
===================================================================
--- openbios-devel/kernel/cross.h 2009-01-31 13:33:07 UTC (rev 435)
+++ openbios-devel/kernel/cross.h 2009-01-31 16:42:01 UTC (rev 436)
@@ -46,16 +46,13 @@
#define target_ucell(value) ((ucell)target_long(value))
#define target_cell(value) ((cell)target_long(value))
#elif BITS==64
-#ifdef NATIVE_BITWIDTH_LARGER_THAN_HOST_BITWIDTH
-#define target_ucell(value) ( ((ucell)target_long((value)&0xffffffff))<<32 )
-#define target_cell(value) ( ((cell)target_long((value)&0xffffffff))<<32 )
+#define target_ucell(value) \
+ ((((ucell)target_long((value) & 0xffffffff)) << 32) | \
+ ((ucell)target_long((value) >> 32)))
+#define target_cell(value) \
+ ((((cell)target_long((value) & 0xffffffff)) << 32) | \
+ ((cell)target_long((value) >> 32)))
#else
-#define target_ucell(value) ( ((ucell)target_long((value)&0xffffffff))<<32 | \
- ((ucell)target_long((value)>>32)) )
-#define target_cell(value) ( ((cell)target_long((value)&0xffffffff))<<32 | \
- ((cell)target_long((value)>>32)) )
-#endif
-#else
#error "Endianness not supported. Please report."
#endif
Modified: openbios-devel/kernel/dict.c
===================================================================
--- openbios-devel/kernel/dict.c 2009-01-31 13:33:07 UTC (rev 435)
+++ openbios-devel/kernel/dict.c 2009-01-31 16:42:01 UTC (rev 436)
@@ -167,7 +167,7 @@
l=(walk-(ucell *)dict);
pos=l/BITS;
bit=l&~(-BITS);
- if (reloc_table[pos]&target_ucell(1UL<<bit)) {
+ if (reloc_table[pos] & target_ucell((ucell)1ULL << bit)) {
// printk("%lx, pos %x, bit %d\n",*walk, pos, bit);
write_ucell(walk, read_ucell(walk)+pointer2cell(dict));
}
Modified: openbios-devel/kernel/forth.c
===================================================================
--- openbios-devel/kernel/forth.c 2009-01-31 13:33:07 UTC (rev 435)
+++ openbios-devel/kernel/forth.c 2009-01-31 16:42:01 UTC (rev 436)
@@ -330,8 +330,18 @@
const ucell b = POP();
const ducell a = DPOP();
#ifdef NEED_FAKE_INT128_T
- fprintf(stderr, "mudivmode called\n");
- exit(-1);
+ if (a.hi != 0) {
+ fprintf(stderr, "mudivmod called (0x%016llx %016llx / 0x%016llx)\n",
+ a.hi, a.lo, b);
+ exit(-1);
+ } else {
+ ducell c;
+
+ PUSH(a.lo % b);
+ c.hi = 0;
+ c.lo = a.lo / b;
+ DPUSH(c);
+ }
#else
PUSH(a % b);
DPUSH(a / b);
@@ -480,8 +490,16 @@
const dcell d2 = DPOP();
const dcell d1 = DPOP();
#ifdef NEED_FAKE_INT128_T
- fprintf(stderr, "dplus called\n");
- exit(-1);
+ ducell c;
+
+ if (d1.hi != 0 || d2.hi != 0) {
+ fprintf(stderr, "dplus called (0x%016llx %016llx + 0x%016llx %016llx)\n",
+ d1.hi, d1.lo, d2.hi, d2.lo);
+ exit(-1);
+ }
+ c.hi = 0;
+ c.lo = d1.lo + d2.lo;
+ DPUSH(c);
#else
DPUSH(d1 + d2);
#endif
@@ -497,8 +515,16 @@
const dcell d2 = DPOP();
const dcell d1 = DPOP();
#ifdef NEED_FAKE_INT128_T
- fprintf(stderr, "dminus called\n");
- exit(-1);
+ ducell c;
+
+ if (d1.hi != 0 || d2.hi != 0) {
+ fprintf(stderr, "dminus called (0x%016llx %016llx + 0x%016llx %016llx)\n",
+ d1.hi, d1.lo, d2.hi, d2.lo);
+ exit(-1);
+ }
+ c.hi = 0;
+ c.lo = d1.lo - d2.lo;
+ DPUSH(c);
#else
DPUSH(d1 - d2);
#endif
@@ -514,8 +540,15 @@
const cell u2 = POP();
const cell u1 = POP();
#ifdef NEED_FAKE_INT128_T
- fprintf(stderr, "mmult called\n");
- exit(-1);
+ ducell c;
+
+ if (0) { // XXX How to detect overflow?
+ fprintf(stderr, "mmult called (%016llx * 0x%016llx)\n", u1, u2);
+ exit(-1);
+ }
+ c.hi = 0;
+ c.lo = u1 * u2;
+ DPUSH(c);
#else
DPUSH((dcell) u1 * u2);
#endif
@@ -531,8 +564,15 @@
const ucell u2 = POP();
const ucell u1 = POP();
#ifdef NEED_FAKE_INT128_T
- fprintf(stderr, "ummult called\n");
- exit(-1);
+ ducell c;
+
+ if (0) { // XXX How to detect overflow?
+ fprintf(stderr, "ummult called (%016llx * 0x%016llx)\n", u1, u2);
+ exit(-1);
+ }
+ c.hi = 0;
+ c.lo = u1 * u2;
+ DPUSH(c);
#else
DPUSH((ducell) u1 * u2);
#endif
10 years, 10 months
r435 - openbios-devel/kernel
by svn@openbios.org
Author: blueswirl
Date: 2009-01-31 14:33:07 +0100 (Sat, 31 Jan 2009)
New Revision: 435
Modified:
openbios-devel/kernel/bootstrap.c
Log:
Exit with nonzero status if there are errors
Modified: openbios-devel/kernel/bootstrap.c
===================================================================
--- openbios-devel/kernel/bootstrap.c 2009-01-31 13:31:29 UTC (rev 434)
+++ openbios-devel/kernel/bootstrap.c 2009-01-31 13:33:07 UTC (rev 435)
@@ -1108,5 +1108,9 @@
}
free(ressources);
- return 0;
+
+ if (errors)
+ return 1;
+ else
+ return 0;
}
10 years, 10 months
r434 - openbios-devel/config/examples
by svn@openbios.org
Author: blueswirl
Date: 2009-01-31 14:31:29 +0100 (Sat, 31 Jan 2009)
New Revision: 434
Modified:
openbios-devel/config/examples/amd64_rules.xml
openbios-devel/config/examples/cross-ppc_rules.xml
openbios-devel/config/examples/cross-sparc32_rules.xml
openbios-devel/config/examples/cross-sparc64_rules.xml
openbios-devel/config/examples/cross-x86_rules.xml
openbios-devel/config/examples/ppc_rules.xml
openbios-devel/config/examples/sparc32_rules.xml
openbios-devel/config/examples/sparc64_rules.xml
openbios-devel/config/examples/x86_rules.xml
Log:
Really allow overriding HOSTARCH
Modified: openbios-devel/config/examples/amd64_rules.xml
===================================================================
--- openbios-devel/config/examples/amd64_rules.xml 2009-01-31 09:07:29 UTC (rev 433)
+++ openbios-devel/config/examples/amd64_rules.xml 2009-01-31 13:31:29 UTC (rev 434)
@@ -10,7 +10,7 @@
ODIR := .
SRCDIR := ..
HOSTCC := gcc
-HOSTARCH=$(shell $(SRCDIR)/config/scripts/archname)
+HOSTARCH?=$(shell $(SRCDIR)/config/scripts/archname)
CROSSCFLAGS=$(shell $(SRCDIR)/config/scripts/crosscflags $(HOSTARCH) $(ARCH))
HOSTCFLAGS := -O2 -g -Wall -W -DFCOMPILER -DBOOTSTRAP $(CROSSCFLAGS)
HOSTCFLAGS+= -Wredundant-decls -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations
Modified: openbios-devel/config/examples/cross-ppc_rules.xml
===================================================================
--- openbios-devel/config/examples/cross-ppc_rules.xml 2009-01-31 09:07:29 UTC (rev 433)
+++ openbios-devel/config/examples/cross-ppc_rules.xml 2009-01-31 13:31:29 UTC (rev 434)
@@ -10,7 +10,7 @@
ODIR := .
SRCDIR := ..
HOSTCC := gcc
-HOSTARCH=$(shell $(SRCDIR)/config/scripts/archname)
+HOSTARCH?=$(shell $(SRCDIR)/config/scripts/archname)
CROSSCFLAGS=$(shell $(SRCDIR)/config/scripts/crosscflags $(HOSTARCH) $(ARCH))
HOSTCFLAGS := -Os -Wall -W -DFCOMPILER -DBOOTSTRAP $(CROSSCFLAGS)
HOSTCFLAGS+= -Wredundant-decls -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations
Modified: openbios-devel/config/examples/cross-sparc32_rules.xml
===================================================================
--- openbios-devel/config/examples/cross-sparc32_rules.xml 2009-01-31 09:07:29 UTC (rev 433)
+++ openbios-devel/config/examples/cross-sparc32_rules.xml 2009-01-31 13:31:29 UTC (rev 434)
@@ -10,7 +10,7 @@
ODIR := .
SRCDIR := ..
HOSTCC := gcc
-HOSTARCH=$(shell $(SRCDIR)/config/scripts/archname)
+HOSTARCH?=$(shell $(SRCDIR)/config/scripts/archname)
CROSSCFLAGS=$(shell $(SRCDIR)/config/scripts/crosscflags $(HOSTARCH) $(ARCH))
HOSTCFLAGS := -O2 -g -Wall -W -DFCOMPILER -DBOOTSTRAP $(CROSSCFLAGS)
HOSTCFLAGS+= -Wredundant-decls -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations
Modified: openbios-devel/config/examples/cross-sparc64_rules.xml
===================================================================
--- openbios-devel/config/examples/cross-sparc64_rules.xml 2009-01-31 09:07:29 UTC (rev 433)
+++ openbios-devel/config/examples/cross-sparc64_rules.xml 2009-01-31 13:31:29 UTC (rev 434)
@@ -10,7 +10,7 @@
ODIR := .
SRCDIR := ..
HOSTCC := gcc
-HOSTARCH=$(shell $(SRCDIR)/config/scripts/archname)
+HOSTARCH?=$(shell $(SRCDIR)/config/scripts/archname)
CROSSCFLAGS=$(shell $(SRCDIR)/config/scripts/crosscflags $(HOSTARCH) $(ARCH))
HOSTCFLAGS := -O2 -g -Wall -W -DFCOMPILER -DBOOTSTRAP $(CROSSCFLAGS)
HOSTCFLAGS+= -Wredundant-decls -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations
Modified: openbios-devel/config/examples/cross-x86_rules.xml
===================================================================
--- openbios-devel/config/examples/cross-x86_rules.xml 2009-01-31 09:07:29 UTC (rev 433)
+++ openbios-devel/config/examples/cross-x86_rules.xml 2009-01-31 13:31:29 UTC (rev 434)
@@ -10,7 +10,7 @@
ODIR := .
SRCDIR := ..
HOSTCC := gcc
-HOSTARCH=$(shell $(SRCDIR)/config/scripts/archname)
+HOSTARCH?=$(shell $(SRCDIR)/config/scripts/archname)
CROSSCFLAGS=$(shell $(SRCDIR)/config/scripts/crosscflags $(HOSTARCH) $(ARCH))
HOSTCFLAGS := -O2 -g -Wall -W -DFCOMPILER -DBOOTSTRAP $(CROSSCFLAGS)
HOSTCFLAGS+= -Wredundant-decls -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations
Modified: openbios-devel/config/examples/ppc_rules.xml
===================================================================
--- openbios-devel/config/examples/ppc_rules.xml 2009-01-31 09:07:29 UTC (rev 433)
+++ openbios-devel/config/examples/ppc_rules.xml 2009-01-31 13:31:29 UTC (rev 434)
@@ -10,7 +10,7 @@
ODIR := .
SRCDIR := ..
HOSTCC := gcc
-HOSTARCH=$(shell $(SRCDIR)/config/scripts/archname)
+HOSTARCH?=$(shell $(SRCDIR)/config/scripts/archname)
CROSSCFLAGS=$(shell $(SRCDIR)/config/scripts/crosscflags $(HOSTARCH) $(ARCH))
HOSTCFLAGS := -Os -Wall -W -DFCOMPILER -DBOOTSTRAP $(CROSSCFLAGS)
HOSTCFLAGS+= -Wredundant-decls -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations
Modified: openbios-devel/config/examples/sparc32_rules.xml
===================================================================
--- openbios-devel/config/examples/sparc32_rules.xml 2009-01-31 09:07:29 UTC (rev 433)
+++ openbios-devel/config/examples/sparc32_rules.xml 2009-01-31 13:31:29 UTC (rev 434)
@@ -10,7 +10,7 @@
ODIR := .
SRCDIR := ..
HOSTCC := gcc
-HOSTARCH=$(shell $(SRCDIR)/config/scripts/archname)
+HOSTARCH?=$(shell $(SRCDIR)/config/scripts/archname)
CROSSCFLAGS=$(shell $(SRCDIR)/config/scripts/crosscflags $(HOSTARCH) $(ARCH))
HOSTCFLAGS := -O2 -g -Wall -W -DFCOMPILER -DBOOTSTRAP $(CROSSCFLAGS)
HOSTCFLAGS+= -Wredundant-decls -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations
Modified: openbios-devel/config/examples/sparc64_rules.xml
===================================================================
--- openbios-devel/config/examples/sparc64_rules.xml 2009-01-31 09:07:29 UTC (rev 433)
+++ openbios-devel/config/examples/sparc64_rules.xml 2009-01-31 13:31:29 UTC (rev 434)
@@ -10,7 +10,7 @@
ODIR := .
SRCDIR := ..
HOSTCC := gcc
-HOSTARCH=$(shell $(SRCDIR)/config/scripts/archname)
+HOSTARCH?=$(shell $(SRCDIR)/config/scripts/archname)
CROSSCFLAGS=$(shell $(SRCDIR)/config/scripts/crosscflags $(HOSTARCH) $(ARCH))
HOSTCFLAGS := -O2 -g -Wall -W -DFCOMPILER -DBOOTSTRAP $(CROSSCFLAGS)
HOSTCFLAGS+= -Wa,-xarch=v9 -Wa,-64 -m64 -mcpu=ultrasparc -mcmodel=medany
Modified: openbios-devel/config/examples/x86_rules.xml
===================================================================
--- openbios-devel/config/examples/x86_rules.xml 2009-01-31 09:07:29 UTC (rev 433)
+++ openbios-devel/config/examples/x86_rules.xml 2009-01-31 13:31:29 UTC (rev 434)
@@ -10,7 +10,7 @@
ODIR := .
SRCDIR := ..
HOSTCC := gcc
-HOSTARCH=$(shell $(SRCDIR)/config/scripts/archname)
+HOSTARCH?=$(shell $(SRCDIR)/config/scripts/archname)
CROSSCFLAGS=$(shell $(SRCDIR)/config/scripts/crosscflags $(HOSTARCH) $(ARCH))
HOSTCFLAGS := -O2 -g -Wall -W -DFCOMPILER -DBOOTSTRAP $(CROSSCFLAGS)
HOSTCFLAGS+= -Wredundant-decls -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations
10 years, 10 months
r433 - openbios-devel/config/scripts
by svn@openbios.org
Author: blueswirl
Date: 2009-01-31 10:07:29 +0100 (Sat, 31 Jan 2009)
New Revision: 433
Modified:
openbios-devel/config/scripts/switch-arch
Log:
Allow overriding HOSTARCH
Modified: openbios-devel/config/scripts/switch-arch
===================================================================
--- openbios-devel/config/scripts/switch-arch 2009-01-31 08:49:16 UTC (rev 432)
+++ openbios-devel/config/scripts/switch-arch 2009-01-31 09:07:29 UTC (rev 433)
@@ -15,7 +15,9 @@
chmod 755 config/scripts/archname
chmod 755 config/scripts/reldir
chmod 755 config/scripts/crosscflags
-HOSTARCH=`config/scripts/archname`
+if test "x$HOSTARCH" = "x"; then
+ HOSTARCH=`config/scripts/archname`
+fi
echo "Configuring OpenBIOS on $HOSTARCH for $*"
for RULES_ARCH in $*; do
10 years, 10 months
r432 - in openbios-devel: arch/ppc/qemu arch/sparc32 arch/sparc64 config/examples drivers include/openbios
by svn@openbios.org
Author: blueswirl
Date: 2009-01-31 09:49:16 +0100 (Sat, 31 Jan 2009)
New Revision: 432
Added:
openbios-devel/drivers/fw_cfg.c
Modified:
openbios-devel/arch/ppc/qemu/init.c
openbios-devel/arch/sparc32/entry.S
openbios-devel/arch/sparc64/entry.S
openbios-devel/arch/sparc64/openbios.c
openbios-devel/config/examples/cross-ppc_config.xml
openbios-devel/config/examples/cross-sparc32_config.xml
openbios-devel/config/examples/cross-sparc64_config.xml
openbios-devel/config/examples/ppc_config.xml
openbios-devel/config/examples/sparc32_config.xml
openbios-devel/config/examples/sparc64_config.xml
openbios-devel/drivers/build.xml
openbios-devel/drivers/obio.c
openbios-devel/include/openbios/fw_cfg.h
Log:
Refactor QEMU firmware confguration device handling (based on patch by
Aurelien Jarno)
Modified: openbios-devel/arch/ppc/qemu/init.c
===================================================================
--- openbios-devel/arch/ppc/qemu/init.c 2009-01-30 07:44:48 UTC (rev 431)
+++ openbios-devel/arch/ppc/qemu/init.c 2009-01-31 08:49:16 UTC (rev 432)
@@ -33,8 +33,6 @@
#define NO_QEMU_PROTOS
#include "openbios/fw_cfg.h"
-#define CFG_ADDR 0xf0000510
-
#define UUID_FMT "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x"
struct cpudef {
@@ -95,39 +93,6 @@
};
uint32_t isa_io_base;
-static volatile uint16_t *fw_cfg_cmd = (void *)CFG_ADDR;
-static volatile uint8_t *fw_cfg_data = (void *)(CFG_ADDR + 2);
-
-static void
-fw_cfg_read(uint16_t cmd, char *buf, unsigned int nbytes)
-{
- unsigned int i;
-
- *fw_cfg_cmd = cmd;
- for (i = 0; i < nbytes; i++)
- buf[i] = *fw_cfg_data;
-}
-
-static uint32_t
-fw_cfg_read_i32(uint16_t cmd)
-{
- char buf[sizeof(uint32_t)];
-
- fw_cfg_read(cmd, buf, sizeof(uint32_t));
-
- return __le32_to_cpu(*(uint32_t *)buf);
-}
-
-static uint16_t
-fw_cfg_read_i16(uint16_t cmd)
-{
- char buf[sizeof(uint16_t)];
-
- fw_cfg_read(cmd, buf, sizeof(uint16_t));
-
- return __le16_to_cpu(*(uint16_t *)buf);
-}
-
void
entry( void )
{
@@ -136,6 +101,8 @@
arch = &known_arch[ARCH_HEATHROW];
+ fw_cfg_init();
+
fw_cfg_read(FW_CFG_SIGNATURE, buf, 4);
buf[4] = '\0';
if (strncmp(buf, "QEMU", 4) == 0) {
Modified: openbios-devel/arch/sparc32/entry.S
===================================================================
--- openbios-devel/arch/sparc32/entry.S 2009-01-30 07:44:48 UTC (rev 431)
+++ openbios-devel/arch/sparc32/entry.S 2009-01-31 08:49:16 UTC (rev 432)
@@ -11,6 +11,7 @@
#include "asm/asi.h"
#include "asm/crs.h"
#define NO_QEMU_PROTOS
+#define NO_OPENBIOS_PROTOS
#include "openbios/fw_cfg.h"
#define CFG_ADDR 0x00000510
Modified: openbios-devel/arch/sparc64/entry.S
===================================================================
--- openbios-devel/arch/sparc64/entry.S 2009-01-30 07:44:48 UTC (rev 431)
+++ openbios-devel/arch/sparc64/entry.S 2009-01-31 08:49:16 UTC (rev 432)
@@ -12,6 +12,7 @@
#include "pstate.h"
#include "lsu.h"
#define NO_QEMU_PROTOS
+#define NO_OPENBIOS_PROTOS
#include "openbios/fw_cfg.h"
#define PROM_ADDR 0x1fff0000000
Modified: openbios-devel/arch/sparc64/openbios.c
===================================================================
--- openbios-devel/arch/sparc64/openbios.c 2009-01-30 07:44:48 UTC (rev 431)
+++ openbios-devel/arch/sparc64/openbios.c 2009-01-31 08:49:16 UTC (rev 432)
@@ -24,9 +24,6 @@
#include "openbios/fw_cfg.h"
#include "video_subr.h"
-#define BIOS_CFG_CMD 0x510
-#define BIOS_CFG_DATA 0x511
-
#define UUID_FMT "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x"
#define NVRAM_ADDR_LO 0x74
@@ -244,46 +241,6 @@
for (;;);
}
-static void
-fw_cfg_read(uint16_t cmd, char *buf, unsigned int nbytes)
-{
- unsigned int i;
-
- outw(cmd, BIOS_CFG_CMD);
- for (i = 0; i < nbytes; i++)
- buf[i] = inb(BIOS_CFG_DATA);
-}
-
-static uint64_t
-fw_cfg_read_i64(uint16_t cmd)
-{
- char buf[sizeof(uint64_t)];
-
- fw_cfg_read(cmd, buf, sizeof(uint64_t));
-
- return __le64_to_cpu(*(uint64_t *)buf);
-}
-
-static uint32_t
-fw_cfg_read_i32(uint16_t cmd)
-{
- char buf[sizeof(uint32_t)];
-
- fw_cfg_read(cmd, buf, sizeof(uint32_t));
-
- return __le32_to_cpu(*(uint32_t *)buf);
-}
-
-static uint16_t
-fw_cfg_read_i16(uint16_t cmd)
-{
- char buf[sizeof(uint16_t)];
-
- fw_cfg_read(cmd, buf, sizeof(uint16_t));
-
- return __le16_to_cpu(*(uint16_t *)buf);
-}
-
static uint8_t nvram_read_byte(uint16_t offset)
{
outb(offset & 0xff, NVRAM_ADDR_LO);
@@ -330,6 +287,8 @@
nvram_read(0, (char *)&nv_info, sizeof(ohwcfg_v3_t));
+ fw_cfg_init();
+
fw_cfg_read(FW_CFG_SIGNATURE, buf, 4);
buf[4] = '\0';
Modified: openbios-devel/config/examples/cross-ppc_config.xml
===================================================================
--- openbios-devel/config/examples/cross-ppc_config.xml 2009-01-30 07:44:48 UTC (rev 431)
+++ openbios-devel/config/examples/cross-ppc_config.xml 2009-01-31 08:49:16 UTC (rev 432)
@@ -75,5 +75,6 @@
<option name="CONFIG_DRIVER_VGA" type="boolean" value="true"/>
<option name="CONFIG_DRIVER_MACIO" type="boolean" value="true"/>
<option name="CONFIG_DRIVER_ESCC" type="boolean" value="true"/>
-
+ <option name="CONFIG_DRIVER_FW_CFG" type="boolean" value="true"/>
+ <option name="CONFIG_FW_CFG_ADDR" type="integer" value="0xf0000510"/>
</config>
Modified: openbios-devel/config/examples/cross-sparc32_config.xml
===================================================================
--- openbios-devel/config/examples/cross-sparc32_config.xml 2009-01-30 07:44:48 UTC (rev 431)
+++ openbios-devel/config/examples/cross-sparc32_config.xml 2009-01-31 08:49:16 UTC (rev 432)
@@ -76,5 +76,6 @@
<option name="CONFIG_DEBUG_FLOPPY" type="boolean" value="false"/>
<option name="CONFIG_DRIVER_ESCC" type="boolean" value="true"/>
<option name="CONFIG_DRIVER_ESCC_SUN" type="boolean" value="true"/>
-
+ <option name="CONFIG_DRIVER_FW_CFG" type="boolean" value="true"/>
+ <option name="CONFIG_FW_CFG_ADDR" type="integer" value="0xd00000510ULL"/>
</config>
Modified: openbios-devel/config/examples/cross-sparc64_config.xml
===================================================================
--- openbios-devel/config/examples/cross-sparc64_config.xml 2009-01-30 07:44:48 UTC (rev 431)
+++ openbios-devel/config/examples/cross-sparc64_config.xml 2009-01-31 08:49:16 UTC (rev 432)
@@ -77,5 +77,6 @@
<option name="CONFIG_DRIVER_EBUS" type="boolean" value="true"/>
<option name="CONFIG_DRIVER_PC_KBD" type="boolean" value="true"/>
<option name="CONFIG_DRIVER_PC_SERIAL" type="boolean" value="true"/>
-
+ <option name="CONFIG_DRIVER_FW_CFG" type="boolean" value="true"/>
+ <option name="CONFIG_FW_CFG_ADDR" type="integer" value="0x510"/>
</config>
Modified: openbios-devel/config/examples/ppc_config.xml
===================================================================
--- openbios-devel/config/examples/ppc_config.xml 2009-01-30 07:44:48 UTC (rev 431)
+++ openbios-devel/config/examples/ppc_config.xml 2009-01-31 08:49:16 UTC (rev 432)
@@ -75,5 +75,6 @@
<option name="CONFIG_DRIVER_VGA" type="boolean" value="true"/>
<option name="CONFIG_DRIVER_MACIO" type="boolean" value="true"/>
<option name="CONFIG_DRIVER_ESCC" type="boolean" value="true"/>
-
+ <option name="CONFIG_DRIVER_FW_CFG" type="boolean" value="true"/>
+ <option name="CONFIG_FW_CFG_ADDR" type="integer" value="0xf0000510"/>
</config>
Modified: openbios-devel/config/examples/sparc32_config.xml
===================================================================
--- openbios-devel/config/examples/sparc32_config.xml 2009-01-30 07:44:48 UTC (rev 431)
+++ openbios-devel/config/examples/sparc32_config.xml 2009-01-31 08:49:16 UTC (rev 432)
@@ -76,5 +76,6 @@
<option name="CONFIG_DEBUG_FLOPPY" type="boolean" value="false"/>
<option name="CONFIG_DRIVER_ESCC" type="boolean" value="true"/>
<option name="CONFIG_DRIVER_ESCC_SUN" type="boolean" value="true"/>
-
+ <option name="CONFIG_DRIVER_FW_CFG" type="boolean" value="true"/>
+ <option name="CONFIG_FW_CFG_ADDR" type="integer" value="0xd00000510ULL"/>
</config>
Modified: openbios-devel/config/examples/sparc64_config.xml
===================================================================
--- openbios-devel/config/examples/sparc64_config.xml 2009-01-30 07:44:48 UTC (rev 431)
+++ openbios-devel/config/examples/sparc64_config.xml 2009-01-31 08:49:16 UTC (rev 432)
@@ -77,5 +77,6 @@
<option name="CONFIG_DRIVER_EBUS" type="boolean" value="true"/>
<option name="CONFIG_DRIVER_PC_KBD" type="boolean" value="true"/>
<option name="CONFIG_DRIVER_PC_SERIAL" type="boolean" value="true"/>
-
+ <option name="CONFIG_DRIVER_FW_CFG" type="boolean" value="true"/>
+ <option name="CONFIG_FW_CFG_ADDR" type="integer" value="0x510"/>
</config>
Modified: openbios-devel/drivers/build.xml
===================================================================
--- openbios-devel/drivers/build.xml 2009-01-30 07:44:48 UTC (rev 431)
+++ openbios-devel/drivers/build.xml 2009-01-31 08:49:16 UTC (rev 432)
@@ -22,6 +22,7 @@
<object source="pc_kbd.c" condition="DRIVER_PC_KBD"/>
<object source="pc_serial.c" condition="DRIVER_PC_SERIAL"/>
<object source="escc.c" condition="DRIVER_ESCC"/>
+ <object source="fw_cfg.c" condition="DRIVER_FW_CFG"/>
</library>
<dictionary name="openbios" target="forth">
Added: openbios-devel/drivers/fw_cfg.c
===================================================================
--- openbios-devel/drivers/fw_cfg.c (rev 0)
+++ openbios-devel/drivers/fw_cfg.c 2009-01-31 08:49:16 UTC (rev 432)
@@ -0,0 +1,76 @@
+#include "openbios/config.h"
+#include "openbios/bindings.h"
+#include "libc/byteorder.h"
+#include "ofmem.h"
+#define NO_QEMU_PROTOS
+#include "openbios/fw_cfg.h"
+
+#if !defined(CONFIG_SPARC64)
+static volatile uint16_t *fw_cfg_cmd;
+static volatile uint8_t *fw_cfg_data;
+
+void
+fw_cfg_read(uint16_t cmd, char *buf, unsigned int nbytes)
+{
+ unsigned int i;
+
+ *fw_cfg_cmd = cmd;
+ for (i = 0; i < nbytes; i++)
+ buf[i] = *fw_cfg_data;
+}
+#else
+// XXX depends on PCI bus location, should be removed
+void
+fw_cfg_read(uint16_t cmd, char *buf, unsigned int nbytes)
+{
+ unsigned int i;
+
+ outw(cmd, CONFIG_FW_CFG_ADDR);
+ for (i = 0; i < nbytes; i++)
+ buf[i] = inb(CONFIG_FW_CFG_ADDR + 1);
+}
+#endif
+
+uint64_t
+fw_cfg_read_i64(uint16_t cmd)
+{
+ char buf[sizeof(uint64_t)];
+
+ fw_cfg_read(cmd, buf, sizeof(uint64_t));
+
+ return __le64_to_cpu(*(uint64_t *)buf);
+}
+
+uint32_t
+fw_cfg_read_i32(uint16_t cmd)
+{
+ char buf[sizeof(uint32_t)];
+
+ fw_cfg_read(cmd, buf, sizeof(uint32_t));
+
+ return __le32_to_cpu(*(uint32_t *)buf);
+}
+
+uint16_t
+fw_cfg_read_i16(uint16_t cmd)
+{
+ char buf[sizeof(uint16_t)];
+
+ fw_cfg_read(cmd, buf, sizeof(uint16_t));
+
+ return __le16_to_cpu(*(uint16_t *)buf);
+}
+
+void
+fw_cfg_init(void)
+{
+#if defined(CONFIG_SPARC32)
+ fw_cfg_cmd = (void *)map_io(CONFIG_FW_CFG_ADDR, 2);
+ fw_cfg_data = (uint8_t *)fw_cfg_cmd + 2;
+#elif defined(CONFIG_SPARC64)
+ // Nothing for the port version
+#elif defined(CONFIG_PPC)
+ fw_cfg_cmd = (void *)CONFIG_FW_CFG_ADDR;
+ fw_cfg_data = (void *)(CONFIG_FW_CFG_ADDR + 2);
+#endif
+}
Modified: openbios-devel/drivers/obio.c
===================================================================
--- openbios-devel/drivers/obio.c 2009-01-30 07:44:48 UTC (rev 431)
+++ openbios-devel/drivers/obio.c 2009-01-31 08:49:16 UTC (rev 432)
@@ -646,39 +646,6 @@
for (;;);
}
-static volatile uint16_t *fw_cfg_cmd;
-static volatile uint8_t *fw_cfg_data;
-
-static void
-fw_cfg_read(uint16_t cmd, char *buf, unsigned int nbytes)
-{
- unsigned int i;
-
- *fw_cfg_cmd = cmd;
- for (i = 0; i < nbytes; i++)
- buf[i] = *fw_cfg_data;
-}
-
-static uint32_t
-fw_cfg_read_i32(uint16_t cmd)
-{
- char buf[sizeof(uint32_t)];
-
- fw_cfg_read(cmd, buf, sizeof(uint32_t));
-
- return __le32_to_cpu(*(uint32_t *)buf);
-}
-
-static uint16_t
-fw_cfg_read_i16(uint16_t cmd)
-{
- char buf[sizeof(uint16_t)];
-
- fw_cfg_read(cmd, buf, sizeof(uint16_t));
-
- return __le16_to_cpu(*(uint16_t *)buf);
-}
-
static uint8_t qemu_uuid[16];
static void
@@ -710,8 +677,7 @@
fword("finish-device");
- fw_cfg_cmd = map_io(CFG_ADDR, CFG_SIZE);
- fw_cfg_data = (uint8_t *)fw_cfg_cmd + 2;
+ fw_cfg_init();
fw_cfg_read(FW_CFG_SIGNATURE, buf, 4);
buf[4] = '\0';
Modified: openbios-devel/include/openbios/fw_cfg.h
===================================================================
--- openbios-devel/include/openbios/fw_cfg.h 2009-01-30 07:44:48 UTC (rev 431)
+++ openbios-devel/include/openbios/fw_cfg.h 2009-01-31 08:49:16 UTC (rev 432)
@@ -30,4 +30,12 @@
#endif /* NO_QEMU_PROTOS */
+#ifndef NO_OPENBIOS_PROTOS
+void fw_cfg_read(uint16_t cmd, char *buf, unsigned int nbytes);
+uint64_t fw_cfg_read_i64(uint16_t cmd);
+uint32_t fw_cfg_read_i32(uint16_t cmd);
+uint16_t fw_cfg_read_i16(uint16_t cmd);
+void fw_cfg_init(void);
+#endif /* NO_OPENBIOS_PROTOS */
+
#endif
10 years, 10 months
r431 - in openbios-devel: drivers include/openbios
by svn@openbios.org
Author: laurent
Date: 2009-01-30 08:44:48 +0100 (Fri, 30 Jan 2009)
New Revision: 431
Modified:
openbios-devel/drivers/ide.c
openbios-devel/drivers/macio.c
openbios-devel/include/openbios/drivers.h
Log:
Add mac-io IDE driver
Modified: openbios-devel/drivers/ide.c
===================================================================
--- openbios-devel/drivers/ide.c 2009-01-29 19:56:41 UTC (rev 430)
+++ openbios-devel/drivers/ide.c 2009-01-30 07:44:48 UTC (rev 431)
@@ -1294,30 +1294,14 @@
static void
ob_ide_ctrl_initialize(int *idx)
{
- int len, props[6];
phandle_t ph=get_cur_dev();
- char *idename;
- struct ide_channel *chan;
/* set device type */
push_str(DEV_TYPE);
fword("device-type");
- idename=get_property(ph, "name", &len);
- chan = ide_seek_channel(idename);
-
- /* Create interrupt properties. */
- props[0]=14; props[1]=0;
- set_property(ph, "interrupts", (char *)&props, 2*sizeof(int));
-
set_int_property(ph, "#address-cells", 1);
set_int_property(ph, "#size-cells", 0);
-
- props[0] = __cpu_to_be32(chan->io_regs[0]);
- props[1] = __cpu_to_be32(1); props[2] = __cpu_to_be32(8);
- props[3] = __cpu_to_be32(chan->io_regs[8]);
- props[4] = __cpu_to_be32(1); props[5] = __cpu_to_be32(2);
- set_property(ph, "reg", (char *)&props, 6*sizeof(int));
}
static void
@@ -1378,6 +1362,7 @@
struct ide_channel *chan;
int io_ports[IDE_MAX_CHANNELS];
int ctl_ports[IDE_MAX_CHANNELS];
+ cell props[6];
io_ports[0] = io_port0;
ctl_ports[0] = ctl_port0 + 2;
@@ -1433,6 +1418,19 @@
snprintf(nodebuff, sizeof(nodebuff), "%s/" DEV_NAME, path,
current_channel);
REGISTER_NAMED_NODE(ob_ide_ctrl, nodebuff);
+
+ dnode = find_dev(nodebuff);
+
+ props[0]=14; props[1]=0;
+ set_property(dnode, "interrupts",
+ (char *)&props, 2*sizeof(cell));
+
+ props[0] = __cpu_to_be32(chan->io_regs[0]);
+ props[1] = __cpu_to_be32(1); props[2] = __cpu_to_be32(8);
+ props[3] = __cpu_to_be32(chan->io_regs[8]);
+ props[4] = __cpu_to_be32(1); props[5] = __cpu_to_be32(2);
+ set_property(dnode, "reg", (char *)&props, 6*sizeof(cell));
+
#ifdef CONFIG_DEBUG_IDE
printk(DEV_NAME": [io ports 0x%x-0x%x,0x%x]\n",
current_channel, chan->io_regs[0],
@@ -1486,3 +1484,177 @@
return 0;
}
+
+#if defined(CONFIG_DRIVER_MACIO)
+static unsigned char
+macio_ide_inb(struct ide_channel *chan, unsigned int port)
+{
+ return in_8((unsigned char*)(chan->mmio + (port << 4)));
+}
+
+static void
+macio_ide_outb(struct ide_channel *chan, unsigned char data, unsigned int port)
+{
+ out_8((unsigned char*)(chan->mmio + (port << 4)), data);
+}
+
+static void
+macio_ide_insw(struct ide_channel *chan,
+ unsigned int port, unsigned char *addr, unsigned int count)
+{
+ _insw((uint16_t*)(chan->mmio + (port << 4)), addr, count);
+}
+
+static void
+macio_ide_outsw(struct ide_channel *chan,
+ unsigned int port, unsigned char *addr, unsigned int count)
+{
+ _outsw((uint16_t*)(chan->mmio + (port << 4)), addr, count);
+}
+
+#define MACIO_IDE_OFFSET 0x00020000
+#define MACIO_IDE_SIZE 0x00001000
+
+int macio_ide_init(const char *path, uint32_t addr, int nb_channels)
+{
+ int i, j;
+ char nodebuff[128];
+ phandle_t dnode;
+ cell props[8];
+ struct ide_channel *chan;
+
+ for (i = 0; i < nb_channels; i++, current_channel++) {
+
+ chan = malloc(sizeof(struct ide_channel));
+
+ snprintf(chan->name, sizeof(chan->name),
+ DEV_NAME, current_channel);
+
+ chan->mmio = addr + MACIO_IDE_OFFSET + i * MACIO_IDE_SIZE;
+
+ chan->obide_inb = macio_ide_inb;
+ chan->obide_insw = macio_ide_insw;
+ chan->obide_outb = macio_ide_outb;
+ chan->obide_outsw = macio_ide_outsw;
+
+ chan->selected = -1;
+
+ /*
+ * assume it's there, if not io port dead check will clear
+ */
+ chan->present = 1;
+
+ for (j = 0; j < 2; j++) {
+ chan->drives[j].present = 0;
+ chan->drives[j].unit = j;
+ chan->drives[j].channel = chan;
+ /* init with a decent value */
+ chan->drives[j].bs = 512;
+
+ chan->drives[j].nr = i * 2 + j;
+ }
+
+ ob_ide_probe(chan);
+
+ if (!chan->present) {
+ free(chan);
+ continue;
+ }
+
+ ide_add_channel(chan);
+
+ ob_ide_identify_drives(chan);
+
+ snprintf(nodebuff, sizeof(nodebuff), "%s/" DEV_NAME, path,
+ current_channel);
+ REGISTER_NAMED_NODE(ob_ide_ctrl, nodebuff);
+
+ dnode = find_dev(nodebuff);
+
+ set_property(dnode, "compatible", "heathrow-ata", 13);
+
+ props[0] = 0x00000526;
+ props[1] = 0x00000085;
+ props[2] = 0x00000025;
+ props[3] = 0x00000025;
+ props[4] = 0x00000025;
+ props[5] = 0x00000000;
+ props[6] = 0x00000000;
+ props[7] = 0x00000000;
+ OLDWORLD(set_property(dnode, "AAPL,pio-timing",
+ (char *)&props, 8*sizeof(cell)));
+
+ props[0] = 0x0000000d;
+ props[1] = 0x00000000;
+ set_property(dnode, "interrupts",
+ (char *)&props, 2*sizeof(cell));
+ OLDWORLD(set_property(dnode, "AAPL,interrupts",
+ (char *)&props, 2*sizeof(cell)));
+
+ props[0] = MACIO_IDE_OFFSET + i * MACIO_IDE_SIZE;
+ props[1] = MACIO_IDE_SIZE;
+ props[2] = 0x00008b00 + i * 0x0200;
+ props[3] = 0x0200;
+ set_property(dnode, "reg", (char *)&props, 4*sizeof(cell));
+
+ props[0] = addr + MACIO_IDE_OFFSET + i * MACIO_IDE_SIZE;
+ props[1] = addr + 0x00008b00 + i * 0x0200;
+ OLDWORLD(set_property(dnode, "AAPL,address",
+ (char *)&props, 2*sizeof(cell)));
+
+ props[0] = 0;
+ OLDWORLD(set_property(dnode, "AAPL,bus-id", (char*)props,
+ 1 * sizeof(cell)));
+#ifdef CONFIG_DEBUG_IDE
+ printk(DEV_NAME": [io ports 0x%lx]\n",
+ current_channel, chan->mmio);
+#endif
+
+ for (j = 0; j < 2; j++) {
+ struct ide_drive *drive = &chan->drives[j];
+ const char *media = "UNKNOWN";
+
+ if (!drive->present)
+ continue;
+
+#ifdef CONFIG_DEBUG_IDE
+ printk(" drive%d [ATA%s ", j,
+ drive->type == ide_type_atapi ? "PI" : "");
+#endif
+ switch (drive->media) {
+ case ide_media_floppy:
+ media = "floppy";
+ break;
+ case ide_media_cdrom:
+ media = "cdrom";
+ break;
+ case ide_media_optical:
+ media = "mo";
+ break;
+ case ide_media_disk:
+ media = "disk";
+ break;
+ }
+#ifdef CONFIG_DEBUG_IDE
+ printk("%s]: %s\n", media, drive->model);
+#endif
+ snprintf(nodebuff, sizeof(nodebuff),
+ "%s/" DEV_NAME "/%s", path, current_channel,
+ media);
+ REGISTER_NAMED_NODE(ob_ide, nodebuff);
+ dnode = find_dev(nodebuff);
+ set_int_property(dnode, "reg", j);
+
+ /* create aliases */
+
+ set_ide_alias(nodebuff);
+ if (drive->media == ide_media_cdrom)
+ set_cd_alias(nodebuff);
+ if (drive->media == ide_media_disk)
+ set_hd_alias(nodebuff);
+ }
+ }
+
+ return 0;
+}
+#endif /* CONFIG_DRIVER_MACIO */
Modified: openbios-devel/drivers/macio.c
===================================================================
--- openbios-devel/drivers/macio.c 2009-01-29 19:56:41 UTC (rev 430)
+++ openbios-devel/drivers/macio.c 2009-01-30 07:44:48 UTC (rev 431)
@@ -14,6 +14,7 @@
#include "libc/byteorder.h"
#include "libc/vsprintf.h"
+#include "openbios/drivers.h"
#include "macio.h"
#include "cuda.h"
#include "escc.h"
@@ -112,4 +113,5 @@
cuda_init(path, addr);
macio_nvram_init(path, addr);
escc_init(path, addr);
+ macio_ide_init(path, addr, 1);
}
Modified: openbios-devel/include/openbios/drivers.h
===================================================================
--- openbios-devel/include/openbios/drivers.h 2009-01-29 19:56:41 UTC (rev 430)
+++ openbios-devel/include/openbios/drivers.h 2009-01-30 07:44:48 UTC (rev 431)
@@ -47,6 +47,7 @@
/* drivers/ide.c */
int ob_ide_init(const char *path, uint32_t io_port0, uint32_t ctl_port0,
uint32_t io_port1, uint32_t ctl_port1);
+int macio_ide_init(const char *path, uint32_t addr, int nb_channels);
#endif
#ifdef CONFIG_DRIVER_ESP
/* drivers/esp.c */
10 years, 10 months
Re: [OpenBIOS] [coreboot] OpenBIOS SVN r416 breaks coreboot-v3
by Mark Cave-Ayland
Myles Watson wrote:
> Yes. qemu 0.9.1 works with v2+OpenBIOS and v3+OpenBIOS, but the latest qemu
> doesn't. The latest qemu works with v2 or v3 +OpenBIOS r186, so it looks
> like an interaction between OpenBIOS and qemu.
>
> HTH,
> Myles
Okay, I think I found out what is happening. With coreboot-v3 and
OpenBIOS SVN then the base address for I/O devices is set to 0x400 which
causes subsequent hardware to be mapped higher. The backtrace on the
hw_error() line shows this:
Breakpoint 1, register_ioport_write (start=1296, length=1, size=1,
func=0x42b105 <ne2000_asic_ioport_write>, opaque=0xc9abb8)
at /home/build/src/qemu/trunk/vl.c:392
392 hw_error("register_ioport_write: invalid opaque:
(start 0x%x, length 0x%x, address 0x%x)", start, length, i);
(gdb) print/x start
$1 = 0x510
(gdb) bt
#0 register_ioport_write (start=1296, length=1, size=1, func=0x42b105
<ne2000_asic_ioport_write>, opaque=0xc9abb8)
at /home/build/src/qemu/trunk/vl.c:392
#1 0x000000000042bc6b in ne2000_map (pci_dev=0xc9a990, region_num=0,
addr=1280, size=256, type=1)
at /home/build/src/qemu/trunk/hw/ne2000.c:771
#2 0x0000000000414548 in pci_update_mappings (d=0xc9a990) at
/home/build/src/qemu/trunk/hw/pci.c:301
#3 0x0000000000414706 in pci_default_write_config (d=0xc9a990,
address=16, val=1281, len=4) at /home/build/src/qemu/trunk/hw/pci.c:362
#4 0x00000000004148d7 in pci_data_write (opaque=0xc281c0,
addr=2147489808, val=1281, len=4) at /home/build/src/qemu/trunk/hw/pci.c:467
#5 0x0000000000483e31 in pci_host_data_writel (opaque=0xc281a0,
addr=3324, val=1281) at /home/build/src/qemu/trunk/hw/pci_host.h:74
#6 0x0000000000406818 in ioport_write (index=2, address=3324,
data=1281) at /home/build/src/qemu/trunk/vl.c:298
#7 0x0000000000406c0d in cpu_outl (env=0xc10650, addr=3324, val=1281)
at /home/build/src/qemu/trunk/vl.c:438
#8 0x00000000005248fe in helper_outl (port=3324, data=1281) at
/home/build/src/qemu/trunk/target-i386/op_helper.c:582
#9 0x0000000040e5d11c in ?? ()
#10 0x00000000000000f4 in ?? ()
#11 0x0000000006e64a20 in ?? ()
#12 0x0000000006f687ab in ?? ()
#13 0x0000000040e5ce30 in ?? ()
#14 0x0000000040e603c8 in ?? ()
#15 0x0000000008000000 in ?? ()
#16 0x00007fff4ef701b0 in ?? ()
#17 0x00000000004fcd9c in tb_set_jmp_target (tb=0x406670, n=0,
addr=2361183241434822607) at ../exec-all.h:240
#18 0x000000000040c64f in main_loop () at
/home/build/src/qemu/trunk/vl.c:3737
#19 0x000000000040f772 in main (argc=6, argv=0x7fff4ef70bf8,
envp=0x7fff4ef70c30) at /home/build/src/qemu/trunk/vl.c:5712
So in other words, with current OpenBIOS SVN the I/O space for the
network card requires more than 0x110 bytes from 0x400 and hence when
qemu tries to map I/O address 0x510 (which is already mapped to the BIOS
I/O port), qemu reports the error and panics.
My quick fix was to apply the following patch to openbios in order to
raise the io_base further from 0x400 to 0x520 so that no devices appear
below the BIOS_IO_PORT address of 0x510:
--- drivers/pci.c (revision 428)
+++ drivers/pci.c (working copy)
@@ -762,7 +762,7 @@
mem_base = arch->mem_base;
/* I/O ports under 0x400 are used by devices mapped at fixed
location. */
- io_base = arch->io_base + 0x400;
+ io_base = arch->io_base + 0x520;
path = strdup("");
for (bus = 0; bus<0x100; bus++) {
ob_scan_pci_bus(bus, &mem_base, &io_base, &path);
With this patch applied, I am pleased to report that qemu can
successfully boot openbios once again. Can anyone with more knowledge
comment on whether this is an adequate solution or not?
ATB,
Mark.
--
Mark Cave-Ayland
Sirius Corporation - The Open Source Experts
http://www.siriusit.co.uk
T: +44 870 608 0063
10 years, 10 months
[PATCH] Fix fs->vol_name handling
by Stefan Assmann
Subject: Fix fs->vol_name handling
This patch checks wether fs->vol_name exists and handles the
case where it doesn't exist. That fixes the lockup that occurs
when trying to run qemu-system-ppc -cdrom <iso> -boot d
Signed-off-by: Stefan Assmann <sassmann(a)suse.de>
Index: modules/filesystems.c
===================================================================
--- modules/filesystems.c (revision 418)
+++ modules/filesystems.c (working copy)
@@ -145,8 +145,12 @@
if( !mi->volname )
mi->volname = malloc( VOLNAME_SIZE );
-
- ret = mi->fs->vol_name( mi->fs, mi->volname, VOLNAME_SIZE );
+ /* handle case where there is no vol_name function in fs */
+ if( !mi->fs->vol_name ) {
+ mi->volname[0] = '\0';
+ ret = mi->volname;
+ } else
+ ret = mi->fs->vol_name( mi->fs, mi->volname, VOLNAME_SIZE );
PUSH( (ucell)ret );
}
Stefan
--
Stefan Assmann | SUSE LINUX Products GmbH
Software Engineer | Maxfeldstr. 5, D-90409 Nuernberg
Mail: sassmann(a)suse.de | GF: Markus Rex, HRB 16746 (AG Nuernberg)
10 years, 10 months
r430 - openbios-devel/modules
by svn@openbios.org
Author: blueswirl
Date: 2009-01-29 20:56:41 +0100 (Thu, 29 Jan 2009)
New Revision: 430
Modified:
openbios-devel/modules/filesystems.c
Log:
Fix fs->vol_name handling
This patch checks wether fs->vol_name exists and handles the
case where it doesn't exist. That fixes the lockup that occurs
when trying to run qemu-system-ppc -cdrom <iso> -boot d
Signed-off-by: Stefan Assmann <sassmann(a)suse.de>
Modified: openbios-devel/modules/filesystems.c
===================================================================
--- openbios-devel/modules/filesystems.c 2009-01-29 10:51:25 UTC (rev 429)
+++ openbios-devel/modules/filesystems.c 2009-01-29 19:56:41 UTC (rev 430)
@@ -145,8 +145,12 @@
if( !mi->volname )
mi->volname = malloc( VOLNAME_SIZE );
-
- ret = mi->fs->vol_name( mi->fs, mi->volname, VOLNAME_SIZE );
+ /* handle case where there is no vol_name function in fs */
+ if( !mi->fs->vol_name ) {
+ mi->volname[0] = '\0';
+ ret = mi->volname;
+ } else
+ ret = mi->fs->vol_name( mi->fs, mi->volname, VOLNAME_SIZE );
PUSH( (ucell)ret );
}
10 years, 10 months