Hello Aaron Durbin,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/46482
to review the following change.
Change subject: prog_loaders: Switch prog_locate() to new CBFS API ......................................................................
prog_loaders: Switch prog_locate() to new CBFS API
This patch changes prog_locate() to use the new cbfs_boot_lookup() instead of cbfs_boot_locate(), in preparation for the following changes.
Signed-off-by: Julius Werner jwerner@chromium.org Change-Id: Iad80de16a9f5faae50d444b854b50a45166fb2e2 --- M src/include/program_loading.h M src/lib/prog_loaders.c 2 files changed, 12 insertions(+), 13 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/82/46482/1
diff --git a/src/include/program_loading.h b/src/include/program_loading.h index fae70ce..e5a2931 100644 --- a/src/include/program_loading.h +++ b/src/include/program_loading.h @@ -4,8 +4,7 @@
#include <bootmem.h> #include <commonlib/region.h> -#include <stdint.h> -#include <stddef.h> +#include <types.h>
enum { /* Last segment of program. Can be used to take different actions for @@ -128,7 +127,7 @@ }
/* Locate the identified program to run. Return 0 on success. < 0 on error. */ -int prog_locate(struct prog *prog); +cb_err_t prog_locate(struct prog *prog); /* The prog_locate_hook() is called prior to CBFS traversal. The hook can be * used to implement policy that allows or prohibits further progress through * prog_locate(). The type and name field within struct prog are the only valid diff --git a/src/lib/prog_loaders.c b/src/lib/prog_loaders.c index 93efc0a..4fae5d2 100644 --- a/src/lib/prog_loaders.c +++ b/src/lib/prog_loaders.c @@ -3,6 +3,7 @@
#include <stdlib.h> #include <cbfs.h> +#include <cbfs_private.h> #include <cbmem.h> #include <console/console.h> #include <fallback.h> @@ -22,21 +23,20 @@ const struct mem_region_device addrspace_32bit = MEM_REGION_DEV_RO_INIT(0, ~0UL);
-int prog_locate(struct prog *prog) +cb_err_t prog_locate(struct prog *prog) { - struct cbfsf file; + union cbfs_mdata mdata; + cb_err_t err;
if (prog_locate_hook(prog)) - return -1; + return CB_ERR;
- if (cbfs_boot_locate(&file, prog_name(prog), NULL)) - return -1; + err = cbfs_boot_lookup(prog_name(prog), false, &mdata, prog_rdev(prog)); + if (err != CB_SUCCESS) + return err;
- cbfsf_file_type(&file, &prog->cbfs_type); - - cbfs_file_data(prog_rdev(prog), &file); - - return 0; + prog->cbfs_type = be32toh(mdata.h.type); + return CB_SUCCESS; }
void run_romstage(void)
Aaron Durbin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46482 )
Change subject: prog_loaders: Switch prog_locate() to new CBFS API ......................................................................
Patch Set 1: Code-Review+2
Julius Werner has abandoned this change. ( https://review.coreboot.org/c/coreboot/+/46482 )
Change subject: prog_loaders: Switch prog_locate() to new CBFS API ......................................................................
Abandoned
Moved patch series around so prog_locate() is removed completely and this won't be necessary.