Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm32/podulebus New bus-independent DMA framework. ...



details:   https://anonhg.NetBSD.org/src/rev/b3b3577c4b98
branches:  trunk
changeset: 513838:b3b3577c4b98
user:      rearnsha <rearnsha%NetBSD.org@localhost>
date:      Tue Aug 14 22:58:17 2001 +0000

description:
New bus-independent DMA framework.  Adjust asc.c for new interface
but not (yet) make use of new framework.

diffstat:

 sys/arch/arm32/podulebus/asc.c     |  253 +++-------------
 sys/arch/arm32/podulebus/sbic.c    |  552 ++++++++----------------------------
 sys/arch/arm32/podulebus/sbicreg.h |    4 +-
 sys/arch/arm32/podulebus/sbicvar.h |   90 ++---
 4 files changed, 224 insertions(+), 675 deletions(-)

diffs (truncated from 1412 to 300 lines):

diff -r 91b95cb4f83d -r b3b3577c4b98 sys/arch/arm32/podulebus/asc.c
--- a/sys/arch/arm32/podulebus/asc.c    Tue Aug 14 22:17:48 2001 +0000
+++ b/sys/arch/arm32/podulebus/asc.c    Tue Aug 14 22:58:17 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: asc.c,v 1.34 2001/07/04 17:54:18 bjh21 Exp $   */
+/*     $NetBSD: asc.c,v 1.35 2001/08/14 22:58:17 rearnsha Exp $        */
 
 /*
  * Copyright (c) 1996 Mark Brinicombe
@@ -71,18 +71,21 @@
 #include <dev/podulebus/podules.h>
 #include <dev/podulebus/powerromreg.h>
 
-void ascattach __P((struct device *, struct device *, void *));
-int ascmatch   __P((struct device *, struct cfdata *, void *));
+void ascattach         (struct device *, struct device *, void *);
+int  ascmatch          (struct device *, struct cfdata *, void *);
+
+void asc_enintr                (struct sbic_softc *);
 
-void asc_enintr __P((struct sbic_softc *));
-void asc_dmastop __P((struct sbic_softc *));
-int asc_dmanext __P((struct sbic_softc *));
-int asc_dmaintr __P((struct sbic_softc *));
-int asc_dmago  __P((struct sbic_softc *, char *, int, int));
-void asc_scsi_request __P((struct scsipi_channel *,
-                                scsipi_adapter_req_t, void *));
-int asc_intr   __P((void *arg));
-void asc_minphys __P((struct buf *bp));
+int  asc_dmaok         (void *, bus_dma_tag_t, struct sbic_acb *);
+int  asc_dmasetup      (void *, bus_dma_tag_t, struct sbic_acb *, int);
+int  asc_dmanext       (void *, bus_dma_tag_t, struct sbic_acb *, int);
+void asc_dmastop       (void *, bus_dma_tag_t, struct sbic_acb *);
+void asc_dmafinish     (void *, bus_dma_tag_t, struct sbic_acb *);
+
+void asc_scsi_request  (struct scsipi_channel *,
+                        scsipi_adapter_req_t, void *);
+int  asc_intr          (void *);
+void asc_minphys       (struct buf *);
 
 #ifdef DEBUG
 int    asc_dmadebug = 0;
@@ -103,10 +106,7 @@
 #endif
 
 int
-ascmatch(pdp, cf, auxp)
-       struct device *pdp;
-       struct cfdata *cf;
-       void *auxp;
+ascmatch(struct device *pdp, struct cfdata *cf, void *auxp)
 {
        struct podule_attach_args *pa = (struct podule_attach_args *)auxp;
 
@@ -127,9 +127,7 @@
 }
 
 void
-ascattach(pdp, dp, auxp)
-       struct device *pdp, *dp;
-       void *auxp;
+ascattach(struct device *pdp, struct device *dp, void *auxp)
 {
 /*     volatile struct sdmac *rp;*/
        struct asc_softc *sc;
