diff options
author | Travis Geiselbrecht <geist@foobox.com> | 2024-05-09 22:15:27 -0700 |
---|---|---|
committer | Travis Geiselbrecht <geist@foobox.com> | 2024-05-09 22:18:19 -0700 |
commit | 2f98fbf772dc5a01d06bce8ca65511c86eb4c4f5 (patch) | |
tree | 3c0b9fddef9298840b55cff8a94addd5fc2556b0 | |
parent | 5d8dd9c36ae811f72b9aade36f5900beb7533599 (diff) | |
download | lk-2f98fbf772dc5a01d06bce8ca65511c86eb4c4f5.tar.gz |
[pci][fdt] do not attempt to configure PCI with 64bit bars on a 32bit system
Especially in the case where the 32bit system doesn't have an MMU, avoid
using any high addresses for BARs.
-rw-r--r-- | dev/bus/pci/bus_mgr/resource.cpp | 1 | ||||
-rw-r--r-- | lib/fdtwalk/helpers.cpp | 6 |
2 files changed, 5 insertions, 2 deletions
diff --git a/dev/bus/pci/bus_mgr/resource.cpp b/dev/bus/pci/bus_mgr/resource.cpp index 22470fbb..e862fd4b 100644 --- a/dev/bus/pci/bus_mgr/resource.cpp +++ b/dev/bus/pci/bus_mgr/resource.cpp @@ -71,6 +71,7 @@ status_t resource_allocator::allocate_mmio(bool can_be_64bit, bool prefetchable, return NO_ERROR; } + // after trying once to allocate in a 64bit range, drop to 32bit and try again if (can_be_64bit) { can_be_64bit = false; continue; diff --git a/lib/fdtwalk/helpers.cpp b/lib/fdtwalk/helpers.cpp index fae5c6c6..9254103c 100644 --- a/lib/fdtwalk/helpers.cpp +++ b/lib/fdtwalk/helpers.cpp @@ -249,8 +249,10 @@ status_t fdtwalk_setup_pci(const void *fdt) { if (pcie_info[i].mmio_len > 0) { pci_bus_mgr_add_resource(PCI_RESOURCE_MMIO_RANGE, pcie_info[i].mmio_base, pcie_info[i].mmio_len); } - if (pcie_info[i].mmio64_len > 0) { - pci_bus_mgr_add_resource(PCI_RESOURCE_MMIO64_RANGE, pcie_info[i].mmio64_base, pcie_info[i].mmio64_len); + if (sizeof(void *) >= 8) { + if (pcie_info[i].mmio64_len > 0) { + pci_bus_mgr_add_resource(PCI_RESOURCE_MMIO64_RANGE, pcie_info[i].mmio64_base, pcie_info[i].mmio64_len); + } } } } |