git: d12f56486571 - stable/12 - pci_dw: fix outbound I/O window configuration

From: Marcin Wojtas <mw_at_FreeBSD.org>
Date: Thu, 14 Oct 2021 16:20:16 UTC
The branch stable/12 has been updated by mw:

URL: https://cgit.FreeBSD.org/src/commit/?id=d12f564865718e213e9d41aa493a3b6aa7faca60

commit d12f564865718e213e9d41aa493a3b6aa7faca60
Author:     Marcin Wojtas <mw@FreeBSD.org>
AuthorDate: 2021-04-06 12:31:39 +0000
Commit:     Marcin Wojtas <mw@FreeBSD.org>
CommitDate: 2021-10-14 16:16:33 +0000

    pci_dw: fix outbound I/O window configuration
    
    Use viewport "2" instead of "0" and change window type from MEM to IO.
    Without these changes the MEM ATU window can be overwritten with the IO one.
    
    Submitted by: Kornel Duleba <mindal@semihalf.com>
    Obtained from: Semihalf
    Sponsored by: Marvell
    Differential revision: https://reviews.freebsd.org/D29516
    
    (cherry picked from commit 57dbb3c25936f0d61fef152eb224ca86a73af0e9)
---
 sys/dev/pci/pci_dw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/pci/pci_dw.c b/sys/dev/pci/pci_dw.c
index 973a56239473..5baa2729493e 100644
--- a/sys/dev/pci/pci_dw.c
+++ b/sys/dev/pci/pci_dw.c
@@ -236,7 +236,7 @@ pci_dw_setup_hw(struct pci_dw_softc *sc)
 	/* If we have enouht viewports ..*/
 	if (sc->num_viewport >= 3 && sc->io_range.size != 0) {
 		/* Setup outbound I/O window */
-		rv = pci_dw_map_out_atu(sc, 0, IATU_CTRL1_TYPE_MEM,
+		rv = pci_dw_map_out_atu(sc, 2, IATU_CTRL1_TYPE_IO,
 		    sc->io_range.host, sc->io_range.pci, sc->io_range.size);
 		if (rv != 0)
 			return (rv);