Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch make paddr_t 64bit on arc port by introducing _MIPS...



details:   https://anonhg.NetBSD.org/src/rev/7759fbc3629f
branches:  trunk
changeset: 487535:7759fbc3629f
user:      soda <soda%NetBSD.org@localhost>
date:      Fri Jun 09 04:36:43 2000 +0000

description:
make paddr_t 64bit on arc port by introducing _MIPS_PADDR_T_64BIT.

diffstat:

 sys/arch/arc/include/types.h       |   4 +++-
 sys/arch/mips/include/mips1_pte.h  |   4 ++--
 sys/arch/mips/include/mips3_pte.h  |   9 ++++-----
 sys/arch/mips/include/mips_param.h |   6 +++---
 sys/arch/mips/include/pte.h        |  32 ++++++++++++++++----------------
 sys/arch/mips/include/types.h      |   7 ++++++-
 sys/arch/mips/mips/pmap.c          |  28 +++++++++++++++++++---------
 sys/arch/mips/mips/trap.c          |  14 ++++++++------
 8 files changed, 61 insertions(+), 43 deletions(-)

diffs (truncated from 325 to 300 lines):

diff -r d71f0df9f335 -r 7759fbc3629f sys/arch/arc/include/types.h
--- a/sys/arch/arc/include/types.h      Fri Jun 09 04:28:17 2000 +0000
+++ b/sys/arch/arc/include/types.h      Fri Jun 09 04:36:43 2000 +0000
@@ -1,7 +1,9 @@
-/*     $NetBSD: types.h,v 1.7 2000/02/05 00:13:23 cgd Exp $    */
+/*     $NetBSD: types.h,v 1.8 2000/06/09 04:36:43 soda Exp $   */
 /*     $OpenBSD: types.h,v 1.2 1997/04/19 17:19:59 pefo Exp $  */
 /*     NetBSD: types.h,v 1.10 1995/07/06 03:39:43 cgd Exp      */
 
+#define _MIPS_PADDR_T_64BIT
+
 #include <mips/types.h>
 
 #define __BROKEN_CONFIG_UNIT_USAGE
diff -r d71f0df9f335 -r 7759fbc3629f sys/arch/mips/include/mips1_pte.h
--- a/sys/arch/mips/include/mips1_pte.h Fri Jun 09 04:28:17 2000 +0000
+++ b/sys/arch/mips/include/mips1_pte.h Fri Jun 09 04:36:43 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mips1_pte.h,v 1.11 1999/05/27 01:56:32 nisimura Exp $  */
+/*     $NetBSD: mips1_pte.h,v 1.12 2000/06/09 04:37:51 soda Exp $      */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -95,4 +95,4 @@
 #define        mips1_vad_to_pfn(x)     (x)
 
 #define        MIPS1_PTE_TO_PADDR(pte) ((unsigned)(pte) & MIPS1_PG_FRAME)
-#define MIPS1_PAGE_IS_RDONLY(pte,va) ((pte) & MIPS1_PG_RO)
+#define MIPS1_PAGE_IS_RDONLY(pte,va) ((int)(pte) & MIPS1_PG_RO)
diff -r d71f0df9f335 -r 7759fbc3629f sys/arch/mips/include/mips3_pte.h
--- a/sys/arch/mips/include/mips3_pte.h Fri Jun 09 04:28:17 2000 +0000
+++ b/sys/arch/mips/include/mips3_pte.h Fri Jun 09 04:36:43 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mips3_pte.h,v 1.11 2000/03/27 02:55:13 nisimura Exp $  */
+/*     $NetBSD: mips3_pte.h,v 1.12 2000/06/09 04:37:51 soda Exp $      */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -117,10 +117,9 @@
 /* pte accessor macros */
 
 #define mips3_pfn_is_ext(x) ((x) & 0x3c000000)
-#define mips3_vad_to_pfn(x) (((unsigned)(x) >> MIPS3_PG_SHIFT) & MIPS3_PG_FRAME)
-#define mips3_vad_to_pfn64(x) (((quad_t)(x) >> MIPS3_PG_SHIFT) & MIPS3_PG_FRAME)
-#define mips3_pfn_to_vad(x) (((x) & MIPS3_PG_FRAME) << MIPS3_PG_SHIFT)
-#define mips3_vad_to_vpn(x) ((unsigned)(x) & MIPS3_PG_SVPN)
+#define mips3_vad_to_pfn(x) (((paddr_t)(x) >> MIPS3_PG_SHIFT) & MIPS3_PG_FRAME)
+#define mips3_pfn_to_vad(x) ((paddr_t)((x) & MIPS3_PG_FRAME) << MIPS3_PG_SHIFT)
+#define mips3_vad_to_vpn(x) ((vaddr_t)(x) & MIPS3_PG_SVPN)
 #define mips3_vpn_to_vad(x) ((x) & MIPS3_PG_SVPN)
 
 #define MIPS3_PTE_TO_PADDR(pte) (mips3_pfn_to_vad(pte))
