2020-02-28 19:22:32 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020, Liav A. <liavalb@hotmail.co.il>
|
|
|
|
*
|
2021-04-22 11:24:48 +03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-02-28 19:22:32 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/OwnPtr.h>
|
|
|
|
#include <AK/Types.h>
|
2022-05-30 10:04:37 +03:00
|
|
|
#include <Kernel/Arch/IRQController.h>
|
2020-02-28 19:22:32 +03:00
|
|
|
#include <Kernel/Interrupts/GenericInterruptHandler.h>
|
|
|
|
|
|
|
|
namespace Kernel {
|
|
|
|
|
|
|
|
class SpuriousInterruptHandler final : public GenericInterruptHandler {
|
|
|
|
public:
|
|
|
|
static void initialize(u8 interrupt_number);
|
2022-01-28 19:18:14 +03:00
|
|
|
static void initialize_for_disabled_master_pic();
|
|
|
|
static void initialize_for_disabled_slave_pic();
|
2020-02-28 19:22:32 +03:00
|
|
|
virtual ~SpuriousInterruptHandler();
|
2022-04-01 20:58:27 +03:00
|
|
|
virtual bool handle_interrupt(RegisterState const& regs) override;
|
2020-02-28 19:22:32 +03:00
|
|
|
|
|
|
|
void register_handler(GenericInterruptHandler&);
|
|
|
|
void unregister_handler(GenericInterruptHandler&);
|
|
|
|
|
|
|
|
virtual bool eoi() override;
|
|
|
|
|
|
|
|
virtual size_t sharing_devices_count() const override { return 1; }
|
|
|
|
virtual bool is_shared_handler() const override { return false; }
|
|
|
|
|
2020-03-05 20:13:55 +03:00
|
|
|
virtual HandlerType type() const override { return HandlerType::SpuriousInterruptHandler; }
|
2021-07-11 02:46:09 +03:00
|
|
|
virtual StringView purpose() const override;
|
|
|
|
virtual StringView controller() const override;
|
2020-02-28 19:22:32 +03:00
|
|
|
|
2022-01-28 19:18:14 +03:00
|
|
|
void enable_interrupt_vector_for_disabled_pic();
|
|
|
|
|
2020-02-28 19:22:32 +03:00
|
|
|
private:
|
|
|
|
void enable_interrupt_vector();
|
|
|
|
void disable_interrupt_vector();
|
|
|
|
explicit SpuriousInterruptHandler(u8 interrupt_number);
|
2021-12-22 12:32:55 +03:00
|
|
|
bool m_enabled { false };
|
2020-12-19 09:49:15 +03:00
|
|
|
bool m_real_irq { false };
|
2022-09-25 15:25:14 +03:00
|
|
|
NonnullLockRefPtr<IRQController> m_responsible_irq_controller;
|
2020-02-28 19:22:32 +03:00
|
|
|
OwnPtr<GenericInterruptHandler> m_real_handler;
|
|
|
|
};
|
|
|
|
}
|