Kernel: Add a method to check the type of a StorageController

Also, the device method in the StorageController class is public now.
This commit is contained in:
Liav A 2020-12-19 13:47:25 +02:00 committed by Andreas Kling
parent 28599af387
commit e3b3805abf
Notes: sideshowbarker 2024-07-19 00:42:17 +09:00
2 changed files with 8 additions and 1 deletions

View file

@ -44,6 +44,7 @@ public:
static NonnullRefPtr<IDEController> initialize(PCI::Address address, bool force_pio);
virtual ~IDEController() override;
virtual Type type() const override { return Type::IDE; }
virtual RefPtr<StorageDevice> device(u32 index) override;
virtual bool reset() override;
virtual bool shutdown() override;

View file

@ -46,13 +46,19 @@ class StorageController : public RefCounted<StorageController>
, public PCI::DeviceController {
AK_MAKE_ETERNAL
public:
enum class Type : u8 {
IDE,
NVMe
};
virtual Type type() const = 0;
virtual RefPtr<StorageDevice> device(u32 index) = 0;
protected:
explicit StorageController(PCI::Address address)
: PCI::DeviceController(address)
{
}
virtual RefPtr<StorageDevice> device(u32 index) = 0;
virtual void start_request(const StorageDevice&, AsyncBlockDeviceRequest&) = 0;
protected: