common: board_r: Drop arch-specific ifdefs around initr_trap
In order to remove the arch-specific ifdefs around initr_trap, introduce arch_initr_trap weak initcall. Implementations for ppc/m68k/mips have been moved to arch/<arch>/lib/traps.c Default implementation is a nop stub. Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
This commit is contained in:
@@ -40,7 +40,7 @@ void exc_handler(struct pt_regs *fp) {
|
|||||||
for(;;);
|
for(;;);
|
||||||
}
|
}
|
||||||
|
|
||||||
void trap_init(ulong value) {
|
static void trap_init(ulong value) {
|
||||||
unsigned long *vec = (ulong *)value;
|
unsigned long *vec = (ulong *)value;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -59,3 +59,10 @@ void trap_init(ulong value) {
|
|||||||
|
|
||||||
setvbr(value); /* set vector base register to new table */
|
setvbr(value); /* set vector base register to new table */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int arch_initr_trap(void)
|
||||||
|
{
|
||||||
|
trap_init(CONFIG_SYS_SDRAM_BASE);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ static void set_handler(unsigned long offset, void *addr, unsigned long size)
|
|||||||
flush_cache(ebase + offset, size);
|
flush_cache(ebase + offset, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void trap_init(ulong reloc_addr)
|
static void trap_init(ulong reloc_addr)
|
||||||
{
|
{
|
||||||
unsigned long ebase = gd->irq_sp;
|
unsigned long ebase = gd->irq_sp;
|
||||||
|
|
||||||
@@ -131,3 +131,10 @@ void trap_restore(void)
|
|||||||
clear_c0_status(ST0_BEV);
|
clear_c0_status(ST0_BEV);
|
||||||
execution_hazard_barrier();
|
execution_hazard_barrier();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int arch_initr_trap(void)
|
||||||
|
{
|
||||||
|
trap_init(CONFIG_SYS_SDRAM_BASE);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ obj-y += interrupts.o
|
|||||||
obj-$(CONFIG_CMD_KGDB) += kgdb.o
|
obj-$(CONFIG_CMD_KGDB) += kgdb.o
|
||||||
obj-y += stack.o
|
obj-y += stack.o
|
||||||
obj-y += time.o
|
obj-y += time.o
|
||||||
|
obj-y += traps.o
|
||||||
endif # not minimal
|
endif # not minimal
|
||||||
|
|
||||||
ifdef CONFIG_SPL_BUILD
|
ifdef CONFIG_SPL_BUILD
|
||||||
|
|||||||
19
arch/powerpc/lib/traps.c
Normal file
19
arch/powerpc/lib/traps.c
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0+
|
||||||
|
/*
|
||||||
|
* (C) Copyright 2003
|
||||||
|
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <common.h>
|
||||||
|
#include <init.h>
|
||||||
|
|
||||||
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
|
void trap_init(unsigned long reloc_addr);
|
||||||
|
|
||||||
|
int arch_initr_trap(void)
|
||||||
|
{
|
||||||
|
trap_init(gd->relocaddr);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -182,20 +182,10 @@ static int initr_reloc_global_data(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_MIPS)
|
__weak int arch_initr_trap(void)
|
||||||
static int initr_trap(void)
|
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
* Setup trap handlers
|
|
||||||
*/
|
|
||||||
#if defined(CONFIG_PPC)
|
|
||||||
trap_init(gd->relocaddr);
|
|
||||||
#else
|
|
||||||
trap_init(CONFIG_SYS_SDRAM_BASE);
|
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_ADDR_MAP
|
#ifdef CONFIG_ADDR_MAP
|
||||||
static int initr_addr_map(void)
|
static int initr_addr_map(void)
|
||||||
@@ -669,9 +659,7 @@ static init_fnc_t init_sequence_r[] = {
|
|||||||
#ifdef CONFIG_NEEDS_MANUAL_RELOC
|
#ifdef CONFIG_NEEDS_MANUAL_RELOC
|
||||||
initr_manual_reloc_cmdtable,
|
initr_manual_reloc_cmdtable,
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_MIPS)
|
arch_initr_trap,
|
||||||
initr_trap,
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_ADDR_MAP
|
#ifdef CONFIG_ADDR_MAP
|
||||||
initr_addr_map,
|
initr_addr_map,
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -300,7 +300,15 @@ int board_early_init_r(void);
|
|||||||
/* TODO(sjg@chromium.org): Drop this when DM_PCI migration is completed */
|
/* TODO(sjg@chromium.org): Drop this when DM_PCI migration is completed */
|
||||||
void pci_init_board(void);
|
void pci_init_board(void);
|
||||||
|
|
||||||
void trap_init(unsigned long reloc_addr);
|
/**
|
||||||
|
* arch_initr_trap() - Init traps
|
||||||
|
*
|
||||||
|
* Arch specific routine for initializing traps. It is called during the
|
||||||
|
* generic board init sequence, after relocation.
|
||||||
|
*
|
||||||
|
* Return: 0 if OK
|
||||||
|
*/
|
||||||
|
int arch_initr_trap(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* main_loop() - Enter the main loop of U-Boot
|
* main_loop() - Enter the main loop of U-Boot
|
||||||
|
|||||||
Reference in New Issue
Block a user