summaryrefslogtreecommitdiff
path: root/src/cpu/x86/smm
diff options
context:
space:
mode:
authorEugene D Myers <cedarhouse@comcast.net>2020-04-15 18:28:10 -0400
committerPatrick Georgi <pgeorgi@google.com>2020-05-02 17:03:48 +0000
commit076605bc92730553e9adae543713f0d356a94709 (patch)
treeec70d2818f516fd208f7f16d20e8b3f8c7091e97 /src/cpu/x86/smm
parent7bab4c90a72a0e3599d6dbda0a72e8d470fd3fbf (diff)
intel/stm: Place resource list right below MSEG
Suggested by Nico Huber in CB:38765. This placement makes the address calculation simpler and makes its location indepedent of the number of CPUs. As part of the change in the BIOS resource list address calculation, the `size` variable was factored out of the conditional in line 361, thus eliminating the else. Change-Id: I9ee2747474df02b0306530048bdec75e95413b5d Signed-off-by: Eugene D Myers <cedarhouse@comcast.net> Reviewed-on: https://review.coreboot.org/c/coreboot/+/40437 Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/cpu/x86/smm')
-rw-r--r--src/cpu/x86/smm/smm_module_loader.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/cpu/x86/smm/smm_module_loader.c b/src/cpu/x86/smm/smm_module_loader.c
index bdcf2834ed..c08e83369e 100644
--- a/src/cpu/x86/smm/smm_module_loader.c
+++ b/src/cpu/x86/smm/smm_module_loader.c
@@ -307,13 +307,13 @@ int smm_setup_relocation_handler(struct smm_loader_params *params)
/* The SMM module is placed within the provided region in the following
* manner:
* +-----------------+ <- smram + size
- * | stacks |
- * +-----------------+ <- smram + size - total_stack_size
- * | fxsave area |
- * +-----------------+ <- smram + size - total_stack_size - fxsave_size
* | BIOS resource |
* | list (STM) |
- * +-----------------+ <- .. - CONFIG_BIOS_RESOURCE_LIST_SIZE
+ * +-----------------+ <- smram + size - CONFIG_BIOS_RESOURCE_LIST_SIZE
+ * | stacks |
+ * +-----------------+ <- .. - total_stack_size
+ * | fxsave area |
+ * +-----------------+ <- .. - total_stack_size - fxsave_size
* | ... |
* +-----------------+ <- smram + handler_size + SMM_DEFAULT_SIZE
* | handler |
@@ -354,11 +354,10 @@ int smm_load_module(void *smram, size_t size, struct smm_loader_params *params)
/* Stacks start at the top of the region. */
base = smram;
+ base += size;
if (CONFIG(STM))
- base += size - CONFIG_MSEG_SIZE; // take out the mseg
- else
- base += size;
+ base -= CONFIG_MSEG_SIZE + CONFIG_BIOS_RESOURCE_LIST_SIZE;
params->stack_top = base;
@@ -388,9 +387,6 @@ int smm_load_module(void *smram, size_t size, struct smm_loader_params *params)
/* Does the required amount of memory exceed the SMRAM region size? */
total_size = total_stack_size + handler_size;
total_size += fxsave_size + SMM_DEFAULT_SIZE;
- /* Account for the BIOS resource list */
- if (CONFIG(STM))
- total_size += CONFIG_BIOS_RESOURCE_LIST_SIZE;
if (total_size > size)
return -1;