* 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++)