fix(nxp/common/setup): fix total dram size checking

total_dram_size should be signed value because it is equal to return
value of init_ddr(), so if it is lower or equal zero, report
error as DDR is not initialized correctly.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: Idbc40da103f60f10cb18c5306e97b764c1a9d372
This commit is contained in:
Jiafei Pan 2021-10-21 15:17:51 +08:00
parent 3ccc8ac3e5
commit 0259a3e828
2 changed files with 5 additions and 3 deletions

View File

@ -113,7 +113,7 @@ typedef struct {
typedef struct {
uint64_t num_dram_regions;
uint64_t total_dram_size;
int64_t total_dram_size;
region_info_t region[NUM_DRAM_REGIONS];
} dram_regions_info_t;

View File

@ -279,10 +279,12 @@ void bl2_plat_preload_setup(void)
soc_preload_setup();
if (dram_regions_info.total_dram_size < NXP_DRAM0_SIZE) {
NOTICE("ERROR: DRAM0 Size is not correctly configured.");
#ifdef DDR_INIT
if (dram_regions_info.total_dram_size <= 0) {
ERROR("Asserting as the DDR is not initialized yet.");
assert(false);
}
#endif
if ((dram_regions_info.region[0].addr == 0)
&& (dram_regions_info.total_dram_size > 0)) {