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