diff options
author | Jakub Czapiga <jacz@semihalf.com> | 2022-01-03 15:06:21 +0000 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2022-01-12 16:15:59 +0000 |
commit | ad45f681aabc556b81cdca5f519be763a346db4a (patch) | |
tree | b80fd3cc5d0238690e1b6a3c2ca8d3483a4d9377 /payloads/libpayload/include | |
parent | b3398ba562b3b340eadcb6859a20f2a05df48551 (diff) |
libpayload/libcbfs: Add unverified_area APIs
This patch introduces equivalents of unverified_area CBFS access
functions added to the main coreboot tree in CB:59678
Change-Id: Ibadfd2a5cb6ad037ef1222b0a4301f90a79a127b
Signed-off-by: Jakub Czapiga <jacz@semihalf.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60714
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'payloads/libpayload/include')
-rw-r--r-- | payloads/libpayload/include/cbfs.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/payloads/libpayload/include/cbfs.h b/payloads/libpayload/include/cbfs.h index 8adadb737e..23b96695ef 100644 --- a/payloads/libpayload/include/cbfs.h +++ b/payloads/libpayload/include/cbfs.h @@ -17,9 +17,13 @@ static inline size_t cbfs_load(const char *name, void *buf, size_t size); static inline size_t cbfs_ro_load(const char *name, void *buf, size_t size); +static inline size_t cbfs_unverified_area_load(const char *area, const char *name, void *buf, + size_t size); static inline void *cbfs_map(const char *name, size_t *size_out); static inline void *cbfs_ro_map(const char *name, size_t *size_out); +static inline void *cbfs_unverified_area_map(const char *area, const char *name, + size_t *size_out); void cbfs_unmap(void *mapping); @@ -39,6 +43,9 @@ ssize_t _cbfs_boot_lookup(const char *name, bool force_ro, union cbfs_mdata *mda void *_cbfs_load(const char *name, void *buf, size_t *size_inout, bool force_ro); +void *_cbfs_unverified_area_load(const char *area, const char *name, void *buf, + size_t *size_inout); + /********************************************************************************************** * INLINE IMPLEMENTATIONS * **********************************************************************************************/ @@ -53,6 +60,12 @@ static inline void *cbfs_ro_map(const char *name, size_t *size_out) return _cbfs_load(name, NULL, size_out, true); } +static inline void *cbfs_unverified_area_map(const char *area, const char *name, + size_t *size_out) +{ + return _cbfs_unverified_area_load(area, name, NULL, size_out); +} + static inline size_t cbfs_load(const char *name, void *buf, size_t size) { if (_cbfs_load(name, buf, &size, false)) @@ -69,6 +82,15 @@ static inline size_t cbfs_ro_load(const char *name, void *buf, size_t size) return 0; } +static inline size_t cbfs_unverified_area_load(const char *area, const char *name, void *buf, + size_t size) +{ + if (_cbfs_unverified_area_load(area, name, buf, &size)) + return size; + else + return 0; +} + static inline size_t cbfs_get_size(const char *name) { union cbfs_mdata mdata; |