summaryrefslogtreecommitdiff
path: root/src/commonlib/bsd/include
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2020-10-01 18:25:49 -0700
committerPatrick Georgi <pgeorgi@google.com>2020-12-02 22:13:42 +0000
commitd17ce41e29018176ad43f5228f17ba93cab4a346 (patch)
tree18b98d912f631ea900522c9123a9295f38f9e600 /src/commonlib/bsd/include
parent834b3ecd7cbefbad8f09a9bda4f10cd7842cdbcd (diff)
downloadcoreboot-d17ce41e29018176ad43f5228f17ba93cab4a346.tar.xz
cbfs: Port cbfs_load() and cbfs_map() to new API
This patch adapts cbfs_load() and cbfs_map() to use the new CBFS API directly, rather than through cbfs_boot_locate(). For cbfs_load() this means that attribute metadata does not need to be read twice. Change-Id: I754cc34b1c1471129e15475aa0f1891e02439a02 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/39305 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/commonlib/bsd/include')
-rw-r--r--src/commonlib/bsd/include/commonlib/bsd/cbfs_private.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/commonlib/bsd/include/commonlib/bsd/cbfs_private.h b/src/commonlib/bsd/include/commonlib/bsd/cbfs_private.h
index 64dcf9f5ba..b72463aba3 100644
--- a/src/commonlib/bsd/include/commonlib/bsd/cbfs_private.h
+++ b/src/commonlib/bsd/include/commonlib/bsd/cbfs_private.h
@@ -134,4 +134,9 @@ cb_err_t cbfs_mcache_lookup(const void *mcache, size_t mcache_size, const char *
/* Returns the amount of bytes actually used by the CBFS metadata cache in |mcache|. */
size_t cbfs_mcache_real_size(const void *mcache, size_t mcache_size);
+/* Finds a CBFS attribute in a metadata block. Attribute returned as-is (still big-endian).
+ If |size| is not 0, will check that it matches the length of the attribute (if found)...
+ else caller is responsible for checking the |len| field to avoid reading out-of-bounds. */
+const void *cbfs_find_attr(const union cbfs_mdata *mdata, uint32_t attr_tag, size_t size_check);
+
#endif /* _COMMONLIB_BSD_CBFS_PRIVATE_H_ */