[coreboot] RFC: Allow CBFS to read from multiple arbitrary source media.
hungte at chromium.org
Tue Jan 29 11:08:16 CET 2013
I've uploaded some CBFS changes for discussion:
CBFS used to work only on memory-mapped ROM (all x86). For platforms
like ARM, the ROM may come from USB, UART, or SPI -- any serial devices and
not available for memory mapping.
The idea is to allow (1) using CBFS on platforms without memory-mapped
ROM (ex, ARM), and (2) reading CBFS from multiple source at the same time
(ex, receive updates from USB or UART cable).
The first patch is for coreboot itself, and the second one is to
provide some implementation on libpayload.
I tried to minimize necessary changes to existing source, although the
API names are changed - but rewriting should be easy. In summary, if you
don't need to read from multiple sources at the same time, just add a
CBFS_DEFAULT_MEDIA param to every CBFS functions.
The major reader APIs are renamed because we don't "find" anymore:
struct cbfs_file *f = cbfs_find(name); => f = cbfs_get_file(media,
void *p = cbfs_find_file(name, type) => p =
cbfs_get_file_content(media, name, type);
(One function is deprecated: cbfs_get_file => it can be replaced with
cbfs_get_file_content with correct type, although I don't see anyone using
it in source tree now)
To read from multiple source, libpayload used to do this:
which is hard to figure out current cbfs source inside function calls.
With the new API, we can rewrite as:
cbfs_media *ram = create_cbfs_ram_media(), *default =
The CL is tested to work on both ARM and x86/qemu. I would be really
happy to see people checking the patch, and especially checking that my
implementation is correct. I'm also happy to hear about improvements, bug
fixes, and other ideas.
Thanks for listening,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the coreboot