summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2019-12-05 22:29:07 -0800
committerPatrick Georgi <pgeorgi@google.com>2020-01-18 10:51:04 +0000
commit815611ef56fd1059ae79f0024cb36454a69a05fc (patch)
tree9c559cb5a04ebf60d9aa6a0e32b36a9d517bbf96 /src/lib
parent029d67278bd53ef9918045712880f3cc9c61a605 (diff)
cbfs: Remove locator concept
When vboot was first integrated into CBFS it was still part of Google vendorcode. So to not directly tie custom vendorcode into the core CBFS library, the concept of cbfs_locator was introduced to decouple core code from an arbitrary amount of platform-specific implementations that want to decide where the CBFS can be found. Nowadays vboot is a core coreboot feature itself, and the locator concept isn't used by anything else anymore. This patch simplifies the code by removing it and just calling vboot from the CBFS library directly. That should make it easier to more closely integrate vboot into CBFS in the future. Change-Id: I7b9112adc7b53aa218c58b8cb5c85982dcc1dbc0 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/38419 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/cbfs.c59
1 files changed, 3 insertions, 56 deletions
diff --git a/src/lib/cbfs.c b/src/lib/cbfs.c
index 636ff70de8..e31c7cc925 100644
--- a/src/lib/cbfs.c
+++ b/src/lib/cbfs.c
@@ -27,6 +27,7 @@
#include <timestamp.h>
#include <fmap.h>
#include <security/vboot/vboot_crtm.h>
+#include <security/vboot/vboot_common.h>
#define ERROR(x...) printk(BIOS_ERR, "CBFS: " x)
#define LOG(x...) printk(BIOS_INFO, "CBFS: " x)
@@ -279,63 +280,9 @@ out:
return 0;
}
-/* The default locator to find the CBFS in the "COREBOOT" FMAP region. */
-int cbfs_default_region_device(struct region_device *rdev)
-{
- if (fmap_locate_area_as_rdev("COREBOOT", rdev))
- return -1;
-
- printk(BIOS_SPEW, "CBFS @ %zx size %zx\n",
- region_device_offset(rdev), region_device_sz(rdev));
-
- return 0;
-}
-
-/* This struct is marked as weak to allow a particular platform to
- * override the master header logic. This implementation should work for most
- * devices. */
-const struct cbfs_locator __weak cbfs_default_locator = {
- .name = "COREBOOT Locator",
- .locate = cbfs_default_region_device,
-};
-
-extern const struct cbfs_locator vboot_locator;
-
-static const struct cbfs_locator *locators[] = {
-#if CONFIG(VBOOT)
- /*
- * NOTE: Does not link in SMM, as the vboot_locator isn't compiled.
- * ATM there's no need for VBOOT functionality in SMM and it's not
- * a problem.
- */
- &vboot_locator,
-#endif
- &cbfs_default_locator,
-};
-
int cbfs_boot_region_device(struct region_device *rdev)
{
- int i;
-
boot_device_init();
-
- for (i = 0; i < ARRAY_SIZE(locators); i++) {
- const struct cbfs_locator *ops;
-
- ops = locators[i];
-
- if (ops->locate == NULL)
- continue;
-
- if (ops->locate(rdev))
- continue;
-
- LOG("'%s' located CBFS at [%zx:%zx)\n",
- ops->name, region_device_offset(rdev),
- region_device_end(rdev));
-
- return 0;
- }
-
- return -1;
+ return vboot_locate_cbfs(rdev) &&
+ fmap_locate_area_as_rdev("COREBOOT", rdev);
}