From 34e53e22b414cc905ad1abd914bf90f5f2a2a461 Mon Sep 17 00:00:00 2001 From: Jiajie Chen Date: Thu, 9 Jul 2020 12:40:50 +0800 Subject: [PATCH] Fix mipsel serial --- kernel/src/arch/mipsel/board/malta/device.dts | 2 -- kernel/src/arch/mipsel/interrupt/mod.rs | 24 ++++++------------- kernel/src/shell.rs | 4 ---- 3 files changed, 7 insertions(+), 23 deletions(-) diff --git a/kernel/src/arch/mipsel/board/malta/device.dts b/kernel/src/arch/mipsel/board/malta/device.dts index 328915d2..3e18aea1 100644 --- a/kernel/src/arch/mipsel/board/malta/device.dts +++ b/kernel/src/arch/mipsel/board/malta/device.dts @@ -30,8 +30,6 @@ reg = <0xbf000900 0x40>; reg-shift = <3>; clock-frequency = <1843200>; - /* The CBUS UART is attached to the MIPS CPU INT2 pin, ie interrupt 4 */ - interrupt-parent = <&cpu_intc>; interrupts = <4>; }; diff --git a/kernel/src/arch/mipsel/interrupt/mod.rs b/kernel/src/arch/mipsel/interrupt/mod.rs index aab5c339..43b47586 100644 --- a/kernel/src/arch/mipsel/interrupt/mod.rs +++ b/kernel/src/arch/mipsel/interrupt/mod.rs @@ -64,7 +64,7 @@ pub extern "C" fn trap_handler(tf: &mut TrapFrame) { let cause = cp0::cause::Cause { bits: tf.cause as u32, }; - debug!("Exception @ CPU{}: {:?} ", 0, cause.cause()); + trace!("Exception @ CPU{}: {:?} ", 0, cause.cause()); match cause.cause() { E::Interrupt => interrupt_dispatcher(tf), E::Syscall => syscall(tf), @@ -83,30 +83,20 @@ fn interrupt_dispatcher(tf: &mut TrapFrame) { bits: tf.cause as u32, }; let pint = cause.pending_interrupt(); - // trace!(" Interrupt {:08b} ", pint); + trace!(" Interrupt {:08b} ", pint); if (pint & 0b100_000_00) != 0 { timer(); } else if (pint & 0b011_111_00) != 0 { - external(); + for i in 0..6 { + if (pint & (1 << i)) != 0 { + IRQ_MANAGER.read().try_handle_interrupt(Some(i)); + } + } } else { ipi(); } } -fn external() { - // true means handled, false otherwise - let handlers = [try_process_drivers]; - for handler in handlers.iter() { - if handler() == true { - break; - } - } -} - -fn try_process_drivers() -> bool { - IRQ_MANAGER.read().try_handle_interrupt(None) -} - fn ipi() { debug!("IPI"); cp0::cause::reset_soft_int0(); diff --git a/kernel/src/shell.rs b/kernel/src/shell.rs index 095895a8..9798d32d 100644 --- a/kernel/src/shell.rs +++ b/kernel/src/shell.rs @@ -13,10 +13,6 @@ pub fn add_user_shell() { // This one can transfer env vars! // Why??? - #[cfg(target_arch = "mips")] - let init_shell = "/rust/sh"; //from docker-library - - #[cfg(not(target_arch = "mips"))] let init_shell = "/busybox"; //from docker-library #[cfg(target_arch = "x86_64")]