northbridge/intel/sandybridge/raminit: Prepare MRC path for x86_64

- Remove pointers in argument list passed to MRC to make sure the struct
  has the same size on x86_64 as on x86_32.
- Add assembly wrapper to call the MRC with argument in EAX.
- Wrap calling MRC in protected_mode_call_2arg, which is a stub on x86_32

Tested: Boots on Lenovo X220 using MRC in x86_32 and x86_64 mode.

Change-Id: Id755e7381c5a94360e3511c53432d68b7687df67
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/79751
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jérémy Compostella <jeremy.compostella@intel.com>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/src/northbridge/intel/sandybridge/mrc_wrapper.S b/src/northbridge/intel/sandybridge/mrc_wrapper.S
new file mode 100644
index 0000000..860526b
--- /dev/null
+++ b/src/northbridge/intel/sandybridge/mrc_wrapper.S
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/* Functions to call MRC.bin from x86_64 */
+
+.text
+.code32
+	.section ".text.mrc_wrapper", "ax", @progbits
+	.globl mrc_wrapper
+mrc_wrapper:
+	/* Set up new stack frame */
+	pushal
+	mov	%esp, %ebp
+
+	/* Align stack */
+	andl	$0xfffffff0, %esp
+
+	movl	36(%ebp), %ebx	/* Get function pointer */
+	movl	40(%ebp), %eax	/* Get argument */
+
+	call	*%ebx
+
+	/* Place return value on stack so that popal fetches it */
+	movl	%eax, 28(%ebp)
+
+	/* Restore stack pointer */
+	mov	%ebp, %esp
+	popal
+	ret