diff options
author | Arthur Heymans <arthur@aheymans.xyz> | 2021-02-15 23:46:06 +0100 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2021-03-19 11:33:17 +0000 |
commit | ad0116c0327f575f0af184a2f4861848a49a0e2a (patch) | |
tree | d463c4b65a7957fac57e5b383783d05264a08946 /src | |
parent | 1afe20b1b2e6e7e9be3df5e21cffbdf8ee5a4c3f (diff) |
cpu/x86/smm_loaderv2: Remove unused variables
Remove variables that are either constants or are just assigned but
not used.
Change-Id: I5d291a3464f30fc5d9f4b7233bde575010275973
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/50784
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/cpu/x86/smm/smm_module_loaderv2.c | 24 | ||||
-rw-r--r-- | src/include/cpu/x86/smm.h | 14 |
2 files changed, 7 insertions, 31 deletions
diff --git a/src/cpu/x86/smm/smm_module_loaderv2.c b/src/cpu/x86/smm/smm_module_loaderv2.c index 3bf77a93ab..c8b9fe689a 100644 --- a/src/cpu/x86/smm/smm_module_loaderv2.c +++ b/src/cpu/x86/smm/smm_module_loaderv2.c @@ -89,7 +89,7 @@ static int smm_create_map(uintptr_t smbase, unsigned int num_cpus, unsigned int i; struct rmodule smm_stub; unsigned int ss_size = params->per_cpu_save_state_size, stub_size; - unsigned int smm_entry_offset = params->smm_main_entry_offset; + unsigned int smm_entry_offset = SMM_ENTRY_OFFSET; unsigned int seg_count = 0, segments = 0, available; unsigned int cpus_in_segment = 0; unsigned int base = smbase; @@ -221,8 +221,7 @@ static int smm_place_entry_code(uintptr_t smbase, unsigned int num_cpus, * + size of stack. */ if (cpus[num_cpus].active) { - if (cpus[num_cpus - 1].smbase + - params->smm_main_entry_offset < stack_top) { + if (cpus[num_cpus - 1].smbase + SMM_ENTRY_OFFSET < stack_top) { printk(BIOS_ERR, "%s: stack encroachment\n", __func__); printk(BIOS_ERR, "%s: smbase %zx, stack_top %lx\n", __func__, cpus[num_cpus].smbase, stack_top); @@ -330,7 +329,6 @@ static int smm_module_setup_stub(void *const smbase, const size_t smm_size, { size_t total_save_state_size; size_t smm_stub_size; - size_t stub_entry_offset; char *smm_stub_loc; void *stacks_top; size_t size; @@ -366,10 +364,10 @@ static int smm_module_setup_stub(void *const smbase, const size_t smm_size, size -= total_save_state_size; /* The save state size encroached over the first SMM entry point. */ - if (size <= params->smm_main_entry_offset) { + if (size <= SMM_ENTRY_OFFSET) { printk(BIOS_ERR, "%s: encroachment over SMM entry point\n", __func__); printk(BIOS_ERR, "%s: state save size: %zx : smm_entry_offset -> %lx\n", - __func__, size, params->smm_main_entry_offset); + __func__, size, (size_t)SMM_ENTRY_OFFSET); return -1; } @@ -382,13 +380,12 @@ static int smm_module_setup_stub(void *const smbase, const size_t smm_size, smm_stub_loc = NULL; smm_stub_size = rmodule_memory_size(&smm_stub); - stub_entry_offset = rmodule_entry_offset(&smm_stub); /* Put the stub at the main entry point */ - smm_stub_loc = &base[params->smm_main_entry_offset]; + smm_stub_loc = &base[SMM_ENTRY_OFFSET]; /* Stub is too big to fit. */ - if (smm_stub_size > (size - params->smm_main_entry_offset)) { + if (smm_stub_size > (size - SMM_ENTRY_OFFSET)) { printk(BIOS_ERR, "%s: stub is too big to fit\n", __func__); return -1; } @@ -399,7 +396,7 @@ static int smm_module_setup_stub(void *const smbase, const size_t smm_size, */ const size_t total_stack_size = params->num_concurrent_stacks * params->per_cpu_stack_size; - stacks_top = smm_stub_place_stacks((char *)params->smram_start, total_stack_size, + stacks_top = smm_stub_place_stacks(smbase, total_stack_size, params); if (stacks_top == NULL) { printk(BIOS_ERR, "%s: not enough space for stacks\n", __func__); @@ -474,9 +471,6 @@ int smm_setup_relocation_handler(struct smm_loader_params *params) if (params->num_concurrent_stacks == 0) params->num_concurrent_stacks = CONFIG_MAX_CPUS; - params->smm_main_entry_offset = SMM_ENTRY_OFFSET; - params->smram_start = SMM_DEFAULT_BASE; - params->smram_end = SMM_DEFAULT_BASE + SMM_DEFAULT_SIZE; return smm_module_setup_stub(smram, SMM_DEFAULT_SIZE, params, fxsave_area_relocation); printk(BIOS_SPEW, "%s: exit\n", __func__); @@ -529,9 +523,6 @@ int smm_load_module(void *smram, size_t size, struct smm_loader_params *params) */ base = smram; base += size; - params->smram_start = (uintptr_t)smram; - params->smram_end = params->smram_start + size; - params->smm_main_entry_offset = SMM_ENTRY_OFFSET; /* Fail if can't parse the smm rmodule. */ if (rmodule_parse(&_binary_smm_start, &smm_mod)) @@ -634,7 +625,6 @@ int smm_load_module(void *smram, size_t size, struct smm_loader_params *params) base -= SMM_CODE_SEGMENT_SIZE; printk(BIOS_DEBUG, "%s: cpu0 entry: %p\n", __func__, base); - params->smm_entry = (uintptr_t)base + params->smm_main_entry_offset; if (!smm_create_map((uintptr_t)base, params->num_concurrent_save_states, params)) { printk(BIOS_ERR, "%s: Error creating CPU map\n", __func__); diff --git a/src/include/cpu/x86/smm.h b/src/include/cpu/x86/smm.h index b100bf800b..3375f4a144 100644 --- a/src/include/cpu/x86/smm.h +++ b/src/include/cpu/x86/smm.h @@ -132,12 +132,6 @@ static inline bool smm_points_to_smram(const void *ptr, const size_t len) * into this field so the code doing the loading can manipulate the * runtime's assumptions. e.g. updating the APIC id to CPU map to * handle sparse APIC id space. - * The following parameters are only used when X86_SMM_LOADER_VERSION2 is enabled. - * - smm_entry - entry address of first CPU thread, all others will be tiled - * below this address. - * - smm_main_entry_offset - default entry offset (e.g 0x8000) - * - smram_start - smaram starting address - * - smram_end - smram ending address */ struct smm_loader_params { void *stack_top; @@ -150,14 +144,6 @@ struct smm_loader_params { smm_handler_t handler; struct smm_stub_params *stub_params; - - /* The following are only used by X86_SMM_LOADER_VERSION2 */ -#if CONFIG(X86_SMM_LOADER_VERSION2) - uintptr_t smm_entry; - uintptr_t smm_main_entry_offset; - uintptr_t smram_start; - uintptr_t smram_end; -#endif }; /* Both of these return 0 on success, < 0 on failure. */ |