shithub: riscv

Download patch

ref: 759656ad4cc778b6cff47296b718cd388e762adc
parent: 77048feb25e6d3334a5c3e0942f65c17da426548
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Wed Apr 22 15:57:25 EDT 2020

bcm, bcm64: dancing to the drum of the linux clowns for device tree memory size detection (thanks kenji)

looks like linux changed the device tree names for
the memory node:

https://github.com/raspberrypi/linux/commit/4b17654f51fd87c42cda3217b0863e6aa1df49b9#diff-ac03c9402b807c11d42edc9e8d03dfc7

this fixes the memory size detection with latest firmware
on raspberry pi4-b (4GB) for kenji.

--- a/sys/src/9/bcm/bootargs.c
+++ b/sys/src/9/bcm/bootargs.c
@@ -89,7 +89,8 @@
 static void
 devtreeprop(char *path, char *key, void *val, int len)
 {
-	if(strcmp(path, "/memory") == 0 && strcmp(key, "reg") == 0){
+	if((strcmp(path, "/memory") == 0 || strcmp(path, "/memory@0") == 0)
+	&& strcmp(key, "reg") == 0){
 		if(findconf("*maxmem") < 0 && len > 0 && (len % (3*4)) == 0){
 			uvlong top;
 			uchar *p = val;