blob: 3e3a11ac2fa93e4bd2675f2cdc012917407182b7 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Graeme Russd47ab0e2011-12-23 16:51:29 +11002/*
3 * (C) Copyright 2011
4 * Graeme Russ, <graeme.russ@gmail.com>
Graeme Russd47ab0e2011-12-23 16:51:29 +11005 */
Bin Mengc17ca6b2015-08-13 00:29:10 -07006
Graeme Russd47ab0e2011-12-23 16:51:29 +11007#include <common.h>
Masahiro Yamada1221ce42016-09-21 11:28:55 +09008#include <linux/errno.h>
Simon Glassdb55bd72015-01-01 16:18:11 -07009#include <asm/mtrr.h>
Graeme Russd47ab0e2011-12-23 16:51:29 +110010
11DECLARE_GLOBAL_DATA_PTR;
12
Graeme Russa1d57b72011-12-23 21:14:22 +110013int init_cache_f_r(void)
14{
Simon Glasscc2d27d2019-09-25 08:56:49 -060015 bool do_mtrr = CONFIG_IS_ENABLED(X86_32BIT_INIT) ||
16 IS_ENABLED(CONFIG_FSP_VERSION2);
Simon Glassdb55bd72015-01-01 16:18:11 -070017 int ret;
18
Simon Glasscc2d27d2019-09-25 08:56:49 -060019 do_mtrr &= !IS_ENABLED(CONFIG_FSP_VERSION1) &&
20 !IS_ENABLED(CONFIG_SYS_SLIMBOOTLOADER);
21
22 if (do_mtrr) {
23 ret = mtrr_commit(false);
24 /*
25 * If MTRR MSR is not implemented by the processor, just ignore
26 * it
27 */
28 if (ret && ret != -ENOSYS)
29 return ret;
30 }
31
Graeme Russa1d57b72011-12-23 21:14:22 +110032 /* Initialise the CPU cache(s) */
33 return init_cache();
34}