summaryrefslogtreecommitdiff
path: root/include/cbfs.h
AgeCommit message (Collapse)Author
2022-04-06cbfs: Add some more definititionsSimon Glass
Add definitions for a payload or 'self', which is like an unpacked ELF file. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-19doc: replace @return by Return:Heinrich Schuchardt
Sphinx expects Return: and not @return to indicate a return value. find . -name '*.c' -exec \ sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \; find . -name '*.h' -exec \ sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \; Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2021-03-27cbfs: Support reading compression informationSimon Glass
CBFS now supports compressed filed. Add support for reading this information so that the correct decompression can be applied. The decompression itself is not implemented in CBFS. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-27cbfs: Allow file traversal with any CBFSSimon Glass
The file traversal functions currently use a single global CBFS. In some cases we need to access multiple CBFSs to obtain different files. Add new functions to support this. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-27cbfs: Allow access to CBFS without a headerSimon Glass
In some cases CBFS does not start with a header but is just a collection of files. It is possible to support this so long as the size of the CBFS is provided. Update the cbfs_init_mem() function to support this. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-27cbfs: Add support for attributesSimon Glass
CBFS now supports attributes for things that cannot fit in the header as originally conceived. Add the structures for these. Also rename attributes_offset to something shorter, to ease code readability. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-27cbfs: Don't require the CBFS size with cbfs_init_mem()Simon Glass
The size is not actually used since it is present in the header. Drop this parameter. Also tidy up error handling while we are here. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2020-05-27cbfs: Allow reading a file from a CBFS given its base addrSimon Glass
Currently we support reading a file from CBFS given the address of the end of the ROM. Sometimes we only know the start of the CBFS. Add a function to find a file given that. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2020-05-27cbfs: Change file_cbfs_find_uncached() to return an errorSimon Glass
This function currently returns a node pointer so there is no way to know the error code. Also it uses data in BSS which seems unnecessary since the caller might prefer to use a local variable. Update the function and split its body out into a separate function so we can use it later. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2020-05-27cbfs: Return the error code from file_cbfs_init()Simon Glass
We may as well return the error code and use it directly in the command code. CBFS still uses its own error enum which we may be able to remove, but leave it for now. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2020-05-27cbfs: Use ulong consistentlySimon Glass
U-Boot uses ulong for addresses but there are a few places in this driver that don't use it. Convert this driver over to follow this convention fully. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2020-05-27cbfs: drop file_cbfs_result declarationChristian Gmeiner
It is not definded anywhere. Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com> Reviewed-by: Heinrich Schuchardt <xypron.gpk@gmx.de> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2020-04-30x86: cbfs: Drop unwanted declarationSimon Glass
The intention here is add a forward declaration, not actually declare a variable. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-11-02cbfs: do not pack struct cbfs_cachenodeHeinrich Schuchardt
With the __packed attribute sandbox_defconfig cannot be compiled with GCC 9.2.1: fs/cbfs/cbfs.c: In function ‘file_cbfs_fill_cache’: fs/cbfs/cbfs.c:164:16: error: taking address of packed member of ‘struct cbfs_cachenode’ may result in an unaligned pointer value [-Werror=address-of-packed-member] 164 | cache_tail = &new_node->next; | ^~~~~~~~~~~~~~~ struct cbfs_cachenode is only an internal structure. So let's rearrange the fields such that the structure is naturally packed and remove the __packed attribute. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2019-08-18cbfs: Add functions to support multiple CBFSsSimon Glass
Sometimes an image has multiple CBFS. The current CBFS API is limited to handling only one at time. Also it keeps track of the CBFS internally in BSS, which does not work before relocation, for example. Add a few new functions to overcome these limitations. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com>
2019-08-18cbfs: Move result variable into the structSimon Glass
Move the result variable into the struct also, so that it can be used when BSS is not available. Add a function to read it. Note that all functions sill use the BSS version of the data. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com>
2019-07-23cbfs: Rename checksum to attributes_offsetSimon Glass
It seems that this field has been renamed in later version of coreboot. Update it. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-23cbfs: Add an enum and comment for the magic numberSimon Glass
This field is not commented in the original file. Add a comment. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-12-31fs: cbfs: Add missing standard CBFS component typesBin Meng
Current CBFS component type list is incomplete. Add missing ones. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-12-31fs: cbfs: Make all CBFS_TYPE_xxx macros consistentBin Meng
At present there are 2 macros that are named as CBFS_COMPONENT_xxx. Change them to CBFS_TYPE_xxx for consistency. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-05-07SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
2013-07-24Add GPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk
Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Fixup common/cmd_io.c] Signed-off-by: Tom Rini <trini@ti.com>
2012-12-06cbfs: Add docbook templateSimon Glass
This adds a docbook template for fs, and makes CBFS use it. Signed-off-by: Simon Glass <sjg@chromium.org>
2012-12-06cbfs: Remove mention of CREDITS filesSimon Glass
As requested by Wolfgang, remove references to CREDITS in the CBFS files. Signed-off-by: Simon Glass <sjg@chromium.org>
2012-10-22fs: Add a Coreboot Filesystem (CBFS) driver and commandsGabe Black
This change adds CBFS support and some commands to use it to u-boot. These commands are: cbfsinit - Initialize CBFS support and pull all metadata into RAM. The end of the ROM is an optional parameter which defaults to the standard 0xffffffff and can be used to support multiple CBFSes in a system. The last one set up with cbfsinit is the one that will be used. cbfsinfo - Print information from the CBFS header. cbfsls - Print out the size, type, and name of all the files in the current CBFS. Recognized types are translated into symbolic names. cbfsload - Load a file from CBFS into memory. Like the similar command for fat filesystems, you can optionally provide a maximum size. Support for CBFS is compiled in when the CONFIG_CMD_CBFS option is specified. The CBFS driver can also be used programmatically from within u-boot. If u-boot needs something out of CBFS very early before the heap is configured, it won't be able to use the normal CBFS support which caches some information in memory it allocates from the heap. The cbfs_file_find_uncached function searches a CBFS instance without touching the heap. Signed-off-by: Gabe Black <gabeblack@google.com> Signed-off-by: Stefan Reinauer <reinauer@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>