Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Report HW DMA capability and if the DMA tag limits it.



details:   https://anonhg.NetBSD.org/src/rev/3b4601309398
branches:  trunk
changeset: 1015614:3b4601309398
user:      skrll <skrll%NetBSD.org@localhost>
date:      Tue Oct 27 13:50:57 2020 +0000

description:
Report HW DMA capability and if the DMA tag limits it.

diffstat:

 sys/dev/acpi/xhci_acpi.c |  18 ++++++++++++------
 sys/dev/pci/xhci_pci.c   |  19 ++++++++++++++-----
 2 files changed, 26 insertions(+), 11 deletions(-)

diffs (81 lines):

diff -r 6e9dff70adc7 -r 3b4601309398 sys/dev/acpi/xhci_acpi.c
--- a/sys/dev/acpi/xhci_acpi.c  Tue Oct 27 13:46:33 2020 +0000
+++ b/sys/dev/acpi/xhci_acpi.c  Tue Oct 27 13:50:57 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xhci_acpi.c,v 1.8 2020/10/24 08:55:23 skrll Exp $ */
+/* $NetBSD: xhci_acpi.c,v 1.9 2020/10/27 13:50:57 skrll Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci_acpi.c,v 1.8 2020/10/24 08:55:23 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci_acpi.c,v 1.9 2020/10/27 13:50:57 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -129,11 +129,17 @@
        }
 
        hccparams = bus_space_read_4(sc->sc_iot, sc->sc_ioh, XHCI_HCCPARAMS);
-       if (XHCI_HCC_AC64(hccparams) && BUS_DMA_TAG_VALID(aa->aa_dmat64)) {
-               aprint_verbose_dev(self, "using 64-bit DMA\n");
-               sc->sc_bus.ub_dmatag = aa->aa_dmat64;
+       if (XHCI_HCC_AC64(hccparams)) {
+               aprint_verbose_dev(self, "64-bit DMA");
+               if (BUS_DMA_TAG_VALID(aa->aa_dmat64)) {
+                       aprint_verbose("\n");
+                       sc->sc_bus.ub_dmatag = aa->aa_dmat64;
+               } else {
+                       aprint_verbose(" - limited\n");
+                       sc->sc_bus.ub_dmatag = aa->aa_dmat;
+               }
        } else {
-               aprint_verbose_dev(self, "using 32-bit DMA\n");
+               aprint_verbose_dev(self, "32-bit DMA\n");
                sc->sc_bus.ub_dmatag = aa->aa_dmat;
        }
 
diff -r 6e9dff70adc7 -r 3b4601309398 sys/dev/pci/xhci_pci.c
--- a/sys/dev/pci/xhci_pci.c    Tue Oct 27 13:46:33 2020 +0000
+++ b/sys/dev/pci/xhci_pci.c    Tue Oct 27 13:50:57 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xhci_pci.c,v 1.24 2019/12/02 03:06:51 msaitoh Exp $    */
+/*     $NetBSD: xhci_pci.c,v 1.25 2020/10/27 13:50:57 skrll Exp $      */
 /*     OpenBSD: xhci_pci.c,v 1.4 2014/07/12 17:38:51 yuo Exp   */
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.24 2019/12/02 03:06:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.25 2020/10/27 13:50:57 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_xhci_pci.h"
@@ -193,10 +193,19 @@
 
        hccparams = bus_space_read_4(sc->sc_iot, sc->sc_ioh, XHCI_HCCPARAMS);
 
-       if (pci_dma64_available(pa) && (XHCI_HCC_AC64(hccparams) != 0))
-               sc->sc_bus.ub_dmatag = pa->pa_dmat64;
-       else
+       if (XHCI_HCC_AC64(hccparams) != 0) {
+               aprint_verbose_dev(self, "64-bit DMA");
+               if (pci_dma64_available(pa)) {
+                       sc->sc_bus.ub_dmatag = pa->pa_dmat64;
+                       aprint_verbose("\n");
+               } else {
+                       aprint_verbose(" - limited\n");
+                       sc->sc_bus.ub_dmatag = pa->pa_dmat;
+               }
+       } else {
+               aprint_verbose_dev(self, "32-bit DMA\n");
                sc->sc_bus.ub_dmatag = pa->pa_dmat;
+       }
 
        /* Enable the device. */
        pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG,



Home | Main Index | Thread Index | Old Index