1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:48:10 +00:00

Revert "Kernel/Storage: Remove the ramdisk implementation"

This reverts commit 4e0f85432a as the
ramdisk code is useful for the bring-up of the aarch64 port. Once the
kernel supports better ram-based filesystems, this code will be removed
again.
This commit is contained in:
Timon Kruiper 2023-01-30 13:48:44 +01:00 committed by Linus Groh
parent 4d68dcfca0
commit 187723776a
9 changed files with 227 additions and 0 deletions

View file

@ -25,6 +25,7 @@
#include <Kernel/Storage/ATA/AHCI/Controller.h>
#include <Kernel/Storage/ATA/GenericIDE/Controller.h>
#include <Kernel/Storage/NVMe/NVMeController.h>
#include <Kernel/Storage/Ramdisk/Controller.h>
#include <Kernel/Storage/StorageManagement.h>
#include <LibPartition/EBRPartitionTable.h>
#include <LibPartition/GUIDPartitionTable.h>
@ -47,6 +48,7 @@ static constexpr StringView block_device_prefix = "block"sv;
static constexpr StringView ata_device_prefix = "ata"sv;
static constexpr StringView nvme_device_prefix = "nvme"sv;
static constexpr StringView ramdisk_device_prefix = "ramdisk"sv;
static constexpr StringView logical_unit_number_device_prefix = "lun"sv;
UNMAP_AFTER_INIT StorageManagement::StorageManagement()
@ -286,6 +288,13 @@ UNMAP_AFTER_INIT void StorageManagement::determine_nvme_boot_device()
});
}
UNMAP_AFTER_INIT void StorageManagement::determine_ramdisk_boot_device()
{
determine_hardware_relative_boot_device(ramdisk_device_prefix, [](StorageDevice const& device) -> bool {
return device.command_set() == StorageDevice::CommandSet::PlainMemory;
});
}
UNMAP_AFTER_INIT void StorageManagement::determine_block_boot_device()
{
VERIFY(m_boot_argument.starts_with(block_device_prefix));
@ -345,6 +354,11 @@ UNMAP_AFTER_INIT void StorageManagement::determine_boot_device()
return;
}
if (m_boot_argument.starts_with(ramdisk_device_prefix)) {
determine_ramdisk_boot_device();
return;
}
if (m_boot_argument.starts_with(nvme_device_prefix)) {
determine_nvme_boot_device();
return;
@ -428,6 +442,9 @@ UNMAP_AFTER_INIT void StorageManagement::initialize(StringView root_device, bool
} else {
enumerate_pci_controllers(force_pio, poll);
}
// Note: Whether PCI bus is present on the system or not, always try to attach
// a given ramdisk.
m_controllers.append(RamdiskController::initialize());
enumerate_storage_devices();
enumerate_disk_partitions();