Add trace support to generic board
Add hooks for tracing to generic board, including: - allow early tracing to start early as possible in U-Boot - reserve memory for trace buffer - copy early trace buffer to main trace buffer after relocation - setup full tracing support after relocation Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
5c2aeac5ae
commit
71c52dba2b
|
@ -53,6 +53,7 @@
|
||||||
#include <os.h>
|
#include <os.h>
|
||||||
#include <post.h>
|
#include <post.h>
|
||||||
#include <spi.h>
|
#include <spi.h>
|
||||||
|
#include <trace.h>
|
||||||
#include <watchdog.h>
|
#include <watchdog.h>
|
||||||
#include <asm/errno.h>
|
#include <asm/errno.h>
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
|
@ -500,6 +501,18 @@ static int reserve_lcd(void)
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_LCD */
|
#endif /* CONFIG_LCD */
|
||||||
|
|
||||||
|
static int reserve_trace(void)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_TRACE
|
||||||
|
gd->relocaddr -= CONFIG_TRACE_BUFFER_SIZE;
|
||||||
|
gd->trace_buff = map_sysmem(gd->relocaddr, CONFIG_TRACE_BUFFER_SIZE);
|
||||||
|
debug("Reserving %dk for trace data at: %08lx\n",
|
||||||
|
CONFIG_TRACE_BUFFER_SIZE >> 10, gd->relocaddr);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) \
|
#if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) \
|
||||||
&& !defined(CONFIG_ARM) && !defined(CONFIG_X86)
|
&& !defined(CONFIG_ARM) && !defined(CONFIG_X86)
|
||||||
static int reserve_video(void)
|
static int reserve_video(void)
|
||||||
|
@ -818,8 +831,9 @@ static init_fnc_t init_sequence_f[] = {
|
||||||
#ifdef CONFIG_SANDBOX
|
#ifdef CONFIG_SANDBOX
|
||||||
setup_ram_buf,
|
setup_ram_buf,
|
||||||
#endif
|
#endif
|
||||||
setup_fdt,
|
|
||||||
setup_mon_len,
|
setup_mon_len,
|
||||||
|
setup_fdt,
|
||||||
|
trace_early_init,
|
||||||
#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
|
#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
|
||||||
/* TODO: can this go into arch_cpu_init()? */
|
/* TODO: can this go into arch_cpu_init()? */
|
||||||
probecpu,
|
probecpu,
|
||||||
|
@ -963,6 +977,7 @@ static init_fnc_t init_sequence_f[] = {
|
||||||
#ifdef CONFIG_LCD
|
#ifdef CONFIG_LCD
|
||||||
reserve_lcd,
|
reserve_lcd,
|
||||||
#endif
|
#endif
|
||||||
|
reserve_trace,
|
||||||
/* TODO: Why the dependency on CONFIG_8xx? */
|
/* TODO: Why the dependency on CONFIG_8xx? */
|
||||||
#if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) \
|
#if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) \
|
||||||
&& !defined(CONFIG_ARM) && !defined(CONFIG_X86)
|
&& !defined(CONFIG_ARM) && !defined(CONFIG_X86)
|
||||||
|
|
|
@ -58,6 +58,7 @@
|
||||||
#include <serial.h>
|
#include <serial.h>
|
||||||
#include <spi.h>
|
#include <spi.h>
|
||||||
#include <stdio_dev.h>
|
#include <stdio_dev.h>
|
||||||
|
#include <trace.h>
|
||||||
#include <watchdog.h>
|
#include <watchdog.h>
|
||||||
#ifdef CONFIG_ADDR_MAP
|
#ifdef CONFIG_ADDR_MAP
|
||||||
#include <asm/mmu.h>
|
#include <asm/mmu.h>
|
||||||
|
@ -106,6 +107,15 @@ static int initr_secondary_cpu(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int initr_trace(void)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_TRACE
|
||||||
|
trace_init(gd->trace_buff, CONFIG_TRACE_BUFFER_SIZE);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int initr_reloc(void)
|
static int initr_reloc(void)
|
||||||
{
|
{
|
||||||
gd->flags |= GD_FLG_RELOC; /* tell others: relocation done */
|
gd->flags |= GD_FLG_RELOC; /* tell others: relocation done */
|
||||||
|
@ -711,6 +721,7 @@ static int run_main_loop(void)
|
||||||
* TODO: perhaps reset the watchdog in the initcall function after each call?
|
* TODO: perhaps reset the watchdog in the initcall function after each call?
|
||||||
*/
|
*/
|
||||||
init_fnc_t init_sequence_r[] = {
|
init_fnc_t init_sequence_r[] = {
|
||||||
|
initr_trace,
|
||||||
initr_reloc,
|
initr_reloc,
|
||||||
/* TODO: could x86/PPC have this also perhaps? */
|
/* TODO: could x86/PPC have this also perhaps? */
|
||||||
#ifdef CONFIG_ARM
|
#ifdef CONFIG_ARM
|
||||||
|
|
|
@ -82,6 +82,9 @@ typedef struct global_data {
|
||||||
unsigned long fdt_size; /* Space reserved for relocated FDT */
|
unsigned long fdt_size; /* Space reserved for relocated FDT */
|
||||||
void **jt; /* jump table */
|
void **jt; /* jump table */
|
||||||
char env_buf[32]; /* buffer for getenv() before reloc. */
|
char env_buf[32]; /* buffer for getenv() before reloc. */
|
||||||
|
#ifdef CONFIG_TRACE
|
||||||
|
void *trace_buff; /* The trace buffer */
|
||||||
|
#endif
|
||||||
struct arch_global_data arch; /* architecture-specific data */
|
struct arch_global_data arch; /* architecture-specific data */
|
||||||
} gd_t;
|
} gd_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue