summaryrefslogtreecommitdiffstats
path: root/sys/mips/include/param.h
diff options
context:
space:
mode:
authorjchandra <jchandra@FreeBSD.org>2011-01-13 15:17:29 +0000
committerjchandra <jchandra@FreeBSD.org>2011-01-13 15:17:29 +0000
commit564c9a855eee850b6f252549bbb5ec6af6ba778a (patch)
tree088c80e0e190da6dd7f15ceb0535eecfaf39addf /sys/mips/include/param.h
parent267bbb010596a8758a3d64f44dc570be2e5ed5aa (diff)
downloadFreeBSD-src-564c9a855eee850b6f252549bbb5ec6af6ba778a.zip
FreeBSD-src-564c9a855eee850b6f252549bbb5ec6af6ba778a.tar.gz
Support for 64 bit PTEs on n32 and n64 compilation.
In n32 and n64, add support for physical address above 4GB by having 64 bit page table entries and physical addresses. Major changes are: - param.h: update PTE sizes, masks and shift values to support 64 bit PTEs. - param.h: remove DELAY(), mips_btop(same as atop), mips_ptob (same as ptoa), and reformat. - param.h: remove casting to unsigned long in trunc_page and round_page since this will be used on physical addresses. - _types.h: have 64 bit __vm_paddr_t for n32. - pte.h: update TLB LO0/1 access macros to support 64 bit PTE - pte.h: assembly macros for PTE operations. - proc.h: md_upte is now 64 bit for n32 and n64. - exception.S and swtch.S: use the new PTE macros for PTE operations. - cpufunc.h: TLB_LO0/1 registers are 64bit for n32 and n64. - xlr_machdep.c: Add memory segments above 4GB to phys_avail[] as they are supported now. Reviewed by: jmallett (earlier version)
Diffstat (limited to 'sys/mips/include/param.h')
-rw-r--r--sys/mips/include/param.h73
1 files changed, 37 insertions, 36 deletions
diff --git a/sys/mips/include/param.h b/sys/mips/include/param.h
index d3bed63..0b1ea98 100644
--- a/sys/mips/include/param.h
+++ b/sys/mips/include/param.h
@@ -116,31 +116,39 @@
#define CACHE_LINE_SHIFT 6
#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT)
-#define PAGE_SHIFT 12 /* LOG2(PAGE_SIZE) */
-#define PAGE_SIZE (1<<PAGE_SHIFT) /* bytes/page */
-#define PAGE_MASK (PAGE_SIZE-1)
-
-#define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t)))
-#define NPDEPG (PAGE_SIZE/(sizeof (pd_entry_t)))
-
-#if defined(__mips_n64)
-#define SEGSHIFT 31 /* LOG2(NBSEG) */
-#define NBSEG (1ul << SEGSHIFT) /* bytes/segment */
-#define PDRSHIFT 22 /* second level */
-#define PDRMASK ((1 << PDRSHIFT) - 1)
+#define PAGE_SHIFT 12 /* LOG2(PAGE_SIZE) */
+#define PAGE_SIZE (1<<PAGE_SHIFT) /* bytes/page */
+#define PAGE_MASK (PAGE_SIZE-1)
+
+#define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t)))
+#define NPDEPG (PAGE_SIZE/(sizeof (pd_entry_t)))
+
+#if defined(__mips_n32) || defined(__mips_n64) /* PHYSADDR_64_BIT */
+#define NPTEPGSHIFT 9 /* LOG2(NPTEPG) */
+#else
+#define NPTEPGSHIFT 10 /* LOG2(NPTEPG) */
+#endif
+
+#ifdef __mips_n64
+#define NPDEPGSHIFT 9 /* LOG2(NPTEPG) */
+#define SEGSHIFT (PAGE_SHIFT + NPTEPGSHIFT + NPDEPGSHIFT)
+#define NBSEG (1ul << SEGSHIFT)
+#define PDRSHIFT (PAGE_SHIFT + NPTEPGSHIFT)
+#define PDRMASK ((1 << PDRSHIFT) - 1)
#else
-#define SEGSHIFT 22 /* LOG2(NBSEG) */
-#define NBSEG (1 << SEGSHIFT) /* bytes/segment */
-#define PDRSHIFT SEGSHIFT /* alias for SEG in 32 bit */
-#define PDRMASK ((1 << PDRSHIFT) - 1)
+#define NPDEPGSHIFT 10 /* LOG2(NPTEPG) */
+#define SEGSHIFT (PAGE_SHIFT + NPTEPGSHIFT)
+#define NBSEG (1 << SEGSHIFT) /* bytes/segment */
+#define PDRSHIFT SEGSHIFT /* alias for SEG in 32 bit */
+#define PDRMASK ((1 << PDRSHIFT) - 1)
#endif
-#define NBPDR (1 << PDRSHIFT) /* bytes/pagedir */
-#define SEGMASK (NBSEG-1) /* byte offset into segment */
+#define NBPDR (1 << PDRSHIFT) /* bytes/pagedir */
+#define SEGMASK (NBSEG - 1) /* byte offset into segment */
-#define MAXPAGESIZES 1 /* maximum number of supported page sizes */
+#define MAXPAGESIZES 1 /* max supported pagesizes */
-#define BLKDEV_IOSIZE 2048 /* xxx: Why is this 1/2 page? */
-#define MAXDUMPPGS 1 /* xxx: why is this only one? */
+#define BLKDEV_IOSIZE 2048 /* xxx: Why is this 1/2 page? */
+#define MAXDUMPPGS 1 /* xxx: why is this only one? */
/*
* The kernel stack needs to be aligned on a (PAGE_SIZE * 2) boundary.
@@ -151,8 +159,8 @@
#define UPAGES 2
/* pages ("clicks") (4096 bytes) to disk blocks */
-#define ctod(x) ((x) << (PAGE_SHIFT - DEV_BSHIFT))
-#define dtoc(x) ((x) >> (PAGE_SHIFT - DEV_BSHIFT))
+#define ctod(x) ((x) << (PAGE_SHIFT - DEV_BSHIFT))
+#define dtoc(x) ((x) >> (PAGE_SHIFT - DEV_BSHIFT))
/*
* Map a ``block device block'' to a file system block.
@@ -160,24 +168,17 @@
* field from the disk label.
* For now though just use DEV_BSIZE.
*/
-#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
+#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
/*
* Mach derived conversion macros
*/
-#define round_page(x) (((unsigned long)(x) + PAGE_MASK) & ~PAGE_MASK)
-#define trunc_page(x) ((unsigned long)(x) & ~PAGE_MASK)
-
-#define atop(x) ((unsigned long)(x) >> PAGE_SHIFT)
-#define ptoa(x) ((unsigned long)(x) << PAGE_SHIFT)
-
-#define mips_btop(x) ((unsigned long)(x) >> PAGE_SHIFT)
-#define mips_ptob(x) ((unsigned long)(x) << PAGE_SHIFT)
+#define round_page(x) (((x) + PAGE_MASK) & ~PAGE_MASK)
+#define trunc_page(x) ((x) & ~PAGE_MASK)
-#define pgtok(x) ((unsigned long)(x) * (PAGE_SIZE / 1024))
+#define atop(x) ((x) >> PAGE_SHIFT)
+#define ptoa(x) ((x) << PAGE_SHIFT)
-#ifndef _KERNEL
-#define DELAY(n) { register int N = (n); while (--N > 0); }
-#endif /* !_KERNEL */
+#define pgtok(x) ((x) * (PAGE_SIZE / 1024))
#endif /* !_MIPS_INCLUDE_PARAM_H_ */
OpenPOWER on IntegriCloud