Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/acpi Use 64-bit DMA if available



details:   https://anonhg.NetBSD.org/src/rev/67c376a72813
branches:  trunk
changeset: 930866:67c376a72813
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Wed Apr 15 19:26:51 2020 +0000

description:
Use 64-bit DMA if available

diffstat:

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

diffs (50 lines):

diff -r f0d5913dcd3b -r 67c376a72813 sys/dev/acpi/ahcisata_acpi.c
--- a/sys/dev/acpi/ahcisata_acpi.c      Wed Apr 15 17:28:26 2020 +0000
+++ b/sys/dev/acpi/ahcisata_acpi.c      Wed Apr 15 19:26:51 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ahcisata_acpi.c,v 1.4 2018/11/16 23:18:17 jmcneill Exp $ */
+/* $NetBSD: ahcisata_acpi.c,v 1.5 2020/04/15 19:26:51 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_acpi.c,v 1.4 2018/11/16 23:18:17 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_acpi.c,v 1.5 2020/04/15 19:26:51 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -75,6 +75,7 @@
        struct acpi_mem *mem;
        struct acpi_irq *irq;
        ACPI_STATUS rv;
+       uint32_t cap;
        void *ih;
 
        rv = acpi_resource_parse(self, aa->aa_node->ad_handle, "_CRS",
@@ -95,7 +96,6 @@
        }
 
        sc->sc_atac.atac_dev = self;
-       sc->sc_dmat = aa->aa_dmat;
        sc->sc_ahcit = aa->aa_memt;
        sc->sc_ahcis = mem->ar_length;
        if (bus_space_map(aa->aa_memt, mem->ar_base, mem->ar_length, 0, &sc->sc_ahcih) != 0) {
@@ -103,6 +103,15 @@
                goto done;
        }
 
+       cap = AHCI_READ(sc, AHCI_CAP);
+       if ((cap & AHCI_CAP_64BIT) != 0 && BUS_DMA_TAG_VALID(aa->aa_dmat64)) {
+               aprint_verbose_dev(self, "using 64-bit DMA\n");
+               sc->sc_dmat = aa->aa_dmat64;
+       } else {
+               aprint_verbose_dev(self, "using 32-bit DMA\n");
+               sc->sc_dmat = aa->aa_dmat;
+       }
+
        ih = acpi_intr_establish(self, (uint64_t)aa->aa_node->ad_handle,
            IPL_BIO, false, ahci_intr, sc, device_xname(self));
        if (ih == NULL) {



Home | Main Index | Thread Index | Old Index