changelog shortlog tags branches changeset file revisions annotate raw help

Mercurial > hg > plan9front / sys/src/9/bcm64/mem.h

revision 7317: 406bef7018a8
parent 7244: 2e8af1bf191d
child 7327: 94c91dfe14a6
     1.1--- a/sys/src/9/bcm64/mem.h
     1.2+++ b/sys/src/9/bcm64/mem.h
     1.3@@ -5,11 +5,6 @@
     1.4 #define MiB		1048576u		/* Mebi 0x0000000000100000 */
     1.5 #define GiB		1073741824u		/* Gibi 000000000040000000 */
     1.6 
     1.7-#define	HOWMANY(x,y)	(((x)+((y)-1))/(y))
     1.8-#define	ROUNDUP(x,y)	(HOWMANY((x),(y))*(y))
     1.9-#define	PGROUND(s)	ROUNDUP(s, BY2PG)
    1.10-#define	ROUND(s, sz)	(((s)+(sz-1))&~(sz-1))
    1.11-
    1.12 /*
    1.13  * Sizes:
    1.14  * 	L0	L1	L2	L3
    1.15@@ -19,19 +14,21 @@
    1.16  */
    1.17 #define	PGSHIFT		16		/* log(BY2PG) */
    1.18 #define	BY2PG		(1ULL<<PGSHIFT)	/* bytes per page */
    1.19+#define	ROUND(s, sz)	(((s)+(sz-1))&~(sz-1))
    1.20+#define	PGROUND(s)	ROUND(s, BY2PG)
    1.21 
    1.22 /* effective virtual address space */
    1.23-#define EVASHIFT	33
    1.24+#define EVASHIFT	34
    1.25 #define EVAMASK		((1ULL<<EVASHIFT)-1)
    1.26 
    1.27 #define PTSHIFT		(PGSHIFT-3)
    1.28-#define PTLEVELS	HOWMANY(EVASHIFT-PGSHIFT, PTSHIFT)
    1.29+#define PTLEVELS	(((EVASHIFT-PGSHIFT)+PTSHIFT-1)/PTSHIFT)	
    1.30 #define PTLX(v, l)	((((v) & EVAMASK) >> (PGSHIFT + (l)*PTSHIFT)) & ((1 << PTSHIFT)-1))
    1.31 #define PGLSZ(l)	(1ULL << (PGSHIFT + (l)*PTSHIFT))
    1.32 
    1.33 #define PTL1X(v, l)	(L1TABLEX(v, l) | PTLX(v, l))
    1.34 #define L1TABLEX(v, l)	(L1TABLE(v, l) << PTSHIFT)
    1.35-#define L1TABLES	HOWMANY(-KSEG0, PGLSZ(2))
    1.36+#define L1TABLES	((-KSEG0+PGLSZ(2)-1)/PGLSZ(2))
    1.37 #define L1TABLE(v, l)	(L1TABLES - ((PTLX(v, 2) % L1TABLES) >> (((l)-1)*PTSHIFT)) + (l)-1)
    1.38 #define L1TOPSIZE	(1ULL << (EVASHIFT - PTLEVELS*PTSHIFT))
    1.39 
    1.40@@ -43,12 +40,18 @@
    1.41 #define TRAPFRAMESIZE	(38*8)
    1.42 
    1.43 #define KSEG0		(0xFFFFFFFF00000000ULL)
    1.44-#define VIRTIO		(0xFFFFFFFF3F000000ULL)	/* i/o registers */
    1.45-#define	ARMLOCAL	(0xFFFFFFFF40000000ULL)
    1.46-#define	KZERO		(0xFFFFFFFF80000000ULL)	/* kernel address space */
    1.47-#define FRAMEBUFFER	(0xFFFFFFFFC0000000ULL|PTEWT)
    1.48+#define FRAMEBUFFER	(0xFFFFFFFF00000000ULL|PTEWT)
    1.49 #define	VGPIO		0			/* virtual gpio for pi3 ACT LED */
    1.50 
    1.51+#define VIRTPCI		(0xFFFFFFFF80000000ULL) /* virtual pcie mmio */
    1.52+
    1.53+#define VIRTIO2		(0xFFFFFFFFBC000000ULL)	/* 0x7C000000	-		0xFC000000 */
    1.54+#define VIRTIO1		(0xFFFFFFFFBD000000ULL)	/* 0x7D000000	-		0xFD000000 */
    1.55+#define VIRTIO		(0xFFFFFFFFBE000000ULL) /* 0x7E000000	0x3F000000	0xFE000000 */
    1.56+#define	ARMLOCAL	(0xFFFFFFFFBF800000ULL)	/* -		0x40000000	0xFF800000 */
    1.57+
    1.58+#define	KZERO		(0xFFFFFFFFC0000000ULL)	/* kernel address space */
    1.59+
    1.60 #define SPINTABLE	(KZERO+0xd8)
    1.61 #define CONFADDR	(KZERO+0x100)
    1.62 #define	REBOOTADDR	(0x1c00)		/* reboot code - physical address */
    1.63@@ -127,7 +130,6 @@
    1.64  *	BUS  addresses as seen from the videocore gpu.
    1.65  */
    1.66 #define	PHYSDRAM	0
    1.67-#define	IOSIZE		(16*MiB)
    1.68 
    1.69 #define MIN(a, b)	((a) < (b)? (a): (b))
    1.70 #define MAX(a, b)	((a) > (b)? (a): (b))