risc-v: initialize active_irq during PLIC init

- Initialize all elements active_irq during PLIC init and done't assume
  implicitly that irqInvalid is zero.
- make active_irq hold elements of the type irq_t and not uint32_t.

Signed-off-by: Axel Heider <axel.heider@hensoldt-cyber.de>
This commit is contained in:
Axel Heider 2021-07-25 17:56:00 +02:00 committed by Kent McLeod
parent c2bf323d0a
commit 2450a1f910

View file

@ -103,7 +103,7 @@ static irq_t getNewActiveIRQ(void)
return irqInvalid;
}
static uint32_t active_irq[CONFIG_MAX_NUM_NODES] = { irqInvalid };
static irq_t active_irq[CONFIG_MAX_NUM_NODES];
/**
@ -267,6 +267,15 @@ BOOT_CODE void initIRQController(void)
{
printf("Initializing PLIC...\n");
/* Initialize active_irq[] properly to stick to the semantics and play safe.
* Effectively this is not needed if irqInvalid is zero (which is currently
* the case) and the array is in the BSS, that is filled with zeros (which
* the a kernel loader is supposed to do and which the ELF-Loader does).
*/
for (word_t i = 0; i < ARRAY_SIZE(active_irq); i++) {
active_irq[i] = irqInvalid;
}
plic_init_controller();
}