/** @file\r
- DXE Dispatcher Dependency Evaluator\r
+ DXE Dispatcher Dependency Evaluator.\r
\r
This routine evaluates a dependency expression (DEPENDENCY_EXPRESSION) to determine\r
if a driver can be scheduled for execution. The criteria for\r
Grow size of the Depex stack\r
\r
@retval EFI_SUCCESS Stack successfully growed. \r
- @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the \r
- stack.\r
+ @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.\r
\r
**/\r
EFI_STATUS\r
\r
\r
/**\r
- Push an element onto the Boolean Stack\r
+ Push an element onto the Boolean Stack.\r
\r
@param Value BOOLEAN to push. \r
\r
@retval EFI_SUCCESS The value was pushed onto the stack. \r
- @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the \r
- stack.\r
+ @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.\r
\r
**/\r
EFI_STATUS\r
@param Value BOOLEAN to pop. \r
\r
@retval EFI_SUCCESS The value was popped onto the stack. \r
- @retval EFI_ACCESS_DENIED The pop operation underflowed the stack\r
+ @retval EFI_ACCESS_DENIED The pop operation underflowed the stack.\r
\r
**/\r
EFI_STATUS \r
it will be cleared by CoreSchedule(), and then the driver can be\r
dispatched.\r
\r
- @param DriverEntry DriverEntry element to update \r
+ @param DriverEntry DriverEntry element to update .\r
\r
@retval EFI_SUCCESS It always works.\r
\r
routine in this case. The SOR is just ignored and is a nop in the grammer.\r
POSTFIX means all the math is done on top of the stack.\r
\r
- @param DriverEntry DriverEntry element to update \r
+ @param DriverEntry DriverEntry element to update. \r
\r
@retval TRUE If driver is ready to run. \r
@retval FALSE If driver is not ready to run or some fatal error \r
\r
//\r
// Clean out memory leaks in Depex Boolean stack. Leaks are only caused by\r
- // incorrectly formed DEPEX expressions\r
+ // incorrectly formed DEPEX expressions\r
//\r
mDepexEvaluationStackPointer = mDepexEvaluationStack;\r
\r
//\r
// List of file types supported by dispatcher\r
//\r
-STATIC EFI_FV_FILETYPE mDxeFileTypes[] = { \r
+EFI_FV_FILETYPE mDxeFileTypes[] = { \r
EFI_FV_FILETYPE_DRIVER, \r
EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER, \r
EFI_FV_FILETYPE_DXE_CORE,\r
);\r
\r
/**\r
- Convert FvHandle and DriverName into an EFI device path\r
+ Convert FvHandle and DriverName into an EFI device path.\r
\r
@param Fv Fv protocol, needed to read Depex info out of \r
FLASH. \r
\r
\r
/**\r
- Convert a driver from the Untrused back to the Scheduled state\r
+ Convert a driver from the Untrused back to the Scheduled state.\r
\r
@param FirmwareVolumeHandle The handle of the Firmware Volume that contains \r
the firmware file specified by DriverName. \r
@param FvHandle The handle of a FV that's being tested \r
\r
@retval TRUE Fv protocol on FvHandle has been processed \r
- @retval FALSE Fv protocol on FvHandle has not yet been \r
- processed\r
+ @retval FALSE Fv protocol on FvHandle has not yet been processed\r
\r
**/\r
BOOLEAN\r
\r
\r
\r
-\r
/**\r
Add an entry to the mDiscoveredList. Allocate memory to store the DriverEntry,\r
and initilize any state variables. Read the Depex from the FV and store it\r
ASSERT (DriverEntry != NULL);\r
\r
DriverEntry->Signature = EFI_CORE_DRIVER_ENTRY_SIGNATURE;\r
- CopyMem (&DriverEntry->FileName, DriverName, sizeof (EFI_GUID));\r
+ CopyGuid (&DriverEntry->FileName, DriverName);\r
DriverEntry->FvHandle = FvHandle;\r
DriverEntry->Fv = Fv;\r
DriverEntry->FvFileDevicePath = CoreFvToDevicePath (Fv, FvHandle, DriverName);\r
//\r
// Read the first (and only the first) firmware volume section\r
//\r
- SectionType = EFI_SECTION_FIRMWARE_VOLUME_IMAGE;\r
- FvHeader = NULL;\r
- FvAlignment = 0;\r
- Buffer = NULL;\r
- BufferSize = 0;\r
+ SectionType = EFI_SECTION_FIRMWARE_VOLUME_IMAGE;\r
+ FvHeader = NULL;\r
+ FvAlignment = 0;\r
+ Buffer = NULL;\r
+ BufferSize = 0;\r
AlignedBuffer = NULL;\r
Status = Fv->ReadSection (\r
- Fv, \r
- DriverName, \r
- SectionType, \r
- 0, \r
- &Buffer, \r
- &BufferSize,\r
- &AuthenticationStatus\r
- );\r
+ Fv, \r
+ DriverName, \r
+ SectionType, \r
+ 0, \r
+ &Buffer, \r
+ &BufferSize,\r
+ &AuthenticationStatus\r
+ );\r
if (!EFI_ERROR (Status)) {\r
//\r
// FvImage should be at its required alignment.\r
if (FvAlignment < 8) {\r
FvAlignment = 8;\r
}\r
+ //\r
+ // Allocate the aligned buffer for the FvImage.\r
+ //\r
AlignedBuffer = AllocateAlignedPages (EFI_SIZE_TO_PAGES (BufferSize), (UINTN) FvAlignment);\r
if (AlignedBuffer == NULL) {\r
Status = EFI_OUT_OF_RESOURCES;\r
while (TRUE) {\r
BufferSize = sizeof (EFI_HANDLE);\r
Status = CoreLocateHandle (\r
- ByRegisterNotify,\r
- NULL,\r
- mFwVolEventRegistration,\r
- &BufferSize,\r
- &FvHandle\r
- );\r
+ ByRegisterNotify,\r
+ NULL,\r
+ mFwVolEventRegistration,\r
+ &BufferSize,\r
+ &FvHandle\r
+ );\r
if (EFI_ERROR (Status)) {\r
//\r
// If no more notification events exit\r
//\r
FvIsBeingProcesssed (FvHandle);\r
\r
-\r
Status = CoreHandleProtocol (FvHandle, &gEfiFirmwareVolume2ProtocolGuid, (VOID **)&Fv);\r
if (EFI_ERROR (Status)) {\r
//\r
// EFI_FV_FILETYPE_DXE_CORE is processed to produce a Loaded Image protocol for the core\r
// EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE is processed to create a Fvb\r
//\r
- for (Index = 0; Index < sizeof (mDxeFileTypes)/sizeof (EFI_FV_FILETYPE); Index++) {\r
+ for (Index = 0; Index < sizeof (mDxeFileTypes) / sizeof (EFI_FV_FILETYPE); Index++) {\r
//\r
// Initialize the search key\r
//\r
\r
/**\r
Initialize the dispatcher. Initialize the notification function that runs when\r
- a FV protocol is added to the system.\r
+ an FV2 protocol is added to the system.\r
\r
**/\r
VOID\r
EFI_BDS_ARCH_PROTOCOL *gBds = NULL;\r
EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *gWatchdogTimer = NULL;\r
\r
+//\r
+// DXE Core Global used to update core loaded image protocol handle\r
+//\r
+EFI_GUID *gDxeCoreFileName;\r
+EFI_LOADED_IMAGE_PROTOCOL *gDxeCoreLoadedImage;\r
\r
//\r
// BugBug: I'n not runtime, but is the PPI?\r
\r
EFI_STATUS_CODE_PROTOCOL *gStatusCode = &gStatusCodeInstance;\r
\r
-\r
-//\r
-// DXE Core Global used to update core loaded image protocol handle\r
-//\r
-EFI_GUID *gDxeCoreFileName;\r
-EFI_LOADED_IMAGE_PROTOCOL *gDxeCoreLoadedImage;\r
-\r
-\r
-\r
//\r
// DXE Core Module Variables\r
//\r
EFI_RUNTIME_SERVICES *gDxeCoreRT = &mEfiRuntimeServicesTableTemplate;\r
EFI_HANDLE gDxeCoreImageHandle = NULL;\r
\r
-VOID *mHobStart;\r
\r
//\r
// EFI Decompress Protocol\r
/**\r
Main entry point to DXE Core.\r
\r
- @param HobStart Pointer to the beginning of the HOB List from \r
- PEI \r
+ @param HobStart Pointer to the beginning of the HOB List from PEI. \r
\r
- @return This function should never return\r
+ @return This function should never return.\r
\r
**/\r
VOID\r
EFI_PHYSICAL_ADDRESS MemoryBaseAddress;\r
UINT64 MemoryLength;\r
\r
- mHobStart = HobStart;\r
-\r
//\r
// Initialize Memory Services\r
//\r
ASSERT_EFI_ERROR (Status);\r
\r
//\r
- // The HobStart is relocated in gcd service init. Sync mHobStart varible.\r
- //\r
- mHobStart = HobStart;\r
- \r
// Install the DXE Services Table into the EFI System Tables's Configuration Table\r
//\r
Status = CoreInstallConfigurationTable (&gEfiDxeServicesTableGuid, gDxeCoreDS);\r
//\r
// Initialize the ReportStatusCode with PEI version, if available\r
//\r
- CoreGetPeiProtocol (&gEfiStatusCodeRuntimeProtocolGuid, (VOID **)&gStatusCode->ReportStatusCode);\r
+ CoreGetPeiProtocol (&gEfiStatusCodeRuntimeProtocolGuid, (VOID **) &gStatusCode->ReportStatusCode);\r
\r
//\r
// Report Status Code here for DXE_ENTRY_POINT once it is available\r
gDxeCoreImageHandle\r
);\r
\r
- DEBUG ((DEBUG_INFO | DEBUG_LOAD, "HOBLIST address in DXE = 0x%016lx\n", (UINT64) (UINTN) HobStart));\r
+ DEBUG ((DEBUG_INFO | DEBUG_LOAD, "HOBLIST address in DXE = 0x%p\n", HobStart));\r
\r
//\r
// Initialize the Event Services\r
// Publish the EFI, Tiano, and Custom Decompress protocols for use by other DXE components\r
//\r
Status = CoreInstallMultipleProtocolInterfaces (\r
- &mDecompressHandle,\r
- &gEfiDecompressProtocolGuid, &gEfiDecompress,\r
- NULL\r
- );\r
+ &mDecompressHandle,\r
+ &gEfiDecompressProtocolGuid, &gEfiDecompress,\r
+ NULL\r
+ );\r
ASSERT_EFI_ERROR (Status);\r
\r
//\r
// Report Status code before transfer control to BDS\r
//\r
CoreReportProgressCode (FixedPcdGet32 (PcdStatusCodeValueDxeCoreHandoffToBds));\r
+ \r
//\r
// Display any drivers that were not dispatched because dependency expression\r
// evaluated to false if this is a debug build\r
EFI_HOB_GUID_TYPE *GuidHob;\r
VOID *Buffer;\r
\r
- GuidHob = GetNextGuidHob (ProtocolGuid, mHobStart);\r
+ GuidHob = GetFirstGuidHob (ProtocolGuid);\r
if (GuidHob == NULL) {\r
return EFI_NOT_FOUND;\r
}\r
IN UINTN MapKey\r
)\r
{\r
- EFI_STATUS Status;\r
- EFI_STATUS StatusTemp;\r
+ EFI_STATUS Status;\r
+ EFI_STATUS StatusTemp;\r
EFI_TCG_PLATFORM_PROTOCOL *TcgPlatformProtocol;\r
\r
//\r
//\r
// Zero out the Boot Service Table\r
//\r
- SetMem (gDxeCoreBS, sizeof (EFI_BOOT_SERVICES), 0);\r
+ ZeroMem (gDxeCoreBS, sizeof (EFI_BOOT_SERVICES));\r
gDxeCoreBS = NULL;\r
\r
//\r
OUT UINT32 *ScratchSize\r
)\r
{\r
- if (Source == NULL \r
- || DestinationSize == NULL \r
- || ScratchSize == NULL) {\r
+ if (Source == NULL || DestinationSize == NULL || ScratchSize == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
return UefiDecompressGetInfo (Source, SourceSize, DestinationSize, ScratchSize);\r
EFI_STATUS\r
EFIAPI\r
DxeMainUefiDecompress (\r
- IN EFI_DECOMPRESS_PROTOCOL *This,\r
+ IN EFI_DECOMPRESS_PROTOCOL *This,\r
IN VOID *Source,\r
IN UINT32 SourceSize,\r
IN OUT VOID *Destination,\r
UINT32 TestDestinationSize;\r
UINT32 TestScratchSize;\r
\r
- if (Source == NULL \r
- || Destination== NULL \r
- || Scratch == NULL) {\r
+ if (Source == NULL || Destination== NULL || Scratch == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
{ &gEfiRuntimeArchProtocolGuid, (VOID **)&gRuntime, NULL, NULL, FALSE },\r
{ &gEfiVariableArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE },\r
{ &gEfiVariableWriteArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE },\r
- { &gEfiCapsuleArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE},\r
+ { &gEfiCapsuleArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE },\r
{ &gEfiMonotonicCounterArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE },\r
{ &gEfiResetArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE },\r
{ &gEfiRealTimeClockArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE },\r
/**\r
Return TRUE if all AP services are availible.\r
\r
-\r
@retval EFI_SUCCESS All AP services are available \r
@retval EFI_NOT_FOUND At least one AP service is not available\r
\r
\r
\r
\r
-\r
/**\r
Creates an event that is fired everytime a Protocol of a specific type is installed.\r
\r
CHAR16 *GuidString;\r
} GUID_TO_STRING_PROTOCOL_ENTRY;\r
\r
-STATIC CONST GUID_TO_STRING_PROTOCOL_ENTRY MissingProtocols[] = {\r
+CONST GUID_TO_STRING_PROTOCOL_ENTRY MissingProtocols[] = {\r
{ &gEfiSecurityArchProtocolGuid, (CHAR16 *)L"Security" },\r
{ &gEfiCpuArchProtocolGuid, (CHAR16 *)L"CPU" },\r
{ &gEfiMetronomeArchProtocolGuid, (CHAR16 *)L"Metronome" },\r
{ &gEfiCapsuleArchProtocolGuid, (CHAR16 *)L"Capsule" },\r
{ &gEfiMonotonicCounterArchProtocolGuid, (CHAR16 *)L"Monotonic Counter" },\r
{ &gEfiResetArchProtocolGuid, (CHAR16 *)L"Reset" },\r
-// { &gEfiStatusCodeRuntimeProtocolGuid, (CHAR16 *)L"Status Code" },\r
{ &gEfiRealTimeClockArchProtocolGuid, (CHAR16 *)L"Real Time Clock" }\r
};\r
\r
VOID\r
)\r
{\r
- const GUID_TO_STRING_PROTOCOL_ENTRY *MissingEntry;\r
+ CONST GUID_TO_STRING_PROTOCOL_ENTRY *MissingEntry;\r
ARCHITECTURAL_PROTOCOL_ENTRY *Entry;\r
\r
for (Entry = mArchProtocols; Entry->ProtocolGuid != NULL; Entry++) {\r
/**\r
Initializes "event" support and populates parts of the System and Runtime Table.\r
\r
-\r
@retval EFI_SUCCESS Always return success\r
\r
**/\r
return EFI_OUT_OF_RESOURCES;\r
}\r
\r
- SetMem (IEvent, sizeof (IEVENT), 0);\r
+ ZeroMem (IEvent, sizeof (IEVENT));\r
\r
IEvent->Signature = EVENT_SIGNATURE;\r
IEvent->Type = Type;\r
\r
\r
/**\r
- Signals the event. Queues the event to be notified if needed\r
+ Signals the event. Queues the event to be notified if needed.\r
\r
- @param UserEvent The event to signal \r
+ @param UserEvent The event to signal .\r
\r
@retval EFI_INVALID_PARAMETER Parameters are not valid. \r
@retval EFI_SUCCESS The event was signaled.\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
- if (Event->Type & EVT_NOTIFY_SIGNAL) {\r
+ if ((Event->Type & EVT_NOTIFY_SIGNAL) != 0) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
//\r
// Queue the wait notify function\r
//\r
-\r
CoreAcquireEventLock ();\r
if (!Event->SignalCount) {\r
CoreNotifyEvent (Event);\r
\r
\r
\r
-\r
/**\r
Stops execution until an event is signaled.\r
\r
}\r
\r
\r
-\r
/**\r
Closes an event and frees the event structure.\r
\r
//\r
// If it's a timer event, make sure it's not pending\r
//\r
- if (Event->Type & EVT_TIMER) {\r
+ if ((Event->Type & EVT_TIMER) != 0) {\r
CoreSetTimer (Event, TimerCancel, 0);\r
}\r
\r
// Internal data\r
//\r
\r
-STATIC LIST_ENTRY mEfiTimerList = INITIALIZE_LIST_HEAD_VARIABLE (mEfiTimerList);\r
-STATIC EFI_LOCK mEfiTimerLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_HIGH_LEVEL - 1);\r
-STATIC EFI_EVENT mEfiCheckTimerEvent;\r
+LIST_ENTRY mEfiTimerList = INITIALIZE_LIST_HEAD_VARIABLE (mEfiTimerList);\r
+EFI_LOCK mEfiTimerLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_HIGH_LEVEL - 1);\r
+EFI_EVENT mEfiCheckTimerEvent = NULL;\r
\r
-STATIC EFI_LOCK mEfiSystemTimeLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_HIGH_LEVEL);\r
-STATIC UINT64 mEfiSystemTime = 0;\r
+EFI_LOCK mEfiSystemTimeLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_HIGH_LEVEL);\r
+UINT64 mEfiSystemTime = 0;\r
\r
//\r
// Timer functions\r
//\r
-\r
-\r
/**\r
Initializes timer support.\r
\r
EFI_STATUS Status;\r
\r
Status = CoreCreateEvent (\r
- EVT_NOTIFY_SIGNAL,\r
- TPL_HIGH_LEVEL - 1,\r
- CoreCheckTimers,\r
- NULL,\r
- &mEfiCheckTimerEvent\r
- );\r
+ EVT_NOTIFY_SIGNAL,\r
+ TPL_HIGH_LEVEL - 1,\r
+ CoreCheckTimers,\r
+ NULL,\r
+ &mEfiCheckTimerEvent\r
+ );\r
ASSERT_EFI_ERROR (Status);\r
}\r
\r
CoreAcquireLock (&mEfiSystemTimeLock);\r
SystemTime = mEfiSystemTime;\r
CoreReleaseLock (&mEfiSystemTimeLock);\r
+ \r
return SystemTime;\r
}\r
\r
//\r
// Check runtiem flag in case there are ticks while exiting boot services\r
//\r
-\r
CoreAcquireLock (&mEfiSystemTimeLock);\r
\r
//\r
// Update the system time\r
//\r
-\r
mEfiSystemTime += Duration;\r
\r
//\r
// If the head of the list is expired, fire the timer event\r
// to process it\r
//\r
-\r
if (!IsListEmpty (&mEfiTimerList)) {\r
Event = CR (mEfiTimerList.ForwardLink, IEVENT, u.Timer.Link, EVENT_SIGNATURE);\r
\r
//\r
// Check the timer database for expired timers\r
//\r
-\r
CoreAcquireLock (&mEfiTimerLock);\r
SystemTime = CoreCurrentSystemTime ();\r
\r
//\r
// If this timer is not expired, then we're done\r
//\r
-\r
if (Event->u.Timer.TriggerTime > SystemTime) {\r
break;\r
}\r
// If this is a periodic timer, set it\r
//\r
if (Event->u.Timer.Period) {\r
-\r
//\r
// Compute the timers new trigger time\r
//\r
-\r
Event->u.Timer.TriggerTime = Event->u.Timer.TriggerTime + Event->u.Timer.Period;\r
\r
//\r
//\r
// Add the timer\r
//\r
-\r
CoreInsertEventTimer (Event);\r
}\r
}\r
//\r
// Get the timer's trigger time\r
//\r
-\r
TriggerTime = Event->u.Timer.TriggerTime;\r
\r
//\r
// Insert the timer into the timer database in assending sorted order\r
//\r
-\r
for (Link = mEfiTimerList.ForwardLink; Link != &mEfiTimerList; Link = Link->ForwardLink) {\r
Event2 = CR (Link, IEVENT, u.Timer.Link, EVENT_SIGNATURE);\r
\r
\r
\r
\r
-\r
/**\r
Sets the type of timer and the trigger time for a timer event.\r
\r
//\r
// If the timer is queued to the timer database, remove it\r
//\r
-\r
if (Event->u.Timer.Link.ForwardLink != NULL) {\r
RemoveEntryList (&Event->u.Timer.Link);\r
Event->u.Timer.Link.ForwardLink = NULL;\r
}\r
\r
CoreReleaseLock (&mEfiTimerLock);\r
+\r
return EFI_SUCCESS;\r
}\r
/** @file\r
- Task priority (TPL) function\r
+ Task priority (TPL) functions.\r
\r
Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
All rights reserved. This program and the accompanying materials\r
IN UINTN Number\r
)\r
{\r
- UINTN msb;\r
+ UINTN Msb;\r
\r
- msb = 31;\r
- while ((msb > 0) && ((Number & (UINTN)(1 << msb)) == 0)) {\r
- msb--;\r
+ Msb = 31;\r
+ while ((Msb > 0) && ((Number & (UINTN)(1 << Msb)) == 0)) {\r
+ Msb--;\r
}\r
\r
- return msb;\r
+ return Msb;\r
}\r
\r
\r
\r
#include <DxeMain.h>\r
\r
-#define PHYSICAL_ADDRESS_TO_POINTER(Address) ((VOID *)((UINTN)(Address)))\r
-\r
\r
/**\r
Get the FFS file state by checking the highest bit set in the header's state field.\r
HighestBit >>= 1;\r
}\r
\r
- return (EFI_FFS_FILE_STATE)HighestBit;\r
+ return (EFI_FFS_FILE_STATE) HighestBit;\r
}\r
\r
\r
*FileState = GetFileState (ErasePolarity, FfsHeader);\r
\r
switch (*FileState) {\r
- case EFI_FILE_HEADER_VALID:\r
- case EFI_FILE_DATA_VALID:\r
- case EFI_FILE_MARKED_FOR_UPDATE:\r
- case EFI_FILE_DELETED:\r
- //\r
- // Here we need to verify header checksum\r
- //\r
- return VerifyHeaderChecksum (FfsHeader);\r
- \r
- case EFI_FILE_HEADER_CONSTRUCTION:\r
- case EFI_FILE_HEADER_INVALID:\r
- default:\r
- return FALSE;\r
+ case EFI_FILE_HEADER_VALID:\r
+ case EFI_FILE_DATA_VALID:\r
+ case EFI_FILE_MARKED_FOR_UPDATE:\r
+ case EFI_FILE_DELETED:\r
+ //\r
+ // Here we need to verify header checksum\r
+ //\r
+ return VerifyHeaderChecksum (FfsHeader);\r
+ \r
+ case EFI_FILE_HEADER_CONSTRUCTION:\r
+ case EFI_FILE_HEADER_INVALID:\r
+ default:\r
+ return FALSE;\r
}\r
}\r
\r
\r
-\r
/**\r
Check if it's a valid FFS file.\r
Here we are sure that it has a valid FFS file header since we must call IsValidFfsHeader() first.\r
FileState = GetFileState (ErasePolarity, FfsHeader);\r
switch (FileState) {\r
\r
- case EFI_FILE_DELETED:\r
- case EFI_FILE_DATA_VALID:\r
- case EFI_FILE_MARKED_FOR_UPDATE:\r
- //\r
- // Some other vliadation like file content checksum might be done here.\r
- // For performance issue, Tiano only do FileState check.\r
- //\r
- return TRUE;\r
+ case EFI_FILE_DELETED:\r
+ case EFI_FILE_DATA_VALID:\r
+ case EFI_FILE_MARKED_FOR_UPDATE:\r
+ //\r
+ // Some other vliadation like file content checksum might be done here.\r
+ // For performance issue, Tiano only do FileState check.\r
+ //\r
+ return TRUE;\r
\r
- default:\r
- return FALSE;\r
+ default:\r
+ return FALSE;\r
}\r
}\r
\r
//\r
// FFS helper functions\r
//\r
-\r
-\r
/**\r
given the supplied FW_VOL_BLOCK_PROTOCOL, allocate a buffer for output and\r
copy the volume header into it.\r
\r
@param FvDevice pointer to the FvDevice to be freed. \r
\r
- @return None.\r
-\r
**/\r
VOID\r
FreeFvDeviceResource (\r
\r
CoreFreePool (FfsFileEntry);\r
\r
- FfsFileEntry = (FFS_FILE_LIST_ENTRY *)NextEntry;\r
+ FfsFileEntry = (FFS_FILE_LIST_ENTRY *) NextEntry;\r
}\r
\r
\r
\r
\r
/**\r
- Check if a FV is consistent and allocate cache\r
+ Check if an FV is consistent and allocate cache for it.\r
\r
- @param FvDevice pointer to the FvDevice to be checked. \r
+ @param FvDevice A pointer to the FvDevice to be checked. \r
\r
@retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated. \r
@retval EFI_SUCCESS FV is consistent and cache is allocated. \r
Size -= LbaOffset;\r
}\r
Status = Fvb->Read (Fvb,\r
- LbaIndex,\r
- LbaOffset,\r
- &Size,\r
- CacheLocation\r
- );\r
+ LbaIndex,\r
+ LbaOffset,\r
+ &Size,\r
+ CacheLocation\r
+ );\r
//\r
// Not check EFI_BAD_BUFFER_SIZE, for Size = BlockMap->Length\r
//\r
//\r
// Build FFS list\r
//\r
- FfsHeader = (EFI_FFS_FILE_HEADER *)FvDevice->CachedFv;\r
+ FfsHeader = (EFI_FFS_FILE_HEADER *) FvDevice->CachedFv;\r
TopFvAddress = FvDevice->EndOfCachedFv;\r
- while ((UINT8 *)FfsHeader < TopFvAddress) {\r
+ while ((UINT8 *) FfsHeader < TopFvAddress) {\r
\r
- TestLength = TopFvAddress - ((UINT8 *)FfsHeader);\r
+ TestLength = TopFvAddress - ((UINT8 *) FfsHeader);\r
if (TestLength > sizeof (EFI_FFS_FILE_HEADER)) {\r
TestLength = sizeof (EFI_FFS_FILE_HEADER);\r
}\r
if ((FileState == EFI_FILE_HEADER_INVALID) || \r
(FileState == EFI_FILE_HEADER_CONSTRUCTION)) {\r
FfsHeader++;\r
- \r
continue;\r
- \r
} else {\r
//\r
// File system is corrputed\r
return;\r
}\r
\r
- FvDevice->Fvb = Fvb;\r
- FvDevice->Handle = Handle;\r
- FvDevice->FwVolHeader = FwVolHeader;\r
+ FvDevice->Fvb = Fvb;\r
+ FvDevice->Handle = Handle;\r
+ FvDevice->FwVolHeader = FwVolHeader;\r
FvDevice->Fv.ParentHandle = Fvb->ParentHandle;\r
\r
//\r
// Return FileType, NameGuid, and Attributes\r
//\r
*FileType = FfsFileHeader->Type;\r
- CopyMem (NameGuid, &FfsFileHeader->Name, sizeof (EFI_GUID));\r
+ CopyGuid (NameGuid, &FfsFileHeader->Name);\r
*Attributes = FfsAttributes2FvFileAttributes (FfsFileHeader->Attributes);\r
\r
//\r
EFI_FFS_FILE_HEADER *FfsHeader;\r
UINTN InputBufferSize;\r
\r
- if (NULL == NameGuid) {\r
+ if (NameGuid == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
UINT8 *FileBuffer;\r
FFS_FILE_LIST_ENTRY *FfsEntry;\r
\r
- if (NULL == NameGuid || Buffer == NULL) {\r
+ if (NameGuid == NULL || Buffer == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
//\r
// Get the last key used by our call to FvReadFile as it is the FfsEntry for this file.\r
// \r
- FfsEntry = (FFS_FILE_LIST_ENTRY *)FvDevice->LastKey;\r
+ FfsEntry = (FFS_FILE_LIST_ENTRY *) FvDevice->LastKey;\r
\r
if (EFI_ERROR (Status)) {\r
return Status;\r
//\r
if (FfsEntry->StreamHandle == 0) {\r
Status = OpenSectionStream (\r
- FileSize,\r
- FileBuffer,\r
- &FfsEntry->StreamHandle\r
- );\r
+ FileSize,\r
+ FileBuffer,\r
+ &FfsEntry->StreamHandle\r
+ );\r
if (EFI_ERROR (Status)) {\r
goto Done;\r
}\r
/** @file\r
- Firmware Volume Block protocol. Consumes FV hobs and creates\r
- appropriate block protocols.\r
-\r
- Also consumes NT_NON_MM_FV envinronment variable and produces appropriate\r
- block protocols fro them also... (this is TBD)\r
+ Implementations for Firmware Volume Block protocol. \r
+ \r
+ It consumes FV HOBs and creates read-lonly Firmare Volume Block protocol \r
+ instances for each of them.\r
\r
Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
All rights reserved. This program and the accompanying materials\r
{\r
HARDWARE_DEVICE_PATH,\r
HW_MEMMAP_DP,\r
- { (UINT8)(sizeof (MEMMAP_DEVICE_PATH)), (UINT8)(sizeof (MEMMAP_DEVICE_PATH) >> 8) }\r
+ {\r
+ (UINT8)(sizeof (MEMMAP_DEVICE_PATH)),\r
+ (UINT8)(sizeof (MEMMAP_DEVICE_PATH) >> 8)\r
+ }\r
},\r
EfiMemoryMappedIO,\r
- (EFI_PHYSICAL_ADDRESS)0,\r
- (EFI_PHYSICAL_ADDRESS)0,\r
+ (EFI_PHYSICAL_ADDRESS) 0,\r
+ (EFI_PHYSICAL_ADDRESS) 0,\r
},\r
{\r
END_DEVICE_PATH_TYPE,\r
END_ENTIRE_DEVICE_PATH_SUBTYPE,\r
- { END_DEVICE_PATH_LENGTH, 0 } \r
+ { \r
+ END_DEVICE_PATH_LENGTH,\r
+ 0\r
+ } \r
},\r
},\r
{\r
\r
\r
\r
-\r
-\r
/**\r
Retrieves Volume attributes. No polarity translations are done.\r
\r
return EFI_ACCESS_DENIED;\r
}\r
\r
- LbaIndex = (UINTN)Lba;\r
+ LbaIndex = (UINTN) Lba;\r
if (LbaIndex >= FvbDevice->NumBlocks) {\r
//\r
// Invalid Lba, read nothing.\r
}\r
\r
LbaStart = FvbDevice->LbaCache[LbaIndex].Base;\r
- FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)((UINTN)FvbDevice->BaseAddress);\r
- LbaOffset = (UINT8 *)FwVolHeader + LbaStart + Offset;\r
+ FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)((UINTN) FvbDevice->BaseAddress);\r
+ LbaOffset = (UINT8 *) FwVolHeader + LbaStart + Offset;\r
\r
//\r
// Perform read operation\r
EFI_FV_BLOCK_MAP_ENTRY *PtrBlockMapEntry;\r
\r
FvAlignment = 0;\r
- FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)BaseAddress;\r
+ FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)(UINTN) BaseAddress;\r
//\r
// Validate FV Header, if not as expected, return\r
//\r
//\r
FvbDev->NumBlocks = 0;\r
for (PtrBlockMapEntry = FwVolHeader->BlockMap;\r
- PtrBlockMapEntry->NumBlocks != 0;\r
- PtrBlockMapEntry++) {\r
+ PtrBlockMapEntry->NumBlocks != 0;\r
+ PtrBlockMapEntry++) {\r
FvbDev->NumBlocks += PtrBlockMapEntry->NumBlocks;\r
}\r
//\r
BlockIndex = 0;\r
LinearOffset = 0;\r
for (PtrBlockMapEntry = FwVolHeader->BlockMap;\r
- PtrBlockMapEntry->NumBlocks != 0; PtrBlockMapEntry++) {\r
+ PtrBlockMapEntry->NumBlocks != 0; PtrBlockMapEntry++) {\r
for (BlockIndex2 = 0; BlockIndex2 < PtrBlockMapEntry->NumBlocks; BlockIndex2++) {\r
FvbDev->LbaCache[BlockIndex].Base = LinearOffset;\r
FvbDev->LbaCache[BlockIndex].Length = PtrBlockMapEntry->Length;\r
// Attach FvVolBlock Protocol to new handle\r
//\r
Status = CoreInstallMultipleProtocolInterfaces (\r
- &FvbDev->Handle,\r
- &gEfiFirmwareVolumeBlockProtocolGuid, &FvbDev->FwVolBlockInstance,\r
- &gEfiDevicePathProtocolGuid, &FvbDev->DevicePath,\r
- &gEfiFirmwareVolumeDispatchProtocolGuid, NULL,\r
- NULL\r
- );\r
+ &FvbDev->Handle,\r
+ &gEfiFirmwareVolumeBlockProtocolGuid, &FvbDev->FwVolBlockInstance,\r
+ &gEfiDevicePathProtocolGuid, &FvbDev->DevicePath,\r
+ &gEfiFirmwareVolumeDispatchProtocolGuid, NULL,\r
+ NULL\r
+ );\r
\r
//\r
// If they want the handle back, set it.\r
)\r
{\r
EFI_PEI_HOB_POINTERS FvHob;\r
+\r
//\r
// Core Needs Firmware Volumes to function\r
//\r
ProduceFVBProtocolOnBuffer (FvHob.FirmwareVolume->BaseAddress, FvHob.FirmwareVolume->Length, NULL, NULL); \r
FvHob.Raw = GET_NEXT_HOB (FvHob);\r
}\r
+\r
return EFI_SUCCESS;\r
}\r
\r
//\r
if (!EFI_ERROR(Status)) {\r
Ptr = NULL;\r
- Status = CoreHandleProtocol (*FVProtocolHandle, &gEfiFirmwareVolume2ProtocolGuid, (VOID **)&Ptr);\r
+ Status = CoreHandleProtocol (*FVProtocolHandle, &gEfiFirmwareVolume2ProtocolGuid, (VOID **) &Ptr);\r
if (EFI_ERROR(Status) || (Ptr == NULL)) {\r
return EFI_VOLUME_CORRUPTED;\r
}\r
/** @file\r
The file contains the GCD related services in the EFI Boot Services Table.\r
- The GCD services are used to manage the memory and I/O regions that \r
- are accessible to the CPU that is executing the DXE core.\r
+ The GCD services are used to manage the memory and I/O regions that \r
+ are accessible to the CPU that is executing the DXE core.\r
\r
Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
All rights reserved. This program and the accompanying materials\r
\r
EFI_GCD_MAP_ENTRY mGcdMemorySpaceMapEntryTemplate = {\r
EFI_GCD_MAP_SIGNATURE,\r
- { NULL, NULL },\r
+ { \r
+ NULL,\r
+ NULL\r
+ },\r
0,\r
0,\r
0,\r
\r
EFI_GCD_MAP_ENTRY mGcdIoSpaceMapEntryTemplate = {\r
EFI_GCD_MAP_SIGNATURE,\r
- { NULL, NULL },\r
+ {\r
+ NULL,\r
+ NULL\r
+ },\r
0,\r
0,\r
0,\r
{ EFI_RESOURCE_ATTRIBUTE_PRESENT, EFI_MEMORY_PRESENT, FALSE },\r
{ EFI_RESOURCE_ATTRIBUTE_INITIALIZED, EFI_MEMORY_INITIALIZED, FALSE },\r
{ EFI_RESOURCE_ATTRIBUTE_TESTED, EFI_MEMORY_TESTED, FALSE },\r
- { 0, 0, FALSE }\r
+ { 0, 0, FALSE }\r
};\r
\r
\r
//\r
// GCD Initialization Worker Functions\r
//\r
-\r
/**\r
Aligns a value to the specified boundary.\r
\r
\r
\r
/**\r
- Merge the Gcd region specified by Link and its adjacent entry\r
+ Merge the Gcd region specified by Link and its adjacent entry.\r
\r
@param Link Specify the entry to be merged (with its \r
adjacent entry). \r
}\r
Link = Link->ForwardLink;\r
}\r
+\r
return EFI_NOT_FOUND;\r
}\r
\r
Count++;\r
Link = Link->ForwardLink;\r
}\r
+ \r
return Count;\r
}\r
\r
if ((Attributes & EFI_MEMORY_RUNTIME) != 0) {\r
if ((BaseAddress & EFI_PAGE_MASK) != 0 || (Length & EFI_PAGE_MASK) != 0) {\r
Status = EFI_INVALID_PARAMETER;\r
-\r
goto Done;\r
}\r
}\r
goto Done;\r
}\r
\r
- //\r
- //\r
- //\r
if (Operation == GCD_SET_ATTRIBUTES_MEMORY_OPERATION) {\r
//\r
// Call CPU Arch Protocol to attempt to set attributes on the range\r
}\r
\r
if (GcdAllocateType == EfiGcdAllocateMaxAddressSearchTopDown ||\r
- GcdAllocateType == EfiGcdAllocateAnySearchTopDown ) {\r
+ GcdAllocateType == EfiGcdAllocateAnySearchTopDown) {\r
if ((Entry->BaseAddress + Length) > MaxAddress) {\r
continue;\r
}\r
//\r
// See if this resource descrior HOB describes tested system memory below MaxAddress\r
//\r
- if (ResourceHob->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY &&\r
- (ResourceHob->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) == TESTED_MEMORY_ATTRIBUTES &&\r
- ResourceHob->PhysicalStart + ResourceHob->ResourceLength <= MaxAddress ) {\r
-\r
+ if (ResourceHob->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY &&\r
+ (ResourceHob->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) == TESTED_MEMORY_ATTRIBUTES &&\r
+ ResourceHob->PhysicalStart + ResourceHob->ResourceLength <= MaxAddress) {\r
//\r
// See if this is the highest tested system memory region below MaxAddress\r
//\r
MaxAddress = ResourceHob->PhysicalStart;\r
} while (Found && MaxMemoryLength < MINIMUM_INITIAL_MEMORY_SIZE);\r
\r
- //\r
- //\r
- //\r
- if ((Length < MINIMUM_INITIAL_MEMORY_SIZE) ||\r
- (MaxMemoryBaseAddress > BaseAddress && MaxMemoryLength >= MINIMUM_INITIAL_MEMORY_SIZE) ) {\r
+ if ((Length < MINIMUM_INITIAL_MEMORY_SIZE) ||\r
+ (MaxMemoryBaseAddress > BaseAddress && MaxMemoryLength >= MINIMUM_INITIAL_MEMORY_SIZE)) {\r
BaseAddress = MaxMemoryBaseAddress;\r
Length = MaxMemoryLength;\r
Attributes = MaxMemoryAttributes;\r
**/\r
EFI_STATUS\r
CoreInitializeGcdServices (\r
- IN OUT VOID **HobStart,\r
+ IN OUT VOID **HobStart,\r
IN EFI_PHYSICAL_ADDRESS MemoryBaseAddress,\r
IN UINT64 MemoryLength\r
)\r
{\r
- EFI_PEI_HOB_POINTERS Hob;\r
+ EFI_PEI_HOB_POINTERS Hob;\r
VOID *NewHobList;\r
- EFI_HOB_HANDOFF_INFO_TABLE *PhitHob;\r
+ EFI_HOB_HANDOFF_INFO_TABLE *PhitHob;\r
UINT8 SizeOfMemorySpace;\r
UINT8 SizeOfIoSpace;\r
EFI_HOB_RESOURCE_DESCRIPTOR *ResourceHob;\r
UINTN Index;\r
UINT64 Capabilities;\r
EFI_HOB_CPU * CpuHob;\r
+\r
//\r
// Cache the PHIT HOB for later use\r
//\r
}\r
\r
if (GcdMemoryType != EfiGcdMemoryTypeNonExistent) {\r
-\r
//\r
// Convert the Resource HOB Attributes to an EFI Memory Capabilities mask\r
//\r
IN EFI_EVENT Event\r
);\r
\r
+/**\r
+ Connects a controller to a driver.\r
+\r
+ @param ControllerHandle Handle of the controller to be \r
+ connected. \r
+ @param ContextDriverImageHandles DriverImageHandle A pointer to an \r
+ ordered list of driver image \r
+ handles. \r
+ @param RemainingDevicePath RemainingDevicePath A pointer to \r
+ the device path that specifies a \r
+ child of the controller \r
+ specified by ControllerHandle. \r
+\r
+ @retval EFI_SUCCESS One or more drivers were \r
+ connected to ControllerHandle. \r
+ @retval EFI_OUT_OF_RESOURCES No enough system resources to \r
+ complete the request. \r
+ @retval EFI_NOT_FOUND No drivers were connected to \r
+ ControllerHandle.\r
+\r
+**/\r
+EFI_STATUS \r
+CoreConnectSingleController (\r
+ IN EFI_HANDLE ControllerHandle,\r
+ IN EFI_HANDLE *ContextDriverImageHandles OPTIONAL,\r
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL \r
+ );\r
\r
/**\r
Attempts to disconnect all drivers that are using the protocol interface being queried.\r
\r
#include <DxeMain.h>\r
\r
-//\r
-// Driver Support Function Prototypes\r
-// \r
-/**\r
- Connects a controller to a driver.\r
-\r
- @param ControllerHandle Handle of the controller to be \r
- connected. \r
- @param ContextDriverImageHandles DriverImageHandle A pointer to an \r
- ordered list of driver image \r
- handles. \r
- @param RemainingDevicePath RemainingDevicePath A pointer to \r
- the device path that specifies a \r
- child of the controller \r
- specified by ControllerHandle. \r
-\r
- @retval EFI_SUCCESS One or more drivers were \r
- connected to ControllerHandle. \r
- @retval EFI_OUT_OF_RESOURCES No enough system resources to \r
- complete the request. \r
- @retval EFI_NOT_FOUND No drivers were connected to \r
- ControllerHandle.\r
-\r
-**/\r
-EFI_STATUS \r
-CoreConnectSingleController (\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_HANDLE *ContextDriverImageHandles OPTIONAL,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL \r
- );\r
\r
//\r
// Driver Support Functions\r
//\r
-\r
/**\r
Connects one or more drivers to a controller.\r
\r
//\r
do {\r
ReturnStatus = CoreConnectSingleController (\r
- ControllerHandle,\r
- DriverImageHandle,\r
- AlignedRemainingDevicePath\r
- );\r
+ ControllerHandle,\r
+ DriverImageHandle,\r
+ AlignedRemainingDevicePath\r
+ );\r
} while (ReturnStatus == EFI_NOT_READY);\r
\r
//\r
Status = CoreHandleProtocol (\r
DriverBindingHandleBuffer[Index],\r
&gEfiDriverBindingProtocolGuid,\r
- (VOID **)&DriverBinding\r
+ (VOID **) &DriverBinding\r
);\r
if (EFI_ERROR (Status) || DriverBinding == NULL) {\r
continue;\r
Status = CoreHandleProtocol(\r
DriverBindingHandle,\r
&gEfiDriverBindingProtocolGuid,\r
- (VOID **)&DriverBinding\r
+ (VOID **) &DriverBinding\r
);\r
//\r
// If DriverBindingHandle does not support the Driver Binding Protocol then return\r
Status = CoreLocateProtocol (\r
&gEfiPlatformDriverOverrideProtocolGuid, \r
NULL, \r
- (VOID **)&PlatformDriverOverride\r
+ (VOID **) &PlatformDriverOverride\r
);\r
if (!EFI_ERROR (Status) && (PlatformDriverOverride != NULL)) {\r
DriverImageHandle = NULL;\r
Status = CoreHandleProtocol (\r
ControllerHandle, \r
&gEfiBusSpecificDriverOverrideProtocolGuid, \r
- (VOID **)&BusSpecificDriverOverride\r
+ (VOID **) &BusSpecificDriverOverride\r
);\r
if (!EFI_ERROR (Status) && (BusSpecificDriverOverride != NULL)) {\r
DriverImageHandle = NULL;\r
// gProtocolDatabaseLock - Lock to protect the mProtocolDatabase\r
// gHandleDatabaseKey - The Key to show that the handle has been created/modified\r
//\r
-STATIC LIST_ENTRY mProtocolDatabase = INITIALIZE_LIST_HEAD_VARIABLE (mProtocolDatabase);\r
+LIST_ENTRY mProtocolDatabase = INITIALIZE_LIST_HEAD_VARIABLE (mProtocolDatabase);\r
LIST_ENTRY gHandleList = INITIALIZE_LIST_HEAD_VARIABLE (gHandleList);\r
EFI_LOCK gProtocolDatabaseLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_NOTIFY);\r
UINT64 gHandleDatabaseKey = 0;\r
// Initialize new protocol entry structure\r
//\r
ProtEntry->Signature = PROTOCOL_ENTRY_SIGNATURE;\r
- CopyMem ((VOID *)&ProtEntry->ProtocolID, Protocol, sizeof (EFI_GUID));\r
+ CopyGuid ((VOID *)&ProtEntry->ProtocolID, Protocol);\r
InitializeListHead (&ProtEntry->Protocols);\r
InitializeListHead (&ProtEntry->Notify);\r
\r
}\r
\r
GetNext = NULL;\r
+\r
//\r
// Set initial position\r
//\r
-\r
Position.Protocol = Protocol;\r
Position.SearchKey = SearchKey;\r
Position.Position = &gHandleList;\r
//\r
// Lock the protocol database\r
//\r
- \r
CoreAcquireProtocolLock ();\r
\r
//\r
@param Interface Return the interface structure for the matching \r
protocol. \r
\r
- @retval IHANDLE An IHANDLE is returned if the next Position is \r
- not the end of the list. A NULL_HANDLE is \r
- returned if it's the end of the list.\r
+ @return An pointer to IHANDLE if the next Position is not the end of the list.\r
+ Otherwise,NULL_HANDLE is returned.\r
\r
**/\r
IHANDLE *\r
@param Interface Return the interface structure for the matching \r
protocol. \r
\r
- @retval IHANDLE An IHANDLE is returned if the next Position is \r
- not the end of the list. A NULL_HANDLE is \r
- returned if it's the end of the list.\r
+ @return An pointer to IHANDLE if the next Position is not the end of the list.\r
+ Otherwise,NULL_HANDLE is returned.\r
\r
**/\r
IHANDLE *\r
}\r
\r
\r
-\r
/**\r
Routine to get the next Handle, when you are searching for a given protocol.\r
\r
@param Interface Return the interface structure for the matching \r
protocol. \r
\r
- @retval IHANDLE An IHANDLE is returned if the next Position is \r
- not the end of the list. A NULL_HANDLE is \r
- returned if it's the end of the list.\r
+ @return An pointer to IHANDLE if the next Position is not the end of the list.\r
+ Otherwise,NULL_HANDLE is returned.\r
\r
**/\r
IHANDLE *\r
}\r
\r
\r
-\r
-\r
/**\r
Locates the handle to a device on the device path that best matches the specified protocol.\r
\r
}\r
\r
\r
- \r
-\r
-/**\r
+ /**\r
Return the first Protocol Interface that matches the Protocol GUID. If\r
Registration is pasased in return a Protocol Instance that was just add\r
to the system. If Retistration is NULL return the first Protocol Interface\r
\r
mEfiLocateHandleRequest += 1;\r
\r
- if (NULL == Registration) {\r
+ if (Registration == NULL) {\r
//\r
// Look up the protocol entry and set the head pointer\r
//\r
Handle = CoreGetNextLocateByRegisterNotify (&Position, Interface); \r
}\r
\r
- if (NULL == Handle) {\r
+ if (Handle == NULL) {\r
Status = EFI_NOT_FOUND;\r
- } else if (NULL != Registration) {\r
+ } else if (Registration != NULL) {\r
//\r
// If this is a search by register notify and a handle was\r
// returned, update the register notification position\r
}\r
\r
\r
- \r
-\r
/**\r
Function returns an array of handles that support the requested protocol\r
in a buffer allocated from pool. This is a version of CoreLocateHandle()\r
@retval EFI_NOT_FOUND No handles match the search. \r
@retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the \r
matching results. \r
- @retval EFI_INVALID_PARAMETER Invalid parameter\r
+ @retval EFI_INVALID_PARAMETER One or more paramters are not valid.\r
\r
**/\r
EFI_STATUS\r
*Buffer\r
);\r
\r
- *NumberHandles = BufferSize/sizeof(EFI_HANDLE);\r
+ *NumberHandles = BufferSize / sizeof(EFI_HANDLE);\r
if (EFI_ERROR(Status)) {\r
*NumberHandles = 0;\r
}\r
//\r
// If there's a protocol notify location pointing to this entry, back it up one\r
//\r
-\r
for(Link = ProtEntry->Notify.ForwardLink; Link != &ProtEntry->Notify; Link=Link->ForwardLink) {\r
ProtNotify = CR(Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE);\r
\r
//\r
// Remove the protocol interface entry\r
//\r
-\r
RemoveEntryList (&Prot->ByProtocol);\r
}\r
\r
}\r
\r
\r
-\r
-\r
/**\r
Add a new protocol notification record for the request protocol.\r
\r
CoreRegisterProtocolNotify (\r
IN EFI_GUID *Protocol,\r
IN EFI_EVENT Event,\r
- OUT VOID **Registration\r
+ OUT VOID **Registration\r
)\r
{\r
- PROTOCOL_ENTRY *ProtEntry;\r
- PROTOCOL_NOTIFY *ProtNotify;\r
+ PROTOCOL_ENTRY *ProtEntry;\r
+ PROTOCOL_NOTIFY *ProtNotify;\r
EFI_STATUS Status;\r
\r
if ((Protocol == NULL) || (Event == NULL) || (Registration == NULL)) {\r
//\r
// Allocate a new notification record\r
//\r
-\r
ProtNotify = CoreAllocateBootServicesPool (sizeof(PROTOCOL_NOTIFY));\r
-\r
if (ProtNotify != NULL) {\r
\r
ProtNotify->Signature = PROTOCOL_NOTIFY_SIGNATURE;\r
}\r
\r
\r
-\r
-\r
/**\r
Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface.\r
\r
//\r
CoreReleaseProtocolLock ();\r
Status = CoreConnectController (\r
- UserHandle, \r
- NULL, \r
- NULL, \r
- TRUE\r
- );\r
+ UserHandle, \r
+ NULL, \r
+ NULL, \r
+ TRUE\r
+ );\r
CoreAcquireProtocolLock ();\r
\r
//\r
Status = Image->Ebc->CreateThunk (\r
Image->Ebc,\r
Image->Handle,\r
- (VOID *)(UINTN)Image->ImageContext.EntryPoint,\r
- (VOID **)&Image->EntryPoint\r
+ (VOID *)(UINTN) Image->ImageContext.EntryPoint,\r
+ (VOID **) &Image->EntryPoint\r
);\r
if (EFI_ERROR(Status)) {\r
goto Done;\r
UINTN StartIndex;\r
CHAR8 EfiFileName[256];\r
\r
- if (Image->ImageContext.Machine != IMAGE_FILE_MACHINE_IA64) {\r
- DEBUG ((DEBUG_INFO | DEBUG_LOAD,\r
- "Loading driver at 0x%10p EntryPoint=0x%10p ",\r
- (VOID *)(UINTN)Image->ImageContext.ImageAddress,\r
- (VOID *)(UINTN)Image->ImageContext.EntryPoint));\r
- } else {\r
- //\r
- // For IPF Image, the real entry point should be print.\r
- //\r
- DEBUG ((DEBUG_INFO | DEBUG_LOAD,\r
- "Loading driver at 0x%10p EntryPoint=0x%10p ",\r
- (VOID *)(UINTN)Image->ImageContext.ImageAddress,\r
- (VOID *)(UINTN)(*(UINT64 *)(UINTN)Image->ImageContext.EntryPoint)));\r
- }\r
+ \r
+ DEBUG ((DEBUG_INFO | DEBUG_LOAD,\r
+ "Loading driver at 0x%10p EntryPoint=0x%10p ",\r
+ (VOID *)(UINTN) Image->ImageContext.ImageAddress,\r
+ FUNCTION_ENTRY_POINT ((UINTN) Image->ImageContext.EntryPoint)));\r
+ \r
\r
//\r
// Print Module Name by Pdb file path\r
if (!EFI_ERROR (Status)) {\r
Image = LOADED_IMAGE_PRIVATE_DATA_FROM_THIS (LoadedImage);\r
} else {\r
- DEBUG ((DEBUG_LOAD, "CoreLoadedImageInfo: Not an ImageHandle %x\n", ImageHandle));\r
+ DEBUG ((DEBUG_LOAD, "CoreLoadedImageInfo: Not an ImageHandle %p\n", ImageHandle));\r
Image = NULL;\r
}\r
\r
Status = CoreHandleProtocol (DeviceHandle, &gEfiDevicePathProtocolGuid, (VOID **)&HandleFilePath);\r
if (!EFI_ERROR (Status)) {\r
FilePathSize = CoreDevicePathSize (HandleFilePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL);\r
- FilePath = (EFI_DEVICE_PATH_PROTOCOL *) ( ((UINT8 *)FilePath) + FilePathSize );\r
+ FilePath = (EFI_DEVICE_PATH_PROTOCOL *) (((UINT8 *)FilePath) + FilePathSize );\r
}\r
\r
//\r
DEBUG_CODE_BEGIN ();\r
if (Image->ExitDataSize != 0 || Image->ExitData != NULL) {\r
\r
- DEBUG (\r
- (DEBUG_LOAD,\r
- "StartImage: ExitDataSize %d, ExitData %x",\r
- Image->ExitDataSize,\r
- Image->ExitData)\r
- );\r
+ DEBUG ((DEBUG_LOAD, "StartImage: ExitDataSize %d, ExitData %x", Image->ExitDataSize, Image->ExitData));\r
if (Image->ExitData != NULL) {\r
DEBUG ((DEBUG_LOAD, " (%hs)", Image->ExitData));\r
}\r
if (SourceBuffer != NULL) {\r
ImageFileHandle->Source = SourceBuffer;\r
ImageFileHandle->SourceSize = SourceSize;\r
- *DeviceHandle = NULL;\r
+ *DeviceHandle = NULL;\r
CoreLocateDevicePath (&gEfiDevicePathProtocolGuid, FilePath, DeviceHandle);\r
if (SourceSize > 0) {\r
Status = EFI_SUCCESS;\r
//\r
// Read the file into the buffer we allocated\r
//\r
- ImageFileHandle->SourceSize = (UINTN)FileInfo->FileSize;\r
+ ImageFileHandle->SourceSize = (UINTN) FileInfo->FileSize;\r
ImageFileHandle->FreeBuffer = TRUE;\r
Status = FileHandle->Read (FileHandle, &ImageFileHandle->SourceSize, ImageFileHandle->Source);\r
\r
\r
TempFilePath = *FilePath;\r
Status = CoreDevicePathToInterface (\r
- &gEfiLoadFileProtocolGuid,\r
- &TempFilePath,\r
- (VOID*)&LoadFile,\r
- DeviceHandle\r
- );\r
+ &gEfiLoadFileProtocolGuid,\r
+ &TempFilePath,\r
+ (VOID*) &LoadFile,\r
+ DeviceHandle\r
+ );\r
if (!EFI_ERROR (Status)) {\r
//\r
// Call LoadFile with the correct buffer size\r
\r
\r
\r
-\r
/**\r
Read image file (specified by UserHandle) into user specified buffer with specified offset\r
and length.\r
//\r
// If the status code is "buffer too small", resize the buffer\r
//\r
-\r
if (*Status == EFI_BUFFER_TOO_SMALL) {\r
if (*Buffer != NULL) {\r
CoreFreePool (*Buffer);\r
VOID *Memory;\r
\r
Memory = CoreAllocateBootServicesPool (AllocationSize);\r
- SetMem (Memory, (Memory == NULL) ? 0 : AllocationSize, 0);\r
+ ZeroMem (Memory, (Memory == NULL) ? 0 : AllocationSize);\r
return Memory;\r
}\r
\r
//\r
// Compute the size and add back in the size of the end device path structure\r
//\r
- return ((UINTN)DevicePath - (UINTN)Start) + sizeof(EFI_DEVICE_PATH_PROTOCOL);\r
+ return ((UINTN) DevicePath - (UINTN) Start) + sizeof(EFI_DEVICE_PATH_PROTOCOL);\r
}\r
\r
\r
}\r
\r
\r
-\r
-\r
/**\r
Function is used to append a Src1 and Src2 together.\r
\r
}\r
\r
\r
-\r
-\r
/**\r
Create a protocol notification event and return it.\r
\r
//\r
// Create the event\r
//\r
-\r
Status = CoreCreateEvent (\r
EVT_NOTIFY_SIGNAL,\r
NotifyTpl,\r
NotifyFunction,\r
NotifyContext,\r
- &Event\r
+ &Event\r
);\r
ASSERT_EFI_ERROR (Status);\r
\r
//\r
// Register for protocol notifactions on this event\r
//\r
-\r
Status = CoreRegisterProtocolNotify (\r
- ProtocolGuid,\r
- Event,\r
- Registration\r
- );\r
+ ProtocolGuid,\r
+ Event,\r
+ Registration\r
+ );\r
ASSERT_EFI_ERROR (Status);\r
\r
if (SignalFlag) {\r
//\r
// This list maintain the free memory map list\r
//\r
-LIST_ENTRY mFreeMemoryMapEntryList = INITIALIZE_LIST_HEAD_VARIABLE (mFreeMemoryMapEntryList);\r
-BOOLEAN mMemoryTypeInformationInitialized = FALSE;\r
+LIST_ENTRY mFreeMemoryMapEntryList = INITIALIZE_LIST_HEAD_VARIABLE (mFreeMemoryMapEntryList);\r
+BOOLEAN mMemoryTypeInformationInitialized = FALSE;\r
\r
EFI_MEMORY_TYPE_STAISTICS mMemoryTypeStatistics[EfiMaxMemoryType + 1] = {\r
{ 0, EFI_MAX_ADDRESS, 0, 0, EfiMaxMemoryType, TRUE, FALSE }, // EfiReservedMemoryType\r
byte of a page \r
@param Attribute The attributes of the memory range to add \r
\r
- @return None. The range is added to the memory map\r
-\r
**/\r
VOID\r
CoreAddRange (\r
**/\r
VOID\r
RemoveMemoryMapEntry (\r
- MEMORY_MAP *Entry\r
+ IN OUT MEMORY_MAP *Entry\r
)\r
{\r
RemoveEntryList (&Entry->Link);\r
}\r
\r
\r
-\r
-\r
-\r
/**\r
Frees previous allocated pages.\r
\r
}\r
\r
\r
-\r
-\r
/**\r
This function returns a copy of the current memory map. The map is an array of\r
memory descriptors, each of which describes a contiguous block of memory.\r
if (mMemoryTypeStatistics[Type].Special &&\r
mMemoryTypeStatistics[Type].NumberOfPages > 0 &&\r
Entry->Start >= mMemoryTypeStatistics[Type].BaseAddress &&\r
- Entry->End <= mMemoryTypeStatistics[Type].MaximumAddress ) {\r
+ Entry->End <= mMemoryTypeStatistics[Type].MaximumAddress) {\r
MemoryMap->Type = Type;\r
}\r
}\r
CoreConvertPages (Start, NumberOfPages, PoolType);\r
}\r
\r
- return (VOID *)(UINTN)Start;\r
+ return (VOID *)(UINTN) Start;\r
}\r
\r
\r
LIST_ENTRY Link;\r
} POOL; \r
\r
-\r
-POOL PoolHead[EfiMaxMemoryType];\r
-LIST_ENTRY PoolHeadList;\r
-\r
//\r
+// Pool header for each memory type.\r
+//\r
+POOL mPoolHead[EfiMaxMemoryType];\r
+\r
//\r
+// List of pool header to search for the appropriate memory type.\r
//\r
+LIST_ENTRY mPoolHeadList;\r
\r
\r
/**\r
UINTN Index;\r
\r
for (Type=0; Type < EfiMaxMemoryType; Type++) {\r
- PoolHead[Type].Signature = 0;\r
- PoolHead[Type].Used = 0;\r
- PoolHead[Type].MemoryType = (EFI_MEMORY_TYPE) Type;\r
+ mPoolHead[Type].Signature = 0;\r
+ mPoolHead[Type].Used = 0;\r
+ mPoolHead[Type].MemoryType = (EFI_MEMORY_TYPE) Type;\r
for (Index=0; Index < MAX_POOL_LIST; Index++) {\r
- InitializeListHead (&PoolHead[Type].FreeList[Index]);\r
+ InitializeListHead (&mPoolHead[Type].FreeList[Index]);\r
}\r
}\r
- InitializeListHead (&PoolHeadList);\r
+ InitializeListHead (&mPoolHeadList);\r
}\r
\r
\r
UINTN Index;\r
\r
if (MemoryType >= 0 && MemoryType < EfiMaxMemoryType) {\r
- return &PoolHead[MemoryType];\r
+ return &mPoolHead[MemoryType];\r
}\r
\r
if (MemoryType < 0) {\r
\r
- for (Link = PoolHeadList.ForwardLink; Link != &PoolHeadList; Link = Link->ForwardLink) {\r
+ for (Link = mPoolHeadList.ForwardLink; Link != &mPoolHeadList; Link = Link->ForwardLink) {\r
Pool = CR(Link, POOL, Link, POOL_SIGNATURE);\r
if (Pool->MemoryType == MemoryType) {\r
return Pool;\r
InitializeListHead (&Pool->FreeList[Index]);\r
}\r
\r
- InsertHeadList (&PoolHeadList, &Pool->Link);\r
+ InsertHeadList (&mPoolHeadList, &Pool->Link);\r
\r
return Pool;\r
}\r
\r
\r
\r
-\r
/**\r
Allocate pool of a particular type.\r
\r
Buffer = Head->Data;\r
DEBUG_CLEAR_MEMORY (Buffer, Size - POOL_OVERHEAD);\r
\r
- DEBUG (\r
- (DEBUG_POOL,\r
- "AllocatePoolI: Type %x, Addr %x (len %x) %,d\n",\r
- PoolType, \r
- Buffer, \r
- Size - POOL_OVERHEAD, \r
- Pool->Used)\r
- );\r
+ DEBUG ((\r
+ DEBUG_POOL,\r
+ "AllocatePoolI: Type %x, Addr %x (len %x) %,d\n", PoolType, \r
+ Buffer, \r
+ Size - POOL_OVERHEAD, \r
+ Pool->Used\r
+ ));\r
\r
//\r
// Account the allocation\r
\r
\r
\r
-\r
/**\r
Frees pool.\r
\r
{\r
EFI_STATUS Status;\r
\r
- if (NULL == Buffer) {\r
+ if (Buffer == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
//\r
NewPage = (CHAR8 *)((UINTN)Free & ~((DEFAULT_PAGE_ALLOCATION) -1));\r
Free = (POOL_FREE *) &NewPage[0];\r
- ASSERT(NULL != Free);\r
+ ASSERT(Free != NULL);\r
\r
if (Free->Signature == POOL_FREE_SIGNATURE) {\r
\r
#include <DxeMain.h>\r
\r
\r
-STATIC EFI_DEBUG_IMAGE_INFO_TABLE_HEADER mDebugInfoTableHeader = {\r
+EFI_DEBUG_IMAGE_INFO_TABLE_HEADER mDebugInfoTableHeader = {\r
0, // volatile UINT32 UpdateStatus;\r
0, // UINT32 TableSize;\r
NULL // EFI_DEBUG_IMAGE_INFO *EfiDebugImageInfoTable;\r
};\r
\r
-STATIC EFI_SYSTEM_TABLE_POINTER *mDebugTable = NULL;\r
+EFI_SYSTEM_TABLE_POINTER *mDebugTable = NULL;\r
\r
\r
\r
//\r
// Fill in the new entry\r
//\r
- CopyMem ((VOID *)&EfiConfigurationTable[Index].VendorGuid, Guid, sizeof (EFI_GUID));\r
+ CopyGuid ((VOID *)&EfiConfigurationTable[Index].VendorGuid, Guid);\r
EfiConfigurationTable[Index].VendorTable = Table;\r
\r
//\r
//\r
// Local prototypes\r
//\r
-\r
/**\r
Worker function. Determine if the input stream:child matches the input type.\r
\r
IN EFI_GUID *SectionDefinitionGuid\r
);\r
\r
-#if 0\r
-/**\r
- RPN callback function. Removes a stale section stream and re-initializes it\r
- with an updated AuthenticationStatus.\r
-\r
- @param Event The event that fired \r
- @param RpnContext A pointer to the context that allows us to \r
- identify the relevent encapsulation...\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-NotifyGuidedExtraction (\r
- IN EFI_EVENT Event,\r
- IN VOID *RpnContext\r
- );\r
-#endif\r
-\r
-#if 0\r
-/**\r
- Worker function. Constructor for RPN event if needed to keep AuthenticationStatus\r
- cache correct when a missing GUIDED_SECTION_EXTRACTION_PROTOCOL appears...\r
-\r
- @param ParentStream Indicates the parent of the ecnapsulation \r
- section (child) \r
- @param ChildNode Indicates the child node that is the \r
- encapsulation section.\r
-\r
-**/\r
-VOID\r
-CreateGuidedExtractionRpnEvent (\r
- IN CORE_SECTION_STREAM_NODE *ParentStream,\r
- IN CORE_SECTION_CHILD_NODE *ChildNode\r
- );\r
-#endif\r
\r
/**\r
Worker function. Search stream database for requested stream handle.\r
OUT CORE_SECTION_STREAM_NODE **FoundStream\r
);\r
\r
+\r
/**\r
Worker function Recursively searches / builds section stream database\r
looking for requested section.\r
OUT UINT32 *AuthenticationStatus\r
);\r
\r
+\r
/**\r
Worker function. Constructor for new child nodes.\r
\r
OUT CORE_SECTION_CHILD_NODE **ChildNode\r
);\r
\r
+\r
/**\r
Worker function. Destructor for child nodes.\r
\r
FreeChildNode (\r
IN CORE_SECTION_CHILD_NODE *ChildNode\r
);\r
- \r
+\r
+\r
/**\r
Worker function. Constructor for section streams.\r
\r
IN UINT32 AuthenticationStatus, \r
OUT UINTN *SectionStreamHandle\r
);\r
- \r
+\r
+\r
/**\r
Check if a stream is valid.\r
\r
IN UINTN SectionStreamLength\r
);\r
\r
+\r
/**\r
The ExtractSection() function processes the input section and\r
allocates a buffer from the pool in which it returns the section\r
\r
@param This Indicates the\r
EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL instance.\r
-\r
@param InputSection Buffer containing the input GUIDed section\r
to be processed. OutputBuffer OutputBuffer\r
is allocated from boot services pool\r
is stored. If the function returns\r
anything other than EFI_SUCCESS, the value\r
of OutputSize is undefined.\r
-\r
@param AuthenticationStatus A pointer to a caller-allocated\r
UINT32 that indicates the\r
authentication status of the\r
OUT UINTN *OutputSize,\r
OUT UINT32 *AuthenticationStatus\r
); \r
+\r
//\r
// Module globals\r
//\r
}\r
\r
return OpenSectionStreamEx ( \r
- SectionStreamLength, \r
- SectionStream,\r
- TRUE,\r
- 0,\r
- SectionStreamHandle\r
- );\r
+ SectionStreamLength, \r
+ SectionStream,\r
+ TRUE,\r
+ 0,\r
+ SectionStreamHandle\r
+ );\r
}\r
\r
\r
// There's a requested section type, so go find it and return it...\r
//\r
Status = FindChildNode (\r
- StreamNode, \r
- *SectionType, \r
- &Instance, \r
- SectionDefinitionGuid,\r
- &ChildNode,\r
- &ChildStreamNode, \r
- &ExtractedAuthenticationStatus\r
- );\r
+ StreamNode, \r
+ *SectionType, \r
+ &Instance, \r
+ SectionDefinitionGuid,\r
+ &ChildNode,\r
+ &ChildStreamNode, \r
+ &ExtractedAuthenticationStatus\r
+ );\r
if (EFI_ERROR (Status)) {\r
goto GetSection_Done;\r
}\r
\r
GetSection_Done:\r
CoreRestoreTpl (OldTpl);\r
+ \r
return Status;\r
}\r
\r
}\r
\r
\r
-\r
/**\r
Worker function Recursively searches / builds section stream database\r
looking for requested section.\r
}\r
\r
if (IsListEmpty (&SourceStream->Children) && \r
- SourceStream->StreamLength >= sizeof (EFI_COMMON_SECTION_HEADER)) {\r
+ SourceStream->StreamLength >= sizeof (EFI_COMMON_SECTION_HEADER)) {\r
//\r
// This occurs when a section stream exists, but no child sections\r
// have been parsed out yet. Therefore, extract the first child and add it\r
// Round up to 4 byte boundary\r
//\r
NextChildOffset += 3;\r
- NextChildOffset &= ~(UINTN)3;\r
+ NextChildOffset &= ~(UINTN) 3;\r
if (NextChildOffset <= SourceStream->StreamLength - sizeof (EFI_COMMON_SECTION_HEADER)) {\r
//\r
// There's an unparsed child remaining in the stream, so create a new child node\r
}\r
\r
\r
-\r
/**\r
Worker function. Constructor for new child nodes.\r
\r
}\r
\r
\r
-#if 0\r
-/**\r
- Worker function. Constructor for RPN event if needed to keep AuthenticationStatus\r
- cache correct when a missing GUIDED_SECTION_EXTRACTION_PROTOCOL appears...\r
-\r
- @param ParentStream Indicates the parent of the ecnapsulation \r
- section (child) \r
- @param ChildNode Indicates the child node that is the \r
- encapsulation section.\r
-\r
-**/\r
-VOID\r
-CreateGuidedExtractionRpnEvent (\r
- IN CORE_SECTION_STREAM_NODE *ParentStream,\r
- IN CORE_SECTION_CHILD_NODE *ChildNode\r
- )\r
-{\r
- RPN_EVENT_CONTEXT *Context;\r
- \r
- //\r
- // Allocate new event structure and context\r
- //\r
- Context = CoreAllocateBootServicesPool (sizeof (RPN_EVENT_CONTEXT));\r
- ASSERT (Context != NULL);\r
- \r
- Context->ChildNode = ChildNode;\r
- Context->ParentStream = ParentStream;\r
- \r
- Context->Event = CoreCreateProtocolNotifyEvent (\r
- Context->ChildNode->EncapsulationGuid,\r
- TPL_NOTIFY,\r
- NotifyGuidedExtraction,\r
- Context,\r
- &Context->Registration,\r
- FALSE\r
- );\r
-}\r
-#endif\r
-\r
-\r
-#if 0\r
-/**\r
- RPN callback function. Removes a stale section stream and re-initializes it\r
- with an updated AuthenticationStatus.\r
-\r
- @param Event The event that fired \r
- @param RpnContext A pointer to the context that allows us to \r
- identify the relevent encapsulation...\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-NotifyGuidedExtraction (\r
- IN EFI_EVENT Event,\r
- IN VOID *RpnContext\r
- )\r
-{\r
- EFI_STATUS Status;\r
- EFI_GUID_DEFINED_SECTION *GuidedHeader;\r
- EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL *GuidedExtraction;\r
- VOID *NewStreamBuffer;\r
- UINTN NewStreamBufferSize;\r
- UINT32 AuthenticationStatus;\r
- RPN_EVENT_CONTEXT *Context;\r
- \r
- Context = RpnContext;\r
- \r
- Status = CloseSectionStream (Context->ChildNode->EncapsulatedStreamHandle);\r
- if (!EFI_ERROR (Status)) {\r
- //\r
- // The stream closed successfully, so re-open the stream with correct AuthenticationStatus\r
- //\r
- \r
- GuidedHeader = (EFI_GUID_DEFINED_SECTION *) \r
- (Context->ParentStream->StreamBuffer + Context->ChildNode->OffsetInStream);\r
- ASSERT (GuidedHeader->CommonHeader.Type == EFI_SECTION_GUID_DEFINED);\r
- \r
- Status = CoreLocateProtocol (Context->ChildNode->EncapsulationGuid, NULL, (VOID **)&GuidedExtraction);\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- \r
- Status = GuidedExtraction->ExtractSection (\r
- GuidedExtraction,\r
- GuidedHeader,\r
- &NewStreamBuffer,\r
- &NewStreamBufferSize,\r
- &AuthenticationStatus\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
- //\r
- // OR in the parent stream's aggregagate status.\r
- //\r
- AuthenticationStatus |= Context->ParentStream->AuthenticationStatus & EFI_AUTH_STATUS_ALL;\r
- Status = OpenSectionStreamEx (\r
- NewStreamBufferSize,\r
- NewStreamBuffer,\r
- FALSE,\r
- AuthenticationStatus,\r
- &Context->ChildNode->EncapsulatedStreamHandle\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
- }\r
-\r
- //\r
- // If above, the stream did not close successfully, it indicates it's\r
- // alread been closed by someone, so just destroy the event and be done with\r
- // it.\r
- //\r
- \r
- CoreCloseEvent (Event);\r
- CoreFreePool (Context);\r
-} \r
-#endif\r
-\r
/**\r
Worker function. Destructor for child nodes.\r
\r
}\r
\r
\r
-\r
/**\r
Check if a stream is valid.\r
\r
return FALSE;\r
}\r
\r
+\r
/**\r
The ExtractSection() function processes the input section and\r
allocates a buffer from the pool in which it returns the section\r
\r
@param This Indicates the\r
EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL instance.\r
-\r
@param InputSection Buffer containing the input GUIDed section\r
to be processed. OutputBuffer OutputBuffer\r
is allocated from boot services pool\r
OutputBuffer,\r
ScratchBuffer,\r
AuthenticationStatus\r
- );\r
+ );\r
if (EFI_ERROR (Status)) {\r
//\r
// Decode failed\r