Commit e1999b26 authored by Andreas Sandberg's avatar Andreas Sandberg Committed by mergify[bot]
Browse files

ArmPkg/ArmGic: Fix maximum number of interrupts in GICv3

Bugzilla: 3415 (https://bugzilla.tianocore.org/show_bug.cgi?id=3415

)

The GICv3 architecture supports up to 1020 ordinary interrupt
lines. The actual number of interrupts supported is described by the
ITLinesNumber field in the GICD_TYPER register. The total number of
implemented registers is normally calculated as
32*(ITLinesNumber+1). However, maximum value (0x1f) is a special case
since that would indicate that 1024 interrupts are implemented.

Add handling for this special case in ArmGicGetMaxNumInterrupts.
Signed-off-by: Andreas Sandberg's avatarAndreas Sandberg <andreas.sandberg@arm.com>
Signed-off-by: Joey Gouly's avatarJoey Gouly <joey.gouly@arm.com>
Signed-off-by: Sami Mujawar's avatarSami Mujawar <sami.mujawar@arm.com>
Reviewed-by: default avatarArd Biesheuvel <ardb@kernel.org>
Reviewed-by: default avatarPhilippe Mathieu-Daude <philmd@redhat.com>
parent cfa6ffb1
/** @file
*
* Copyright (c) 2011-2018, ARM Limited. All rights reserved.
* Copyright (c) 2011-2021, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*
......@@ -120,7 +120,14 @@ ArmGicGetMaxNumInterrupts (
IN INTN GicDistributorBase
)
{
return 32 * ((MmioRead32 (GicDistributorBase + ARM_GIC_ICDICTR) & 0x1F) + 1);
UINTN ItLines;
ItLines = MmioRead32 (GicDistributorBase + ARM_GIC_ICDICTR) & 0x1F;
//
// Interrupt ID 1020-1023 are reserved.
//
return (ItLines == 0x1f) ? 1020 : 32 * (ItLines + 1);
}
VOID
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment