diff options
author | Aaron Durbin <adurbin@chromium.org> | 2015-03-27 21:17:22 -0500 |
---|---|---|
committer | Aaron Durbin <adurbin@google.com> | 2015-04-03 14:53:35 +0200 |
commit | 460703bbb4f1a51b9ecd19ac78ec62c97502a4a2 (patch) | |
tree | 050712ccf718a467ee9c76b01b21dfafcb05f8a7 /src/soc | |
parent | ce9efe061a23bc3e3d2a4c17cf29692ce6f9eb53 (diff) | |
download | coreboot-460703bbb4f1a51b9ecd19ac78ec62c97502a4a2.tar.xz |
rmodule: use struct prog while loading rmodules
The rmod_stage_load structure contained the same fields
as struct prog. In order to more closely integrate with the
rest of program loading use struct prog.
Change-Id: Ib7f45d0b3573e6d518864deacc4002802b11aa9c
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/9143
Tested-by: build bot (Jenkins)
Reviewed-by: Marc Jones <marc.jones@se-eng.com>
Diffstat (limited to 'src/soc')
-rw-r--r-- | src/soc/intel/baytrail/refcode.c | 20 | ||||
-rw-r--r-- | src/soc/intel/broadwell/refcode.c | 20 |
2 files changed, 24 insertions, 16 deletions
diff --git a/src/soc/intel/baytrail/refcode.c b/src/soc/intel/baytrail/refcode.c index 059639bd02..45771e0777 100644 --- a/src/soc/intel/baytrail/refcode.c +++ b/src/soc/intel/baytrail/refcode.c @@ -23,6 +23,7 @@ #include <console/console.h> #include <console/streams.h> #include <cpu/x86/tsc.h> +#include <program_loading.h> #include <rmodule.h> #include <ramstage_cache.h> #if IS_ENABLED(CONFIG_CHROMEOS) @@ -84,16 +85,16 @@ static void cache_refcode(const struct rmod_stage_load *rsl) /* Determine how much remaining cache available. */ cache_size -= c->size + sizeof(*c); - if (cache_size < (sizeof(*c) + cbmem_entry_size(rsl->cbmem_entry))) { + if (cache_size < (sizeof(*c) + prog_size(rsl->prog))) { printk(BIOS_DEBUG, "Not enough cache space for ref code.\n"); return; } c = next_cache(c); c->magic = RAMSTAGE_CACHE_MAGIC; - c->entry_point = (uint32_t)rsl->entry; - c->load_address = (uint32_t)cbmem_entry_start(rsl->cbmem_entry); - c->size = cbmem_entry_size(rsl->cbmem_entry); + c->entry_point = (uint32_t)(uintptr_t)prog_entry(rsl->prog); + c->load_address = (uint32_t)(uintptr_t)prog_start(rsl->prog); + c->size = prog_size(rsl->prog); printk(BIOS_DEBUG, "Caching refcode at 0x%p(%x)\n", &c->program[0], c->size); @@ -119,7 +120,7 @@ static int load_refcode_from_vboot(struct rmod_stage_load *refcode) printk(BIOS_DEBUG, "refcode loading from vboot rw area.\n"); stage = (void *)(uintptr_t)fwc->address; - if (rmodule_stage_load(refcode, stage) || refcode->entry == NULL) { + if (rmodule_stage_load(refcode, stage)) { printk(BIOS_DEBUG, "Error loading reference code.\n"); return -1; } @@ -136,7 +137,7 @@ static int load_refcode_from_cbfs(struct rmod_stage_load *refcode) { printk(BIOS_DEBUG, "refcode loading from cbfs.\n"); - if (rmodule_stage_load_from_cbfs(refcode) || refcode->entry == NULL) { + if (rmodule_stage_load_from_cbfs(refcode)) { printk(BIOS_DEBUG, "Error loading reference code.\n"); return -1; } @@ -146,9 +147,12 @@ static int load_refcode_from_cbfs(struct rmod_stage_load *refcode) static efi_wrapper_entry_t load_reference_code(void) { + struct prog prog = { + .name = CONFIG_CBFS_PREFIX "/refcode", + }; struct rmod_stage_load refcode = { .cbmem_id = CBMEM_ID_REFCODE, - .name = CONFIG_CBFS_PREFIX "/refcode", + .prog = &prog, }; if (acpi_is_wakeup_s3()) { @@ -162,7 +166,7 @@ static efi_wrapper_entry_t load_reference_code(void) /* Cache loaded reference code. */ cache_refcode(&refcode); - return refcode.entry; + return prog_entry(&prog); } void baytrail_run_reference_code(void) diff --git a/src/soc/intel/broadwell/refcode.c b/src/soc/intel/broadwell/refcode.c index 1328f1a412..36ce97d6af 100644 --- a/src/soc/intel/broadwell/refcode.c +++ b/src/soc/intel/broadwell/refcode.c @@ -23,6 +23,7 @@ #include <console/console.h> #include <console/streams.h> #include <cpu/x86/tsc.h> +#include <program_loading.h> #include <rmodule.h> #include <ramstage_cache.h> #include <string.h> @@ -80,16 +81,16 @@ static void cache_refcode(const struct rmod_stage_load *rsl) /* Determine how much remaining cache available. */ cache_size -= c->size + sizeof(*c); - if (cache_size < (sizeof(*c) + cbmem_entry_size(rsl->cbmem_entry))) { + if (cache_size < (sizeof(*c) + prog_size(rsl->prog))) { printk(BIOS_DEBUG, "Not enough cache space for ref code.\n"); return; } c = next_cache(c); c->magic = RAMSTAGE_CACHE_MAGIC; - c->entry_point = (uint32_t)rsl->entry; - c->load_address = (uint32_t)cbmem_entry_start(rsl->cbmem_entry); - c->size = cbmem_entry_size(rsl->cbmem_entry); + c->entry_point = (uint32_t)(uintptr_t)prog_entry(rsl->prog); + c->load_address = (uint32_t)(uintptr_t)prog_start(rsl->prog); + c->size = prog_size(rsl->prog); printk(BIOS_DEBUG, "Caching refcode at 0x%p(%x)\n", &c->program[0], c->size); @@ -115,7 +116,7 @@ static int load_refcode_from_vboot(struct rmod_stage_load *refcode) printk(BIOS_DEBUG, "refcode loading from vboot rw area.\n"); stage = (void *)(uintptr_t)fwc->address; - if (rmodule_stage_load(refcode, stage) || refcode->entry == NULL) { + if (rmodule_stage_load(refcode, stage)) { printk(BIOS_DEBUG, "Error loading reference code.\n"); return -1; } @@ -132,7 +133,7 @@ static int load_refcode_from_cbfs(struct rmod_stage_load *refcode) { printk(BIOS_DEBUG, "refcode loading from cbfs.\n"); - if (rmodule_stage_load_from_cbfs(refcode) || refcode->entry == NULL) { + if (rmodule_stage_load_from_cbfs(refcode)) { printk(BIOS_DEBUG, "Error loading reference code.\n"); return -1; } @@ -142,9 +143,12 @@ static int load_refcode_from_cbfs(struct rmod_stage_load *refcode) static pei_wrapper_entry_t load_reference_code(void) { + struct prog prog = { + .name = CONFIG_CBFS_PREFIX "/refcode", + }; struct rmod_stage_load refcode = { .cbmem_id = CBMEM_ID_REFCODE, - .name = CONFIG_CBFS_PREFIX "/refcode", + .prog = &prog, }; if (acpi_is_wakeup_s3()) { @@ -158,7 +162,7 @@ static pei_wrapper_entry_t load_reference_code(void) /* Cache loaded reference code. */ cache_refcode(&refcode); - return refcode.entry; + return prog_entry(&prog); } void broadwell_run_reference_code(void) |