Skip to content

Commit

Permalink
aarch64/layout: Add MMIO range to memory layout
Browse files Browse the repository at this point in the history
Signed-off-by: Akira Moroo <retrage01@gmail.com>
  • Loading branch information
retrage committed Nov 7, 2023
1 parent 5c436c1 commit f34c82a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
11 changes: 10 additions & 1 deletion src/arch/aarch64/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ pub fn virt_mem_layout() -> &'static KernelVirtualLayout<NUM_MEM_RANGES> {
&LAYOUT
}

pub fn mmio_range() -> Range<usize> {
map::mmio::START..map::mmio::END
}

pub fn reserved_range() -> Range<usize> {
map::dram::START..map::dram::KERNEL_START
}
Expand All @@ -95,9 +99,14 @@ pub fn stack_range() -> Range<usize> {
unsafe { (stack_start.get() as _)..(stack_end.get() as _) }
}

const NUM_MEM_DESCS: usize = 4;
const NUM_MEM_DESCS: usize = 5;

pub static MEM_LAYOUT: MemoryLayout<NUM_MEM_DESCS> = [
MemoryDescriptor {
name: "MMIO",
range: mmio_range,
attribute: MemoryAttribute::Mmio,
},
MemoryDescriptor {
name: "Reserved",
range: reserved_range,
Expand Down
9 changes: 0 additions & 9 deletions src/efi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -995,15 +995,6 @@ fn populate_allocator(info: &dyn bootinfo::Info, image_address: u64, image_size:
);
}

// Add IO map for RTC PL031 on aarch64
#[cfg(target_arch = "aarch64")]
ALLOCATOR.borrow_mut().add_initial_allocation(
efi::MEMORY_MAPPED_IO,
1,
crate::arch::aarch64::layout::map::mmio::PL031_START as u64,
r_efi::efi::MEMORY_RUNTIME,
);

// Add the loaded binary
ALLOCATOR.borrow_mut().allocate_pages(
efi::ALLOCATE_ADDRESS,
Expand Down

0 comments on commit f34c82a

Please sign in to comment.