1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 18:35:07 +00:00
serenity/Kernel/Bus/PCI/Device.cpp
Pankaj Raghav d0fbaf790a Kernel: Add MSIxInfo struct to PCI DeviceIdentifier
Add a struct named MSIxInfo that stores all the relevant MSIx
information as a part of PCI DeviceIdentifier struct.

Populate the MSIx struct during the PCI device init. As the
DeviceIdentifier struct need to populate MSIx info, don't mark
DeviceIdentifier as const in the PCI::Device class.
2023-05-07 21:16:41 +02:00

58 lines
1.2 KiB
C++

/*
* Copyright (c) 2020, Liav A. <liavalb@hotmail.co.il>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/AnyOf.h>
#include <Kernel/Bus/PCI/API.h>
#include <Kernel/Bus/PCI/Device.h>
namespace Kernel::PCI {
Device::Device(DeviceIdentifier const& pci_identifier)
: m_pci_identifier(pci_identifier)
{
m_pci_identifier->initialize();
}
bool Device::is_msi_capable() const
{
return AK::any_of(
m_pci_identifier->capabilities(),
[](auto const& capability) { return capability.id().value() == PCI::Capabilities::ID::MSI; });
}
bool Device::is_msix_capable() const
{
return AK::any_of(
m_pci_identifier->capabilities(),
[](auto const& capability) { return capability.id().value() == PCI::Capabilities::ID::MSIX; });
}
void Device::enable_pin_based_interrupts() const
{
PCI::enable_interrupt_line(m_pci_identifier);
}
void Device::disable_pin_based_interrupts() const
{
PCI::disable_interrupt_line(m_pci_identifier);
}
void Device::enable_message_signalled_interrupts()
{
TODO();
}
void Device::disable_message_signalled_interrupts()
{
TODO();
}
void Device::enable_extended_message_signalled_interrupts()
{
TODO();
}
void Device::disable_extended_message_signalled_interrupts()
{
TODO();
}
}