Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/vax Extend asc driver to include support for the VS...



details:   https://anonhg.NetBSD.org/src/rev/8c941792a2e1
branches:  trunk
changeset: 485260:8c941792a2e1
user:      matt <matt%NetBSD.org@localhost>
date:      Sun Apr 23 16:38:52 2000 +0000

description:
Extend asc driver to include support for the VS400/9x.
Add VS4000/9x support vsbus_dma.c

diffstat:

 sys/arch/vax/conf/GENERIC      |   7 +++--
 sys/arch/vax/include/vsbus.h   |   6 +++-
 sys/arch/vax/vsa/asc_vsbus.c   |  46 +++++++++++++++++++++++++++++-----
 sys/arch/vax/vsa/if_ze_vsbus.c |   5 ++-
 sys/arch/vax/vsa/vsbus.c       |  30 +++++++++++-----------
 sys/arch/vax/vsa/vsbus_dma.c   |  56 ++++++++++++++++++++++++------------------
 6 files changed, 97 insertions(+), 53 deletions(-)

diffs (truncated from 340 to 300 lines):

diff -r 9658d63a32e4 -r 8c941792a2e1 sys/arch/vax/conf/GENERIC
--- a/sys/arch/vax/conf/GENERIC Sun Apr 23 15:05:02 2000 +0000
+++ b/sys/arch/vax/conf/GENERIC Sun Apr 23 16:38:52 2000 +0000
@@ -1,11 +1,11 @@
-#      $NetBSD: GENERIC,v 1.63 2000/04/22 16:48:53 ragge Exp $
+#      $NetBSD: GENERIC,v 1.64 2000/04/23 16:38:52 matt Exp $
 #
 # GENERIC VAX configuration file; all supported devices.
 #
 
 include                "arch/vax/conf/std.vax"
 
-#ident                 "GENERIC-$Revision: 1.63 $"
+#ident                 "GENERIC-$Revision: 1.64 $"
 
 # Here are all different supported CPU types listed.
 options        "VAX8600"
@@ -125,7 +125,8 @@
 dz0            at vsbus0 csr 0x25000000 # VS4000/90 serial line
 #hdc0          at vsbus0 csr 0x200c0000 # HDC9224 MFM/floppy ctlr
 ncr0           at vsbus0 csr 0x200c0080 # VS2000/3100 SCSI-ctlr
-asc0           at vsbus0 csr 0x200c0080 # VS4000 SCSI-ctlr
+asc0           at vsbus0 csr 0x200c0080 # VS4000/60 (or VLC) SCSI-ctlr
+asc0           at vsbus0 csr 0x26000080 # VS4000/90 SCSI-ctlr
 ncr1           at vsbus0 csr 0x200c0180 # VS2000/3100 SCSI-ctlr
 smg0           at vsbus0 csr 0x200f0000 # Small monochrome display ctlr.
 #clr0          at vsbus0 csr 0x30000000 # 4- or 8-bitplans color graphics
diff -r 9658d63a32e4 -r 8c941792a2e1 sys/arch/vax/include/vsbus.h
--- a/sys/arch/vax/include/vsbus.h      Sun Apr 23 15:05:02 2000 +0000
+++ b/sys/arch/vax/include/vsbus.h      Sun Apr 23 16:38:52 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vsbus.h,v 1.11 2000/03/04 07:27:49 matt Exp $ */
+/*     $NetBSD: vsbus.h,v 1.12 2000/04/23 16:38:53 matt Exp $ */
 /*
  * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -65,6 +65,7 @@
 #define NI_BASE         0x200e0000      /* LANCE CSRs */
 #define NI_IOSIZE       (128 * VAX_NBPG)    /* IO address size */
 
+#define        KA49_SCSIMAP    0x27000000      /* KA49 SCSI SGMAP */
 /*
  * Small monochrome graphics framebuffer, present on all machines.
  */
@@ -77,12 +78,13 @@
        u_char  *sc_intclr;     /* Clear interrupt register */
        u_char  *sc_intreq;     /* Interrupt request register */
        u_char  sc_mask;        /* Interrupts to enable after autoconf */
