Hello !
Here are a few patches for QEMU and OpenBIOS, about SPARC32, grouped
into two
diffs:
OpenBIOS : http://temlib.org/pub/openbios_nn.diff
QEMU : http://temlib.org/pub/qemu_nn.diff
Changes:
OpenBIOS
* SparcStation10/20 mode fix (drivers/iommu.c, drivers/sbus.c)
- TCX properties (drivers/tcx.fs)
- next-property (forth/device/property.fs)
- Keyboard property (drivers/escc.c)
+ Memory allocation/deallocation (arch/sparc32/lib.c,
arch/sparc32/ofmem_sparc32.c,
libopenbios/ofmem_common.c,
arch/sparc32/romvec.h)
+ a.out file loading (libopenbios/aout_load.c)
+ Dummy TICK counter (arch/sparc32/romvec.c)
+ Interrupt/Timer properties (include/drivers/drivers.h,
forth/device/property.fs,
drivers/obio.c)
QEMU
- TCX Hardware acceleration : Blitter, Stippler, HW cursor
(hw/display/tcx.c,
hw/sparc/sun4m.c)
- "!TC on DATA XFER" warning under NetBSD (hw/scsi/esp.c)
+ Timer Run/Stop bit correction (hw/timer/slavio_timer.c)
TCX emulation with acceleration seems good enough, although it is
incomplete and
it is probably impossible to implement the 24bits mode accurately and
efficiently in QEMU.
I will post each patch separately on the two mailing lists. TCX patches
should be synchronised : OpenBIOS cannot advertise an hardware cursor until
it is actually implemented.
One more thing.
After NetBSD and TCX acceleration, I tried NextSTEP, which needs the
patches marked + above.
Alas, this is not enough to make it run.
Maybe it is because QEMU SCSI disk and ESP emulation are too fast.
Olivier
Author: mcayland
Date: Mon Jan 13 10:47:04 2014
New Revision: 1256
URL: http://tracker.coreboot.org/trac/openbios/changeset/1256
Log:
SPARC32: move romvec initialisation out of go() and into a separate function
The go word should just execute the current program context, otherwise the
romvec contents will get altered if called by a client.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland(a)ilande.co.uk>
Modified:
trunk/openbios-devel/arch/sparc32/boot.c
Modified: trunk/openbios-devel/arch/sparc32/boot.c
==============================================================================
--- trunk/openbios-devel/arch/sparc32/boot.c Mon Jan 13 10:46:59 2014 (r1255)
+++ trunk/openbios-devel/arch/sparc32/boot.c Mon Jan 13 10:47:04 2014 (r1256)
@@ -20,26 +20,18 @@
char boot_device;
const void *romvec;
-void go(void)
+
+static void setup_romvec(void)
{
- ucell address, type, size;
- int image_retval = 0, intprop, proplen, target, device;
+ /* SPARC32 is slightly unusual in that before invoking any loaders, a romvec array
+ needs to be set up to pass certain parameters using a C struct. Hence this function
+ extracts the relevant boot information and places it in obp_arg. */
+
+ int intprop, proplen, target, device;
phandle_t chosen;
char *prop, *id, *name;
static char bootpathbuf[128], bootargsbuf[128], buf[128];
- /* Get the entry point and the type (see forth/debugging/client.fs) */
- feval("saved-program-state >sps.entry @");
- address = POP();
- feval("saved-program-state >sps.file-type @");
- type = POP();
- feval("saved-program-state >sps.file-size @");
- size = POP();
-
- /* SPARC32 is slightly unusual in that before invoking any loaders, a romvec array
- needs to be set up to pass certain parameters using a C struct. Hence this section
- extracts the relevant boot information and places it in obp_arg. */
-
/* Get the stdin and stdout paths */
chosen = find_dev("/chosen");
intprop = get_int_property(chosen, "stdin", &proplen);
@@ -140,7 +132,24 @@
obp_arg.argv[1] = bootargsbuf;
}
-
+}
+
+
+void go(void)
+{
+ ucell address, type, size;
+ int image_retval = 0;
+
+ /* Get the entry point and the type (see forth/debugging/client.fs) */
+ feval("saved-program-state >sps.entry @");
+ address = POP();
+ feval("saved-program-state >sps.file-type @");
+ type = POP();
+ feval("saved-program-state >sps.file-size @");
+ size = POP();
+
+ setup_romvec();
+
printk("\nJumping to entry point " FMT_ucellx " for type " FMT_ucellx "...\n", address, type);
switch (type) {
Author: mcayland
Date: Mon Jan 13 10:46:59 2014
New Revision: 1255
URL: http://tracker.coreboot.org/trac/openbios/changeset/1255
Log:
OFMEM: allocate retained memory top downwards
Not only does this match the behaviour of the other routines, but it also
fixes a bug whereby the first free physical memory location was 0x0 and
so page zero was being returned for use by SUNW,retain clients. Due to the
way in which PCI/ISA devices are mapped in QEMU (e.g. IDE ioports) then
clients could inadvertantly start writing to device registers.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland(a)ilande.co.uk>
Modified:
trunk/openbios-devel/libopenbios/ofmem_common.c
Modified: trunk/openbios-devel/libopenbios/ofmem_common.c
==============================================================================
--- trunk/openbios-devel/libopenbios/ofmem_common.c Mon Jan 13 10:46:56 2014 (r1254)
+++ trunk/openbios-devel/libopenbios/ofmem_common.c Mon Jan 13 10:46:59 2014 (r1255)
@@ -599,7 +599,7 @@
" align=" FMT_ucellx "\n",
phys, size, align);
- retain_phys = ofmem_claim_phys_( phys, size, align, 0, get_ram_size(), 0 );
+ retain_phys = ofmem_claim_phys_( phys, size, align, 0, get_ram_size(), 1 /* reverse */ );
/* Add to the retain_phys_range list */
retained->retain_phys_range[retained->numentries].next = NULL;
Author: mcayland
Date: Mon Jan 13 10:46:56 2014
New Revision: 1254
URL: http://tracker.coreboot.org/trac/openbios/changeset/1254
Log:
fcode_load.c: don't skip the FCode header when invoked via init-program
The FCode start address was set to bypass the FCode header rather than just
executing the first word which does this automatically (and may even one
day verify the payload contents/length).
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland(a)ilande.co.uk>
Modified:
trunk/openbios-devel/libopenbios/fcode_load.c
Modified: trunk/openbios-devel/libopenbios/fcode_load.c
==============================================================================
--- trunk/openbios-devel/libopenbios/fcode_load.c Mon Jan 13 10:46:53 2014 (r1253)
+++ trunk/openbios-devel/libopenbios/fcode_load.c Mon Jan 13 10:46:56 2014 (r1254)
@@ -94,7 +94,6 @@
{
/* If the payload is Fcode then we execute it immediately */
ucell address;
- uint8_t fcode_header[8];
fword("load-base");
address = POP();
@@ -104,7 +103,7 @@
return;
}
- PUSH(address + sizeof(fcode_header));
+ PUSH(address);
PUSH(1);
fword("byte-load");
}
Author: mcayland
Date: Mon Jan 13 10:46:51 2014
New Revision: 1252
URL: http://tracker.coreboot.org/trac/openbios/changeset/1252
Log:
feval.fs: enable OpenBIOS to recover correctly from invalid FCode
If invalid FCode has been executed, the FCode interpreter may have exited
whilst still in compile mode, causing OpenBIOS internals to become corrupted.
Detect this condition and switch back to immediate mode to prevent subsequent
random internal errors within OpenBIOS.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland(a)ilande.co.uk>
Modified:
trunk/openbios-devel/forth/device/feval.fs
Modified: trunk/openbios-devel/forth/device/feval.fs
==============================================================================
--- trunk/openbios-devel/forth/device/feval.fs Mon Jan 13 10:46:46 2014 (r1251)
+++ trunk/openbios-devel/forth/device/feval.fs Mon Jan 13 10:46:51 2014 (r1252)
@@ -49,6 +49,15 @@
,
then
fcode-end @ until
+
+ \ If we've executed incorrect FCode we may have reached the end of the FCode
+ \ program but still be in compile mode. Make sure that if this has happened
+ \ then we switch back to immediate mode to prevent internal OpenBIOS errors.
+ tmp-comp-depth @ -1 <> if
+ -1 tmp-comp-depth !
+ tmp-comp-buf @ @ here!
+ 0 state !
+ then
;
: byte-load ( addr xt -- )
Author: mcayland
Date: Mon Jan 13 10:46:46 2014
New Revision: 1251
URL: http://tracker.coreboot.org/trac/openbios/changeset/1251
Log:
ciface.fs: enable test-method for all architectures
Currently it is only compiled for PPC, but at least *BSD on SPARC64 try to
make use of it too.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland(a)ilande.co.uk>
Modified:
trunk/openbios-devel/forth/system/ciface.fs
Modified: trunk/openbios-devel/forth/system/ciface.fs
==============================================================================
--- trunk/openbios-devel/forth/system/ciface.fs Mon Jan 13 10:46:43 2014 (r1250)
+++ trunk/openbios-devel/forth/system/ciface.fs Mon Jan 13 10:46:46 2014 (r1251)
@@ -315,17 +315,12 @@
outer-interpreter
;
-[IFDEF] CONFIG_PPC
-\ PowerPC Microprocessor CHRP binding
-\ 10.5.2. Client Interface
-
( cstring-method phandle -- missing )
: test-method
swap dup cstrlen rot
find-method 0= if -1 else drop 0 then
;
-[THEN]
finish-device
device-end