Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
10 changes: 1 addition & 9 deletions src/efi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,7 @@ fn populate_allocator(info: &dyn bootinfo::Info, image_address: u64, image_size:
layout::MemoryAttribute::Code => efi::RUNTIME_SERVICES_CODE,
layout::MemoryAttribute::Data => efi::RUNTIME_SERVICES_DATA,
layout::MemoryAttribute::Unusable => efi::UNUSABLE_MEMORY,
layout::MemoryAttribute::Mmio => efi::MEMORY_MAPPED_IO,
};
ALLOCATOR.borrow_mut().allocate_pages(
efi::ALLOCATE_ADDRESS,
Expand All @@ -994,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
3 changes: 2 additions & 1 deletion src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@

use core::ops::Range;

#[allow(dead_code)]
#[derive(Clone, Copy)]
pub enum MemoryAttribute {
Code,
Data,
#[allow(dead_code)]
Unusable,
Mmio,
}

#[derive(Clone, Copy)]
Expand Down