summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2020-12-23 17:38:11 -0800
committerJulius Werner <jwerner@chromium.org>2021-03-16 21:45:34 +0000
commit1de8708fe50339162b4a59039e0ac45e6f3ffdd0 (patch)
tree30a0f3fd50c7cfce4a02b822ccc7073b0b4e884c /src/arch
parentc24db001efb669c06489c55122e85a4a8948b539 (diff)
downloadcoreboot-1de8708fe50339162b4a59039e0ac45e6f3ffdd0.tar.xz
cbfs: Remove prog_locate() for stages and rmodules
This patch removes the prog_locate() step for stages and rmodules. Instead, the stage and rmodule loading functions will now perform the locate step directly together with the actual loading. The long-term goal of this is to eliminate prog_locate() (and the rdev member in struct prog that it fills) completely in order to make CBFS verification code safer and its security guarantees easier to follow. prog_locate() is the main remaining use case where a raw rdev of CBFS file data "leaks" out of cbfs.c into other code, and that other code needs to manually make sure that the contents of the rdev get verified during loading. By eliminating this step and moving all code that directly deals with file data into cbfs.c, we can concentrate the code that needs to worry about file data hashing (and needs access to cbfs_private.h APIs) into one file, making it easier to keep track of and reason about. This patch is the first step of this move, later patches will do the same for SELFs and other program types. Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: Ia600e55f77c2549a00e2606f09befc1f92594a3a Reviewed-on: https://review.coreboot.org/c/coreboot/+/49335 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/arm64/bl31.c3
-rw-r--r--src/arch/x86/bootblock_normal.c6
-rw-r--r--src/arch/x86/postcar_loader.c3
3 files changed, 3 insertions, 9 deletions
diff --git a/src/arch/arm64/bl31.c b/src/arch/arm64/bl31.c
index caa11362f3..a3870275ac 100644
--- a/src/arch/arm64/bl31.c
+++ b/src/arch/arm64/bl31.c
@@ -87,9 +87,6 @@ void run_bl31(u64 payload_entry, u64 payload_arg0, u64 payload_spsr)
struct prog bl32 = PROG_INIT(PROG_BL32,
CONFIG_CBFS_PREFIX"/secure_os");
- if (prog_locate(&bl32))
- die("BL32 not found");
-
if (cbfs_prog_stage_load(&bl32))
die("BL32 load failed");
diff --git a/src/arch/x86/bootblock_normal.c b/src/arch/x86/bootblock_normal.c
index e2dfcf4610..9341ac3325 100644
--- a/src/arch/x86/bootblock_normal.c
+++ b/src/arch/x86/bootblock_normal.c
@@ -12,7 +12,7 @@ static const char *get_fallback(const char *stagelist)
return ++stagelist;
}
-int legacy_romstage_selector(struct prog *romstage)
+int legacy_romstage_select_and_load(struct prog *romstage)
{
static const char *default_filenames = "normal/romstage\0fallback/romstage";
const char *boot_candidate;
@@ -24,10 +24,10 @@ int legacy_romstage_selector(struct prog *romstage)
if (do_normal_boot()) {
romstage->name = boot_candidate;
- if (!prog_locate(romstage))
+ if (!cbfs_prog_stage_load(romstage))
return 0;
}
romstage->name = get_fallback(boot_candidate);
- return prog_locate(romstage);
+ return cbfs_prog_stage_load(romstage);
}
diff --git a/src/arch/x86/postcar_loader.c b/src/arch/x86/postcar_loader.c
index cae5574fd3..8a5f902680 100644
--- a/src/arch/x86/postcar_loader.c
+++ b/src/arch/x86/postcar_loader.c
@@ -135,9 +135,6 @@ static void load_postcar_cbfs(struct prog *prog, struct postcar_frame *pcf)
vboot_run_logic();
- if (prog_locate(prog))
- die_with_post_code(POST_INVALID_ROM,
- "Failed to locate after CAR program.\n");
if (rmodule_stage_load(&rsl))
die_with_post_code(POST_INVALID_ROM,
"Failed to load after CAR program.\n");