mirror of
https://github.com/RGBCube/serenity
synced 2025-07-05 20:47:36 +00:00

This change is another minor step towards removing `AK::String` from the Kernel. Instead of dynamically allocating the storage_name we can instead allocate it via a KString in the factory for each device, and then push the device name down into the StorageDevice base class. We don't have a way of doing `AK::String::formatted(..)` with a KString at the moment, so cleaning that up will be left for a later day.
43 lines
1.1 KiB
C++
43 lines
1.1 KiB
C++
/*
|
|
* Copyright (c) 2021, Liav A. <liavalb@hotmail.co.il>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <Kernel/Interrupts/IRQHandler.h>
|
|
#include <Kernel/Locking/Mutex.h>
|
|
#include <Kernel/Storage/AHCIPort.h>
|
|
#include <Kernel/Storage/StorageDevice.h>
|
|
|
|
namespace Kernel {
|
|
|
|
class AHCIController;
|
|
class SATADiskDevice final : public StorageDevice {
|
|
friend class AHCIController;
|
|
friend class DeviceManagement;
|
|
|
|
public:
|
|
enum class InterfaceType : u8 {
|
|
SATA,
|
|
SATAPI,
|
|
};
|
|
|
|
public:
|
|
static NonnullRefPtr<SATADiskDevice> create(const AHCIController&, const AHCIPort&, size_t sector_size, u64 max_addressable_block);
|
|
virtual ~SATADiskDevice() override;
|
|
|
|
// ^StorageDevice
|
|
// ^BlockDevice
|
|
virtual void start_request(AsyncBlockDeviceRequest&) override;
|
|
|
|
private:
|
|
SATADiskDevice(const AHCIController&, const AHCIPort&, size_t sector_size, u64 max_addressable_block, int minor_device_number, NonnullOwnPtr<KString> device_name);
|
|
|
|
// ^DiskDevice
|
|
virtual StringView class_name() const override;
|
|
WeakPtr<AHCIPort> m_port;
|
|
};
|
|
|
|
}
|