1 // SPDX-License-Identifier: GPL-2.0+ 2 /* 3 * Copyright (C) 2014, Bin Meng <bmeng.cn@gmail.com> 4 */ 5 6 #include <init.h> 7 #include <asm/fsp/fsp_support.h> 8 #include <asm/global_data.h> 9 dram_init(void)10int dram_init(void) 11 { 12 int ret; 13 14 /* The FSP has already set up DRAM, so grab the info we need */ 15 ret = fsp_scan_for_ram_size(); 16 if (ret) 17 return ret; 18 19 if (IS_ENABLED(CONFIG_ENABLE_MRC_CACHE)) { 20 struct mrc_output *mrc = &gd->arch.mrc[MRC_TYPE_NORMAL]; 21 22 mrc->buf = fsp_get_nvs_data(gd->arch.hob_list, &mrc->len); 23 } 24 25 return 0; 26 } 27 28 /* 29 * This function looks for the highest region of memory lower than 4GB which 30 * has enough space for U-Boot where U-Boot is aligned on a page boundary. 31 * It overrides the default implementation found elsewhere which simply 32 * picks the end of ram, wherever that may be. The location of the stack, 33 * the relocation address, and how far U-Boot is moved by relocation are 34 * set in the global data structure. 35 */ board_get_usable_ram_top(phys_size_t total_size)36phys_addr_t board_get_usable_ram_top(phys_size_t total_size) 37 { 38 return fsp_get_usable_lowmem_top(gd->arch.hob_list); 39 } 40