diff options
| author | Patrick Rudolph <patrick.rudolph@9elements.com> | 2025-02-26 14:56:42 +0100 |
|---|---|---|
| committer | Tom Rini <trini@konsulko.com> | 2025-03-12 10:23:59 -0600 |
| commit | 699baa63ddcabe141adf3305d61f7b2a0d2de5db (patch) | |
| tree | 1089baa4dcf7023e30dc2548d2704f2d1856a7ef /drivers/pci/pci_auto.c | |
| parent | 57bbc4de75f6f6eb066462c777bf18cb8b8d4631 (diff) | |
pci_auto: Downgrade prefetch if necessary
Legacy PCI devices, like qemu's Bochs VGA device, are allowed to have
prefetchable 32-bit BARs, while PCIe devices are not allowed to have
32-bit prefetchable BARs. Typically prefetchable BARs are 64-bit and
typically the prefetch MMIO window is also 64-bit and placed above
4GiB, as it's the case on qemu sbsa-ref.
Currently the U-Boot code assumes that prefetchable BARs are
64-bit BARs and always tries to assign them into the prefetch
MMIO window.
When a 32-bit BAR is marked as prefetch, but the prefetch area is
not within the first 4GiB of the address space, then downgrade the
BAR and place it in the non-prefetch MMIO window.
For prefetch BARs there's no downside on being placed in non prefetch
MMIO areas, besides the possible slower performance when a driver tries
to map it Write-Combine.
TEST: Fixes pci_auto on QEMU sbsa-ref fails to autoconfigure BAR0.
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Diffstat (limited to 'drivers/pci/pci_auto.c')
| -rw-r--r-- | drivers/pci/pci_auto.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/pci/pci_auto.c b/drivers/pci/pci_auto.c index 90f81886445..e68e31a8227 100644 --- a/drivers/pci/pci_auto.c +++ b/drivers/pci/pci_auto.c @@ -107,7 +107,8 @@ static void dm_pciauto_setup_device(struct udevice *dev, } if (prefetch && - (bar_response & PCI_BASE_ADDRESS_MEM_PREFETCH)) + (bar_response & PCI_BASE_ADDRESS_MEM_PREFETCH) && + (found_mem64 || prefetch->bus_lower < 0x100000000ULL)) bar_res = prefetch; else bar_res = mem; |
