Unmask second disk controller's IRQ
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: Julien CLEMENT <julien.clement@epita.fr>
This commit is contained in:
Julien CLEMENT 2022-12-14 12:06:36 +01:00
parent 8e0fbfe263
commit b60ec92388
3 changed files with 14 additions and 10 deletions

@ -106,10 +106,7 @@ impl ATABus {
fn discover_atapi_drive() -> Option<Self> { fn discover_atapi_drive() -> Option<Self> {
let mut primary_bus = ATABus::new(ATA_BUS_PRIMARY); let mut primary_bus = ATABus::new(ATA_BUS_PRIMARY);
unsafe { primary_bus.software_reset();
primary_bus.dcr.write(ATA_SRST);
primary_bus.dcr.write(0);
}
primary_bus.select_drive(ATA_DRIVE_MASTER); primary_bus.select_drive(ATA_DRIVE_MASTER);
if primary_bus.is_atapi() { if primary_bus.is_atapi() {
@ -123,10 +120,7 @@ impl ATABus {
let mut secondary_bus = ATABus::new(ATA_BUS_SECONDARY); let mut secondary_bus = ATABus::new(ATA_BUS_SECONDARY);
unsafe { secondary_bus.software_reset();
secondary_bus.dcr.write(ATA_SRST);
primary_bus.dcr.write(0);
}
secondary_bus.select_drive(ATA_DRIVE_MASTER); secondary_bus.select_drive(ATA_DRIVE_MASTER);
if secondary_bus.is_atapi() { if secondary_bus.is_atapi() {
@ -140,6 +134,13 @@ impl ATABus {
None None
} }
fn software_reset(&mut self) {
unsafe {
self.dcr.write(ATA_SRST);
self.dcr.write(0);
}
}
fn new(port: u16) -> Self { fn new(port: u16) -> Self {
ATABus { ATABus {
base_port: port, base_port: port,

@ -21,4 +21,4 @@ pub extern "x86-interrupt" fn disk2_interrupt_handler(_stack_frame: InterruptSta
PICS.lock() PICS.lock()
.notify_end_of_interrupt(InterruptIndex::HardDisk2.as_u8()); .notify_end_of_interrupt(InterruptIndex::HardDisk2.as_u8());
} }
} }

@ -35,5 +35,8 @@ pub static PICS: spin::Mutex<ChainedPics> =
pub fn init_pic() { pub fn init_pic() {
println!("Initializing PIC"); println!("Initializing PIC");
unsafe { PICS.lock().initialize() }; unsafe {
PICS.lock().initialize();
PICS.lock().write_masks(0b10111000, 0b00001110);
};
} }