* Patch by Hans-Joerg Frieden, 06 Dec 2002
  Fix misc problems with AmigaOne support

* Patch by Chris Hallinan, 3 Dec 2002:
  minor cleanup to the MPC8245 EPIC driver

* Patch by Pierre Aubert , 28 Nov 2002
  Add support for external (SIU) interrupts on MPC8xx

* Patch by Pierre Aubert , 28 Nov 2002
  Fix nested syscalls bug in standalone applications

* Patch by David Müller, 27 Nov 2002:
  fix output of "pciinfo" command for CardBus bridge devices.

* Fix bug in TQM8260 board detection - boards got stuck when board ID
  was not readable
diff --git a/board/MAI/AmigaOneG3SE/AmigaOneG3SE.c b/board/MAI/AmigaOneG3SE/AmigaOneG3SE.c
index 0cf5388..9d5c24e 100644
--- a/board/MAI/AmigaOneG3SE/AmigaOneG3SE.c
+++ b/board/MAI/AmigaOneG3SE/AmigaOneG3SE.c
@@ -76,9 +76,8 @@
 
 int checkboard (void)
 {
-	printf ("AmigaOneG3SE\n");
-
-	return 1;
+	printf ("Board: AmigaOneG3SE\n");
+	return 0;
 }
 
 long initdram (int board_type)
@@ -88,9 +87,9 @@
 
 
 
-void after_reloc (ulong dest_addr)
+void after_reloc (ulong dest_addr, gd_t *gd)
 {
-	DECLARE_GLOBAL_DATA_PTR;
+/* HJF:	DECLARE_GLOBAL_DATA_PTR; */
 
 	board_init_r (gd, dest_addr);
 }
diff --git a/board/MAI/AmigaOneG3SE/Makefile b/board/MAI/AmigaOneG3SE/Makefile
index 7271746..785f01f 100644
--- a/board/MAI/AmigaOneG3SE/Makefile
+++ b/board/MAI/AmigaOneG3SE/Makefile
@@ -35,13 +35,16 @@
 
 OBJS	= $(COBJS) $(AOBJS) 
 
-## FIXME !!!
-# EMUOBJS = ../bios_emulator/scitech/src/x86emu/*.o
+EMUDIR  = ../bios_emulator/scitech/src/x86emu/
+EMUOBJ  = $(EMUDIR)decode.o $(EMUDIR)ops2.o $(EMUDIR)fpu.o $(EMUDIR)prim_ops.o \
+		$(EMUDIR)ops.o $(EMUDIR)sys.o
+EMUSRC = $(EMUOBJ:.o=.c)
 
-
-$(LIB):	.depend $(OBJS) $(EMUOBJS)
+$(LIB):	.depend $(OBJS) $(EMUSRC) 
+	make libx86emu.a -C ../bios_emulator/scitech/src/x86emu -f makefile.uboot CROSS_COMPILE=$(CROSS_COMPILE)
 	-rm $(LIB)
-	$(AR) crv $@ $(OBJS) $(EMUOBJS)
+	$(AR) crv $@ $(OBJS) $(EMUOBJ)
+
 
 #########################################################################
 
