2 * Copyright (C) 2014, Bin Meng <bmeng.cn@gmail.com>
4 * SPDX-License-Identifier: GPL-2.0+
8 #include <asm/arch/fsp/fsp_support.h>
12 DECLARE_GLOBAL_DATA_PTR;
16 phys_size_t ram_size = 0;
17 union hob_pointers_t hob;
19 hob.raw = gd->arch.hob_list;
20 while (!END_OF_HOB(hob)) {
21 if (hob.hdr->type == HOB_TYPE_RES_DESC) {
22 if (hob.res_desc->type == RES_SYS_MEM ||
23 hob.res_desc->type == RES_MEM_RESERVED) {
24 ram_size += hob.res_desc->len;
27 hob.raw = GET_NEXT_HOB(hob);
30 gd->ram_size = ram_size;
36 void dram_init_banksize(void)
38 gd->bd->bi_dram[0].start = 0;
39 gd->bd->bi_dram[0].size = gd->ram_size;
43 * This function looks for the highest region of memory lower than 4GB which
44 * has enough space for U-Boot where U-Boot is aligned on a page boundary.
45 * It overrides the default implementation found elsewhere which simply
46 * picks the end of ram, wherever that may be. The location of the stack,
47 * the relocation address, and how far U-Boot is moved by relocation are
48 * set in the global data structure.
50 ulong board_get_usable_ram_top(ulong total_size)
52 return get_usable_lowmem_top(gd->arch.hob_list);
55 unsigned install_e820_map(unsigned max_entries, struct e820entry *entries)
57 unsigned num_entries = 0;
59 union hob_pointers_t hob;
61 hob.raw = gd->arch.hob_list;
63 while (!END_OF_HOB(hob)) {
64 if (hob.hdr->type == HOB_TYPE_RES_DESC) {
65 entries[num_entries].addr = hob.res_desc->phys_start;
66 entries[num_entries].size = hob.res_desc->len;
68 if (hob.res_desc->type == RES_SYS_MEM)
69 entries[num_entries].type = E820_RAM;
70 else if (hob.res_desc->type == RES_MEM_RESERVED)
71 entries[num_entries].type = E820_RESERVED;
73 hob.raw = GET_NEXT_HOB(hob);