diff -r d71f0df9f335 -r 7759fbc3629f sys/arch/mips/include/mips_param.h
--- a/sys/arch/mips/include/mips_param.h        Fri Jun 09 04:28:17 2000 +0000
+++ b/sys/arch/mips/include/mips_param.h        Fri Jun 09 04:36:43 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mips_param.h,v 1.19 2000/03/27 02:55:14 nisimura Exp $ */
+/*     $NetBSD: mips_param.h,v 1.20 2000/06/09 04:37:51 soda Exp $     */
 
 #ifdef _KERNEL
 #include <machine/cpu.h>
@@ -75,5 +75,5 @@
  */
 #define mips_round_page(x)     ((((unsigned)(x)) + NBPG - 1) & ~(NBPG-1))
 #define mips_trunc_page(x)     ((unsigned)(x) & ~(NBPG-1))
-#define mips_btop(x)           ((unsigned)(x) >> PGSHIFT)
-#define mips_ptob(x)           ((unsigned)(x) << PGSHIFT)
+#define mips_btop(x)           ((paddr_t)(x) >> PGSHIFT)
+#define mips_ptob(x)           ((paddr_t)(x) << PGSHIFT)
diff -r d71f0df9f335 -r 7759fbc3629f sys/arch/mips/include/pte.h
--- a/sys/arch/mips/include/pte.h       Fri Jun 09 04:28:17 2000 +0000
+++ b/sys/arch/mips/include/pte.h       Fri Jun 09 04:36:43 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pte.h,v 1.8 1999/05/28 07:23:38 nisimura Exp $ */
+/*     $NetBSD: pte.h,v 1.9 2000/06/09 04:37:51 soda Exp $     */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -140,11 +140,11 @@
     mips_pg_ropage_bit(void),
     mips_pg_cwpage_bit(void),
     mips_pg_rwpage_bit(void),
-    mips_pg_global_bit(void),
-    PTE_TO_PADDR(unsigned int entry);
+    mips_pg_global_bit(void);
+static __inline paddr_t PTE_TO_PADDR(unsigned int pte);
 
-static __inline vaddr_t pfn_to_vad(unsigned int x);
-static __inline int vad_to_pfn(vaddr_t x);
+static __inline paddr_t pfn_to_vad(unsigned int pfn);
+static __inline unsigned int vad_to_pfn(paddr_t pa);
 
 
 static __inline int
@@ -230,7 +230,7 @@
        return (MIPS1_PG_WIRED);
 }
 
-static __inline unsigned int
+static __inline paddr_t
 PTE_TO_PADDR(pte)
        unsigned int pte;
 {
@@ -249,22 +249,22 @@
        return (MIPS1_PAGE_IS_RDONLY(pte, va));
 }
 
-static __inline vaddr_t
-pfn_to_vad(x)
-       unsigned int x;
+static __inline paddr_t
+pfn_to_vad(pfn)
+       unsigned int pfn;
 {
        if (CPUISMIPS3)
-               return (mips3_pfn_to_vad(x));
-       return (mips1_pfn_to_vad(x));
+               return (mips3_pfn_to_vad(pfn));
+       return (mips1_pfn_to_vad(pfn));
 }
 
-static __inline int
-vad_to_pfn(x)
-       vaddr_t x;
+static __inline unsigned int
+vad_to_pfn(pa)
+       paddr_t pa;
 {
        if (CPUISMIPS3)
-               return (mips3_vad_to_pfn(x));
-       return (mips1_vad_to_pfn(x));
+               return (mips3_vad_to_pfn(pa));
+       return (mips1_vad_to_pfn(pa));
 }
 #endif
 
diff -r d71f0df9f335 -r 7759fbc3629f sys/arch/mips/include/types.h
--- a/sys/arch/mips/include/types.h     Fri Jun 09 04:28:17 2000 +0000
+++ b/sys/arch/mips/include/types.h     Fri Jun 09 04:36:43 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: types.h,v 1.23 2000/06/06 02:24:02 soren Exp $ */
+/*     $NetBSD: types.h,v 1.24 2000/06/09 04:37:51 soda Exp $  */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -72,8 +72,13 @@
 
 /* NB: This should probably be if defined(_KERNEL) */
 #if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)
+#ifdef _MIPS_PADDR_T_64BIT
+typedef unsigned long long     paddr_t;
+typedef unsigned long long     psize_t;
+#else
 typedef unsigned long  paddr_t;
 typedef unsigned long  psize_t;
+#endif
 typedef unsigned long  vaddr_t;
 typedef unsigned long  vsize_t;
 #endif
