summaryrefslogtreecommitdiff
path: root/src/northbridge
diff options
context:
space:
mode:
Diffstat (limited to 'src/northbridge')
-rw-r--r--src/northbridge/intel/sandybridge/mrc_wrapper.S10
-rw-r--r--src/northbridge/intel/sandybridge/raminit_mrc.c11
2 files changed, 19 insertions, 2 deletions
diff --git a/src/northbridge/intel/sandybridge/mrc_wrapper.S b/src/northbridge/intel/sandybridge/mrc_wrapper.S
index 860526b03c..d68ce091a4 100644
--- a/src/northbridge/intel/sandybridge/mrc_wrapper.S
+++ b/src/northbridge/intel/sandybridge/mrc_wrapper.S
@@ -25,3 +25,13 @@ mrc_wrapper:
mov %ebp, %esp
popal
ret
+
+ /*
+ * Callback for MRC to print a character on the console.
+ * As MRC is x86_32 call into long mode and use the x86_64
+ * function do_putchar to print to console.
+ */
+
+#include <src/cpu/x86/64bit/prot2long.inc>
+
+prot2lm_wrapper do_putchar
diff --git a/src/northbridge/intel/sandybridge/raminit_mrc.c b/src/northbridge/intel/sandybridge/raminit_mrc.c
index d59aa8687f..dde5742e8b 100644
--- a/src/northbridge/intel/sandybridge/raminit_mrc.c
+++ b/src/northbridge/intel/sandybridge/raminit_mrc.c
@@ -52,6 +52,7 @@
/* Assembly functions: */
void mrc_wrapper(void *func_ptr, uint32_t arg1);
+void __prot2lm_do_putchar(uint8_t byte);
static void save_mrc_data(struct pei_data *pei_data)
{
@@ -154,8 +155,14 @@ static void sdram_initialize(struct pei_data *pei_data)
system_reset();
}
- /* Pass console handler in pei_data */
- pei_data->tx_byte_ptr = (uintptr_t)do_putchar;
+ /*
+ * Pass console handler in pei_data. On x86_64 provide a wrapper around
+ * do_putchar that switches to long mode before calling do_putchar.
+ */
+ if (ENV_X86_64)
+ pei_data->tx_byte_ptr = (uintptr_t)__prot2lm_do_putchar;
+ else
+ pei_data->tx_byte_ptr = (uintptr_t)do_putchar;
/* Locate and call UEFI System Agent binary. */
entry = cbfs_map("mrc.bin", NULL);