diff options
42 files changed, 711 insertions, 453 deletions
diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec index d386bda..4f0de24 100644 --- a/EmbeddedPkg/EmbeddedPkg.dec +++ b/EmbeddedPkg/EmbeddedPkg.dec @@ -50,10 +50,6 @@ [Guids.common]
gEmbeddedTokenSpaceGuid = { 0xe0d8ca17, 0x4276, 0x4386, { 0xbb, 0x79, 0x48, 0xcb, 0x81, 0x3d, 0x3c, 0x4f }}
- ## FDT Configuration Table
- # Include/Guid/Fdt.h
- gFdtTableGuid = { 0xb1b621d5, 0xf19c, 0x41a5, { 0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0 } }
- gFdtVariableGuid = { 0x25a4fd4a, 0x9703, 0x4ba9, { 0xa1, 0x90, 0xb7, 0xc8, 0x4e, 0xfb, 0x3e, 0x57 } }
## Include/Guid/PlatformHasDeviceTree.h
gEdkiiPlatformHasDeviceTreeGuid = { 0x7ebb920d, 0x1aaf, 0x46d9, { 0xb2, 0xaf, 0x54, 0x1e, 0x1d, 0xce, 0x14, 0x8b } }
diff --git a/Maintainers.txt b/Maintainers.txt index 6beda4c..8be4f96 100644 --- a/Maintainers.txt +++ b/Maintainers.txt @@ -615,7 +615,7 @@ R: Min Xu <min.m.xu@intel.com> [mxu9] SecurityPkg: Tcg related modules
F: SecurityPkg/Tcg/
-R: Rahul Kumar <rahul1.kumar@intel.com> [rahul1-kumar]
+R: Arun Subramanian Baskaran <arun.subramanian.baskaran@intel.com> [arunsbaskaran]
SecurityPkg: SVSM related modules
F: SecurityPkg/Library/Tpm2DeviceLibDTpm/*Svsm*
@@ -657,7 +657,7 @@ M: Ray Ni <ray.ni@intel.com> [niruiyu] M: Jiaxin Wu <jiaxin.wu@intel.com> [jiaxinwu]
R: Zhiguang Liu <zhiguang.liu@intel.com> [LiuZhiguang001]
R: Dun Tan <dun.tan@intel.com> [td36]
-R: Rahul Kumar <rahul1.kumar@intel.com> [rahul1-kumar]
+R: Arun Subramanian Baskaran <arun.subramanian.baskaran@intel.com> [arunsbaskaran]
R: Gerd Hoffmann <kraxel@redhat.com> [kraxel]
R: Star Zeng <star.zeng@intel.com> [lzeng14]
R: Eduardo Cuevas Farfan <eduardo.cuevas.farfan@intel.com> [ecuevasf]
diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c index c830db6..c337f15 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c @@ -837,6 +837,10 @@ XhcTransfer ( }
Xhc->PciIo->Flush (Xhc->PciIo);
+ //
+ // Do not free URB data, since it is passed in as an external argument
+ // and allocated and managed by the caller.
+ //
XhcFreeUrb (Xhc, Urb);
return Status;
}
@@ -1227,8 +1231,9 @@ ON_EXIT: sending or receiving.
@param DataBuffersNumber Number of data buffers prepared for the transfer.
@param Data Array of pointers to the buffers of data to transmit
- from or receive into.
- @param DataLength The lenght of the data buffer.
+ from or receive into. The caller is responsible for freeing
+ the buffers after the transfers are completed.
+ @param DataLength The length of the data buffer.
@param DataToggle On input, the initial data toggle for the transfer;
On output, it is updated to to next data toggle to
use of the subsequent bulk transfer.
diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c index 50d7d4b..52551a3 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c @@ -107,6 +107,10 @@ XhcCmdTransfer ( Status = EFI_SUCCESS;
}
+ //
+ // Do not free URB data, since `XhcCreateCmdTrb` does not allocate any data
+ // and the `Data` field is not used in command transfers.
+ //
XhcFreeUrb (Xhc, Urb);
ON_EXIT:
@@ -184,6 +188,9 @@ XhcCreateUrb ( /**
Free an allocated URB.
+ The `Data` field of the URB is not owned by the URB and is not freed here.
+ The caller is which allocates `Data` is responsible for freeing it.
+ Freeing `Data` must be done AFTER calling `XhcFreeUrb`, since this function may unmap the `DataMap` field.
@param Xhc The XHCI device.
@param Urb The URB to free.
@@ -1388,6 +1395,7 @@ XhciDelAsyncIntTransfer ( LIST_ENTRY *Entry;
LIST_ENTRY *Next;
URB *Urb;
+ VOID *UrbData;
EFI_USB_DATA_DIRECTION Direction;
EFI_STATUS Status;
@@ -1412,8 +1420,16 @@ XhciDelAsyncIntTransfer ( }
RemoveEntryList (&Urb->UrbList);
- FreePool (Urb->Data);
+ //
+ // For `XhciDelAsyncIntTransfer`, the URB is created through `XhciInsertAsyncIntTransfer`
+ // and allocates and manages its own data buffer, so free it here.
+ //
+ UrbData = Urb->Data;
XhcFreeUrb (Xhc, Urb);
+ if (UrbData != NULL) {
+ FreePool (UrbData);
+ }
+
return EFI_SUCCESS;
}
}
@@ -1435,6 +1451,7 @@ XhciDelAllAsyncIntTransfers ( LIST_ENTRY *Entry;
LIST_ENTRY *Next;
URB *Urb;
+ VOID *UrbData;
EFI_STATUS Status;
BASE_LIST_FOR_EACH_SAFE (Entry, Next, &Xhc->AsyncIntTransfers) {
@@ -1450,8 +1467,15 @@ XhciDelAllAsyncIntTransfers ( }
RemoveEntryList (&Urb->UrbList);
- FreePool (Urb->Data);
+ //
+ // For `XhciDelAllAsyncIntTransfers`, the URB is created through `XhciInsertAsyncIntTransfer`
+ // and allocates and manages its own data buffer, so free it here.
+ //
+ UrbData = Urb->Data;
XhcFreeUrb (Xhc, Urb);
+ if (UrbData != NULL) {
+ FreePool (UrbData);
+ }
}
}
@@ -1631,6 +1655,17 @@ XhcMonitorAsyncRequests ( Xhc = (USB_XHCI_INSTANCE *)Context;
BASE_LIST_FOR_EACH_SAFE (Entry, Next, &Xhc->AsyncIntTransfers) {
+ //
+ // Save values passed into the callback.
+ // `XhcUpdateAsyncRequest` must be called before the callback
+ // since the callback may free the URB, leading to a fault.
+ // However, the callback depends on values of the URB *before*
+ // `XhcUpdateAsyncRequest` is called, so we must save a copy.
+ //
+ UINTN cbCompleted;
+ UINT32 cbResult;
+ VOID *cbContext;
+
Urb = EFI_LIST_CONTAINER (Entry, URB, UrbList);
//
@@ -1683,6 +1718,19 @@ XhcMonitorAsyncRequests ( }
//
+ // Store values of URB before `XhcUpdateAsyncRequest`, since the callback depends on these values.
+ //
+ cbCompleted = Urb->Completed;
+ cbResult = Urb->Result;
+ cbContext = Urb->Context;
+
+ //
+ // The update call must occur before the callback since the callback
+ // may remove and free the URB, leading to a fault.
+ //
+ XhcUpdateAsyncRequest (Xhc, Urb);
+
+ //
// Leave error recovery to its related device driver. A
// common case of the error recovery is to re-submit the
// interrupt transfer which is linked to the head of the
@@ -1694,19 +1742,17 @@ XhcMonitorAsyncRequests ( //
if (Urb->Callback != NULL) {
//
- // Restore the old TPL, USB bus maybe connect device in
- // his callback. Some drivers may has a lower TPL restriction.
+ // Restore the previous TPL. The USB bus may connect a device in its callback,
+ // and some drivers require a lower TPL to run correctly.
//
gBS->RestoreTPL (OldTpl);
- (Urb->Callback)(ProcBuf, Urb->Completed, Urb->Context, Urb->Result);
+ (Urb->Callback)(ProcBuf, cbCompleted, cbContext, cbResult);
OldTpl = gBS->RaiseTPL (XHC_TPL);
}
if (ProcBuf != NULL) {
gBS->FreePool (ProcBuf);
}
-
- XhcUpdateAsyncRequest (Xhc, Urb);
}
gBS->RestoreTPL (OldTpl);
}
diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c index a03b2ce..c1072af 100644 --- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c +++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c @@ -1862,43 +1862,47 @@ UfsEnableHostController ( }
}
- //
- // UFS 2.0 spec section 7.1.1 - Host Controller Initialization
- //
- // Reinitialize the UFS host controller if HCE bit of HC register is set.
- //
- Status = UfsMmioRead32 (Private, UFS_HC_ENABLE_OFFSET, &Data);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- if ((Data & UFS_HC_HCE_EN) == UFS_HC_HCE_EN) {
+ if ((mUfsHcPlatform == NULL) ||
+ ((mUfsHcPlatform->Version >= 3) && !mUfsHcPlatform->SkipHceReenable))
+ {
//
- // Write a 0 to the HCE register at first to disable the host controller.
+ // UFS 2.0 spec section 7.1.1 - Host Controller Initialization
//
- Status = UfsMmioWrite32 (Private, UFS_HC_ENABLE_OFFSET, 0);
+ // Reinitialize the UFS host controller if HCE bit of HC register is set.
+ //
+ Status = UfsMmioRead32 (Private, UFS_HC_ENABLE_OFFSET, &Data);
if (EFI_ERROR (Status)) {
return Status;
}
+ if ((Data & UFS_HC_HCE_EN) == UFS_HC_HCE_EN) {
+ //
+ // Write a 0 to the HCE register at first to disable the host controller.
+ //
+ Status = UfsMmioWrite32 (Private, UFS_HC_ENABLE_OFFSET, 0);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Wait until HCE is read as '0' before continuing.
+ //
+ Status = UfsWaitMemSet (Private, UFS_HC_ENABLE_OFFSET, UFS_HC_HCE_EN, 0, UFS_TIMEOUT);
+ if (EFI_ERROR (Status)) {
+ return EFI_DEVICE_ERROR;
+ }
+ }
+
//
- // Wait until HCE is read as '0' before continuing.
+ // Write a 1 to the HCE register to enable the UFS host controller.
//
- Status = UfsWaitMemSet (Private, UFS_HC_ENABLE_OFFSET, UFS_HC_HCE_EN, 0, UFS_TIMEOUT);
+ Status = UfsMmioWrite32 (Private, UFS_HC_ENABLE_OFFSET, UFS_HC_HCE_EN);
if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
+ return Status;
}
}
//
- // Write a 1 to the HCE register to enable the UFS host controller.
- //
- Status = UfsMmioWrite32 (Private, UFS_HC_ENABLE_OFFSET, UFS_HC_HCE_EN);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
// Wait until HCE is read as '1' before continuing.
//
Status = UfsWaitMemSet (Private, UFS_HC_ENABLE_OFFSET, UFS_HC_HCE_EN, UFS_HC_HCE_EN, UFS_TIMEOUT);
@@ -1945,6 +1949,10 @@ UfsDeviceDetection ( }
}
+ if ((mUfsHcPlatform != NULL) && (mUfsHcPlatform->Version >= 3) && mUfsHcPlatform->SkipLinkStartup) {
+ return EFI_SUCCESS;
+ }
+
//
// Start UFS device detection.
// Try up to 3 times for establishing data link with device.
diff --git a/MdeModulePkg/Include/Protocol/UfsHostControllerPlatform.h b/MdeModulePkg/Include/Protocol/UfsHostControllerPlatform.h index 32e9f64..b5b3160 100644 --- a/MdeModulePkg/Include/Protocol/UfsHostControllerPlatform.h +++ b/MdeModulePkg/Include/Protocol/UfsHostControllerPlatform.h @@ -11,7 +11,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include <Protocol/UfsHostController.h>
-#define EDKII_UFS_HC_PLATFORM_PROTOCOL_VERSION 2
+#define EDKII_UFS_HC_PLATFORM_PROTOCOL_VERSION 3
extern EFI_GUID gEdkiiUfsHcPlatformProtocolGuid;
@@ -129,6 +129,14 @@ struct _EDKII_UFS_HC_PLATFORM_PROTOCOL { /// Reference Clock Frequency Ufs Card Attribute that need to be set in this Ufs Host Environment.
///
EDKII_UFS_CARD_REF_CLK_FREQ_ATTRIBUTE RefClkFreq;
+ ///
+ /// Flag to skip HCE re-enable.
+ ///
+ BOOLEAN SkipHceReenable;
+ ///
+ /// Flag to skip link startup.
+ ///
+ BOOLEAN SkipLinkStartup;
};
#endif
diff --git a/EmbeddedPkg/Include/Guid/Fdt.h b/MdePkg/Include/Guid/Fdt.h index e009146..9f9270a 100644 --- a/EmbeddedPkg/Include/Guid/Fdt.h +++ b/MdePkg/Include/Guid/Fdt.h @@ -14,9 +14,4 @@ extern EFI_GUID gFdtTableGuid;
-#define FDT_VARIABLE_GUID \
- { 0x25a4fd4a, 0x9703, 0x4ba9, { 0xa1, 0x90, 0xb7, 0xc8, 0x4e, 0xfb, 0x3e, 0x57 } }
-
-extern EFI_GUID gFdtVariableGuid;
-
#endif /* __FDT_H__ */
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index 842abaa..ed22a67 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -615,6 +615,10 @@ ## Include/Guid/FdtHob.h
gFdtHobGuid = { 0x16958446, 0x19B7, 0x480B, { 0xB0, 0x47, 0x74, 0x85, 0xAD, 0x3F, 0x71, 0x6D } }
+ ## FDT Configuration Table
+ # Include/Guid/Fdt.h
+ gFdtTableGuid = { 0xb1b621d5, 0xf19c, 0x41a5, { 0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0 } }
+
## Include/Guid/ImageAuthentication.h
gEfiImageSecurityDatabaseGuid = { 0xd719b2cb, 0x3d3a, 0x4596, {0xa3, 0xbc, 0xda, 0xd0, 0xe, 0x67, 0x65, 0x6f }}
gEfiCertSha256Guid = { 0xc1c41626, 0x504c, 0x4092, {0xac, 0xa9, 0x41, 0xf9, 0x36, 0x93, 0x43, 0x28 }}
diff --git a/SecurityPkg/FvReportPei/FvReportPei.c b/SecurityPkg/FvReportPei/FvReportPei.c index 4376f52..50773db 100644 --- a/SecurityPkg/FvReportPei/FvReportPei.c +++ b/SecurityPkg/FvReportPei/FvReportPei.c @@ -71,10 +71,7 @@ InstallPreHashFvPpi ( + HashSize;
PreHashedFvPpi = AllocatePool (PpiSize);
- if (PreHashedFvPpi == NULL) {
- ASSERT (PreHashedFvPpi != NULL);
- return;
- }
+ ASSERT (PreHashedFvPpi != NULL);
PreHashedFvPpi->FvBase = (UINT32)(UINTN)FvBuffer;
PreHashedFvPpi->FvLength = (UINT32)FvLength;
@@ -86,11 +83,7 @@ InstallPreHashFvPpi ( CopyMem (HASH_VALUE_PTR (HashInfo), HashValue, HashSize);
FvInfoPpiDescriptor = AllocatePool (sizeof (EFI_PEI_PPI_DESCRIPTOR));
- if (FvInfoPpiDescriptor == NULL) {
- ASSERT (FvInfoPpiDescriptor != NULL);
- FreePool (PreHashedFvPpi);
- return;
- }
+ ASSERT (FvInfoPpiDescriptor != NULL);
FvInfoPpiDescriptor->Guid = &gEdkiiPeiFirmwareVolumeInfoPrehashedFvPpiGuid;
FvInfoPpiDescriptor->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
@@ -209,11 +202,8 @@ VerifyHashedFv ( // Copy FV to permanent memory to avoid potential TOC/TOU.
//
FvBuffer = AllocatePages (EFI_SIZE_TO_PAGES ((UINTN)FvInfo[FvIndex].Length));
- if (FvBuffer == NULL) {
- ASSERT (FvBuffer != NULL);
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
+
+ ASSERT (FvBuffer != NULL);
if (FvShadowPpi != NULL) {
Status = FvShadowPpi->FirmwareVolumeShadow (
@@ -389,17 +379,12 @@ CheckStoredHashFv ( );
if (!EFI_ERROR (Status) && (StoredHashFvPpi != NULL) && (StoredHashFvPpi->FvNumber > 0)) {
HashInfo = GetHashInfo (StoredHashFvPpi, BootMode);
- if (HashInfo != NULL) {
- Status = VerifyHashedFv (
+ Status = VerifyHashedFv (
HashInfo,
StoredHashFvPpi->FvInfo,
StoredHashFvPpi->FvNumber,
BootMode
);
- } else {
- Status = EFI_NOT_FOUND;
- }
-
if (!EFI_ERROR (Status)) {
DEBUG ((DEBUG_INFO, "OBB verification passed (%r)\r\n", Status));
diff --git a/SecurityPkg/HddPassword/HddPasswordDxe.c b/SecurityPkg/HddPassword/HddPasswordDxe.c index 228a9f4..6f36b5a 100644 --- a/SecurityPkg/HddPassword/HddPasswordDxe.c +++ b/SecurityPkg/HddPassword/HddPasswordDxe.c @@ -149,10 +149,7 @@ BuildHddPasswordDeviceInfo ( S3InitDevicesExist = FALSE;
} else if (Status == EFI_BUFFER_TOO_SMALL) {
S3InitDevices = AllocatePool (S3InitDevicesLength);
- if (S3InitDevices == NULL) {
- ASSERT (S3InitDevices != NULL);
- return;
- }
+ ASSERT (S3InitDevices != NULL);
Status = RestoreLockBox (
&gS3StorageDeviceInitListGuid,
@@ -187,10 +184,7 @@ BuildHddPasswordDeviceInfo ( FreePool (S3InitDevicesBak);
}
- if (S3InitDevices == NULL) {
- ASSERT (S3InitDevices != NULL);
- return;
- }
+ ASSERT (S3InitDevices != NULL);
TempDevInfo = (HDD_PASSWORD_DEVICE_INFO *)((UINTN)TempDevInfo +
sizeof (HDD_PASSWORD_DEVICE_INFO) +
@@ -2201,14 +2195,8 @@ HddPasswordFormExtractConfig ( // followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a Null-terminator
//
ConfigRequestHdr = HiiConstructConfigHdr (&mHddPasswordVendorGuid, mHddPasswordVendorStorageName, Private->DriverHandle);
- if (ConfigRequestHdr == NULL) {
- ASSERT (ConfigRequestHdr != NULL);
- FreePool (IfrData);
- return EFI_OUT_OF_RESOURCES;
- }
-
- Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
- ConfigRequest = AllocateZeroPool (Size);
+ Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
+ ConfigRequest = AllocateZeroPool (Size);
ASSERT (ConfigRequest != NULL);
AllocatedRequest = TRUE;
UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize);
@@ -2398,11 +2386,7 @@ HddPasswordFormCallback ( // In case goto the device configuration form, update the device form title.
//
ConfigFormEntry = HddPasswordGetConfigFormEntryByIndex ((UINT32)(QuestionId - KEY_HDD_DEVICE_ENTRY_BASE));
- if (ConfigFormEntry == NULL) {
- ASSERT (ConfigFormEntry != NULL);
- FreePool (IfrData);
- return EFI_NOT_FOUND;
- }
+ ASSERT (ConfigFormEntry != NULL);
DeviceFormTitleToken = (EFI_STRING_ID)STR_HDD_SECURITY_HD;
HiiSetString (Private->HiiHandle, DeviceFormTitleToken, ConfigFormEntry->HddString, NULL);
diff --git a/SecurityPkg/Library/AuthVariableLib/AuthService.c b/SecurityPkg/Library/AuthVariableLib/AuthService.c index 2d79cc1..706cb67 100644 --- a/SecurityPkg/Library/AuthVariableLib/AuthService.c +++ b/SecurityPkg/Library/AuthVariableLib/AuthService.c @@ -553,7 +553,7 @@ CheckSignatureListFormat ( // Walk through the input signature list and check the data format.
// If any signature is incorrectly formed, the whole check will fail.
//
- while ((SigDataSize > 0) && (SigDataSize >= (UINTN)SigList->SignatureListSize)) {
+ while ((SigDataSize > 0) && (SigDataSize >= SigList->SignatureListSize)) {
for (Index = 0; Index < (sizeof (mSupportSigItem) / sizeof (EFI_SIGNATURE_ITEM)); Index++ ) {
if (CompareGuid (&SigList->SignatureType, &mSupportSigItem[Index].SigType)) {
//
@@ -1088,7 +1088,7 @@ FilterSignatureList ( Tail = TempData;
NewCertList = (EFI_SIGNATURE_LIST *)NewData;
- while ((*NewDataSize > 0) && (*NewDataSize >= (UINTN)NewCertList->SignatureListSize)) {
+ while ((*NewDataSize > 0) && (*NewDataSize >= NewCertList->SignatureListSize)) {
NewCert = (EFI_SIGNATURE_DATA *)((UINT8 *)NewCertList + sizeof (EFI_SIGNATURE_LIST) + NewCertList->SignatureHeaderSize);
NewCertCount = (NewCertList->SignatureListSize - sizeof (EFI_SIGNATURE_LIST) - NewCertList->SignatureHeaderSize) / NewCertList->SignatureSize;
@@ -1098,7 +1098,7 @@ FilterSignatureList ( Size = DataSize;
CertList = (EFI_SIGNATURE_LIST *)Data;
- while ((Size > 0) && (Size >= (UINTN)CertList->SignatureListSize)) {
+ while ((Size > 0) && (Size >= CertList->SignatureListSize)) {
if (CompareGuid (&CertList->SignatureType, &NewCertList->SignatureType) &&
(CertList->SignatureSize == NewCertList->SignatureSize))
{
diff --git a/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c b/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c index 5ac6dda..46d39cd 100644 --- a/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c +++ b/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c @@ -883,7 +883,7 @@ IsCertHashFoundInDbx ( return Status;
}
- while ((DbxSize > 0) && (SignatureListSize >= (UINTN)DbxList->SignatureListSize)) {
+ while ((DbxSize > 0) && (SignatureListSize >= DbxList->SignatureListSize)) {
//
// Determine Hash Algorithm of Certificate in the forbidden database.
//
@@ -1028,7 +1028,7 @@ IsSignatureFoundInDatabase ( // Enumerate all signature data in SigDB to check if signature exists for executable.
//
CertList = (EFI_SIGNATURE_LIST *)Data;
- while ((DataSize > 0) && (DataSize >= (UINTN)CertList->SignatureListSize)) {
+ while ((DataSize > 0) && (DataSize >= CertList->SignatureListSize)) {
CertCount = (CertList->SignatureListSize - sizeof (EFI_SIGNATURE_LIST) - CertList->SignatureHeaderSize) / CertList->SignatureSize;
Cert = (EFI_SIGNATURE_DATA *)((UINT8 *)CertList + sizeof (EFI_SIGNATURE_LIST) + CertList->SignatureHeaderSize);
if ((CertList->SignatureSize == sizeof (EFI_SIGNATURE_DATA) - 1 + SignatureSize) && (CompareGuid (&CertList->SignatureType, CertType))) {
@@ -1193,7 +1193,7 @@ PassTimestampCheck ( }
CertList = (EFI_SIGNATURE_LIST *)DbtData;
- while ((DbtDataSize > 0) && (DbtDataSize >= (UINTN)CertList->SignatureListSize)) {
+ while ((DbtDataSize > 0) && (DbtDataSize >= CertList->SignatureListSize)) {
if (CompareGuid (&CertList->SignatureType, &gEfiCertX509Guid)) {
Cert = (EFI_SIGNATURE_DATA *)((UINT8 *)CertList + sizeof (EFI_SIGNATURE_LIST) + CertList->SignatureHeaderSize);
CertCount = (CertList->SignatureListSize - sizeof (EFI_SIGNATURE_LIST) - CertList->SignatureHeaderSize) / CertList->SignatureSize;
@@ -1319,7 +1319,7 @@ IsForbiddenByDbx ( //
CertList = (EFI_SIGNATURE_LIST *)Data;
CertListSize = DataSize;
- while ((CertListSize > 0) && (CertListSize >= (UINTN)CertList->SignatureListSize)) {
+ while ((CertListSize > 0) && (CertListSize >= CertList->SignatureListSize)) {
if (CompareGuid (&CertList->SignatureType, &gEfiCertX509Guid)) {
CertData = (EFI_SIGNATURE_DATA *)((UINT8 *)CertList + sizeof (EFI_SIGNATURE_LIST) + CertList->SignatureHeaderSize);
CertCount = (CertList->SignatureListSize - sizeof (EFI_SIGNATURE_LIST) - CertList->SignatureHeaderSize) / CertList->SignatureSize;
@@ -1524,7 +1524,7 @@ IsAllowedByDb ( // Find X509 certificate in Signature List to verify the signature in pkcs7 signed data.
//
CertList = (EFI_SIGNATURE_LIST *)Data;
- while ((DataSize > 0) && (DataSize >= (UINTN)CertList->SignatureListSize)) {
+ while ((DataSize > 0) && (DataSize >= CertList->SignatureListSize)) {
if (CompareGuid (&CertList->SignatureType, &gEfiCertX509Guid)) {
CertData = (EFI_SIGNATURE_DATA *)((UINT8 *)CertList + sizeof (EFI_SIGNATURE_LIST) + CertList->SignatureHeaderSize);
CertCount = (CertList->SignatureListSize - sizeof (EFI_SIGNATURE_LIST) - CertList->SignatureHeaderSize) / CertList->SignatureSize;
@@ -2057,9 +2057,8 @@ Failed: // executable information table in either case.
//
NameStr = ConvertDevicePathToText (File, FALSE, TRUE);
-
+ AddImageExeInfo (Action, NameStr, File, SignatureList, SignatureListSize);
if (NameStr != NULL) {
- AddImageExeInfo (Action, NameStr, File, SignatureList, SignatureListSize);
DEBUG ((DEBUG_INFO, "The image doesn't pass verification: %s\n", NameStr));
FreePool (NameStr);
}
diff --git a/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLib.c b/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLib.c index f81519d..de4f5e5 100644 --- a/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLib.c +++ b/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLib.c @@ -387,10 +387,7 @@ Tcg2UserConfirm ( NoPpiInfo = FALSE;
BufSize = CONFIRM_BUFFER_SIZE;
ConfirmText = AllocateZeroPool (BufSize);
- if (ConfirmText == NULL) {
- ASSERT (ConfirmText != NULL);
- return FALSE;
- }
+ ASSERT (ConfirmText != NULL);
mTcg2PpStringPackHandle = HiiAddPackages (&gEfiTcg2PhysicalPresenceGuid, gImageHandle, DxeTcg2PhysicalPresenceLibStrings, NULL);
ASSERT (mTcg2PpStringPackHandle != NULL);
@@ -404,20 +401,10 @@ Tcg2UserConfirm ( TmpStr2 = Tcg2PhysicalPresenceGetStringById (STRING_TOKEN (TPM_CLEAR));
TmpStr1 = Tcg2PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR));
- if ((TmpStr1 == NULL) || (TmpStr2 == NULL)) {
- FreePool (ConfirmText);
- return FALSE;
- }
-
UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2);
FreePool (TmpStr1);
TmpStr1 = Tcg2PhysicalPresenceGetStringById (STRING_TOKEN (TPM_WARNING_CLEAR));
- if (TmpStr1 == NULL) {
- FreePool (ConfirmText);
- return FALSE;
- }
-
StrnCatS (ConfirmText, BufSize / sizeof (CHAR16), TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);
StrnCatS (ConfirmText, BufSize / sizeof (CHAR16), L" \n\n", (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);
FreePool (TmpStr1);
@@ -430,29 +417,14 @@ Tcg2UserConfirm ( TmpStr2 = Tcg2PhysicalPresenceGetStringById (STRING_TOKEN (TPM_CLEAR));
TmpStr1 = Tcg2PhysicalPresenceGetStringById (STRING_TOKEN (TPM_PPI_HEAD_STR));
- if ((TmpStr1 == NULL) || (TmpStr2 == NULL)) {
- FreePool (ConfirmText);
- return FALSE;
- }
-
UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2);
FreePool (TmpStr1);
TmpStr1 = Tcg2PhysicalPresenceGetStringById (STRING_TOKEN (TPM_NOTE_CLEAR));
- if (TmpStr1 == NULL) {
- FreePool (ConfirmText);
- return FALSE;
- }
-
StrnCatS (ConfirmText, BufSize / sizeof (CHAR16), TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);
FreePool (TmpStr1);
TmpStr1 = Tcg2PhysicalPresenceGetStringById (STRING_TOKEN (TPM_WARNING_CLEAR));
- if (TmpStr1 == NULL) {
- FreePool (ConfirmText);
- return FALSE;
- }
-
StrnCatS (ConfirmText, BufSize / sizeof (CHAR16), TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);
StrnCatS (ConfirmText, BufSize / sizeof (CHAR16), L" \n\n", (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);
FreePool (TmpStr1);
@@ -480,29 +452,14 @@ Tcg2UserConfirm ( TmpStr2 = Tcg2PhysicalPresenceGetStringById (STRING_TOKEN (TPM_SET_PCR_BANKS));
TmpStr1 = Tcg2PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR));
- if ((TmpStr1 == NULL) || (TmpStr2 == NULL)) {
- FreePool (ConfirmText);
- return FALSE;
- }
-
UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2);
FreePool (TmpStr1);
TmpStr1 = Tcg2PhysicalPresenceGetStringById (STRING_TOKEN (TPM_WARNING_SET_PCR_BANKS_1));
- if (TmpStr1 == NULL) {
- FreePool (ConfirmText);
- return FALSE;
- }
-
StrnCatS (ConfirmText, BufSize / sizeof (CHAR16), TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);
FreePool (TmpStr1);
TmpStr1 = Tcg2PhysicalPresenceGetStringById (STRING_TOKEN (TPM_WARNING_SET_PCR_BANKS_2));
- if (TmpStr1 == NULL) {
- FreePool (ConfirmText);
- return FALSE;
- }
-
StrnCatS (ConfirmText, BufSize / sizeof (CHAR16), TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);
FreePool (TmpStr1);
@@ -510,11 +467,7 @@ Tcg2UserConfirm ( Tcg2FillBufferWithBootHashAlg (TempBuffer2, sizeof (TempBuffer2), CurrentPCRBanks);
TmpStr1 = AllocateZeroPool (BufSize);
- if (TmpStr1 == NULL) {
- ASSERT (TmpStr1 != NULL);
- return FALSE;
- }
-
+ ASSERT (TmpStr1 != NULL);
UnicodeSPrint (TmpStr1, BufSize, L"Current PCRBanks is 0x%x. (%s)\nNew PCRBanks is 0x%x. (%s)\n", CurrentPCRBanks, TempBuffer2, TpmPpCommandParameter, TempBuffer);
StrnCatS (ConfirmText, BufSize / sizeof (CHAR16), TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);
@@ -528,29 +481,14 @@ Tcg2UserConfirm ( TmpStr2 = Tcg2PhysicalPresenceGetStringById (STRING_TOKEN (TPM_CHANGE_EPS));
TmpStr1 = Tcg2PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR));
- if ((TmpStr1 == NULL) || (TmpStr2 == NULL)) {
- FreePool (ConfirmText);
- return FALSE;
- }
-
UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2);
FreePool (TmpStr1);
TmpStr1 = Tcg2PhysicalPresenceGetStringById (STRING_TOKEN (TPM_WARNING_CHANGE_EPS_1));
- if (TmpStr1 == NULL) {
- FreePool (ConfirmText);
- return FALSE;
- }
-
StrnCatS (ConfirmText, BufSize / sizeof (CHAR16), TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);
FreePool (TmpStr1);
TmpStr1 = Tcg2PhysicalPresenceGetStringById (STRING_TOKEN (TPM_WARNING_CHANGE_EPS_2));
- if (TmpStr1 == NULL) {
- FreePool (ConfirmText);
- return FALSE;
- }
-
StrnCatS (ConfirmText, BufSize / sizeof (CHAR16), TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);
FreePool (TmpStr1);
@@ -560,11 +498,6 @@ Tcg2UserConfirm ( TmpStr2 = Tcg2PhysicalPresenceGetStringById (STRING_TOKEN (TCG_STORAGE_ENABLE_BLOCK_SID));
TmpStr1 = Tcg2PhysicalPresenceGetStringById (STRING_TOKEN (TCG_STORAGE_HEAD_STR));
- if ((TmpStr1 == NULL) || (TmpStr2 == NULL)) {
- FreePool (ConfirmText);
- return FALSE;
- }
-
UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2);
FreePool (TmpStr1);
break;
@@ -573,11 +506,6 @@ Tcg2UserConfirm ( TmpStr2 = Tcg2PhysicalPresenceGetStringById (STRING_TOKEN (TCG_STORAGE_DISABLE_BLOCK_SID));
TmpStr1 = Tcg2PhysicalPresenceGetStringById (STRING_TOKEN (TCG_STORAGE_HEAD_STR));
- if ((TmpStr1 == NULL) || (TmpStr2 == NULL)) {
- FreePool (ConfirmText);
- return FALSE;
- }
-
UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2);
FreePool (TmpStr1);
break;
@@ -587,11 +515,6 @@ Tcg2UserConfirm ( TmpStr2 = Tcg2PhysicalPresenceGetStringById (STRING_TOKEN (TCG_STORAGE_PP_ENABLE_BLOCK_SID));
TmpStr1 = Tcg2PhysicalPresenceGetStringById (STRING_TOKEN (TCG_STORAGE_PPI_HEAD_STR));
- if ((TmpStr1 == NULL) || (TmpStr2 == NULL)) {
- FreePool (ConfirmText);
- return FALSE;
- }
-
UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2);
FreePool (TmpStr1);
break;
@@ -601,11 +524,6 @@ Tcg2UserConfirm ( TmpStr2 = Tcg2PhysicalPresenceGetStringById (STRING_TOKEN (TCG_STORAGE_PP_DISABLE_BLOCK_SID));
TmpStr1 = Tcg2PhysicalPresenceGetStringById (STRING_TOKEN (TCG_STORAGE_PPI_HEAD_STR));
- if ((TmpStr1 == NULL) || (TmpStr2 == NULL)) {
- FreePool (ConfirmText);
- return FALSE;
- }
-
UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2);
FreePool (TmpStr1);
break;
@@ -626,21 +544,11 @@ Tcg2UserConfirm ( TmpStr1 = Tcg2PhysicalPresenceGetStringById (STRING_TOKEN (TPM_ACCEPT_KEY));
}
- if (TmpStr1 == NULL) {
- FreePool (ConfirmText);
- return FALSE;
- }
-
StrnCatS (ConfirmText, BufSize / sizeof (CHAR16), TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);
FreePool (TmpStr1);
if (NoPpiInfo) {
TmpStr1 = Tcg2PhysicalPresenceGetStringById (STRING_TOKEN (TPM_NO_PPI_INFO));
- if (TmpStr1 == NULL) {
- FreePool (ConfirmText);
- return FALSE;
- }
-
StrnCatS (ConfirmText, BufSize / sizeof (CHAR16), TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);
FreePool (TmpStr1);
}
@@ -653,21 +561,11 @@ Tcg2UserConfirm ( TmpStr1 = Tcg2PhysicalPresenceGetStringById (STRING_TOKEN (TCG_STORAGE_ACCEPT_KEY));
}
- if (TmpStr1 == NULL) {
- FreePool (ConfirmText);
- return FALSE;
- }
-
StrnCatS (ConfirmText, BufSize / sizeof (CHAR16), TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);
FreePool (TmpStr1);
if (NoPpiInfo) {
TmpStr1 = Tcg2PhysicalPresenceGetStringById (STRING_TOKEN (TCG_STORAGE_NO_PPI_INFO));
- if (TmpStr1 == NULL) {
- FreePool (ConfirmText);
- return FALSE;
- }
-
StrnCatS (ConfirmText, BufSize / sizeof (CHAR16), TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);
FreePool (TmpStr1);
}
@@ -675,11 +573,6 @@ Tcg2UserConfirm ( TmpStr1 = Tcg2PhysicalPresenceGetStringById (STRING_TOKEN (TCG_STORAGE_REJECT_KEY));
}
- if (TmpStr1 == NULL) {
- FreePool (ConfirmText);
- return FALSE;
- }
-
BufSize -= StrSize (ConfirmText);
UnicodeSPrint (ConfirmText + StrLen (ConfirmText), BufSize, TmpStr1, TmpStr2);
diff --git a/SecurityPkg/Library/DxeTcgPhysicalPresenceLib/DxeTcgPhysicalPresenceLib.c b/SecurityPkg/Library/DxeTcgPhysicalPresenceLib/DxeTcgPhysicalPresenceLib.c index d38a607..597ce77 100644 --- a/SecurityPkg/Library/DxeTcgPhysicalPresenceLib/DxeTcgPhysicalPresenceLib.c +++ b/SecurityPkg/Library/DxeTcgPhysicalPresenceLib/DxeTcgPhysicalPresenceLib.c @@ -540,7 +540,7 @@ UserConfirm ( CHAR16 *TmpStr2;
UINTN BufSize;
BOOLEAN CautionKey;
- UINTN Index;
+ UINT16 Index;
CHAR16 DstStr[81];
TmpStr2 = NULL;
diff --git a/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c b/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c index b8eb5d6..acba11d 100644 --- a/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c +++ b/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c @@ -615,9 +615,6 @@ GetMeasureBootProtocols ( @retval EFI_SUCCESS The file specified by DevicePath and non-NULL
FileBuffer did authenticate, and the platform policy dictates
that the DXE Foundation may use the file.
-
- @retval EFI_OUT_OF_RESOURCES A necessary memory buffer could not be allocated.
-
@retval other error value
**/
EFI_STATUS
@@ -711,16 +708,9 @@ DxeTpm2MeasureBootHandler ( }
}
- if (OrigDevicePathNode != NULL) {
- FreePool (OrigDevicePathNode);
- }
-
+ FreePool (OrigDevicePathNode);
OrigDevicePathNode = DuplicateDevicePath (File);
- if (OrigDevicePathNode == NULL) {
- ASSERT (OrigDevicePathNode != NULL);
- return EFI_OUT_OF_RESOURCES;
- }
-
+ ASSERT (OrigDevicePathNode != NULL);
break;
}
}
diff --git a/SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.c b/SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.c index 7b00833..c786c21 100644 --- a/SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.c +++ b/SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.c @@ -56,10 +56,7 @@ Sha1HashInit ( CtxSize = Sha1GetContextSize ();
Sha1Ctx = AllocatePool (CtxSize);
- if (Sha1Ctx == NULL) {
- ASSERT (Sha1Ctx != NULL);
- return EFI_OUT_OF_RESOURCES;
- }
+ ASSERT (Sha1Ctx != NULL);
Sha1Init (Sha1Ctx);
diff --git a/SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.c b/SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.c index 4fdc5a8..4387740 100644 --- a/SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.c +++ b/SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.c @@ -56,10 +56,7 @@ Sha256HashInit ( CtxSize = Sha256GetContextSize ();
Sha256Ctx = AllocatePool (CtxSize);
- if (Sha256Ctx == NULL) {
- ASSERT (Sha256Ctx != NULL);
- return EFI_OUT_OF_RESOURCES;
- }
+ ASSERT (Sha256Ctx != NULL);
Sha256Init (Sha256Ctx);
diff --git a/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterDxe.c b/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterDxe.c index 5e0bbe5..2169c5e 100644 --- a/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterDxe.c +++ b/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterDxe.c @@ -80,11 +80,6 @@ HashStart ( for (Index = 0; Index < mHashInterfaceCount; Index++) {
HashMask = Tpm2GetHashMaskFromAlgo (&mHashInterface[Index].HashGuid);
- if (HashCtx == NULL) {
- // If we fail to get the hash mask we don't have resources.
- return EFI_OUT_OF_RESOURCES;
- }
-
if ((HashMask & PcdGet32 (PcdTpm2HashMask)) != 0) {
mHashInterface[Index].HashInit (&HashCtx[Index]);
}
@@ -283,16 +278,8 @@ HashAndExtend ( CheckSupportedHashMaskMismatch ();
- Status = HashStart (&HashHandle);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = HashUpdate (HashHandle, DataToHash, DataToHashLen);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
+ HashStart (&HashHandle);
+ HashUpdate (HashHandle, DataToHash, DataToHashLen);
Status = HashCompleteAndExtend (HashHandle, PcrIndex, NULL, 0, DigestList);
return Status;
diff --git a/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.c b/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.c index 156dc04..eeb424b 100644 --- a/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.c +++ b/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.c @@ -106,10 +106,7 @@ CheckSupportedHashMaskMismatch ( HASH_INTERFACE_HOB *HashInterfaceHobLast;
HashInterfaceHobLast = InternalGetHashInterfaceHob (&gZeroGuid);
- if (HashInterfaceHobLast == NULL) {
- ASSERT (HashInterfaceHobLast != NULL);
- return;
- }
+ ASSERT (HashInterfaceHobLast != NULL);
if ((HashInterfaceHobLast->SupportedHashMask != 0) &&
(HashInterfaceHobCurrent->SupportedHashMask != HashInterfaceHobLast->SupportedHashMask))
@@ -155,10 +152,7 @@ HashStart ( CheckSupportedHashMaskMismatch (HashInterfaceHob);
HashCtx = AllocatePool (sizeof (*HashCtx) * HashInterfaceHob->HashInterfaceCount);
- if (HashCtx == NULL) {
- ASSERT (HashCtx != NULL);
- return EFI_OUT_OF_RESOURCES;
- }
+ ASSERT (HashCtx != NULL);
for (Index = 0; Index < HashInterfaceHob->HashInterfaceCount; Index++) {
HashMask = Tpm2GetHashMaskFromAlgo (&HashInterfaceHob->HashInterface[Index].HashGuid);
@@ -311,16 +305,8 @@ HashAndExtend ( CheckSupportedHashMaskMismatch (HashInterfaceHob);
- Status = HashStart (&HashHandle);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = HashUpdate (HashHandle, DataToHash, DataToHashLen);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
+ HashStart (&HashHandle);
+ HashUpdate (HashHandle, DataToHash, DataToHashLen);
Status = HashCompleteAndExtend (HashHandle, PcrIndex, NULL, 0, DigestList);
return Status;
diff --git a/SecurityPkg/Library/SecureBootVariableProvisionLib/SecureBootVariableProvisionLib.c b/SecurityPkg/Library/SecureBootVariableProvisionLib/SecureBootVariableProvisionLib.c index e45e975..7f9fdd2 100644 --- a/SecurityPkg/Library/SecureBootVariableProvisionLib/SecureBootVariableProvisionLib.c +++ b/SecurityPkg/Library/SecureBootVariableProvisionLib/SecureBootVariableProvisionLib.c @@ -59,11 +59,7 @@ SecureBootFetchData ( *SigListOut = NULL;
*SigListsSize = 0;
CertInfo = AllocatePool (sizeof (SECURE_BOOT_CERTIFICATE_INFO));
- if (CertInfo == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewCertInfo = CertInfo;
+ NewCertInfo = CertInfo;
while (1) {
if (NewCertInfo == NULL) {
Status = EFI_OUT_OF_RESOURCES;
@@ -97,9 +93,6 @@ SecureBootFetchData ( sizeof (SECURE_BOOT_CERTIFICATE_INFO) * (KeyIndex + 1),
CertInfo
);
- if (NewCertInfo == NULL) {
- goto Cleanup;
- }
}
if (Status == EFI_NOT_FOUND) {
diff --git a/SecurityPkg/Library/TcgEventLogRecordLib/TcgEventLogRecordLib.c b/SecurityPkg/Library/TcgEventLogRecordLib/TcgEventLogRecordLib.c index cbe1da3..e1e0f99 100644 --- a/SecurityPkg/Library/TcgEventLogRecordLib/TcgEventLogRecordLib.c +++ b/SecurityPkg/Library/TcgEventLogRecordLib/TcgEventLogRecordLib.c @@ -106,7 +106,7 @@ MeasureFirmwareBlob ( {
if (Description != NULL) {
AsciiSPrint ((CHAR8 *)FvBlob2.BlobDescription, sizeof (FvBlob2.BlobDescription), "%a", Description);
- } else if (FvName != NULL) {
+ } else {
AsciiSPrint ((CHAR8 *)FvBlob2.BlobDescription, sizeof (FvBlob2.BlobDescription), "Fv(%g)", FvName);
}
diff --git a/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c b/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c index 5eb1a0b..64bea73 100644 --- a/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c +++ b/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c @@ -270,7 +270,7 @@ Tpm12TisTpmCommand ( {
EFI_STATUS Status;
UINT16 BurstCount;
- UINTN Index;
+ UINT32 Index;
UINT32 TpmOutSize;
UINT16 Data16;
UINT32 Data32;
diff --git a/SecurityPkg/RandomNumberGenerator/RngDxe/Rand/AesCore.c b/SecurityPkg/RandomNumberGenerator/RngDxe/Rand/AesCore.c index 1b2cddf..3ac20e8 100644 --- a/SecurityPkg/RandomNumberGenerator/RngDxe/Rand/AesCore.c +++ b/SecurityPkg/RandomNumberGenerator/RngDxe/Rand/AesCore.c @@ -230,8 +230,6 @@ AesEncrypt ( UINTN NbIndex;
UINTN Round;
- EFI_STATUS Status;
-
if ((Key == NULL) || (InData == NULL) || (OutData == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -239,10 +237,7 @@ AesEncrypt ( //
// Expands AES Key for encryption.
//
- Status = AesExpandKey (Key, 128, &AesKey);
- if (EFI_ERROR (Status)) {
- return Status;
- }
+ AesExpandKey (Key, 128, &AesKey);
Nr = AesKey.Nk + 6;
Ek = AesKey.EncKey;
diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c index c41fe6f..7b48002 100644 --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c @@ -2224,7 +2224,7 @@ ProcessOpalRequest ( //
TempVariable = Variable;
while ((VariableSize > sizeof (OPAL_REQUEST_VARIABLE)) &&
- (VariableSize >= (UINTN)TempVariable->Length) &&
+ (VariableSize >= TempVariable->Length) &&
(TempVariable->Length > sizeof (OPAL_REQUEST_VARIABLE)))
{
DevicePathInVariable = (EFI_DEVICE_PATH_PROTOCOL *)((UINTN)TempVariable + sizeof (OPAL_REQUEST_VARIABLE));
diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalHii.c b/SecurityPkg/Tcg/Opal/OpalPassword/OpalHii.c index c5f1121..1e0b00b 100644 --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalHii.c +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalHii.c @@ -113,7 +113,7 @@ GetSavedOpalRequest ( TempVariable = Variable;
while ((VariableSize > sizeof (OPAL_REQUEST_VARIABLE)) &&
- (VariableSize >= (UINTN)TempVariable->Length) &&
+ (VariableSize >= TempVariable->Length) &&
(TempVariable->Length > sizeof (OPAL_REQUEST_VARIABLE)))
{
DevicePathInVariable = (EFI_DEVICE_PATH_PROTOCOL *)((UINTN)TempVariable + sizeof (OPAL_REQUEST_VARIABLE));
@@ -193,7 +193,7 @@ SaveOpalRequest ( TempVariable = Variable;
TempVariableSize = VariableSize;
while ((TempVariableSize > sizeof (OPAL_REQUEST_VARIABLE)) &&
- (TempVariableSize >= (UINTN)TempVariable->Length) &&
+ (TempVariableSize >= TempVariable->Length) &&
(TempVariable->Length > sizeof (OPAL_REQUEST_VARIABLE)))
{
DevicePathInVariable = (EFI_DEVICE_PATH_PROTOCOL *)((UINTN)TempVariable + sizeof (OPAL_REQUEST_VARIABLE));
@@ -226,11 +226,7 @@ SaveOpalRequest ( DevicePathSize = GetDevicePathSize (DevicePath);
NewVariableSize = VariableSize + sizeof (OPAL_REQUEST_VARIABLE) + DevicePathSize;
NewVariable = AllocatePool (NewVariableSize);
- if (NewVariable == NULL) {
- ASSERT (NewVariable != NULL);
- return;
- }
-
+ ASSERT (NewVariable != NULL);
CopyMem (NewVariable, Variable, VariableSize);
TempVariable = (OPAL_REQUEST_VARIABLE *)((UINTN)NewVariable + VariableSize);
TempVariable->Length = (UINT32)(sizeof (OPAL_REQUEST_VARIABLE) + DevicePathSize);
@@ -243,11 +239,7 @@ SaveOpalRequest ( DevicePathSize = GetDevicePathSize (DevicePath);
NewVariableSize = sizeof (OPAL_REQUEST_VARIABLE) + DevicePathSize;
NewVariable = AllocatePool (NewVariableSize);
- if (NewVariable == NULL) {
- ASSERT (NewVariable != NULL);
- return;
- }
-
+ ASSERT (NewVariable != NULL);
NewVariable->Length = (UINT32)(sizeof (OPAL_REQUEST_VARIABLE) + DevicePathSize);
CopyMem (&NewVariable->OpalRequest, &OpalRequest, sizeof (OPAL_REQUEST));
DevicePathInVariable = (EFI_DEVICE_PATH_PROTOCOL *)((UINTN)NewVariable + sizeof (OPAL_REQUEST_VARIABLE));
@@ -1119,13 +1111,8 @@ ExtractConfig ( //
DriverHandle = HiiGetDriverImageHandleCB ();
ConfigRequestHdr = HiiConstructConfigHdr (&gHiiSetupVariableGuid, OpalPasswordStorageName, DriverHandle);
- if (ConfigRequestHdr == NULL) {
- ASSERT (ConfigRequestHdr != NULL);
- return EFI_OUT_OF_RESOURCES;
- }
-
- Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
- ConfigRequest = AllocateZeroPool (Size);
+ Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
+ ConfigRequest = AllocateZeroPool (Size);
if (ConfigRequest == NULL) {
return EFI_OUT_OF_RESOURCES;
}
diff --git a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDriver.c b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDriver.c index 2b93733..edf5f0f 100644 --- a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDriver.c +++ b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDriver.c @@ -103,11 +103,7 @@ InitializeTcg2VersionInfo ( TCG2_VERSION_NAME,
PrivateData->DriverHandle
);
- if (ConfigRequestHdr == NULL) {
- ASSERT (ConfigRequestHdr != NULL);
- return;
- }
-
+ ASSERT (ConfigRequestHdr != NULL);
DataSize = sizeof (Tcg2Version);
Status = gRT->GetVariable (
TCG2_VERSION_NAME,
diff --git a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c index 2a0307c..85a8528 100644 --- a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c +++ b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c @@ -626,7 +626,7 @@ DumpEventLog ( TCG_PCR_EVENT_HDR *EventHdr;
TCG_PCR_EVENT2 *TcgPcrEvent2;
TCG_EfiSpecIDEventStruct *TcgEfiSpecIdEventStruct;
- UINT64 NumberOfEvents;
+ UINTN NumberOfEvents;
if (!DebugPrintLevelEnabled (DEBUG_SECURITY)) {
return;
@@ -637,7 +637,7 @@ DumpEventLog ( switch (EventLogFormat) {
case EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2:
EventHdr = (TCG_PCR_EVENT_HDR *)(UINTN)EventLogLocation;
- while ((EFI_PHYSICAL_ADDRESS)(UINTN)EventHdr <= EventLogLastEntry) {
+ while ((UINTN)EventHdr <= EventLogLastEntry) {
DumpEvent (EventHdr);
EventHdr = (TCG_PCR_EVENT_HDR *)((UINTN)EventHdr + sizeof (TCG_PCR_EVENT_HDR) + EventHdr->EventSize);
}
@@ -668,7 +668,7 @@ DumpEventLog ( DumpTcgEfiSpecIdEventStruct (TcgEfiSpecIdEventStruct);
TcgPcrEvent2 = (TCG_PCR_EVENT2 *)((UINTN)TcgEfiSpecIdEventStruct + GetTcgEfiSpecIdEventStructSize (TcgEfiSpecIdEventStruct));
- while ((EFI_PHYSICAL_ADDRESS)(UINTN)TcgPcrEvent2 <= EventLogLastEntry) {
+ while ((UINTN)TcgPcrEvent2 <= EventLogLastEntry) {
DumpEvent2 (TcgPcrEvent2);
TcgPcrEvent2 = (TCG_PCR_EVENT2 *)((UINTN)TcgPcrEvent2 + GetPcrEvent2Size (TcgPcrEvent2));
}
diff --git a/SecurityPkg/Tcg/TcgConfigDxe/TcgConfigImpl.c b/SecurityPkg/Tcg/TcgConfigDxe/TcgConfigImpl.c index 2b4164c..52ea1ac 100644 --- a/SecurityPkg/Tcg/TcgConfigDxe/TcgConfigImpl.c +++ b/SecurityPkg/Tcg/TcgConfigDxe/TcgConfigImpl.c @@ -193,19 +193,9 @@ TcgExtractConfig ( // followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a Null-terminator
//
ConfigRequestHdr = HiiConstructConfigHdr (&gTcgConfigFormSetGuid, mTcgStorageName, PrivateData->DriverHandle);
- if (ConfigRequestHdr == NULL) {
- ASSERT (ConfigRequestHdr != NULL);
- return EFI_OUT_OF_RESOURCES;
- }
-
- Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
- ConfigRequest = AllocateZeroPool (Size);
- if (ConfigRequest == NULL) {
- ASSERT (ConfigRequest != NULL);
- FreePool (ConfigRequestHdr);
- return EFI_OUT_OF_RESOURCES;
- }
-
+ Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
+ ConfigRequest = AllocateZeroPool (Size);
+ ASSERT (ConfigRequest != NULL);
AllocatedRequest = TRUE;
UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, sizeof (TCG_CONFIGURATION));
FreePool (ConfigRequestHdr);
diff --git a/SecurityPkg/Tcg/TcgDxe/TcgDxe.c b/SecurityPkg/Tcg/TcgDxe/TcgDxe.c index ea4516a..ee6c627 100644 --- a/SecurityPkg/Tcg/TcgDxe/TcgDxe.c +++ b/SecurityPkg/Tcg/TcgDxe/TcgDxe.c @@ -286,10 +286,7 @@ TpmCommHashAll ( CtxSize = Sha1GetContextSize ();
Sha1Ctx = AllocatePool (CtxSize);
- if (Sha1Ctx == NULL) {
- ASSERT (Sha1Ctx != NULL);
- return EFI_OUT_OF_RESOURCES;
- }
+ ASSERT (Sha1Ctx != NULL);
Sha1Init (Sha1Ctx);
Sha1Update (Sha1Ctx, Data, DataLen);
diff --git a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c index 65b3f81..5a23dc5 100644 --- a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c +++ b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c @@ -98,11 +98,7 @@ ExtractFileNameFromDevicePath ( ASSERT (DevicePath != NULL);
- String = DevicePathToStr (DevicePath);
- if (String == NULL) {
- return NULL;
- }
-
+ String = DevicePathToStr (DevicePath);
MatchString = String;
LastMatch = String;
FileName = NULL;
diff --git a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c index e79932d..d262904 100644 --- a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c +++ b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c @@ -1095,7 +1095,7 @@ IsSignatureFoundInDatabase ( // Enumerate all signature data in SigDB to check if signature exists for executable.
//
CertList = (EFI_SIGNATURE_LIST *)Data;
- while ((DataSize > 0) && (DataSize >= (UINTN)CertList->SignatureListSize)) {
+ while ((DataSize > 0) && (DataSize >= CertList->SignatureListSize)) {
CertCount = (CertList->SignatureListSize - sizeof (EFI_SIGNATURE_LIST) - CertList->SignatureHeaderSize) / CertList->SignatureSize;
Cert = (EFI_SIGNATURE_DATA *)((UINT8 *)CertList + sizeof (EFI_SIGNATURE_LIST) + CertList->SignatureHeaderSize);
if ((CertList->SignatureSize == sizeof (EFI_SIGNATURE_DATA) - 1 + SignatureSize) && (CompareGuid (&CertList->SignatureType, &gEfiCertX509Guid))) {
@@ -1173,10 +1173,7 @@ CalculateCertHash ( //
CtxSize = mHash[HashAlg].GetContextSize ();
HashCtx = AllocatePool (CtxSize);
- if (HashCtx == NULL) {
- ASSERT (HashCtx != NULL);
- return FALSE;
- }
+ ASSERT (HashCtx != NULL);
//
// 2. Initialize a hash context.
@@ -1264,7 +1261,7 @@ IsCertHashFoundInDbx ( // Check whether the certificate hash exists in the forbidden database.
//
DbxList = (EFI_SIGNATURE_LIST *)Data;
- while ((DataSize > 0) && (DataSize >= (UINTN)DbxList->SignatureListSize)) {
+ while ((DataSize > 0) && (DataSize >= DbxList->SignatureListSize)) {
//
// Determine Hash Algorithm of Certificate in the forbidden database.
//
@@ -1351,7 +1348,7 @@ GetSignaturelistOffset ( SigList = Database;
SiglistSize = DatabaseSize;
- while ((SiglistSize > 0) && (SiglistSize >= (UINTN)SigList->SignatureListSize)) {
+ while ((SiglistSize > 0) && (SiglistSize >= SigList->SignatureListSize)) {
if (CompareGuid (&SigList->SignatureType, SignatureType)) {
*Offset = DatabaseSize - SiglistSize;
return TRUE;
@@ -1891,10 +1888,7 @@ HashPeImage ( CtxSize = mHash[HashAlg].GetContextSize ();
HashCtx = AllocatePool (CtxSize);
- if (HashCtx == NULL) {
- ASSERT (HashCtx != NULL);
- goto Done;
- }
+ ASSERT (HashCtx != NULL);
// 1. Load the image header into memory.
@@ -2546,7 +2540,7 @@ UpdateDeletePage ( )
{
EFI_STATUS Status;
- UINTN Index;
+ UINT32 Index;
UINTN CertCount;
UINTN GuidIndex;
VOID *StartOpCodeHandle;
@@ -2730,7 +2724,7 @@ DeleteKeyExchangeKey ( UINT8 *Data;
UINT8 *OldData;
UINT32 Attr;
- UINTN Index;
+ UINT32 Index;
EFI_SIGNATURE_LIST *CertList;
EFI_SIGNATURE_LIST *NewCertList;
EFI_SIGNATURE_DATA *Cert;
@@ -2934,7 +2928,7 @@ DeleteSignature ( UINT8 *Data;
UINT8 *OldData;
UINT32 Attr;
- UINTN Index;
+ UINT32 Index;
EFI_SIGNATURE_LIST *CertList;
EFI_SIGNATURE_LIST *NewCertList;
EFI_SIGNATURE_DATA *Cert;
@@ -3212,7 +3206,7 @@ DeleteSignatureEx ( //
// Traverse to target EFI_SIGNATURE_LIST but others will be skipped.
//
- while ((RemainingSize > 0) && (RemainingSize >= (UINTN)ListWalker->SignatureListSize) && ListIndex < PrivateData->ListIndex) {
+ while ((RemainingSize > 0) && (RemainingSize >= ListWalker->SignatureListSize) && ListIndex < PrivateData->ListIndex) {
CopyMem ((UINT8 *)NewVariableData + Offset, ListWalker, ListWalker->SignatureListSize);
Offset += ListWalker->SignatureListSize;
@@ -3519,19 +3513,9 @@ SecureBootExtractConfig ( // followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a Null-terminator
//
ConfigRequestHdr = HiiConstructConfigHdr (&gSecureBootConfigFormSetGuid, mSecureBootStorageName, PrivateData->DriverHandle);
- if (ConfigRequestHdr == NULL) {
- ASSERT (ConfigRequestHdr != NULL);
- return EFI_OUT_OF_RESOURCES;
- }
-
- Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
- ConfigRequest = AllocateZeroPool (Size);
- if (ConfigRequest == NULL) {
- ASSERT (ConfigRequest != NULL);
- FreePool (ConfigRequestHdr);
- return EFI_OUT_OF_RESOURCES;
- }
-
+ Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
+ ConfigRequest = AllocateZeroPool (Size);
+ ASSERT (ConfigRequest != NULL);
AllocatedRequest = TRUE;
UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize);
FreePool (ConfigRequestHdr);
@@ -3810,7 +3794,7 @@ LoadSignatureList ( RemainingSize = DataSize;
ListWalker = (EFI_SIGNATURE_LIST *)VariableData;
- while ((RemainingSize > 0) && (RemainingSize >= (UINTN)ListWalker->SignatureListSize)) {
+ while ((RemainingSize > 0) && (RemainingSize >= ListWalker->SignatureListSize)) {
if (CompareGuid (&ListWalker->SignatureType, &gEfiCertRsa2048Guid)) {
ListType = STRING_TOKEN (STR_LIST_TYPE_RSA2048_SHA256);
} else if (CompareGuid (&ListWalker->SignatureType, &gEfiCertX509Guid)) {
@@ -4226,7 +4210,7 @@ LoadSignatureData ( VOID *EndOpCodeHandle;
UINTN DataSize;
UINTN RemainingSize;
- UINT64 Index;
+ UINT16 Index;
UINT8 *VariableData;
CHAR16 VariableName[BUFFER_MAX_SIZE];
CHAR16 NameBuffer[BUFFER_MAX_SIZE];
@@ -4310,7 +4294,7 @@ LoadSignatureData ( //
// Skip signature list.
//
- while ((RemainingSize > 0) && (RemainingSize >= (UINTN)ListWalker->SignatureListSize) && ListIndex-- > 0) {
+ while ((RemainingSize > 0) && (RemainingSize >= ListWalker->SignatureListSize) && ListIndex-- > 0) {
RemainingSize -= ListWalker->SignatureListSize;
ListWalker = (EFI_SIGNATURE_LIST *)((UINT8 *)ListWalker + ListWalker->SignatureListSize);
}
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf index 0f4068d..b6c5df7 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf @@ -96,7 +96,6 @@ MdePkg/MdePkg.dec
ShellPkg/ShellPkg.dec
MdeModulePkg/MdeModulePkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
[LibraryClasses]
MemoryAllocationLib
diff --git a/ShellPkg/ShellPkg.ci.yaml b/ShellPkg/ShellPkg.ci.yaml index 4f5c69d..2c3a70d 100644 --- a/ShellPkg/ShellPkg.ci.yaml +++ b/ShellPkg/ShellPkg.ci.yaml @@ -35,7 +35,6 @@ "MdePkg/MdePkg.dec",
"MdeModulePkg/MdeModulePkg.dec",
"ShellPkg/ShellPkg.dec",
- "EmbeddedPkg/EmbeddedPkg.dec",
"NetworkPkg/NetworkPkg.dec"
],
# For host based unit tests
diff --git a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c index 2fd6f7d..215bc60 100644 --- a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c +++ b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c @@ -1,6 +1,6 @@ /** @file
- This driver will report some MMIO/IO resources to dxe core, extract smbios and acpi
- tables from bootloader.
+ This driver will setup PCDs for DXE phase from HOBs
+ and initialise architecture-specific settings and resources.
Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -30,8 +30,6 @@ BlDxeEntryPoint ( EFI_PEI_GRAPHICS_INFO_HOB *GfxInfo;
ACPI_BOARD_INFO *AcpiBoardInfo;
- Status = EFI_SUCCESS;
-
//
// Find the frame buffer information and update PCDs
//
diff --git a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h index ebae6f2..5f611c3 100644 --- a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h +++ b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h @@ -11,16 +11,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include <PiDxe.h>
-#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
-#include <Library/DxeServicesTableLib.h>
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
-#include <Library/UefiLib.h>
#include <Library/IoLib.h>
#include <Library/HobLib.h>
-#include <Guid/SmBios.h>
#include <Guid/AcpiBoardInfoGuid.h>
#include <Guid/GraphicsInfoHob.h>
diff --git a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf index 4c15fd4..401b99f 100644 --- a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf +++ b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf @@ -42,10 +42,8 @@ [LibraryClasses]
UefiDriverEntryPoint
UefiBootServicesTableLib
- DxeServicesTableLib
DebugLib
BaseMemoryLib
- UefiLib
HobLib
[LibraryClasses.AARCH64]
diff --git a/UefiPayloadPkg/BlSupportDxe/X86/BlSupport.c b/UefiPayloadPkg/BlSupportDxe/X86/BlSupport.c index 56d4c71..a7bbd88 100644 --- a/UefiPayloadPkg/BlSupportDxe/X86/BlSupport.c +++ b/UefiPayloadPkg/BlSupportDxe/X86/BlSupport.c @@ -6,85 +6,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
-#include "BlSupportDxe.h"
-
-/**
- Reserve MMIO/IO resource in GCD
-
- @param IsMMIO Flag of whether it is mmio resource or io resource.
- @param GcdType Type of the space.
- @param BaseAddress Base address of the space.
- @param Length Length of the space.
- @param Alignment Align with 2^Alignment
- @param ImageHandle Handle for the image of this driver.
-
- @retval EFI_SUCCESS Reserve successful
-**/
-EFI_STATUS
-ReserveResourceInGcd (
- IN BOOLEAN IsMMIO,
- IN UINTN GcdType,
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- IN UINTN Alignment,
- IN EFI_HANDLE ImageHandle
- )
-{
- EFI_STATUS Status;
-
- if (IsMMIO) {
- Status = gDS->AddMemorySpace (
- GcdType,
- BaseAddress,
- Length,
- EFI_MEMORY_UC
- );
- if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_WARN,
- "Failed to add memory space :0x%lx 0x%lx\n",
- BaseAddress,
- Length
- ));
- }
-
- Status = gDS->AllocateMemorySpace (
- EfiGcdAllocateAddress,
- GcdType,
- Alignment,
- Length,
- &BaseAddress,
- ImageHandle,
- NULL
- );
- } else {
- Status = gDS->AddIoSpace (
- GcdType,
- BaseAddress,
- Length
- );
- if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_WARN,
- "Failed to add IO space :0x%lx 0x%lx\n",
- BaseAddress,
- Length
- ));
- }
-
- Status = gDS->AllocateIoSpace (
- EfiGcdAllocateAddress,
- GcdType,
- Alignment,
- Length,
- &BaseAddress,
- ImageHandle,
- NULL
- );
- }
- return Status;
-}
+#include "BlSupportDxe.h"
/**
Architecture level additional operation which needs to be performed before
@@ -104,12 +27,5 @@ BlArchAdditionalOps ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- //
- // Report MMIO/IO Resources
- //
- ReserveResourceInGcd (TRUE, EfiGcdMemoryTypeMemoryMappedIo, 0xFEC00000, SIZE_4KB, 0, ImageHandle); // IOAPIC
-
- ReserveResourceInGcd (TRUE, EfiGcdMemoryTypeMemoryMappedIo, 0xFED00000, SIZE_1KB, 0, ImageHandle); // HPET
-
return EFI_SUCCESS;
}
diff --git a/UefiPayloadPkg/PciPlatformDxe/PciPlatformDxe.c b/UefiPayloadPkg/PciPlatformDxe/PciPlatformDxe.c new file mode 100644 index 0000000..05b66c0 --- /dev/null +++ b/UefiPayloadPkg/PciPlatformDxe/PciPlatformDxe.c @@ -0,0 +1,459 @@ +/** @file
+ Implementation of the gEfiPciPlatformProtocol to support loading
+ PCI Option ROMs when full PCI enumeration is skipped.
+
+Copyright (c) 2025, 9elements GmbH. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+
+**/
+
+#include "PciPlatformDxe.h"
+#include <Bus/Pci/PciBusDxe/PciBus.h>
+#include <Bus/Pci/PciBusDxe/PciOptionRomSupport.h>
+
+EFI_STATUS
+EFIAPI
+PciPlatformNotify (
+ IN EFI_PCI_PLATFORM_PROTOCOL *This,
+ IN EFI_HANDLE HostBridge,
+ IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase,
+ IN EFI_PCI_EXECUTION_PHASE ExecPhase
+ )
+{
+ return EFI_UNSUPPORTED;
+}
+
+EFI_STATUS
+EFIAPI
+PciPlatformPrepController (
+ IN EFI_PCI_PLATFORM_PROTOCOL *This,
+ IN EFI_HANDLE HostBridge,
+ IN EFI_HANDLE RootBridge,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS PciAddress,
+ IN EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE Phase,
+ IN EFI_PCI_EXECUTION_PHASE ExecPhase
+ )
+{
+ return EFI_UNSUPPORTED;
+}
+
+/**
+ Gets the PCI device's option ROM from a platform-specific location.
+
+ The GetPciRom() function gets the PCI device's option ROM from a platform-specific location.
+ The option ROM will be loaded into memory. This member function is used to return an image
+ that is packaged as a PCI 2.2 option ROM. The image may contain both legacy and EFI option
+ ROMs. See the UEFI 2.0 Specification for details. This member function can be used to return
+ option ROM images for embedded controllers. Option ROMs for embedded controllers are typically
+ stored in platform-specific storage, and this member function can retrieve it from that storage
+ and return it to the PCI bus driver. The PCI bus driver will call this member function before
+ scanning the ROM that is attached to any controller, which allows to scan the PCI card for
+ ROM image and retrieve it.
+
+ @param[in] This The pointer to the EFI_PCI_PLATFORM_PROTOCOL instance.
+ @param[in] PciHandle The handle of the PCI device.
+ @param[out] RomImage If the call succeeds, the pointer to the pointer to the option ROM image.
+ Otherwise, this field is undefined. The memory for RomImage is allocated
+ by EFI_PCI_PLATFORM_PROTOCOL.GetPciRom() using the EFI Boot Service AllocatePool().
+ It is the caller's responsibility to free the memory using the EFI Boot Service
+ FreePool(), when the caller is done with the option ROM.
+ @param[out] RomSize If the call succeeds, a pointer to the size of the option ROM size. Otherwise,
+ this field is undefined.
+
+ @retval EFI_SUCCESS The option ROM was available for this device and loaded into memory.
+ @retval EFI_NOT_FOUND No option ROM was available for this device.
+ @retval EFI_OUT_OF_RESOURCES No memory was available to load the option ROM.
+ @retval EFI_DEVICE_ERROR An error occurred in obtaining the option ROM.
+
+**/
+EFI_STATUS
+EFIAPI
+PciGetPciRom (
+ IN CONST EFI_PCI_PLATFORM_PROTOCOL *This,
+ IN EFI_HANDLE PciHandle,
+ OUT VOID **RomImage,
+ OUT UINTN *RomSize
+ )
+{
+ EFI_STATUS Status;
+ IN EFI_PCI_IO_PROTOCOL *PciIo;
+ UINTN PciSegment;
+ UINTN PciBus;
+ UINTN PciDevice;
+ UINTN PciFunction;
+ UINTN RomBarIndex;
+ UINT32 Buffer;
+ UINT32 AllOnes;
+ PCI_IO_DEVICE *PciIoDevice;
+ UINT8 Indicator;
+ UINT16 OffsetPcir;
+ UINT32 RomBarOffset;
+ UINT32 RomBar;
+ BOOLEAN FirstCheck;
+ UINT64 RomImageSize;
+ UINT32 LegacyImageLength;
+ UINT8 *RomInMemory;
+ UINT8 CodeType;
+ PCI_EXPANSION_ROM_HEADER RomHeader;
+ PCI_DATA_STRUCTURE RomPcir;
+
+ //
+ // Check to see if RomImage is NULL
+ //
+ if (RomImage == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ //
+ // Check to see if RomSize is NULL
+ //
+ if (RomSize == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ *RomImage = NULL;
+ *RomSize = 0;
+
+ Status = gBS->HandleProtocol (
+ PciHandle,
+ &gEfiPciIoProtocolGuid,
+ (VOID **)&PciIo
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: Failed to open gEfiPciIoProtocolGuid\n", __func__));
+ return EFI_UNSUPPORTED;
+ }
+
+ PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (PciIo);
+
+ //
+ // Get the location of the PCI device
+ //
+ PciIo->GetLocation (
+ PciIo,
+ &PciSegment,
+ &PciBus,
+ &PciDevice,
+ &PciFunction
+ );
+
+ DEBUG ((
+ DEBUG_VERBOSE,
+ "%a: PCI @ [%02x|%02x|%02x|%02x] Searching Option ROM...\n",
+ __func__,
+ PciSegment,
+ PciBus,
+ PciDevice,
+ PciFunction
+ ));
+
+ //
+ // Default ROM is at 0x30
+ //
+ RomBarIndex = PCI_EXPANSION_ROM_BASE;
+
+ if (IS_PCI_BRIDGE (&PciIoDevice->Pci)) {
+ //
+ // If is ppb ROM is at 0x38
+ //
+ RomBarIndex = PCI_BRIDGE_ROMBAR;
+ }
+
+ //
+ // Backup ROM BAR
+ //
+ Status = PciIo->Pci.Read (
+ PciIo,
+ EfiPciWidthUint32,
+ RomBarIndex,
+ 1,
+ &Buffer
+ );
+ if (EFI_ERROR (Status)) {
+ goto CloseAndReturn;
+ }
+
+ //
+ // The bit0 is 0 to prevent the enabling of the Rom address decoder
+ //
+ AllOnes = 0xfffffffe;
+
+ Status = PciIo->Pci.Write (
+ PciIo,
+ EfiPciWidthUint32,
+ RomBarIndex,
+ 1,
+ &AllOnes
+ );
+ if (EFI_ERROR (Status)) {
+ goto CloseAndReturn;
+ }
+
+ //
+ // Read back
+ //
+ Status = PciIo->Pci.Read (
+ PciIo,
+ EfiPciWidthUint32,
+ RomBarIndex,
+ 1,
+ &AllOnes
+ );
+ if (EFI_ERROR (Status)) {
+ goto CloseAndReturn;
+ }
+
+ //
+ // Bits [1, 10] are reserved
+ //
+ AllOnes &= 0xFFFFF800;
+ if ((AllOnes == 0) || (AllOnes == 0xFFFFF800)) {
+ DEBUG ((DEBUG_VERBOSE, "%a: No Option ROM found\n", __func__));
+ return EFI_NOT_FOUND;
+ }
+
+ *RomSize = (~AllOnes) + 1;
+
+ //
+ // Restore BAR and enable it
+ //
+ RomBar = Buffer | 1;
+ Status = PciIo->Pci.Write (
+ PciIo,
+ EfiPciWidthUint32,
+ RomBarIndex,
+ 1,
+ &RomBar
+ );
+ if (EFI_ERROR (Status)) {
+ goto CloseAndReturn;
+ }
+
+ DEBUG ((
+ DEBUG_VERBOSE,
+ "%a: ROM BAR enabled at 0x%x with size %d\n",
+ __func__,
+ Buffer &~1,
+ *RomSize
+ ));
+
+ //
+ // Set pointer to ROM BAR
+ //
+ RomBar = Buffer & 0xFFFFF800;
+
+ RomBarOffset = RomBar;
+ FirstCheck = TRUE;
+ LegacyImageLength = 0;
+ RomImageSize = 0;
+
+ //
+ // Expect to find a PCI ROM header at offset 0.
+ // The ROM header contains a pointer to the PCI Data structure.
+ // The PCI Data structure holds the image size.
+ // At the end of the image another Option ROM might be found
+ // (one for legacy BIOS and one for EFI).
+ //
+ do {
+ Status = PciIoDevice->PciRootBridgeIo->Mem.Read (
+ PciIoDevice->PciRootBridgeIo,
+ EfiPciWidthUint8,
+ RomBarOffset,
+ sizeof (PCI_EXPANSION_ROM_HEADER),
+ (UINT8 *)&RomHeader
+ );
+ if (EFI_ERROR (Status)) {
+ goto RestoreBar;
+ }
+
+ if (RomHeader.Signature != PCI_EXPANSION_ROM_HEADER_SIGNATURE) {
+ RomBarOffset = RomBarOffset + 512;
+ if (FirstCheck) {
+ break;
+ } else {
+ RomImageSize = RomImageSize + 512;
+ continue;
+ }
+ }
+
+ FirstCheck = FALSE;
+ OffsetPcir = RomHeader.PcirOffset;
+ //
+ // If the pointer to the PCI Data Structure is invalid, no further images can be located.
+ // The PCI Data Structure must be DWORD aligned.
+ //
+ if ((OffsetPcir == 0) ||
+ ((OffsetPcir & 3) != 0) ||
+ (RomImageSize + OffsetPcir + sizeof (PCI_DATA_STRUCTURE) > *RomSize))
+ {
+ break;
+ }
+
+ Status = PciIoDevice->PciRootBridgeIo->Mem.Read (
+ PciIoDevice->PciRootBridgeIo,
+ EfiPciWidthUint8,
+ RomBarOffset + OffsetPcir,
+ sizeof (PCI_DATA_STRUCTURE),
+ (UINT8 *)&RomPcir
+ );
+ if (EFI_ERROR (Status)) {
+ goto RestoreBar;
+ }
+
+ //
+ // If a valid signature is not present in the PCI Data Structure, no further images can be located.
+ //
+ if (RomPcir.Signature != PCI_DATA_STRUCTURE_SIGNATURE) {
+ break;
+ }
+
+ if (RomImageSize + RomPcir.ImageLength * 512 > *RomSize) {
+ break;
+ }
+
+ if (RomPcir.CodeType == PCI_CODE_TYPE_PCAT_IMAGE) {
+ CodeType = PCI_CODE_TYPE_PCAT_IMAGE;
+ LegacyImageLength = ((UINT32)((EFI_LEGACY_EXPANSION_ROM_HEADER *)&RomHeader)->Size512) * 512;
+ }
+
+ Indicator = RomPcir.Indicator;
+ RomImageSize = RomImageSize + RomPcir.ImageLength * 512;
+ RomBarOffset = RomBarOffset + RomPcir.ImageLength * 512;
+ } while (((Indicator & 0x80) == 0x00) && ((RomBarOffset - RomBar) < *RomSize));
+
+ //
+ // Some Legacy Cards do not report the correct ImageLength so used the maximum
+ // of the legacy length and the PCIR Image Length
+ //
+ if (CodeType == PCI_CODE_TYPE_PCAT_IMAGE) {
+ RomImageSize = MAX (RomImageSize, LegacyImageLength);
+ }
+
+ if (RomImageSize > 0) {
+ //
+ // Allocate buffer to return
+ //
+ RomInMemory = (UINT8 *)AllocatePool ((UINT32)RomImageSize);
+ if (RomInMemory == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ goto RestoreBar;
+ }
+
+ //
+ // Copy ROM image into memory
+ //
+ Status = PciIoDevice->PciRootBridgeIo->Mem.Read (
+ PciIoDevice->PciRootBridgeIo,
+ EfiPciWidthUint8,
+ RomBar,
+ (UINT32)RomImageSize,
+ RomInMemory
+ );
+ if (EFI_ERROR (Status)) {
+ goto RestoreBar;
+ }
+ } else {
+ Status = EFI_NOT_FOUND;
+ goto RestoreBar;
+ }
+
+ DEBUG ((
+ DEBUG_INFO,
+ "%a: PCI @ [%02x|%02x|%02x|%02x]: Found Option ROM at 0x%x, length 0x%x\n",
+ __func__,
+ PciSegment,
+ PciBus,
+ PciDevice,
+ PciFunction,
+ RomBar,
+ RomImageSize
+ ));
+
+ PciIoDevice->EmbeddedRom = TRUE;
+ PciIoDevice->PciIo.RomSize = RomImageSize;
+ PciIoDevice->PciIo.RomImage = RomInMemory;
+
+ *RomImage = RomInMemory;
+ *RomSize = RomImageSize;
+
+ Status = EFI_SUCCESS;
+
+RestoreBar:
+ //
+ // Restore BAR
+ //
+ PciIo->Pci.Write (
+ PciIo,
+ EfiPciWidthUint32,
+ RomBarIndex,
+ 1,
+ &RomBar
+ );
+
+CloseAndReturn:
+ //
+ // Close the I/O Abstraction(s) used to perform the supported test
+ //
+ gBS->CloseProtocol (
+ PciHandle,
+ &gEfiPciIoProtocolGuid,
+ PciIo,
+ PciHandle
+ );
+
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+PciGetPlatformPolicy (
+ IN CONST EFI_PCI_PLATFORM_PROTOCOL *This,
+ OUT EFI_PCI_PLATFORM_POLICY *PciPolicy
+ )
+{
+ if (PciPolicy == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ *PciPolicy = 0;
+
+ return EFI_SUCCESS;
+}
+
+EFI_PCI_PLATFORM_PROTOCOL mPciPlatformProtocol = {
+ PciPlatformNotify,
+ PciPlatformPrepController,
+ PciGetPlatformPolicy,
+ PciGetPciRom,
+};
+
+/**
+ The Entry Point for Option ROM driver.
+
+ It installs DriverBinding.
+
+ @retval EFI_SUCCESS The entry point is executed successfully.
+ @retval other Some error occurs when executing this entry point.
+
+**/
+EFI_STATUS
+EFIAPI
+InstallPciPlatformProtocol (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_HANDLE DriverHandle = NULL;
+
+ Status = gBS->InstallProtocolInterface (
+ &DriverHandle,
+ &gEfiPciPlatformProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &mPciPlatformProtocol
+ );
+
+ return Status;
+}
diff --git a/UefiPayloadPkg/PciPlatformDxe/PciPlatformDxe.h b/UefiPayloadPkg/PciPlatformDxe/PciPlatformDxe.h new file mode 100644 index 0000000..322fc5f --- /dev/null +++ b/UefiPayloadPkg/PciPlatformDxe/PciPlatformDxe.h @@ -0,0 +1,20 @@ +/** @file
+ Header file for a gEfiPciPlatformProtocol driver.
+
+Copyright (c) 2025, 9elements GmbH. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+
+**/
+
+#ifndef _PCI_PLATFORM_DXE_H_
+#define _PCI_PLATFORM_DXE_H_
+#include <PiDxe.h>
+
+#include <IndustryStandard/Pci.h>
+#include <IndustryStandard/Acpi.h>
+#include <IndustryStandard/Pci22.h>
+#include <Protocol/PciIo.h>
+#include <Protocol/PciPlatform.h>
+
+#endif
diff --git a/UefiPayloadPkg/PciPlatformDxe/PciPlatformDxe.inf b/UefiPayloadPkg/PciPlatformDxe/PciPlatformDxe.inf new file mode 100644 index 0000000..9e0ba63 --- /dev/null +++ b/UefiPayloadPkg/PciPlatformDxe/PciPlatformDxe.inf @@ -0,0 +1,43 @@ +## @file
+# This driver produces gEfiPciPlatformProtocol to load PCI Option ROMs
+#
+# Copyright (c) 2025, 9elements Agency GmbH
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = PciPlatformDxe
+ FILE_GUID = 86D58F7B-6E7C-401F-BDD4-E32E6D582AAD
+ MODULE_TYPE = UEFI_DRIVER
+ VERSION_STRING = 1.0
+ ENTRY_POINT = InstallPciPlatformProtocol
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64
+#
+
+[Sources.common]
+ PciPlatformDxe.h
+ PciPlatformDxe.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ UefiPayloadPkg/UefiPayloadPkg.dec
+
+[LibraryClasses]
+ UefiDriverEntryPoint
+ DxeServicesTableLib
+ DebugLib
+ MemoryAllocationLib
+ BaseMemoryLib
+
+[Protocols]
+ gEfiPciPlatformProtocolGuid ## PRODUCES
+ gEfiPciIoProtocolGuid ## COMSUMES
diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayloadPkg.dsc index 34de87f..76e4e58 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.dsc +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc @@ -45,6 +45,7 @@ DEFINE NVME_ENABLE = TRUE
DEFINE CAPSULE_SUPPORT = FALSE
DEFINE LOCKBOX_SUPPORT = FALSE
+ DEFINE LOAD_OPTION_ROMS = FALSE
#
# Crypto Support
@@ -1036,6 +1037,13 @@ !endif
#
+ # Support for loading Option ROMs from PCI-Express devices
+ #
+!if $(LOAD_OPTION_ROMS) == TRUE
+ UefiPayloadPkg/PciPlatformDxe/PciPlatformDxe.inf
+!endif
+
+ #
# Usb Support
#
MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf
diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf b/UefiPayloadPkg/UefiPayloadPkg.fdf index 4264fa9..06ca207 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.fdf +++ b/UefiPayloadPkg/UefiPayloadPkg.fdf @@ -292,6 +292,10 @@ INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf !endif
INF UefiPayloadPkg/GraphicsOutputDxe/GraphicsOutputDxe.inf
+!if $(LOAD_OPTION_ROMS) == TRUE
+INF UefiPayloadPkg/PciPlatformDxe/PciPlatformDxe.inf
+!endif
+
#
# SCSI/ATA/IDE/DISK Support
#
|