From 765120383b235beeb1288ec5af875af25d4806c3 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Thu, 3 May 2018 19:15:00 +0200 Subject: [PATCH] soc/intel/common: Allow exporting the size of the VBT Change-Id: Ib340aad846ea7cb61d650928b495efaa1fc2d641 Signed-off-by: Patrick Georgi Reviewed-on: https://review.coreboot.org/26038 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin Reviewed-by: Furquan Shaikh --- src/soc/intel/common/vbt.c | 7 +++++-- src/soc/intel/common/vbt.h | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/soc/intel/common/vbt.c b/src/soc/intel/common/vbt.c index 9e3cb3516b..50d3951179 100644 --- a/src/soc/intel/common/vbt.c +++ b/src/soc/intel/common/vbt.c @@ -33,7 +33,7 @@ const char *mainboard_vbt_filename(void) static char vbt_data[8 * KiB]; static int vbt_data_used; -void *locate_vbt(void) +void *locate_vbt(size_t *vbt_size) { uint32_t vbtsig = 0; @@ -48,6 +48,9 @@ void *locate_vbt(void) if (file_size == 0) return NULL; + if (vbt_size) + *vbt_size = file_size; + memcpy(&vbtsig, vbt_data, sizeof(vbtsig)); if (vbtsig != VBT_SIGNATURE) { printk(BIOS_ERR, "Missing/invalid signature in VBT data file!\n"); @@ -72,5 +75,5 @@ void *vbt_get(void) return NULL; if (!display_init_required()) return NULL; - return locate_vbt(); + return locate_vbt(NULL); } diff --git a/src/soc/intel/common/vbt.h b/src/soc/intel/common/vbt.h index 615af4b29c..1bc536e430 100644 --- a/src/soc/intel/common/vbt.h +++ b/src/soc/intel/common/vbt.h @@ -27,8 +27,11 @@ */ const char *mainboard_vbt_filename(void); -/* locate vbt.bin file. Returns a pointer to its content. */ -void *locate_vbt(void); +/* + * locate vbt.bin file. Returns a pointer to its content. + * If vbt_size is non-NULL, also return the vbt's size. + */ +void *locate_vbt(size_t *vbt_size); /* * Returns VBT pointer and mapping after checking prerequisites for Pre OS * Graphics initialization