Attention is currently required from: Angel Pons.
Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/79754?usp=email )
Change subject: northbridge/intel/sandybridge: Enable x86_64 for mrc.bin ......................................................................
northbridge/intel/sandybridge: Enable x86_64 for mrc.bin
Enable x86_64 support for MRC.bin: - Add a wrapper function for console printing that calls into long mode to call native do_putchar - Remove Kconfig guard for x86_64 when MRC is being used
Tested: Booted Lenovo X220 using mrc.bin under x86_64 and MRC is able to print to the console.
Change-Id: I21ffcb5f5d4bf155593e8111531bdf0ed7071dfc Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M src/cpu/intel/model_206ax/Kconfig M src/northbridge/intel/sandybridge/mrc_wrapper.S M src/northbridge/intel/sandybridge/raminit_mrc.c 3 files changed, 41 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/54/79754/1
diff --git a/src/cpu/intel/model_206ax/Kconfig b/src/cpu/intel/model_206ax/Kconfig index 10c0ae3..649ef4e 100644 --- a/src/cpu/intel/model_206ax/Kconfig +++ b/src/cpu/intel/model_206ax/Kconfig @@ -1,7 +1,7 @@ config CPU_INTEL_MODEL_206AX bool select ARCH_X86 - select HAVE_EXP_X86_64_SUPPORT if USE_NATIVE_RAMINIT + select HAVE_EXP_X86_64_SUPPORT select SSE2 select UDELAY_TSC select TSC_MONOTONIC_TIMER diff --git a/src/northbridge/intel/sandybridge/mrc_wrapper.S b/src/northbridge/intel/sandybridge/mrc_wrapper.S index e169064..c92289c 100644 --- a/src/northbridge/intel/sandybridge/mrc_wrapper.S +++ b/src/northbridge/intel/sandybridge/mrc_wrapper.S @@ -26,3 +26,38 @@ popal ret
+ .section ".text.mrc_console_wrapper", "ax", @progbits + .globl mrc_console_wrapper + + /* + * 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. + */ +mrc_console_wrapper: + /* Set up new stack frame */ + pushal + mov %esp, %ebp + + /* Align stack and make space for arguments */ + andl $0xfffffff0, %esp + subl $8, %esp + + /* Get argument */ + movl 36(%ebp), %eax + push %eax + + /* Get function to call */ + mov $do_putchar, %eax + push %eax + + /* + * Elevate to long mode. As 2nd and 3rd argument are unused they + * haven't been pushed to the stack. + */ + call long_mode_call_3arg + + /* Restore stack pointer */ + mov %ebp, %esp + popal + ret \ No newline at end of file diff --git a/src/northbridge/intel/sandybridge/raminit_mrc.c b/src/northbridge/intel/sandybridge/raminit_mrc.c index d59aa86..0bcc817 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 mrc_console_wrapper(uint8_t byte);
static void save_mrc_data(struct pei_data *pei_data) { @@ -155,7 +156,10 @@ }
/* Pass console handler in pei_data */ - pei_data->tx_byte_ptr = (uintptr_t)do_putchar; + if (ENV_X86_64) + pei_data->tx_byte_ptr = (uintptr_t)mrc_console_wrapper; + else + pei_data->tx_byte_ptr = (uintptr_t)do_putchar;
/* Locate and call UEFI System Agent binary. */ entry = cbfs_map("mrc.bin", NULL);