mrc_cache: Change mrc_cache_load_current to return size of entry

Modify mrc_cache_load current to return the size of the mrc_cache
entry 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>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/46110
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
Shelley Chen 2020-10-06 15:14:24 -07:00
parent 60d4f2411c
commit 93d483db89
2 changed files with 8 additions and 8 deletions

View File

@ -260,12 +260,12 @@ static int mrc_cache_find_current(int type, uint32_t version,
return rdev_chain(rdev, rdev, md_size, data_size);
}
int mrc_cache_load_current(int type, uint32_t version, void *buffer,
ssize_t mrc_cache_load_current(int type, uint32_t version, void *buffer,
size_t buffer_size)
{
struct region_device rdev;
struct mrc_metadata md;
size_t data_size;
ssize_t data_size;
if (mrc_cache_find_current(type, version, &rdev, &md) < 0)
return -1;
@ -280,7 +280,7 @@ int mrc_cache_load_current(int type, uint32_t version, void *buffer,
if (mrc_data_valid(&md, buffer, data_size) < 0)
return -1;
return 0;
return data_size;
}
void *mrc_cache_current_mmap_leak(int type, uint32_t version,

View File

@ -27,10 +27,10 @@ enum {
* mrc_cache_load_current
*
* Fill in the buffer with the latest slot data. This will be a
* common entry point for ARM platforms. Returns < 0 on error, 0 on
* success.
* common entry point for ARM platforms. Returns < 0 on error, size
* of the returned data on success.
*/
int mrc_cache_load_current(int type, uint32_t version, void *buffer,
ssize_t mrc_cache_load_current(int type, uint32_t version, void *buffer,
size_t buffer_size);
/**
* mrc_cache_mmap_leak