Module Name: src
Committed By: matt
Date: Tue Sep 8 07:54:53 UTC 2009
Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: cpu.h cpuregs.h
mips3_pte.h
Log Message:
Add and optimize MIPS_PHYS_TO_XKPHYS_{UN,}CACHED(pa).
Treat like mips3_pg_cached: add mips3_xkphys_cached which contains the
starting address of the cached XKPHYS region. It also respects SPECIAL_CCA.
To generate a diff of this commit:
cvs rdiff -u -r1.90.16.1 -r1.90.16.2 src/sys/arch/mips/include/cpu.h
cvs rdiff -u -r1.74.28.7 -r1.74.28.8 src/sys/arch/mips/include/cpuregs.h
cvs rdiff -u -r1.23.38.1 -r1.23.38.2 src/sys/arch/mips/include/mips3_pte.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/mips/include/cpu.h
diff -u src/sys/arch/mips/include/cpu.h:1.90.16.1 src/sys/arch/mips/include/cpu.h:1.90.16.2
--- src/sys/arch/mips/include/cpu.h:1.90.16.1 Fri Aug 21 17:17:37 2009
+++ src/sys/arch/mips/include/cpu.h Tue Sep 8 07:54:52 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.90.16.1 2009/08/21 17:17:37 matt Exp $ */
+/* $NetBSD: cpu.h,v 1.90.16.2 2009/09/08 07:54:52 matt Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -157,6 +157,9 @@
extern int mips_has_r4k_mmu;
extern int mips_has_llsc;
extern int mips3_pg_cached;
+#ifdef _LP64
+extern uint64_t mips3_xkphys_cached;
+#endif
extern u_int mips3_pg_shift;
#define CPU_MIPS_R4K_MMU 0x0001
Index: src/sys/arch/mips/include/cpuregs.h
diff -u src/sys/arch/mips/include/cpuregs.h:1.74.28.7 src/sys/arch/mips/include/cpuregs.h:1.74.28.8
--- src/sys/arch/mips/include/cpuregs.h:1.74.28.7 Mon Sep 7 21:34:47 2009
+++ src/sys/arch/mips/include/cpuregs.h Tue Sep 8 07:54:53 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: cpuregs.h,v 1.74.28.7 2009/09/07 21:34:47 matt Exp $ */
+/* $NetBSD: cpuregs.h,v 1.74.28.8 2009/09/08 07:54:53 matt Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -116,10 +116,14 @@
#define MIPS_XKSEG_P(x) (((uint64_t)(x) >> 62) == 3)
#define MIPS_XKPHYS_START (0x2ULL << 62)
+#define MIPS_PHYS_TO_XKPHYS_UNCACHED(x) \
+ (MIPS_XKPHYS_START | ((uint64_t)(CCA_UNCACHED) << 59) | (x))
+#define MIPS_PHYS_TO_XKPHYS_CACHED(x) \
+ (mips3_xkphys_cached | (x))
#define MIPS_PHYS_TO_XKPHYS(cca,x) \
(MIPS_XKPHYS_START | ((uint64_t)(cca) << 59) | (x))
-#define MIPS_XKPHYS_TO_PHYS(x) ((uintptr_t)(x) & 0x0effffffffffffffLL)
-#define MIPS_XKPHYS_TO_CCA(x) (((uintptr_t)(x) >> 59) & 7)
+#define MIPS_XKPHYS_TO_PHYS(x) ((uint64_t)(x) & 0x07ffffffffffffffLL)
+#define MIPS_XKPHYS_TO_CCA(x) (((uint64_t)(x) >> 59) & 7)
#define MIPS_XKPHYS_P(x) (((uint64_t)(x) >> 62) == 2)
#define CCA_UNCACHED 2
Index: src/sys/arch/mips/include/mips3_pte.h
diff -u src/sys/arch/mips/include/mips3_pte.h:1.23.38.1 src/sys/arch/mips/include/mips3_pte.h:1.23.38.2
--- src/sys/arch/mips/include/mips3_pte.h:1.23.38.1 Thu Aug 20 07:44:50 2009
+++ src/sys/arch/mips/include/mips3_pte.h Tue Sep 8 07:54:53 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: mips3_pte.h,v 1.23.38.1 2009/08/20 07:44:50 matt Exp $ */
+/* $NetBSD: mips3_pte.h,v 1.23.38.2 2009/09/08 07:54:53 matt Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -128,10 +128,13 @@
#define MIPS3_CCA_TO_PG(cca) ((cca) << 3)
#define MIPS3_PG_TO_CCA(cca) (((cca) >> 3) & 7)
+#define MIPS3_XPHYS_UNCACHED MIPS_PHYS_TO_XKPHYS(2, 0)
#define MIPS3_PG_UNCACHED MIPS3_CCA_TO_PG(2)
#ifdef HPCMIPS_L1CACHE_DISABLE /* MIPS3_L1CACHE_DISABLE */
+#define MIPS3_DEFAULT_XKPHYS_CACHED MIPS3_DEFAULT_XKPHYS_UNCACHED
#define MIPS3_PG_CACHED MIPS3_PG_UNCACHED /* XXX: brain damaged!!! */
#else /* HPCMIPS_L1CACHE_DISABLE */
+#define MIPS3_DEFAULT_XKPHYS_CACHED MIPS_PHYS_TO_XKPHYS(3, 0)
#define MIPS3_PG_CACHED mips3_pg_cached
#define MIPS3_DEFAULT_PG_CACHED MIPS3_CCA_TO_PG(3)
#endif /* ! HPCMIPS_L1CACHE_DISABLE */