mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-18 02:40:08 +00:00
base-hw: communicate kernel irqs via boot info
Core used to read the kernel-reserved IRQs from the timer objects in the kernel's CPU objects and the PIC class (inter-processor IRQ). Besides not being "good style" to access a kernel object in Core, this becomes a problem when trying to prevent CPU pool from being accessed via global functions. As a solution, this commit extends the boot info to also carry an array of all kernel-reserved IRQs. Ref #4217
This commit is contained in:
parent
8b69bc96f9
commit
aa6a7db50a
@ -20,6 +20,7 @@
|
|||||||
#include <platform_pd.h>
|
#include <platform_pd.h>
|
||||||
#include <board.h>
|
#include <board.h>
|
||||||
#include <platform_thread.h>
|
#include <platform_thread.h>
|
||||||
|
#include <hw/boot_info.h>
|
||||||
|
|
||||||
/* base includes */
|
/* base includes */
|
||||||
#include <base/internal/unmanaged_singleton.h>
|
#include <base/internal/unmanaged_singleton.h>
|
||||||
@ -71,6 +72,15 @@ extern "C" void kernel_init()
|
|||||||
if (Cpu::executing_id() == Cpu::primary_id()) {
|
if (Cpu::executing_id() == Cpu::primary_id()) {
|
||||||
Lock::Guard guard(data_lock());
|
Lock::Guard guard(data_lock());
|
||||||
|
|
||||||
|
using Boot_info = Hw::Boot_info<Board::Boot_info>;
|
||||||
|
Boot_info &boot_info {
|
||||||
|
*reinterpret_cast<Boot_info*>(Hw::Mm::boot_info().base) };
|
||||||
|
|
||||||
|
cpu_pool().for_each_cpu([&] (Kernel::Cpu &cpu) {
|
||||||
|
boot_info.kernel_irqs.add(cpu.timer().interrupt_id());
|
||||||
|
});
|
||||||
|
boot_info.kernel_irqs.add((unsigned)Board::Pic::IPI);
|
||||||
|
|
||||||
Genode::log("");
|
Genode::log("");
|
||||||
Genode::log("kernel initialized");
|
Genode::log("kernel initialized");
|
||||||
|
|
||||||
|
@ -177,14 +177,12 @@ Platform::Platform()
|
|||||||
/* make all non-kernel interrupts available to the interrupt allocator */
|
/* make all non-kernel interrupts available to the interrupt allocator */
|
||||||
for (unsigned i = 0; i < Board::Pic::NR_OF_IRQ; i++) {
|
for (unsigned i = 0; i < Board::Pic::NR_OF_IRQ; i++) {
|
||||||
bool kernel_resource = false;
|
bool kernel_resource = false;
|
||||||
Kernel::cpu_pool().for_each_cpu([&] (Kernel::Cpu & cpu) {
|
_boot_info().kernel_irqs.for_each([&] (unsigned /*idx*/,
|
||||||
if (i == cpu.timer().interrupt_id()) {
|
unsigned kernel_irq) {
|
||||||
|
if (i == kernel_irq) {
|
||||||
kernel_resource = true;
|
kernel_resource = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (i == Board::Pic::IPI) {
|
|
||||||
kernel_resource = true;
|
|
||||||
}
|
|
||||||
if (kernel_resource) {
|
if (kernel_resource) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -23,10 +23,12 @@ template <typename PLAT_INFO>
|
|||||||
struct Hw::Boot_info
|
struct Hw::Boot_info
|
||||||
{
|
{
|
||||||
using Mapping_pool = Genode::Array<Mapping, 32>;
|
using Mapping_pool = Genode::Array<Mapping, 32>;
|
||||||
|
using Kernel_irqs = Genode::Array<unsigned, NR_OF_CPUS + 1>;
|
||||||
|
|
||||||
addr_t const table;
|
addr_t const table;
|
||||||
addr_t const table_allocator;
|
addr_t const table_allocator;
|
||||||
Mapping_pool const elf_mappings;
|
Mapping_pool const elf_mappings;
|
||||||
|
Kernel_irqs kernel_irqs { };
|
||||||
Mapping const boot_modules;
|
Mapping const boot_modules;
|
||||||
Mmio_space const mmio_space;
|
Mmio_space const mmio_space;
|
||||||
Memory_region_array ram_regions { };
|
Memory_region_array ram_regions { };
|
||||||
|
Loading…
Reference in New Issue
Block a user