Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Change DMAADDR macro slightly.



details:   https://anonhg.NetBSD.org/src/rev/60829bbd99a1
branches:  trunk
changeset: 531886:60829bbd99a1
user:      augustss <augustss%NetBSD.org@localhost>
date:      Tue May 28 12:42:38 2002 +0000

description:
Change DMAADDR macro slightly.

diffstat:

 sys/dev/usb/ehci.c    |  14 +++++++-------
 sys/dev/usb/ohci.c    |  24 ++++++++++++------------
 sys/dev/usb/uhci.c    |  18 +++++++++---------
 sys/dev/usb/usb_mem.h |   6 +++---
 4 files changed, 31 insertions(+), 31 deletions(-)

diffs (277 lines):

diff -r fbcb6d849cab -r 60829bbd99a1 sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c        Tue May 28 12:21:22 2002 +0000
+++ b/sys/dev/usb/ehci.c        Tue May 28 12:42:38 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ehci.c,v 1.30 2002/05/19 06:24:30 augustss Exp $       */
+/*     $NetBSD: ehci.c,v 1.31 2002/05/28 12:42:38 augustss Exp $       */
 
 /*
  * TODO
@@ -52,7 +52,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.30 2002/05/19 06:24:30 augustss Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.31 2002/05/28 12:42:38 augustss Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -899,7 +899,7 @@
 #if 0
 OOO
                /* Some broken BIOSes do not recover these values */
-               OWRITE4(sc, EHCI_HCCA, DMAADDR(&sc->sc_hccadma));
+               OWRITE4(sc, EHCI_HCCA, DMAADDR(&sc->sc_hccadma, 0));
                OWRITE4(sc, EHCI_CONTROL_HEAD_ED, sc->sc_ctrl_head->physaddr);
                OWRITE4(sc, EHCI_BULK_HEAD_ED, sc->sc_bulk_head->physaddr);
                if (sc->sc_intre)
@@ -1978,7 +1978,7 @@
                for(i = 0; i < EHCI_SQH_CHUNK; i++) {
                        offs = i * EHCI_SQH_SIZE;
                        sqh = KERNADDR(&dma, offs);
-                       sqh->physaddr = DMAADDR(&dma) + offs;
+                       sqh->physaddr = DMAADDR(&dma, offs);
                        sqh->next = sc->sc_freeqhs;
                        sc->sc_freeqhs = sqh;
                }
@@ -2020,7 +2020,7 @@
                for(i = 0; i < EHCI_SQTD_CHUNK; i++) {
                        offs = i * EHCI_SQTD_SIZE;
                        sqtd = KERNADDR(&dma, offs);
-                       sqtd->physaddr = DMAADDR(&dma) + offs;
+                       sqtd->physaddr = DMAADDR(&dma, offs);
                        sqtd->nextqtd = sc->sc_freeqtds;
                        sc->sc_freeqtds = sqtd;
                }
@@ -2064,7 +2064,7 @@
        DPRINTFN(alen<4*4096,("ehci_alloc_sqtd_chain: start len=%d\n", alen));
 
        len = alen;
-       dataphys = DMAADDR(dma);
+       dataphys = DMAADDR(dma, 0);
        dataphyslastpage = EHCI_PAGE(dataphys + len - 1);
        qtdstatus = htole32(
            EHCI_QTD_ACTIVE |
@@ -2512,7 +2512,7 @@
            EHCI_QTD_SET_CERR(3) |
            EHCI_QTD_SET_BYTES(sizeof *req)
            );
-       setup->qtd.qtd_buffer[0] = htole32(DMAADDR(&epipe->u.ctl.reqdma));
+       setup->qtd.qtd_buffer[0] = htole32(DMAADDR(&epipe->u.ctl.reqdma, 0));
        setup->nextqtd = next;
        setup->qtd.qtd_next = setup->qtd.qtd_altnext = htole32(next->physaddr);
        setup->xfer = xfer;
