From 44a888c39aa806441581c83012c30f885e9962c9 Mon Sep 17 00:00:00 2001 From: Mark Poliakov Date: Mon, 7 Aug 2023 10:28:04 +0300 Subject: [PATCH] aarch64: make kernel build --- src/arch/aarch64/mod.rs | 9 ++++++--- src/arch/aarch64/plat_qemu/mod.rs | 17 ++++++++++------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/arch/aarch64/mod.rs b/src/arch/aarch64/mod.rs index 0ddc263e..180dbdcf 100644 --- a/src/arch/aarch64/mod.rs +++ b/src/arch/aarch64/mod.rs @@ -108,6 +108,10 @@ impl Architecture for AArch64 { fn interrupt_mask() -> bool { DAIF.read(DAIF::I) != 0 } + + fn cpu_count() -> usize { + CPU_COUNT.load(Ordering::Acquire) + } } impl AArch64 { @@ -203,10 +207,9 @@ pub fn kernel_main(dtb_phys: usize) -> ! { AArch64::set_interrupt_mask(true); ARCHITECTURE.init_device_tree(dtb_phys); - PLATFORM.init_primary_debug_sink(); + PLATFORM.init_debug(); } - // Setup debugging functions - debug::init(); + debug::reset(); exception::init_exceptions(); diff --git a/src/arch/aarch64/plat_qemu/mod.rs b/src/arch/aarch64/plat_qemu/mod.rs index e7e4c9b4..ea019ec1 100644 --- a/src/arch/aarch64/plat_qemu/mod.rs +++ b/src/arch/aarch64/plat_qemu/mod.rs @@ -4,9 +4,10 @@ use abi::error::Error; use tock_registers::interfaces::Writeable; use crate::{ - debug::DebugSink, + arch::CpuMessage, + debug::{self, DebugSink, LogLevel}, device::{ - interrupt::{ExternalInterruptController, InterruptSource}, + interrupt::{ExternalInterruptController, InterruptSource, IpiDeliveryTarget}, platform::Platform, serial::pl011::Pl011, timer::TimestampSource, @@ -54,12 +55,9 @@ impl Platform for QemuPlatform { Ok(()) } - unsafe fn init_primary_debug_sink(&self) { + unsafe fn init_debug(&'static self) { self.pl011.init(()).ok(); - } - - fn primary_debug_sink(&self) -> Option<&dyn DebugSink> { - Some(&self.pl011) + debug::add_sink(&self.pl011, LogLevel::Debug); } fn interrupt_controller( @@ -75,6 +73,11 @@ impl Platform for QemuPlatform { fn timestamp_source(&self) -> &dyn TimestampSource { &self.local_timer } + + unsafe fn send_ipi(&self, target: IpiDeliveryTarget, _msg: CpuMessage) -> Result<(), Error> { + infoln!("TODO send ipi"); + loop {} + } } /// AArch64 "virt" platform