blob: 80eab71031529e3db98855df8042957b48fdcfd8 [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
Simon Glass1fa70f82019-11-14 12:57:34 -07007#include <cpu_func.h>
Simon Glass590aef72017-01-16 07:03:59 -07008#include <debug_uart.h>
Simon Glass97589732020-05-10 11:40:02 -06009#include <init.h>
Simon Glass3d2d3b12023-09-19 21:00:05 -060010#include <asm/cpu.h>
Simon Glass86ed9c52021-11-03 21:09:08 -060011#include <asm/global_data.h>
Simon Glass0b226042024-01-04 08:10:39 -070012#include <asm/processor-flags.h>
Simon Glassefedba72017-01-16 07:03:58 -070013
Simon Glass3d2d3b12023-09-19 21:00:05 -060014DECLARE_GLOBAL_DATA_PTR;
15
Simon Glassefedba72017-01-16 07:03:58 -070016int cpu_has_64bit(void)
17{
18 return true;
19}
20
21void enable_caches(void)
22{
23 /* Not implemented */
24}
25
26void disable_caches(void)
27{
28 /* Not implemented */
29}
30
31int dcache_status(void)
32{
33 return true;
34}
35
36int x86_mp_init(void)
37{
38 /* Not implemented */
39 return 0;
40}
Simon Glass78a20d22017-01-16 07:04:08 -070041
Simon Glass0b226042024-01-04 08:10:39 -070042/* enable SSE features for hardware floating point */
43static void setup_sse_features(void)
44{
45 asm ("mov %%cr4, %%rax\n" \
46 "or %0, %%rax\n" \
47 "mov %%rax, %%cr4\n" \
48 : : "i" (X86_CR4_OSFXSR | X86_CR4_OSXMMEXCPT) : "eax");
49}
50
Simon Glass05e12f72019-04-25 21:58:42 -060051int x86_cpu_reinit_f(void)
52{
Simon Glass3d2d3b12023-09-19 21:00:05 -060053 /* set the vendor to Intel so that native_calibrate_tsc() works */
54 gd->arch.x86_vendor = X86_VENDOR_INTEL;
55 gd->arch.has_mtrr = true;
Simon Glass0b226042024-01-04 08:10:39 -070056 if (IS_ENABLED(CONFIG_X86_HARDFP))
57 setup_sse_features();
Simon Glass3d2d3b12023-09-19 21:00:05 -060058
Simon Glass05e12f72019-04-25 21:58:42 -060059 return 0;
60}
Simon Glass2d8b3c62020-09-22 12:45:26 -060061
62int cpu_phys_address_size(void)
63{
64 return CONFIG_CPU_ADDR_BITS;
65}
Simon Glassf3d73ea2022-01-04 03:51:13 -070066
67int x86_cpu_init_f(void)
68{
69 return 0;
70}
Simon Glass436393e2023-05-04 16:50:51 -060071
72#ifdef CONFIG_DEBUG_UART_BOARD_INIT
73void board_debug_uart_init(void)
74{
75 /* this was already done in SPL */
76}
77#endif