cbfs: Remove prog_locate() for payloads (SELF and FIT)

This patch removes the prog_locate() call for all instances of loading
payload formats (SELF and FIT), as the previous patch did for stages.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Change-Id: I582b37f36fe6f9f26975490a823e85b130ba49a2
Reviewed-on: https://review.coreboot.org/c/coreboot/+/49336
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Julius Werner
2021-01-11 16:07:02 -08:00
parent 1de8708fe5
commit 965846fcd0
9 changed files with 46 additions and 67 deletions

View File

@ -14,7 +14,6 @@
#include <stage_cache.h>
#include <symbols.h>
#include <timestamp.h>
#include <fit_payload.h>
#include <security/vboot/vboot_common.h>
/* Only can represent up to 1 byte less than size_t. */
@ -154,24 +153,30 @@ void payload_load(void)
timestamp_add_now(TS_LOAD_PAYLOAD);
if (prog_locate(payload))
if (prog_locate_hook(payload))
goto out;
payload->cbfs_type = CBFS_TYPE_QUERY;
void *mapping = cbfs_type_map(prog_name(payload), NULL, &payload->cbfs_type);
if (!mapping)
goto out;
switch (prog_cbfs_type(payload)) {
case CBFS_TYPE_SELF: /* Simple ELF */
selfload_check(payload, BM_MEM_RAM);
selfload_mapped(payload, mapping, BM_MEM_RAM);
break;
case CBFS_TYPE_FIT: /* Flattened image tree */
if (CONFIG(PAYLOAD_FIT_SUPPORT)) {
fit_payload(payload);
fit_payload(payload, mapping);
break;
} /* else fall-through */
default:
die_with_post_code(POST_INVALID_ROM,
"Unsupported payload type.\n");
"Unsupported payload type %d.\n", payload->cbfs_type);
break;
}
cbfs_unmap(mapping);
out:
if (prog_entry(payload) == NULL)
die_with_post_code(POST_INVALID_ROM, "Payload not loaded.\n");