diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/cbfs.h | 15 | ||||
-rw-r--r-- | src/include/symbols.h | 6 |
2 files changed, 17 insertions, 4 deletions
diff --git a/src/include/cbfs.h b/src/include/cbfs.h index e08af56399..426757d3f5 100644 --- a/src/include/cbfs.h +++ b/src/include/cbfs.h @@ -5,6 +5,7 @@ #include <cbmem.h> #include <commonlib/cbfs.h> +#include <commonlib/mem_pool.h> #include <program_loading.h> #include <types.h> #include <vb2_sha.h> @@ -26,7 +27,7 @@ static inline void *cbfs_ro_map(const char *name, size_t *size_out); /* Removes a previously allocated CBFS mapping. Should try to unmap mappings in strict LIFO order where possible, since mapping backends often don't support more complicated cases. */ -int cbfs_unmap(void *mapping); +void cbfs_unmap(void *mapping); /* Load a file from CBFS into a buffer. Returns amount of loaded bytes on success or 0 on error. File will get decompressed as necessary. */ @@ -38,11 +39,22 @@ static inline size_t cbfs_ro_load(const char *name, void *buf, size_t buf_size); /* Load stage into memory filling in prog. Return 0 on success. < 0 on error. */ int cbfs_prog_stage_load(struct prog *prog); + /********************************************************************************************** * BOOT DEVICE HELPER APIs * **********************************************************************************************/ /* + * The shared memory pool for backing mapped CBFS files, and other CBFS allocation needs. + * On x86 platforms, this would only be needed to transparently map compressed files, but it + * would require a permanent CBMEM carveout to be safe to use during S3 resume. Since it's not + * clear whether this feature is necessary or worth the wasted memory, it is currently disabled + * but could be added behind a Kconfig later if desired. + */ +#define CBFS_CACHE_AVAILABLE (!CONFIG(ARCH_X86)) +extern struct mem_pool cbfs_cache; + +/* * Data structure that represents "a" CBFS boot device, with optional metadata cache. Generally * we only have one of these, or two (RO and RW) when CONFIG(VBOOT) is set. The region device * stored here must always be a subregion of boot_device_ro(). @@ -95,6 +107,7 @@ void *cbfs_boot_map_optionrom_revision(uint16_t vendor, uint16_t device, uint8_t size_t cbfs_load_and_decompress(const struct region_device *rdev, size_t offset, size_t in_size, void *buffer, size_t buffer_size, uint32_t compression); + /********************************************************************************************** * INTERNAL HELPERS FOR INLINES, DO NOT USE. * **********************************************************************************************/ diff --git a/src/include/symbols.h b/src/include/symbols.h index fe449d9b4f..3e4694b90d 100644 --- a/src/include/symbols.h +++ b/src/include/symbols.h @@ -32,9 +32,9 @@ DECLARE_OPTIONAL_REGION(timestamp) DECLARE_REGION(preram_cbmem_console) DECLARE_REGION(cbmem_init_hooks) DECLARE_REGION(stack) -DECLARE_REGION(preram_cbfs_cache) -DECLARE_REGION(postram_cbfs_cache) -DECLARE_REGION(cbfs_cache) +DECLARE_OPTIONAL_REGION(preram_cbfs_cache) +DECLARE_OPTIONAL_REGION(postram_cbfs_cache) +DECLARE_OPTIONAL_REGION(cbfs_cache) DECLARE_REGION(cbfs_mcache) DECLARE_REGION(fmap_cache) DECLARE_REGION(tpm_tcpa_log) |