aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2019-10-07 12:04:43 +0200
committerPatrick Georgi <pgeorgi@google.com>2019-10-23 14:23:29 +0000
commit88e9c5af574130483de24cdc1e2328e0dd622793 (patch)
tree536e2d2351f349dd77e9a55547444c1dc4188ec8 /src
parent62a6741bba6d0752412f3cdf8ada94f0cc25a603 (diff)
drivers/pc80/rtc: Avoid searching for cmos_layout.bin on each get/set_option
Avoid searching for cmos_layout.bin each time get/set_option is called on platforms with NO_CAR_GLOBAL_MIGRATION. Change-Id: Ie541017d2f8c8e9d4b592b71f44a08fd9670dd09 Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/35848 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src')
-rw-r--r--src/drivers/pc80/rtc/mc146818rtc.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/drivers/pc80/rtc/mc146818rtc.c b/src/drivers/pc80/rtc/mc146818rtc.c
index f6c748d0cb..abf8b2556f 100644
--- a/src/drivers/pc80/rtc/mc146818rtc.c
+++ b/src/drivers/pc80/rtc/mc146818rtc.c
@@ -241,7 +241,7 @@ static enum cb_err get_cmos_value(unsigned long bit, unsigned long length,
static enum cb_err locate_cmos_layout(struct region_device *rdev)
{
uint32_t cbfs_type = CBFS_COMPONENT_CMOS_LAYOUT;
- struct cbfsf fh;
+ MAYBE_STATIC_BSS struct cbfsf fh = {};
/*
* In case VBOOT is enabled and this function is called from SMM,
@@ -250,11 +250,13 @@ static enum cb_err locate_cmos_layout(struct region_device *rdev)
*
* Support only one CMOS layout in the 'COREBOOT' region for now.
*/
- if (cbfs_locate_file_in_region(&fh, "COREBOOT", "cmos_layout.bin",
- &cbfs_type)) {
- printk(BIOS_ERR, "RTC: cmos_layout.bin could not be found. "
+ if (!region_device_sz(&(fh.data))) {
+ if (cbfs_locate_file_in_region(&fh, "COREBOOT", "cmos_layout.bin",
+ &cbfs_type)) {
+ printk(BIOS_ERR, "RTC: cmos_layout.bin could not be found. "
"Options are disabled\n");
- return CB_CMOS_LAYOUT_NOT_FOUND;
+ return CB_CMOS_LAYOUT_NOT_FOUND;
+ }
}
cbfs_file_data(rdev, &fh);