mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:07:44 +00:00
Kernel: Add simple implementation for InterruptManagement on aarch64
This class currently hardcodes the use of the Raspberry Pi interrupt controller.
This commit is contained in:
parent
5eac2b9f33
commit
c959344c00
4 changed files with 69 additions and 21 deletions
57
Kernel/Arch/aarch64/InterruptManagement.cpp
Normal file
57
Kernel/Arch/aarch64/InterruptManagement.cpp
Normal file
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* Copyright (c) 2020, Liav A. <liavalb@hotmail.co.il>
|
||||
* Copyright (c) 2022, Timon Kruiper <timonkruiper@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <Kernel/Arch/aarch64/InterruptManagement.h>
|
||||
#include <Kernel/Arch/aarch64/RPi/InterruptController.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
static InterruptManagement* s_interrupt_management;
|
||||
|
||||
bool InterruptManagement::initialized()
|
||||
{
|
||||
return s_interrupt_management != nullptr;
|
||||
}
|
||||
|
||||
InterruptManagement& InterruptManagement::the()
|
||||
{
|
||||
VERIFY(InterruptManagement::initialized());
|
||||
return *s_interrupt_management;
|
||||
}
|
||||
|
||||
void InterruptManagement::initialize()
|
||||
{
|
||||
VERIFY(!InterruptManagement::initialized());
|
||||
s_interrupt_management = new InterruptManagement;
|
||||
|
||||
the().find_controllers();
|
||||
}
|
||||
|
||||
void InterruptManagement::find_controllers()
|
||||
{
|
||||
// TODO: Once device tree support is in place, find interrupt controllers using that.
|
||||
m_interrupt_controllers.append(new RPi::InterruptController);
|
||||
}
|
||||
|
||||
u8 InterruptManagement::acquire_mapped_interrupt_number(u8 interrupt_number)
|
||||
{
|
||||
return interrupt_number;
|
||||
}
|
||||
|
||||
Vector<RefPtr<IRQController>> const& InterruptManagement::controllers()
|
||||
{
|
||||
return m_interrupt_controllers;
|
||||
}
|
||||
|
||||
RefPtr<IRQController> InterruptManagement::get_responsible_irq_controller(u8)
|
||||
{
|
||||
// TODO: Support more interrupt controllers
|
||||
VERIFY(m_interrupt_controllers.size() == 1);
|
||||
return m_interrupt_controllers[0];
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue