mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-09 04:37:52 +03: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
Notes:
sideshowbarker
2024-07-17 10:30:40 +09:00
Author: https://github.com/FireFox317 Commit: https://github.com/SerenityOS/serenity/commit/c959344c00 Pull-request: https://github.com/SerenityOS/serenity/pull/14146 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/BertalanD Reviewed-by: https://github.com/Hendiadyoin1 Reviewed-by: https://github.com/nico ✅
@ -7,7 +7,6 @@
|
||||
#include <AK/Singleton.h>
|
||||
#include <AK/Types.h>
|
||||
|
||||
#include <Kernel/Arch/aarch64/InterruptManagement.h>
|
||||
#include <Kernel/FileSystem/Inode.h>
|
||||
#include <Kernel/KString.h>
|
||||
#include <Kernel/Locking/SpinlockProtected.h>
|
||||
@ -137,23 +136,3 @@ void KString::operator delete(void*)
|
||||
extern "C" {
|
||||
FlatPtr kernel_mapping_base;
|
||||
}
|
||||
|
||||
// InterruptManagement.cpp
|
||||
namespace Kernel {
|
||||
|
||||
u8 InterruptManagement::acquire_mapped_interrupt_number(u8)
|
||||
{
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
InterruptManagement& InterruptManagement::the()
|
||||
{
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
RefPtr<IRQController> InterruptManagement::get_responsible_irq_controller(u8)
|
||||
{
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
}
|
||||
|
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];
|
||||
}
|
||||
|
||||
}
|
@ -6,6 +6,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <Kernel/Arch/aarch64/IRQController.h>
|
||||
|
||||
namespace Kernel {
|
||||
@ -13,10 +15,19 @@ namespace Kernel {
|
||||
class InterruptManagement {
|
||||
public:
|
||||
static InterruptManagement& the();
|
||||
static void initialize();
|
||||
static bool initialized();
|
||||
|
||||
static u8 acquire_mapped_interrupt_number(u8 original_irq);
|
||||
|
||||
Vector<RefPtr<IRQController>> const& controllers();
|
||||
RefPtr<IRQController> get_responsible_irq_controller(u8 interrupt_vector);
|
||||
|
||||
private:
|
||||
InterruptManagement() = default;
|
||||
void find_controllers();
|
||||
|
||||
Vector<RefPtr<IRQController>> m_interrupt_controllers;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -417,6 +417,7 @@ else()
|
||||
Arch/aarch64/Dummy.cpp
|
||||
Arch/aarch64/Exceptions.cpp
|
||||
Arch/aarch64/init.cpp
|
||||
Arch/aarch64/InterruptManagement.cpp
|
||||
Arch/aarch64/Interrupts.cpp
|
||||
Arch/aarch64/kprintf.cpp
|
||||
Arch/aarch64/MainIdRegister.cpp
|
||||
|
Loading…
Reference in New Issue
Block a user