summaryrefslogtreecommitdiff
path: root/src/cpu
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2021-02-15 13:20:35 +0100
committerPatrick Georgi <pgeorgi@google.com>2021-03-18 08:13:33 +0000
commited4be45d58ea482c1c8172bc4b2fa1c6af75c75f (patch)
tree16d9da57a5cad45b001f58f863cfbea040ab3569 /src/cpu
parent166d2ac901e2faafa84c88f46cdeb774dd1123bd (diff)
cpu/x86/smm: Move apic_id_to_cpu map to smm_stub params
This is only consumed by the stub and not by the relocation handler or the permanent handler, so move it out of the runtime struct. Change-Id: I01ed0a412c23c8a82d88408be058a27e55d0dc4d Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/50762 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src/cpu')
-rw-r--r--src/cpu/x86/mp_init.c4
-rw-r--r--src/cpu/x86/smm/smm_module_loader.c3
-rw-r--r--src/cpu/x86/smm/smm_module_loaderv2.c3
-rw-r--r--src/cpu/x86/smm/smm_stub.S11
4 files changed, 12 insertions, 9 deletions
diff --git a/src/cpu/x86/mp_init.c b/src/cpu/x86/mp_init.c
index 3edb5e7693..0693bc712a 100644
--- a/src/cpu/x86/mp_init.c
+++ b/src/cpu/x86/mp_init.c
@@ -762,10 +762,10 @@ static void asmlinkage smm_do_relocation(void *arg)
static void adjust_smm_apic_id_map(struct smm_loader_params *smm_params)
{
int i;
- struct smm_runtime *runtime = smm_params->runtime;
+ struct smm_stub_params *stub_params = smm_params->stub_params;
for (i = 0; i < CONFIG_MAX_CPUS; i++)
- runtime->apic_id_to_cpu[i] = cpu_get_apic_id(i);
+ stub_params->apic_id_to_cpu[i] = cpu_get_apic_id(i);
}
static int install_relocation_handler(int num_cpus, size_t save_state_size)
diff --git a/src/cpu/x86/smm/smm_module_loader.c b/src/cpu/x86/smm/smm_module_loader.c
index d799ae2805..16feeb6c6e 100644
--- a/src/cpu/x86/smm/smm_module_loader.c
+++ b/src/cpu/x86/smm/smm_module_loader.c
@@ -259,9 +259,10 @@ static int smm_module_setup_stub(void *smbase, size_t smm_size,
/* Initialize the APIC id to CPU number table to be 1:1 */
for (i = 0; i < params->num_concurrent_stacks; i++)
- stub_params->runtime.apic_id_to_cpu[i] = i;
+ stub_params->apic_id_to_cpu[i] = i;
/* Allow the initiator to manipulate SMM stub parameters. */
+ params->stub_params = stub_params;
params->runtime = &stub_params->runtime;
printk(BIOS_DEBUG, "SMM Module: stub loaded at %p. Will call %p\n",
diff --git a/src/cpu/x86/smm/smm_module_loaderv2.c b/src/cpu/x86/smm/smm_module_loaderv2.c
index be0e23d50c..81d85c6f92 100644
--- a/src/cpu/x86/smm/smm_module_loaderv2.c
+++ b/src/cpu/x86/smm/smm_module_loaderv2.c
@@ -464,9 +464,10 @@ static int smm_module_setup_stub(void *smbase, size_t smm_size,
/* Initialize the APIC id to CPU number table to be 1:1 */
for (i = 0; i < params->num_concurrent_stacks; i++)
- stub_params->runtime.apic_id_to_cpu[i] = i;
+ stub_params->apic_id_to_cpu[i] = i;
/* Allow the initiator to manipulate SMM stub parameters. */
+ params->stub_params = stub_params;
params->runtime = &stub_params->runtime;
printk(BIOS_DEBUG, "SMM Module: stub loaded at %p. Will call %p\n",
diff --git a/src/cpu/x86/smm/smm_stub.S b/src/cpu/x86/smm/smm_stub.S
index b9b0670ef6..24cb684e10 100644
--- a/src/cpu/x86/smm/smm_stub.S
+++ b/src/cpu/x86/smm/smm_stub.S
@@ -25,6 +25,12 @@ fxsave_area:
.long 0
fxsave_area_size:
.long 0
+/* apic_to_cpu_num is a table mapping the default APIC id to CPU num. If the
+ * APIC id is found at the given index, the contiguous CPU number is index
+ * into the table. */
+apic_to_cpu_num:
+.fill CONFIG_MAX_CPUS,1,0xff
+
/* struct smm_runtime begins here. */
smm_runtime:
smbase:
@@ -40,11 +46,6 @@ gnvs_ptr:
/* allows the STM to bring up SMM in 32-bit mode */
start32_offset:
.long smm_trampoline32 - _start
-/* apic_to_cpu_num is a table mapping the default APIC id to CPU num. If the
- * APIC id is found at the given index, the contiguous CPU number is index
- * into the table. */
-apic_to_cpu_num:
-.fill CONFIG_MAX_CPUS,1,0xff
/* end struct smm_runtime */
.data