+       vaddr_t sc_vsregs;      /* Where the VS_REGS are mapped */
        struct vax_bus_dma_tag sc_dmatag;
        struct vax_sgmap sc_sgmap;
 };
 
 #ifdef _KERNEL
-void   vsbus_dma_init __P((struct vsbus_softc *));
+void   vsbus_dma_init __P((struct vsbus_softc *, unsigned ptecnt));
 u_char vsbus_setmask __P((int));
 void   vsbus_clrintr __P((int));
 void   vsbus_copytoproc __P((struct proc *, caddr_t, caddr_t, int));
diff -r 9658d63a32e4 -r 8c941792a2e1 sys/arch/vax/vsa/asc_vsbus.c
--- a/sys/arch/vax/vsa/asc_vsbus.c      Sun Apr 23 15:05:02 2000 +0000
+++ b/sys/arch/vax/vsa/asc_vsbus.c      Sun Apr 23 16:38:52 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: asc_vsbus.c,v 1.10 2000/04/18 21:25:31 matt Exp $      */
+/*     $NetBSD: asc_vsbus.c,v 1.11 2000/04/23 16:38:54 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.10 2000/04/18 21:25:31 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: asc_vsbus.c,v 1.11 2000/04/23 16:38:54 matt Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -76,6 +76,8 @@
        struct ncr53c9x_softc sc_ncr53c9x;      /* Must be first */
        bus_space_tag_t sc_bst;                 /* bus space tag */
        bus_space_handle_t sc_bsh;              /* bus space handle */
+       bus_space_handle_t sc_dirh;             /* scsi direction handle */
+       bus_space_handle_t sc_adrh;             /* scsi address handle */
        bus_space_handle_t sc_ncrh;             /* ncr bus space handle */
        bus_dma_tag_t sc_dmat;                  /* bus dma tag */
        bus_dmamap_t sc_dmamap;
@@ -89,8 +91,10 @@
        unsigned long sc_xfers;
 };
 
-#define        ASC_REG_ADR             0x0000
-#define        ASC_REG_DIR             0x000C
+#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_NCR             0x0080
 #define        ASC_REG_END             0x00B0
 
@@ -147,7 +151,7 @@
 
        if (vax_boardtype != VAX_BTYP_46
           && vax_boardtype != VAX_BTYP_48
-          /* && vax_boardtype != VAX_BTYP_49 */)
+          && vax_boardtype != VAX_BTYP_49)
                return 0;
 
        ncr_regs = (volatile u_int8_t *) va->va_addr;
@@ -203,6 +207,34 @@
                printf(": failed to map ncr registers: error=%d\n", error);
                return;
        }
+       if (vax_boardtype == VAX_BTYP_46 || vax_boardtype == VAX_BTYP_48) {
+               error = bus_space_subregion(asc->sc_bst, asc->sc_bsh,
+                   ASC_REG_KA46_ADR, sizeof(u_int32_t), &asc->sc_adrh);
+               if (error) {
+                       printf(": failed to map adr register: error=%d\n",
+                            error);
+                       return;
+               }
+               error = bus_space_subregion(asc->sc_bst, asc->sc_bsh,
+                   ASC_REG_KA46_DIR, sizeof(u_int32_t), &asc->sc_dirh);
+               if (error) {
+                       printf(": failed to map dir register: error=%d\n",
+                            error);
+                       return;
+               }
+       } else {
+               /* This is a gross and disgusting kludge but it'll
+                * save a bunch of ugly code.  Unlike the VS4000/60,
+                * the SCSI Address and direction registers are not
+                * near the SCSI NCR registers and are inside the 
+                * block of general VAXstation registers.  So we grab
+                * them from there and knowing the internals of the 
+                * bus_space implementation, we cast to bus_space_handles.
+                */
+               struct vsbus_softc *vsc = (struct vsbus_softc *) parent;
+               asc->sc_adrh = (bus_space_handle_t) (vsc->sc_vsregs + ASC_REG_KA49_ADR);
+               asc->sc_dirh = (bus_space_handle_t) (vsc->sc_vsregs + ASC_REG_KA49_DIR);
+       }
        error = bus_dmamap_create(asc->sc_dmat, ASC_MAXXFERSIZE, 1, 
            ASC_MAXXFERSIZE, 0, BUS_DMA_NOWAIT, &asc->sc_dmamap);
 
