• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <init.h>
9 #include <linux/errno.h>
10 #include <asm/mtrr.h>
11 
12 DECLARE_GLOBAL_DATA_PTR;
13 
init_cache_f_r(void)14 int init_cache_f_r(void)
15 {
16 	bool do_mtrr = CONFIG_IS_ENABLED(X86_32BIT_INIT) ||
17 		 IS_ENABLED(CONFIG_FSP_VERSION2);
18 	int ret;
19 
20 	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 
33 	/* Initialise the CPU cache(s) */
34 	return init_cache();
35 }
36