lib/prog_loaders: Store CBFS type in struct prog

Store the type of the loaded program after locating the file and add a
method to retrieve the type.
Will be used to distinguish between SELF and FIT payloads.

Change-Id: Ic226e7e028d722ab9e3c6f7f1c22bde2a1cd8a85
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/26028
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Patrick Rudolph 2018-05-03 10:35:26 +02:00 committed by Ronald G. Minnich
parent d8ec973fd2
commit 71327fbad8
2 changed files with 8 additions and 0 deletions

View File

@ -65,6 +65,7 @@ struct prog {
* payload. For architectures that use a bounce buffer * payload. For architectures that use a bounce buffer
* then it would represent the bounce buffer. */ * then it would represent the bounce buffer. */
enum prog_type type; enum prog_type type;
uint32_t cbfs_type;
const char *name; const char *name;
struct region_device rdev; struct region_device rdev;
/* Entry to program with optional argument. It's up to the architecture /* Entry to program with optional argument. It's up to the architecture
@ -89,6 +90,11 @@ static inline enum prog_type prog_type(const struct prog *prog)
return prog->type; return prog->type;
} }
static inline uint32_t prog_cbfs_type(const struct prog *prog)
{
return prog->cbfs_type;
}
static inline struct region_device *prog_rdev(struct prog *prog) static inline struct region_device *prog_rdev(struct prog *prog)
{ {
return &prog->rdev; return &prog->rdev;

View File

@ -44,6 +44,8 @@ int prog_locate(struct prog *prog)
if (cbfs_boot_locate(&file, prog_name(prog), NULL)) if (cbfs_boot_locate(&file, prog_name(prog), NULL))
return -1; return -1;
cbfsf_file_type(&file, &prog->cbfs_type);
cbfs_file_data(prog_rdev(prog), &file); cbfs_file_data(prog_rdev(prog), &file);
return 0; return 0;