@@ -398,9 +430,9 @@
                                asc->sc_flags & ASC_FROMMEMORY
                                        ? BUS_DMASYNC_PREWRITE
                                        : BUS_DMASYNC_PREREAD);
-               bus_space_write_4(asc->sc_bst, asc->sc_bsh, ASC_REG_ADR,
+               bus_space_write_4(asc->sc_bst, asc->sc_adrh, 0,
                                  asc->sc_dmamap->dm_segs[0].ds_addr);
-               bus_space_write_4(asc->sc_bst, asc->sc_bsh, ASC_REG_DIR,
+               bus_space_write_4(asc->sc_bst, asc->sc_dirh, 0,
                                  asc->sc_flags & ASC_FROMMEMORY);
                asc->sc_flags |= ASC_MAPLOADED;
        }
diff -r 9658d63a32e4 -r 8c941792a2e1 sys/arch/vax/vsa/if_ze_vsbus.c
--- a/sys/arch/vax/vsa/if_ze_vsbus.c    Sun Apr 23 15:05:02 2000 +0000
+++ b/sys/arch/vax/vsa/if_ze_vsbus.c    Sun Apr 23 16:38:52 2000 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: if_ze_vsbus.c,v 1.2 2000/01/24 02:40:35 matt Exp $ */
+/*      $NetBSD: if_ze_vsbus.c,v 1.3 2000/04/23 16:38:54 matt Exp $ */
 /*
  * Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved.
  *
@@ -104,6 +104,7 @@
 {
        struct ze_softc *sc = (struct ze_softc *)self;
        struct vsbus_attach_args *va = aux;
+       extern struct vax_bus_dma_tag vax_bus_dma_tag;
        int *ea, i;
 
        /*
@@ -111,7 +112,7 @@
         */
        sc->sc_ioh = vax_map_physmem(SGECADDR, 1);
        sc->sc_iot = 0; /* :-) */
-       sc->sc_dmat = va->va_dmat;
+       sc->sc_dmat = &vax_bus_dma_tag;
 
        sc->sc_intvec = SGECVEC;
        scb_vecalloc(va->va_cvec, (void (*)(void *)) sgec_intr, sc, SCB_ISTACK);
diff -r 9658d63a32e4 -r 8c941792a2e1 sys/arch/vax/vsa/vsbus.c
--- a/sys/arch/vax/vsa/vsbus.c  Sun Apr 23 15:05:02 2000 +0000
+++ b/sys/arch/vax/vsa/vsbus.c  Sun Apr 23 16:38:52 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vsbus.c,v 1.23 2000/03/08 23:50:51 matt Exp $ */
+/*     $NetBSD: vsbus.c,v 1.24 2000/04/23 16:38:54 matt Exp $ */
 /*
  * Copyright (c) 1996, 1999 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -132,7 +132,6 @@
        void    *aux;
 {
        struct  vsbus_softc *sc = (void *)self;
-       vaddr_t temp;
 
        printf("\n");
 
@@ -141,28 +140,29 @@
        switch (vax_boardtype) {
 #if VAX49
        case VAX_BTYP_49:
-               temp = vax_map_physmem(0x25c00000, 1);
-               sc->sc_intreq = (char *)temp + 12;
-               sc->sc_intclr = (char *)temp + 12;
-               sc->sc_intmsk = (char *)temp + 8;
-#if 0
-               vsbus_dma_init(sc);     /* not yet */
-#endif
+               sc->sc_vsregs = vax_map_physmem(0x25c00000, 1);
+               sc->sc_intreq = (char *)sc->sc_vsregs + 12;
+               sc->sc_intclr = (char *)sc->sc_vsregs + 12;
+               sc->sc_intmsk = (char *)sc->sc_vsregs + 8;
+               vsbus_dma_init(sc, 8192);
                break;
 #endif
 
 #if VAX46 || VAX48
        case VAX_BTYP_48:
        case VAX_BTYP_46:
-               vsbus_dma_init(sc);
-               /* FALL THROUGH */
+               sc->sc_vsregs = vax_map_physmem(VS_REGS, 1);
+               sc->sc_intreq = (char *)sc->sc_vsregs + 15;
+               sc->sc_intclr = (char *)sc->sc_vsregs + 15;
+               sc->sc_intmsk = (char *)sc->sc_vsregs + 12;
+               vsbus_dma_init(sc, 32768);
 #endif
 
        default:
-               temp = vax_map_physmem(VS_REGS, 1);
-               sc->sc_intreq = (char *)temp + 15;
-               sc->sc_intclr = (char *)temp + 15;
-               sc->sc_intmsk = (char *)temp + 12;
+               sc->sc_vsregs = vax_map_physmem(VS_REGS, 1);
+               sc->sc_intreq = (char *)sc->sc_vsregs + 15;
+               sc->sc_intclr = (char *)sc->sc_vsregs + 15;
+               sc->sc_intmsk = (char *)sc->sc_vsregs + 12;
                break;
        }
 
