aboutsummaryrefslogtreecommitdiff
path: root/src/soc
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/soc
parentc24db001efb669c06489c55122e85a4a8948b539 (diff)
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/soc')
-rw-r--r--src/soc/amd/common/block/pi/refcode_loader.c3
-rw-r--r--src/soc/intel/baytrail/refcode.c5
-rw-r--r--src/soc/intel/broadwell/refcode.c5
-rw-r--r--src/soc/mediatek/common/memory.c5
-rw-r--r--src/soc/mediatek/mt8183/memory.c3
-rw-r--r--src/soc/qualcomm/common/qclib.c6
6 files changed, 0 insertions, 27 deletions
diff --git a/src/soc/amd/common/block/pi/refcode_loader.c b/src/soc/amd/common/block/pi/refcode_loader.c
index 274291de56..1d8db89440 100644
--- a/src/soc/amd/common/block/pi/refcode_loader.c
+++ b/src/soc/amd/common/block/pi/refcode_loader.c
@@ -51,9 +51,6 @@ static int agesa_locate_stage_file_ramstage(const char *name,
if (resume_from_stage_cache()) {
stage_cache_load_stage(STAGE_REFCODE, &prog);
} else {
- if (prog_locate(&prog))
- return -1;
-
if (rmodule_stage_load(&rmod_agesa) < 0)
return -1;
diff --git a/src/soc/intel/baytrail/refcode.c b/src/soc/intel/baytrail/refcode.c
index 8cd7336a62..4ee66756a4 100644
--- a/src/soc/intel/baytrail/refcode.c
+++ b/src/soc/intel/baytrail/refcode.c
@@ -32,11 +32,6 @@ static efi_wrapper_entry_t load_reference_code(void)
.prog = &prog,
};
- if (prog_locate(&prog)) {
- printk(BIOS_DEBUG, "Couldn't locate reference code.\n");
- return NULL;
- }
-
if (rmodule_stage_load(&refcode)) {
printk(BIOS_DEBUG, "Error loading reference code.\n");
return NULL;
diff --git a/src/soc/intel/broadwell/refcode.c b/src/soc/intel/broadwell/refcode.c
index 31d6ad8482..ae175b0f68 100644
--- a/src/soc/intel/broadwell/refcode.c
+++ b/src/soc/intel/broadwell/refcode.c
@@ -28,11 +28,6 @@ static pei_wrapper_entry_t load_reference_code(void)
.prog = &prog,
};
- if (prog_locate(&prog)) {
- printk(BIOS_DEBUG, "Couldn't locate reference code.\n");
- return NULL;
- }
-
if (rmodule_stage_load(&refcode)) {
printk(BIOS_DEBUG, "Error loading reference code.\n");
return NULL;
diff --git a/src/soc/mediatek/common/memory.c b/src/soc/mediatek/common/memory.c
index 2cc05713a1..b8bda6e82c 100644
--- a/src/soc/mediatek/common/memory.c
+++ b/src/soc/mediatek/common/memory.c
@@ -132,11 +132,6 @@ static int dram_run_full_calibration(struct dramc_param *dparam)
initialize_dramc_param(dparam);
- if (prog_locate(&dram)) {
- printk(BIOS_ERR, "DRAM-K: Locate program failed\n");
- return -1;
- }
-
if (cbfs_prog_stage_load(&dram)) {
printk(BIOS_ERR, "DRAM-K: CBFS load program failed\n");
return -2;
diff --git a/src/soc/mediatek/mt8183/memory.c b/src/soc/mediatek/mt8183/memory.c
index 6b80a43a8c..a43cdea102 100644
--- a/src/soc/mediatek/mt8183/memory.c
+++ b/src/soc/mediatek/mt8183/memory.c
@@ -105,9 +105,6 @@ static int dram_run_full_calibration(struct dramc_param *dparam,
/* Load and run the provided blob for full-calibration if available */
struct prog dram = PROG_INIT(PROG_REFCODE, CONFIG_CBFS_PREFIX "/dram");
- if (prog_locate(&dram))
- return -1;
-
if (cbfs_prog_stage_load(&dram))
return -2;
diff --git a/src/soc/qualcomm/common/qclib.c b/src/soc/qualcomm/common/qclib.c
index daea209082..6f2a6f1b61 100644
--- a/src/soc/qualcomm/common/qclib.c
+++ b/src/soc/qualcomm/common/qclib.c
@@ -157,9 +157,6 @@ void qclib_load_and_run(void)
CONFIG_CBFS_PREFIX "/qcsdi");
/* Attempt to load QCSDI elf */
- if (prog_locate(&qcsdi))
- goto fail;
-
if (cbfs_prog_stage_load(&qcsdi))
goto fail;
@@ -174,9 +171,6 @@ void qclib_load_and_run(void)
struct prog qclib =
PROG_INIT(PROG_REFCODE, CONFIG_CBFS_PREFIX "/qclib");
- if (prog_locate(&qclib))
- goto fail;
-
if (cbfs_prog_stage_load(&qclib))
goto fail;