]> git.ipfire.org Git - thirdparty/u-boot.git/blame - arch/x86/cpu/x86_64/cpu.c
x86: Enable SSE in 64-bit mode
[thirdparty/u-boot.git] / arch / x86 / cpu / x86_64 / cpu.c
CommitLineData
83d290c5 1// SPDX-License-Identifier: GPL-2.0+
93031595
SG
2/*
3 * (C) Copyright 2016 Google, Inc
4 * Written by Simon Glass <sjg@chromium.org>
93031595
SG
5 */
6
7#include <common.h>
30c7c434 8#include <cpu_func.h>
a160092a 9#include <debug_uart.h>
691d719d 10#include <init.h>
8ebca32b 11#include <asm/cpu.h>
9c297a3d 12#include <asm/global_data.h>
5716be53 13#include <asm/processor-flags.h>
93031595 14
8ebca32b
SG
15DECLARE_GLOBAL_DATA_PTR;
16
93031595
SG
17int cpu_has_64bit(void)
18{
19 return true;
20}
21
22void enable_caches(void)
23{
24 /* Not implemented */
25}
26
27void disable_caches(void)
28{
29 /* Not implemented */
30}
31
32int dcache_status(void)
33{
34 return true;
35}
36
37int x86_mp_init(void)
38{
39 /* Not implemented */
40 return 0;
41}
1b408630 42
5716be53
SG
43/* enable SSE features for hardware floating point */
44static void setup_sse_features(void)
45{
46 asm ("mov %%cr4, %%rax\n" \
47 "or %0, %%rax\n" \
48 "mov %%rax, %%cr4\n" \
49 : : "i" (X86_CR4_OSFXSR | X86_CR4_OSXMMEXCPT) : "eax");
50}
51
c0069e9a
SG
52int x86_cpu_reinit_f(void)
53{
8ebca32b
SG
54 /* set the vendor to Intel so that native_calibrate_tsc() works */
55 gd->arch.x86_vendor = X86_VENDOR_INTEL;
56 gd->arch.has_mtrr = true;
5716be53
SG
57 if (IS_ENABLED(CONFIG_X86_HARDFP))
58 setup_sse_features();
8ebca32b 59
c0069e9a
SG
60 return 0;
61}
aec7c1c5
SG
62
63int cpu_phys_address_size(void)
64{
65 return CONFIG_CPU_ADDR_BITS;
66}
450ce56a
SG
67
68int x86_cpu_init_f(void)
69{
70 return 0;
71}
afa3d90c
SG
72
73#ifdef CONFIG_DEBUG_UART_BOARD_INIT
74void board_debug_uart_init(void)
75{
76 /* this was already done in SPL */
77}
78#endif