summaryrefslogtreecommitdiff
path: root/Kernel/Interrupts/MSIHandler.h
blob: b4c1c2e6c0b9ddce76b6f67864c665401cbe2dee (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
/*
 * Copyright (c) 2020, Liav A. <liavalb@hotmail.co.il>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <AK/Types.h>
#include <Kernel/Arch/x86/CPU.h>
#include <Kernel/Interrupts/GenericInterruptHandler.h>
#include <Kernel/PCI/Definitions.h>

namespace Kernel {

class MSIHandler final : public GenericInterruptHandler {
public:
    virtual ~MSIHandler();

    virtual void handle_interrupt(RegisterState&) override { }

    void enable_irq();
    void disable_irq();

    virtual bool eoi() override;

    virtual size_t sharing_devices_count() const override { return 0; }
    virtual bool is_shared_handler() const override { return false; }
    virtual bool is_sharing_with_others() const override { return m_shared_with_others; }

protected:
    void change_irq_number(u8 irq);
    explicit MSIHandler(PCI::Address);

private:
    bool m_shared_with_others;
    bool m_enabled;
};
}