diff options
Diffstat (limited to 'MdeModulePkg/Core/Pei/Ppi')
-rw-r--r-- | MdeModulePkg/Core/Pei/Ppi/Ppi.c | 353 |
1 files changed, 185 insertions, 168 deletions
diff --git a/MdeModulePkg/Core/Pei/Ppi/Ppi.c b/MdeModulePkg/Core/Pei/Ppi/Ppi.c index 2e339e2522..0e85264ddb 100644 --- a/MdeModulePkg/Core/Pei/Ppi/Ppi.c +++ b/MdeModulePkg/Core/Pei/Ppi/Ppi.c @@ -21,19 +21,20 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/
VOID
ConvertPointer (
- IN OUT VOID **Pointer,
- IN UINTN TempBottom,
- IN UINTN TempTop,
- IN UINTN Offset,
- IN BOOLEAN OffsetPositive
+ IN OUT VOID **Pointer,
+ IN UINTN TempBottom,
+ IN UINTN TempTop,
+ IN UINTN Offset,
+ IN BOOLEAN OffsetPositive
)
{
- if (((UINTN) *Pointer < TempTop) &&
- ((UINTN) *Pointer >= TempBottom)) {
+ if (((UINTN)*Pointer < TempTop) &&
+ ((UINTN)*Pointer >= TempBottom))
+ {
if (OffsetPositive) {
- *Pointer = (VOID *) ((UINTN) *Pointer + Offset);
+ *Pointer = (VOID *)((UINTN)*Pointer + Offset);
} else {
- *Pointer = (VOID *) ((UINTN) *Pointer - Offset);
+ *Pointer = (VOID *)((UINTN)*Pointer - Offset);
}
}
}
@@ -55,7 +56,7 @@ ConvertPointerInRanges ( IN OUT VOID **Pointer
)
{
- UINT8 IndexHole;
+ UINT8 IndexHole;
if (PrivateData->MemoryPages.Size != 0) {
//
@@ -96,7 +97,7 @@ ConvertPointerInRanges ( //
// Convert PPI pointer in old TempRam Hole
//
- for (IndexHole = 0; IndexHole < HOLE_MAX_NUMBER; IndexHole ++) {
+ for (IndexHole = 0; IndexHole < HOLE_MAX_NUMBER; IndexHole++) {
if (PrivateData->HoleData[IndexHole].Size == 0) {
continue;
}
@@ -139,12 +140,12 @@ ConvertSinglePpiPointer ( // 2. Convert the pointer to the GUID in the PPI or NOTIFY descriptor
// from the old TempRam to the relocated physical memory.
//
- ConvertPointerInRanges (SecCoreData, PrivateData, (VOID **) &PpiPointer->Ppi->Guid);
+ ConvertPointerInRanges (SecCoreData, PrivateData, (VOID **)&PpiPointer->Ppi->Guid);
//
// 3. Convert the pointer to the PPI interface structure in the PPI descriptor
// from the old TempRam to the relocated physical memory.
//
- ConvertPointerInRanges (SecCoreData, PrivateData, (VOID **) &PpiPointer->Ppi->Ppi);
+ ConvertPointerInRanges (SecCoreData, PrivateData, (VOID **)&PpiPointer->Ppi->Ppi);
}
/**
@@ -162,7 +163,7 @@ ConvertPpiPointers ( IN PEI_CORE_INSTANCE *PrivateData
)
{
- UINT8 Index;
+ UINT8 Index;
//
// Convert normal PPIs.
@@ -210,10 +211,10 @@ ConvertPpiPointers ( **/
VOID
ConvertPpiPointersFv (
- IN PEI_CORE_INSTANCE *PrivateData,
- IN UINTN OrgFvHandle,
- IN UINTN FvHandle,
- IN UINTN FvSize
+ IN PEI_CORE_INSTANCE *PrivateData,
+ IN UINTN OrgFvHandle,
+ IN UINTN FvHandle,
+ IN UINTN FvSize
)
{
UINT8 Index;
@@ -229,18 +230,18 @@ ConvertPpiPointersFv ( if (FvHandle > OrgFvHandle) {
OffsetPositive = TRUE;
- Offset = FvHandle - OrgFvHandle;
+ Offset = FvHandle - OrgFvHandle;
} else {
OffsetPositive = FALSE;
- Offset = OrgFvHandle - FvHandle;
+ Offset = OrgFvHandle - FvHandle;
}
DEBUG ((DEBUG_VERBOSE, "Converting PPI pointers in FV.\n"));
DEBUG ((
DEBUG_VERBOSE,
" OrgFvHandle at 0x%08x. FvHandle at 0x%08x. FvSize = 0x%x\n",
- (UINTN) OrgFvHandle,
- (UINTN) FvHandle,
+ (UINTN)OrgFvHandle,
+ (UINTN)FvHandle,
FvSize
));
DEBUG ((
@@ -251,46 +252,46 @@ ConvertPpiPointersFv ( ));
for (Index = 0; Index < PrivateData->PpiData.CallbackNotifyList.CurrentCount; Index++) {
- ConvertPointer (
- (VOID **) &PrivateData->PpiData.CallbackNotifyList.NotifyPtrs[Index].Raw,
- OrgFvHandle,
- OrgFvHandle + FvSize,
- Offset,
- OffsetPositive
- );
- ConvertPointer (
- (VOID **) &PrivateData->PpiData.CallbackNotifyList.NotifyPtrs[Index].Notify->Guid,
- OrgFvHandle,
- OrgFvHandle + FvSize,
- Offset,
- OffsetPositive
- );
- ConvertPointer (
- (VOID **) &PrivateData->PpiData.CallbackNotifyList.NotifyPtrs[Index].Notify->Notify,
- OrgFvHandle,
- OrgFvHandle + FvSize,
- Offset,
- OffsetPositive
- );
+ ConvertPointer (
+ (VOID **)&PrivateData->PpiData.CallbackNotifyList.NotifyPtrs[Index].Raw,
+ OrgFvHandle,
+ OrgFvHandle + FvSize,
+ Offset,
+ OffsetPositive
+ );
+ ConvertPointer (
+ (VOID **)&PrivateData->PpiData.CallbackNotifyList.NotifyPtrs[Index].Notify->Guid,
+ OrgFvHandle,
+ OrgFvHandle + FvSize,
+ Offset,
+ OffsetPositive
+ );
+ ConvertPointer (
+ (VOID **)&PrivateData->PpiData.CallbackNotifyList.NotifyPtrs[Index].Notify->Notify,
+ OrgFvHandle,
+ OrgFvHandle + FvSize,
+ Offset,
+ OffsetPositive
+ );
}
for (Index = 0; Index < PrivateData->PpiData.DispatchNotifyList.CurrentCount; Index++) {
ConvertPointer (
- (VOID **) &PrivateData->PpiData.DispatchNotifyList.NotifyPtrs[Index].Raw,
+ (VOID **)&PrivateData->PpiData.DispatchNotifyList.NotifyPtrs[Index].Raw,
OrgFvHandle,
OrgFvHandle + FvSize,
Offset,
OffsetPositive
);
ConvertPointer (
- (VOID **) &PrivateData->PpiData.DispatchNotifyList.NotifyPtrs[Index].Notify->Guid,
+ (VOID **)&PrivateData->PpiData.DispatchNotifyList.NotifyPtrs[Index].Notify->Guid,
OrgFvHandle,
OrgFvHandle + FvSize,
Offset,
OffsetPositive
);
ConvertPointer (
- (VOID **) &PrivateData->PpiData.DispatchNotifyList.NotifyPtrs[Index].Notify->Notify,
+ (VOID **)&PrivateData->PpiData.DispatchNotifyList.NotifyPtrs[Index].Notify->Notify,
OrgFvHandle,
OrgFvHandle + FvSize,
Offset,
@@ -300,21 +301,21 @@ ConvertPpiPointersFv ( for (Index = 0; Index < PrivateData->PpiData.PpiList.CurrentCount; Index++) {
ConvertPointer (
- (VOID **) &PrivateData->PpiData.PpiList.PpiPtrs[Index].Raw,
+ (VOID **)&PrivateData->PpiData.PpiList.PpiPtrs[Index].Raw,
OrgFvHandle,
OrgFvHandle + FvSize,
Offset,
OffsetPositive
);
ConvertPointer (
- (VOID **) &PrivateData->PpiData.PpiList.PpiPtrs[Index].Ppi->Guid,
+ (VOID **)&PrivateData->PpiData.PpiList.PpiPtrs[Index].Ppi->Guid,
OrgFvHandle,
OrgFvHandle + FvSize,
Offset,
OffsetPositive
);
ConvertPointer (
- (VOID **) &PrivateData->PpiData.PpiList.PpiPtrs[Index].Ppi->Ppi,
+ (VOID **)&PrivateData->PpiData.PpiList.PpiPtrs[Index].Ppi->Ppi,
OrgFvHandle,
OrgFvHandle + FvSize,
Offset,
@@ -331,7 +332,8 @@ ConvertPpiPointersFv ( if ((((INT32 *)Guid)[0] == ((INT32 *)GuidCheckList[GuidIndex])[0]) &&
(((INT32 *)Guid)[1] == ((INT32 *)GuidCheckList[GuidIndex])[1]) &&
(((INT32 *)Guid)[2] == ((INT32 *)GuidCheckList[GuidIndex])[2]) &&
- (((INT32 *)Guid)[3] == ((INT32 *)GuidCheckList[GuidIndex])[3])) {
+ (((INT32 *)Guid)[3] == ((INT32 *)GuidCheckList[GuidIndex])[3]))
+ {
FvInfoPpi = PrivateData->PpiData.PpiList.PpiPtrs[Index].Ppi->Ppi;
DEBUG ((DEBUG_VERBOSE, " FvInfo: %p -> ", FvInfoPpi->FvInfo));
if ((UINTN)FvInfoPpi->FvInfo == OrgFvHandle) {
@@ -344,6 +346,7 @@ ConvertPpiPointersFv ( );
DEBUG ((DEBUG_VERBOSE, "%p", FvInfoPpi->FvInfo));
}
+
DEBUG ((DEBUG_VERBOSE, "\n"));
break;
}
@@ -360,11 +363,11 @@ ConvertPpiPointersFv ( **/
VOID
DumpPpiList (
- IN PEI_CORE_INSTANCE *PrivateData
+ IN PEI_CORE_INSTANCE *PrivateData
)
{
DEBUG_CODE_BEGIN ();
- UINTN Index;
+ UINTN Index;
if (PrivateData == NULL) {
return;
@@ -376,46 +379,51 @@ DumpPpiList ( "CallbackNotify[%2d] {%g} at 0x%x (%a)\n",
Index,
PrivateData->PpiData.CallbackNotifyList.NotifyPtrs[Index].Notify->Guid,
- (UINTN) PrivateData->PpiData.CallbackNotifyList.NotifyPtrs[Index].Raw,
+ (UINTN)PrivateData->PpiData.CallbackNotifyList.NotifyPtrs[Index].Raw,
(
- !(
- ((EFI_PHYSICAL_ADDRESS) (UINTN) PrivateData->PpiData.CallbackNotifyList.NotifyPtrs[Index].Raw >= PrivateData->PhysicalMemoryBegin) &&
- (((EFI_PHYSICAL_ADDRESS) ((UINTN) PrivateData->PpiData.CallbackNotifyList.NotifyPtrs[Index].Raw) + sizeof (EFI_PEI_NOTIFY_DESCRIPTOR)) < PrivateData->FreePhysicalMemoryTop)
- )
+ !(
+ ((EFI_PHYSICAL_ADDRESS)(UINTN)PrivateData->PpiData.CallbackNotifyList.NotifyPtrs[Index].Raw >= PrivateData->PhysicalMemoryBegin) &&
+ (((EFI_PHYSICAL_ADDRESS)((UINTN)PrivateData->PpiData.CallbackNotifyList.NotifyPtrs[Index].Raw) + sizeof (EFI_PEI_NOTIFY_DESCRIPTOR)) < PrivateData->FreePhysicalMemoryTop)
+ )
? "CAR" : "Post-Memory"
- )
+ )
));
}
+
for (Index = 0; Index < PrivateData->PpiData.DispatchNotifyList.CurrentCount; Index++) {
- DEBUG ((DEBUG_VERBOSE,
- "DispatchNotify[%2d] {%g} at 0x%x (%a)\n",
- Index,
- PrivateData->PpiData.DispatchNotifyList.NotifyPtrs[Index].Notify->Guid,
- (UINTN) PrivateData->PpiData.DispatchNotifyList.NotifyPtrs[Index].Raw,
- (
- !(
- ((EFI_PHYSICAL_ADDRESS) (UINTN) PrivateData->PpiData.DispatchNotifyList.NotifyPtrs[Index].Raw >=PrivateData->PhysicalMemoryBegin) &&
- (((EFI_PHYSICAL_ADDRESS) ((UINTN) PrivateData->PpiData.DispatchNotifyList.NotifyPtrs[Index].Raw) + sizeof (EFI_PEI_NOTIFY_DESCRIPTOR)) < PrivateData->FreePhysicalMemoryTop)
- )
+ DEBUG ((
+ DEBUG_VERBOSE,
+ "DispatchNotify[%2d] {%g} at 0x%x (%a)\n",
+ Index,
+ PrivateData->PpiData.DispatchNotifyList.NotifyPtrs[Index].Notify->Guid,
+ (UINTN)PrivateData->PpiData.DispatchNotifyList.NotifyPtrs[Index].Raw,
+ (
+ !(
+ ((EFI_PHYSICAL_ADDRESS)(UINTN)PrivateData->PpiData.DispatchNotifyList.NotifyPtrs[Index].Raw >= PrivateData->PhysicalMemoryBegin) &&
+ (((EFI_PHYSICAL_ADDRESS)((UINTN)PrivateData->PpiData.DispatchNotifyList.NotifyPtrs[Index].Raw) + sizeof (EFI_PEI_NOTIFY_DESCRIPTOR)) < PrivateData->FreePhysicalMemoryTop)
+ )
? "CAR" : "Post-Memory"
)
- ));
+ ));
}
+
for (Index = 0; Index < PrivateData->PpiData.PpiList.CurrentCount; Index++) {
- DEBUG ((DEBUG_VERBOSE,
- "PPI[%2d] {%g} at 0x%x (%a)\n",
- Index,
- PrivateData->PpiData.PpiList.PpiPtrs[Index].Ppi->Guid,
- (UINTN) PrivateData->PpiData.PpiList.PpiPtrs[Index].Raw,
- (
- !(
- ((EFI_PHYSICAL_ADDRESS) (UINTN) PrivateData->PpiData.PpiList.PpiPtrs[Index].Raw >= PrivateData->PhysicalMemoryBegin) &&
- (((EFI_PHYSICAL_ADDRESS) ((UINTN) PrivateData->PpiData.PpiList.PpiPtrs[Index].Raw) + sizeof (EFI_PEI_PPI_DESCRIPTOR)) < PrivateData->FreePhysicalMemoryTop)
- )
+ DEBUG ((
+ DEBUG_VERBOSE,
+ "PPI[%2d] {%g} at 0x%x (%a)\n",
+ Index,
+ PrivateData->PpiData.PpiList.PpiPtrs[Index].Ppi->Guid,
+ (UINTN)PrivateData->PpiData.PpiList.PpiPtrs[Index].Raw,
+ (
+ !(
+ ((EFI_PHYSICAL_ADDRESS)(UINTN)PrivateData->PpiData.PpiList.PpiPtrs[Index].Raw >= PrivateData->PhysicalMemoryBegin) &&
+ (((EFI_PHYSICAL_ADDRESS)((UINTN)PrivateData->PpiData.PpiList.PpiPtrs[Index].Raw) + sizeof (EFI_PEI_PPI_DESCRIPTOR)) < PrivateData->FreePhysicalMemoryTop)
+ )
? "CAR" : "Post-Memory"
)
- ));
+ ));
}
+
DEBUG_CODE_END ();
}
@@ -444,21 +452,21 @@ InternalPeiInstallPpi ( IN BOOLEAN Single
)
{
- PEI_CORE_INSTANCE *PrivateData;
- PEI_PPI_LIST *PpiListPointer;
- UINTN Index;
- UINTN LastCount;
- VOID *TempPtr;
+ PEI_CORE_INSTANCE *PrivateData;
+ PEI_PPI_LIST *PpiListPointer;
+ UINTN Index;
+ UINTN LastCount;
+ VOID *TempPtr;
if (PpiList == NULL) {
return EFI_INVALID_PARAMETER;
}
- PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices);
+ PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices);
PpiListPointer = &PrivateData->PpiData.PpiList;
- Index = PpiListPointer->CurrentCount;
- LastCount = Index;
+ Index = PpiListPointer->CurrentCount;
+ LastCount = Index;
//
// This is loop installs all PPI descriptors in the PpiList. It is terminated
@@ -466,7 +474,7 @@ InternalPeiInstallPpi ( // EFI_PEI_PPI_DESCRIPTOR in the list.
//
- for (;;) {
+ for ( ; ;) {
//
// Check if it is a valid PPI.
// If not, rollback list to exclude all in this list.
@@ -474,8 +482,8 @@ InternalPeiInstallPpi ( //
if ((PpiList->Flags & EFI_PEI_PPI_DESCRIPTOR_PPI) == 0) {
PpiListPointer->CurrentCount = LastCount;
- DEBUG((DEBUG_ERROR, "ERROR -> InstallPpi: %g %p\n", PpiList->Guid, PpiList->Ppi));
- return EFI_INVALID_PARAMETER;
+ DEBUG ((DEBUG_ERROR, "ERROR -> InstallPpi: %g %p\n", PpiList->Guid, PpiList->Ppi));
+ return EFI_INVALID_PARAMETER;
}
if (Index >= PpiListPointer->MaxCount) {
@@ -491,12 +499,12 @@ InternalPeiInstallPpi ( PpiListPointer->PpiPtrs,
sizeof (PEI_PPI_LIST_POINTERS) * PpiListPointer->MaxCount
);
- PpiListPointer->PpiPtrs = TempPtr;
+ PpiListPointer->PpiPtrs = TempPtr;
PpiListPointer->MaxCount = PpiListPointer->MaxCount + PPI_GROWTH_STEP;
}
- DEBUG((DEBUG_INFO, "Install PPI: %g\n", PpiList->Guid));
- PpiListPointer->PpiPtrs[Index].Ppi = (EFI_PEI_PPI_DESCRIPTOR *) PpiList;
+ DEBUG ((DEBUG_INFO, "Install PPI: %g\n", PpiList->Guid));
+ PpiListPointer->PpiPtrs[Index].Ppi = (EFI_PEI_PPI_DESCRIPTOR *)PpiList;
Index++;
PpiListPointer->CurrentCount++;
@@ -506,12 +514,14 @@ InternalPeiInstallPpi ( //
break;
} else if ((PpiList->Flags & EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) ==
- EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) {
+ EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST)
+ {
//
// Continue until the end of the PPI List.
//
break;
}
+
//
// Go to the next descriptor.
//
@@ -583,19 +593,18 @@ PeiReInstallPpi ( IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi
)
{
- PEI_CORE_INSTANCE *PrivateData;
- UINTN Index;
-
+ PEI_CORE_INSTANCE *PrivateData;
+ UINTN Index;
if ((OldPpi == NULL) || (NewPpi == NULL)) {
return EFI_INVALID_PARAMETER;
}
if ((NewPpi->Flags & EFI_PEI_PPI_DESCRIPTOR_PPI) == 0) {
- return EFI_INVALID_PARAMETER;
+ return EFI_INVALID_PARAMETER;
}
- PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices);
+ PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices);
//
// Find the old PPI instance in the database. If we can not find it,
@@ -606,6 +615,7 @@ PeiReInstallPpi ( break;
}
}
+
if (Index == PrivateData->PpiData.PpiList.CurrentCount) {
return EFI_NOT_FOUND;
}
@@ -613,8 +623,8 @@ PeiReInstallPpi ( //
// Replace the old PPI with the new one.
//
- DEBUG((DEBUG_INFO, "Reinstall PPI: %g\n", NewPpi->Guid));
- PrivateData->PpiData.PpiList.PpiPtrs[Index].Ppi = (EFI_PEI_PPI_DESCRIPTOR *) NewPpi;
+ DEBUG ((DEBUG_INFO, "Reinstall PPI: %g\n", NewPpi->Guid));
+ PrivateData->PpiData.PpiList.PpiPtrs[Index].Ppi = (EFI_PEI_PPI_DESCRIPTOR *)NewPpi;
//
// Process any callback level notifies for the newly installed PPI.
@@ -650,26 +660,25 @@ PeiReInstallPpi ( EFI_STATUS
EFIAPI
PeiLocatePpi (
- IN CONST EFI_PEI_SERVICES **PeiServices,
- IN CONST EFI_GUID *Guid,
- IN UINTN Instance,
- IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,
- IN OUT VOID **Ppi
+ IN CONST EFI_PEI_SERVICES **PeiServices,
+ IN CONST EFI_GUID *Guid,
+ IN UINTN Instance,
+ IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,
+ IN OUT VOID **Ppi
)
{
- PEI_CORE_INSTANCE *PrivateData;
- UINTN Index;
- EFI_GUID *CheckGuid;
- EFI_PEI_PPI_DESCRIPTOR *TempPtr;
-
+ PEI_CORE_INSTANCE *PrivateData;
+ UINTN Index;
+ EFI_GUID *CheckGuid;
+ EFI_PEI_PPI_DESCRIPTOR *TempPtr;
- PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices);
+ PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices);
//
// Search the data base for the matching instance of the GUIDed PPI.
//
for (Index = 0; Index < PrivateData->PpiData.PpiList.CurrentCount; Index++) {
- TempPtr = PrivateData->PpiData.PpiList.PpiPtrs[Index].Ppi;
+ TempPtr = PrivateData->PpiData.PpiList.PpiPtrs[Index].Ppi;
CheckGuid = TempPtr->Guid;
//
@@ -680,9 +689,9 @@ PeiLocatePpi ( if ((((INT32 *)Guid)[0] == ((INT32 *)CheckGuid)[0]) &&
(((INT32 *)Guid)[1] == ((INT32 *)CheckGuid)[1]) &&
(((INT32 *)Guid)[2] == ((INT32 *)CheckGuid)[2]) &&
- (((INT32 *)Guid)[3] == ((INT32 *)CheckGuid)[3])) {
+ (((INT32 *)Guid)[3] == ((INT32 *)CheckGuid)[3]))
+ {
if (Instance == 0) {
-
if (PpiDescriptor != NULL) {
*PpiDescriptor = TempPtr;
}
@@ -691,9 +700,9 @@ PeiLocatePpi ( *Ppi = TempPtr->Ppi;
}
-
return EFI_SUCCESS;
}
+
Instance--;
}
}
@@ -738,15 +747,15 @@ InternalPeiNotifyPpi ( return EFI_INVALID_PARAMETER;
}
- PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices);
+ PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices);
CallbackNotifyListPointer = &PrivateData->PpiData.CallbackNotifyList;
- CallbackNotifyIndex = CallbackNotifyListPointer->CurrentCount;
- LastCallbackNotifyCount = CallbackNotifyIndex;
+ CallbackNotifyIndex = CallbackNotifyListPointer->CurrentCount;
+ LastCallbackNotifyCount = CallbackNotifyIndex;
DispatchNotifyListPointer = &PrivateData->PpiData.DispatchNotifyList;
- DispatchNotifyIndex = DispatchNotifyListPointer->CurrentCount;
- LastDispatchNotifyCount = DispatchNotifyIndex;
+ DispatchNotifyIndex = DispatchNotifyListPointer->CurrentCount;
+ LastDispatchNotifyCount = DispatchNotifyIndex;
//
// This is loop installs all Notify descriptors in the NotifyList. It is
@@ -754,15 +763,15 @@ InternalPeiNotifyPpi ( // EFI_PEI_NOTIFY_DESCRIPTOR in the list.
//
- for (;;) {
+ for ( ; ;) {
//
// If some of the PPI data is invalid restore original Notify PPI database value
//
if ((NotifyList->Flags & EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES) == 0) {
- CallbackNotifyListPointer->CurrentCount = LastCallbackNotifyCount;
- DispatchNotifyListPointer->CurrentCount = LastDispatchNotifyCount;
- DEBUG((DEBUG_ERROR, "ERROR -> NotifyPpi: %g %p\n", NotifyList->Guid, NotifyList->Notify));
- return EFI_INVALID_PARAMETER;
+ CallbackNotifyListPointer->CurrentCount = LastCallbackNotifyCount;
+ DispatchNotifyListPointer->CurrentCount = LastDispatchNotifyCount;
+ DEBUG ((DEBUG_ERROR, "ERROR -> NotifyPpi: %g %p\n", NotifyList->Guid, NotifyList->Notify));
+ return EFI_INVALID_PARAMETER;
}
if ((NotifyList->Flags & EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK) != 0) {
@@ -780,9 +789,10 @@ InternalPeiNotifyPpi ( sizeof (PEI_PPI_LIST_POINTERS) * CallbackNotifyListPointer->MaxCount
);
CallbackNotifyListPointer->NotifyPtrs = TempPtr;
- CallbackNotifyListPointer->MaxCount = CallbackNotifyListPointer->MaxCount + CALLBACK_NOTIFY_GROWTH_STEP;
+ CallbackNotifyListPointer->MaxCount = CallbackNotifyListPointer->MaxCount + CALLBACK_NOTIFY_GROWTH_STEP;
}
- CallbackNotifyListPointer->NotifyPtrs[CallbackNotifyIndex].Notify = (EFI_PEI_NOTIFY_DESCRIPTOR *) NotifyList;
+
+ CallbackNotifyListPointer->NotifyPtrs[CallbackNotifyIndex].Notify = (EFI_PEI_NOTIFY_DESCRIPTOR *)NotifyList;
CallbackNotifyIndex++;
CallbackNotifyListPointer->CurrentCount++;
} else {
@@ -800,14 +810,15 @@ InternalPeiNotifyPpi ( sizeof (PEI_PPI_LIST_POINTERS) * DispatchNotifyListPointer->MaxCount
);
DispatchNotifyListPointer->NotifyPtrs = TempPtr;
- DispatchNotifyListPointer->MaxCount = DispatchNotifyListPointer->MaxCount + DISPATCH_NOTIFY_GROWTH_STEP;
+ DispatchNotifyListPointer->MaxCount = DispatchNotifyListPointer->MaxCount + DISPATCH_NOTIFY_GROWTH_STEP;
}
- DispatchNotifyListPointer->NotifyPtrs[DispatchNotifyIndex].Notify = (EFI_PEI_NOTIFY_DESCRIPTOR *) NotifyList;
+
+ DispatchNotifyListPointer->NotifyPtrs[DispatchNotifyIndex].Notify = (EFI_PEI_NOTIFY_DESCRIPTOR *)NotifyList;
DispatchNotifyIndex++;
DispatchNotifyListPointer->CurrentCount++;
}
- DEBUG((DEBUG_INFO, "Register PPI Notify: %g\n", NotifyList->Guid));
+ DEBUG ((DEBUG_INFO, "Register PPI Notify: %g\n", NotifyList->Guid));
if (Single) {
//
@@ -815,12 +826,14 @@ InternalPeiNotifyPpi ( //
break;
} else if ((NotifyList->Flags & EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) ==
- EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) {
+ EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST)
+ {
//
// Continue until the end of the Notify List.
//
break;
}
+
//
// Go to the next descriptor.
//
@@ -839,7 +852,7 @@ InternalPeiNotifyPpi ( CallbackNotifyListPointer->CurrentCount
);
- return EFI_SUCCESS;
+ return EFI_SUCCESS;
}
/**
@@ -878,7 +891,7 @@ ProcessDispatchNotifyList ( IN PEI_CORE_INSTANCE *PrivateData
)
{
- UINTN TempValue;
+ UINTN TempValue;
while (TRUE) {
//
@@ -927,6 +940,7 @@ ProcessDispatchNotifyList ( break;
}
}
+
return;
}
@@ -945,18 +959,18 @@ ProcessDispatchNotifyList ( VOID
ProcessNotify (
IN PEI_CORE_INSTANCE *PrivateData,
- IN UINTN NotifyType,
- IN INTN InstallStartIndex,
- IN INTN InstallStopIndex,
- IN INTN NotifyStartIndex,
- IN INTN NotifyStopIndex
+ IN UINTN NotifyType,
+ IN INTN InstallStartIndex,
+ IN INTN InstallStopIndex,
+ IN INTN NotifyStartIndex,
+ IN INTN NotifyStopIndex
)
{
- INTN Index1;
- INTN Index2;
- EFI_GUID *SearchGuid;
- EFI_GUID *CheckGuid;
- EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor;
+ INTN Index1;
+ INTN Index2;
+ EFI_GUID *SearchGuid;
+ EFI_GUID *CheckGuid;
+ EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor;
for (Index1 = NotifyStartIndex; Index1 < NotifyStopIndex; Index1++) {
if (NotifyType == EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK) {
@@ -977,13 +991,16 @@ ProcessNotify ( if ((((INT32 *)SearchGuid)[0] == ((INT32 *)CheckGuid)[0]) &&
(((INT32 *)SearchGuid)[1] == ((INT32 *)CheckGuid)[1]) &&
(((INT32 *)SearchGuid)[2] == ((INT32 *)CheckGuid)[2]) &&
- (((INT32 *)SearchGuid)[3] == ((INT32 *)CheckGuid)[3])) {
- DEBUG ((DEBUG_INFO, "Notify: PPI Guid: %g, Peim notify entry point: %p\n",
+ (((INT32 *)SearchGuid)[3] == ((INT32 *)CheckGuid)[3]))
+ {
+ DEBUG ((
+ DEBUG_INFO,
+ "Notify: PPI Guid: %g, Peim notify entry point: %p\n",
SearchGuid,
NotifyDescriptor->Notify
));
NotifyDescriptor->Notify (
- (EFI_PEI_SERVICES **) GetPeiServicesTablePointer (),
+ (EFI_PEI_SERVICES **)GetPeiServicesTablePointer (),
NotifyDescriptor,
(PrivateData->PpiData.PpiList.PpiPtrs[Index2].Ppi)->Ppi
);
@@ -1002,20 +1019,20 @@ ProcessNotify ( **/
VOID
ProcessPpiListFromSec (
- IN CONST EFI_PEI_SERVICES **PeiServices,
- IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList
+ IN CONST EFI_PEI_SERVICES **PeiServices,
+ IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList
)
{
- EFI_STATUS Status;
- EFI_SEC_HOB_DATA_PPI *SecHobDataPpi;
- EFI_HOB_GENERIC_HEADER *SecHobList;
+ EFI_STATUS Status;
+ EFI_SEC_HOB_DATA_PPI *SecHobDataPpi;
+ EFI_HOB_GENERIC_HEADER *SecHobList;
- for (;;) {
+ for ( ; ;) {
if ((PpiList->Flags & EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES) != 0) {
//
// It is a notification PPI.
//
- Status = InternalPeiNotifyPpi (PeiServices, (CONST EFI_PEI_NOTIFY_DESCRIPTOR *) PpiList, TRUE);
+ Status = InternalPeiNotifyPpi (PeiServices, (CONST EFI_PEI_NOTIFY_DESCRIPTOR *)PpiList, TRUE);
ASSERT_EFI_ERROR (Status);
} else {
//
@@ -1041,7 +1058,7 @@ ProcessPpiListFromSec ( // returned into the HOB list. It does this after installing all PPIs passed from SEC
// into the PPI database and before dispatching any PEIMs.
//
- Status = PeiLocatePpi (PeiServices, &gEfiSecHobDataPpiGuid, 0, NULL, (VOID **) &SecHobDataPpi);
+ Status = PeiLocatePpi (PeiServices, &gEfiSecHobDataPpiGuid, 0, NULL, (VOID **)&SecHobDataPpi);
if (!EFI_ERROR (Status)) {
Status = SecHobDataPpi->GetHobs (SecHobDataPpi, &SecHobList);
if (!EFI_ERROR (Status)) {
@@ -1061,8 +1078,8 @@ ProcessPpiListFromSec ( **/
VOID
ConvertPeiCorePpiPointers (
- IN PEI_CORE_INSTANCE *PrivateData,
- IN PEI_CORE_FV_HANDLE *CoreFvHandle
+ IN PEI_CORE_INSTANCE *PrivateData,
+ IN PEI_CORE_FV_HANDLE *CoreFvHandle
)
{
EFI_FV_FILE_INFO FileInfo;
@@ -1080,11 +1097,11 @@ ConvertPeiCorePpiPointers ( // Find the PEI Core in the BFV in temporary memory.
//
Status = CoreFvHandle->FvPpi->FindFileByType (
- CoreFvHandle->FvPpi,
- EFI_FV_FILETYPE_PEI_CORE,
- CoreFvHandle->FvHandle,
- &PeiCoreFileHandle
- );
+ CoreFvHandle->FvPpi,
+ EFI_FV_FILETYPE_PEI_CORE,
+ CoreFvHandle->FvHandle,
+ &PeiCoreFileHandle
+ );
ASSERT_EFI_ERROR (Status);
if (!EFI_ERROR (Status)) {
@@ -1097,21 +1114,21 @@ ConvertPeiCorePpiPointers ( //
// Find PEI Core EntryPoint in the BFV in temporary memory.
//
- Status = PeCoffLoaderGetEntryPoint ((VOID *) (UINTN) PeiCoreImageBase, &PeiCoreEntryPoint);
+ Status = PeCoffLoaderGetEntryPoint ((VOID *)(UINTN)PeiCoreImageBase, &PeiCoreEntryPoint);
ASSERT_EFI_ERROR (Status);
- OrgImageBase = (UINTN) PeiCoreImageBase;
- MigratedImageBase = (UINTN) _ModuleEntryPoint - ((UINTN) PeiCoreEntryPoint - (UINTN) PeiCoreImageBase);
+ OrgImageBase = (UINTN)PeiCoreImageBase;
+ MigratedImageBase = (UINTN)_ModuleEntryPoint - ((UINTN)PeiCoreEntryPoint - (UINTN)PeiCoreImageBase);
//
// Size of loaded PEI_CORE in permanent memory.
//
- PeiCoreModuleSize = (UINTN)FileInfo.BufferSize - ((UINTN) OrgImageBase - (UINTN) FileInfo.Buffer);
+ PeiCoreModuleSize = (UINTN)FileInfo.BufferSize - ((UINTN)OrgImageBase - (UINTN)FileInfo.Buffer);
//
// Migrate PEI_CORE PPI pointers from temporary memory to newly
// installed PEI_CORE in permanent memory.
//
- ConvertPpiPointersFv (PrivateData, (UINTN) OrgImageBase, (UINTN) MigratedImageBase, PeiCoreModuleSize);
+ ConvertPpiPointersFv (PrivateData, (UINTN)OrgImageBase, (UINTN)MigratedImageBase, PeiCoreModuleSize);
}
}
|