dm: fixup the alignment of software region address

Address of software SRAM configured by TCC tool shall be
 page-aligned. This patch fixup these addresses if they're
 not page aligned.

Tracked-On: #6778
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
This commit is contained in:
Yonghua Huang 2021-11-04 12:50:07 +03:00 committed by wenlingz
parent f8bb2064a4
commit d12474f34b
1 changed files with 9 additions and 0 deletions

View File

@ -9,6 +9,7 @@
#include <sys/cdefs.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/user.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
@ -203,6 +204,14 @@ static void remap_software_sram_regions(struct acpi_table_hdr *vrtct, int rtct_v
}
pr_info("%s, hpa_bottom:%lx, hpa_top:%lx.\n", __func__, hpa_bottom, hpa_top);
if (((hpa_bottom & ~PAGE_MASK) != 0) || ((hpa_top & ~PAGE_MASK) != 0)) {
pr_warn("%s, Warning: hpa_bottom:%lx OR hpa_top:%lx is not page-aligned!\n",
__func__, hpa_bottom, hpa_top);
hpa_bottom &= PAGE_MASK;
hpa_top &= PAGE_MASK;
}
software_sram_base_hpa = hpa_bottom;
software_sram_size = hpa_top - hpa_bottom;