shithub: riscv

Download patch

ref: 753fa51b77869eadcc27c00df34f09c3c9239fe2
parent: 6a3a3d69c67647db5d5176a7cf9ee68e9fce4352
author: cinap_lenrek <[email protected]>
date: Thu Apr 11 09:49:41 EDT 2019

bcm: dont assume PHYSDRAM 0 in dmaaddr(), fix dmaioaddr()

--- a/sys/src/9/bcm/dma.c
+++ b/sys/src/9/bcm/dma.c
@@ -100,13 +100,13 @@
 uintptr
 dmaaddr(void *va)
 {
-	return soc.busdram | (PTR2UINT(va) & ~KSEGM);
+	return soc.busdram | (PADDR(va) - PHYSDRAM);
 }
 
 static uintptr
 dmaioaddr(void *va)
 {
-	return soc.busio | (PTR2UINT(va) & ~VIRTIO);
+	return soc.busio | ((uintptr)va - VIRTIO);
 }
 
 static void