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>
diff --git a/src/cpu/x86/smm/smm_module_loaderv2.c b/src/cpu/x86/smm/smm_module_loaderv2.c
index 3bf77a9..c8b9fe6 100644
--- a/src/cpu/x86/smm/smm_module_loaderv2.c
+++ b/src/cpu/x86/smm/smm_module_loaderv2.c
@@ -89,7 +89,7 @@
 	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 @@
 	 * + 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 @@
 {
 	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 @@
 	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 @@
 
 	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 @@
 	 */
 	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 @@
 	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 @@
 	 */
 	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 @@
 	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 b100bf8..3375f4a 100644
--- a/src/include/cpu/x86/smm.h
+++ b/src/include/cpu/x86/smm.h
@@ -132,12 +132,6 @@
  *             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 @@
 	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. */