Skip to content

Commit

Permalink
[pci][fdt] do not attempt to configure PCI with 64bit bars on a 32bit…
Browse files Browse the repository at this point in the history
… system

Especially in the case where the 32bit system doesn't have an MMU, avoid
using any high addresses for BARs.
  • Loading branch information
travisg committed May 10, 2024
1 parent 5d8dd9c commit 2f98fbf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions dev/bus/pci/bus_mgr/resource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 4 additions & 2 deletions lib/fdtwalk/helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
}
Expand Down

0 comments on commit 2f98fbf

Please sign in to comment.