blob: 3cb57e058c729f5376bf786ba6ac78f1097afbac [file] [log] [blame]
Alexandru Gagniuc6be6c8f2016-01-26 18:22:43 -08001/*
Alexandru Gagniuc6be6c8f2016-01-26 18:22:43 -08002 * This file is part of the coreboot project.
3 *
Alexandru Gagniuc6be6c8f2016-01-26 18:22:43 -08004 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
Martin Rothcfc80c22016-02-02 06:14:44 -07008 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
Martin Roth20bbd812019-08-30 21:09:37 -060013 *
14 * This is the modern bootblock. It is used by platforms which select
15 * C_ENVIRONMENT_BOOTBLOCK, and it prepares the system for C environment runtime
16 * setup. The actual setup is done by hardware-specific code.
17 *
18 * It provides a bootflow similar to other architectures, and thus is considered
19 * to be the modern approach.
20 *
Alexandru Gagniuc6be6c8f2016-01-26 18:22:43 -080021 */
22
Furquan Shaikhb3ee03c2016-04-13 17:15:36 -070023#include <cpu/x86/cr.h>
Alexandru Gagniuc6be6c8f2016-01-26 18:22:43 -080024
25/*
26 * Include the old code for reset vector and protected mode entry. That code has
27 * withstood the test of time.
28 */
29#include <arch/x86/prologue.inc>
30#include <cpu/x86/16bit/entry16.inc>
31#include <cpu/x86/16bit/reset16.inc>
32#include <cpu/x86/32bit/entry32.inc>
33
Julius Wernercd49cce2019-03-05 16:53:33 -080034#if CONFIG(BOOTBLOCK_DEBUG_SPINLOOP)
Lee Leahyfdc8c8b2016-06-07 08:45:17 -070035
36 /* Wait for a JTAG debugger to break in and set EBX non-zero */
37 xor %ebx, %ebx
38
39debug_spinloop:
40 cmp $0, %ebx
41 jz debug_spinloop
42#endif
Alexandru Gagniuc6be6c8f2016-01-26 18:22:43 -080043
44bootblock_protected_mode_entry:
Lee Leahy2030d252016-06-05 18:41:00 -070045
Julius Wernercd49cce2019-03-05 16:53:33 -080046#if !CONFIG(USE_MARCH_586)
Kyösti Mälkki87efe242018-12-23 07:22:44 +020047 /* MMX registers required here */
48
Lee Leahy2030d252016-06-05 18:41:00 -070049 /* BIST result in eax */
Himanshu Sahdev aka CunningLearner2b840082019-09-08 12:29:27 +053050 movd %eax, %mm0
Lee Leahy2030d252016-06-05 18:41:00 -070051
52 /* Get an early timestamp */
Alexandru Gagniuc6be6c8f2016-01-26 18:22:43 -080053 rdtsc
54 movd %eax, %mm1
55 movd %edx, %mm2
Lee Leahy2030d252016-06-05 18:41:00 -070056#endif
Alexandru Gagniuc6be6c8f2016-01-26 18:22:43 -080057
Julius Wernercd49cce2019-03-05 16:53:33 -080058#if CONFIG(SSE)
Alexandru Gagniuc6be6c8f2016-01-26 18:22:43 -080059enable_sse:
Alexandru Gagniuc6be6c8f2016-01-26 18:22:43 -080060 mov %cr4, %eax
Lee Leahy38925972016-06-08 07:11:48 -070061 or $CR4_OSFXSR, %ax
Alexandru Gagniuc6be6c8f2016-01-26 18:22:43 -080062 mov %eax, %cr4
Julius Wernercd49cce2019-03-05 16:53:33 -080063#endif /* CONFIG(SSE) */
Alexandru Gagniuc6be6c8f2016-01-26 18:22:43 -080064
65 /* We're done. Now it's up to platform-specific code */
66 jmp bootblock_pre_c_entry