summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2020-12-19 13:47:25 +0200
committerAndreas Kling <kling@serenityos.org>2020-12-21 00:19:21 +0100
commite3b3805abfe0995c356920879a98de0aac57c987 (patch)
tree047d8a090e30ab6a0fe4fc95819e8e09fa1a0573
parent28599af3873cb53a4b8c12415353231bfacea576 (diff)
downloadserenity-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.h1
-rw-r--r--Kernel/Storage/StorageController.h8
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: