From a6c369fc36fcac4784e160dca5c2e464a9b27f1a Mon Sep 17 00:00:00 2001 From: Mikhail Krichanov Date: Fri, 28 Jun 2024 11:01:20 +0300 Subject: [PATCH] Fixed compilation of all packages tracked by CI after rebasing upon edk2-stable202405 tag. --- CryptoPkg/Library/IntrinsicLib/CopyMem.c | 2 + .../MemoryAllocationLib.c | 57 ------------------- .../Spi/SpiNorFlashJedecSfdp/SpiNorFlash.c | 1 + MdeModulePkg/MdeModulePkg.dsc | 6 ++ MdePkg/Include/Library/DebugLib.h | 2 +- NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c | 2 +- OvmfPkg/Library/PlatformInitLib/IntelTdx.c | 1 - OvmfPkg/OvmfPkgIa32.fdf | 4 +- OvmfPkg/OvmfPkgX64.fdf | 4 +- UefiCpuPkg/Library/MpInitLib/X64/AmdSev.c | 9 ++- UefiPayloadPkg/UefiPayloadPkg.dsc | 2 +- .../SampleUnitTestDxeExpectFail.inf | 3 + .../SampleUnitTestHostExpectFail.inf | 3 + .../SampleUnitTestPeiExpectFail.inf | 3 + .../SampleUnitTestSmmExpectFail.inf | 3 + .../SampleUnitTestUefiShellExpectFail.inf | 3 + .../SampleUnitTestDxeGenerateException.inf | 3 + .../SampleUnitTestHostGenerateException.inf | 3 + .../SampleUnitTestPeiGenerateException.inf | 3 + .../SampleUnitTestSmmGenerateException.inf | 3 + ...mpleUnitTestUefiShellGenerateException.inf | 3 + 21 files changed, 53 insertions(+), 67 deletions(-) diff --git a/CryptoPkg/Library/IntrinsicLib/CopyMem.c b/CryptoPkg/Library/IntrinsicLib/CopyMem.c index 530d092c8b..b3487db891 100644 --- a/CryptoPkg/Library/IntrinsicLib/CopyMem.c +++ b/CryptoPkg/Library/IntrinsicLib/CopyMem.c @@ -10,6 +10,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include +#if !defined (__arm__) #if defined (__clang__) && !defined (__APPLE__) /* Copies bytes between buffers */ @@ -53,3 +54,4 @@ __bzero ( ZeroMem (src, count); } #endif +#endif diff --git a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c index 24bf5142d9..253ace4e54 100644 --- a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c +++ b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c @@ -156,60 +156,3 @@ PhaseFreePool ( { // Not implemented yet } - -/** - Reallocates a buffer of type EfiBootServicesData. - - Allocates and zeros the number bytes specified by NewSize from memory of type - EfiBootServicesData. If OldBuffer is not NULL, then the smaller of OldSize and - NewSize bytes are copied from OldBuffer to the newly allocated buffer, and - OldBuffer is freed. A pointer to the newly allocated buffer is returned. - If NewSize is 0, then a valid buffer of 0 size is returned. If there is not - enough memory remaining to satisfy the request, then NULL is returned. - - If the allocation of the new buffer is successful and the smaller of NewSize and OldSize - is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). - - @param OldSize The size, in bytes, of OldBuffer. - @param NewSize The size, in bytes, of the buffer to reallocate. - @param OldBuffer The buffer to copy to the allocated buffer. This is an optional - parameter that may be NULL. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -ReallocatePool ( - IN UINTN OldSize, - IN UINTN NewSize, - IN VOID *OldBuffer OPTIONAL - ) -{ - VOID *NewBuffer; - - // Validate the OldBuffer is HobAllocated. - DEBUG_CODE_BEGIN (); - EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob; - - if (OldBuffer != NULL) { - HandOffHob = GetHobList (); - ASSERT (((EFI_PHYSICAL_ADDRESS)(UINTN)OldBuffer >= HandOffHob->EfiMemoryBottom)); - ASSERT (((EFI_PHYSICAL_ADDRESS)((UINTN)OldBuffer + OldSize) <= HandOffHob->EfiFreeMemoryBottom)); - } - - DEBUG_CODE_END (); - - // If new buffer would be smaller just return old buffer as FreePool isn't supported. - if ((OldBuffer != NULL) && (OldSize >= NewSize)) { - return OldBuffer; - } - - NewBuffer = AllocateZeroPool (NewSize); - if ((NewBuffer != NULL) && (OldBuffer != NULL)) { - CopyMem (NewBuffer, OldBuffer, MIN (OldSize, NewSize)); - FreePool (OldBuffer); - } - - return NewBuffer; -} diff --git a/MdeModulePkg/Bus/Spi/SpiNorFlashJedecSfdp/SpiNorFlash.c b/MdeModulePkg/Bus/Spi/SpiNorFlashJedecSfdp/SpiNorFlash.c index 3ac5420fbf..018a2b3a4a 100644 --- a/MdeModulePkg/Bus/Spi/SpiNorFlashJedecSfdp/SpiNorFlash.c +++ b/MdeModulePkg/Bus/Spi/SpiNorFlashJedecSfdp/SpiNorFlash.c @@ -49,6 +49,7 @@ FillWriteBuffer ( UINT8 SfdpAddressBytes; SfdpAddressBytes = (UINT8)Instance->SfdpBasicFlash->AddressBytes; + AddressSize = 0; // Copy Opcode into Write Buffer Instance->SpiTransactionWriteBuffer[0] = Opcode; diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc index 12f726f355..ba4298f736 100644 --- a/MdeModulePkg/MdeModulePkg.dsc +++ b/MdeModulePkg/MdeModulePkg.dsc @@ -109,6 +109,12 @@ SpiHcPlatformLib|MdeModulePkg/Library/BaseSpiHcPlatformLibNull/BaseSpiHcPlatformLibNull.inf IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf +[LibraryClasses.IA32] + AmdSvsmLib|UefiCpuPkg/Library/AmdSvsmLibNull/AmdSvsmLibNull.inf + +[LibraryClasses.X64] + AmdSvsmLib|OvmfPkg/Library/AmdSvsmLib/AmdSvsmLib.inf + [LibraryClasses.EBC.PEIM] IoLib|MdePkg/Library/PeiIoLibCpuIo/PeiIoLibCpuIo.inf diff --git a/MdePkg/Include/Library/DebugLib.h b/MdePkg/Include/Library/DebugLib.h index b79d67ad10..9531e5a7ff 100644 --- a/MdePkg/Include/Library/DebugLib.h +++ b/MdePkg/Include/Library/DebugLib.h @@ -437,7 +437,7 @@ UnitTestDebugAssert ( #define DEBUG(Expression) \ do { \ if (FALSE) { \ - _DEBUG (Expression); \ + _DEBUGLIB_DEBUG (Expression); \ } \ } while (FALSE) #endif diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c b/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c index f38e3ee3fe..f72bc93a68 100644 --- a/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c +++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c @@ -1001,7 +1001,7 @@ Dhcp6AppendETOption ( return EFI_INVALID_PARAMETER; } - if ((Elapsed == NULL)) { + if (Elapsed == NULL) { return EFI_INVALID_PARAMETER; } diff --git a/OvmfPkg/Library/PlatformInitLib/IntelTdx.c b/OvmfPkg/Library/PlatformInitLib/IntelTdx.c index d282d3895c..e561cee30b 100644 --- a/OvmfPkg/Library/PlatformInitLib/IntelTdx.c +++ b/OvmfPkg/Library/PlatformInitLib/IntelTdx.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf index c066cb1e63..8a41a78d2a 100644 --- a/OvmfPkg/OvmfPkgIa32.fdf +++ b/OvmfPkg/OvmfPkgIa32.fdf @@ -82,11 +82,11 @@ gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvm 0x010000|0x010000 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamSize -0x020000|0x0E0000 +0x020000|0x100000 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvSize FV = PEIFV -0x100000|0xE80000 +0x120000|0xE60000 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvSize FV = DXEFV diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf index f5da94c67f..33237f94ac 100644 --- a/OvmfPkg/OvmfPkgX64.fdf +++ b/OvmfPkg/OvmfPkgX64.fdf @@ -103,11 +103,11 @@ gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecApicPageTableBase|gUefiOvmfPkgTokenSpaceGui 0x011000|0x00F000 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamSize -0x020000|0x110000 +0x020000|0x120000 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvSize FV = PEIFV -0x130000|0xE50000 +0x140000|0xE40000 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvSize FV = DXEFV diff --git a/UefiCpuPkg/Library/MpInitLib/X64/AmdSev.c b/UefiCpuPkg/Library/MpInitLib/X64/AmdSev.c index bbdc47b5a3..d06c5e4995 100644 --- a/UefiCpuPkg/Library/MpInitLib/X64/AmdSev.c +++ b/UefiCpuPkg/Library/MpInitLib/X64/AmdSev.c @@ -9,13 +9,18 @@ **/ #include "MpLib.h" -#include + #include +#include +#include + #include #include #define _IS_ALIGNED(x, y) (ALIGN_POINTER((x), (y)) == (x)) +extern EFI_HOB_PLATFORM_INFO *mPlatformInfoHob; + /** Perform the requested AP Creation action. @@ -293,7 +298,7 @@ SevSnpCreateAP ( // GuidHob = GetFirstGuidHob (&gGhcbApicIdsGuid); GhcbApicIds = (GHCB_APIC_IDS *)(*(UINTN *)GET_GUID_HOB_DATA (GuidHob)); - MaxIndex = MIN (GhcbApicIds->NumEntries, PcdGet32 (PcdCpuMaxLogicalProcessorNumber)); + MaxIndex = MIN (GhcbApicIds->NumEntries, mPlatformInfoHob->PcdCpuMaxLogicalProcessorNumber); } else { // // APs have been previously started. diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayloadPkg.dsc index a0e3a7f579..999e3ab802 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.dsc +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc @@ -22,7 +22,7 @@ SUPPORTED_ARCHITECTURES = IA32|X64 BUILD_TARGETS = DEBUG|RELEASE|NOOPT SKUID_IDENTIFIER = DEFAULT - OUTPUT_DIRECTORY = Build/UefiPayloadPkg$(BUILD_ARCH) + OUTPUT_DIRECTORY = Build/UefiPayloadPkg FLASH_DEFINITION = UefiPayloadPkg/UefiPayloadPkg.fdf PCD_DYNAMIC_AS_DYNAMICEX = TRUE diff --git a/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestExpectFail/SampleUnitTestDxeExpectFail.inf b/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestExpectFail/SampleUnitTestDxeExpectFail.inf index 6757434952..5b68355c48 100644 --- a/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestExpectFail/SampleUnitTestDxeExpectFail.inf +++ b/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestExpectFail/SampleUnitTestDxeExpectFail.inf @@ -39,3 +39,6 @@ [Depex] TRUE + +[BuildOptions] + NOOPT_CLANGPDB_*_DLINK_FLAGS = /force:unresolved diff --git a/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestExpectFail/SampleUnitTestHostExpectFail.inf b/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestExpectFail/SampleUnitTestHostExpectFail.inf index dcaedbf7e4..06f3c94393 100644 --- a/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestExpectFail/SampleUnitTestHostExpectFail.inf +++ b/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestExpectFail/SampleUnitTestHostExpectFail.inf @@ -33,3 +33,6 @@ [Pcd] gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask + +[BuildOptions] + NOOPT_CLANGPDB_*_DLINK_FLAGS = /force:unresolved diff --git a/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestExpectFail/SampleUnitTestPeiExpectFail.inf b/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestExpectFail/SampleUnitTestPeiExpectFail.inf index 763d80e532..0d5b27919f 100644 --- a/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestExpectFail/SampleUnitTestPeiExpectFail.inf +++ b/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestExpectFail/SampleUnitTestPeiExpectFail.inf @@ -39,3 +39,6 @@ [Depex] gEfiPeiMemoryDiscoveredPpiGuid + +[BuildOptions] + NOOPT_CLANGPDB_*_DLINK_FLAGS = /force:unresolved diff --git a/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestExpectFail/SampleUnitTestSmmExpectFail.inf b/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestExpectFail/SampleUnitTestSmmExpectFail.inf index d4c2f4b707..08f861cbb1 100644 --- a/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestExpectFail/SampleUnitTestSmmExpectFail.inf +++ b/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestExpectFail/SampleUnitTestSmmExpectFail.inf @@ -40,3 +40,6 @@ [Depex] gEfiSmmCpuProtocolGuid + +[BuildOptions] + NOOPT_CLANGPDB_*_DLINK_FLAGS = /force:unresolved diff --git a/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestExpectFail/SampleUnitTestUefiShellExpectFail.inf b/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestExpectFail/SampleUnitTestUefiShellExpectFail.inf index 324b4ff52e..73eb37414d 100644 --- a/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestExpectFail/SampleUnitTestUefiShellExpectFail.inf +++ b/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestExpectFail/SampleUnitTestUefiShellExpectFail.inf @@ -36,3 +36,6 @@ [Pcd] gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask + +[BuildOptions] + NOOPT_CLANGPDB_*_DLINK_FLAGS = /force:unresolved diff --git a/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestGenerateException/SampleUnitTestDxeGenerateException.inf b/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestGenerateException/SampleUnitTestDxeGenerateException.inf index b742befe4d..7490f9a904 100644 --- a/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestGenerateException/SampleUnitTestDxeGenerateException.inf +++ b/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestGenerateException/SampleUnitTestDxeGenerateException.inf @@ -41,3 +41,6 @@ [Depex] TRUE + +[BuildOptions] + NOOPT_CLANGPDB_*_DLINK_FLAGS = /force:unresolved diff --git a/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestGenerateException/SampleUnitTestHostGenerateException.inf b/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestGenerateException/SampleUnitTestHostGenerateException.inf index a9f10ff184..1528209cda 100644 --- a/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestGenerateException/SampleUnitTestHostGenerateException.inf +++ b/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestGenerateException/SampleUnitTestHostGenerateException.inf @@ -35,3 +35,6 @@ [Pcd] gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask + +[BuildOptions] + NOOPT_CLANGPDB_*_DLINK_FLAGS = /force:unresolved diff --git a/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestGenerateException/SampleUnitTestPeiGenerateException.inf b/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestGenerateException/SampleUnitTestPeiGenerateException.inf index cb26961568..f0084c5b14 100644 --- a/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestGenerateException/SampleUnitTestPeiGenerateException.inf +++ b/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestGenerateException/SampleUnitTestPeiGenerateException.inf @@ -41,3 +41,6 @@ [Depex] gEfiPeiMemoryDiscoveredPpiGuid + +[BuildOptions] + NOOPT_CLANGPDB_*_DLINK_FLAGS = /force:unresolved diff --git a/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestGenerateException/SampleUnitTestSmmGenerateException.inf b/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestGenerateException/SampleUnitTestSmmGenerateException.inf index 5aee6a52bd..ab0c60e8d0 100644 --- a/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestGenerateException/SampleUnitTestSmmGenerateException.inf +++ b/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestGenerateException/SampleUnitTestSmmGenerateException.inf @@ -42,3 +42,6 @@ [Depex] gEfiSmmCpuProtocolGuid + +[BuildOptions] + NOOPT_CLANGPDB_*_DLINK_FLAGS = /force:unresolved diff --git a/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestGenerateException/SampleUnitTestUefiShellGenerateException.inf b/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestGenerateException/SampleUnitTestUefiShellGenerateException.inf index 32d6f4270a..306adf1ddf 100644 --- a/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestGenerateException/SampleUnitTestUefiShellGenerateException.inf +++ b/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTestGenerateException/SampleUnitTestUefiShellGenerateException.inf @@ -38,3 +38,6 @@ [Pcd] gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask + +[BuildOptions] + NOOPT_CLANGPDB_*_DLINK_FLAGS = /force:unresolved