From: Gabriel L. Somlo Date: Mon, 8 Jul 2019 13:43:40 +0000 (-0400) Subject: soc_core: additional csr_alignment follow-up fixes X-Git-Tag: 24jan2021_ls180~1117^2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e42f33ede1025438a175321d4e8cb9a372397070;p=litex.git soc_core: additional csr_alignment follow-up fixes - Update a few additional places to use DFII_ADDR_SHIFT instead of a hard-coded 4, which assumed 32-bit alignment. - Force 64-bit alignment Rocket -- the only supported configuration! This is a fixup for commit f4770219, tested on Rocket and 64bit Linux. Signed-off-by: Gabriel Somlo --- diff --git a/litex/soc/integration/soc_core.py b/litex/soc/integration/soc_core.py index 00de250f..6f5b3cf7 100644 --- a/litex/soc/integration/soc_core.py +++ b/litex/soc/integration/soc_core.py @@ -186,11 +186,14 @@ class SoCCore(Module): # Parameters managment --------------------------------------------------------------------- - # FIXME: RocketChip reserves the first 256Mbytes for internal use, change default mem_map + # NOTE: RocketChip reserves the first 256Mbytes for internal use, + # so we must change default mem_map; + # Also, CSRs *must* be 64-bit aligned. if cpu_type == "rocket": self.soc_mem_map["rom"] = 0x10000000 self.soc_mem_map["sram"] = 0x11000000 self.soc_mem_map["csr"] = 0x12000000 + csr_alignment = 64 if cpu_type == "None": cpu_type = None diff --git a/litex/soc/software/bios/sdram.c b/litex/soc/software/bios/sdram.c index 5cb4929d..0af3e4fc 100644 --- a/litex/soc/software/bios/sdram.c +++ b/litex/soc/software/bios/sdram.c @@ -536,7 +536,7 @@ static void read_level(int module) /* Write test pattern */ for(p=0;p #include +#define DFII_ADDR_SHIFT CONFIG_CSR_ALIGNMENT/8 void get_ident(char *ident) { #ifdef CSR_IDENTIFIER_MEM_BASE int i; for(i=0;i<256;i++) - ident[i] = MMPTR(CSR_IDENTIFIER_MEM_BASE + 4*i); + ident[i] = MMPTR(CSR_IDENTIFIER_MEM_BASE + DFII_ADDR_SHIFT*i); #else ident[0] = 0; #endif