Commit 545ec4d2 authored by Jeremy Soller's avatar Jeremy Soller

Add more debugging

parent 84a8a6c0
......@@ -6,9 +6,8 @@ use super::trb::Trb;
#[repr(packed)]
pub struct EventRingSte {
pub address: Mmio<u64>,
pub size: Mmio<u16>,
_rsvd: Mmio<u16>,
_rsvd2: Mmio<u32>,
pub size: Mmio<u32>,
_rsvd: Mmio<u32>,
}
pub struct EventRing {
......@@ -24,7 +23,7 @@ impl EventRing {
};
ring.ste.address.write(ring.trbs.physical() as u64);
ring.ste.size.write(ring.trbs.len() as u16);
ring.ste.size.write(ring.trbs.len() as u32);
Ok(ring)
}
......
......@@ -96,37 +96,40 @@ impl Xhci {
}
pub fn init(&mut self, max_slots: u8) {
println!(" - Set enabled slots");
// Set enabled slots
println!(" - Set enabled slots to {}", max_slots);
self.op.config.write(max_slots as u32);
println!(" - Enabled Slots: {}", self.op.config.read() & 0xFF);
println!(" - Write DCBAAP");
// Set device context address array pointer
println!(" - Write DCBAAP");
self.op.dcbaap.write(self.devices.dcbaap());
println!(" - Write CRCR");
// Set command ring control register
println!(" - Write CRCR");
self.op.crcr.write(self.cmd.crcr());
println!(" - Write ERST");
// Set event ring segment table registers
println!(" - Interrupter 0: {:X}", self.run.ints.as_ptr() as usize);
println!(" - Write ERSTZ");
self.run.ints[0].erstsz.write(1);
println!(" - Write ERSTBA: {:X}", self.cmd.events.ste.physical() as u64);
self.run.ints[0].erstba.write(self.cmd.events.ste.physical() as u64);
println!(" - Write ERDP");
self.run.ints[0].erdp.write(self.cmd.events.trbs.physical() as u64);
println!(" - Start");
// Set run/stop to 1
println!(" - Start");
self.op.usb_cmd.writef(1, true);
println!(" - Wait for running");
// Wait until controller is running
println!(" - Wait for running");
while self.op.usb_sts.readf(1) {
println!(" - Waiting for XHCI running");
}
println!(" - Ring doorbell");
// Ring command doorbell
println!(" - Ring doorbell");
self.dbs[0].write(0);
println!(" - XHCI initialized");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment