aboutsummaryrefslogtreecommitdiff
path: root/src/soc/intel/common/mrc_cache.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/intel/common/mrc_cache.h')
-rw-r--r--src/soc/intel/common/mrc_cache.h45
1 files changed, 18 insertions, 27 deletions
diff --git a/src/soc/intel/common/mrc_cache.h b/src/soc/intel/common/mrc_cache.h
index 6414accfcf..4511fc3016 100644
--- a/src/soc/intel/common/mrc_cache.h
+++ b/src/soc/intel/common/mrc_cache.h
@@ -19,34 +19,25 @@
#include <stddef.h>
#include <stdint.h>
-#define DEFAULT_MRC_CACHE "RW_MRC_CACHE"
-#define VARIABLE_MRC_CACHE "RW_VAR_MRC_CACHE"
-#define RECOVERY_MRC_CACHE "RECOVERY_MRC_CACHE"
-#define UNIFIED_MRC_CACHE "UNIFIED_MRC_CACHE"
+enum {
+ MRC_TRAINING_DATA,
+ MRC_VARIABLE_DATA,
+};
-/* Wrapper object to save MRC information. */
-struct mrc_saved_data {
- uint32_t signature;
- uint32_t size;
- uint32_t checksum;
- uint32_t version;
- uint8_t data[0];
-} __attribute__((packed));
-
-/* Locate the most recently saved MRC data. */
-int mrc_cache_get_current(const struct mrc_saved_data **cache);
-int mrc_cache_get_current_with_version(const struct mrc_saved_data **cache,
- uint32_t version);
-int mrc_cache_get_vardata(const struct mrc_saved_data **cache,
- uint32_t version);
-int mrc_cache_get_current_from_region(const struct mrc_saved_data **cache,
- uint32_t version,
- const char *region_name);
+/*
+ * It's up to the caller to decide when to retrieve and stash data. There is
+ * differentiation on recovery mode CONFIG_HAS_RECOVERY_MRC_CACHE, but that's
+ * only for locating where to retrieve and save the data. If a platform doesn't
+ * want to update the data then it shouldn't stash the data for saving.
+ * Similarly, if the platform doesn't need the data for booting because of a
+ * policy don't request the data.
+ */
-/* Stash the resulting MRC data to be saved in non-volatile storage later. */
-int mrc_cache_stash_data(const void *data, size_t size);
-int mrc_cache_stash_data_with_version(const void *data, size_t size,
- uint32_t version);
-int mrc_cache_stash_vardata(const void *data, size_t size, uint32_t version);
+/* Get and stash data for saving provided the type passed in. The functions
+ * return < 0 on error, 0 on success. */
+int mrc_cache_get_current(int type, uint32_t version,
+ struct region_device *rdev);
+int mrc_cache_stash_data(int type, uint32_t version, const void *data,
+ size_t size);
#endif /* _COMMON_MRC_CACHE_H_ */