Shelley Chen has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/46110 )
Change subject: mrc_cache: Add data_size parameter to mrc_cache_load_current ......................................................................
mrc_cache: Add data_size parameter to mrc_cache_load_current
Add parameter so that caller will know what the actual size of the data returned is. This is needed for ARM devices like trogdor, which need to know the size of the training data when populating the QcLib interface table.
BUG=b:150502246 BRANCH=None TEST=./util/abuild/abuild -p none -t GOOGLE_NAMI -x -a
Change-Id: Ia314717ad2a7d5232b37a19951c1aecd7f843c27 Signed-off-by: Shelley Chen shchen@google.com --- M src/drivers/mrc_cache/mrc_cache.c M src/include/mrc_cache.h 2 files changed, 7 insertions(+), 7 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/10/46110/1
diff --git a/src/drivers/mrc_cache/mrc_cache.c b/src/drivers/mrc_cache/mrc_cache.c index d2991ac..ded3181 100644 --- a/src/drivers/mrc_cache/mrc_cache.c +++ b/src/drivers/mrc_cache/mrc_cache.c @@ -261,23 +261,23 @@ }
int mrc_cache_load_current(int type, uint32_t version, void *buffer, - size_t buffer_size) + size_t buffer_size, size_t *data_size) { struct region_device rdev; struct mrc_metadata md; - size_t data_size; + size_t dsize;
if (mrc_cache_find_current(type, version, &rdev, &md) < 0) return -1;
- data_size = region_device_sz(&rdev); - if (buffer_size < data_size) + *data_size = dsize = region_device_sz(&rdev); + if (buffer_size < dsize) return -1;
- if (rdev_readat(&rdev, buffer, 0, data_size) != data_size) + if (rdev_readat(&rdev, buffer, 0, dsize) != dsize) return -1;
- if (mrc_data_valid(&md, buffer, data_size) < 0) + if (mrc_data_valid(&md, buffer, dsize) < 0) return -1;
return 0; diff --git a/src/include/mrc_cache.h b/src/include/mrc_cache.h index da2bf79..cb713a1 100644 --- a/src/include/mrc_cache.h +++ b/src/include/mrc_cache.h @@ -31,7 +31,7 @@ * success. */ int mrc_cache_load_current(int type, uint32_t version, void *buffer, - size_t buffer_size); + size_t buffer_size, size_t *data_size); /** * mrc_cache_mmap_leak *