Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci use pci_mapreg_type() instead of assuming PCI_MA...



details:   https://anonhg.NetBSD.org/src/rev/188178361671
branches:  trunk
changeset: 835825:188178361671
user:      mrg <mrg%NetBSD.org@localhost>
date:      Wed Sep 12 03:23:38 2018 +0000

description:
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.

diffstat:

 sys/dev/pci/hdaudio_pci.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (40 lines):

diff -r fbc3fa256e1a -r 188178361671 sys/dev/pci/hdaudio_pci.c
--- a/sys/dev/pci/hdaudio_pci.c Wed Sep 12 02:24:25 2018 +0000
+++ b/sys/dev/pci/hdaudio_pci.c Wed Sep 12 03:23:38 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudio_pci.c,v 1.8 2017/06/04 23:34:55 pgoyette Exp $ */
+/* $NetBSD: hdaudio_pci.c,v 1.9 2018/09/12 03:23:38 mrg Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd <support%precedence.co.uk@localhost>
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdaudio_pci.c,v 1.8 2017/06/04 23:34:55 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdaudio_pci.c,v 1.9 2018/09/12 03:23:38 mrg Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -107,8 +107,8 @@
        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 @@
        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,



Home | Main Index | Thread Index | Old Index