diff -r d71f0df9f335 -r 7759fbc3629f sys/arch/mips/mips/pmap.c
--- a/sys/arch/mips/mips/pmap.c Fri Jun 09 04:28:17 2000 +0000
+++ b/sys/arch/mips/mips/pmap.c Fri Jun 09 04:36:43 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.97 2000/05/09 13:40:13 shin Exp $   */
+/*     $NetBSD: pmap.c,v 1.98 2000/06/09 04:37:52 soda Exp $   */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.97 2000/05/09 13:40:13 shin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.98 2000/06/09 04:37:52 soda Exp $");
 
 /*
  *     Manages physical address maps.
@@ -704,7 +704,7 @@
 
                /* remove entries from kernel pmap */
 #ifdef PARANOIADIAG
-               if (sva < VM_MIN_KERNEL_ADDRESS || eva > virtual_end)
+               if (sva < VM_MIN_KERNEL_ADDRESS || eva >= virtual_end)
                        panic("pmap_remove: kva not in range");
 #endif
                pte = kvtopte(sva);
@@ -893,7 +893,7 @@
                 * read-only.
                 */
 #ifdef PARANOIADIAG
-               if (sva < VM_MIN_KERNEL_ADDRESS || eva > virtual_end)
+               if (sva < VM_MIN_KERNEL_ADDRESS || eva >= virtual_end)
                        panic("pmap_protect: kva not in range");
 #endif
                pte = kvtopte(sva);
@@ -976,13 +976,16 @@
        pmap = p->p_vmspace->vm_map.pmap;
 
        if (CPUISMIPS3) {
+#ifdef MIPS3
 #if 0
                printf("pmap_procwr: va %lx len %lx\n", va, len);
 #endif
                MachFlushDCache(va, len);
                MachFlushICache(MIPS_PHYS_TO_KSEG0(va &
                    (mips_L1ICacheSize - 1)), len);
+#endif /* MIPS3 */
        } else {
+#ifdef MIPS1
                pt_entry_t *pte;
                unsigned entry;
 
@@ -996,7 +999,7 @@
                if (!mips_pg_v(entry))
                        return;
 #if 0
-printf(" flush %lx", pfn_to_vad(entry) + (va & PGOFSET));
+printf(" flush %llx", (long long)pfn_to_vad(entry) + (va & PGOFSET));
 #endif
                mips1_FlushICache(MIPS_PHYS_TO_KSEG0(mips1_pfn_to_vad(entry)
                    + (va & PGOFSET)),
@@ -1004,6 +1007,7 @@
 #if 0
 printf("\n");
 #endif
+#endif /* MIPS1 */
        }
 }
 
@@ -1118,21 +1122,27 @@
 #ifdef PARANOIADIAG
        if (!pmap)
                panic("pmap_enter: pmap");
+#endif
+#if defined(DEBUG) || defined(DIAGNOSTIC) || defined(PARANOIADIAG)
        if (pmap == pmap_kernel()) {
 #ifdef DEBUG
                enter_stats.kernel++;
 #endif
                if (va < VM_MIN_KERNEL_ADDRESS || va >= virtual_end)
-                       panic("pmap_enter: kva");
+                       panic("pmap_enter: kva too big");
        } else {
 #ifdef DEBUG
                enter_stats.user++;
 #endif
                if (va >= VM_MAXUSER_ADDRESS)
-                       panic("pmap_enter: uva");
+                       panic("pmap_enter: uva too big");
        }
-       if (pa & 0x80000000)
+#endif
+#ifdef PARANOIADIAG
+#if defined(cobalt) || defined(newsmips) || defined(pmax) /* otherwise ok */
+       if (pa & 0x80000000)    /* this is not error in general. */
                panic("pmap_enter: pa");
+#endif
        if (!(prot & VM_PROT_READ))
                panic("pmap_enter: prot");
 #endif
@@ -1847,7 +1857,7 @@
 #endif
 }
 
-vaddr_t
+paddr_t
 pmap_phys_address(ppn)
        int ppn;
 {
diff -r d71f0df9f335 -r 7759fbc3629f sys/arch/mips/mips/trap.c
--- a/sys/arch/mips/mips/trap.c Fri Jun 09 04:28:17 2000 +0000
+++ b/sys/arch/mips/mips/trap.c Fri Jun 09 04:36:43 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.138 2000/06/06 18:52:40 soren Exp $ */
+/*     $NetBSD: trap.c,v 1.139 2000/06/09 04:37:52 soda Exp $  */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -44,7 +44,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.138 2000/06/06 18:52:40 soren Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.139 2000/06/09 04:37:52 soda Exp $");
 
 #include "opt_cputype.h"       /* which mips CPU levels do we support? */
 #include "opt_inet.h"
@@ -430,7 +430,7 @@
                if (KERNLAND(vaddr)) {
                        pt_entry_t *pte;
                        unsigned entry;
-                       vaddr_t pa;
+                       paddr_t pa;
 
                        pte = kvtopte(vaddr);
                        entry = pte->pt_entry;
@@ -448,7 +448,8 @@
                        MachTLBUpdate(vaddr, entry);
                        pa = pfn_to_vad(entry);
                        if (!IS_VM_PHYSADDR(pa)) {



Home | Main Index | Thread Index | Old Index