1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-18 21:25:07 +00:00

Kernel: Introduce the new Storage subsystem

This new subsystem is somewhat replacing the IDE disk code we had with a
new flexible design.

StorageDevice is a generic class that represent a generic storage
device. It is meant that specific storage hardware will override the
interface. StorageController is a generic class that represent
a storage controller that can be found in a machine.

The IDEController class governs two IDEChannels. An IDEChannel is
responsible to manage the master & slave devices of the channel,
therefore an IDEChannel is an IRQHandler.
This commit is contained in:
Liav A 2020-12-19 12:50:57 +02:00 committed by Andreas Kling
parent 39c1783387
commit 0a2b00a1bf
12 changed files with 604 additions and 213 deletions

View file

@ -40,8 +40,6 @@
#include <Kernel/Devices/MBRPartitionTable.h>
#include <Kernel/Devices/MBVGADevice.h>
#include <Kernel/Devices/NullDevice.h>
#include <Kernel/Devices/PATAChannel.h>
#include <Kernel/Devices/PATADiskDevice.h>
#include <Kernel/Devices/RandomDevice.h>
#include <Kernel/Devices/SB16.h>
#include <Kernel/Devices/SerialDevice.h>
@ -67,6 +65,8 @@
#include <Kernel/RTC.h>
#include <Kernel/Random.h>
#include <Kernel/Scheduler.h>
#include <Kernel/Storage/IDEController.h>
#include <Kernel/Storage/PATADiskDevice.h>
#include <Kernel/TTY/PTYMultiplexer.h>
#include <Kernel/TTY/VirtualConsole.h>
#include <Kernel/Tasks/FinalizerTask.h>
@ -276,8 +276,15 @@ void init_stage2(void*)
Processor::halt();
}
auto pata0 = PATAChannel::create(PATAChannel::ChannelType::Primary, force_pio);
NonnullRefPtr<BlockDevice> root_dev = *pata0->master_device();
RefPtr<BlockDevice> checked_root_dev;
PCI::enumerate([&](const PCI::Address& address, PCI::ID) {
if (PCI::get_class(address) == 0x1 && PCI::get_subclass(address) == 0x1) {
auto pata0 = IDEController::initialize(address, force_pio);
checked_root_dev = *pata0->device(0);
}
});
ASSERT(!checked_root_dev.is_null());
NonnullRefPtr<BlockDevice> root_dev = checked_root_dev.release_nonnull();
root = root.substring(strlen("/dev/hda"), root.length() - strlen("/dev/hda"));