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