blob: 5ea746ecce4ddb15b9fc643ba2327ca2a1c8f5a5 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Simon Glassefedba72017-01-16 07:03:58 -07002/*
3 * (C) Copyright 2016 Google, Inc
4 * Written by Simon Glass <sjg@chromium.org>
Simon Glassefedba72017-01-16 07:03:58 -07005 */
6
7#include <common.h>
Simon Glass1fa70f82019-11-14 12:57:34 -07008#include <cpu_func.h>
Simon Glass590aef72017-01-16 07:03:59 -07009#include <debug_uart.h>
Simon Glass97589732020-05-10 11:40:02 -060010#include <init.h>
Simon Glass3d2d3b12023-09-19 21:00:05 -060011#include <asm/cpu.h>
Simon Glass86ed9c52021-11-03 21:09:08 -060012#include <asm/global_data.h>
Simon Glass0b226042024-01-04 08:10:39 -070013#include <asm/processor-flags.h>
Simon Glassefedba72017-01-16 07:03:58 -070014
Simon Glass3d2d3b12023-09-19 21:00:05 -060015DECLARE_GLOBAL_DATA_PTR;
16
Simon Glassefedba72017-01-16 07:03:58 -070017int 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}
Simon Glass78a20d22017-01-16 07:04:08 -070042
Simon Glass0b226042024-01-04 08:10:39 -070043/* 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
Simon Glass05e12f72019-04-25 21:58:42 -060052int x86_cpu_reinit_f(void)
53{
Simon Glass3d2d3b12023-09-19 21:00:05 -060054 /* 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;
Simon Glass0b226042024-01-04 08:10:39 -070057 if (IS_ENABLED(CONFIG_X86_HARDFP))
58 setup_sse_features();
Simon Glass3d2d3b12023-09-19 21:00:05 -060059
Simon Glass05e12f72019-04-25 21:58:42 -060060 return 0;
61}
Simon Glass2d8b3c62020-09-22 12:45:26 -060062
63int cpu_phys_address_size(void)
64{
65 return CONFIG_CPU_ADDR_BITS;
66}
Simon Glassf3d73ea2022-01-04 03:51:13 -070067
68int x86_cpu_init_f(void)
69{
70 return 0;
71}
Simon Glass436393e2023-05-04 16:50:51 -060072
73#ifdef CONFIG_DEBUG_UART_BOARD_INIT
74void board_debug_uart_init(void)
75{
76 /* this was already done in SPL */
77}
78#endif