Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci wm: change one bus_dmamap_load_mbuf() to bus_dma...



details:   https://anonhg.NetBSD.org/src/rev/01e6836a6251
branches:  trunk
changeset: 457956:01e6836a6251
user:      tnn <tnn%NetBSD.org@localhost>
date:      Thu Jul 25 08:35:36 2019 +0000

description:
wm: change one bus_dmamap_load_mbuf() to bus_dmamap_load() equivalent

This makes wm work on aarch64, where the bus_dma implementation requires
the mbuf data pointer be immutable between bus_dmamap_load_mbuf and
bus_dmamap_sync. Fix suggested by thorpej@

diffstat:

 sys/dev/pci/if_wm.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (33 lines):

diff -r ad50f8fbb11d -r 01e6836a6251 sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Thu Jul 25 07:45:57 2019 +0000
+++ b/sys/dev/pci/if_wm.c       Thu Jul 25 08:35:36 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.642 2019/07/09 08:46:59 msaitoh Exp $      */
+/*     $NetBSD: if_wm.c,v 1.643 2019/07/25 08:35:36 tnn Exp $  */
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.642 2019/07/09 08:46:59 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.643 2019/07/25 08:35:36 tnn Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -5141,8 +5141,12 @@
        rxs->rxs_mbuf = m;
 
        m->m_len = m->m_pkthdr.len = m->m_ext.ext_size;
-       error = bus_dmamap_load_mbuf(sc->sc_dmat, rxs->rxs_dmamap, m,
-           BUS_DMA_READ | BUS_DMA_NOWAIT);
+       /*
+        * Cannot use bus_dmamap_load_mbuf() here because m_data may be
+        * sc_align_tweak'd between bus_dmamap_load() and bus_dmamap_sync().
+        */
+       error = bus_dmamap_load(sc->sc_dmat, rxs->rxs_dmamap, m->m_ext.ext_buf,
+           m->m_ext.ext_size, NULL, BUS_DMA_READ | BUS_DMA_NOWAIT);
        if (error) {
                /* XXX XXX XXX */
                aprint_error_dev(sc->sc_dev,



Home | Main Index | Thread Index | Old Index