diff --git a/Cargo.toml b/Cargo.toml index 88a2811890..386051c9f6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -53,7 +53,6 @@ default = [ #TODO: issues with Alder Lake and newer CPUs: #This may be because of mismatch between cpu id and apic id #"multi_core", - "graphical_debug", "serial_debug", "self_modifying", "x86_kvm_pv", @@ -64,7 +63,6 @@ default = [ self_modifying = [] acpi = [] -graphical_debug = [] lpss_debug = [] multi_core = ["acpi"] profiling = [] diff --git a/src/arch/aarch64/debug.rs b/src/arch/aarch64/debug.rs index 3f52618655..fc2f16dae5 100644 --- a/src/arch/aarch64/debug.rs +++ b/src/arch/aarch64/debug.rs @@ -1,16 +1,16 @@ use core::fmt; use spin::MutexGuard; -use crate::log::{Log, LOG}; +use crate::{ + devices::graphical_debug::{DebugDisplay, DEBUG_DISPLAY}, + log::{Log, LOG}, +}; #[cfg(feature = "serial_debug")] use super::device::serial::{SerialKind, COM1}; -#[cfg(feature = "graphical_debug")] -use crate::devices::graphical_debug::{DebugDisplay, DEBUG_DISPLAY}; pub struct Writer<'a> { log: MutexGuard<'a, Option>, - #[cfg(feature = "graphical_debug")] display: MutexGuard<'a, Option>, #[cfg(feature = "serial_debug")] serial: MutexGuard<'a, Option>, @@ -20,7 +20,6 @@ impl<'a> Writer<'a> { pub fn new() -> Writer<'a> { Writer { log: LOG.lock(), - #[cfg(feature = "graphical_debug")] display: DEBUG_DISPLAY.lock(), #[cfg(feature = "serial_debug")] serial: COM1.lock(), @@ -34,11 +33,8 @@ impl<'a> Writer<'a> { } } - #[cfg(feature = "graphical_debug")] - { - if let Some(ref mut display) = *self.display { - let _ = display.write(buf); - } + if let Some(ref mut display) = *self.display { + let _ = display.write(buf); } #[cfg(feature = "serial_debug")] diff --git a/src/arch/aarch64/start.rs b/src/arch/aarch64/start.rs index 854b41ea4f..406f38307f 100644 --- a/src/arch/aarch64/start.rs +++ b/src/arch/aarch64/start.rs @@ -5,16 +5,15 @@ use core::slice; use core::sync::atomic::{AtomicBool, AtomicU32, AtomicUsize, Ordering}; -#[cfg(feature = "graphical_debug")] -use crate::devices::graphical_debug; - use fdt::Fdt; use log::info; use crate::{ allocator, arch::interrupt, - device, dtb, + device, + devices::graphical_debug, + dtb, dtb::register_dev_memory_ranges, paging, startup::memory::{register_bootloader_areas, register_memory_region, BootloaderMemoryKind}, @@ -74,7 +73,6 @@ pub unsafe extern "C" fn kstart(args_ptr: *const KernelArgs) -> ! { ); // Set up graphical debug - #[cfg(feature = "graphical_debug")] graphical_debug::init(env); // Get hardware descriptor data @@ -201,7 +199,6 @@ pub unsafe extern "C" fn kstart(args_ptr: *const KernelArgs) -> ! { allocator::init(); // Set up double buffer for graphical debug now that heap is available - #[cfg(feature = "graphical_debug")] graphical_debug::init_heap(); // Activate memory logging diff --git a/src/arch/riscv64/debug.rs b/src/arch/riscv64/debug.rs index 0e6ea54933..6c0bd983f0 100644 --- a/src/arch/riscv64/debug.rs +++ b/src/arch/riscv64/debug.rs @@ -1,18 +1,17 @@ -use crate::log::{Log, LOG}; use core::fmt; use spin::MutexGuard; #[cfg(feature = "serial_debug")] use super::device::serial::{SerialPort, COM1}; - -#[cfg(feature = "graphical_debug")] -use crate::devices::graphical_debug::{DebugDisplay, DEBUG_DISPLAY}; +use crate::{ + devices::graphical_debug::{DebugDisplay, DEBUG_DISPLAY}, + log::{Log, LOG}, +}; pub struct Writer<'a> { log: MutexGuard<'a, Option>, #[cfg(feature = "serial_debug")] serial: MutexGuard<'a, Option>, - #[cfg(feature = "graphical_debug")] display: MutexGuard<'a, Option>, } @@ -20,7 +19,6 @@ impl<'a> Writer<'a> { pub fn new() -> Writer<'a> { Writer { log: LOG.lock(), - #[cfg(feature = "graphical_debug")] display: DEBUG_DISPLAY.lock(), #[cfg(feature = "serial_debug")] serial: COM1.lock(), @@ -34,11 +32,8 @@ impl<'a> Writer<'a> { } } - #[cfg(feature = "graphical_debug")] - { - if let Some(ref mut display) = *self.display { - let _ = display.write(buf); - } + if let Some(ref mut display) = *self.display { + let _ = display.write(buf); } #[cfg(feature = "serial_debug")] diff --git a/src/arch/riscv64/start.rs b/src/arch/riscv64/start.rs index bc02002de8..46d8ce6797 100644 --- a/src/arch/riscv64/start.rs +++ b/src/arch/riscv64/start.rs @@ -15,13 +15,11 @@ use crate::{ use crate::{ arch::{device::serial::init_early, interrupt, paging}, device, + devices::graphical_debug, + dtb::register_dev_memory_ranges, startup::memory::{register_bootloader_areas, register_memory_region, BootloaderMemoryKind}, }; -#[cfg(feature = "graphical_debug")] -use crate::devices::graphical_debug; -use crate::dtb::register_dev_memory_ranges; - /// Test of zero values in BSS. static mut BSS_TEST_ZERO: usize = 0; /// Test of non-zero values in data. @@ -101,7 +99,6 @@ pub unsafe extern "C" fn kstart(args_ptr: *const KernelArgs) -> ! { .map(|(base, size)| unsafe { slice::from_raw_parts(base as *const u8, size) }) .and_then(|data| Fdt::new(data).ok()); - #[cfg(feature = "graphical_debug")] graphical_debug::init(env); #[cfg(feature = "serial_debug")] diff --git a/src/arch/x86_shared/debug.rs b/src/arch/x86_shared/debug.rs index 576c22f56d..cac56ce74d 100644 --- a/src/arch/x86_shared/debug.rs +++ b/src/arch/x86_shared/debug.rs @@ -5,11 +5,14 @@ use spin::MutexGuard; #[cfg(any(feature = "lpss_debug", feature = "serial_debug"))] use crate::devices::uart_16550::SerialPort; -use crate::log::{Log, LOG}; #[cfg(feature = "lpss_debug")] use crate::syscall::io::Mmio; #[cfg(any(feature = "qemu_debug", feature = "serial_debug"))] use crate::syscall::io::Pio; +use crate::{ + devices::graphical_debug::{DebugDisplay, DEBUG_DISPLAY}, + log::{Log, LOG}, +}; #[cfg(feature = "qemu_debug")] use syscall::io::Io; @@ -19,15 +22,12 @@ use super::device::serial::COM1; use super::device::serial::LPSS; #[cfg(feature = "system76_ec_debug")] use super::device::system76_ec::{System76Ec, SYSTEM76_EC}; -#[cfg(feature = "graphical_debug")] -use crate::devices::graphical_debug::{DebugDisplay, DEBUG_DISPLAY}; #[cfg(feature = "qemu_debug")] pub static QEMU: Mutex> = Mutex::new(Pio::::new(0x402)); pub struct Writer<'a> { log: MutexGuard<'a, Option>, - #[cfg(feature = "graphical_debug")] display: MutexGuard<'a, Option>, #[cfg(feature = "lpss_debug")] lpss: MutexGuard<'a, Option<&'static mut SerialPort>>>, @@ -43,7 +43,6 @@ impl<'a> Writer<'a> { pub fn new() -> Writer<'a> { Writer { log: LOG.lock(), - #[cfg(feature = "graphical_debug")] display: DEBUG_DISPLAY.lock(), #[cfg(feature = "lpss_debug")] lpss: LPSS.lock(), @@ -63,11 +62,8 @@ impl<'a> Writer<'a> { } } - #[cfg(feature = "graphical_debug")] - { - if let Some(ref mut display) = *self.display { - display.write(buf); - } + if let Some(ref mut display) = *self.display { + display.write(buf); } #[cfg(feature = "lpss_debug")] diff --git a/src/arch/x86_shared/start.rs b/src/arch/x86_shared/start.rs index 471e644c31..2f5eee9b2f 100644 --- a/src/arch/x86_shared/start.rs +++ b/src/arch/x86_shared/start.rs @@ -13,12 +13,12 @@ use log::info; #[cfg(feature = "acpi")] use crate::acpi; -#[cfg(feature = "graphical_debug")] -use crate::devices::graphical_debug; use crate::{ allocator, cpu_set::LogicalCpuId, - device, gdt, idt, interrupt, + device, + devices::graphical_debug, + gdt, idt, interrupt, paging::{self, PhysicalAddress, RmmA, RmmArch, TableKind}, startup::memory::{register_bootloader_areas, register_memory_region, BootloaderMemoryKind}, }; @@ -91,7 +91,6 @@ pub unsafe extern "C" fn kstart(args_ptr: *const KernelArgs) -> ! { device::serial::init(); // Set up graphical debug - #[cfg(feature = "graphical_debug")] graphical_debug::init(env); #[cfg(feature = "system76_ec_debug")] @@ -209,7 +208,6 @@ pub unsafe extern "C" fn kstart(args_ptr: *const KernelArgs) -> ! { crate::profiling::init(); // Set up double buffer for graphical debug now that heap is available - #[cfg(feature = "graphical_debug")] graphical_debug::init_heap(); idt::init_paging_post_heap(LogicalCpuId::BSP); diff --git a/src/devices/mod.rs b/src/devices/mod.rs index 1b05f81225..8962174326 100644 --- a/src/devices/mod.rs +++ b/src/devices/mod.rs @@ -1,3 +1,2 @@ -#[cfg(feature = "graphical_debug")] pub mod graphical_debug; pub mod uart_16550; diff --git a/src/scheme/debug.rs b/src/scheme/debug.rs index b5f965c40f..bb3feea7c7 100644 --- a/src/scheme/debug.rs +++ b/src/scheme/debug.rs @@ -161,7 +161,6 @@ impl KernelScheme for DebugScheme { } if handle.num == SpecialFds::DisableGraphicalDebug as usize { - #[cfg(feature = "graphical_debug")] graphical_debug::fini(); return Ok(0); diff --git a/src/startup/memory.rs b/src/startup/memory.rs index ad00af4f4d..b987365580 100644 --- a/src/startup/memory.rs +++ b/src/startup/memory.rs @@ -362,7 +362,6 @@ unsafe fn map_memory(areas: &[MemoryArea], mut bump_allocator: &mut Bum } // Ensure graphical debug region remains paged - #[cfg(feature = "graphical_debug")] { use crate::devices::graphical_debug::FRAMEBUFFER;