// SPDX-License-Identifier: GPL-2.0+
/*
 * (C) Copyright 2003
 * Josef Baumgartner <josef.baumgartner@telex.de>
 *
 * (C) Copyright 2000
 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
 */

#include <init.h>
#include <watchdog.h>
#include <command.h>
#include <asm/processor.h>
#include <asm/ptrace.h>


extern void _exc_handler(void);
extern void _int_handler(void);

static void show_frame(struct pt_regs *fp)
{
	printf ("Vector Number: %d  Format: %02x  Fault Status: %01x\n\n", (fp->vector & 0x3fc) >> 2,
		fp->format, (fp->vector & 0x3) | ((fp->vector & 0xc00) >> 8));
	printf ("PC: %08lx    SR: %08lx    SP: %08lx\n", fp->pc, (long) fp->sr, (long) fp);
	printf ("D0: %08lx    D1: %08lx    D2: %08lx    D3: %08lx\n",
		fp->d0, fp->d1, fp->d2, fp->d3);
	printf ("D4: %08lx    D5: %08lx    D6: %08lx    D7: %08lx\n",
		fp->d4, fp->d5, fp->d6, fp->d7);
	printf ("A0: %08lx    A1: %08lx    A2: %08lx    A3: %08lx\n",
		fp->a0, fp->a1, fp->a2, fp->a3);
	printf ("A4: %08lx    A5: %08lx    A6: %08lx\n",
		fp->a4, fp->a5, fp->a6);
}

void exc_handler(struct pt_regs *fp) {
	printf("\n\n*** Unexpected exception ***\n");
	show_frame (fp);
	printf("\n*** Please Reset Board! ***\n");
	for(;;);
}

static void trap_init(ulong value) {
	unsigned long *vec = (ulong *)value;
	int i;

	for(i = 2; i < 25; i++) {
		vec[i] = (unsigned long)_exc_handler;
	}
	for(i = 25; i < 32; i++) {
		vec[i] = (unsigned long)_int_handler;
	}
	for(i = 32; i < 64; i++) {
		vec[i] = (unsigned long)_exc_handler;
	}
	for(i = 64; i < 256; i++) {
		vec[i] = (unsigned long)_int_handler;
	}

	setvbr(value);		/* set vector base register to new table */
}

int arch_initr_trap(void)
{
	trap_init(CFG_SYS_SDRAM_BASE);

	return 0;
}
