diff options
author | Liav A <liavalb@gmail.com> | 2020-12-19 13:47:25 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-12-21 00:19:21 +0100 |
commit | e3b3805abfe0995c356920879a98de0aac57c987 (patch) | |
tree | 047d8a090e30ab6a0fe4fc95819e8e09fa1a0573 | |
parent | 28599af3873cb53a4b8c12415353231bfacea576 (diff) | |
download | serenity-e3b3805abfe0995c356920879a98de0aac57c987.zip |
Kernel: Add a method to check the type of a StorageController
Also, the device method in the StorageController class is public now.
-rw-r--r-- | Kernel/Storage/IDEController.h | 1 | ||||
-rw-r--r-- | Kernel/Storage/StorageController.h | 8 |
2 files changed, 8 insertions, 1 deletions
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<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; 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<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: |