@@ -149,15 +147,11 @@
        sbic = &sc->sc_softc;
 
        sbic->sc_enintr = asc_enintr;
-       sbic->sc_dmago = asc_dmago;
+       sbic->sc_dmaok = asc_dmaok;
+       sbic->sc_dmasetup = asc_dmasetup;
        sbic->sc_dmanext = asc_dmanext;
        sbic->sc_dmastop = asc_dmastop;
-       sbic->sc_dmacmd = 0;
-
-       /*
-        * eveything is a valid dma address
-        */
-       sbic->sc_dmamask = 0;
+       sbic->sc_dmafinish = asc_dmafinish;
 
        /* Map sbic */
        sbic->sc_sbicp.sc_sbiciot = pa->pa_iot;
@@ -233,8 +227,7 @@
 
 
 void
-asc_enintr(sbicsc)
-       struct sbic_softc *sbicsc;
+asc_enintr(struct sbic_softc *sbicsc)
 {
        struct asc_softc *sc = (struct asc_softc *)sbicsc;
 /*     printf("asc_enintr\n");*/
@@ -250,80 +243,46 @@
        WriteByte(sc->sc_pagereg, 0x40);
 }
 
+int
+asc_dmaok (void *dma_h, bus_dma_tag_t dma_t, struct sbic_acb *acb)
+{
+       return 0;
+}
 
 int
-asc_dmago(dev, addr, count, flags)
-       struct sbic_softc *dev;
-       char *addr;
-       int count, flags;
+asc_dmasetup (void *dma_h, bus_dma_tag_t dma_t, struct sbic_acb *acb, int dir)
 {
-       printf("asc_dmago(addr=%p, count=%d,flags=%d)\n", addr, count, flags);
-       printf("dmago: dc_addr=%p tcnt=%lx\n", dev->sc_cur->dc_addr, dev->sc_tcnt);
+       printf("asc_dmasetup()");
 #ifdef DDB
        Debugger();
 #else
        panic("Hit a brick wall\n");
 #endif
-#if 0
-       volatile struct sdmac *sdp;
+       return 0;
+}
 
-       sdp = dev->sc_cregs;
-       /*
-        * Set up the command word based on flags
-        */
-       dev->sc_dmacmd = CNTR_PDMD | CNTR_INTEN;
-       if ((flags & DMAGO_READ) == 0)
-               dev->sc_dmacmd |= CNTR_DDIR;
-#ifdef DEBUG
-       if (ahsc_dmadebug & DDB_IO)
-               printf("ahsc_dmago: cmd %x\n", dev->sc_dmacmd);
+int
+asc_dmanext (void *dma_h, bus_dma_tag_t dma_t, struct sbic_acb *acb, int dir)
+{
+       printf("asc_dmanext()");
+#ifdef DDB
+       Debugger();
+#else
+       panic("Hit a brick wall\n");
 #endif
-
-       dev->sc_flags |= SBICF_INTR;
-       sdp->CNTR = dev->sc_dmacmd;
-       sdp->ACR = (u_int) dev->sc_cur->dc_addr;
-       sdp->ST_DMA = 1;
-
-       return(dev->sc_tcnt);
-#endif
-       return(0);
+       return 0;
 }
 
 void
-asc_dmastop(dev)
-       struct sbic_softc *dev;
+asc_dmastop (void *dma_h, bus_dma_tag_t dma_t, struct sbic_acb *acb)
 {
-/*     printf("asc_dmastop\n");*/
-#if 0
-       volatile struct sdmac *sdp;
-       int s;
-
-       sdp = dev->sc_cregs;
+       printf("asc_dmastop\n");
+}
 
