diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2019-08-23 21:39:20 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2019-08-23 21:39:20 +0200 |
commit | bcf988aff1316d675b4353549197662e6f5d7b17 (patch) | |
tree | ff62d2bcbd16464d1cba5aee4a1f80ea5d3d828b /sys/src/9/bcm | |
parent | e6d22570a84ce1e158f184a8a90cfd53be48bbf4 (diff) |
bcm64: deal with discontinuous memory regions, avoid virtual memory aliasing, implement vmap() proper
on the 2GB and 4GB raspberry pi 4 variants, there are two
memory regions for ram:
[0x00000000..0x3e600000)
[0x40000000..0xfc000000)
the framebuffer is somewhere at the end of the first
GB of memory.
to handle these, we append the region base and limit
of the second region to *maxmem= like:
*maxmem=0x3e600000 0x40000000 0xfc000000
the mmu code has been changed to have non-existing
ram unmapped and mmukmap() now uses small 64K pages
instead of 512GB pages to avoid aliasing (framebuffer).
the VIRTPCI mapping has been removed as we now have
a proper vmap() implementation which assigns vritual
addresses automatically.
Diffstat (limited to 'sys/src/9/bcm')
-rw-r--r-- | sys/src/9/bcm/bootargs.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/sys/src/9/bcm/bootargs.c b/sys/src/9/bcm/bootargs.c index d2304af0f..efb0183b5 100644 --- a/sys/src/9/bcm/bootargs.c +++ b/sys/src/9/bcm/bootargs.c @@ -11,7 +11,7 @@ static char *confname[MAXCONF]; static char *confval[MAXCONF]; static int nconf; -static char maxmem[11]; +static char maxmem[256]; static int findconf(char *k) @@ -89,13 +89,25 @@ beget4(uchar *p) static void devtreeprop(char *path, char *key, void *val, int len) { - if(strcmp(path, "/memory") == 0 && strcmp(key, "reg") == 0 && len == 3*4){ - if(findconf("*maxmem") < 0){ + if(strcmp(path, "/memory") == 0 && strcmp(key, "reg") == 0){ + if(findconf("*maxmem") < 0 && len > 0 && (len % (3*4)) == 0){ uvlong top; + uchar *p = val; + char *s; - top = (uvlong)beget4((uchar*)val)<<32 | beget4((uchar*)val+4); - top += beget4((uchar*)val+8); - snprint(maxmem, sizeof(maxmem), "%#llux", top); + top = (uvlong)beget4(p)<<32 | beget4(p+4); + top += beget4(p+8); + s = seprint(maxmem, &maxmem[sizeof(maxmem)], "%#llux", top); + p += 3*4; + len -= 3*4; + while(len > 0){ + top = (uvlong)beget4(p)<<32 | beget4(p+4); + s = seprint(s, &maxmem[sizeof(maxmem)], " %#llux", top); + top += beget4(p+8); + s = seprint(s, &maxmem[sizeof(maxmem)], " %#llux", top); + p += 3*4; + len -= 3*4; + } addconf("*maxmem", maxmem); } return; |