From: Andrew Murray <amur...@mpcdata.com> This patch adds macros which allow for the instrumentation of UBoot boot time. The macros can be used to call existing initialisation functions during start up. Each macro adds printf statements before and after the initialisation call. --- Changes for v2: - Use dedicated printf with timestamp function - Allow DO_INITCALL_RET macro to provide return value
Signed-off-by: Andrew Murray <amur...@theiet.org> --- include/common.h | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-) diff --git a/include/common.h b/include/common.h index 1e21b7a..a926430 100644 --- a/include/common.h +++ b/include/common.h @@ -176,6 +176,31 @@ typedef void (interrupt_handler_t)(void *); #endif /* CONFIG_SERIAL_MULTI */ +#if defined(CONFIG_BOOT_TRACE) +#define DO_INITCALL(x, ...) \ + do { \ + printf_boot_trace("calling 0x%pF\n", x); \ + (x)(__VA_ARGS__); \ + printf_boot_trace("initcall 0x%pF returned\n", x); \ + } while (0) +#define DO_INITCALL_RET(x, ...) \ + ({ \ + int __ret; \ + printf_boot_trace("calling 0x%pF\n", x); \ + __ret = (x)(__VA_ARGS__); \ + printf_boot_trace("initcall 0x%pF returned\n", x); \ + __ret; \ + }) +#define DO_INITCALL_END(x) \ + printf_boot_trace("initcall 0x%pF returned\n", x) +#else +#define DO_INITCALL(x, ...) \ + (x)(__VA_ARGS__) +#define DO_INITCALL_RET(x, ret, ...) \ + ret = (x)(__VA_ARGS__) +#define DO_INITCALL_END(x) +#endif + /* * General Purpose Utilities */ -- 1.7.4.1 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot