drivers/intel/fsp2_0/memory_init: Wrap calls into FSP

Use a wrapper code that does nothing on x86_32, but drops to protected
mode to call into FSP when running on x86_64.

Tested on Intel Skylake when running in long mode. Successfully run the
FSP-M which is compiled for x86_32 and then continued booting in
long mode.

Change-Id: I9fb37019fb0d04f74d00733ce2e365f484d97d66
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/48202
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/src/drivers/intel/fsp2_0/notify.c b/src/drivers/intel/fsp2_0/notify.c
index ee04630..8a51c0b 100644
--- a/src/drivers/intel/fsp2_0/notify.c
+++ b/src/drivers/intel/fsp2_0/notify.c
@@ -5,6 +5,7 @@
 #include <cpu/x86/mtrr.h>
 #include <fsp/util.h>
 #include <timestamp.h>
+#include <mode_switch.h>
 
 static void fsp_notify(enum fsp_notify_phase phase)
 {
@@ -30,7 +31,10 @@
 		post_code(POST_FSP_NOTIFY_BEFORE_END_OF_FIRMWARE);
 	}
 
-	ret = fspnotify(&notify_params);
+	if (ENV_X86_64)
+		ret = protected_mode_call_1arg(fspnotify, (uintptr_t)&notify_params);
+	else
+		ret = fspnotify(&notify_params);
 
 	if (phase == AFTER_PCI_ENUM) {
 		timestamp_add_now(TS_FSP_AFTER_ENUMERATE);