diff options
author | Ryan Chuang <ryan.chuang@mediatek.corp-partner.google.com> | 2021-07-09 16:26:50 +0800 |
---|---|---|
committer | Hung-Te Lin <hungte@chromium.org> | 2021-07-14 09:47:39 +0000 |
commit | 2e3d1db7ecc142452c717985c3d931cf7aaca19c (patch) | |
tree | 24e6a124d827ba50a7bde4ea7d87dbe8e5ce3f38 /src/soc/mediatek/mt8195 | |
parent | 1ff60178a90cab2a43a818a45bbc40e4389fd66c (diff) |
soc/mediatek/mt8195: Get DRAM size from DRAM calibration result
Signed-off-by: Ryan Chuang <ryan.chuang@mediatek.corp-partner.google.com>
Change-Id: Ic34f29d1692b94284b2cf6c5d91d323df736c76f
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56204
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc/mediatek/mt8195')
-rw-r--r-- | src/soc/mediatek/mt8195/emi.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/soc/mediatek/mt8195/emi.c b/src/soc/mediatek/mt8195/emi.c index 120665a29b..6cbcae1bc5 100644 --- a/src/soc/mediatek/mt8195/emi.c +++ b/src/soc/mediatek/mt8195/emi.c @@ -1,8 +1,25 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#include <console/console.h> +#include <emi.h> #include <soc/emi.h> size_t sdram_size(void) { - return (size_t)4 * GiB; + int rank_num; + u64 rank_size[RANK_MAX]; + static size_t dram_size = 0; + + if (dram_size) + return dram_size; + + get_rank_size_by_emi(rank_size); + rank_num = get_rank_nr_by_emi(); + + for (int i = 0; i < rank_num; i++) + dram_size += rank_size[i]; + + printk(BIOS_INFO, "dram size = %#lx\n", dram_size); + + return dram_size; } |