Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Simon Glass | efedba7 | 2017-01-16 07:03:58 -0700 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2016 Google, Inc |
| 4 | * Written by Simon Glass <sjg@chromium.org> |
Simon Glass | efedba7 | 2017-01-16 07:03:58 -0700 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <common.h> |
Simon Glass | 1fa70f8 | 2019-11-14 12:57:34 -0700 | [diff] [blame] | 8 | #include <cpu_func.h> |
Simon Glass | 590aef7 | 2017-01-16 07:03:59 -0700 | [diff] [blame] | 9 | #include <debug_uart.h> |
Simon Glass | 9758973 | 2020-05-10 11:40:02 -0600 | [diff] [blame] | 10 | #include <init.h> |
Simon Glass | 3d2d3b1 | 2023-09-19 21:00:05 -0600 | [diff] [blame] | 11 | #include <asm/cpu.h> |
Simon Glass | 86ed9c5 | 2021-11-03 21:09:08 -0600 | [diff] [blame] | 12 | #include <asm/global_data.h> |
Simon Glass | 0b22604 | 2024-01-04 08:10:39 -0700 | [diff] [blame] | 13 | #include <asm/processor-flags.h> |
Simon Glass | efedba7 | 2017-01-16 07:03:58 -0700 | [diff] [blame] | 14 | |
Simon Glass | 3d2d3b1 | 2023-09-19 21:00:05 -0600 | [diff] [blame] | 15 | DECLARE_GLOBAL_DATA_PTR; |
| 16 | |
Simon Glass | efedba7 | 2017-01-16 07:03:58 -0700 | [diff] [blame] | 17 | int cpu_has_64bit(void) |
| 18 | { |
| 19 | return true; |
| 20 | } |
| 21 | |
| 22 | void enable_caches(void) |
| 23 | { |
| 24 | /* Not implemented */ |
| 25 | } |
| 26 | |
| 27 | void disable_caches(void) |
| 28 | { |
| 29 | /* Not implemented */ |
| 30 | } |
| 31 | |
| 32 | int dcache_status(void) |
| 33 | { |
| 34 | return true; |
| 35 | } |
| 36 | |
| 37 | int x86_mp_init(void) |
| 38 | { |
| 39 | /* Not implemented */ |
| 40 | return 0; |
| 41 | } |
Simon Glass | 78a20d2 | 2017-01-16 07:04:08 -0700 | [diff] [blame] | 42 | |
Simon Glass | 0b22604 | 2024-01-04 08:10:39 -0700 | [diff] [blame] | 43 | /* enable SSE features for hardware floating point */ |
| 44 | static 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 Glass | 05e12f7 | 2019-04-25 21:58:42 -0600 | [diff] [blame] | 52 | int x86_cpu_reinit_f(void) |
| 53 | { |
Simon Glass | 3d2d3b1 | 2023-09-19 21:00:05 -0600 | [diff] [blame] | 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; |
Simon Glass | 0b22604 | 2024-01-04 08:10:39 -0700 | [diff] [blame] | 57 | if (IS_ENABLED(CONFIG_X86_HARDFP)) |
| 58 | setup_sse_features(); |
Simon Glass | 3d2d3b1 | 2023-09-19 21:00:05 -0600 | [diff] [blame] | 59 | |
Simon Glass | 05e12f7 | 2019-04-25 21:58:42 -0600 | [diff] [blame] | 60 | return 0; |
| 61 | } |
Simon Glass | 2d8b3c6 | 2020-09-22 12:45:26 -0600 | [diff] [blame] | 62 | |
| 63 | int cpu_phys_address_size(void) |
| 64 | { |
| 65 | return CONFIG_CPU_ADDR_BITS; |
| 66 | } |
Simon Glass | f3d73ea | 2022-01-04 03:51:13 -0700 | [diff] [blame] | 67 | |
| 68 | int x86_cpu_init_f(void) |
| 69 | { |
| 70 | return 0; |
| 71 | } |
Simon Glass | 436393e | 2023-05-04 16:50:51 -0600 | [diff] [blame] | 72 | |
| 73 | #ifdef CONFIG_DEBUG_UART_BOARD_INIT |
| 74 | void board_debug_uart_init(void) |
| 75 | { |
| 76 | /* this was already done in SPL */ |
| 77 | } |
| 78 | #endif |