From 08a08129ae134e2906e7478037cc2e1ddadad129 Mon Sep 17 00:00:00 2001 From: Sami Mujawar Date: Mon, 7 Jun 2021 14:38:18 +0100 Subject: ArmPkg: Typecast IntID to UINT32 in ArmGicV2EndOfInterrupt The EIOR register of the Gic CPU interface is a 32 bit register. However, the HARDWARE_INTERRUPT_SOURCE used to represent the interrupt source (Interrupt ID) is typedefed as UINTN, see EmbeddedPkg\Include\Protocol\HardwareInterrupt.h Therfore, typecast the interrupt ID (Source) value to UINT32 before setting the EOIR register. Also, add an assert to check that the value does not exceed 32 bits. Signed-off-by: Sami Mujawar --- ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2Lib.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'ArmPkg/Drivers') diff --git a/ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2Lib.c b/ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2Lib.c index f403bec367..d21caa90e5 100644 --- a/ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2Lib.c +++ b/ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2Lib.c @@ -1,12 +1,13 @@ /** @file * -* Copyright (c) 2013-2014, ARM Limited. All rights reserved. +* Copyright (c) 2013-2023, ARM Limited. All rights reserved. * * SPDX-License-Identifier: BSD-2-Clause-Patent * **/ #include +#include #include UINTN @@ -26,5 +27,6 @@ ArmGicV2EndOfInterrupt ( IN UINTN Source ) { - MmioWrite32 (GicInterruptInterfaceBase + ARM_GIC_ICCEIOR, Source); + ASSERT (Source <= MAX_UINT32); + MmioWrite32 (GicInterruptInterfaceBase + ARM_GIC_ICCEIOR, (UINT32)Source); } -- cgit v1.2.3