summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShelley Chen <shchen@google.com>2020-08-04 14:43:28 -0700
committerShelley Chen <shchen@google.com>2020-08-24 23:31:26 +0000
commit9c9353422e73ab0d819eeaf970f4b892ee512b2c (patch)
tree9e8f3e953f649d76e6940c97b149de26c66270dd /src
parentad9cd687b83061391d44bfc55a625b5571ff32a9 (diff)
mrc_cache: Move mrc_cache_stash_data to end of file
We need to pull update_mrc_cache into mrc_cache_stash_data, so moving to end of the file to make sure update_mrc_cache is defined before. BUG=b:150502246 BRANCH=None TEST=Testing on a nami (x86) device: reboot from ec console. Make sure memory training happens. reboot from ec console. Make sure that we don't do training again. Signed-off-by: Shelley Chen <shchen@google.com> Change-Id: I9e14fec96e9dabceafc2f6f5663fc6f1023f0395 Reviewed-on: https://review.coreboot.org/c/coreboot/+/44195 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/drivers/mrc_cache/mrc_cache.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/src/drivers/mrc_cache/mrc_cache.c b/src/drivers/mrc_cache/mrc_cache.c
index 1b1ad6332f..0e42120c1b 100644
--- a/src/drivers/mrc_cache/mrc_cache.c
+++ b/src/drivers/mrc_cache/mrc_cache.c
@@ -109,41 +109,6 @@ static const struct cache_region *lookup_region_type(int type)
return NULL;
}
-int mrc_cache_stash_data(int type, uint32_t version, const void *data,
- size_t size)
-{
- const struct cache_region *cr;
- size_t cbmem_size;
- struct mrc_metadata *md;
-
- cr = lookup_region_type(type);
- if (cr == NULL) {
- printk(BIOS_ERR, "MRC: failed to add to cbmem for type %d.\n",
- type);
- return -1;
- }
-
- cbmem_size = sizeof(*md) + size;
-
- md = cbmem_add(cr->cbmem_id, cbmem_size);
-
- if (md == NULL) {
- printk(BIOS_ERR, "MRC: failed to add '%s' to cbmem.\n",
- cr->name);
- return -1;
- }
-
- memset(md, 0, sizeof(*md));
- md->signature = MRC_DATA_SIGNATURE;
- md->data_size = size;
- md->version = version;
- md->data_checksum = compute_ip_checksum(data, size);
- md->header_checksum = compute_ip_checksum(md, sizeof(*md));
- memcpy(&md[1], data, size);
-
- return 0;
-}
-
static const struct cache_region *lookup_region(struct region *r, int type)
{
const struct cache_region *cr;
@@ -596,6 +561,41 @@ static void update_mrc_cache(void *unused)
protect_mrc_region();
}
+int mrc_cache_stash_data(int type, uint32_t version, const void *data,
+ size_t size)
+{
+ const struct cache_region *cr;
+ size_t cbmem_size;
+ struct mrc_metadata *md;
+
+ cr = lookup_region_type(type);
+ if (cr == NULL) {
+ printk(BIOS_ERR, "MRC: failed to add to cbmem for type %d.\n",
+ type);
+ return -1;
+ }
+
+ cbmem_size = sizeof(*md) + size;
+
+ md = cbmem_add(cr->cbmem_id, cbmem_size);
+
+ if (md == NULL) {
+ printk(BIOS_ERR, "MRC: failed to add '%s' to cbmem.\n",
+ cr->name);
+ return -1;
+ }
+
+ memset(md, 0, sizeof(*md));
+ md->signature = MRC_DATA_SIGNATURE;
+ md->data_size = size;
+ md->version = version;
+ md->data_checksum = compute_ip_checksum(data, size);
+ md->header_checksum = compute_ip_checksum(md, sizeof(*md));
+ memcpy(&md[1], data, size);
+
+ return 0;
+}
+
/*
* Ensures MRC training data is stored into SPI after PCI enumeration is done.
* Some implementations may require this to be later than others.