git: 332dbd3a2f08 - main - pci_host_generic: Pass a valid end address in generic_pcie_translate_resource

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Tue, 05 Mar 2024 04:53:42 UTC
The branch main has been updated by jhb:

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

commit 332dbd3a2f08a887014a425d2532af93503588ce
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-03-05 04:52:54 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-03-05 04:52:54 +0000

    pci_host_generic: Pass a valid end address in generic_pcie_translate_resource
    
    The generic_pcie_containing_range helper added in commit d79b6b8ec267
    assumed that the passed in (start, end) range used to locate the
    containing mapping range was a valid address range (with end >=
    start).  The previous version of
    generic_pcie_translate_resource_common only used the start address to
    locate a mapping range, so the end address of 0 did not matter, but an
    end of 0 now causes the first range to match and an incorrect
    translation for resources using a later range.
    
    PR:             277211
    Reported by:    dch, tuexen
    Reviewed by:    tuexen
    Fixes:          d79b6b8ec267 pci_host_generic: Don't rewrite resource start address for translation
    Differential Revision:  https://reviews.freebsd.org/D44205
---
 sys/dev/pci/pci_host_generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/pci/pci_host_generic.c b/sys/dev/pci/pci_host_generic.c
index 67b329b58685..0f85e23eb028 100644
--- a/sys/dev/pci/pci_host_generic.c
+++ b/sys/dev/pci/pci_host_generic.c
@@ -538,7 +538,7 @@ generic_pcie_translate_resource(device_t bus, int type,
 	rman_res_t newend; /* unused */
 
 	return (generic_pcie_translate_resource_common(
-	    bus, type, start, 0, newstart, &newend));
+	    bus, type, start, start, newstart, &newend));
 }
 
 struct resource *