rustfmt
This commit is contained in:
parent
5befd11f8d
commit
700b8a4e00
6 changed files with 14 additions and 14 deletions
|
|
@ -1,6 +1,6 @@
|
|||
use super::{check_signature, ACPISDTHeader};
|
||||
use core::mem;
|
||||
use io::{Pio,Io};
|
||||
use io::{Io, Pio};
|
||||
|
||||
static mut DSDT: DSDT = DSDT {
|
||||
valid: false,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use super::{ACPISDTHeader, ACPISDTIter};
|
||||
use io::{Io,Pio};
|
||||
use io::{Io, Pio};
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Clone)]
|
||||
|
|
@ -131,7 +131,7 @@ pub fn is_enable() -> Result<bool, &'static str> {
|
|||
let pin: Pio<u16> = Pio::new(pm1_cnt[0]);
|
||||
if pm1_cnt[1] == 0 {
|
||||
Ok(pin.read() & 0x1 == 0x1)
|
||||
// Ok(cpuio::inw(pm1_cnt[0]) & 0x1 == 0x1)
|
||||
// Ok(cpuio::inw(pm1_cnt[0]) & 0x1 == 0x1)
|
||||
} else {
|
||||
let pin2: Pio<u8> = Pio::new(pm1_cnt[1]);
|
||||
Ok(pin.read() & 0x1 == 0x1 || pin2.read() & 0x1 == 0x1)
|
||||
|
|
@ -153,7 +153,10 @@ pub fn reboot() -> Result<(), &'static str> {
|
|||
Err("ACPI is not enabled")
|
||||
} else {
|
||||
let fadt = is_init()?;
|
||||
println!("fadt on {} ({}), value is {}", fadt.resetreg.address as u32, fadt.resetreg.address as u16, fadt.resetvalue);
|
||||
println!(
|
||||
"fadt on {} ({}), value is {}",
|
||||
fadt.resetreg.address as u32, fadt.resetreg.address as u16, fadt.resetvalue
|
||||
);
|
||||
let mut pin: Pio<u8> = Pio::new(fadt.resetreg.address as u16);
|
||||
pin.write(fadt.resetvalue);
|
||||
// cpuio::outb(fadt.resetreg.address as u16, fadt.resetvalue); //TODO do it work
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ pub fn shutdown() -> Result<(), &'static str> {
|
|||
/// This function need ACPI in v2
|
||||
pub fn reboot() -> Result<(), &'static str> {
|
||||
is_init()?;
|
||||
if unsafe {ACPI.v2} {
|
||||
if unsafe { ACPI.v2 } {
|
||||
fadt::reboot()
|
||||
} else {
|
||||
Err("ACPI reboot only available in ACPI v2+")
|
||||
|
|
|
|||
|
|
@ -61,11 +61,11 @@ fn help() -> Result<(), &'static str> {
|
|||
///
|
||||
fn reboot() -> ! {
|
||||
match acpi::reboot() {
|
||||
Err(msg) => println!("{}", msg),
|
||||
_ => println!("Unable to perform ACPI reboot."),
|
||||
Err(msg) => println!("{}", msg),
|
||||
_ => println!("Unable to perform ACPI reboot."),
|
||||
}
|
||||
flush!();
|
||||
unsafe {PS2.ps2_8042_reset()};// TODO unsafe
|
||||
unsafe { PS2.ps2_8042_reset() }; // TODO unsafe
|
||||
println!("Unable to perform 8042 reboot. Kernel will be halted");
|
||||
flush!();
|
||||
io::halt();
|
||||
|
|
@ -78,8 +78,8 @@ fn reboot() -> ! {
|
|||
///
|
||||
fn shutdown() -> ! {
|
||||
match acpi::shutdown() {
|
||||
Err(msg) => println!("{}", msg),
|
||||
_ => println!("Unable to perform ACPI shutdown. Kernel will be halted"),
|
||||
Err(msg) => println!("{}", msg),
|
||||
_ => println!("Unable to perform ACPI shutdown. Kernel will be halted"),
|
||||
}
|
||||
flush!();
|
||||
io::halt();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
extern crate core;
|
||||
|
||||
use vga;
|
||||
use io::{self,Pio,Io};
|
||||
use io::{self, Io, Pio};
|
||||
|
||||
const MAX_KEYS: usize = 59;
|
||||
const KEYMAP_US: [[u8; 2]; MAX_KEYS] = [
|
||||
|
|
@ -66,7 +66,6 @@ const KEYMAP_US: [[u8; 2]; MAX_KEYS] = [
|
|||
*b"\0\0",//capslock
|
||||
];
|
||||
|
||||
|
||||
pub static mut PS2: Ps2 = Ps2::new();
|
||||
|
||||
pub struct Ps2 {
|
||||
|
|
|
|||
|
|
@ -61,8 +61,6 @@ pub fn kmain() -> ! {
|
|||
// *(0xdead as *mut u32) = 42;
|
||||
// };
|
||||
|
||||
println!("tss: {:?}");
|
||||
|
||||
// vga is *not* cpu specific
|
||||
vga::init();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue