diff options
author | Julius Werner <jwerner@chromium.org> | 2021-01-11 16:44:06 -0800 |
---|---|---|
committer | Julius Werner <jwerner@chromium.org> | 2021-03-17 00:13:59 +0000 |
commit | 535846763825f9bc4531b9322b1b61f3973cd6f8 (patch) | |
tree | f403f851438c5bc1cf71470e9e52db4475880265 /src/drivers/intel/fsp1_1/car.c | |
parent | 965846fcd0657bead026056e9bdc3625a534552e (diff) |
prog_loaders: Remove prog_locate()
This patch rewrites the last few users of prog_locate() to access CBFS
APIs directly and removes the call. This eliminates the double-meaning
of prog_rdev() (referring to both the boot medium where the program is
stored before loading, and the memory area where it is loaded after) and
makes sure that programs are always located and loaded in a single
operation. This makes CBFS verification easier to implement and secure
because it avoids leaking a raw rdev of unverified data outside the CBFS
core code.
Signed-off-by: Julius Werner <jwerner@chromium.org>
Change-Id: I7a5525f66e1d5f3a632e8f6f0ed9e116e3cebfcf
Reviewed-on: https://review.coreboot.org/c/coreboot/+/49337
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/drivers/intel/fsp1_1/car.c')
-rw-r--r-- | src/drivers/intel/fsp1_1/car.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/drivers/intel/fsp1_1/car.c b/src/drivers/intel/fsp1_1/car.c index 9b47e71db1..5d41a017b6 100644 --- a/src/drivers/intel/fsp1_1/car.c +++ b/src/drivers/intel/fsp1_1/car.c @@ -2,13 +2,13 @@ #include <arch/romstage.h> #include <arch/symbols.h> +#include <cbfs.h> #include <cbmem.h> #include <console/console.h> #include <commonlib/helpers.h> #include <cpu/x86/mtrr.h> #include <fsp/car.h> #include <fsp/util.h> -#include <program_loading.h> void fill_postcar_frame(struct postcar_frame *pcf) { @@ -27,14 +27,14 @@ void mainboard_romstage_entry(void) { /* Need to locate the current FSP_INFO_HEADER. The cache-as-ram * is still enabled. We can directly access work buffer here. */ - struct prog fsp = PROG_INIT(PROG_REFCODE, "fsp.bin"); + void *fsp = cbfs_map("fsp.bin", NULL); - if (prog_locate(&fsp)) + if (!fsp) die_with_post_code(POST_INVALID_CBFS, "Unable to locate fsp.bin"); /* This leaks a mapping which this code assumes is benign as * the flash is memory mapped CPU's address space. */ - FSP_INFO_HEADER *fih = find_fsp((uintptr_t)rdev_mmap_full(prog_rdev(&fsp))); + FSP_INFO_HEADER *fih = find_fsp((uintptr_t)fsp); if (!fih) die("Invalid FSP header\n"); |