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
This commit is contained in:
parent
bd23963c8f
commit
91994dc5d8
2 changed files with 14 additions and 7 deletions
|
@ -39,8 +39,10 @@
|
||||||
#define STACKALIGN(sp) ((sp) & ~7) /* bug: assure with alloc */
|
#define STACKALIGN(sp) ((sp) & ~7) /* bug: assure with alloc */
|
||||||
#define TRAPFRAMESIZE (38*8)
|
#define TRAPFRAMESIZE (38*8)
|
||||||
|
|
||||||
#define KSEG0 (0xFFFFFFFE00000000ULL)
|
#define KSEG0 (0xFFFFFFFC00000000ULL)
|
||||||
#define KMAP (0xFFFFFFFE00000000ULL)
|
|
||||||
|
#define KMAP (0xFFFFFFFC00000000ULL)
|
||||||
|
#define KMAPEND (0xFFFFFFFF00000000ULL)
|
||||||
|
|
||||||
#define FRAMEBUFFER (0xFFFFFFFFA0000000ULL|PTEWT)
|
#define FRAMEBUFFER (0xFFFFFFFFA0000000ULL|PTEWT)
|
||||||
|
|
||||||
|
|
|
@ -132,12 +132,13 @@ kaddr(uintptr pa)
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* KMAP maps all of ram (up to 4GB) */
|
|
||||||
static void*
|
static void*
|
||||||
kmapaddr(uintptr pa)
|
kmapaddr(uintptr pa)
|
||||||
{
|
{
|
||||||
if(pa < (uintptr)-KZERO)
|
if(pa < (uintptr)-KZERO)
|
||||||
return (void*)(pa + KZERO);
|
return (void*)(pa + KZERO);
|
||||||
|
if(pa >= KMAPEND-KMAP)
|
||||||
|
panic("kmapaddr: pa=%#p pc=%#p", pa, getcallerpc(&pa));
|
||||||
return (void*)(pa + KMAP);
|
return (void*)(pa + KMAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,12 +276,16 @@ meminit(void)
|
||||||
|
|
||||||
pa = PGROUND((uintptr)end)-KZERO;
|
pa = PGROUND((uintptr)end)-KZERO;
|
||||||
for(i=0; i<nelem(conf.mem); i++){
|
for(i=0; i<nelem(conf.mem); i++){
|
||||||
if(conf.mem[i].limit <= conf.mem[i].base
|
if(conf.mem[i].limit >= KMAPEND-KMAP)
|
||||||
|| conf.mem[i].base >= PHYSDRAM + soc.dramsize){
|
conf.mem[i].limit = KMAPEND-KMAP;
|
||||||
conf.mem[i].base = conf.mem[i].limit = 0;
|
|
||||||
|
if(conf.mem[i].limit <= conf.mem[i].base){
|
||||||
|
conf.mem[i].limit = conf.mem[i].base = 0;
|
||||||
continue;
|
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;
|
conf.mem[i].limit = PHYSDRAM + soc.dramsize;
|
||||||
|
|
||||||
/* take kernel out of allocatable space */
|
/* take kernel out of allocatable space */
|
||||||
|
|
Loading…
Reference in a new issue