1use alloc::vec::Vec;
2use lazy_static::lazy_static;
3use spin::mutex::Mutex;
4
5pub const NUM_OF_CPU: usize = 8;
6pub const NUM_OF_CLUSTER: usize = 2;
7pub const NUM_OF_CPU_PER_CLUSTER: usize = NUM_OF_CPU / NUM_OF_CLUSTER;
8
9pub const PAGE_BITS: usize = 12;
10pub const PAGE_SIZE: usize = 1 << PAGE_BITS; pub const LARGE_PAGE_SIZE: usize = 1024 * 1024 * 2; pub const HUGE_PAGE_SIZE: usize = 1024 * 1024 * 1024; #[cfg(any(feature = "fvp", not(feature = "qemu")))]
15pub const MAX_DRAM_SIZE: usize = 0xFC00_0000; #[cfg(feature = "qemu")]
17pub const MAX_DRAM_SIZE: usize = 0x2_0000_0000; pub const RMM_STACK_GUARD_SIZE: usize = crate::granule::GRANULE_SIZE * 1;
20pub const RMM_STACK_SIZE: usize = 1024 * 1024 - RMM_STACK_GUARD_SIZE;
21pub const RMM_HEAP_SIZE: usize = 16 * 1024 * 1024;
22
23pub const VM_STACK_SIZE: usize = 1 << 15;
24pub const STACK_ALIGN: usize = 16;
25
26pub const SMCCC_1_3_SVE_HINT: usize = 1 << 16;
27
28#[derive(Debug, Default)]
29pub struct PlatformMemoryLayout {
30 pub rmm_base: u64,
31 pub rw_start: u64,
32 pub rw_end: u64,
33 pub stack_base: u64,
34 pub uart_phys: u64,
35 pub el3_shared_buf: u64,
36}
37
38lazy_static! {
39 pub static ref NS_DRAM_REGIONS: Mutex<Vec<core::ops::Range<usize>>> = Mutex::new(Vec::new());
40}
41
42pub fn is_ns_dram(addr: usize) -> bool {
43 let regions = NS_DRAM_REGIONS.lock();
44
45 for range in regions.iter() {
46 if range.contains(&addr) {
47 return true;
48 }
49 }
50
51 false
52}