aboutsummaryrefslogtreecommitdiff
path: root/util/cbfstool/common.h
diff options
context:
space:
mode:
authorPatrick Georgi <patrick.georgi@coresystems.de>2009-11-09 17:18:02 +0000
committerPatrick Georgi <patrick.georgi@coresystems.de>2009-11-09 17:18:02 +0000
commit0da38dde4b173e43e29435751549809b4b13053d (patch)
tree9aecd2f506a0d4a39691bd278ad428a70a9e36b8 /util/cbfstool/common.h
parent031029d4d4f80c1754ba57d21cda69e4f381850a (diff)
Add a "locate" function cbfstool, which helps you find
out a suitable address to put a XIP stage to. Specifically, you pass it the file (to get its filesize), its filename (as the header has a variable length that depends on it), and the granularity requirement it has to fit in (for XIP). The granularity is MTRR-style: when you request 0x10000, cbfstool looks for a suitable place in a 64kb-aligned 64kb block. cbfstool simply prints out a hex value which is the start address of a suitably located free memory block. That value can then be used with cbfs add-stage to store the file in the ROM image. It's a two-step operation (instead of being merged into cbfs add-stage) because the image must be linked twice: First, with some bogus, but safe base address (eg. 0) to figure out the target address (based on file size). Then a second time at the target address. The work flow is: - link file - cbfstool locate - link file again - cbfstool add-stage. Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de> Acked-by: Stefan Reinauer <stepan@coresystems.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4929 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/cbfstool/common.h')
-rw-r--r--util/cbfstool/common.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/util/cbfstool/common.h b/util/cbfstool/common.h
index a41eb8a439..ede06e5340 100644
--- a/util/cbfstool/common.h
+++ b/util/cbfstool/common.h
@@ -34,6 +34,7 @@ static uint32_t virt_to_phys(void *addr)
#define ALIGN(val, by) (((val) + (by)-1)&~((by)-1))
+uint32_t getfilesize(const char *filename);
void *loadfile(const char *filename, uint32_t * romsize_p, void *content,
int place);
void *loadrom(const char *filename);
@@ -62,4 +63,7 @@ int create_cbfs_image(const char *romfile, uint32_t romsize,
int add_file_to_cbfs(void *content, uint32_t contentsize, uint32_t location);
void print_cbfs_directory(const char *filename);
+uint32_t cbfs_find_location(const char *romfile, uint32_t filesize,
+ const char *filename, uint32_t align);
+
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))