Debug all driver activity to display:1, use format to avoid line splitting
This commit is contained in:
parent
d71081110e
commit
418149bb07
11 changed files with 43 additions and 70 deletions
|
@ -191,8 +191,8 @@ impl HbaPort {
|
|||
48
|
||||
};
|
||||
|
||||
println!(" + Serial: {} Firmware: {} Model: {} {}-bit LBA Size: {} MB",
|
||||
serial.trim(), firmware.trim(), model.trim(), lba_bits, sectors / 2048);
|
||||
print!("{}", format!(" + Serial: {} Firmware: {} Model: {} {}-bit LBA Size: {} MB\n",
|
||||
serial.trim(), firmware.trim(), model.trim(), lba_bits, sectors / 2048));
|
||||
|
||||
Some(sectors * 512)
|
||||
} else {
|
||||
|
@ -230,7 +230,7 @@ impl HbaPort {
|
|||
}
|
||||
|
||||
pub fn ata_dma(&mut self, block: u64, sectors: usize, write: bool, clb: &mut Dma<[HbaCmdHeader; 32]>, ctbas: &mut [Dma<HbaCmdTable>; 32], buf: &mut Dma<[u8; 256 * 512]>) -> Result<usize> {
|
||||
//println!("AHCI {:X} DMA BLOCK: {:X} SECTORS: {} WRITE: {}", (self as *mut HbaPort) as usize, block, sectors, write);
|
||||
//print!("{}", format!("AHCI {:X} DMA BLOCK: {:X} SECTORS: {} WRITE: {}\n", (self as *mut HbaPort) as usize, block, sectors, write));
|
||||
|
||||
assert!(sectors > 0 && sectors < 256);
|
||||
|
||||
|
@ -286,20 +286,20 @@ impl HbaPort {
|
|||
|
||||
while self.ci.readf(1 << slot) {
|
||||
if self.is.readf(HBA_PORT_IS_TFES) {
|
||||
println!("IS_TFES set in CI loop TFS {:X} SERR {:X}", self.tfd.read(), self.serr.read());
|
||||
print!("{}", format!("IS_TFES set in CI loop TFS {:X} SERR {:X}\n", self.tfd.read(), self.serr.read()));
|
||||
return Err(Error::new(EIO));
|
||||
}
|
||||
pause();
|
||||
}
|
||||
|
||||
if self.is.readf(HBA_PORT_IS_TFES) {
|
||||
println!("IS_TFES set after CI loop TFS {:X} SERR {:X}", self.tfd.read(), self.serr.read());
|
||||
print!("{}", format!("IS_TFES set after CI loop TFS {:X} SERR {:X}\n", self.tfd.read(), self.serr.read()));
|
||||
return Err(Error::new(EIO));
|
||||
}
|
||||
|
||||
Ok(sectors * 512)
|
||||
} else {
|
||||
println!("No Command Slots");
|
||||
print!("No Command Slots\n");
|
||||
Err(Error::new(EIO))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,21 +8,19 @@ pub mod fis;
|
|||
pub mod hba;
|
||||
|
||||
pub fn disks(base: usize, irq: u8) -> Vec<Disk> {
|
||||
println!(" + AHCI on: {:X} IRQ: {}", base as usize, irq);
|
||||
|
||||
let pi = unsafe { &mut *(base as *mut HbaMem) }.pi.read();
|
||||
let ret: Vec<Disk> = (0..32)
|
||||
.filter(|&i| pi & 1 << i as i32 == 1 << i as i32)
|
||||
.filter_map(|i| {
|
||||
let port = &mut unsafe { &mut *(base as *mut HbaMem) }.ports[i];
|
||||
let port_type = port.probe();
|
||||
println!("{}: {:?}", i, port_type);
|
||||
print!("{}", format!("{}: {:?}\n", i, port_type));
|
||||
match port_type {
|
||||
HbaPortType::SATA => {
|
||||
match Disk::new(i, port) {
|
||||
Ok(disk) => Some(disk),
|
||||
Err(err) => {
|
||||
println!("{}: {}", i, err);
|
||||
print!("{}", format!("{}: {}\n", i, err));
|
||||
None
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,8 @@ fn main() {
|
|||
let irq_str = args.next().expect("ahcid: no irq provided");
|
||||
let irq = irq_str.parse::<u8>().expect("ahcid: failed to parse irq");
|
||||
|
||||
print!("{}", format!(" + AHCI on: {:X} IRQ: {}\n", bar, irq));
|
||||
|
||||
thread::spawn(move || {
|
||||
unsafe {
|
||||
syscall::iopl(3).expect("ahcid: failed to get I/O permission");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue