From e3b3805abfe0995c356920879a98de0aac57c987 Mon Sep 17 00:00:00 2001 From: Liav A Date: Sat, 19 Dec 2020 13:47:25 +0200 Subject: [PATCH] Kernel: Add a method to check the type of a StorageController Also, the device method in the StorageController class is public now. --- Kernel/Storage/IDEController.h | 1 + Kernel/Storage/StorageController.h | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Kernel/Storage/IDEController.h b/Kernel/Storage/IDEController.h index 757c8c5956..40ab04886a 100644 --- a/Kernel/Storage/IDEController.h +++ b/Kernel/Storage/IDEController.h @@ -44,6 +44,7 @@ public: static NonnullRefPtr initialize(PCI::Address address, bool force_pio); virtual ~IDEController() override; + virtual Type type() const override { return Type::IDE; } virtual RefPtr device(u32 index) override; virtual bool reset() override; virtual bool shutdown() override; diff --git a/Kernel/Storage/StorageController.h b/Kernel/Storage/StorageController.h index 9f01156b26..6dba3f21fe 100644 --- a/Kernel/Storage/StorageController.h +++ b/Kernel/Storage/StorageController.h @@ -46,13 +46,19 @@ class StorageController : public RefCounted , public PCI::DeviceController { AK_MAKE_ETERNAL public: + enum class Type : u8 { + IDE, + NVMe + }; + virtual Type type() const = 0; + virtual RefPtr device(u32 index) = 0; + protected: explicit StorageController(PCI::Address address) : PCI::DeviceController(address) { } - virtual RefPtr device(u32 index) = 0; virtual void start_request(const StorageDevice&, AsyncBlockDeviceRequest&) = 0; protected: