Alexandru Gagniuc | 6be6c8f | 2016-01-26 18:22:43 -0800 | [diff] [blame] | 1 | /* |
| 2 | * This is the modern bootblock. It is used by platforms which select |
| 3 | * C_ENVIRONMENT_BOOTBLOCK, and it prepares the system for C environment runtime |
| 4 | * setup. The actual setup is done by hardware-specific code. |
| 5 | * |
| 6 | * It provides a bootflow similar to other architectures, and thus is considered |
| 7 | * to be the modern approach. |
| 8 | * |
| 9 | * This file is part of the coreboot project. |
| 10 | * |
| 11 | * Copyright (C) 2015 Alexandru Gagniuc <mr.nuke.me@gmail.com> |
| 12 | * |
| 13 | * This program is free software; you can redistribute it and/or modify |
| 14 | * it under the terms of the GNU General Public License as published by |
| 15 | * the Free Software Foundation; either version 2 of the License, or |
| 16 | * (at your option) any later version. |
Martin Roth | cfc80c2 | 2016-02-02 06:14:44 -0700 | [diff] [blame] | 17 | * |
| 18 | * This program is distributed in the hope that it will be useful, |
| 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 21 | * GNU General Public License for more details. |
Alexandru Gagniuc | 6be6c8f | 2016-01-26 18:22:43 -0800 | [diff] [blame] | 22 | */ |
| 23 | |
Furquan Shaikh | b3ee03c | 2016-04-13 17:15:36 -0700 | [diff] [blame] | 24 | #include <cpu/x86/cr.h> |
Alexandru Gagniuc | 6be6c8f | 2016-01-26 18:22:43 -0800 | [diff] [blame] | 25 | |
| 26 | /* |
| 27 | * Include the old code for reset vector and protected mode entry. That code has |
| 28 | * withstood the test of time. |
| 29 | */ |
| 30 | #include <arch/x86/prologue.inc> |
| 31 | #include <cpu/x86/16bit/entry16.inc> |
| 32 | #include <cpu/x86/16bit/reset16.inc> |
| 33 | #include <cpu/x86/32bit/entry32.inc> |
| 34 | |
| 35 | |
| 36 | bootblock_protected_mode_entry: |
| 37 | /* Save BIST result */ |
| 38 | movd %eax, %mm0 |
| 39 | /* Save an early timestamp */ |
| 40 | rdtsc |
| 41 | movd %eax, %mm1 |
| 42 | movd %edx, %mm2 |
| 43 | |
| 44 | #if !IS_ENABLED(CONFIG_SSE) |
| 45 | enable_sse: |
| 46 | mov %cr0, %eax |
| 47 | and $~CR0_EM, %ax /* Clear coprocessor emulation CR0.EM */ |
| 48 | or $CR0_MP, %ax /* Set coprocessor monitoring CR0.MP */ |
| 49 | mov %eax, %cr0 |
| 50 | mov %cr4, %eax |
| 51 | or $(CR4_OSFXSR | CR4_OSXMMEXCPT), %ax |
| 52 | mov %eax, %cr4 |
| 53 | #endif /* IS_ENABLED(CONFIG_SSE) */ |
| 54 | |
| 55 | /* We're done. Now it's up to platform-specific code */ |
| 56 | jmp bootblock_pre_c_entry |