diff options
author | Aaron Durbin <adurbin@chromium.org> | 2015-09-17 16:09:30 -0500 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2015-10-07 10:46:11 +0000 |
commit | 37a5d15da92a9fb8a682a32ef1eaf37734fcc5ad (patch) | |
tree | 8f37c1712f44789501a830fdaaaf22012972738c /src/include | |
parent | 72bb66eb9cecf94b66a4aca3586165d5495fcfdb (diff) |
cbfs: add struct cbfsf
Now that cbfs is adding more metadata in the cbfs file
header one needs to access that metadata. Therefore,
add struct cbfsf which tracks the metadata and data
of the file separately. Note that stage and payload
metadata specific to itself is still contained within
the 'data' portion of a cbfs file. Update the cbfs
API to use struct cbfsf. Additionally, remove struct
cbfsd as there's nothing else associated with a cbfs
region aside from offset and size which tracked
by a region_device (thanks, CBFS_ALIGNMENT!).
BUG=None
BRANCH=None
TEST=Built and booted through end of ramstage on qemu armv7.
Built and booted glados using Chrome OS.
Change-Id: I05486c6cf6cfcafa5c64b36324833b2374f763c2
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/11679
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/cbfs.h | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/include/cbfs.h b/src/include/cbfs.h index f23a82a173..5d60716ef4 100644 --- a/src/include/cbfs.h +++ b/src/include/cbfs.h @@ -30,8 +30,8 @@ * - cbfsd which is a descriptor for representing a cbfs instance */ -/* Descriptor for cbfs lookup operations. */ -struct cbfsd; +/* Object representing cbfs files. */ +struct cbfsf; /*********************************************** * Perform CBFS operations on the boot device. * @@ -43,8 +43,7 @@ void *cbfs_boot_map_optionrom(uint16_t vendor, uint16_t device); * failure. */ void *cbfs_boot_load_stage_by_name(const char *name); /* Locate file by name and optional type. Return 0 on success. < 0 on error. */ -int cbfs_boot_locate(struct region_device *fh, const char *name, - uint32_t *type); +int cbfs_boot_locate(struct cbfsf *fh, const char *name, uint32_t *type); /* Map file into memory leaking the mapping. Only should be used when * leaking mappings are a no-op. Returns NULL on error, else returns * the mapping and sets the size of the file. */ @@ -55,7 +54,7 @@ int cbfs_prog_stage_load(struct prog *prog); /* Locate file by name and optional type. Returns 0 on succcess else < 0 on * error.*/ -int cbfs_locate(struct region_device *fh, const struct cbfsd *cbfs, +int cbfs_locate(struct cbfsf *fh, const struct region_device *cbfs, const char *name, uint32_t *type); /***************************************************************** @@ -64,10 +63,17 @@ int cbfs_locate(struct region_device *fh, const struct cbfsd *cbfs, * API. * *****************************************************************/ -struct cbfsd { - const struct region_device *rdev; +struct cbfsf { + struct region_device metadata; + struct region_device data; }; +static inline void cbfs_file_data(struct region_device *data, + const struct cbfsf *file) +{ + rdev_chain(data, &file->data, 0, region_device_sz(&file->data)); +} + /* The cbfs_props struct describes the properties associated with a CBFS. */ struct cbfs_props { /* CBFS starts at the following offset within the boot region. */ |