Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/vax Preliminary support for the VS4000/90 SGMAP. N...



details:   https://anonhg.NetBSD.org/src/rev/ced30d286be8
branches:  trunk
changeset: 486286:ced30d286be8
user:      matt <matt%NetBSD.org@localhost>
date:      Wed May 17 21:22:18 2000 +0000

description:
Preliminary support for the VS4000/90 SGMAP.  Needed for SCSI.  Does not
quite work right yet.

diffstat:

 sys/arch/vax/include/sgmap.h |   4 +++-
 sys/arch/vax/vax/ka49.c      |   6 ++++++
 sys/arch/vax/vax/sgmap.c     |  16 ++++++++++++++--
 sys/arch/vax/vsa/asc_vsbus.c |   9 +++++----
 sys/arch/vax/vsa/vsbus_dma.c |   7 ++++---
 5 files changed, 32 insertions(+), 10 deletions(-)

diffs (136 lines):

diff -r 78354a2bea06 -r ced30d286be8 sys/arch/vax/include/sgmap.h
--- a/sys/arch/vax/include/sgmap.h      Wed May 17 21:19:49 2000 +0000
+++ b/sys/arch/vax/include/sgmap.h      Wed May 17 21:22:18 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sgmap.h,v 1.2 2000/04/10 03:49:56 matt Exp $ */
+/* $NetBSD: sgmap.h,v 1.3 2000/05/17 21:22:18 matt Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -59,6 +59,8 @@
        bus_addr_t aps_sgvabase;        /* base of the sgva space */
        bus_size_t aps_sgvasize;        /* size of the sgva space */
        bus_addr_t aps_pa;              /* Address in region */
+       unsigned int aps_flags;         /* flags */
+#define        SGMAP_KA49              0x01    /* KA49 SGMAP is weird */
 };
 
 void   vax_sgmap_init __P((bus_dma_tag_t, struct vax_sgmap *,
diff -r 78354a2bea06 -r ced30d286be8 sys/arch/vax/vax/ka49.c
--- a/sys/arch/vax/vax/ka49.c   Wed May 17 21:19:49 2000 +0000
+++ b/sys/arch/vax/vax/ka49.c   Wed May 17 21:22:18 2000 +0000
@@ -38,6 +38,10 @@
 #include <machine/cpu.h>
 #include <machine/scb.h>
 
+#define        KA49_CPMBX      0x38
+#define        KA49_HLT_HALT   0x03
+#define        KA49_HLT_BOOT   0x02
+
 static void    ka49_conf __P((void));
 static void    ka49_memerr __P((void));
 static int     ka49_mchk __P((caddr_t));
@@ -225,6 +229,7 @@
 static void
 ka49_halt()
 {
+       ((u_int8_t *) clk_page)[KA49_CPMBX] = KA49_HLT_HALT;
        asm("halt");
 }
 
@@ -232,5 +237,6 @@
 ka49_reboot(arg)
        int arg;
 {
+       ((u_int8_t *) clk_page)[KA49_CPMBX] = KA49_HLT_BOOT;
        asm("halt");
 }
diff -r 78354a2bea06 -r ced30d286be8 sys/arch/vax/vax/sgmap.c
--- a/sys/arch/vax/vax/sgmap.c  Wed May 17 21:19:49 2000 +0000
+++ b/sys/arch/vax/vax/sgmap.c  Wed May 17 21:22:18 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sgmap.c,v 1.5 2000/04/10 03:49:57 matt Exp $ */
+/* $NetBSD: sgmap.c,v 1.6 2000/05/17 21:22:20 matt Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -249,7 +249,19 @@
                /*
                 * Load the current PTE with this page.
                 */
-               *pte = (pa >> VAX_PGSHIFT) | PG_V;
+               if (sgmap->aps_flags & SGMAP_KA49) {
+                       unsigned long pte0 = (pa & ~VAX_PGOFSET);
+                       unsigned long tmp = pte0 >> VAX_PGSHIFT;
+                       int cnt;
+
+                       for (cnt = 0; tmp != 0; tmp >>= 1) {
+                               cnt += (tmp & 1);
+                       }
+                       *pte = pte0 | PG_V | ((cnt & 1) ? 0 : 0x10000000);
+                       printf("%p: 0x%08lx\n", pte, *pte);
+               } else {
+                       *pte = (pa >> VAX_PGSHIFT) | PG_V;
+               }
        }
        /* The VS4000 SCSI prefetcher doesn't like to end on a page boundary
         * so add an extra page to quiet it down.
diff -r 78354a2bea06 -r ced30d286be8 sys/arch/vax/vsa/asc_vsbus.c
--- a/sys/arch/vax/vsa/asc_vsbus.c      Wed May 17 21:19:49 2000 +0000
+++ b/sys/arch/vax/vsa/asc_vsbus.c      Wed May 17 21:22:18 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: asc_vsbus.c,v 1.12 2000/04/24 21:59:22 matt Exp $      */
+/*     $NetBSD: asc_vsbus.c,v 1.13 2000/05/17 21:22:20 matt Exp $      */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: asc_vsbus.c,v 1.12 2000/04/24 21:59:22 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: asc_vsbus.c,v 1.13 2000/05/17 21:22:20 matt Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -93,8 +93,8 @@
 
 #define        ASC_REG_KA46_ADR        0x0000
 #define        ASC_REG_KA46_DIR        0x000C
-#define        ASC_REG_KA49_ADR        0x0004
-#define        ASC_REG_KA49_DIR        0x0008
+#define        ASC_REG_KA49_ADR        0x0000
+#define        ASC_REG_KA49_DIR        0x0004
 #define        ASC_REG_NCR             0x0080
 #define        ASC_REG_END             0x00B0
 
@@ -184,6 +184,7 @@
        DELAY(10000);
 
        dummy = ncr_regs[NCR_INTR << 2] & 0xFF;
+       printf("ncr intr = %d\n", dummy);
        return (dummy & NCRINTR_SBR) != 0;
 }
 
diff -r 78354a2bea06 -r ced30d286be8 sys/arch/vax/vsa/vsbus_dma.c
--- a/sys/arch/vax/vsa/vsbus_dma.c      Wed May 17 21:19:49 2000 +0000
+++ b/sys/arch/vax/vsa/vsbus_dma.c      Wed May 17 21:22:18 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vsbus_dma.c,v 1.4 2000/04/23 16:38:54 matt Exp $ */
+/* $NetBSD: vsbus_dma.c,v 1.5 2000/05/17 21:22:20 matt Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -129,9 +129,10 @@
                memset(pte, 0, mapsize);
                *(int *) (sc->sc_vsregs + 8) = segs->ds_addr;   /* set MAP BASE 0x2008008 */
        } else {
+               sc->sc_sgmap.aps_flags |= SGMAP_KA49;
                pte = (struct pte *) vax_map_physmem(KA49_SCSIMAP, mapsize / VAX_NBPG);
-               for (; ptecnt > 0; ) {
-                       ((u_int32_t *) pte)[--ptecnt] = 0;
+               for (nsegs = ptecnt; nsegs > 0; ) {
+                       ((u_int32_t *) pte)[--nsegs] = 0x88000000;
                }
                segs->ds_addr = KA49_SCSIMAP;
        }



Home | Main Index | Thread Index | Old Index