summaryrefslogtreecommitdiff
path: root/src/vendorcode/google
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2015-05-08 17:07:04 -0500
committerPatrick Georgi <pgeorgi@google.com>2015-05-11 22:39:49 +0200
commit1e8be636cc941ab262ce08401ede0bf4555985b0 (patch)
treed2c6c436826d9647b491e48c1c17957d9477cdf5 /src/vendorcode/google
parentc6100e54213c2abdf3e873c000f4cdce884e3f3d (diff)
downloadcoreboot-1e8be636cc941ab262ce08401ede0bf4555985b0.tar.xz
vboot: add vb2_working_data_size()
Instead of using the symbols directly provide a size function to provide symmetry between getting the work data and size. It also allows for an abstraction where the linker symbols may not be the only source of this information. Change-Id: I4568064a0050d118c3544ab1ea59a08eb0bad8e4 Signed-off-by: Aaron Durbi <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/10156 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'src/vendorcode/google')
-rw-r--r--src/vendorcode/google/chromeos/vboot2/common.c5
-rw-r--r--src/vendorcode/google/chromeos/vboot2/misc.h1
-rw-r--r--src/vendorcode/google/chromeos/vboot2/vboot_loader.c6
3 files changed, 10 insertions, 2 deletions
diff --git a/src/vendorcode/google/chromeos/vboot2/common.c b/src/vendorcode/google/chromeos/vboot2/common.c
index beffebeba1..289005c996 100644
--- a/src/vendorcode/google/chromeos/vboot2/common.c
+++ b/src/vendorcode/google/chromeos/vboot2/common.c
@@ -30,6 +30,11 @@ struct vb2_working_data * const vboot_get_working_data(void)
return (struct vb2_working_data *)_vboot2_work;
}
+size_t vb2_working_data_size(void)
+{
+ return _vboot2_work_size;
+}
+
void *vboot_get_work_buffer(struct vb2_working_data *wd)
{
return (void *)((uintptr_t)wd + wd->buffer_offset);
diff --git a/src/vendorcode/google/chromeos/vboot2/misc.h b/src/vendorcode/google/chromeos/vboot2/misc.h
index d942d5649b..175e2c244d 100644
--- a/src/vendorcode/google/chromeos/vboot2/misc.h
+++ b/src/vendorcode/google/chromeos/vboot2/misc.h
@@ -43,6 +43,7 @@ struct vb2_working_data {
};
struct vb2_working_data * const vboot_get_working_data(void);
+size_t vb2_working_data_size(void);
void *vboot_get_work_buffer(struct vb2_working_data *wd);
static inline void vb2_get_selected_region(struct vb2_working_data *wd,
diff --git a/src/vendorcode/google/chromeos/vboot2/vboot_loader.c b/src/vendorcode/google/chromeos/vboot2/vboot_loader.c
index 929f0cbb2b..505c9c0090 100644
--- a/src/vendorcode/google/chromeos/vboot2/vboot_loader.c
+++ b/src/vendorcode/google/chromeos/vboot2/vboot_loader.c
@@ -63,15 +63,17 @@ static int verstage_should_load(void)
static void init_vb2_working_data(void)
{
struct vb2_working_data *wd;
+ size_t work_size;
+ work_size = vb2_working_data_size();
wd = vboot_get_working_data();
- memset(wd, 0, _vboot2_work_size);
+ memset(wd, 0, work_size);
/*
* vboot prefers 16-byte alignment. This takes away 16 bytes
* from the VBOOT2_WORK region, but the vboot devs said that's okay.
*/
wd->buffer_offset = ALIGN_UP(sizeof(*wd), 16);
- wd->buffer_size = _vboot2_work_size - wd->buffer_offset;
+ wd->buffer_size = work_size - wd->buffer_offset;
}
static int vboot_loader_active(struct prog *prog)