Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/acpi Conditionally use a 32- or 64-bit DMA tag based...



details:   https://anonhg.NetBSD.org/src/rev/e3d791feed2c
branches:  trunk
changeset: 452143:e3d791feed2c
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Wed Jun 19 13:40:23 2019 +0000

description:
Conditionally use a 32- or 64-bit DMA tag based on HCCPARAMS

diffstat:

 sys/dev/acpi/xhci_acpi.c |  15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diffs (50 lines):

diff -r b3356926e84d -r e3d791feed2c sys/dev/acpi/xhci_acpi.c
--- a/sys/dev/acpi/xhci_acpi.c  Wed Jun 19 13:39:18 2019 +0000
+++ b/sys/dev/acpi/xhci_acpi.c  Wed Jun 19 13:40:23 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xhci_acpi.c,v 1.3 2019/02/16 23:28:56 tron Exp $ */
+/* $NetBSD: xhci_acpi.c,v 1.4 2019/06/19 13:40:23 jmcneill 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.3 2019/02/16 23:28:56 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci_acpi.c,v 1.4 2019/06/19 13:40:23 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -89,6 +89,7 @@
        struct acpi_resources res;
        struct acpi_mem *mem;
        struct acpi_irq *irq;
+       uint32_t hccparams;
        ACPI_STATUS rv;
        int error;
        void *ih;
@@ -97,7 +98,6 @@
 
        sc->sc_dev = self;
        sc->sc_bus.ub_hcpriv = sc;
-       sc->sc_bus.ub_dmatag = aa->aa_dmat;
        sc->sc_bus.ub_revision = USBREV_3_0;
        sc->sc_quirks = 0;
        sc->sc_vendor_init = xhci_acpi_init;
@@ -127,6 +127,15 @@
                return;
        }
 
+       hccparams = bus_space_read_4(sc->sc_iot, sc->sc_ioh, XHCI_HCCPARAMS);
+       if (XHCI_HCC_AC64(hccparams)) {
+               aprint_verbose_dev(self, "using 64-bit DMA\n");
+               sc->sc_bus.ub_dmatag = aa->aa_dmat64;
+       } else {
+               aprint_verbose_dev(self, "using 32-bit DMA\n");
+               sc->sc_bus.ub_dmatag = aa->aa_dmat;
+       }
+
         ih = acpi_intr_establish(self, (uint64_t)aa->aa_node->ad_handle,
            IPL_USB, true, xhci_intr, sc, device_xname(self));
        if (ih == NULL) {



Home | Main Index | Thread Index | Old Index