summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Kconfig11
-rw-r--r--src/lib/prog_loaders.c53
2 files changed, 9 insertions, 55 deletions
diff --git a/src/lib/Kconfig b/src/lib/Kconfig
index 0f184252dc..014230012d 100644
--- a/src/lib/Kconfig
+++ b/src/lib/Kconfig
@@ -114,14 +114,3 @@ config CBFS_PRELOAD
in the background before they are actually required. This feature
depends on the read-only boot_device having a DMA controller to
perform the background transfer.
-
-config PAYLOAD_PRELOAD
- bool
- depends on COOP_MULTITASKING
- help
- On some systems with SPI DMA controllers, it is possible to preload
- the payload while ramstage is executing. This can be selected by the
- SoC to enable payload preloading.
-
- The SoC needs to define a payload_preload_cache region where the
- raw payload can be placed.
diff --git a/src/lib/prog_loaders.c b/src/lib/prog_loaders.c
index 1a361ea3b9..8ad646a10c 100644
--- a/src/lib/prog_loaders.c
+++ b/src/lib/prog_loaders.c
@@ -127,71 +127,37 @@ fail:
static struct prog global_payload =
PROG_INIT(PROG_PAYLOAD, CONFIG_CBFS_PREFIX "/payload");
-static struct thread_handle payload_preload_handle;
-
-static enum cb_err payload_preload_thread_entry(void *arg)
-{
- size_t size;
- struct prog *payload = &global_payload;
-
- printk(BIOS_DEBUG, "Preloading payload\n");
-
- payload->cbfs_type = CBFS_TYPE_QUERY;
-
- size = cbfs_type_load(prog_name(payload), _payload_preload_cache,
- REGION_SIZE(payload_preload_cache), &payload->cbfs_type);
-
- if (!size) {
- printk(BIOS_ERR, "ERROR: Preloading payload failed\n");
- return CB_ERR;
- }
-
- printk(BIOS_DEBUG, "Preloading payload complete\n");
-
- return CB_SUCCESS;
-}
-
void payload_preload(void)
{
- struct thread_handle *handle = &payload_preload_handle;
-
- if (!CONFIG(PAYLOAD_PRELOAD))
+ if (!CONFIG(CBFS_PRELOAD))
return;
- if (thread_run(handle, payload_preload_thread_entry, NULL))
- printk(BIOS_ERR, "ERROR: Failed to start payload preload thread\n");
+ cbfs_preload(global_payload.name);
}
void payload_load(void)
{
struct prog *payload = &global_payload;
- struct thread_handle *handle = &payload_preload_handle;
- void *mapping = NULL;
- void *buffer;
+ void *mapping;
timestamp_add_now(TS_LOAD_PAYLOAD);
if (prog_locate_hook(payload))
goto out;
- if (CONFIG(PAYLOAD_PRELOAD) && thread_join(handle) == CB_SUCCESS) {
- buffer = _payload_preload_cache;
- } else {
- payload->cbfs_type = CBFS_TYPE_QUERY;
- mapping = cbfs_type_map(prog_name(payload), NULL, &payload->cbfs_type);
- buffer = mapping;
- }
+ payload->cbfs_type = CBFS_TYPE_QUERY;
+ mapping = cbfs_type_map(prog_name(payload), NULL, &payload->cbfs_type);
- if (!buffer)
+ if (!mapping)
goto out;
switch (prog_cbfs_type(payload)) {
case CBFS_TYPE_SELF: /* Simple ELF */
- selfload_mapped(payload, buffer, 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, buffer);
+ fit_payload(payload, mapping);
break;
} /* else fall-through */
default:
@@ -200,8 +166,7 @@ void payload_load(void)
break;
}
- if (mapping)
- cbfs_unmap(mapping);
+ cbfs_unmap(mapping);
out:
if (prog_entry(payload) == NULL)
die_with_post_code(POST_INVALID_ROM, "Payload not loaded.\n");