1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 10:01:13 +09:00

Kernel: Expand PATA driver to support multiple hard drives (#365)

The previous implementation of the PIIX3/4 PATA/IDE channel driver only
supported a single drive, as the object model was wrong (the channel
inherits the IRQ, not the disk drive itself). This fixes it by 'attaching'
two `PATADiskDevices` to a `PATAChannel`, which makes more sense.

The reading/writing code is presented as is, which violates the spec
outlined by Seagate in the linked datasheet. That spec is rather old,
so it might not be 100% up to date, though may cause issues on real
hardware, so until we can actually test it, this will suffice.
This commit is contained in:
Jesse 2019-07-28 23:44:01 +10:00 committed by Andreas Kling
parent cf57d64481
commit 59e122f8ba
Notes: sideshowbarker 2024-07-19 13:00:57 +09:00
6 changed files with 442 additions and 239 deletions

View file

@ -1,3 +1,4 @@
#include "Devices/PATADiskDevice.h"
#include "KSyms.h"
#include "Process.h"
#include "RTC.h"
@ -13,13 +14,13 @@
#include <Kernel/Devices/DiskPartition.h>
#include <Kernel/Devices/FloppyDiskDevice.h>
#include <Kernel/Devices/FullDevice.h>
#include <Kernel/Devices/IDEDiskDevice.h>
#include <Kernel/Devices/KeyboardDevice.h>
#include <Kernel/Devices/MBRPartitionTable.h>
#include <Kernel/Devices/NullDevice.h>
#include <Kernel/Devices/PATAChannel.h>
#include <Kernel/Devices/PS2MouseDevice.h>
#include <Kernel/Devices/SB16.h>
#include <Kernel/Devices/RandomDevice.h>
#include <Kernel/Devices/SB16.h>
#include <Kernel/Devices/SerialDevice.h>
#include <Kernel/Devices/ZeroDevice.h>
#include <Kernel/FileSystem/DevPtsFS.h>
@ -68,9 +69,8 @@ VFS* vfs;
hang();
}
auto dev_hd0 = IDEDiskDevice::create(IDEDiskDevice::DriveType::MASTER);
NonnullRefPtr<DiskDevice> root_dev = dev_hd0;
auto pata0 = PATAChannel::create(PATAChannel::ChannelType::Primary);
NonnullRefPtr<DiskDevice> root_dev = *pata0->master_device();
root = root.substring(strlen("/dev/hda"), root.length() - strlen("/dev/hda"));