xref: /openbmc/u-boot/arch/x86/include/asm/mrc_common.h (revision e8f80a5a)
1*83d290c5STom Rini /* SPDX-License-Identifier: GPL-2.0 */
265dd1507SSimon Glass /*
365dd1507SSimon Glass  * Copyright (c) 2016 Google, Inc
465dd1507SSimon Glass  */
565dd1507SSimon Glass 
665dd1507SSimon Glass #ifndef __ASM_MRC_COMMON_H
765dd1507SSimon Glass #define __ASM_MRC_COMMON_H
865dd1507SSimon Glass 
965dd1507SSimon Glass #include <linux/linkage.h>
1065dd1507SSimon Glass 
1165dd1507SSimon Glass /**
1265dd1507SSimon Glass  * mrc_common_init() - Set up SDRAM
1365dd1507SSimon Glass  *
1465dd1507SSimon Glass  * This calls the memory reference code (MRC) to set up SDRAM
1565dd1507SSimon Glass  *
1665dd1507SSimon Glass  * @dev:	Northbridge device
1765dd1507SSimon Glass  * @pei_data:	Platform-specific data required by the MRC
1865dd1507SSimon Glass  * @use_asm_linkage: true if the call to MRC requires asmlinkage, false if it
1965dd1507SSimon Glass  * uses normal U-Boot calling
2065dd1507SSimon Glass  * @return 0 if OK, -ve on error
2165dd1507SSimon Glass  */
2265dd1507SSimon Glass int mrc_common_init(struct udevice *dev, void *pei_data, bool use_asm_linkage);
2365dd1507SSimon Glass 
2465dd1507SSimon Glass asmlinkage void sdram_console_tx_byte(unsigned char byte);
2565dd1507SSimon Glass 
2665dd1507SSimon Glass int mrc_locate_spd(struct udevice *dev, int size, const void **spd_datap);
2765dd1507SSimon Glass 
2865dd1507SSimon Glass void report_memory_config(void);
2965dd1507SSimon Glass 
3065dd1507SSimon Glass /**
3165dd1507SSimon Glass  * mrc_add_memory_area() - Add a new usable memory area to our list
3265dd1507SSimon Glass  *
3365dd1507SSimon Glass  * Note: @start and @end must not span the first 4GB boundary
3465dd1507SSimon Glass  *
3565dd1507SSimon Glass  * @info:	Place to store memory info
3665dd1507SSimon Glass  * @start:	Start of this memory area
3765dd1507SSimon Glass  * @end:	End of this memory area + 1
3865dd1507SSimon Glass  */
3965dd1507SSimon Glass int mrc_add_memory_area(struct memory_info *info, uint64_t start,
4065dd1507SSimon Glass 			  uint64_t end);
4165dd1507SSimon Glass 
4265dd1507SSimon Glass /*
4365dd1507SSimon Glass  * This function looks for the highest region of memory lower than 4GB which
4465dd1507SSimon Glass  * has enough space for U-Boot where U-Boot is aligned on a page boundary.
4565dd1507SSimon Glass  * It overrides the default implementation found elsewhere which simply
4665dd1507SSimon Glass  * picks the end of ram, wherever that may be. The location of the stack,
4765dd1507SSimon Glass  * the relocation address, and how far U-Boot is moved by relocation are
4865dd1507SSimon Glass  * set in the global data structure.
4965dd1507SSimon Glass  */
5065dd1507SSimon Glass ulong mrc_common_board_get_usable_ram_top(ulong total_size);
5165dd1507SSimon Glass 
5265dd1507SSimon Glass void mrc_common_dram_init_banksize(void);
5365dd1507SSimon Glass 
5465dd1507SSimon Glass #endif
55