Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/35827 )
Change subject: drivers/pc80/rtc: Cache cmos_layout.bin region device ......................................................................
drivers/pc80/rtc: Cache cmos_layout.bin region device
This avoids needing to search for the cmos_layout.bin cbfs file each time cmos_get or cmos_set is called.
Change-Id: Ic7679269f28d090e9a99625d68b37e0bf02b061a Signed-off-by: Arthur Heymans arthur@aheymans.xyz --- M src/drivers/pc80/rtc/mc146818rtc.c 1 file changed, 14 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/27/35827/1
diff --git a/src/drivers/pc80/rtc/mc146818rtc.c b/src/drivers/pc80/rtc/mc146818rtc.c index 9ea5414..ecb02e8 100644 --- a/src/drivers/pc80/rtc/mc146818rtc.c +++ b/src/drivers/pc80/rtc/mc146818rtc.c @@ -17,6 +17,7 @@
#include <arch/acpi.h> #include <arch/io.h> +#include <arch/early_variables.h> #include <bcd.h> #include <fallback.h> #include <version.h> @@ -242,10 +243,19 @@ return CB_SUCCESS; }
+static struct region_device layout_rdev CAR_GLOBAL; +static struct region_device *layout_rdev_p CAR_GLOBAL; + static enum cb_err locate_cmos_layout(struct region_device *rdev) { uint32_t cbfs_type = CBFS_COMPONENT_CMOS_LAYOUT; struct cbfsf fh; + struct region_device *cmos_layout_rdev = car_get_ptr(layout_rdev_p); + + if (cmos_layout_rdev) { + rdev = cmos_layout_rdev; + return CB_SUCCESS; + }
/* * In case VBOOT is enabled and this function is called from SMM, @@ -261,7 +271,10 @@ return CB_CMOS_LAYOUT_NOT_FOUND; }
- cbfs_file_data(rdev, &fh); + cbfs_file_data(cmos_layout_rdev, &fh); + + car_set_var(layout_rdev, *cmos_layout_rdev); + car_set_ptr(layout_rdev_p, car_get_ptr(&layout_rdev));
return CB_SUCCESS; }