bcm64: handle 8GB of physical memory for raspberry pi4

widen and move the KMAP window to a new address so we can
handle the 8GB of physical memory of the new raspberry pi4.

the new memory map on pi4 uses the following 4 banks:

0x000000000	0x03e600000
0x040000000	0x0fc000000 <- soc.dramsize (only < 4GB)
0x100000000	0x180000000
0x180000000 0x200000000
front
cinap_lenrek 2020-07-02 21:12:40 +02:00
parent bd23963c8f
commit 91994dc5d8
2 changed files with 14 additions and 7 deletions

View File

@ -39,8 +39,10 @@
#define STACKALIGN(sp) ((sp) & ~7) /* bug: assure with alloc */
#define TRAPFRAMESIZE (38*8)
#define KSEG0 (0xFFFFFFFE00000000ULL)
#define KMAP (0xFFFFFFFE00000000ULL)
#define KSEG0 (0xFFFFFFFC00000000ULL)
#define KMAP (0xFFFFFFFC00000000ULL)
#define KMAPEND (0xFFFFFFFF00000000ULL)
#define FRAMEBUFFER (0xFFFFFFFFA0000000ULL|PTEWT)

View File

@ -132,12 +132,13 @@ kaddr(uintptr pa)
return nil;
}
/* KMAP maps all of ram (up to 4GB) */
static void*
kmapaddr(uintptr pa)
{
if(pa < (uintptr)-KZERO)
return (void*)(pa + KZERO);
if(pa >= KMAPEND-KMAP)
panic("kmapaddr: pa=%#p pc=%#p", pa, getcallerpc(&pa));
return (void*)(pa + KMAP);
}
@ -275,12 +276,16 @@ meminit(void)
pa = PGROUND((uintptr)end)-KZERO;
for(i=0; i<nelem(conf.mem); i++){
if(conf.mem[i].limit <= conf.mem[i].base
|| conf.mem[i].base >= PHYSDRAM + soc.dramsize){
conf.mem[i].base = conf.mem[i].limit = 0;
if(conf.mem[i].limit >= KMAPEND-KMAP)
conf.mem[i].limit = KMAPEND-KMAP;
if(conf.mem[i].limit <= conf.mem[i].base){
conf.mem[i].limit = conf.mem[i].base = 0;
continue;
}
if(conf.mem[i].limit > PHYSDRAM + soc.dramsize)
if(conf.mem[i].base < PHYSDRAM + soc.dramsize
&& conf.mem[i].limit > PHYSDRAM + soc.dramsize)
conf.mem[i].limit = PHYSDRAM + soc.dramsize;
/* take kernel out of allocatable space */