All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Murray <amurray@theiet.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 2/7] Add macros for recording init calls during UBoot execution
Date: Sat, 10 Sep 2011 14:17:28 +0100	[thread overview]
Message-ID: <1315660648-761-1-git-send-email-amurray@theiet.org> (raw)
In-Reply-To: <1315658227-4388-2-git-send-email-amurray@theiet.org>

From: Andrew Murray <amurray@mpcdata.com>

The previous patch included a compile error when the CONFIG_BOOT_TRACE macro is not
set, this is an update to that patch
---
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 <amurray@theiet.org>
---
 include/common.h |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/include/common.h b/include/common.h
index 1e21b7a..196c306 100644
--- a/include/common.h
+++ b/include/common.h
@@ -176,6 +176,33 @@ 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) \
+	do { \
+		printf_boot_trace("initcall 0x%pF returned\n", x); \
+	} while (0)
+#else
+#define DO_INITCALL(x, ...) \
+	({ (x)(__VA_ARGS__); })
+#define DO_INITCALL_RET(x, ...) \
+	({ (x)(__VA_ARGS__); })
+#define DO_INITCALL_END(x)
+#endif
+
 /*
  * General Purpose Utilities
  */
@@ -687,6 +714,8 @@ void	puts(const char *s);
 int	printf(const char *fmt, ...)
 		__attribute__ ((format (__printf__, 1, 2)));
 int	vprintf(const char *fmt, va_list args);
+int	printf_boot_trace(const char *fmt, ...)
+		__attribute__ ((format (__printf__, 1, 2)));
 
 /* stderr */
 #define eputc(c)		fputc(stderr, c)
-- 
1.7.4.1

  reply	other threads:[~2011-09-10 13:17 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-31 22:20 [U-Boot] [PATCH 0/7] Bootgraph.pl instrumentation support for UBoot Andrew Murray
2011-08-31 22:20 ` [U-Boot] [PATCH 1/7] Add bootgraph.pl script for generating a boot graph SVG file Andrew Murray
2011-08-31 22:20 ` [U-Boot] [PATCH 2/7] Add macros for recording init calls during UBoot execution Andrew Murray
2011-08-31 22:50   ` Mike Frysinger
2011-08-31 23:40     ` Andrew Murray
2011-08-31 22:20 ` [U-Boot] [PATCH 3/7] Add timing information to printf's for use with bootgraph.pl Andrew Murray
2011-08-31 22:47   ` Mike Frysinger
2011-08-31 23:30     ` Andrew Murray
2011-08-31 23:38     ` Graeme Russ
2011-08-31 23:42       ` Andrew Murray
2011-09-07 21:10     ` Wolfgang Denk
2011-09-09  0:50       ` Mike Frysinger
2011-09-09  7:00         ` Wolfgang Denk
2011-08-31 22:20 ` [U-Boot] [PATCH 4/7] Add bootgraph instrumentation for ARM boards Andrew Murray
2011-08-31 22:20 ` [U-Boot] [PATCH 5/7] Add bootgraph instrumentation for bootm command Andrew Murray
2011-08-31 22:21 ` [U-Boot] [PATCH 6/7] Add bootgraph instrumentation for UBoot commands Andrew Murray
2011-08-31 22:21 ` [U-Boot] [PATCH 7/7] Add documentation for bootgraph.pl Andrew Murray
2011-08-31 22:47 ` [U-Boot] [PATCH 0/7] Bootgraph.pl instrumentation support for UBoot Mike Frysinger
2011-08-31 23:12   ` Simon Glass
2011-08-31 23:25     ` Andrew Murray
2011-08-31 23:32       ` Graeme Russ
2011-08-31 23:39         ` Simon Glass
2011-08-31 23:53           ` Andrew Murray
2011-09-10 12:40             ` Andrew Murray
2011-09-13  4:34               ` Simon Glass
2011-09-13  5:24                 ` Graeme Russ
2011-09-13 11:52                   ` Simon Glass
2011-09-13 12:01                     ` Graeme Russ
2011-09-13 12:22                       ` Simon Glass
2011-09-10 12:37 ` [U-Boot] [PATCH v2 1/7] Add bootgraph.pl script for generating a boot graph SVG file Andrew Murray
2011-09-10 12:37   ` [U-Boot] [PATCH v2 2/7] Add macros for recording init calls during UBoot execution Andrew Murray
2011-09-10 13:17     ` Andrew Murray [this message]
2011-09-18  2:16       ` Mike Frysinger
2011-09-10 12:37   ` [U-Boot] [PATCH v2 3/7] Add timing information to printf's for use with bootgraph.pl Andrew Murray
2011-09-18  2:10     ` Mike Frysinger
2011-09-10 12:37   ` [U-Boot] [PATCH v2 4/7] Add bootgraph instrumentation for ARM boards Andrew Murray
2011-09-18  2:11     ` Mike Frysinger
2011-10-06 21:37     ` Wolfgang Denk
2011-09-10 12:37   ` [U-Boot] [PATCH v2 5/7] Add bootgraph instrumentation for bootm command Andrew Murray
2011-09-10 12:37   ` [U-Boot] [PATCH v2 6/7] Add bootgraph instrumentation for UBoot commands Andrew Murray
2011-09-18  2:11     ` Mike Frysinger
2011-10-06 21:35     ` Wolfgang Denk
2011-09-10 12:37   ` [U-Boot] [PATCH v2 7/7] Add documentation for bootgraph.pl Andrew Murray
2011-10-06 21:38   ` [U-Boot] [PATCH v2 1/7] Add bootgraph.pl script for generating a boot graph SVG file Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1315660648-761-1-git-send-email-amurray@theiet.org \
    --to=amurray@theiet.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.