diff --git a/board/MAI/AmigaOneG3SE/articiaS.c b/board/MAI/AmigaOneG3SE/articiaS.c
index af85444..5eddfc6 100644
--- a/board/MAI/AmigaOneG3SE/articiaS.c
+++ b/board/MAI/AmigaOneG3SE/articiaS.c
@@ -82,8 +82,9 @@
 
 long detect_sdram (uint8 * rom, int dimmNum, struct dimm_bank *banks)
 {
+    DECLARE_GLOBAL_DATA_PTR;
 	int dimm_address = (dimmNum == 0) ? SM_DIMM0_ADDR : SM_DIMM1_ADDR;
-	uint32 busclock = get_bus_freq (0);
+	uint32 busclock = gd->bus_clk;
 	uint32 memclock = busclock;
 	uint32 tmemclock = 1000000000 / (memclock / 100);
 	uint32 datawidth;
@@ -404,7 +405,7 @@
 	uint32 total_ram = 0;
 
 	struct dimm_bank banks[4];	/* FIXME: Move to initram */
-	uint32 busclock = get_bus_freq (0);
+	uint32 busclock = gd->bus_clk;
 	uint32 memclock = busclock;
 	uint32 reg32;
 	uint32 refresh_clocks;
diff --git a/board/MAI/AmigaOneG3SE/articiaS_pci.c b/board/MAI/AmigaOneG3SE/articiaS_pci.c
index 774c32d..2a7763d 100644
--- a/board/MAI/AmigaOneG3SE/articiaS_pci.c
+++ b/board/MAI/AmigaOneG3SE/articiaS_pci.c
@@ -26,7 +26,7 @@
 #include "memio.h"
 #include "articiaS.h"
 
-//#define ARTICIA_PCI_DEBUG
+#undef ARTICIA_PCI_DEBUG
 
 #ifdef  ARTICIA_PCI_DEBUG
 #define PRINTF(fmt,args...)     printf (fmt ,##args)
@@ -512,7 +512,11 @@
 	PRINTF("Searching for class 0x%x on bus %d\n", classes[classnr], busnr);
 	/* Find the first of this class on this bus */
 	dev = pci_hose_find_class(&articiaS_hose, busnr, classes[classnr], 0);
-	if (dev != ~0) break;
+	if (dev != ~0) 
+	{
+	    PRINTF("Found VGA Card at %02x:%02x:%02x\n", PCI_BUS(dev), PCI_DEV(dev), PCI_FUNC(dev));
+	    break;
+	}
 	busnr++;
 	if (busnr > articiaS_hose.last_busno)
 	{
@@ -552,7 +556,7 @@
     /*
      * Now try to run the bios
      */
-
+    PRINTF("Trying to run bios now\n");
     if (execute_bios(dev, gd->relocaddr))
     {
 	printf("OK\n");
diff --git a/board/MAI/AmigaOneG3SE/config.mk b/board/MAI/AmigaOneG3SE/config.mk
index 0537cd9..d7d0e6b 100644
--- a/board/MAI/AmigaOneG3SE/config.mk
+++ b/board/MAI/AmigaOneG3SE/config.mk
@@ -29,5 +29,5 @@
 
 TEXT_BASE = 0xfff00000
 
-PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -Wa,-mregnames -DEASTEREGG $(X86EMU) #-DDEBUG
+PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -Wa,-mregnames -DEASTEREGG $(X86EMU) -Dprintk=printf #-DDEBUG 
 
diff --git a/board/MAI/AmigaOneG3SE/video.c b/board/MAI/AmigaOneG3SE/video.c
index d0e366c..e80288b 100644
--- a/board/MAI/AmigaOneG3SE/video.c
+++ b/board/MAI/AmigaOneG3SE/video.c
@@ -474,13 +474,13 @@
 }
 #endif
 
-extern bd_t *bd_global;
 extern block_dev_desc_t * ide_get_dev(int dev);
 extern char version_string[];
 
 void video_banner(void)
 {
     block_dev_desc_t *ide;
+    DECLARE_GLOBAL_DATA_PTR;
     int i;
     char *s;
     int maxdev;
@@ -513,8 +513,8 @@
 	video_clear();
 	printf("%s\n\nCPU: ", version_string);
 	checkcpu();
-	printf("DRAM: %ld MB\n", bd_global->bi_memsize/(1024*1024));
-	printf("FSB: %ld MHz\n", bd_global->bi_busfreq/1000000);
+	printf("DRAM: %ld MB\n", gd->bd->bi_memsize/(1024*1024));
+	printf("FSB: %ld MHz\n", gd->bd->bi_busfreq/1000000);
 
 	printf("\n---- Disk summary ----\n");
 	for (i = 0; i < maxdev; i++)
diff --git a/board/MAI/bios_emulator/glue.c b/board/MAI/bios_emulator/glue.c
index b765ed5..f59ffaa 100644
--- a/board/MAI/bios_emulator/glue.c
+++ b/board/MAI/bios_emulator/glue.c
@@ -271,9 +271,9 @@
     pci_write_config_dword(dev, PCI_ROM_ADDRESS, 0);
     pci_write_config_dword(dev, i, bar_backup);
 
-    /*  FIXME: */
-    bat_map(2, 0x80000000, 256*1024*1024);
-    show_bat_mapping();
+    /*  FIXME: Shouldn't be needed anymore*/
+    /* bat_map(2, 0x80000000, 256*1024*1024);
+       show_bat_mapping(); */
 
     /*
      * Since most cards can probably only do 16 bit IO addressing, we
@@ -436,7 +436,6 @@
 
 void show_bat_mapping(void)
 {
-#ifdef DEBUG
     u32 dbat0u, dbat0l, ibat0u, ibat0l;
     u32 dbat1u, dbat1l, ibat1u, ibat1l;
     u32 dbat2u, dbat2l, ibat2u, ibat2l;
@@ -477,7 +476,6 @@
 	   dbat3u, dbat3l, ibat3u, ibat3l);
 
     printf("\nMSR: %08x   HID0: %08x   L2CR: %08x \n", msr,hid0, l2cr_reg);
-#endif
 }
 
 
@@ -485,44 +483,34 @@
 void remove_init_data(void)
 {
     char *s;
-    u32 batl = ((CFG_SDRAM_BASE+0x100000) | BATL_PP_RW);
-    u32 batu =((CFG_SDRAM_BASE+0x100000) | BATU_BL_256M | BATU_VS | BATU_VP);
-#if 0	/* already done in board_init_r() */
-    void *data = (void *)(CFG_INIT_RAM_ADDR+CFG_INIT_DATA_OFFSET);
-    unsigned char data2[CFG_INIT_DATA_SIZE];
-
-    /*  Make a copy of the data */
-    memcpy(data2, data, CFG_INIT_DATA_SIZE);
-#endif /* 0 */
 
     /*  Invalidate and disable data cache */
     invalidate_l1_data_cache();
     dcache_disable();
 
-#if 0
-    /*  Copy to the real RAM address */
-    memcpy(data, data2, CFG_INIT_DATA_SIZE);
-#endif
-
-    /*printf("Before ICache enable\n");
-      show_bat_mapping();*/
-
-    __asm volatile ("isync        \n"
-		    "mtdbatu 2,%2 \n"
-		    "mtdbatl 2,%2 \n"
-	            "mtdbatu 1,%0 \n"
-		    "mtdbatl 1,%1 \n"
-		    "sync         \n"
-		    "isync        \n"
-		    : : "r" (batu), "r" (batl), "r" (0));
-
-    /* show_bat_mapping(); */
     s = getenv("x86_cache");
 
-    if (!s || (s && strcmp(s, "on")==0))
+    if (!s)
     {
 	icache_enable();
 	dcache_enable();
     }
+    else if (s)
+    {
+        if (strcmp(s, "dcache")==0)
+        {
+            dcache_enable();
+        }
+        else if (strcmp(s, "icache") == 0)
+        {
+            icache_enable();
+        }
+        else if (strcmp(s, "on")== 0 || strcmp(s, "both") == 0)
+        {
+            dcache_enable();
+            icache_enable();
+        }
+    }
 
+    /*   show_bat_mapping();*/
 }
diff --git a/board/MAI/bios_emulator/scitech/src/x86emu/makefile.uboot b/board/MAI/bios_emulator/scitech/src/x86emu/makefile.uboot
new file mode 100644
index 0000000..d011cf5
--- /dev/null
+++ b/board/MAI/bios_emulator/scitech/src/x86emu/makefile.uboot
@@ -0,0 +1,80 @@
+#############################################################################
+#
+#						Realmode X86 Emulator Library
+#
+#            	Copyright (C) 1996-1999 SciTech Software, Inc.
+#
+#  ========================================================================
+#
+#  Permission to use, copy, modify, distribute, and sell this software and
+#  its documentation for any purpose is hereby granted without fee,
+#  provided that the above copyright notice appear in all copies and that
+#  both that copyright notice and this permission notice appear in
+#  supporting documentation, and that the name of the authors not be used
+#  in advertising or publicity pertaining to distribution of the software
+#  without specific, written prior permission.  The authors makes no
+#  representations about the suitability of this software for any purpose.
+#  It is provided "as is" without express or implied warranty.
+#
+#  THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+#  INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+#  EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+#  CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+#  USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+#  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+#  PERFORMANCE OF THIS SOFTWARE.
+#
+#  ========================================================================
+#
+# Descripton:   Linux specific makefile for the x86emu library.
+#
+#############################################################################
+CC = $(CROSS_COMPILE)gcc
+AR = $(CROSS_COMPILE)ar
+TARGETLIB = libx86emu.a
+TARGETDEBUGLIB =libx86emud.a
+
+OBJS=\
+decode.o \
+fpu.o \
+ops.o \
+ops2.o \
+prim_ops.o \
+sys.o
+
+DEBUGOBJS=debug.d \
+          decode.d \
+	  fpu.d \
+	  ops.d \
+	  ops2.d \
+	  prim_ops.d \
+	  sys.d
+
+.SUFFIXES: .d
+
+all: $(TARGETLIB) $(TARGETDEBUGLIB)
+
+$(TARGETLIB): $(OBJS)
+	$(AR) rv $(TARGETLIB) $(OBJS)
+
+$(TARGETDEBUGLIB): $(DEBUGOBJS)
+	$(AR) rv $(TARGETDEBUGLIB) $(DEBUGOBJS)
+
+INCS   = -I. -Ix86emu -I../../include
+CFLAGS = -D__DRIVER__ -DFORCE_POST -D_CEXPORT= -DNO_LONG_LONG -Dprintk=printf -fsigned-char  -fomit-frame-pointer -mrelocatable -ffixed-r14 -meabi -mrelocatable -ffixed-r14 -meabi
+CDEBUGFLAGS = -DDEBUG
+
+.c.o:
+	$(CC) -g -O2 -Wall -c $(CFLAGS) $(INCS) $*.c
+
+.c.d:
+	$(CC) -g -O2 -Wall -c -o$*.d $(CFLAGS) $(CDEBUGFLAGS) $(INCS) $*.c
+
+.cpp.o:
+	$(CC) -c $(CFLAGS) $(INCS) $*.cpp
+
+clean:
+	rm -f *.a *.o *.d
+
+validate:	validate.o libx86emu.a
+	$(CC) -o validate validate.o -lx86emu -L.
diff --git a/board/MAI/bios_emulator/x86interface.c b/board/MAI/bios_emulator/x86interface.c
index b1ad61a..e90ec5a 100644
--- a/board/MAI/bios_emulator/x86interface.c
+++ b/board/MAI/bios_emulator/x86interface.c
@@ -398,9 +398,7 @@
     u8 cfg;
     int i;
     char c;
-#ifdef DEBUG
     char *s;
-#endif
 #ifdef EASTEREGG
     int easteregg_active = 0;
 #endif
@@ -409,6 +407,7 @@
     unsigned char *msg;
     unsigned char current_attr;
 
+    PRINTF("Trying to remove init data\n");
     remove_init_data();
     PRINTF("Removed init data from cache, now in RAM\n");
 
@@ -438,7 +437,7 @@
 	return 0;
     }
 
-#ifdef DEBUG
+#if 1 /*def DEBUG*/
     s = getenv("x86_ask_start");
     if (s)
     {
@@ -646,7 +645,7 @@
     if (getenv("x86_do_inout")) do_inout();
 #endif
 
-    dcache_disable();
+//FIXME:    dcache_disable();
     return 1;
 }
 
diff --git a/board/MAI/menu/cmd_menu.c b/board/MAI/menu/cmd_menu.c
index a24ab49..1788173 100644
--- a/board/MAI/menu/cmd_menu.c
+++ b/board/MAI/menu/cmd_menu.c
@@ -2,7 +2,7 @@
 #include <command.h>
 #include <cmd_menu.h>
 
-int do_menu( cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[] )
+int do_menu( cmd_tbl_t *cmdtp, /*bd_t *bd,*/ int flag, int argc, char *argv[] )
 {
 //    printf("<NOT YET IMPLEMENTED>\n");
     return 0;
diff --git a/board/hermes/u-boot.lds b/board/hermes/u-boot.lds
index 517a354..11f55f3 100644
--- a/board/hermes/u-boot.lds
+++ b/board/hermes/u-boot.lds
@@ -56,11 +56,13 @@
     /* WARNING - the following is hand-optimized to fit within	*/
     /* the sector layout of our flash chips!	XXX FIXME XXX	*/
 
-    cpu/mpc8xx/start.o	(.text)
-    common/dlmalloc.o	(.text)
-    lib_ppc/ppcstring.o	(.text)
-    cpu/mpc8xx/interrupts.o (.text)
+    cpu/mpc8xx/start.o		(.text)
+    common/dlmalloc.o		(.text)
+    cpu/mpc8xx/interrupts.o	(.text)
     lib_ppc/time.o		(.text)
+    lib_ppc/ticks.o		(.text)
+    lib_ppc/cache.o		(.text)
+    lib_generic/crc32.o		(.text)
     . = env_offset;
     common/environment.o(.text)
 
diff --git a/board/tqm8260/tqm8260.c b/board/tqm8260/tqm8260.c
index 19229b7..784d72e 100644
--- a/board/tqm8260/tqm8260.c
+++ b/board/tqm8260/tqm8260.c
@@ -202,7 +202,7 @@
 
 	if (!i || strncmp (str, "TQM8260", 7)) {
 		puts ("### No HW ID - assuming TQM8260\n");
-		return (1);
+		return (0);
 	}
 
 	puts (str);
diff --git a/board/trab/vfd.c b/board/trab/vfd.c
index 7377b4d..234a9d4 100644
--- a/board/trab/vfd.c
+++ b/board/trab/vfd.c
@@ -344,7 +344,7 @@
 	DECLARE_GLOBAL_DATA_PTR;
 
 	if (vfd_init_done != 0)
-		return;
+		return (0);
 	vfd_init_done = 1;
 
 	vfdbase = gd->fb_base;