changelog shortlog tags branches files raw gz bz2 help

Mercurial > hg > plan9front / changeset: bcm64: map framebuffer write-through to allow unaligned access

changeset 7217: 871931727b28
parent 7216: 249468ce1239
child 7218: 0e07d7fce9f3
author: cinap_lenrek@felloff.net
date: Thu, 09 May 2019 02:17:50 +0200
files: sys/src/9/bcm64/mem.h sys/src/9/bcm64/mmu.c
description: bcm64: map framebuffer write-through to allow unaligned access
     1.1--- a/sys/src/9/bcm64/mem.h
     1.2+++ b/sys/src/9/bcm64/mem.h
     1.3@@ -63,7 +63,7 @@
     1.4 #define MACHADDR(n)	(KTZERO-((n)+1)*MACHSIZE)
     1.5 
     1.6 #define	KTZERO		(KZERO+0x80000)		/* kernel text start */
     1.7-#define FRAMEBUFFER	0xFFFFFFFFC0000000ULL
     1.8+#define FRAMEBUFFER	(0xFFFFFFFFC0000000ULL | PTEWT)
     1.9 #define VIRTIO		0xFFFFFFFFE0000000ULL	/* i/o registers */
    1.10 #define	ARMLOCAL	(VIRTIO+IOSIZE)
    1.11 #define	VGPIO		0			/* virtual gpio for pi3 ACT LED */
    1.12@@ -125,7 +125,7 @@
    1.13 
    1.14 #define PTEWT		PTEMA(MA_MEM_WT)
    1.15 #define	PTEUNCACHED	PTEMA(MA_MEM_UC)
    1.16-#define	PTEDEVICE	PTEMA(MA_DEV_nGnRnE)
    1.17+#define	PTEDEVICE	PTEMA(MA_DEV_nGnRE)
    1.18 
    1.19 /*
    1.20  * Physical machine information from here on.
     2.1--- a/sys/src/9/bcm64/mmu.c
     2.2+++ b/sys/src/9/bcm64/mmu.c
     2.3@@ -124,18 +124,19 @@ kunmap(KMap*)
     2.4 uintptr
     2.5 mmukmap(uintptr va, uintptr pa, usize size)
     2.6 {
     2.7-	uintptr a, pe, off;
     2.8+	uintptr a, pe, off, attr;
     2.9 
    2.10 	if(va == 0)
    2.11 		return 0;
    2.12 
    2.13-	assert((va % PGLSZ(1)) == 0);
    2.14+	attr = va & PTEMA(7);
    2.15+	va &= -PGLSZ(1);
    2.16 	off = pa % PGLSZ(1);
    2.17 	a = va + off;
    2.18 	pe = (pa + size + (PGLSZ(1)-1)) & -PGLSZ(1);
    2.19 	while(pa < pe){
    2.20 		((uintptr*)L1)[PTL1X(va, 1)] = pa | PTEVALID | PTEBLOCK | PTEWRITE | PTEAF
    2.21-			| PTEKERNEL | PTESH(SHARE_OUTER) | PTEDEVICE;
    2.22+			| PTEKERNEL | PTESH(SHARE_OUTER) | attr;
    2.23 		pa += PGLSZ(1);
    2.24 		va += PGLSZ(1);
    2.25 	}