blob: 5d3ba4ec78c0f64d6adf2aaea4bff1561b7996d4 [file] [log] [blame]
Patrick Georgi11f00792020-03-04 15:10:45 +01001/* SPDX-License-Identifier: GPL-2.0-or-later */
2/* This file is part of the coreboot project. */
Alexandru Gagniuc6be6c8f2016-01-26 18:22:43 -08003/*
Arthur Heymansc05b1a62019-11-22 21:01:30 +01004 * This is the modern bootblock. It prepares the system for C environment runtime
Martin Roth20bbd812019-08-30 21:09:37 -06005 * setup. The actual setup is done by hardware-specific code.
6 *
7 * It provides a bootflow similar to other architectures, and thus is considered
8 * to be the modern approach.
9 *
Alexandru Gagniuc6be6c8f2016-01-26 18:22:43 -080010 */
11
Furquan Shaikhb3ee03c2016-04-13 17:15:36 -070012#include <cpu/x86/cr.h>
Alexandru Gagniuc6be6c8f2016-01-26 18:22:43 -080013
14/*
15 * Include the old code for reset vector and protected mode entry. That code has
16 * withstood the test of time.
17 */
18#include <arch/x86/prologue.inc>
19#include <cpu/x86/16bit/entry16.inc>
20#include <cpu/x86/16bit/reset16.inc>
21#include <cpu/x86/32bit/entry32.inc>
22
Patrick Rudolphb1ef7252019-09-28 17:44:01 +020023 /* BIST result in eax */
24 mov %eax, %ebx
25 /* entry64.inc preserves ebx. */
26#include <cpu/x86/64bit/entry64.inc>
27 mov %ebx, %eax
28
Julius Wernercd49cce2019-03-05 16:53:33 -080029#if CONFIG(BOOTBLOCK_DEBUG_SPINLOOP)
Lee Leahyfdc8c8b2016-06-07 08:45:17 -070030
31 /* Wait for a JTAG debugger to break in and set EBX non-zero */
32 xor %ebx, %ebx
33
34debug_spinloop:
35 cmp $0, %ebx
36 jz debug_spinloop
37#endif
Alexandru Gagniuc6be6c8f2016-01-26 18:22:43 -080038
39bootblock_protected_mode_entry:
Lee Leahy2030d252016-06-05 18:41:00 -070040
Julius Wernercd49cce2019-03-05 16:53:33 -080041#if !CONFIG(USE_MARCH_586)
Kyösti Mälkki87efe242018-12-23 07:22:44 +020042 /* MMX registers required here */
43
Lee Leahy2030d252016-06-05 18:41:00 -070044 /* BIST result in eax */
Himanshu Sahdev aka CunningLearner2b840082019-09-08 12:29:27 +053045 movd %eax, %mm0
Lee Leahy2030d252016-06-05 18:41:00 -070046
47 /* Get an early timestamp */
Alexandru Gagniuc6be6c8f2016-01-26 18:22:43 -080048 rdtsc
49 movd %eax, %mm1
50 movd %edx, %mm2
Lee Leahy2030d252016-06-05 18:41:00 -070051#endif
Alexandru Gagniuc6be6c8f2016-01-26 18:22:43 -080052
Julius Wernercd49cce2019-03-05 16:53:33 -080053#if CONFIG(SSE)
Alexandru Gagniuc6be6c8f2016-01-26 18:22:43 -080054enable_sse:
Alexandru Gagniuc6be6c8f2016-01-26 18:22:43 -080055 mov %cr4, %eax
Lee Leahy38925972016-06-08 07:11:48 -070056 or $CR4_OSFXSR, %ax
Alexandru Gagniuc6be6c8f2016-01-26 18:22:43 -080057 mov %eax, %cr4
Julius Wernercd49cce2019-03-05 16:53:33 -080058#endif /* CONFIG(SSE) */
Alexandru Gagniuc6be6c8f2016-01-26 18:22:43 -080059
60 /* We're done. Now it's up to platform-specific code */
61 jmp bootblock_pre_c_entry