Use null driver for unknown IRQ controllers on aarch64
This commit is contained in:
@@ -6,6 +6,7 @@ mod gic;
|
||||
mod gicv3;
|
||||
mod irq_bcm2835;
|
||||
mod irq_bcm2836;
|
||||
mod null;
|
||||
|
||||
pub(crate) fn new_irqchip(ic_str: &str) -> Option<Box<dyn InterruptController>> {
|
||||
if ic_str.contains("arm,gic-v3") {
|
||||
@@ -18,7 +19,8 @@ pub(crate) fn new_irqchip(ic_str: &str) -> Option<Box<dyn InterruptController>>
|
||||
Some(Box::new(irq_bcm2835::Bcm2835ArmInterruptController::new()))
|
||||
} else {
|
||||
log::warn!("no driver for interrupt controller {:?}", ic_str);
|
||||
None
|
||||
//TODO: return None and handle it properly
|
||||
Some(Box::new(null::Null))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
use fdt::Fdt;
|
||||
use syscall::{
|
||||
error::{Error, EINVAL},
|
||||
Result,
|
||||
};
|
||||
|
||||
use super::InterruptController;
|
||||
use crate::dtb::irqchip::{InterruptHandler, IrqDesc};
|
||||
|
||||
pub struct Null;
|
||||
|
||||
impl InterruptHandler for Null {
|
||||
fn irq_handler(&mut self, _irq: u32) {}
|
||||
}
|
||||
|
||||
impl InterruptController for Null {
|
||||
fn irq_init(
|
||||
&mut self,
|
||||
fdt: &Fdt,
|
||||
irq_desc: &mut [IrqDesc; 1024],
|
||||
ic_idx: usize,
|
||||
irq_idx: &mut usize,
|
||||
) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
fn irq_ack(&mut self) -> u32 {
|
||||
unimplemented!()
|
||||
}
|
||||
fn irq_eoi(&mut self, irq_num: u32) {
|
||||
}
|
||||
fn irq_enable(&mut self, irq_num: u32) {
|
||||
}
|
||||
fn irq_disable(&mut self, irq_num: u32) {
|
||||
}
|
||||
fn irq_xlate(&self, irq_data: &[u32; 3]) -> Result<usize> {
|
||||
Err(Error::new(EINVAL))
|
||||
}
|
||||
fn irq_to_virq(&self, hwirq: u32) -> Option<usize> {
|
||||
None
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user