Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Use BUS_ADDR_{LO,HI}32. NFCI.



details:   https://anonhg.NetBSD.org/src/rev/6d10256f7d88
branches:  trunk
changeset: 972144:6d10256f7d88
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sun May 17 08:35:15 2020 +0000

description:
Use BUS_ADDR_{LO,HI}32.  NFCI.

diffstat:

 sys/dev/usb/ehci.c |  25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)

diffs (60 lines):

diff -r 1d89826bb4c4 -r 6d10256f7d88 sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c        Sun May 17 06:30:44 2020 +0000
+++ b/sys/dev/usb/ehci.c        Sun May 17 08:35:15 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ehci.c,v 1.279 2020/05/15 06:15:42 skrll Exp $ */
+/*     $NetBSD: ehci.c,v 1.280 2020/05/17 08:35:15 skrll Exp $ */
 
 /*
  * Copyright (c) 2004-2012 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.279 2020/05/15 06:15:42 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.280 2020/05/17 08:35:15 skrll Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -3038,11 +3038,10 @@
                KASSERT(pages <= EHCI_QTD_NBUFFERS);
                size_t pageoffs = EHCI_PAGE(curoffs);
                for (size_t i = 0; i < pages; i++) {
-                       paddr_t a = DMAADDR(dma,
-                           pageoffs + i * EHCI_PAGE_SIZE);
-                       sqtd->qtd.qtd_buffer[i] = htole32(EHCI_PAGE(a));
-                       /* Cast up to avoid compiler warnings */
-                       sqtd->qtd.qtd_buffer_hi[i] = htole32((uint64_t)a >> 32);
+                       paddr_t a = EHCI_PAGE(DMAADDR(dma,
+                           pageoffs + i * EHCI_PAGE_SIZE));
+                       sqtd->qtd.qtd_buffer[i] = htole32(BUS_ADDR_LO32(a));
+                       sqtd->qtd.qtd_buffer_hi[i] = htole32(BUS_ADDR_HI32(a));
                        DPRINTF("      buffer[%jd/%jd] 0x%08jx 0x%08jx",
                            i, pages,
                            le32toh(sqtd->qtd.qtd_buffer_hi[i]),
@@ -3496,8 +3495,10 @@
            EHCI_QTD_SET_TOGGLE(0) |
            EHCI_QTD_SET_BYTES(sizeof(*req))
            );
-       setup->qtd.qtd_buffer[0] = htole32(DMAADDR(&epipe->ctrl.reqdma, 0));
-       setup->qtd.qtd_buffer_hi[0] = 0;
+
+       const bus_addr_t ba = DMAADDR(&epipe->ctrl.reqdma, 0);
+       setup->qtd.qtd_buffer[0] = htole32(BUS_ADDR_LO32(ba));
+       setup->qtd.qtd_buffer_hi[0] = htole32(BUS_ADDR_HI32(ba));
        setup->qtd.qtd_next = setup->qtd.qtd_altnext = htole32(next->physaddr);
        setup->nextqtd = next;
        setup->xfer = xfer;
@@ -3622,8 +3623,10 @@
            EHCI_QTD_SET_TOGGLE(0) |
            EHCI_QTD_SET_BYTES(sizeof(*req))
            );
-       setup->qtd.qtd_buffer[0] = htole32(DMAADDR(&epipe->ctrl.reqdma, 0));
-       setup->qtd.qtd_buffer_hi[0] = 0;
+
+       const bus_addr_t ba = DMAADDR(&epipe->ctrl.reqdma, 0);
+       setup->qtd.qtd_buffer[0] = htole32(BUS_ADDR_LO32(ba));
+       setup->qtd.qtd_buffer_hi[0] = htole32(BUS_ADDR_HI32(ba));
 
        next = status;
        status->qtd.qtd_status &= ~htole32(



Home | Main Index | Thread Index | Old Index