Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc update for new VME framework



details:   https://anonhg.NetBSD.org/src/rev/7c9ab91614a8
branches:  trunk
changeset: 474172:7c9ab91614a8
user:      drochner <drochner%NetBSD.org@localhost>
date:      Wed Jun 30 15:18:58 1999 +0000

description:
update for new VME framework

diffstat:

 sys/arch/sparc/conf/files.sparc  |    9 +-
 sys/arch/sparc/dev/cgtwo.c       |   58 ++++----
 sys/arch/sparc/dev/si.c          |   49 ++++---
 sys/arch/sparc/dev/vme_machdep.c |  243 +++++++++++++++++++++-----------------
 4 files changed, 197 insertions(+), 162 deletions(-)

diffs (truncated from 804 to 300 lines):

diff -r 7132500d60e5 -r 7c9ab91614a8 sys/arch/sparc/conf/files.sparc
--- a/sys/arch/sparc/conf/files.sparc   Wed Jun 30 15:07:45 1999 +0000
+++ b/sys/arch/sparc/conf/files.sparc   Wed Jun 30 15:18:58 1999 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.sparc,v 1.77 1999/06/20 16:30:22 pk Exp $
+#      $NetBSD: files.sparc,v 1.78 1999/06/30 15:18:58 drochner Exp $
 
 # @(#)files.sparc      8.1 (Berkeley) 7/19/93
 # sparc-specific configuration info
@@ -19,11 +19,12 @@
 attach obio at mainbus
 
 include "dev/vme/files.vme"
-attach vme at mainbus with vme_mainbus
-attach vme at iommu with vme_iommu
+device sparcvme: vmebus
+attach sparcvme at mainbus with vme_mainbus
+attach sparcvme at iommu with vme_iommu
 
 file   arch/sparc/dev/obio.c           obio
-file   arch/sparc/dev/vme_machdep.c    vme
+file   arch/sparc/dev/vme_machdep.c    sparcvme
 
 device auxreg
 attach auxreg at mainbus with auxreg_mainbus
diff -r 7132500d60e5 -r 7c9ab91614a8 sys/arch/sparc/dev/cgtwo.c
--- a/sys/arch/sparc/dev/cgtwo.c        Wed Jun 30 15:07:45 1999 +0000
+++ b/sys/arch/sparc/dev/cgtwo.c        Wed Jun 30 15:18:58 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cgtwo.c,v 1.29 1998/04/07 20:18:19 pk Exp $ */
+/*     $NetBSD: cgtwo.c,v 1.30 1999/06/30 15:18:58 drochner Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -124,22 +124,21 @@
        void *aux;
 {
        struct vme_attach_args  *va = aux;
-       vme_chipset_tag_t       ct = va->vma_chipset_tag;
-       bus_space_tag_t         bt = va->vma_bustag;
-       vme_mod_t               mod;
+       vme_chipset_tag_t       ct = va->va_vct;
+       vme_am_t                mod;
 
        /*
         * Mask out invalid flags from the user.
         */
        cf->cf_flags &= FB_USERMASK;
 
