Attention is currently required from: Hung-Te Lin, Ryan Chuang. Hello Ryan Chuang,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/56204
to review the following change.
Change subject: soc/mediatek/mt8195: Get DRAM size from DRAM calibration result ......................................................................
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 --- M src/soc/mediatek/mt8195/emi.c 1 file changed, 15 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/04/56204/1
diff --git a/src/soc/mediatek/mt8195/emi.c b/src/soc/mediatek/mt8195/emi.c index 120665a..7833707 100644 --- a/src/soc/mediatek/mt8195/emi.c +++ b/src/soc/mediatek/mt8195/emi.c @@ -1,8 +1,22 @@ /* 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; + size_t dram_size = 0; + u64 rank_size[RANK_MAX]; + + 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; }