| 
 | 1 | +//! Configuration and definitions for specific boards on aarch64 systems.  | 
 | 2 | +//!  | 
 | 3 | +//! | Board Name | Num CPUs  | Interrupt Controller | Secondary CPU Startup Method |  | 
 | 4 | +//! | ---------- | --------- | -------------------- | ---------------------------- |  | 
 | 5 | +//! | qemu_virt  | 4         | GICv3                | PSCI                         |  | 
 | 6 | +//!  | 
 | 7 | +
  | 
 | 8 | +#![no_std]  | 
 | 9 | +#![feature(const_trait_impl)]  | 
 | 10 | + | 
 | 11 | +cfg_if::cfg_if! {  | 
 | 12 | +if #[cfg(target_arch = "aarch64")] {  | 
 | 13 | + | 
 | 14 | +use memory_structs::PhysicalAddress;  | 
 | 15 | + | 
 | 16 | +#[derive(Debug, Copy, Clone)]  | 
 | 17 | +pub struct GicV3InterruptControllerConfig {  | 
 | 18 | +    pub distributor_base_address: PhysicalAddress,  | 
 | 19 | +    pub redistributor_base_addresses: [PhysicalAddress; board::NUM_CPUS],  | 
 | 20 | +}  | 
 | 21 | + | 
 | 22 | +#[derive(Debug, Copy, Clone)]  | 
 | 23 | +pub enum InterruptControllerConfig {  | 
 | 24 | +    GicV3(GicV3InterruptControllerConfig),  | 
 | 25 | +}  | 
 | 26 | + | 
 | 27 | +/*  | 
 | 28 | +TODO: multicore_bringup: wake secondary cores based on this:  | 
 | 29 | +pub enum SecondaryCoresStartup {  | 
 | 30 | +    Psci,  | 
 | 31 | +}  | 
 | 32 | +*/  | 
 | 33 | + | 
 | 34 | +#[derive(Debug, Clone)]  | 
 | 35 | +pub struct BoardConfig {  | 
 | 36 | +    pub cpu_ids: [mpidr::DefinedMpidrValue; board::NUM_CPUS],  | 
 | 37 | +    pub interrupt_controller: InterruptControllerConfig,  | 
 | 38 | +}  | 
 | 39 | + | 
 | 40 | +// by default & on x86_64, the default.rs file is used  | 
 | 41 | +#[cfg_attr(feature = "qemu_virt", path = "boards/qemu_virt.rs")]  | 
 | 42 | +#[cfg_attr(not(any(  | 
 | 43 | +    feature = "qemu_virt",  | 
 | 44 | +)), path = "boards/unselected.rs")]  | 
 | 45 | +mod board;  | 
 | 46 | + | 
 | 47 | +pub mod mpidr;  | 
 | 48 | + | 
 | 49 | +pub use board::{NUM_CPUS, BOARD_CONFIG};  | 
 | 50 | + | 
 | 51 | + | 
 | 52 | +} // end of cfg(target_arch = "aarch64")  | 
 | 53 | +} // end of cfg_if  | 
0 commit comments