From 150678a5820bed338c1c8de570c451bc77c15900 Mon Sep 17 00:00:00 2001 From: Doug Anderson Date: Wed, 17 Apr 2013 16:13:41 +0000 Subject: bootstage: Copy bootstage strings post-relocation Any pointers to name strings that were passed to bootstage_mark_name() pre-relocation should be copied post-relocation so that they don't get trashed as the original location of U-Boot is re-used for other purposes. This change introduces a new API call that should be called from board_init_r() after malloc has been initted on any board that uses bootstage. Signed-off-by: Doug Anderson Signed-off-by: Simon Glass Reviewed-by: Simon Glass --- include/bootstage.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'include') diff --git a/include/bootstage.h b/include/bootstage.h index bdda76849f..c8235e8ed6 100644 --- a/include/bootstage.h +++ b/include/bootstage.h @@ -236,6 +236,16 @@ void show_boot_progress(int val); #if defined(CONFIG_BOOTSTAGE) && !defined(CONFIG_SPL_BUILD) /* This is the full bootstage implementation */ +/** + * Relocate existing bootstage records + * + * Call this after relocation has happened and after malloc has been initted. + * We need to copy any pointers in bootstage records that were added pre- + * relocation, since memory can be overritten later. + * @return Always returns 0, to indicate success + */ +int bootstage_relocate(void); + /** * Add a new bootstage record * @@ -326,6 +336,11 @@ static inline ulong bootstage_add_record(enum bootstage_id id, * and won't even do that unless CONFIG_SHOW_BOOT_PROGRESS is defined */ +static inline int bootstage_relocate(void) +{ + return 0; +} + static inline ulong bootstage_mark(enum bootstage_id id) { show_boot_progress(id); -- cgit v1.2.1