diff --git a/kernel/Makefile b/kernel/Makefile index 19d0c88..2ab9b70 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -49,20 +49,22 @@ user_dir := ../user ### export environments ### -export ARCH = $(arch) -export BOARD = $(board) -export SMP = $(smp) -export DTB = $(dtb) export SFSIMG = $(user_dir)/build/$(arch).qcow2 ifeq ($(arch), aarch64) board := raspi3 export SFSIMG = $(user_dir)/build/$(arch).img -else ifeq ($(arch), mipsel) -board := malta endif -dtb := src/arch/$(arch)/boot/dts/$(board).dtb +# currently only mipsel architecture needs DTB linked to the kernel +ifeq ($(arch), mipsel) +dtb := src/arch/$(arch)/board/$(board)/device.dtb +endif + +export ARCH = $(arch) +export BOARD = $(board) +export SMP = $(smp) +export DTB = $(dtb) ### qemu options ### diff --git a/kernel/src/arch/mipsel/boot/dts/malta.dts b/kernel/src/arch/mipsel/board/malta/device.dts similarity index 100% rename from kernel/src/arch/mipsel/boot/dts/malta.dts rename to kernel/src/arch/mipsel/board/malta/device.dts diff --git a/kernel/src/arch/mipsel/board/malta/fb.rs b/kernel/src/arch/mipsel/board/malta/fb.rs index 7023e5e..f466bfa 100644 --- a/kernel/src/arch/mipsel/board/malta/fb.rs +++ b/kernel/src/arch/mipsel/board/malta/fb.rs @@ -1,3 +1,7 @@ +//! stub frame buffer driver for malta board + +use spin::Mutex; + lazy_static! { pub static ref FRAME_BUFFER: Mutex> = Mutex::new(None); } diff --git a/kernel/src/arch/mipsel/board/malta/serial.rs b/kernel/src/arch/mipsel/board/malta/serial.rs index 2ee0a4e..b9b7fe0 100644 --- a/kernel/src/arch/mipsel/board/malta/serial.rs +++ b/kernel/src/arch/mipsel/board/malta/serial.rs @@ -1,5 +1,8 @@ +//! 16550 serial adapter driver for malta board + use core::fmt::{Write, Result, Arguments}; use core::ptr::{read_volatile, write_volatile}; +use spin::Mutex; struct SerialPort { base: usize @@ -7,7 +10,9 @@ struct SerialPort { impl SerialPort { fn new() -> SerialPort { - SerialPort { } + SerialPort { + base: 0 + } } pub fn init(&mut self, base: usize) { diff --git a/kernel/src/arch/mipsel/interrupt.rs b/kernel/src/arch/mipsel/interrupt.rs index b6957bf..f78657a 100644 --- a/kernel/src/arch/mipsel/interrupt.rs +++ b/kernel/src/arch/mipsel/interrupt.rs @@ -1,5 +1,5 @@ -use mips::interrupts::*; -use mips::registers::*; +use mips::interrupts; +use mips::registers::cp0; use crate::drivers::DRIVERS; pub use self::context::*; use log::*; diff --git a/kernel/src/arch/mipsel/io.rs b/kernel/src/arch/mipsel/io.rs index b184a57..2012a62 100644 --- a/kernel/src/arch/mipsel/io.rs +++ b/kernel/src/arch/mipsel/io.rs @@ -9,7 +9,7 @@ pub fn getchar() -> char { SERIAL_PORT.lock().getchar() } -pub fn getchar_option() -> Option { +pub fn getchar_option() -> Option { unsafe { SERIAL_PORT.force_unlock() } SERIAL_PORT.lock().getchar_option() } diff --git a/kernel/src/arch/mipsel/mod.rs b/kernel/src/arch/mipsel/mod.rs index ca51a72..e8c3fe0 100644 --- a/kernel/src/arch/mipsel/mod.rs +++ b/kernel/src/arch/mipsel/mod.rs @@ -11,7 +11,7 @@ pub mod rand; pub mod driver; use log::*; -use mips::registers; +use mips::registers::cp0; use mips::instructions; #[cfg(feature = "board_malta")]