stage_cache: Add rmodule params in metadata

The change allows to update rmodule parameters after
it has been loaded from stage cache.

Change-Id: Ib825ffe245d447ad3a8246f7dbd52c6e34103a0c
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://review.coreboot.org/21385
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Kyösti Mälkki 2017-09-05 22:43:05 +03:00
parent 534b23639b
commit d87e4b3469
3 changed files with 6 additions and 2 deletions

View File

@ -37,6 +37,7 @@ void stage_cache_external_region(void **base, size_t *size);
struct stage_cache {
uint64_t load_addr;
uint64_t entry_addr;
uint64_t arg;
};
#endif /* _STAGE_CACHE_H_ */

View File

@ -29,6 +29,7 @@ void stage_cache_add(int stage_id, const struct prog *stage)
return;
meta->load_addr = (uintptr_t)prog_start(stage);
meta->entry_addr = (uintptr_t)prog_entry(stage);
meta->arg = (uintptr_t)prog_entry_arg(stage);
c = cbmem_add(CBMEM_ID_STAGEx_CACHE + stage_id, prog_size(stage));
if (c == NULL)
@ -63,5 +64,6 @@ void stage_cache_load_stage(int stage_id, struct prog *stage)
memcpy(load_addr, c, size);
prog_set_area(stage, load_addr, size);
prog_set_entry(stage, (void *)(uintptr_t)meta->entry_addr, NULL);
prog_set_entry(stage, (void *)(uintptr_t)meta->entry_addr,
(void *)(uintptr_t)meta->arg);
}

View File

@ -294,10 +294,11 @@ int rmodule_stage_load(struct rmod_stage_load *rsl)
prog_set_area(rsl->prog, rmod_stage.location,
rmodule_memory_size(&rmod_stage));
prog_set_entry(rsl->prog, rmodule_entry(&rmod_stage), NULL);
/* Allow caller to pick up parameters, if available. */
rsl->params = rmodule_parameters(&rmod_stage);
prog_set_entry(rsl->prog, rmodule_entry(&rmod_stage), rsl->params);
return 0;
}