diff -r fbcb6d849cab -r 60829bbd99a1 sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c        Tue May 28 12:21:22 2002 +0000
+++ b/sys/dev/usb/ohci.c        Tue May 28 12:42:38 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ohci.c,v 1.124 2002/05/26 03:10:02 minoura Exp $       */
+/*     $NetBSD: ohci.c,v 1.125 2002/05/28 12:42:38 augustss Exp $      */
 /*     $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $       */
 
 /*
@@ -46,7 +46,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.124 2002/05/26 03:10:02 minoura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.125 2002/05/28 12:42:38 augustss Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -406,7 +406,7 @@
                for(i = 0; i < OHCI_SED_CHUNK; i++) {
                        offs = i * OHCI_SED_SIZE;
                        sed = KERNADDR(&dma, offs);
-                       sed->physaddr = DMAADDR(&dma) + offs;
+                       sed->physaddr = DMAADDR(&dma, offs);
                        sed->next = sc->sc_freeeds;
                        sc->sc_freeeds = sed;
                }
@@ -444,7 +444,7 @@
                for(i = 0; i < OHCI_STD_CHUNK; i++) {
                        offs = i * OHCI_STD_SIZE;
                        std = KERNADDR(&dma, offs);
-                       std->physaddr = DMAADDR(&dma) + offs;
+                       std->physaddr = DMAADDR(&dma, offs);
                        std->nexttd = sc->sc_freetds;
                        sc->sc_freetds = std;
                }
@@ -491,7 +491,7 @@
 
        len = alen;
        cur = sp;
-       dataphys = DMAADDR(dma);
+       dataphys = DMAADDR(dma, 0);
        dataphysend = OHCI_PAGE(dataphys + len - 1);
        tdflags = htole32(
            (rd ? OHCI_TD_IN : OHCI_TD_OUT) |
@@ -600,7 +600,7 @@
                for(i = 0; i < OHCI_SITD_CHUNK; i++) {
                        offs = i * OHCI_SITD_SIZE;
                        sitd = KERNADDR(&dma, offs);
-                       sitd->physaddr = DMAADDR(&dma) + offs;
+                       sitd->physaddr = DMAADDR(&dma, offs);
                        sitd->nextitd = sc->sc_freeitds;
                        sc->sc_freeitds = sitd;
                }
@@ -815,7 +815,7 @@
        /* The controller is now in SUSPEND state, we have 2ms to finish. */
 
        /* Set up HC registers. */
-       OWRITE4(sc, OHCI_HCCA, DMAADDR(&sc->sc_hccadma));
+       OWRITE4(sc, OHCI_HCCA, DMAADDR(&sc->sc_hccadma, 0));
        OWRITE4(sc, OHCI_CONTROL_HEAD_ED, sc->sc_ctrl_head->physaddr);
        OWRITE4(sc, OHCI_BULK_HEAD_ED, sc->sc_bulk_head->physaddr);
        /* disable all interrupts and then switch on all desired interrupts */
@@ -1003,7 +1003,7 @@
        case PWR_RESUME:
                sc->sc_bus.use_polling++;
                /* Some broken BIOSes do not recover these values */
-               OWRITE4(sc, OHCI_HCCA, DMAADDR(&sc->sc_hccadma));
+               OWRITE4(sc, OHCI_HCCA, DMAADDR(&sc->sc_hccadma, 0));
                OWRITE4(sc, OHCI_CONTROL_HEAD_ED, sc->sc_ctrl_head->physaddr);
                OWRITE4(sc, OHCI_BULK_HEAD_ED, sc->sc_bulk_head->physaddr);
                if (sc->sc_intre)
@@ -1456,7 +1456,7 @@
                        OHCI_TD_SET_DI(1) | OHCI_TD_TOGGLE_CARRY);
                if (xfer->flags & USBD_SHORT_XFER_OK)
                        data->td.td_flags |= htole32(OHCI_TD_R);
