Skip to content

Commit

Permalink
EmbeddedPkg: Fix build error for MmcDxe
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Leif Lindholm <[email protected]>
  • Loading branch information
pierregondois authored and mergify[bot] committed Jul 23, 2020
1 parent d0da48f commit 7ff0459
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 7 additions & 3 deletions EmbeddedPkg/Universal/MmcDxe/Diagnostics.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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++;
}
}
Expand Down Expand Up @@ -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");
Expand Down
6 changes: 3 additions & 3 deletions EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c
Original file line number Diff line number Diff line change
@@ -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
*
Expand Down Expand Up @@ -149,15 +149,15 @@ 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)
if ((MmcHostInstance->CardInfo.OCRData.AccessMode & MMC_OCR_ACCESS_MASK) ==
MMC_OCR_ACCESS_SECTOR) {
CmdArg = Lba;
} else {
CmdArg = Lba * This->Media->BlockSize;
CmdArg = MultU64x32 (Lba, This->Media->BlockSize);
}
}

Expand Down

0 comments on commit 7ff0459

Please sign in to comment.