Skip to content

Commit

Permalink
fdt: Support adjusting Info::pci_bar_memory()
Browse files Browse the repository at this point in the history
This allows systems using the FDT boot method to specify PCI BAR
memory space.

Signed-off-by: Rob Bradford <[email protected]>
  • Loading branch information
rbradford committed Mar 13, 2023
1 parent 38993ca commit 9b14cec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/fdt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pub struct StartInfo<'a> {
fdt: Fdt<'a>,
kernel_load_addr: u64,
memory_layout: &'static [MemoryDescriptor],
pci_bar_memory: Option<MemoryEntry>,
}

impl StartInfo<'_> {
Expand All @@ -22,6 +23,7 @@ impl StartInfo<'_> {
acpi_rsdp_addr: Option<u64>,
kernel_load_addr: u64,
memory_layout: &'static [MemoryDescriptor],
pci_bar_memory: Option<MemoryEntry>,
) -> Self {
let fdt = unsafe {
match Fdt::from_ptr(ptr) {
Expand All @@ -38,6 +40,7 @@ impl StartInfo<'_> {
acpi_rsdp_addr,
kernel_load_addr,
memory_layout,
pci_bar_memory,
}
}

Expand Down Expand Up @@ -94,4 +97,8 @@ impl Info for StartInfo<'_> {
fn memory_layout(&self) -> &'static [MemoryDescriptor] {
self.memory_layout
}

fn pci_bar_memory(&self) -> Option<MemoryEntry> {
self.pci_bar_memory
}
}
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ pub extern "C" fn rust64_start(x0: *const u8) -> ! {
Some(arch::aarch64::layout::map::dram::ACPI_START as u64),
arch::aarch64::layout::map::dram::KERNEL_START as u64,
&crate::arch::aarch64::layout::MEM_LAYOUT[..],
None,
);

if let Some((base, length)) = info.find_compatible_region(&["pci-host-ecam-generic"]) {
Expand Down

0 comments on commit 9b14cec

Please sign in to comment.