Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PeiCore method to find AdvancedLogger log buffer if LoggerInfo is… #389

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -436,11 +436,45 @@ AdvancedLoggerGetLoggerInfo (

PeiCoreInstance = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices);
LoggerInfo = ALI_FROM_PA (PeiCoreInstance->PlatformBlob);
if (LoggerInfo != NULL) {
if ((LoggerInfo != NULL) && (LoggerInfo->Signature == ADVANCED_LOGGER_SIGNATURE)) {
// Logger Info was saved from an earlier call - Return LoggerInfo.
return LoggerInfo;
}

// In the time between PeiCore TemporaryRamDonePpi->TemporaryRamDone
// and gEfiPeiMemoryDiscoveredPpiGuid being installed, CAR (and PlatformBlob)
// may become invalid due to CAR relocations. Check if gAdvancedLoggerHobGuid
// already exists, but that the CAR pointers are no longer valid and update
// pointers
GuidHob = GetFirstGuidHob (&gAdvancedLoggerHobGuid);
if (GuidHob != NULL) {
EFI_PEI_HOB_POINTERS Hob;
Hob.Raw = GetHobList ();
LogPtr = (ADVANCED_LOGGER_PTR *)GET_GUID_HOB_DATA (GuidHob);

while ((Hob.Raw = GetNextHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, Hob.Raw)) != NULL) {
// Go through Allocation Hobs, attempting to find an allocation that matches
// the expected Advanced Logger Signature
LoggerInfo = ALI_FROM_PA (Hob.MemoryAllocation->AllocDescriptor.MemoryBaseAddress);
if (LoggerInfo->Signature == ADVANCED_LOGGER_SIGNATURE) {
// Update the PlatformBlob pointer to point to the relocated buffer
(PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices))->PlatformBlob = PA_FROM_PTR (LoggerInfo);

// Update the GuidHob pointer to the relocated memory buffer
LogPtr->LogBuffer = PA_FROM_PTR (LoggerInfo);

// return the pointer
return LoggerInfo;
}

Hob.Raw = GET_NEXT_HOB (Hob);
}

// Nothing valid was found, ensure LoggerInfo is still NULL to not interfere with fallthrough
// in next code section.
LoggerInfo = NULL;
}

//
// No Logger Info - this must be the time to allocate a new LoggerInfo and save
// the pointer in the PeiCoreInstance.
Expand Down