Module Name:    src
Committed By:   martin
Date:           Sun Sep 23 17:22:52 UTC 2018

Modified Files:
        src/sys/dev/pci [netbsd-8]: hdaudio_pci.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1022):

        sys/dev/pci/hdaudio_pci.c: revision 1.9
        sys/dev/pci/hdaudio_pci.c: revision 1.10

use pci_mapreg_type() instead of assuming PCI_MAPREG_TYPE_MEM.
suggested by riastradh@.

fixes hdaudio on thinkpad P51 where the registers are mapped
over 4GB range.  probably fixes intel X10-based systems that
map hdaudio high as well, but i was able to work around that
in the BIOS.  not so for the P51.

XXX: pullup-7, pullup-8.

use pa_dmat64 if pci_dma64_available().


To generate a diff of this commit:
cvs rdiff -u -r1.7.2.1 -r1.7.2.2 src/sys/dev/pci/hdaudio_pci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/hdaudio_pci.c
diff -u src/sys/dev/pci/hdaudio_pci.c:1.7.2.1 src/sys/dev/pci/hdaudio_pci.c:1.7.2.2
--- src/sys/dev/pci/hdaudio_pci.c:1.7.2.1	Mon Jun  5 08:13:05 2017
+++ src/sys/dev/pci/hdaudio_pci.c	Sun Sep 23 17:22:51 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudio_pci.c,v 1.7.2.1 2017/06/05 08:13:05 snj Exp $ */
+/* $NetBSD: hdaudio_pci.c,v 1.7.2.2 2018/09/23 17:22:51 martin Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd <supp...@precedence.co.uk>
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdaudio_pci.c,v 1.7.2.1 2017/06/05 08:13:05 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdaudio_pci.c,v 1.7.2.2 2018/09/23 17:22:51 martin Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -107,8 +107,8 @@ hdaudio_pci_attach(device_t parent, devi
 	struct hdaudio_pci_softc *sc = device_private(self);
 	struct pci_attach_args *pa = opaque;
 	const char *intrstr;
-	pcireg_t csr;
-	int err;
+	pcireg_t csr, maptype;
+	int err, reg;
 	char intrbuf[PCI_INTRSTR_LEN];
 
 	aprint_naive("\n");
@@ -127,7 +127,9 @@ hdaudio_pci_attach(device_t parent, devi
 	pci_conf_write(sc->sc_pc, sc->sc_tag, PCI_COMMAND_STATUS_REG, csr);
 
 	/* Map MMIO registers */
-	err = pci_mapreg_map(pa, HDAUDIO_PCI_AZBARL, PCI_MAPREG_TYPE_MEM, 0,
+	reg = HDAUDIO_PCI_AZBARL;
+	maptype = pci_mapreg_type(sc->sc_pc, sc->sc_tag, reg);
+	err = pci_mapreg_map(pa, reg, maptype, 0,
 			     &sc->sc_hdaudio.sc_memt,
 			     &sc->sc_hdaudio.sc_memh,
 			     &sc->sc_hdaudio.sc_membase,
@@ -137,7 +139,10 @@ hdaudio_pci_attach(device_t parent, devi
 		return;
 	}
 	sc->sc_hdaudio.sc_memvalid = true;
-	sc->sc_hdaudio.sc_dmat = pa->pa_dmat;
+	if (pci_dma64_available(pa))
+		sc->sc_hdaudio.sc_dmat = pa->pa_dmat64;
+	else
+		sc->sc_hdaudio.sc_dmat = pa->pa_dmat;
 
 	/* Map interrupt and establish handler */
 	if (pci_intr_alloc(pa, &sc->sc_pihp, NULL, 0)) {

Reply via email to