aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/cbfs.h23
-rw-r--r--src/include/memlayout.h3
-rw-r--r--src/include/symbols.h1
3 files changed, 22 insertions, 5 deletions
diff --git a/src/include/cbfs.h b/src/include/cbfs.h
index a35597d5b1..32ed7f899e 100644
--- a/src/include/cbfs.h
+++ b/src/include/cbfs.h
@@ -3,10 +3,10 @@
#ifndef _CBFS_H_
#define _CBFS_H_
+#include <cbmem.h>
#include <commonlib/cbfs.h>
#include <program_loading.h>
-#include <stddef.h>
-#include <stdint.h>
+#include <types.h>
/***********************************************
* Perform CBFS operations on the boot device. *
@@ -42,8 +42,21 @@ size_t cbfs_load_and_decompress(const struct region_device *rdev, size_t offset,
/* Load stage into memory filling in prog. Return 0 on success. < 0 on error. */
int cbfs_prog_stage_load(struct prog *prog);
-/* Returns the region device of the currently active CBFS.
- Return < 0 on error, 0 on success. */
-int cbfs_boot_region_device(struct region_device *rdev);
+struct cbfs_boot_device {
+ struct region_device rdev;
+ void *mcache;
+ size_t mcache_size;
+};
+
+/* Helper to fill out |mcache| and |mcache_size| in a cbfs_boot_device. */
+void cbfs_boot_device_find_mcache(struct cbfs_boot_device *cbd, uint32_t id);
+
+/*
+ * Retrieves the currently active CBFS boot device. If |force_ro| is set, will
+ * always return the read-only CBFS instead (this only makes a difference when
+ * CONFIG(VBOOT) is enabled). May perform certain CBFS initialization tasks.
+ * Returns NULL on error (e.g. boot device IO error).
+ */
+const struct cbfs_boot_device *cbfs_get_boot_device(bool force_ro);
#endif
diff --git a/src/include/memlayout.h b/src/include/memlayout.h
index bd1d6846f0..bf830b7d24 100644
--- a/src/include/memlayout.h
+++ b/src/include/memlayout.h
@@ -71,6 +71,9 @@
_ = ASSERT(sz >= FMAP_SIZE, \
STR(FMAP does not fit in FMAP_CACHE! (sz < FMAP_SIZE)));
+#define CBFS_MCACHE(addr, sz) \
+ REGION(cbfs_mcache, addr, sz, 4)
+
#if ENV_ROMSTAGE_OR_BEFORE
#define PRERAM_CBFS_CACHE(addr, size) \
REGION(preram_cbfs_cache, addr, size, 4) \
diff --git a/src/include/symbols.h b/src/include/symbols.h
index 371d84bf9b..6fe24f5e44 100644
--- a/src/include/symbols.h
+++ b/src/include/symbols.h
@@ -33,6 +33,7 @@ DECLARE_REGION(stack)
DECLARE_REGION(preram_cbfs_cache)
DECLARE_REGION(postram_cbfs_cache)
DECLARE_REGION(cbfs_cache)
+DECLARE_REGION(cbfs_mcache)
DECLARE_REGION(fmap_cache)
DECLARE_REGION(tpm_tcpa_log)