diff --git a/src/arch/aarch64/layout.rs b/src/arch/aarch64/layout.rs index f4a1f388..84c13cdb 100644 --- a/src/arch/aarch64/layout.rs +++ b/src/arch/aarch64/layout.rs @@ -79,6 +79,10 @@ pub fn virt_mem_layout() -> &'static KernelVirtualLayout { &LAYOUT } +pub fn mmio_range() -> Range { + map::mmio::START..map::mmio::END +} + pub fn reserved_range() -> Range { map::dram::START..map::dram::KERNEL_START } @@ -95,9 +99,14 @@ pub fn stack_range() -> Range { 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 = [ + MemoryDescriptor { + name: "MMIO", + range: mmio_range, + attribute: MemoryAttribute::Mmio, + }, MemoryDescriptor { name: "Reserved", range: reserved_range, diff --git a/src/efi/mod.rs b/src/efi/mod.rs index ca61a94c..c4cf434a 100644 --- a/src/efi/mod.rs +++ b/src/efi/mod.rs @@ -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, @@ -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, diff --git a/src/layout.rs b/src/layout.rs index 65934a0d..282f47c3 100644 --- a/src/layout.rs +++ b/src/layout.rs @@ -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)]