-               data->td.td_cbp = htole32(DMAADDR(&xfer->dmabuf));
+               data->td.td_cbp = htole32(DMAADDR(&xfer->dmabuf, 0));
                data->nexttd = tail;
                data->td.td_nexttd = htole32(tail->physaddr);
                data->td.td_be = htole32(le32toh(data->td.td_cbp) +
@@ -1652,7 +1652,7 @@
 
        setup->td.td_flags = htole32(OHCI_TD_SETUP | OHCI_TD_NOCC |
                                     OHCI_TD_TOGGLE_0 | OHCI_TD_NOINTR);
-       setup->td.td_cbp = htole32(DMAADDR(&opipe->u.ctl.reqdma));
+       setup->td.td_cbp = htole32(DMAADDR(&opipe->u.ctl.reqdma, 0));
        setup->nexttd = next;
        setup->td.td_nexttd = htole32(next->physaddr);
        setup->td.td_be = htole32(le32toh(setup->td.td_cbp) + sizeof *req - 1);
@@ -2946,7 +2946,7 @@
                OHCI_TD_SET_DI(1) | OHCI_TD_TOGGLE_CARRY);
        if (xfer->flags & USBD_SHORT_XFER_OK)
                data->td.td_flags |= htole32(OHCI_TD_R);
-       data->td.td_cbp = htole32(DMAADDR(&xfer->dmabuf));
+       data->td.td_cbp = htole32(DMAADDR(&xfer->dmabuf, 0));
        data->nexttd = tail;
        data->td.td_nexttd = htole32(tail->physaddr);
        data->td.td_be = htole32(le32toh(data->td.td_cbp) + len - 1);
@@ -3154,7 +3154,7 @@
        }
 
        sitd = opipe->tail.itd;
-       buf = DMAADDR(&xfer->dmabuf);
+       buf = DMAADDR(&xfer->dmabuf, 0);
        bp0 = OHCI_PAGE(buf);
        offs = OHCI_PAGE_OFFSET(buf);
        nframes = xfer->nframes;
diff -r fbcb6d849cab -r 60829bbd99a1 sys/dev/usb/uhci.c
--- a/sys/dev/usb/uhci.c        Tue May 28 12:21:22 2002 +0000
+++ b/sys/dev/usb/uhci.c        Tue May 28 12:42:38 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uhci.c,v 1.159 2002/05/19 06:24:32 augustss Exp $      */
+/*     $NetBSD: uhci.c,v 1.160 2002/05/28 12:42:39 augustss Exp $      */
 /*     $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $       */
 
 /*
@@ -49,7 +49,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.159 2002/05/19 06:24:32 augustss Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.160 2002/05/28 12:42:39 augustss Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -416,7 +416,7 @@
                return (err);
        sc->sc_pframes = KERNADDR(&sc->sc_dma, 0);
        UWRITE2(sc, UHCI_FRNUM, 0);             /* set frame number to 0 */
-       UWRITE4(sc, UHCI_FLBASEADDR, DMAADDR(&sc->sc_dma)); /* set frame list*/
+       UWRITE4(sc, UHCI_FLBASEADDR, DMAADDR(&sc->sc_dma, 0)); /* set frame list*/
 
        /*
         * Allocate a TD, inactive, that hangs from the last QH.
@@ -732,7 +732,7 @@
                        uhci_run(sc, 0); /* in case BIOS has started it */
 
                /* restore saved state */
-               UWRITE4(sc, UHCI_FLBASEADDR, DMAADDR(&sc->sc_dma));
+               UWRITE4(sc, UHCI_FLBASEADDR, DMAADDR(&sc->sc_dma, 0));
                UWRITE2(sc, UHCI_FRNUM, sc->sc_saved_frnum);
                UWRITE1(sc, UHCI_SOF, sc->sc_saved_sof);
 
