summaryrefslogtreecommitdiff
path: root/common/vboot_hash.c
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2014-05-19 15:03:27 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-05-21 20:32:17 +0000
commitffac23c0ea1bd4ff4568f5bd709a98f912b833a7 (patch)
tree362dd0ba205731aa07be97dd35b44b237799b23b /common/vboot_hash.c
parent478361de694b1fb45abf3c38dafbbf7fd1aa5f71 (diff)
downloadchrome-ec-ffac23c0ea1bd4ff4568f5bd709a98f912b833a7.tar.gz
Add cprints() and ccprints()
Our code base contains a lot of debug messages in this pattern: CPRINTF("[%T xxx]\n") or ccprintf("[%T xxx]\n") The strings are taking up spaces in the EC binaries, so let's refactor this by adding cprints() and ccprints(). cprints() is just like cprintf(), except that it adds the brackets and the timestamp. ccprints() is equivalent to cprints(CC_CONSOLE, ...) This saves us hundreds of bytes in EC binaries. BUG=chromium:374575 TEST=Build and check flash size BRANCH=None Change-Id: Ifafe8dc1b80e698b28ed42b70518c7917b49ee51 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/200490 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'common/vboot_hash.c')
-rw-r--r--common/vboot_hash.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/common/vboot_hash.c b/common/vboot_hash.c
index bd80fbde2d..9d51d7517d 100644
--- a/common/vboot_hash.c
+++ b/common/vboot_hash.c
@@ -18,7 +18,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_VBOOT, outstr)
-#define CPRINTF(format, args...) cprintf(CC_VBOOT, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_VBOOT, format, ## args)
struct vboot_hash_tag {
uint8_t hash[SHA256_DIGEST_SIZE];
@@ -49,7 +49,7 @@ static void vboot_hash_abort(void)
if (in_progress) {
want_abort = 1;
} else {
- CPRINTF("[%T hash abort]\n");
+ CPRINTS("hash abort");
want_abort = 0;
data_size = 0;
hash = NULL;
@@ -79,7 +79,7 @@ static void vboot_hash_next_chunk(void)
if (curr_pos >= data_size) {
/* Store the final hash */
hash = SHA256_final(&ctx);
- CPRINTF("[%T hash done %.*h]\n", SHA256_DIGEST_SIZE, hash);
+ CPRINTS("hash done %.*h", SHA256_DIGEST_SIZE, hash);
in_progress = 0;
@@ -126,7 +126,7 @@ static int vboot_hash_start(uint32_t offset, uint32_t size,
in_progress = 1;
/* Restart the hash computation */
- CPRINTF("[%T hash start 0x%08x 0x%08x]\n", offset, size);
+ CPRINTS("hash start 0x%08x 0x%08x", offset, size);
SHA256_init(&ctx);
if (nonce_size)
SHA256_update(&ctx, nonce, nonce_size);
@@ -151,7 +151,7 @@ int vboot_hash_invalidate(int offset, int size)
return 0;
/* Invalidate the hash */
- CPRINTF("[%T hash invalidated 0x%08x 0x%08x]\n", offset, size);
+ CPRINTS("hash invalidated 0x%08x 0x%08x", offset, size);
vboot_hash_abort();
return 1;
}
@@ -170,7 +170,7 @@ static void vboot_hash_init(void)
if (tag && version == VBOOT_HASH_SYSJUMP_VERSION &&
size == sizeof(*tag)) {
/* Already computed a hash, so don't recompute */
- CPRINTF("[%T hash precomputed]\n");
+ CPRINTS("hash precomputed");
hash = tag->hash;
data_offset = tag->offset;
data_size = tag->size;