* Patch by Thomas Frieden, 13 Nov 2002:
  Add code for AmigaOne board
  (preliminary merge to U-Boot, still WIP)

* Patch by Jon Diekema, 12 Nov 2002:
  - Adding URL for IEEE OUI lookup
  - Making the autoboot #defines dependent on CONFIG_AUTOBOOT_KEYED
    being defined.
  - In the CONFIG_EXTRA_ENV_SETTINGS #define, the root-on-initrd and
    root-on-nfs macros are designed to switch how the default boot
    method gets defined.
diff --git a/cpu/74xx_7xx/cpu.c b/cpu/74xx_7xx/cpu.c
index 8a6915f..c265ce2 100644
--- a/cpu/74xx_7xx/cpu.c
+++ b/cpu/74xx_7xx/cpu.c
@@ -44,6 +44,11 @@
 #include <74xx_7xx.h>
 #include <asm/cache.h>
 
+#ifdef CONFIG_AMIGAONEG3SE
+#include "../board/MAI/AmigaOneG3SE/via686.h"
+#include "../board/MAI/AmigaOneG3SE/memio.h"
+#endif
+
 cpu_t
 get_cpu_type(void)
 {
@@ -218,12 +223,20 @@
 /*
  * For the 7400 the TB clock runs at 1/4 the cpu bus speed.
  */
-unsigned long
-get_tbclk (void)
+#ifdef CONFIG_AMIGAONEG3SE
+unsigned long get_tbclk(void)
+{
+	DECLARE_GLOBAL_DATA_PTR;
+
+	return (gd->bus_clk / 4);
+}
+#else	/* ! CONFIG_AMIGAONEG3SE */
+
+unsigned long get_tbclk (void)
 {
 	return CFG_BUS_HZ / 4;
 }
-
+#endif	/* CONFIG_AMIGAONEG3SE */
 /* ------------------------------------------------------------------------- */
 
 #if defined(CONFIG_WATCHDOG)
diff --git a/cpu/74xx_7xx/interrupts.c b/cpu/74xx_7xx/interrupts.c
index 10450da..2e2e456 100644
--- a/cpu/74xx_7xx/interrupts.c
+++ b/cpu/74xx_7xx/interrupts.c
@@ -89,7 +89,7 @@
 
 int interrupt_init(void)
 {
-#ifdef DEBUG
+#if defined(DEBUG) && !defined(CONFIG_AMIGAONEG3SE)
 	printf("interrupt_init: GT main cause reg: %08x:%08x\n",
 	       GTREGREAD(LOW_INTERRUPT_CAUSE_REGISTER),
 	       GTREGREAD(HIGH_INTERRUPT_CAUSE_REGISTER));
diff --git a/cpu/74xx_7xx/speed.c b/cpu/74xx_7xx/speed.c
index fe553f1..ac99bcd 100644
--- a/cpu/74xx_7xx/speed.c
+++ b/cpu/74xx_7xx/speed.c
@@ -25,6 +25,10 @@
 #include <74xx_7xx.h>
 #include <asm/processor.h>
 
+#ifdef CONFIG_AMIGAONEG3SE
+#include "../board/MAI/AmigaOneG3SE/via686.h"
+#endif
+
 static const int hid1_multipliers_x_10[] = {
 	25,	/* 0000 - 2.5x */
 	75,	/* 0001 - 7.5x */
diff --git a/cpu/74xx_7xx/traps.c b/cpu/74xx_7xx/traps.c
index 26db097..6e94601 100644
--- a/cpu/74xx_7xx/traps.c
+++ b/cpu/74xx_7xx/traps.c
@@ -45,7 +45,11 @@
 
 /* THIS NEEDS CHANGING to use the board info structure.
 */
+#ifdef CONFIG_AMIGAONEG3SE
+#define END_OF_MEM (gd->bd->bi_memstart + gd->bd->bi_memsize)
+#else
 #define END_OF_MEM	0x02000000
+#endif
 
 /*
  * Trap & Exception support
@@ -54,6 +58,9 @@
 void
 print_backtrace(unsigned long *sp)
 {
+#ifdef CONFIG_AMIGAONEG3SE
+	DECLARE_GLOBAL_DATA_PTR;
+#endif
 	int cnt = 0;
 	unsigned long i;
 
@@ -171,11 +178,25 @@
 void
 ProgramCheckException(struct pt_regs *regs)
 {
+	unsigned char *p = regs ? (unsigned char *)(regs->nip) : NULL;
+	int i, j;
+
 #if (CONFIG_COMMANDS & CFG_CMD_KGDB)
 	if (debugger_exception_handler && (*debugger_exception_handler)(regs))
 		return;
 #endif
 	show_regs(regs);
+
+	p = (unsigned char *) ((unsigned long)p & 0xFFFFFFE0);
+	p -= 32;
+	for (i = 0; i < 256; i+=16) {
+		printf("%08x: ", (unsigned int)p+i);
+		for (j = 0; j < 16; j++) {
+			printf("%02x ", p[i+j]);
+		}
+		printf("\n");
+	}
+
 	print_backtrace((unsigned long *)regs->gpr[1]);
 	panic("Program Check Exception");
 }