xref: /openbmc/u-boot/arch/x86/lib/init_helpers.c (revision e91610da)
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) && !defined(CONFIG_HAVE_FSP)
22 	int ret;
23 
24 	ret = mtrr_commit(false);
25 	/* If MTRR MSR is not implemented by the processor, just ignore it */
26 	if (ret && ret != -ENOSYS)
27 		return ret;
28 #endif
29 	/* Initialise the CPU cache(s) */
30 	return init_cache();
31 }
32