Some systems share a single window for I/O port resources across
multiple bridges. Prior to commit d79b6b8ec267, each bridge used its
own private rman meaning that multiple downstream devices could
allocate the same or overlapping I/O port resource ranges. Since most
systems only used firmware-assigned ranges for I/O port resources,
this worked ok in practice. After commit d79b6b8ec267, only the first
bridge was able to allocate the parent memory resource for the I/O
port resource range and other bridges were not able to allocate I/O
port resources to child devices.
Add a new quirk to handle this case. The device_t of the first bridge
that succesfully allocates a memory resource for an I/O port resource
range is saved in a global variable. For each subsequent bridge,
check if the new bridges I/O port resource ranges are identical to
those in the first bridge. If so, enable the new
PCIE_SHARED_IO_WINDOW quirk. When this quirk is active, attempts to
allocate an I/O port resource allocate from the rman in the first
bridge and request sub-mappings from the parent memory resource
allocated by the first bridge.
Reported by: imp
Fixes: d79b6b8ec267 pci_host_generic: Don't rewrite resource start address for translation