blob: d906b528b35b5a43f3c1e4c0d40df6d365b62797 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Graeme Russa875dda2011-12-23 16:51:29 +11002/*
3 * (C) Copyright 2011
4 * Graeme Russ, <graeme.russ@gmail.com>
Graeme Russa875dda2011-12-23 16:51:29 +11005 */
Bin Meng535109a2015-08-13 00:29:10 -07006
Graeme Russa875dda2011-12-23 16:51:29 +11007#include <common.h>
Simon Glass6980b6b2019-11-14 12:57:45 -07008#include <init.h>
Masahiro Yamada56a931c2016-09-21 11:28:55 +09009#include <linux/errno.h>
Simon Glass004ba172015-01-01 16:18:11 -070010#include <asm/mtrr.h>
Graeme Russa875dda2011-12-23 16:51:29 +110011
12DECLARE_GLOBAL_DATA_PTR;
13
Graeme Russ3fb4f9e2011-12-23 21:14:22 +110014int init_cache_f_r(void)
15{
Simon Glassa72a7ab2019-09-25 08:56:49 -060016 bool do_mtrr = CONFIG_IS_ENABLED(X86_32BIT_INIT) ||
17 IS_ENABLED(CONFIG_FSP_VERSION2);
Simon Glass004ba172015-01-01 16:18:11 -070018 int ret;
19
Simon Glassa72a7ab2019-09-25 08:56:49 -060020 do_mtrr &= !IS_ENABLED(CONFIG_FSP_VERSION1) &&
21 !IS_ENABLED(CONFIG_SYS_SLIMBOOTLOADER);
22
23 if (do_mtrr) {
24 ret = mtrr_commit(false);
25 /*
26 * If MTRR MSR is not implemented by the processor, just ignore
27 * it
28 */
29 if (ret && ret != -ENOSYS)
30 return ret;
31 }
32
Simon Glass8b8e7542020-04-26 09:12:55 -060033 if (!ll_boot_init())
34 return 0;
35
Graeme Russ3fb4f9e2011-12-23 21:14:22 +110036 /* Initialise the CPU cache(s) */
37 return init_cache();
38}