-       mod = VMEMOD_A24 | VMEMOD_S | VMEMOD_D;
-       if (vme_bus_probe(ct, bt, va->vma_reg[0], CG2_CTLREG_OFF, 2, mod,
+       mod = 0x3d; /* VME_AM_A24 | VME_AM_MBO | VME_AM_SUPER | VME_AM_DATA */
+       if (vme_probe(ct, va->r[0].offset + CG2_CTLREG_OFF, 2, mod, VME_D16,
                          0, 0)) {
-               return (1);
+               return (0);
        }
 
-       return (0);
+       return (1);
 }
 
 /*
@@ -151,10 +150,11 @@
        void *aux;
 {
        struct vme_attach_args  *va = aux;
-       vme_chipset_tag_t       ct = va->vma_chipset_tag;
-       bus_space_tag_t         bt = va->vma_bustag;
+       vme_chipset_tag_t       ct = va->va_vct;
+       bus_space_tag_t         bt;
        bus_space_handle_t      bh;
-       vme_mod_t               mod;
+       vme_am_t                mod;
+       vme_mapresc_t resc;
        struct cgtwo_softc *sc = (struct cgtwo_softc *)self;
        struct fbdevice *fb = &sc->sc_fb;
        struct eeprom *eep = (struct eeprom *)eeprom_va;
@@ -162,7 +162,6 @@
        char *nam = NULL;
 
        sc->sc_ct = ct;
-       sc->sc_bt = bt;
        fb->fb_driver = &cgtwofbdriver;
        fb->fb_device = &sc->sc_dev;
        fb->fb_type.fb_type = FBTYPE_SUN2COLOR;
@@ -182,20 +181,23 @@
         * registers ourselves.  We only need the video RAM if we are
         * going to print characters via rconsole.
         */
-       sc->sc_paddr = va->vma_reg[0];
-       mod = VMEMOD_A24 | VMEMOD_S | VMEMOD_D;
+       sc->sc_paddr = va->r[0].offset;
+       mod = 0x3d; /* VME_AM_A24 | VME_AM_MBO | VME_AM_SUPER | VME_AM_DATA */
 
-       if (vme_bus_map(ct, sc->sc_paddr + CG2_ROPMEM_OFF +
+       if (vme_space_map(ct, sc->sc_paddr + CG2_ROPMEM_OFF +
                                offsetof(struct cg2fb, status.reg),
-                       sizeof(struct cg2statusreg), mod, bt, &bh) != 0)
+                       sizeof(struct cg2statusreg), mod, VME_D16, 0,
+                       &bt, &bh, &resc) != 0)
                panic("cgtwo: vme_map status");
-       sc->sc_reg = (volatile struct cg2statusreg *)bh;
+       sc->sc_bt = bt;
+       sc->sc_reg = (volatile struct cg2statusreg *)bh; /* XXX */
 
-       if (vme_bus_map(ct, sc->sc_paddr + CG2_ROPMEM_OFF +
+       if (vme_space_map(ct, sc->sc_paddr + CG2_ROPMEM_OFF +
                                offsetof(struct cg2fb, redmap[0]),
-                       3 * CG2_CMSIZE, mod, bt, &bh) != 0)
+                       3 * CG2_CMSIZE, mod, VME_D16, 0,
+                       &bt, &bh, &resc) != 0)
                panic("cgtwo: vme_map cmap");
-       sc->sc_cmap = (volatile u_short *)bh;
+       sc->sc_cmap = (volatile u_short *)bh; /* XXX */
 
        /*
         * Assume this is the console if there's no eeprom info
@@ -207,11 +209,12 @@
                isconsole = 0;
 
        if (isconsole) {
-               if (vme_bus_map(ct, sc->sc_paddr + CG2_PIXMAP_OFF,
-                               CG2_PIXMAP_SIZE, mod, bt, &bh) != 0)
+               if (vme_space_map(ct, sc->sc_paddr + CG2_PIXMAP_OFF,
+                               CG2_PIXMAP_SIZE, mod, VME_D16, 0,
+                                 &bt, &bh, &resc) != 0)
                        panic("cgtwo: vme_map pixels");
 
-               fb->fb_pixels = (caddr_t)bh;
+               fb->fb_pixels = (caddr_t)bh; /* XXX */
                printf(" (console)\n");
 #ifdef RASTERCONSOLE
                fbrcons_init(fb);
@@ -409,8 +412,10 @@
        int off, prot;
 {
        register struct cgtwo_softc *sc = cgtwo_cd.cd_devs[minor(dev)];
-       vme_mod_t mod;
+       vme_am_t mod;
        bus_space_handle_t bh;
+       extern int sparc_vme_mmap_cookie __P((vme_addr_t, vme_am_t,
+                                             bus_space_handle_t *));
 
        if (off & PGOFSET)
                panic("cgtwommap");
@@ -419,10 +424,9 @@
                return (-1);
 
        /* Apparently, the pixels are in 32-bit data space */
-       mod = VMEMOD_A24 | VMEMOD_S | VMEMOD_D | VMEMOD_D32;
+       mod = 0x3d; /* VME_AM_A24 | VME_AM_MBO | VME_AM_SUPER | VME_AM_DATA */
 
-       if (vme_bus_mmap_cookie(sc->sc_ct, sc->sc_paddr + off,
-                               mod, sc->sc_bt, &bh) != 0)
+       if (sparc_vme_mmap_cookie(sc->sc_paddr + off, mod, &bh) != 0)
                panic("cgtwommap");
 
        return ((int)bh);
diff -r 7132500d60e5 -r 7c9ab91614a8 sys/arch/sparc/dev/si.c
--- a/sys/arch/sparc/dev/si.c   Wed Jun 30 15:07:45 1999 +0000
+++ b/sys/arch/sparc/dev/si.c   Wed Jun 30 15:18:58 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: si.c,v 1.51 1999/03/17 23:20:16 pk Exp $       */
+/*     $NetBSD: si.c,v 1.52 1999/06/30 15:18:58 drochner Exp $ */
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -107,6 +107,7 @@
 #include <vm/vm.h>
 
 #include <machine/bus.h>
+#include <machine/intr.h>
 #include <machine/autoconf.h>
 #include <machine/cpu.h>
 #include <machine/pmap.h>
@@ -295,9 +296,8 @@
        void *aux;
 {
        struct vme_attach_args  *va = aux;
-       vme_chipset_tag_t       ct = va->vma_chipset_tag;
-        bus_space_tag_t                bt = va->vma_bustag;
-        vme_mod_t              mod; 
+       vme_chipset_tag_t       ct = va->va_vct;
+        vme_am_t               mod; 
         vme_addr_t             vme_addr;
 
 
@@ -306,9 +306,10 @@
                return (0);
 
        /* Make sure there is something there... */
-       mod = VMEMOD_A24 | VMEMOD_S | VMEMOD_D;
-       vme_addr = va->vma_reg[0];
-       if (vme_bus_probe(ct, bt, vme_addr, 1, 1, mod, NULL, 0) == 0)
+       mod = 0x3d; /* VME_AM_A24 | VME_AM_MBO | VME_AM_SUPER | VME_AM_DATA */
+       vme_addr = va->r[0].offset;
+
+       if (vme_probe(ct, vme_addr, 1, mod, VME_D8, NULL, 0) != 0)
                return (0);
 
        /*
@@ -317,8 +318,7 @@
         * be determined using the fact that the "sc" board occupies
         * 4K bytes in VME space but the "si" board occupies 2K bytes.
         */
-       vme_addr = va->vma_reg[0];
-       return (vme_bus_probe(ct, bt, vme_addr, 0x801, 1, mod, NULL, 0) == 0);
+       return (vme_probe(ct, vme_addr + 0x801, 1, mod, VME_D8, NULL, 0) != 0);
 }
 
 static void
@@ -327,23 +327,24 @@
        void            *aux;
 {
        struct si_softc         *sc = (struct si_softc *) self;
-       struct ncr5380_softc *ncr_sc = (struct ncr5380_softc *)sc;
+       struct ncr5380_softc *ncr_sc = &sc->ncr_sc;
        struct vme_attach_args  *va = aux;
-       vme_chipset_tag_t       ct = va->vma_chipset_tag;
-       bus_space_tag_t         bt = va->vma_bustag;
+       vme_chipset_tag_t       ct = va->va_vct;
+       bus_space_tag_t         bt;
        bus_space_handle_t      bh;
+       vme_mapresc_t resc;
        vme_intr_handle_t       ih;
-       vme_mod_t               mod;
+       vme_am_t                mod;
 
-       sc->sc_dmatag = va->vma_dmatag;
+       sc->sc_dmatag = va->va_bdt;
 
-       mod = VMEMOD_A24 | VMEMOD_D | VMEMOD_S;
+       mod = 0x3d; /* VME_AM_A24 | VME_AM_MBO | VME_AM_SUPER | VME_AM_DATA */
 
-       if (vme_bus_map(ct, va->vma_reg[0], sizeof(struct si_regs),
-                       mod, bt, &bh) != 0)
-               panic("%s: vme_bus_map", ncr_sc->sc_dev.dv_xname);
+       if (vme_space_map(ct, va->r[0].offset, sizeof(struct si_regs),
+                         mod, VME_D8, 0, &bt, &bh, &resc) != 0)
+               panic("%s: vme_space_map", ncr_sc->sc_dev.dv_xname);
 
-       sc->sc_regs = (struct si_regs *)bh;
+       sc->sc_regs = (struct si_regs *)bh; /* XXX */
 
        sc->sc_options = si_options;
        reset_adapter = si_reset_adapter;
@@ -354,12 +355,12 @@
        ncr_sc->sc_dma_eop   = si_vme_dma_stop;
        ncr_sc->sc_dma_stop  = si_vme_dma_stop;
 
-       vme_intr_map(ct, va->vma_vec, va->vma_pri, &ih);
-       vme_intr_establish(ct, ih, si_intr, sc);
+       vme_intr_map(ct, va->ilevel, va->ivector, &ih);
+       vme_intr_establish(ct, ih, IPL_BIO, si_intr, sc);
 
-       printf(" pri %d\n", va->vma_pri);
+       printf("\n");
 
-       sc->sc_adapter_iv_am = (mod << 8) | (va->vma_vec & 0xFF);
+       sc->sc_adapter_iv_am = (mod << 8) | (va->ivector & 0xFF);
 
        si_attach_common(parent, sc);
 
@@ -380,7 +381,7 @@
        void            *aux;
 {
        struct si_softc *sc = (struct si_softc *) self;
-       struct ncr5380_softc *ncr_sc = (struct ncr5380_softc *)sc;
+       struct ncr5380_softc *ncr_sc = &sc->ncr_sc;
        union obio_attach_args *uoba = aux;
        struct obio4_attach_args *oba = &uoba->uoba_oba4;
        bus_space_handle_t bh;
diff -r 7132500d60e5 -r 7c9ab91614a8 sys/arch/sparc/dev/vme_machdep.c
--- a/sys/arch/sparc/dev/vme_machdep.c  Wed Jun 30 15:07:45 1999 +0000
+++ b/sys/arch/sparc/dev/vme_machdep.c  Wed Jun 30 15:18:58 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vme_machdep.c,v 1.18 1999/04/14 10:28:23 pk Exp $      */
+/*     $NetBSD: vme_machdep.c,v 1.19 1999/06/30 15:18:58 drochner Exp $        */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -41,6 +41,7 @@
 #include <sys/systm.h>
 #include <sys/device.h>
 #include <sys/malloc.h>
+#include <sys/errno.h>
 
 #include <sys/proc.h>
 #include <sys/user.h>
@@ -57,6 +58,7 @@
 #include <machine/cpu.h>
 #include <machine/ctlreg.h>
 
+#include <dev/vme/vmereg.h>
 #include <dev/vme/vmevar.h>
 
 #include <sparc/sparc/asm.h>
@@ -64,7 +66,7 @@
 #include <sparc/sparc/cpuvar.h>



Home | Main Index | Thread Index | Old Index