Author: wmb Date: 2008-09-02 07:42:53 +0200 (Tue, 02 Sep 2008) New Revision: 913
Modified: clients/lib/callofw.c clients/lib/x86/makefile cpu/x86/pc/neptune/fw.bth cpu/x86/pc/reenter.fth Log: Neptune - allow rerunning ispVME without rebooting.
Modified: clients/lib/callofw.c =================================================================== --- clients/lib/callofw.c 2008-09-02 02:45:16 UTC (rev 912) +++ clients/lib/callofw.c 2008-09-02 05:42:53 UTC (rev 913) @@ -6,14 +6,10 @@ */
#include <stdarg.h> -#include <asm/callofw.h> -#include <linux/types.h> -#include <linux/spinlock.h> +typedef unsigned long u32;
-u32 (*call_firmware)(u32 *); +extern u32 call_firmware(u32 *);
-static DEFINE_SPINLOCK(prom_lock); - #define MAXARGS 20 int callofw(char *name, int numargs, int numres, ...) { @@ -24,9 +20,6 @@ int *intp; unsigned long flags;
- if (call_firmware == NULL) - return -1; - argarray[0] = (u32)name; argarray[1] = numargs; argarray[2] = numres; @@ -38,9 +31,7 @@ while (numargs--) argarray[argnum++] = va_arg(ap, int);
- spin_lock_irqsave(&prom_lock, flags); retval = call_firmware(argarray); - spin_unlock_irqrestore(&prom_lock, flags);
if (retval == 0) { while (numres--) {
Modified: clients/lib/x86/makefile =================================================================== --- clients/lib/x86/makefile 2008-09-02 02:45:16 UTC (rev 912) +++ clients/lib/x86/makefile 2008-09-02 05:42:53 UTC (rev 913) @@ -3,51 +3,23 @@ # -fno-builtin has the effect of suppressing some warnings about # functions that conflict with gcc builtins CC=gcc -CFLAGS=-g -m32 -fno-builtin -fno-stack-protector +CFLAGS=-g -m32 -fno-builtin -fno-stack-limit -fno-stack-protector
all: libobp.a hello hello.elf start.o
# Create a library file containing all the library routines
-libobp.a: lib.o printf.o wrappers.o malloc.o strings.o printf.o debug.o main.o intprop.o regprop.o strprop.o mem.o - ar rcv libobp.a lib.o malloc.o wrappers.o strings.o printf.o debug.o main.o intprop.o regprop.o strprop.o mem.o +OBJS=lib.o printf.o wrappers.o malloc.o strings.o printf.o debug.o main.o intprop.o regprop.o strprop.o mem.o callofw.o + +libobp.a: ${OBJS} + ar rcv libobp.a ${OBJS} ranlib libobp.a
# Build machine-independent library routines
-main.o: ../main.c - ${CC} ${CFLAGS} -c ../main.c +%.o: ../%.c + ${CC} ${CFLAGS} -c $<
-lib.o: ../lib.c - ${CC} ${CFLAGS} -c ../lib.c - -printf.o: ../printf.c - ${CC} ${CFLAGS} -c ../printf.c - -debug.o: ../debug.c - ${CC} ${CFLAGS} -c ../debug.c - -strings.o: ../strings.c - ${CC} ${CFLAGS} -c ../strings.c - -mem.o: ../mem.c - ${CC} ${CFLAGS} -c ../mem.c - -intprop.o: ../intprop.c - ${CC} ${CFLAGS} -c ../intprop.c - -regprop.o: ../regprop.c - ${CC} ${CFLAGS} -c ../regprop.c - -strprop.o: ../strprop.c - ${CC} ${CFLAGS} -c ../strprop.c - -wrappers.o: ../wrappers.c - ${CC} ${CFLAGS} -c ../wrappers.c - -malloc.o: ../malloc.c - ${CC} ${CFLAGS} -c ../malloc.c - # Build processor-specific startup code and call gateway
start.o: start.s
Modified: cpu/x86/pc/neptune/fw.bth =================================================================== --- cpu/x86/pc/neptune/fw.bth 2008-09-02 02:45:16 UTC (rev 912) +++ cpu/x86/pc/neptune/fw.bth 2008-09-02 05:42:53 UTC (rev 913) @@ -165,10 +165,11 @@ fload ${BP}/ofw/elf/elf.fth fload ${BP}/ofw/elf/elfdebug.fth [ifdef] virtual-mode -: (elf-map-in) ( va size -- ) swap 1 -rot allocate-aligned drop ; -\ Depends on the assumption that physical memory is mapped 1:1 already -\ : (elf-map-in) ( va size -- ) 0 mem-claim drop ; -' (elf-map-in) is elf-map-in +\ This version dynamically allocates physical memory +\ : (elf-map-in) ( va size -- ) swap 1 -rot allocate-aligned drop ; + +\ This version depends on the assumption that physical memory is mapped 1:1 already +: (elf-map-in) ( va size -- ) 2drop ; [else] : (elf-map-in) ( va size -- ) 2drop ; [then] @@ -178,6 +179,7 @@ \ Reboot and re-entry code fload ${BP}/cpu/x86/pc/reboot.fth \ Restart the client program fload ${BP}/cpu/x86/pc/reenter.fth \ Various entries into Forth +true to client-rerun?
headerless [ifdef] virtual-mode @@ -198,8 +200,9 @@
\ The LPC FLASH chips decode several addresses below the FLASH "memory" array, \ for "registers" used for programming and access to general purpose inputs. -\ The FPGA programming program wants to access the GPI register at virtual -\ address = physical address, so we pre-claim that range of virtual addresses. +\ We pre-claim that range of virtual addresses just in case someone needs to +\ access the LPC device with virtual-address = physical address. (OFW and +\ ispVME both use dynamically-mapped virtual addresses for that region.)
: claim-lpc ( -- ) (initial-claim) @@ -404,13 +407,8 @@ lpc-gpi0-pa value lpc-gpi-pa
: vme ( -- ) - ." Running Lattice programmer " - - lpc-gpi-pa lpc-gpi-pa h# 100 -1 mmu-map \ verbose-cif " rom:\isp u:\neptune.vme" $boot - - lpc-gpi-pa h# 100 mmu-unmap ;
fload ${BP}/cpu/x86/pc/neptune/versions.fth
Modified: cpu/x86/pc/reenter.fth =================================================================== --- cpu/x86/pc/reenter.fth 2008-09-02 02:45:16 UTC (rev 912) +++ cpu/x86/pc/reenter.fth 2008-09-02 05:42:53 UTC (rev 913) @@ -28,6 +28,8 @@
\ Temporary hacks until we implement these functions correctly
+0 value client-rerun? + defer user-interface ' quit to user-interface also client-services definitions \ " reenter.fth: Implement 'exit' client service correctly" ?reminder @@ -38,6 +40,7 @@ " restore" stdout @ ['] $call-method catch if 3drop then " restore" stdin @ ['] $call-method catch if 3drop then
+ client-rerun? 0= to already-go? user-interface ; : enter ( -- ) interact ;