mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:07:35 +00:00
Kernel: Simplify force_pio logic in PATA driver (#923)
This commit is contained in:
parent
95034fdfbd
commit
0b3a868729
3 changed files with 17 additions and 14 deletions
|
@ -118,19 +118,23 @@ void PATAChannel::initialize(bool force_pio)
|
|||
kprintf("PATAChannel: PATA Controller found! id=%w:%w\n", id.vendor_id, id.device_id);
|
||||
}
|
||||
});
|
||||
m_force_pio.resource() = false;
|
||||
if (!m_pci_address.is_null()) {
|
||||
// Let's try to set up DMA transfers.
|
||||
PCI::enable_bus_mastering(m_pci_address);
|
||||
m_prdt.end_of_table = 0x8000;
|
||||
m_bus_master_base = PCI::get_BAR4(m_pci_address) & 0xfffc;
|
||||
m_dma_buffer_page = MM.allocate_supervisor_physical_page();
|
||||
kprintf("PATAChannel: Bus master IDE: I/O @ %x\n", m_bus_master_base);
|
||||
if (force_pio) {
|
||||
m_force_pio.resource() = true;
|
||||
kprintf("PATAChannel: Requested to force PIO mode!\n");
|
||||
}
|
||||
|
||||
if (m_pci_address.is_null()) {
|
||||
kprintf("PATAChannel: PCI address was null; can not set up DMA\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (force_pio) {
|
||||
kprintf("PATAChannel: Requested to force PIO mode; not setting up DMA\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// Let's try to set up DMA transfers.
|
||||
PCI::enable_bus_mastering(m_pci_address);
|
||||
m_prdt.end_of_table = 0x8000;
|
||||
m_bus_master_base = PCI::get_BAR4(m_pci_address) & 0xfffc;
|
||||
m_dma_buffer_page = MM.allocate_supervisor_physical_page();
|
||||
kprintf("PATAChannel: Bus master IDE: I/O @ %x\n", m_bus_master_base);
|
||||
}
|
||||
|
||||
static void print_ide_status(u8 status)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue