summaryrefslogtreecommitdiff
path: root/Kernel/PCI/DeviceController.cpp
blob: 5c974b818a1a3d3d03f3cba7363e1bd2c4a51990 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
 * Copyright (c) 2020, Liav A. <liavalb@hotmail.co.il>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#include <Kernel/PCI/DeviceController.h>

namespace Kernel {
namespace PCI {

DeviceController::DeviceController(Address address)
    : m_pci_address(address)
{
}

bool DeviceController::is_msi_capable() const
{
    for (auto capability : PCI::get_physical_id(pci_address()).capabilities()) {
        if (capability.id() == PCI_CAPABILITY_MSI)
            return true;
    }
    return false;
}
bool DeviceController::is_msix_capable() const
{
    for (auto capability : PCI::get_physical_id(pci_address()).capabilities()) {
        if (capability.id() == PCI_CAPABILITY_MSIX)
            return true;
    }
    return false;
}

void DeviceController::enable_pin_based_interrupts() const
{
    PCI::enable_interrupt_line(pci_address());
}
void DeviceController::disable_pin_based_interrupts() const
{
    PCI::disable_interrupt_line(pci_address());
}

void DeviceController::enable_message_signalled_interrupts()
{
    TODO();
}
void DeviceController::disable_message_signalled_interrupts()
{
    TODO();
}
void DeviceController::enable_extended_message_signalled_interrupts()
{
    TODO();
}
void DeviceController::disable_extended_message_signalled_interrupts()
{
    TODO();
}

}
}