xref: /openbmc/u-boot/arch/x86/include/asm/mrc_common.h (revision 2399e401)
1 /*
2  * Copyright (c) 2016 Google, Inc
3  *
4  * SPDX-License-Identifier:	GPL-2.0
5  */
6 
7 #ifndef __ASM_MRC_COMMON_H
8 #define __ASM_MRC_COMMON_H
9 
10 #include <linux/linkage.h>
11 
12 /**
13  * mrc_common_init() - Set up SDRAM
14  *
15  * This calls the memory reference code (MRC) to set up SDRAM
16  *
17  * @dev:	Northbridge device
18  * @pei_data:	Platform-specific data required by the MRC
19  * @use_asm_linkage: true if the call to MRC requires asmlinkage, false if it
20  * uses normal U-Boot calling
21  * @return 0 if OK, -ve on error
22  */
23 int mrc_common_init(struct udevice *dev, void *pei_data, bool use_asm_linkage);
24 
25 asmlinkage void sdram_console_tx_byte(unsigned char byte);
26 
27 int mrc_locate_spd(struct udevice *dev, int size, const void **spd_datap);
28 
29 void report_memory_config(void);
30 
31 /**
32  * mrc_add_memory_area() - Add a new usable memory area to our list
33  *
34  * Note: @start and @end must not span the first 4GB boundary
35  *
36  * @info:	Place to store memory info
37  * @start:	Start of this memory area
38  * @end:	End of this memory area + 1
39  */
40 int mrc_add_memory_area(struct memory_info *info, uint64_t start,
41 			  uint64_t end);
42 
43 /*
44  * This function looks for the highest region of memory lower than 4GB which
45  * has enough space for U-Boot where U-Boot is aligned on a page boundary.
46  * It overrides the default implementation found elsewhere which simply
47  * picks the end of ram, wherever that may be. The location of the stack,
48  * the relocation address, and how far U-Boot is moved by relocation are
49  * set in the global data structure.
50  */
51 ulong mrc_common_board_get_usable_ram_top(ulong total_size);
52 
53 void mrc_common_dram_init_banksize(void);
54 
55 #endif
56