diff options
author | Liav A <liavalb@gmail.com> | 2021-08-27 17:13:03 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-10-09 01:39:55 +0200 |
commit | 741c871bc1c6fd37cd2030ecec8bb3e90de31ede (patch) | |
tree | ddb3c47208dc8a1215be2ee74e1057c2f672c945 /Kernel/Storage/IDEController.cpp | |
parent | 9f501d7e71aabd60fd7e0157630595df89490041 (diff) | |
download | serenity-741c871bc1c6fd37cd2030ecec8bb3e90de31ede.zip |
Kernel/Storage: Unify all ATA devices
There's basically no real difference in software between a SATA harddisk
and IDE harddisk. The difference in the implementation is for the host
bus adapter protocol and registers layout.
Therefore, there's no point in putting a distinction in software to
these devices.
This change also greatly simplifies and removes stale APIs and removes
unnecessary parameters in constructor calls, which tighten things
further everywhere.
Diffstat (limited to 'Kernel/Storage/IDEController.cpp')
-rw-r--r-- | Kernel/Storage/IDEController.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/Kernel/Storage/IDEController.cpp b/Kernel/Storage/IDEController.cpp index 49c9188299..4566962813 100644 --- a/Kernel/Storage/IDEController.cpp +++ b/Kernel/Storage/IDEController.cpp @@ -10,9 +10,9 @@ #include <Kernel/Bus/PCI/API.h> #include <Kernel/FileSystem/ProcFS.h> #include <Kernel/Sections.h> +#include <Kernel/Storage/ATADiskDevice.h> #include <Kernel/Storage/BMIDEChannel.h> #include <Kernel/Storage/IDEController.h> -#include <Kernel/Storage/PATADiskDevice.h> namespace Kernel { @@ -41,8 +41,18 @@ size_t IDEController::devices_count() const return count; } -void IDEController::start_request(const StorageDevice&, AsyncBlockDeviceRequest&) +void IDEController::start_request(const ATADevice& device, AsyncBlockDeviceRequest& request) { + auto& address = device.ata_address(); + VERIFY(address.subport < 2); + switch (address.port) { + case 0: + m_channels[0].start_request(request, address.subport == 0 ? false : true, device.ata_capabilites()); + return; + case 1: + m_channels[1].start_request(request, address.subport == 0 ? false : true, device.ata_capabilites()); + return; + } VERIFY_NOT_REACHED(); } @@ -52,7 +62,7 @@ void IDEController::complete_current_request(AsyncDeviceRequest::RequestResult) } UNMAP_AFTER_INIT IDEController::IDEController(PCI::DeviceIdentifier const& device_identifier, bool force_pio) - : StorageController() + : ATAController() , PCI::Device(device_identifier.address()) , m_prog_if(device_identifier.prog_if()) , m_interrupt_line(device_identifier.interrupt_line()) |