summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorTom Rini <trini@ti.com>2013-05-13 18:17:39 -0400
committerTom Rini <trini@ti.com>2013-05-13 18:17:39 -0400
commita661b99dbc35e725f229a7b8e189ca21304ba026 (patch)
treeb3f329efb8cda7a47db2b0e7bbbf6454a3e76db8 /common
parenta7e62be09189dae3a16882e53f15c38754f9db91 (diff)
parent8f0278eab4410de57ea6a32a8e5a50614a28084f (diff)
Merge branch 'master' of git://git.denx.de/u-boot-x86
Diffstat (limited to 'common')
-rw-r--r--common/board_r.c1
-rw-r--r--common/bootstage.c44
-rw-r--r--common/cmd_ximg.c2
3 files changed, 47 insertions, 0 deletions
diff --git a/common/board_r.c b/common/board_r.c
index f801e41103..fd1fd319b6 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -765,6 +765,7 @@ init_fnc_t init_sequence_r[] = {
#endif
initr_barrier,
initr_malloc,
+ bootstage_relocate,
#ifdef CONFIG_ARCH_EARLY_INIT_R
arch_early_init_r,
#endif
diff --git a/common/bootstage.c b/common/bootstage.c
index a1e09394cc..c5c69961ac 100644
--- a/common/bootstage.c
+++ b/common/bootstage.c
@@ -30,6 +30,8 @@
#include <common.h>
#include <libfdt.h>
+#include <malloc.h>
+#include <linux/compiler.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -56,6 +58,21 @@ struct bootstage_hdr {
uint32_t magic; /* Unused */
};
+int bootstage_relocate(void)
+{
+ int i;
+
+ /*
+ * Duplicate all strings. They may point to an old location in the
+ * program .text section that can eventually get trashed.
+ */
+ for (i = 0; i < BOOTSTAGE_ID_COUNT; i++)
+ if (record[i].name)
+ record[i].name = strdup(record[i].name);
+
+ return 0;
+}
+
ulong bootstage_add_record(enum bootstage_id id, const char *name,
int flags, ulong mark)
{
@@ -102,6 +119,33 @@ ulong bootstage_mark_name(enum bootstage_id id, const char *name)
return bootstage_add_record(id, name, flags, timer_get_boot_us());
}
+ulong bootstage_mark_code(const char *file, const char *func, int linenum)
+{
+ char *str, *p;
+ __maybe_unused char *end;
+ int len = 0;
+
+ /* First work out the length we need to allocate */
+ if (linenum != -1)
+ len = 11;
+ if (func)
+ len += strlen(func);
+ if (file)
+ len += strlen(file);
+
+ str = malloc(len + 1);
+ p = str;
+ end = p + len;
+ if (file)
+ p += snprintf(p, end - p, "%s,", file);
+ if (linenum != -1)
+ p += snprintf(p, end - p, "%d", linenum);
+ if (func)
+ p += snprintf(p, end - p, ": %s", func);
+
+ return bootstage_mark_name(BOOTSTAGE_ID_ALLOC, str);
+}
+
uint32_t bootstage_start(enum bootstage_id id, const char *name)
{
struct bootstage_record *rec = &record[id];
diff --git a/common/cmd_ximg.c b/common/cmd_ximg.c
index ea0a26e784..02084b0204 100644
--- a/common/cmd_ximg.c
+++ b/common/cmd_ximg.c
@@ -58,7 +58,9 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
const void *fit_data;
size_t fit_len;
#endif
+#ifdef CONFIG_GZIP
uint unc_len = CONFIG_SYS_XIMG_LEN;
+#endif
uint8_t comp;
verify = getenv_yesno("verify");