summaryrefslogtreecommitdiff
path: root/Kernel/Storage/IDEChannel.cpp
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2021-03-27 09:22:25 +0300
committerAndreas Kling <kling@serenityos.org>2021-03-27 16:40:16 +0100
commit8b446fb57979f4d184f50c6b6813801d354a974b (patch)
treeca7f7f7a04fdd058f37e00a1fda68beffd8e8f7d /Kernel/Storage/IDEChannel.cpp
parent833a6bd047e91b648c4d7c24ae518163df10b9f6 (diff)
downloadserenity-8b446fb57979f4d184f50c6b6813801d354a974b.zip
Kernel/Storage: Add support for non-bus mastering IDE controllers
Although unlikely to happen, a user can have an IDE controller that doesn't support bus master capability. If that's the case, we need to check for this, and create an IDEChannel (not BMIDEChannel) to allow IO operations with the controller.
Diffstat (limited to 'Kernel/Storage/IDEChannel.cpp')
-rw-r--r--Kernel/Storage/IDEChannel.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/Kernel/Storage/IDEChannel.cpp b/Kernel/Storage/IDEChannel.cpp
index 1fc4b9e36c..0ddbb787ea 100644
--- a/Kernel/Storage/IDEChannel.cpp
+++ b/Kernel/Storage/IDEChannel.cpp
@@ -71,7 +71,10 @@ UNMAP_AFTER_INIT IDEChannel::IDEChannel(const IDEController& controller, IOAddre
dbgln_if(PATA_DEBUG, "IDEChannel: {} IO base: {}", channel_type_string(), m_io_group.io_base());
dbgln_if(PATA_DEBUG, "IDEChannel: {} control base: {}", channel_type_string(), m_io_group.control_base());
- dbgln_if(PATA_DEBUG, "IDEChannel: {} bus master base: {}", channel_type_string(), m_io_group.bus_master_base());
+ if (m_io_group.bus_master_base().has_value())
+ dbgln_if(PATA_DEBUG, "IDEChannel: {} bus master base: {}", channel_type_string(), m_io_group.bus_master_base().value());
+ else
+ dbgln_if(PATA_DEBUG, "IDEChannel: {} bus master base disabled", channel_type_string());
m_parent_controller->enable_pin_based_interrupts();
detect_disks();
@@ -181,13 +184,6 @@ void IDEChannel::handle_irq(const RegisterState&)
m_entropy_source.add_random_event(status);
- u8 bstatus = m_io_group.bus_master_base().offset(2).in<u8>();
- if (!(bstatus & 0x4)) {
- // interrupt not from this device, ignore
- dbgln_if(PATA_DEBUG, "IDEChannel: ignore interrupt");
- return;
- }
-
ScopedSpinLock lock(m_request_lock);
dbgln_if(PATA_DEBUG, "IDEChannel: interrupt: DRQ={}, BSY={}, DRDY={}",
(status & ATA_SR_DRQ) != 0,