From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 8AEBB7803DB for ; Wed, 3 Jul 2024 09:53:54 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=R5lbw6IC/Ar3B5nc8+k/XzwkVd3ybjkdSidd3zDvtAk=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20240206; t=1720000434; v=1; b=nSI/aDUGj9TmccG9uYMUOGvm3Pm7ktXQMfNexsBv4du2F3s7xjyNhAjfLh2zSJcRgFIBuQnQ UJnEuB8sLj4nYl3/t8hRW6pK/e/1rlYydqtkBZG0EZW/w9w4/rAvJWexAVv7J7vI+bMFcE1K/JC vubjTZKB/JBjOwOQkXClaG/gUcykbae4mHPmla0+vCUXfH54fChOGPa3HKA3hODN9c5JKgzo+KF DSk7gV6oEhBy4iNmWoTs4Ljg+cxNGsgs/WCZ3h3KofdEoL7U3j39T/wQXyEMzwWNJ32nVmCZzhj sbHMjkIW0mXmirv1dtkfvd0t33zi7j9oGE7oxcvy/a2OQ== X-Received: by 127.0.0.2 with SMTP id L5z6YY7687511x5IB2ri5e2h; Wed, 03 Jul 2024 02:53:53 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.46671.1720000432623399474 for ; Wed, 03 Jul 2024 02:53:52 -0700 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5FB90367; Wed, 3 Jul 2024 02:54:17 -0700 (PDT) X-Received: from e126645.home (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B867D3F766; Wed, 3 Jul 2024 02:53:49 -0700 (PDT) From: "PierreGondois" To: devel@edk2.groups.io Cc: Pierre Gondois , AbdulLateef Attar , Girish Mahadevan , Jeff Brasen , Jeshua Smith , Leif Lindholm , Meenakshi Aggarwal , Sami Mujawar , Sunil V L , Yeo Reum Yun , Pierre Gondois Subject: [edk2-devel] [staging/dynamictables-reorg PATCH 1/2] DynamicTablesPkg: Fix conversion compiler warnings Date: Wed, 3 Jul 2024 11:53:39 +0200 Message-Id: <20240703095340.3402057-2-pierre.gondois@arm.com> In-Reply-To: <20240703095340.3402057-1-pierre.gondois@arm.com> References: <20240703095340.3402057-1-pierre.gondois@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Wed, 03 Jul 2024 02:53:52 -0700 Resent-From: pierre.gondois@arm.com Reply-To: devel@edk2.groups.io,pierre.gondois@arm.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: PHC1mqEdRzcOehzj702i4WYNx7686176AA= Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b="nSI/aDUG"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=arm.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io Some CM objects fields are wider than the targeted field in ACPI tables. Some assignments are also subject to data loss and trigger the following warnings: - '<': signed/unsigned mismatch - '=3D': conversion from 'UINTxx' to 'UINTyy', possible loss of data with xx > yy. Add checks/cast to remove the warnings. Signed-off-by: Pierre Gondois --- .../Acpi/Common/AcpiPcctLib/PcctGenerator.c | 15 +++++++++++---- .../SsdtCpuTopologyGenerator.c | 6 ++++-- .../Common/AcpiSsdtPcieLib/SsdtPcieGenerator.c | 15 ++++++++++----- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/DynamicTablesPkg/Library/Acpi/Common/AcpiPcctLib/PcctGenerator= .c b/DynamicTablesPkg/Library/Acpi/Common/AcpiPcctLib/PcctGenerator.c index 205c44405785..061e12bf1b3d 100644 --- a/DynamicTablesPkg/Library/Acpi/Common/AcpiPcctLib/PcctGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiPcctLib/PcctGenerator.c @@ -379,10 +379,12 @@ AddSubspaceStructType1 ( Doorbell =3D &GenericPccCmObj->DoorbellReg;=0D ChannelTiming =3D &GenericPccCmObj->ChannelTiming;=0D =0D + ASSERT ((PccCmObj->PlatIrq.Flags >> 8) =3D=3D 0);=0D +=0D PccAcpi->Type =3D GenericPccCmObj->Type;=0D PccAcpi->Length =3D sizeof (EFI_ACPI_6_4_PCCT_SUBSPACE_1= _HW_REDUCED_COMMUNICATIONS);=0D PccAcpi->PlatformInterrupt =3D PccCmObj->PlatIrq.Interrupt;=0D - PccAcpi->PlatformInterruptFlags =3D PccCmObj->PlatIrq.Flags;=0D + PccAcpi->PlatformInterruptFlags =3D (UINT8)PccCmObj->PlatIrq.Flags;=0D PccAcpi->Reserved =3D EFI_ACPI_RESERVED_BYTE;=0D PccAcpi->BaseAddress =3D GenericPccCmObj->BaseAddress;=0D PccAcpi->AddressLength =3D GenericPccCmObj->AddressLength;=0D @@ -441,10 +443,12 @@ AddSubspaceStructType2 ( PlatIrqAck =3D &PccCmObj->PlatIrqAckReg;=0D ChannelTiming =3D &GenericPccCmObj->ChannelTiming;=0D =0D + ASSERT ((PccCmObj->PlatIrq.Flags >> 8) =3D=3D 0);=0D +=0D PccAcpi->Type =3D GenericPccCmObj->Type;=0D PccAcpi->Length =3D sizeof (EFI_ACPI_6_4_PCCT_SUBSPACE_2= _HW_REDUCED_COMMUNICATIONS);=0D PccAcpi->PlatformInterrupt =3D PccCmObj->PlatIrq.Interrupt;=0D - PccAcpi->PlatformInterruptFlags =3D PccCmObj->PlatIrq.Flags;=0D + PccAcpi->PlatformInterruptFlags =3D (UINT8)PccCmObj->PlatIrq.Flags;=0D PccAcpi->BaseAddress =3D GenericPccCmObj->BaseAddress;=0D PccAcpi->Reserved =3D EFI_ACPI_RESERVED_BYTE;=0D PccAcpi->BaseAddress =3D GenericPccCmObj->BaseAddress;=0D @@ -519,13 +523,16 @@ AddSubspaceStructType34 ( ErrorStatus =3D &PccCmObj->ErrorStatusReg;=0D ChannelTiming =3D &GenericPccCmObj->ChannelTiming;=0D =0D + ASSERT ((PccCmObj->PlatIrq.Flags >> 8) =3D=3D 0);=0D + ASSERT ((GenericPccCmObj->AddressLength >> 32) =3D=3D 0);=0D +=0D PccAcpi->Type =3D GenericPccCmObj->Type;=0D PccAcpi->Length =3D sizeof (EFI_ACPI_6_4_PCCT_SUBSPACE_3= _EXTENDED_PCC);=0D PccAcpi->PlatformInterrupt =3D PccCmObj->PlatIrq.Interrupt;=0D - PccAcpi->PlatformInterruptFlags =3D PccCmObj->PlatIrq.Flags;=0D + PccAcpi->PlatformInterruptFlags =3D (UINT8)PccCmObj->PlatIrq.Flags;=0D PccAcpi->Reserved =3D EFI_ACPI_RESERVED_BYTE;=0D PccAcpi->BaseAddress =3D GenericPccCmObj->BaseAddress;=0D - PccAcpi->AddressLength =3D GenericPccCmObj->AddressLength;=0D + PccAcpi->AddressLength =3D (UINT32)GenericPccCmObj->AddressLeng= th;=0D =0D CopyMem (=0D &PccAcpi->DoorbellRegister,=0D diff --git a/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtCpuTopologyLib/Ss= dtCpuTopologyGenerator.c b/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtCpu= TopologyLib/SsdtCpuTopologyGenerator.c index 74595131935c..f82b7449713c 100644 --- a/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtCpuTopologyLib/SsdtCpuTo= pologyGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtCpuTopologyLib/SsdtCpuTo= pologyGenerator.c @@ -1026,7 +1026,8 @@ CreateAmlCpuTopologyTree ( if (Generator->ProcNodeList[Index].OverrideNameUidEnabled) {=0D Name =3D Generator->ProcNodeList[Index].OverrideName;=0D } else {=0D - Name =3D CpuIndex;=0D + ASSERT ((CpuIndex >> 16) =3D=3D 0);=0D + Name =3D (UINT16)CpuIndex;=0D }=0D =0D Status =3D CreateAmlCpuFromProcHierarchy (=0D @@ -1061,7 +1062,8 @@ CreateAmlCpuTopologyTree ( Name =3D Generator->ProcNodeList[Index].OverrideName;=0D Uid =3D Generator->ProcNodeList[Index].OverrideUid;=0D } else {=0D - Name =3D ProcContainerName;=0D + ASSERT ((ProcContainerName >> 16) =3D=3D 0);=0D + Name =3D (UINT16)ProcContainerName;=0D Uid =3D *ProcContainerIndex;=0D }=0D =0D diff --git a/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtPcieLib/SsdtPcieG= enerator.c b/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtPcieLib/SsdtPcieG= enerator.c index 5b6d5515622b..3dcca2b33987 100644 --- a/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtPcieLib/SsdtPcieGenerato= r.c +++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtPcieLib/SsdtPcieGenerato= r.c @@ -311,7 +311,7 @@ GeneratePrt ( )=0D {=0D EFI_STATUS Status;=0D - INT32 Index;=0D + UINT32 Index;=0D AML_OBJECT_NODE_HANDLE PrtNode;=0D CM_ARCH_COMMON_OBJ_REF *RefInfo;=0D UINT32 RefCount;=0D @@ -561,6 +561,11 @@ GeneratePciCrs ( break;=0D =0D case PCI_SS_M32:=0D + ASSERT ((AddrMapInfo->PciAddress >> 32) =3D=3D 0);=0D + ASSERT (((AddrMapInfo->PciAddress + AddrMapInfo->AddressSize - 1) = >> 32) =3D=3D 0);=0D + ASSERT (((Translation ? AddrMapInfo->CpuAddress - AddrMapInfo->Pci= Address : 0) >> 32) =3D=3D 0);=0D + ASSERT ((AddrMapInfo->AddressSize >> 32) =3D=3D 0);=0D +=0D Status =3D AmlCodeGenRdDWordMemory (=0D FALSE,=0D IsPosDecode,=0D @@ -569,10 +574,10 @@ GeneratePciCrs ( AmlMemoryCacheable,=0D TRUE,=0D 0,=0D - AddrMapInfo->PciAddress,=0D - AddrMapInfo->PciAddress + AddrMapInfo->AddressSize - 1,= =0D - Translation ? AddrMapInfo->CpuAddress - AddrMapInfo->Pc= iAddress : 0,=0D - AddrMapInfo->AddressSize,=0D + (UINT32)(AddrMapInfo->PciAddress),=0D + (UINT32)(AddrMapInfo->PciAddress + AddrMapInfo->Address= Size - 1),=0D + (UINT32)(Translation ? AddrMapInfo->CpuAddress - AddrMa= pInfo->PciAddress : 0),=0D + (UINT32)(AddrMapInfo->AddressSize),=0D 0,=0D NULL,=0D AmlAddressRangeMemory,=0D --=20 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#119778): https://edk2.groups.io/g/devel/message/119778 Mute This Topic: https://groups.io/mt/107016603/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-