[coreboot-gerrit] New patch to review for coreboot: 15b6ec4 console: Add hexdump function

Marc Jones (marc.jones@se-eng.com) gerrit at coreboot.org
Fri Nov 1 23:10:21 CET 2013


Marc Jones (marc.jones at se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4013

-gerrit

commit 15b6ec4c65d14bf999d6a4dc2781f74b146894b2
Author: Marc Jones <marc.jones at se-eng.com>
Date:   Wed Oct 30 16:25:23 2013 -0600

    console: Add hexdump function
    
    Add a function to display memory locations in the console
    logfile.
    
    Change-Id: Iddb8d2e7a24357075f32c2fdf7916ae7a732247d
    Signed-off-by: Marc Jones <marc.jones at se-eng.com>
---
 src/console/console.c         | 24 ++++++++++++++++++++++++
 src/include/console/console.h |  2 ++
 2 files changed, 26 insertions(+)

diff --git a/src/console/console.c b/src/console/console.c
index 8a1c969..6ef775b 100644
--- a/src/console/console.c
+++ b/src/console/console.c
@@ -135,3 +135,27 @@ void console_init(void)
 #endif /* CONFIG_EARLY_CONSOLE */
 }
 #endif
+
+void
+hexdump(char LEVEL, const void *d, int len)
+{
+#ifdef printk
+	int count=0;
+
+	while (len > 0) {
+		if (count % 8 == 0) {
+			printk(LEVEL,"\n");
+			printk(LEVEL, "%p", d);
+			printk(LEVEL, ":");
+		} else {
+			printk(LEVEL, " ");
+		}
+		printk(LEVEL, "0x%08lx", *(unsigned long*)d);
+		count++;
+		len-=4;
+		d+=4;
+	}
+
+	printk(LEVEL,"\n");
+#endif
+}
diff --git a/src/include/console/console.h b/src/include/console/console.h
index 7a55ae1..635f4e7 100644
--- a/src/include/console/console.h
+++ b/src/include/console/console.h
@@ -40,6 +40,8 @@
 #include <console/spkmodem.h>
 #endif
 
+void hexdump(char LEVEL, const void *d, int len);
+
 #ifndef __PRE_RAM__
 unsigned char console_rx_byte(void);
 int console_tst_byte(void);



More information about the coreboot-gerrit mailing list