From nobody Wed Mar 12 04:37:50 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+105249+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=fail(p=none dis=none) header.from=arm.com Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1684935562086795.1942511832275; Wed, 24 May 2023 06:39:22 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id NCuqYY1788612xzbeFtu5MnZ; Wed, 24 May 2023 06:39:21 -0700 X-Received: from EUR05-DB8-obe.outbound.protection.outlook.com (EUR05-DB8-obe.outbound.protection.outlook.com [40.107.20.83]) by mx.groups.io with SMTP id smtpd.web10.9086.1684935560917828133 for ; Wed, 24 May 2023 06:39:21 -0700 X-Received: from AM6PR0502CA0052.eurprd05.prod.outlook.com (2603:10a6:20b:56::29) by DBBPR08MB5961.eurprd08.prod.outlook.com (2603:10a6:10:203::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15; Wed, 24 May 2023 13:39:10 +0000 X-Received: from AM7EUR03FT037.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:56:cafe::71) by AM6PR0502CA0052.outlook.office365.com (2603:10a6:20b:56::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15 via Frontend Transport; Wed, 24 May 2023 13:39:10 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+105249+1787277+3901457@groups.io; helo=mail02.groups.io; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C X-Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM7EUR03FT037.mail.protection.outlook.com (100.127.140.225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15 via Frontend Transport; Wed, 24 May 2023 13:39:10 +0000 X-Received: ("Tessian outbound 945aec65ec65:v136"); Wed, 24 May 2023 13:39:09 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 88d6e5249b482c29 X-CR-MTA-TID: 64aa7808 X-Received: from e2449963ec0f.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 4421332A-3B2A-4C2F-83FF-62519FFBA1B6.1; Wed, 24 May 2023 13:38:59 +0000 X-Received: from EUR02-AM0-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id e2449963ec0f.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 24 May 2023 13:38:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Is1ovBXmc5Es7tjyr1hs97SKhfhlWPBx/OCPHyTbcD9qeBRz+gRZnjMfUAOrWB7obLX+dP8NUBEtWOqiNydIiXrNAjKBTeekHO1JspWM3l2Wr4+JMyq15cdpyR+gyT/0zIybEroip2PxXcIs7InahhNc0WLXpCcrSZllZXiq3gE2Dt8TzKP6etLWghMce+te2B2dbghwqJCQNAfGf1gW1+fNm9tU9XPbIpINRNQZ0WoagAjAPWyr9jrQzLowukAabC4CEzJoO3uTa+K2Pld8kmtJFDiUglwZfi/VsKTeAFLkPskD/z+fWydQR3BLNRMn8AZS4Ypz2A3tTGnxxLl7Cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=bmQYOsWzU2Te+JCcuss4OC6+7lMKt1tkVmUvl6iLnWc=; b=WUCeGAvBg+Yi7LvLMgpSEvxVoslBqhxpMWhMb+6xdkWEmLvSOCiDLjY+nOse6RSOKqh51y/Qtuf2Us+Xx029ikDzOjwTWJo4PnxcHijg5xzJG/+FR7h7w51QZA+ycefE2xRSO5oBR+cdYIXhrfoMASG9PhpwME7Cbsqf/U42R7g1iGXYRUU6od7wrAKcgNjZoaM/3fqgG4jGkr/kkmR2CDfJPOKrbBUJ0+u7GCR4YT/tD44O+ZdkjmUIUFynbEIkDBmPUjCV90YGwnkIPdp4i8my+sEJco64A9rVLBktZQEapF+8WfeBlZU4LR8SnJIa+USCJElZXG19gbZO/3GdHw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none X-Received: from DU2PR04CA0264.eurprd04.prod.outlook.com (2603:10a6:10:28e::29) by DB4PR08MB9382.eurprd08.prod.outlook.com (2603:10a6:10:3f2::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.27; Wed, 24 May 2023 13:38:56 +0000 X-Received: from DBAEUR03FT044.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:28e:cafe::62) by DU2PR04CA0264.outlook.office365.com (2603:10a6:10:28e::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15 via Frontend Transport; Wed, 24 May 2023 13:38:56 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C X-Received: from nebula.arm.com (40.67.248.234) by DBAEUR03FT044.mail.protection.outlook.com (100.127.142.189) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6433.15 via Frontend Transport; Wed, 24 May 2023 13:38:56 +0000 X-Received: from AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Wed, 24 May 2023 13:38:46 +0000 X-Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Wed, 24 May 2023 13:38:45 +0000 X-Received: from E114225.Arm.com (10.1.196.36) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Wed, 24 May 2023 13:38:45 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , , , , , , Subject: [edk2-devel] [PATCH v2 10/11] ArmPkg: Adjust variable type and cast for RegShift & RegOffset Date: Wed, 24 May 2023 14:38:39 +0100 Message-ID: <20230524133840.28612-11-sami.mujawar@arm.com> In-Reply-To: <20230524133840.28612-1-sami.mujawar@arm.com> References: <20230524133840.28612-1-sami.mujawar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DBAEUR03FT044:EE_|DB4PR08MB9382:EE_|AM7EUR03FT037:EE_|DBBPR08MB5961:EE_ X-MS-Office365-Filtering-Correlation-Id: 04a6663f-4e65-4b8a-dbd0-08db5c5c4111 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: HMCI4dX3LU0xWmw/ahJ9DhRjckcznujAa80y3GVCl63POlmkjkjhF7YleskLDl87LRWaArILbUNgm/xpRw1is3oWkB9ZJatQeY6gkqhLtcGPYzzi+UdNK+UvDlHyki8h2OMC1W3G7VfhttwSn/H6AP/0yqfE7vhnk29eIMyzHq0YQSmpcGwvSXzLrVsO2LREATUIZP3kABUfGbENOOlAnxo4GhDSVgnetpMfkOLQqSb/brIteOBNPSx7N/eMrShnHXbmW6L4tpgtlLzmQS46lofE5uTsFAG+osSkQhtlcoO7YslhcTVg7vbL5wVBze1ywDdK5pVjGTojyE9ufpXcwJAD33P5yTWS0K0qf7FKfo2GGsZj3RINBgB5CpESI2t6T5ooMk1pjk1aTvnws+DBQ9IHv1OHR4fZPpLzAKaRKOHvz4HVqoioSUQmJZ69sak5aR9OUD5EKzv4dqWv/cnlYsAYvXSuIJCMNbADCMUwT4C13aLEcL9zfgPKdGXc+0j+ZMsWhUq7fHKjC4JYtzaGguvBmqcHghVwV3QfWqsw7t7RlfdVbzr61C4Ns2AtWQUm+RUKNW2KOvK7iw0G92+Ts8+iKM6V12iOOQHscH3ARf92YHSlcmmNr1wEOM8wQggV/N85VtDqBRt6RVeWGKkM7cwPN8LYwQbYwrBCuozRgwyhxxoIufKJTCVuKxHthmVe6Rsm1ZZl8wF4ywVneSQ0fUfajJMtI2M+rXC2PuI5OHM= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(376002)(39860400002)(136003)(346002)(396003)(451199021)(46966006)(36840700001)(41300700001)(478600001)(6666004)(316002)(1076003)(26005)(7696005)(54906003)(19627235002)(6916009)(4326008)(70586007)(70206006)(5660300002)(8676002)(44832011)(8936002)(40480700001)(82310400005)(186003)(36756003)(47076005)(81166007)(2906002)(356005)(82740400003)(336012)(36860700001)(83380400001)(426003)(86362001)(2616005)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB9382 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT037.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 1b87a634-525e-4632-8f7a-08db5c5c38b7 X-Microsoft-Antispam-Message-Info: gMij3ki3FvglOGTo3tOJB6uPcGnExkY1UH2kuhdWWSMou+qgMsTVwelOhN+R6cWl8rymuZrGuWmtJ9jBBKjuRl/6YjaKiifvcibjSDHd+Y5dW93FUO0hUV6BSoByQNw76Q/3iF80I4sfZDh37NSWHX4ap8fkO4/aeea7AWOaChUR9dcwHi+5CwE8iwx3qFnbJQPFpwQF3tJ3f4Y8UgUpvGDLNxzAen7fHVHrLwnrAe6xOTHnbO7MBnJEUrGI7eGIptCxOp8P8iunrY7Ry/JGA4HZmjgPY45I/SPGE8oWHbDaEtMEz/DT8x1tzFJI32R5Vt2uTIMXk8JVyFCSkcbQ8VAh1cpneuBNRgOrxJBdwxeyvN68YVlOTWenNSTBgHbDVBercw4ETDJVyNu98Ht6SvCm+MTK4OCWAU61hG0paKNtsMcCGZwSW4Z/9zHjFCfnJwWMEc3ycHz8UI0STdcK0rlmqdfRKNlF3d1CZ+u3Cb+6qlL1+6prRk/e74XmwExZavQmtsMlJsL5jpdr3pbUP2/D8kF0rxkBQjTK+NETGefDHvFZ77oKiR7mN42RDnnXn4fj3f1QhK6FLRE40wZwMYJogY31yFuYjkRNO1gTpd/qYwcfsHzCTfNEtYFAuKKnRihhwlUghzNpD7T4EiCd9YheckZp7i1zgRerHPxrPO7akrdoJQZ9ElKALaAaFCzVgEP6OR+QcQcXsL8engsjmIf+FPvYjV0F7ru/RfDguGE= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2023 13:39:10.0868 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 04a6663f-4e65-4b8a-dbd0-08db5c5c4111 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM7EUR03FT037.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB5961 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,sami.mujawar@arm.com X-Gm-Message-State: TyjPorTPkwYphJ0mmberEEffx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1684935561; bh=DgWa+RnQYsoQoZqHM1bN7y48Aplf4U24oDlzwq/HREw=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=d6z0lmfT36700F63dZv/GdvM67qscTS8rHWMCg/qTYpucsiyiPnYvyDSoMLYB9i/A14 Dzf6cRHigwesuSx6ofGlYdvEq4hQ22I14hrn6c3eWFCOJUjTDFGbxFyLHKA8EWDTMLelC fvBRuDKBLa6KtOeeuIcn0MmDUn7LbC7yW5A= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1684935563642100003 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" According to the GIC architecture version 3 and 4 specification, the maximum number of INTID bits supported in the CPU interface is 24. Considering this the RegShift variable is not required to be more than 8 bits. Therefore, make the RegShift variable type to UINT8. Also add necessary typecasts when calculating the RegOffset and RegShift values. Signed-off-by: Sami Mujawar --- Notes: v2: - updated copyright year [Sami] ArmPkg/Drivers/ArmGic/ArmGicLib.c | 24 ++++++++++---------- ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2Dxe.c | 6 ++--- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ArmPkg/Drivers/ArmGic/ArmGicLib.c b/ArmPkg/Drivers/ArmGic/ArmG= icLib.c index 0127cca3bf0567bc80702f415e9cbb9bd2709fbc..8f3315d76f6f2b28a551d734009= 38430ff3e23c7 100644 --- a/ArmPkg/Drivers/ArmGic/ArmGicLib.c +++ b/ArmPkg/Drivers/ArmGic/ArmGicLib.c @@ -228,13 +228,13 @@ ArmGicSetInterruptPriority ( ) { UINT32 RegOffset; - UINTN RegShift; + UINT8 RegShift; ARM_GIC_ARCH_REVISION Revision; UINTN GicCpuRedistributorBase; =20 // Calculate register offset and bit position - RegOffset =3D Source / 4; - RegShift =3D (Source % 4) * 8; + RegOffset =3D (UINT32)(Source / 4); + RegShift =3D (UINT8)((Source % 4) * 8); =20 Revision =3D ArmGicGetSupportedArchRevision (); if ((Revision =3D=3D ARM_GIC_ARCH_REVISION_2) || @@ -272,13 +272,13 @@ ArmGicEnableInterrupt ( ) { UINT32 RegOffset; - UINTN RegShift; + UINT8 RegShift; ARM_GIC_ARCH_REVISION Revision; UINTN GicCpuRedistributorBase; =20 // Calculate enable register offset and bit position - RegOffset =3D Source / 32; - RegShift =3D Source % 32; + RegOffset =3D (UINT32)(Source / 32); + RegShift =3D (UINT8)(Source % 32); =20 Revision =3D ArmGicGetSupportedArchRevision (); if ((Revision =3D=3D ARM_GIC_ARCH_REVISION_2) || @@ -317,13 +317,13 @@ ArmGicDisableInterrupt ( ) { UINT32 RegOffset; - UINTN RegShift; + UINT8 RegShift; ARM_GIC_ARCH_REVISION Revision; UINTN GicCpuRedistributorBase; =20 // Calculate enable register offset and bit position - RegOffset =3D Source / 32; - RegShift =3D Source % 32; + RegOffset =3D (UINT32)(Source / 32); + RegShift =3D (UINT8)(Source % 32); =20 Revision =3D ArmGicGetSupportedArchRevision (); if ((Revision =3D=3D ARM_GIC_ARCH_REVISION_2) || @@ -361,14 +361,14 @@ ArmGicIsInterruptEnabled ( ) { UINT32 RegOffset; - UINTN RegShift; + UINT8 RegShift; ARM_GIC_ARCH_REVISION Revision; UINTN GicCpuRedistributorBase; UINT32 Interrupts; =20 // Calculate enable register offset and bit position - RegOffset =3D Source / 32; - RegShift =3D Source % 32; + RegOffset =3D (UINT32)(Source / 32); + RegShift =3D (UINT8)(Source % 32); =20 Revision =3D ArmGicGetSupportedArchRevision (); if ((Revision =3D=3D ARM_GIC_ARCH_REVISION_2) || diff --git a/ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2Dxe.c b/ArmPkg/Drivers/Arm= Gic/GicV2/ArmGicV2Dxe.c index cd371cab2a0159b54d8e6f0f5d3930e1276cbf7e..6300a2a54b194cb8c874a4e7db9= 051b9732d8be2 100644 --- a/ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2Dxe.c +++ b/ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2Dxe.c @@ -393,7 +393,7 @@ GicV2DxeInitialize ( EFI_STATUS Status; UINTN Index; UINT32 RegOffset; - UINTN RegShift; + UINT8 RegShift; UINT32 CpuTarget; =20 // Make sure the Interrupt Controller Protocol is not already installed = in @@ -411,8 +411,8 @@ GicV2DxeInitialize ( GicV2DisableInterruptSource (&gHardwareInterruptV2Protocol, Index); =20 // Set Priority - RegOffset =3D Index / 4; - RegShift =3D (Index % 4) * 8; + RegOffset =3D (UINT32)(Index / 4); + RegShift =3D (UINT8)((Index % 4) * 8); MmioAndThenOr32 ( mGicDistributorBase + ARM_GIC_ICDIPR + (4 * RegOffset), ~(0xff << RegShift), --=20 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#105249): https://edk2.groups.io/g/devel/message/105249 Mute This Topic: https://groups.io/mt/99108693/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-