Commit 79df020c authored by Jeremy Soller's avatar Jeremy Soller

If an IRQ is not set, use IRQ #9

parent 390f04ba
#![deny(warnings)]
#![feature(asm)] #![feature(asm)]
#![feature(iterator_step_by)] #![feature(iterator_step_by)]
...@@ -97,9 +96,21 @@ fn handle_parsed_header(config: &Config, pci: &Pci, bus_num: u8, ...@@ -97,9 +96,21 @@ fn handle_parsed_header(config: &Config, pci: &Pci, bus_num: u8,
if let Some(ref args) = driver.command { if let Some(ref args) = driver.command {
// Enable bus mastering, memory space, and I/O space // Enable bus mastering, memory space, and I/O space
unsafe { unsafe {
let cmd = pci.read(bus_num, dev_num, func_num, 0x04); let mut data = pci.read(bus_num, dev_num, func_num, 0x04);
println!("PCI CMD: {:>02X}", cmd); data |= 7;
pci.write(bus_num, dev_num, func_num, 0x04, cmd | 7); pci.write(bus_num, dev_num, func_num, 0x04, data);
}
// Set IRQ line to 9 if not set
let mut irq;
unsafe {
let mut data = pci.read(bus_num, dev_num, func_num, 0x3C);
irq = (data & 0xFF) as u8;
if irq == 0xFF {
irq = 9;
}
data = (data & 0xFFFFFF00) | irq as u32;
pci.write(bus_num, dev_num, func_num, 0x3C, data);
} }
// TODO: find a better way to pass the header data down to the // TODO: find a better way to pass the header data down to the
...@@ -124,7 +135,7 @@ fn handle_parsed_header(config: &Config, pci: &Pci, bus_num: u8, ...@@ -124,7 +135,7 @@ fn handle_parsed_header(config: &Config, pci: &Pci, bus_num: u8,
format!("{}", header.get_bar(4)), format!("{}", header.get_bar(4)),
"$BAR5" if header.header_type() == PciHeaderType::GENERAL => "$BAR5" if header.header_type() == PciHeaderType::GENERAL =>
format!("{}", header.get_bar(5)), format!("{}", header.get_bar(5)),
"$IRQ" => format!("{}", header.interrupt_line()), "$IRQ" => format!("{}", irq),
"$VENID" => format!("{:>04X}", header.vendor_id()), "$VENID" => format!("{:>04X}", header.vendor_id()),
"$DEVID" => format!("{:>04X}", header.device_id()), "$DEVID" => format!("{:>04X}", header.device_id()),
_ => arg.clone() _ => arg.clone()
......
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