From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from cam-smtp0.cambridge.arm.com (cam-smtp0.cambridge.arm.com [217.140.106.53]) by mx.groups.io with SMTP id smtpd.web11.12891.1593514150731490137 for ; Tue, 30 Jun 2020 03:49:11 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.106.53, mailfrom: pierre.gondois@arm.com) Received: from E119881.Arm.com (E119881.Arm.com [10.1.197.28]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id 05UAn70t025781; Tue, 30 Jun 2020 11:49:07 +0100 From: "PierreGondois" To: devel@edk2.groups.io Cc: Pierre Gondois , leif@nuviainc.com, ard.biesheuvel@arm.com, nd@arm.com Subject: [PATCH v1 1/2] EmbeddedPkg: Fix build error for MmcDxe Date: Tue, 30 Jun 2020 11:49:00 +0100 Message-Id: <20200630104901.11648-2-pierre.gondois@arm.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: <20200630104901.11648-1-pierre.gondois@arm.com> References: <20200630104901.11648-1-pierre.gondois@arm.com> From: Pierre Gondois The following command line: build -b NOOPT -a IA32 -t VS2017 -p edk2\EmbeddedPkg\EmbeddedPkg.dsc Generates the following error: MmcDxe.lib(Diagnostics.obj) : error LNK2001: unresolved external symbol __allshl MmcDxe.lib(Diagnostics.obj) : error LNK2001: unresolved external symbol __aullshr MmcDxe.lib(MmcBlockIo.obj) : error LNK2001: unresolved external symbol __allmul These erros are due to the use of shift/multiply operations on UINT64 variable on a IA32 architecture. Signed-off-by: Pierre Gondois --- The changes can be seen at: https://github.com/PierreARM/edk2/commits/831_Fix_VS2017_build_error_v1 Notes: v1: - Fix VS2017 build errors. [Pierre] EmbeddedPkg/Universal/MmcDxe/Diagnostics.c | 10 +++++++--- EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c | 6 +++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/EmbeddedPkg/Universal/MmcDxe/Diagnostics.c b/EmbeddedPkg/Universal/MmcDxe/Diagnostics.c index 20defeb8745a2eb243f316ba9d4e0d03016e260b..49b069043093544a3cbadc46fda4de483803d638 100644 --- a/EmbeddedPkg/Universal/MmcDxe/Diagnostics.c +++ b/EmbeddedPkg/Universal/MmcDxe/Diagnostics.c @@ -1,7 +1,7 @@ /** @file Diagnostics Protocol implementation for the MMC DXE driver - Copyright (c) 2011-2014, ARM Limited. All rights reserved. + Copyright (c) 2011-2020, ARM Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -56,7 +56,7 @@ GenerateRandomBuffer ( UINT64* Buffer64 = (UINT64*)Buffer; for (i = 0; i < (BufferSize >> 3); i++) { - *Buffer64 = i | (~i << 32); + *Buffer64 = i | LShiftU64 (~i, 32); Buffer64++; } } @@ -227,7 +227,11 @@ MmcDriverDiagnosticsRunDiagnostics ( // LBA=10 Size=BlockSize DiagnosticLog (L"MMC Driver Diagnostics - Test: Any Block\n"); - Status = MmcReadWriteDataTest (MmcHostInstance, MmcHostInstance->BlockIo.Media->LastBlock >> 1, MmcHostInstance->BlockIo.Media->BlockSize); + Status = MmcReadWriteDataTest ( + MmcHostInstance, + RShiftU64 (MmcHostInstance->BlockIo.Media->LastBlock, 1), + MmcHostInstance->BlockIo.Media->BlockSize + ); // LBA=LastBlock Size=BlockSize DiagnosticLog (L"MMC Driver Diagnostics - Test: Last Block\n"); diff --git a/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c b/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c index b508c466d9c5c52ffff7855ea32cbd427927e27b..2a5d72d4daf6045e691e51d5b82ed8e6fb721121 100644 --- a/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c +++ b/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c @@ -1,6 +1,6 @@ /** @file * -* Copyright (c) 2011-2015, ARM Limited. All rights reserved. +* Copyright (c) 2011-2020, ARM Limited. All rights reserved. * * SPDX-License-Identifier: BSD-2-Clause-Patent * @@ -149,7 +149,7 @@ MmcTransferBlock ( if (MmcHostInstance->CardInfo.OCRData.AccessMode & SD_CARD_CAPACITY) { CmdArg = Lba; } else { - CmdArg = Lba * This->Media->BlockSize; + CmdArg = MultU64x32 (Lba, This->Media->BlockSize); } } else { //Set command argument based on the card access mode (Byte mode or Block mode) @@ -157,7 +157,7 @@ MmcTransferBlock ( MMC_OCR_ACCESS_SECTOR) { CmdArg = Lba; } else { - CmdArg = Lba * This->Media->BlockSize; + CmdArg = MultU64x32 (Lba, This->Media->BlockSize); } } -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'