Clean up warnings
This commit is contained in:
@@ -6,8 +6,19 @@ fi
|
||||
|
||||
LLVM_DIR=$(llvm-config --bindir)
|
||||
ARCH=aarch64-unknown-none-${MACH}
|
||||
CARGO_ARGS="--target ../etc/aarch64-unknown-none-$MACH.json \
|
||||
--features mach_$MACH,fdt-rs"
|
||||
|
||||
set -e
|
||||
cd kernel && cargo build --target ../etc/aarch64-unknown-none-$MACH.json --features=mach_$MACH,fdt-rs
|
||||
|
||||
cd kernel
|
||||
case $1 in
|
||||
check)
|
||||
cargo check $CARGO_ARGS
|
||||
;;
|
||||
build|"")
|
||||
cargo build $CARGO_ARGS
|
||||
;;
|
||||
esac
|
||||
cd ..
|
||||
${LLVM_DIR}/llvm-objcopy -O binary target/${ARCH}/debug/kernel target/${ARCH}/debug/kernel.bin
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
use crate::{
|
||||
arch::{
|
||||
cpu,
|
||||
mach_bcm283x::mbox::CORE_MBOX0,
|
||||
mmio_read,
|
||||
},
|
||||
dev::irq::IrqRegisters,
|
||||
};
|
||||
|
||||
#[no_mangle]
|
||||
extern "C" fn do_fiq() {
|
||||
loop {}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
pub mod irq;
|
||||
pub mod mbox;
|
||||
pub mod smp;
|
||||
pub mod timer;
|
||||
@@ -33,7 +32,7 @@ impl InterruptController for Intc {
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn disable_irq(&self, irq: u32) {
|
||||
unsafe fn disable_irq(&self, _irq: u32) {
|
||||
todo!();
|
||||
}
|
||||
|
||||
@@ -41,7 +40,7 @@ impl InterruptController for Intc {
|
||||
unsafe { mmio_read(Self::REG_INT_SRC) & (1 << irq) != 0 }
|
||||
}
|
||||
|
||||
unsafe fn clear_irq(&self, irq: u32) {
|
||||
unsafe fn clear_irq(&self, _irq: u32) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
use crate::arch::{
|
||||
cpu, intrin, mmio_read, mmio_write,
|
||||
};
|
||||
|
||||
//pub struct CoreTimer;
|
||||
//pub struct SocTimer;
|
||||
//
|
||||
//impl CoreTimer {
|
||||
// const REG_PSC: usize = 0x40000008;
|
||||
// const REG_INTC: usize = 0x40000040;
|
||||
//
|
||||
// const INTC_CNTPNSIRQ_FIQ: u32 = 1 << 5;
|
||||
// const INTC_CNTPNSIRQ_IRQ: u32 = 1 << 1;
|
||||
//
|
||||
// const PRESCALER: u32 = 0x80000000;
|
||||
// const RELOAD_VALUE: usize = 1 << 18;
|
||||
//}
|
||||
//
|
||||
//impl LocalTimer for CoreTimer {
|
||||
// unsafe fn enable(mode: LocalTimerMode) {
|
||||
// let phys_core_id = cpu::get_phys_id();
|
||||
//
|
||||
// mmio_write(Self::REG_PSC + 4 * phys_core_id, Self::PRESCALER);
|
||||
// let tmp = mmio_read(Self::REG_INTC + 4 * phys_core_id);
|
||||
// let flags = match mode {
|
||||
// LocalTimerMode::Irq => Self::INTC_CNTPNSIRQ_IRQ,
|
||||
// LocalTimerMode::Fiq => Self::INTC_CNTPNSIRQ_FIQ,
|
||||
// };
|
||||
// mmio_write(Self::REG_INTC + 4 * phys_core_id, tmp | flags);
|
||||
//
|
||||
// intrin::write_cntp_ctl_el0(1);
|
||||
// }
|
||||
//
|
||||
// fn do_irq() {
|
||||
// local_tick();
|
||||
// Self::update(Self::RELOAD_VALUE);
|
||||
// }
|
||||
//
|
||||
// #[inline(always)]
|
||||
// fn update(value: usize) {
|
||||
// let current = intrin::read_cntp_cval_el0();
|
||||
// unsafe {
|
||||
// intrin::write_cntp_cval_el0(current + value);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//impl SocTimer {
|
||||
// const REG_CTL: usize = 0x40000034;
|
||||
// const REG_IRQ_RT: usize = 0x40000024;
|
||||
// const REG_IRQ_CLR: usize = 0x40000038;
|
||||
//
|
||||
// const CTL_TIMER_EN: u32 = 1 << 28;
|
||||
// const CTL_IRQ_EN: u32 = 1 << 29;
|
||||
// const IRQ_RT_IRQ0: u32 = 0;
|
||||
// const IRQ_CLR_VALUE: u32 = (1 << 31) | (1 << 30);
|
||||
//
|
||||
// const BASE_FREQ: u32 = 38400000;
|
||||
//
|
||||
// pub const fn new() -> Self {
|
||||
// Self {}
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//impl GlobalTimer for SocTimer {
|
||||
// unsafe fn enable(&self) {
|
||||
// let reload = Self::BASE_FREQ / (GLOBAL_TIMER_FREQ as u32);
|
||||
//
|
||||
// mmio_write(Self::REG_IRQ_RT, Self::IRQ_RT_IRQ0);
|
||||
// mmio_write(
|
||||
// Self::REG_CTL,
|
||||
// reload | Self::CTL_TIMER_EN | Self::CTL_IRQ_EN,
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// fn reset(&self) {
|
||||
// unsafe {
|
||||
// mmio_write(Self::REG_IRQ_CLR, Self::IRQ_CLR_VALUE);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// fn do_irq(&self) {
|
||||
// global_tick();
|
||||
// self.reset();
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
use crate::{
|
||||
arch::intrin,
|
||||
dev::irq::{IrqRegisters, GIC},
|
||||
};
|
||||
|
||||
#[no_mangle]
|
||||
extern "C" fn do_fiq(_regs: &mut IrqRegisters) {
|
||||
loop {}
|
||||
}
|
||||
@@ -1,4 +1,8 @@
|
||||
pub mod timer;
|
||||
pub mod irq;
|
||||
|
||||
use address::PhysicalAddress;
|
||||
|
||||
pub const IRQ_LOCAL_TIMER: u32 = 30;
|
||||
|
||||
pub const GICD_BASE: PhysicalAddress = PhysicalAddress::new(0x08000000usize);
|
||||
pub const GICC_BASE: PhysicalAddress = PhysicalAddress::new(0x08010000usize);
|
||||
|
||||
@@ -28,7 +28,7 @@ cfg_if! {
|
||||
|
||||
impl IpiDelivery for IpiDeliveryImpl {
|
||||
fn enable(&self) {}
|
||||
fn send_ipi(target_id: u32, message: IpiMessage) {}
|
||||
fn send_ipi(_target_id: u32, _message: IpiMessage) {}
|
||||
}
|
||||
|
||||
pub(super) fn cpu_ready(_index: usize) {}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
use core::sync::atomic::{AtomicU64, Ordering};
|
||||
use crate::{
|
||||
arch::{intrin, machine, smp::{self, IpiMessage}},
|
||||
arch::{intrin, machine},
|
||||
dev::irq::{self, InterruptController, InterruptHandler},
|
||||
};
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ vec_el1_sp_elx_fiq:
|
||||
__exc_save_ctx
|
||||
|
||||
mov x0, sp
|
||||
bl do_fiq
|
||||
b .
|
||||
|
||||
__exc_restore_ctx
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
use crate::arch::{intrin, machine};
|
||||
use alloc::collections::LinkedList;
|
||||
use address::PhysicalAddress;
|
||||
|
||||
#[repr(C)]
|
||||
pub struct IrqRegisters {
|
||||
@@ -46,7 +44,7 @@ pub trait InterruptHandler {
|
||||
|
||||
pub struct InterruptEntry {
|
||||
irq: u32,
|
||||
handler: &'static dyn InterruptHandler
|
||||
handler: &'static dyn InterruptHandler,
|
||||
}
|
||||
|
||||
static mut IRQ_HANDLERS: LinkedList<InterruptEntry> = LinkedList::new();
|
||||
@@ -66,9 +64,7 @@ extern "C" fn do_irq(_regs: &mut IrqRegisters) {
|
||||
|
||||
pub fn set_irq_handler(irq: u32, handler: &'static dyn InterruptHandler) {
|
||||
unsafe {
|
||||
IRQ_HANDLERS.push_front(InterruptEntry {
|
||||
irq, handler
|
||||
});
|
||||
IRQ_HANDLERS.push_front(InterruptEntry { irq, handler });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,10 +78,10 @@ cfg_if! {
|
||||
} else {
|
||||
pub mod gic;
|
||||
use gic::Gic;
|
||||
use crate::arch::machine;
|
||||
|
||||
pub static GIC: Gic = Gic::new(
|
||||
PhysicalAddress::new(0x08000000usize),
|
||||
PhysicalAddress::new(0x08010000usize),
|
||||
machine::GICD_BASE, machine::GICC_BASE
|
||||
);
|
||||
|
||||
pub fn get_intc() -> &'static impl InterruptController {
|
||||
|
||||
@@ -21,7 +21,7 @@ impl InterruptController for Gic {
|
||||
self.unmask_irq(irq);
|
||||
}
|
||||
|
||||
unsafe fn disable_irq(&self, irq: u32) {
|
||||
unsafe fn disable_irq(&self, _irq: u32) {
|
||||
todo!();
|
||||
}
|
||||
|
||||
|
||||
+4
-7
@@ -9,7 +9,7 @@ use address::{PhysicalAddress, VirtualAddress};
|
||||
use core::mem::MaybeUninit;
|
||||
use fdt_rs::{
|
||||
base::{DevTree, DevTreeProp},
|
||||
index::{DevTreeIndex, DevTreeIndexNode},
|
||||
index::DevTreeIndex,
|
||||
prelude::*,
|
||||
};
|
||||
|
||||
@@ -44,14 +44,11 @@ pub fn init(fdt_base_phys: PhysicalAddress) {
|
||||
debugln!("Allocating {} pages for fdt index", page_count);
|
||||
let pages = mem::phys::alloc_contiguous_pages(PageUsage::Kernel, page_count).unwrap();
|
||||
let pages_virt = VirtualAddress::<KernelSpace>::from(pages);
|
||||
let index = DevTreeIndex::new(fdt, unsafe {
|
||||
pages_virt.as_slice_mut(page_count * 0x1000)
|
||||
}).unwrap();
|
||||
let index =
|
||||
DevTreeIndex::new(fdt, unsafe { pages_virt.as_slice_mut(page_count * 0x1000) }).unwrap();
|
||||
|
||||
unsafe {
|
||||
FDT_MANAGER.write(FdtManager {
|
||||
fdt, index
|
||||
});
|
||||
FDT_MANAGER.write(FdtManager { fdt, index });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-7
@@ -10,11 +10,8 @@
|
||||
|
||||
#[macro_use]
|
||||
extern crate cfg_if;
|
||||
#[macro_use]
|
||||
extern crate alloc;
|
||||
|
||||
use alloc::boxed::Box;
|
||||
|
||||
#[macro_use]
|
||||
pub mod debug;
|
||||
|
||||
@@ -28,10 +25,7 @@ pub mod mem;
|
||||
pub use mem::KernelSpace;
|
||||
|
||||
use address::PhysicalAddress;
|
||||
use arch::{
|
||||
cpu::{self, Cpu},
|
||||
intrin, smp, timer,
|
||||
};
|
||||
use arch::{cpu, intrin, smp, timer};
|
||||
use dev::irq;
|
||||
|
||||
pub fn entry_common() -> ! {
|
||||
|
||||
Reference in New Issue
Block a user