[coreboot] [PATCH]cbfs locate function
patrick at georgi-clan.de
Fri Oct 16 00:56:25 CEST 2009
attached patch adds 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.
I need this function for my "newfailover" project, which will push most
of the current bootblock code into CBFS (everything but enable_rom).
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 approximative code flow is: link file, cbfstool locate, link file
again, cbfstool add-stage.
I'm not quite sure about the failure modes yet, so all it does for now
is returning an address of "0" if no suitable place could be found.
Maybe returning "1" is a better idea, as "0" is the value used when
cbfstool add-stage can freely choose the location. "1" should already
lead to an error.
Signed-off-by: Patrick Georgi <patrick.georgi at coresystems.de>
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 4899 bytes
Desc: not available
More information about the coreboot