-#ifdef DEBUG
-       if (ahsc_dmadebug & DDB_FOLLOW)
-               printf("ahsc_dmastop()\n");
-#endif
-       if (dev->sc_dmacmd) {
-               s = splbio();
-               if ((dev->sc_dmacmd & (CNTR_TCEN | CNTR_DDIR)) == 0) {
-                       /*
-                        * only FLUSH if terminal count not enabled,
-                        * and reading from peripheral
-                        */
-                       sdp->FLUSH = 1;
-                       while ((sdp->ISTR & ISTR_FE_FLG) == 0)
-                               ;
-               }
-               /* 
-                * clear possible interrupt and stop dma
-                */
-               sdp->CINT = 1;
-               sdp->SP_DMA = 1;
-               dev->sc_dmacmd = 0;
-               splx(s);
-       }
-#endif
+void
+asc_dmafinish (void *dma_h, bus_dma_tag_t dma_t, struct sbic_acb *acb)
+{
+       printf("asc_dmafinish\n");
 }
 
 int
@@ -331,90 +290,7 @@
        struct sbic_softc *dev;
 {
        panic("asc_dmaintr");
-#if 0
-       volatile struct sdmac *sdp;
-       int stat, found;
-
-       sdp = dev->sc_cregs;
-       stat = sdp->ISTR;
-
-       if ((stat & (ISTR_INT_F|ISTR_INT_P)) == 0)
-               return (0);
-
-#ifdef DEBUG
-       if (ahsc_dmadebug & DDB_FOLLOW)
-               printf("%s: dmaintr 0x%x\n", dev->sc_dev.dv_xname, stat);
-#endif
-
-       /*
-        * both, SCSI and DMA interrupts arrive here. I chose
-        * arbitrarily that DMA interrupts should have higher
-        * precedence than SCSI interrupts.
-        */
-       found = 0;
-       if (stat & ISTR_E_INT) {
-               ++found;
-
-               sdp->CINT = 1;  /* clear possible interrupt */
-
-               /*
-                * check for SCSI ints in the same go and 
-                * eventually save an interrupt
-                */
-       }
-
-       if (dev->sc_flags & SBICF_INTR && stat & ISTR_INTS)
-               found += sbicintr(dev);
-       return(found);
-#endif
-       return(0);
-}
-
-
-int
-asc_dmanext(dev)
-       struct sbic_softc *dev;
-{
-       printf("asc_dmanext\n");
-#ifdef DDB
-       Debugger();
-#else
-       panic("Hit a brick wall\n");
-#endif
-#if 0
-       volatile struct sdmac *sdp;
-       int i, stat;
-
-       sdp = dev->sc_cregs;
-
-       if (dev->sc_cur > dev->sc_last) {
-               /* shouldn't happen !! */
-               printf("ahsc_dmanext at end !!!\n");
-               asc_dmastop(dev);
-               return(0);
-       }
-       if ((dev->sc_dmacmd & (CNTR_TCEN | CNTR_DDIR)) == 0) {
-                 /* 
-                  * only FLUSH if terminal count not enabled,
-                  * and reading from peripheral
-                  */
-               sdp->FLUSH = 1;
-               while ((sdp->ISTR & ISTR_FE_FLG) == 0)
-                       ;
-        }
-       /* 
-        * clear possible interrupt and stop dma
-        */
-       sdp->CINT = 1;  /* clear possible interrupt */
-       sdp->SP_DMA = 1;        /* stop dma */
-       sdp->CNTR = dev->sc_dmacmd;
-       sdp->ACR = (u_int)dev->sc_cur->dc_addr;
-       sdp->ST_DMA = 1;
-
-       dev->sc_tcnt = dev->sc_cur->dc_count << 1;
-       return(dev->sc_tcnt);
-#endif
-       return(0);
+       return 0;
 }
 
 void
@@ -428,10 +304,8 @@
 }
 
 void
-asc_scsi_request(chan, req, arg)
-       struct scsipi_channel *chan;
-       scsipi_adapter_req_t req;
-       void *arg;



Home | Main Index | Thread Index | Old Index