diff -r 9658d63a32e4 -r 8c941792a2e1 sys/arch/vax/vsa/vsbus_dma.c
--- a/sys/arch/vax/vsa/vsbus_dma.c      Sun Apr 23 15:05:02 2000 +0000
+++ b/sys/arch/vax/vsa/vsbus_dma.c      Sun Apr 23 16:38:52 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vsbus_dma.c,v 1.3 2000/03/07 00:07:16 matt Exp $ */
+/* $NetBSD: vsbus_dma.c,v 1.4 2000/04/23 16:38:54 matt Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -48,6 +48,7 @@
 #define _VAX_BUS_DMA_PRIVATE
 #include <machine/bus.h>
 #include <machine/cpu.h>
+#include <machine/sid.h>
 #include <machine/sgmap.h>
 #include <machine/vsbus.h>
 
@@ -74,14 +75,15 @@
            bus_size_t, int));
 
 void
-vsbus_dma_init(sc)
+vsbus_dma_init(sc, ptecnt)
        struct vsbus_softc *sc;
+       unsigned ptecnt;
 {
        bus_dma_tag_t t;
        bus_dma_segment_t segs[1];
        struct pte *pte;
        int nsegs, error;
-       vaddr_t vs_regs;
+       unsigned mapsize = ptecnt * sizeof(struct pte);
 
        /*
         * Initialize the DMA tag used for sgmap-mapped DMA.
@@ -89,7 +91,7 @@
        t = &sc->sc_dmatag;
        t->_cookie = sc;
        t->_wbase = 0;
-       t->_wsize = 16*1024*1024;
+       t->_wsize = ptecnt * VAX_NBPG;
        t->_boundary = 0;
        t->_sgmap = &sc->sc_sgmap;
        t->_dmamap_create = vsbus_bus_dmamap_create_sgmap;
@@ -107,28 +109,34 @@
        t->_dmamem_unmap = _bus_dmamem_unmap;
        t->_dmamem_mmap = _bus_dmamem_mmap;
 
-       /*
-        * Allocate and map the VS4000 scatter gather map.
-        */
-       error = bus_dmamem_alloc(t, 0x20000, 0x20000, 0x20000,
-           segs, 1, &nsegs, BUS_DMA_NOWAIT);
-       if (error) {
-               panic("vsbus_dma_init: error allocating memory for hw sgmap"
-                   ": error=%d", error);
-       }
+       if (vax_boardtype == VAX_BTYP_46 || vax_boardtype == VAX_BTYP_48) {
+               /*



Home | Main Index | Thread Index | Old Index