summaryrefslogtreecommitdiff
path: root/util/cbfstool/cbfs_image.h
diff options
context:
space:
mode:
authorHung-Te Lin <hungte@chromium.org>2013-03-19 12:24:43 +0800
committerHung-Te Lin <hungte@chromium.org>2013-03-20 05:47:32 +0100
commite4ea2ca18d4764f8c79560d373d548d52532566d (patch)
treec55d0d8ce4746c60f51e50917128ca9841f083a2 /util/cbfstool/cbfs_image.h
parentb3b72f350e22ecdfa8e228b820f46da805d4f230 (diff)
cbfstool locate: Implement alignment switch --align/-a
cbfstool usage change: "-a" for "cbfstool locate" can specify base address alignment. To support putting a blob in aligned location (ex, microcode needs to be aligned in 0x10), alignment (-a) is implemented into "locate" command. Verified by manually testing a file (324 bytes) with alignment=0x10: cbfstool coreboot.rom locate -f test -n test -a 0x10 # output: 0x71fdd0 cbfstool coreboot.rom add -f test -n test -t raw -b 0x71fdd0 cbfstool coreboot.rom print -v -v # output: test 0x71fd80 raw 324 # output: cbfs_file=0x71fd80, offset=0x50, content_address=0x71fdd0+0x144 Also verified to be compatible with old behavior by building i386/axus/tc320 (with page limitation 0x40000): cbfstool coreboot.rom locate -f romstage_null.bin -n romstage -P 0x40000 # output: 0x44 cbfstool coreboot.rom locate -f x.bin -n romstage -P 0x40000 -a 0x30 # output: 0x60 Change-Id: I78b549fe6097ce5cb6162b09f064853827069637 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: http://review.coreboot.org/2824 Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Tested-by: build bot (Jenkins)
Diffstat (limited to 'util/cbfstool/cbfs_image.h')
-rw-r--r--util/cbfstool/cbfs_image.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/util/cbfstool/cbfs_image.h b/util/cbfstool/cbfs_image.h
index 57bbfa1704..7ad418aee5 100644
--- a/util/cbfstool/cbfs_image.h
+++ b/util/cbfstool/cbfs_image.h
@@ -76,10 +76,12 @@ int cbfs_remove_entry(struct cbfs_image *image, const char *name);
int cbfs_create_empty_entry(struct cbfs_image *image, struct cbfs_file *entry,
size_t len, const char *name);
-/* Finds a location to put given content in same memory page.
+/* Finds a location to put given content by specified criteria:
+ * "page_size" limits the content to fit on same memory page, and
+ * "align" specifies starting address alignment.
* Returns a valid offset, or -1 on failure. */
int32_t cbfs_locate_entry(struct cbfs_image *image, const char *name,
- uint32_t size, uint32_t page_size);
+ uint32_t size, uint32_t page_size, uint32_t align);
/* Callback function used by cbfs_walk.
* Returns 0 on success, or non-zero to stop further iteration. */