Fix style of new ACPI code, reduce warnings

This commit is contained in:
Jeremy Soller
2017-03-19 09:34:54 -06:00
parent 643e1f6552
commit e726234bc6
4 changed files with 16 additions and 12 deletions

View File

@@ -30,9 +30,9 @@ const TRAMPOLINE: usize = 0x7E00;
const AP_STARTUP: usize = TRAMPOLINE + 512;
pub enum AcpiTable {
fadt(Fadt),
madt(Madt),
dmar(Dmar)
Fadt(Fadt),
Madt(Madt),
Dmar(Dmar)
}
pub fn init_sdt(sdt: &'static Sdt, active_table: &mut ActivePageTable) -> Option<AcpiTable> {
@@ -43,7 +43,7 @@ pub fn init_sdt(sdt: &'static Sdt, active_table: &mut ActivePageTable) -> Option
if let Some(fadt) = Fadt::new(sdt) {
println!(": {:#?}", fadt);
Some(AcpiTable::fadt(fadt))
Some(AcpiTable::Fadt(fadt))
} else if let Some(madt) = Madt::new(sdt) {
println!(": {:>08X}: {}", madt.local_address, madt.flags);
@@ -147,7 +147,7 @@ pub fn init_sdt(sdt: &'static Sdt, active_table: &mut ActivePageTable) -> Option
// Unmap trampoline
let result = active_table.unmap(trampoline_page);
result.flush(active_table);
Some(AcpiTable::madt(madt))
Some(AcpiTable::Madt(madt))
} else if let Some(dmar) = Dmar::new(sdt) {
println!(": {}: {}", dmar.addr_width, dmar.flags);
@@ -167,7 +167,7 @@ pub fn init_sdt(sdt: &'static Sdt, active_table: &mut ActivePageTable) -> Option
_ => ()
}
}
Some(AcpiTable::dmar(dmar))
Some(AcpiTable::Dmar(dmar))
} else {
println!(": Unknown");
None
@@ -179,7 +179,7 @@ pub unsafe fn init(active_table: &mut ActivePageTable) {
let start_addr = 0xE0000;
let end_addr = 0xFFFFF;
let mut theFADT: Option<Fadt> = None;
let mut fadt_opt: Option<Fadt> = None;
// Map all of the ACPI RSDP space
{
@@ -231,7 +231,7 @@ pub unsafe fn init(active_table: &mut ActivePageTable) {
// TODO: Eventually, save pointers to all tables containing pertinent information to other parts of
// the kernel
match init_sdt(sdt, active_table) {
Some(AcpiTable::fadt(fadt)) => theFADT = Some(fadt),
Some(AcpiTable::Fadt(fadt)) => fadt_opt = Some(fadt),
_ => drop_sdt(sdt, mapped, active_table)
}
}
@@ -243,7 +243,7 @@ pub unsafe fn init(active_table: &mut ActivePageTable) {
// TODO: Eventually, save pointers to all tables containing pertinent information to other parts of
// the kernel
match init_sdt(sdt, active_table) {
Some(AcpiTable::fadt(fadt)) => theFADT = Some(fadt),
Some(AcpiTable::Fadt(fadt)) => fadt_opt = Some(fadt),
_ => drop_sdt(sdt, mapped, active_table)
}
}
@@ -267,7 +267,7 @@ pub unsafe fn init(active_table: &mut ActivePageTable) {
}
}
if let Some(fadt) = theFADT {
if let Some(fadt) = fadt_opt {
ACPI_TABLE.lock().fadt = Some(fadt);
}
}

View File

@@ -127,6 +127,7 @@ impl Context {
}
}
#[allow(dead_code)]
#[repr(packed)]
pub struct SignalHandlerStack {
r11: usize,

View File

@@ -55,7 +55,7 @@ impl Rtc {
} else {
None
};
unsafe {
self.wait();
second = self.read(0) as usize;
@@ -79,7 +79,7 @@ impl Rtc {
day = cvt_bcd(day);
month = cvt_bcd(month);
year = cvt_bcd(year);
century = if let Some(century_reg) = century_register {
century = if century_register.is_some() {
cvt_bcd(century)
} else {
century

View File

@@ -1,5 +1,6 @@
//! Architecture support for x86_64
//#![deny(warnings)]
#![deny(unused_must_use)]
#![feature(asm)]
#![feature(concat_idents)]
@@ -148,6 +149,7 @@ macro_rules! interrupt {
};
}
#[allow(dead_code)]
#[repr(packed)]
pub struct InterruptStack {
fs: usize,
@@ -214,6 +216,7 @@ macro_rules! interrupt_stack {
};
}
#[allow(dead_code)]
#[repr(packed)]
pub struct InterruptErrorStack {
fs: usize,