x86: Don't set up MTRRs in SPL
[project/bcm63xx/u-boot.git] / arch / x86 / lib / init_helpers.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3 * (C) Copyright 2011
4 * Graeme Russ, <graeme.russ@gmail.com>
5 */
6
7 #include <common.h>
8 #include <linux/errno.h>
9 #include <asm/mtrr.h>
10
11 DECLARE_GLOBAL_DATA_PTR;
12
13 /* Get the top of usable RAM */
14 __weak ulong board_get_usable_ram_top(ulong total_size)
15 {
16 return gd->ram_size;
17 }
18
19 int init_cache_f_r(void)
20 {
21 #if (CONFIG_IS_ENABLED(X86_32BIT_INIT) || \
22 (!defined(CONFIG_SPL_BUILD) && \
23 !CONFIG_IS_ENABLED(CONFIG_X86_RUN_64BIT))) && \
24 !defined(CONFIG_HAVE_FSP)
25 int ret;
26
27 ret = mtrr_commit(false);
28 /* If MTRR MSR is not implemented by the processor, just ignore it */
29 if (ret && ret != -ENOSYS)
30 return ret;
31 #endif
32 /* Initialise the CPU cache(s) */
33 return init_cache();
34 }