diff options
author | Liav A <liavalb@gmail.com> | 2021-08-21 06:55:25 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-23 01:07:45 +0200 |
commit | 7b9c3439ec1d4d0c2122897fdfeb72fe52814d7a (patch) | |
tree | 96c1bf1a4ef695ba2f5d4308001cd372daf4dc84 /Kernel/Bus/PCI | |
parent | d071ce352c3fd9a6f21dc9c6e17626269ec15bc4 (diff) | |
download | serenity-7b9c3439ec1d4d0c2122897fdfeb72fe52814d7a.zip |
Kernel/PCI: Delete PCI::Device in its current form
I created this class a long time ago just to be able to quickly make a
PCI device to also represent an interrupt handler (because PCI devices
have this capability for most devices).
Then after a while I introduced the PCI::DeviceController, which is
really almost the same thing (a PCI device class that has Address member
in it), but is not tied to interrupts so it can have no interrupts, or
spawn interrupt handlers however it wants to seems fit.
However I decided it's time to say goodbye for this class for
a couple of reasons:
1. It made a whole bunch of weird patterns where you had a PCI::Device
and a PCI::DeviceController being used in the topic of implementation,
where originally, they meant to be used mutually exclusively (you
can't and really don't want to use both).
2. We can really make all the classes that inherit from PCI::Device
to inherit from IRQHandler at this point. Later on, when we have MSI
interrupts support, we can go further and untie things even more.
3. It makes it possible to simplify the VirtIO implementation to a great
extent. While this commit almost doesn't change it, future changes
can untangle some complexity in the VirtIO code.
For UHCIController, E1000NetworkAdapter, NE2000NetworkAdapter,
RTL8139NetworkAdapter, RTL8168NetworkAdapter, E1000ENetworkAdapter we
are simply making them to inherit the IRQHandler. This makes some sense,
because the first 3 devices will never support anything besides IRQs.
For the last 2, they might have MSI support, so when we start to utilize
those, we might need to untie these classes from IRQHandler and spawn
IRQHandler(s) or MSIHandler(s) as needed.
The VirtIODevice class is also a case where we currently need to use
both PCI::DeviceController and IRQHandler classes as parents, but it
could also be untied from the latter.
Diffstat (limited to 'Kernel/Bus/PCI')
-rw-r--r-- | Kernel/Bus/PCI/Definitions.h | 1 | ||||
-rw-r--r-- | Kernel/Bus/PCI/Device.cpp | 32 | ||||
-rw-r--r-- | Kernel/Bus/PCI/Device.h | 26 |
3 files changed, 0 insertions, 59 deletions
diff --git a/Kernel/Bus/PCI/Definitions.h b/Kernel/Bus/PCI/Definitions.h index ce12e56687..f3dd65507d 100644 --- a/Kernel/Bus/PCI/Definitions.h +++ b/Kernel/Bus/PCI/Definitions.h @@ -256,7 +256,6 @@ class WindowedMMIOAccess; class IOAccess; class MMIOSegment; class DeviceController; -class Device; } diff --git a/Kernel/Bus/PCI/Device.cpp b/Kernel/Bus/PCI/Device.cpp deleted file mode 100644 index ecb30d9c96..0000000000 --- a/Kernel/Bus/PCI/Device.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2020, Liav A. <liavalb@hotmail.co.il> - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include <Kernel/Bus/PCI/Device.h> - -namespace Kernel { -namespace PCI { - -Device::Device(Address address) - : IRQHandler(get_interrupt_line(address)) - , m_pci_address(address) -{ - // FIXME: Register PCI device somewhere... -} - -Device::Device(Address address, u8 interrupt_vector) - : IRQHandler(interrupt_vector) - , m_pci_address(address) -{ - // FIXME: Register PCI device somewhere... -} - -Device::~Device() -{ - // FIXME: Unregister the device -} - -} -} diff --git a/Kernel/Bus/PCI/Device.h b/Kernel/Bus/PCI/Device.h deleted file mode 100644 index a2fc714501..0000000000 --- a/Kernel/Bus/PCI/Device.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2020, Liav A. <liavalb@hotmail.co.il> - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#pragma once - -#include <AK/Types.h> -#include <Kernel/Bus/PCI/Definitions.h> -#include <Kernel/Interrupts/IRQHandler.h> - -namespace Kernel { -class PCI::Device : public IRQHandler { -public: - Address pci_address() const { return m_pci_address; }; - -protected: - Device(Address pci_address); - Device(Address pci_address, u8 interrupt_vector); - ~Device(); - -private: - Address m_pci_address; -}; -} |