@@ -1615,7 +1615,7 @@
                for(i = 0; i < UHCI_STD_CHUNK; i++) {
                        offs = i * UHCI_STD_SIZE;
                        std = KERNADDR(&dma, offs);
-                       std->physaddr = DMAADDR(&dma) + offs;
+                       std->physaddr = DMAADDR(&dma, offs);
                        std->link.std = sc->sc_freetds;
                        sc->sc_freetds = std;
                }
@@ -1658,7 +1658,7 @@
                for(i = 0; i < UHCI_SQH_CHUNK; i++) {
                        offs = i * UHCI_SQH_SIZE;
                        sqh = KERNADDR(&dma, offs);
-                       sqh->physaddr = DMAADDR(&dma) + offs;
+                       sqh->physaddr = DMAADDR(&dma, offs);
                        sqh->hlink = sc->sc_freeqhs;
                        sc->sc_freeqhs = sqh;
                }
@@ -1751,7 +1751,7 @@
                p->td.td_token =
                    htole32(rd ? UHCI_TD_IN (l, endpt, addr, tog) :
                                 UHCI_TD_OUT(l, endpt, addr, tog));
-               p->td.td_buffer = htole32(DMAADDR(dma) + i * maxp);
+               p->td.td_buffer = htole32(DMAADDR(dma, i * maxp));
                tog ^= 1;
        }
        *sp = lastp;
@@ -2199,7 +2199,7 @@
        setup->td.td_status = htole32(UHCI_TD_SET_ERRCNT(3) | ls |
                UHCI_TD_ACTIVE);
        setup->td.td_token = htole32(UHCI_TD_SETUP(sizeof *req, endpt, addr));
-       setup->td.td_buffer = htole32(DMAADDR(&upipe->u.ctl.reqdma));
+       setup->td.td_buffer = htole32(DMAADDR(&upipe->u.ctl.reqdma, 0));
 
        stat->link.std = NULL;
        stat->td.td_link = htole32(UHCI_PTR_T);
@@ -2339,7 +2339,7 @@
        xfer->status = USBD_IN_PROGRESS;
        UXFER(xfer)->curframe = next;
 
-       buf = DMAADDR(&xfer->dmabuf);
+       buf = DMAADDR(&xfer->dmabuf, 0);
        status = UHCI_TD_ZERO_ACTLEN(UHCI_TD_SET_ERRCNT(0) |
                                     UHCI_TD_ACTIVE |
                                     UHCI_TD_IOS);
diff -r fbcb6d849cab -r 60829bbd99a1 sys/dev/usb/usb_mem.h
--- a/sys/dev/usb/usb_mem.h     Tue May 28 12:21:22 2002 +0000
+++ b/sys/dev/usb/usb_mem.h     Tue May 28 12:42:38 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usb_mem.h,v 1.16 2002/05/19 06:24:33 augustss Exp $    */
+/*     $NetBSD: usb_mem.h,v 1.17 2002/05/28 12:42:39 augustss Exp $    */
 /*     $FreeBSD: src/sys/dev/usb/usb_mem.h,v 1.9 1999/11/17 22:33:47 n_hibma Exp $     */
 
 /*
@@ -51,7 +51,7 @@
        LIST_ENTRY(usb_dma_block) next;
 } usb_dma_block_t;
 
-#define DMAADDR(dma) ((dma)->block->map->dm_segs[0].ds_addr + (dma)->offs)
+#define DMAADDR(dma, o) ((dma)->block->map->dm_segs[0].ds_addr + (dma)->offs + (o))
 #define KERNADDR(dma, o) \
        ((void *)((char *)((dma)->block->kaddr + (dma)->offs) + (o)))
 
@@ -83,5 +83,5 @@
 #define DMAADDR(dma)   (vtophys(*(dma)))
 #endif
 #define KERNADDR(dma, o)       ((void *) ((char *)*(dma) + (o)))
-#endif
+#endif /* __FreeBSD__ */
 



Home | Main Index | Thread Index | Old Index