Serenity Operating System
at master 57 lines 1.2 kB view raw
1/* 2 * Copyright (c) 2020, Liav A. <liavalb@hotmail.co.il> 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7#include <AK/AnyOf.h> 8#include <Kernel/Bus/PCI/API.h> 9#include <Kernel/Bus/PCI/Device.h> 10 11namespace Kernel::PCI { 12 13Device::Device(DeviceIdentifier const& pci_identifier) 14 : m_pci_identifier(pci_identifier) 15{ 16} 17 18bool Device::is_msi_capable() const 19{ 20 return AK::any_of( 21 m_pci_identifier->capabilities(), 22 [](auto const& capability) { return capability.id().value() == PCI::Capabilities::ID::MSI; }); 23} 24bool Device::is_msix_capable() const 25{ 26 return AK::any_of( 27 m_pci_identifier->capabilities(), 28 [](auto const& capability) { return capability.id().value() == PCI::Capabilities::ID::MSIX; }); 29} 30 31void Device::enable_pin_based_interrupts() const 32{ 33 PCI::enable_interrupt_line(m_pci_identifier); 34} 35void Device::disable_pin_based_interrupts() const 36{ 37 PCI::disable_interrupt_line(m_pci_identifier); 38} 39 40void Device::enable_message_signalled_interrupts() 41{ 42 TODO(); 43} 44void Device::disable_message_signalled_interrupts() 45{ 46 TODO(); 47} 48void Device::enable_extended_message_signalled_interrupts() 49{ 50 TODO(); 51} 52void Device::disable_extended_message_signalled_interrupts() 53{ 54 TODO(); 55} 56 57}