1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:47:45 +00:00

Kernel: Make IDEChannel Ref-counted

Technically not supported by the original ATA specification, IDE
hot swapping is still in practice possible, so the only sane way
to start support it is with ref-counting the IDEChannel object so if we
remove a PATADiskDevice, it's not gone with it.
This commit is contained in:
Liav A 2021-03-27 06:22:55 +03:00 committed by Andreas Kling
parent 531037db7e
commit dfb6b296cf
5 changed files with 11 additions and 9 deletions

View file

@ -60,7 +60,8 @@ struct PhysicalRegionDescriptor {
};
class IDEController;
class IDEChannel final : public IRQHandler {
class IDEChannel final : public RefCounted<IDEChannel>
, public IRQHandler {
friend class IDEController;
friend class PATADiskDevice;
AK_MAKE_ETERNAL
@ -104,8 +105,7 @@ public:
};
public:
static NonnullOwnPtr<IDEChannel> create(const IDEController&, IOAddressGroup, ChannelType type, bool force_pio);
IDEChannel(const IDEController&, IOAddressGroup, ChannelType type, bool force_pio);
static NonnullRefPtr<IDEChannel> create(const IDEController&, IOAddressGroup, ChannelType type, bool force_pio);
virtual ~IDEChannel() override;
RefPtr<StorageDevice> master_device() const;
@ -114,6 +114,8 @@ public:
virtual const char* purpose() const override { return "PATA Channel"; }
private:
IDEChannel(const IDEController&, IOAddressGroup, ChannelType type, bool force_pio);
//^ IRQHandler
virtual void handle_irq(const RegisterState&) override;