diff options
25 files changed, 327 insertions, 567 deletions
diff --git a/MdeModulePkg/Core/Dxe/Dispatcher/Dependency.c b/MdeModulePkg/Core/Dxe/Dispatcher/Dependency.c index a3c974b9d9..a77dc31073 100644 --- a/MdeModulePkg/Core/Dxe/Dispatcher/Dependency.c +++ b/MdeModulePkg/Core/Dxe/Dispatcher/Dependency.c @@ -1,5 +1,5 @@ /** @file
- DXE Dispatcher Dependency Evaluator
+ DXE Dispatcher Dependency Evaluator.
This routine evaluates a dependency expression (DEPENDENCY_EXPRESSION) to determine
if a driver can be scheduled for execution. The criteria for
@@ -34,8 +34,7 @@ BOOLEAN *mDepexEvaluationStackPointer = NULL; Grow size of the Depex stack
@retval EFI_SUCCESS Stack successfully growed.
- @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the
- stack.
+ @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.
**/
EFI_STATUS
@@ -85,13 +84,12 @@ GrowDepexStack ( /**
- Push an element onto the Boolean Stack
+ Push an element onto the Boolean Stack.
@param Value BOOLEAN to push.
@retval EFI_SUCCESS The value was pushed onto the stack.
- @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the
- stack.
+ @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.
**/
EFI_STATUS
@@ -131,7 +129,7 @@ PushBool ( @param Value BOOLEAN to pop.
@retval EFI_SUCCESS The value was popped onto the stack.
- @retval EFI_ACCESS_DENIED The pop operation underflowed the stack
+ @retval EFI_ACCESS_DENIED The pop operation underflowed the stack.
**/
EFI_STATUS
@@ -163,7 +161,7 @@ PopBool ( it will be cleared by CoreSchedule(), and then the driver can be
dispatched.
- @param DriverEntry DriverEntry element to update
+ @param DriverEntry DriverEntry element to update .
@retval EFI_SUCCESS It always works.
@@ -203,7 +201,7 @@ CorePreProcessDepex ( routine in this case. The SOR is just ignored and is a nop in the grammer.
POSTFIX means all the math is done on top of the stack.
- @param DriverEntry DriverEntry element to update
+ @param DriverEntry DriverEntry element to update.
@retval TRUE If driver is ready to run.
@retval FALSE If driver is not ready to run or some fatal error
@@ -243,7 +241,7 @@ CoreIsSchedulable ( //
// Clean out memory leaks in Depex Boolean stack. Leaks are only caused by
- // incorrectly formed DEPEX expressions
+ // incorrectly formed DEPEX expressions
//
mDepexEvaluationStackPointer = mDepexEvaluationStack;
diff --git a/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c b/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c index c97d1b85da..27f18326e0 100644 --- a/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c +++ b/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c @@ -76,7 +76,7 @@ VOID *mFwVolEventRegistration; //
// List of file types supported by dispatcher
//
-STATIC EFI_FV_FILETYPE mDxeFileTypes[] = {
+EFI_FV_FILETYPE mDxeFileTypes[] = {
EFI_FV_FILETYPE_DRIVER,
EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER,
EFI_FV_FILETYPE_DXE_CORE,
@@ -135,7 +135,7 @@ CoreFwVolEventProtocolNotify ( );
/**
- Convert FvHandle and DriverName into an EFI device path
+ Convert FvHandle and DriverName into an EFI device path.
@param Fv Fv protocol, needed to read Depex info out of
FLASH.
@@ -341,7 +341,7 @@ CoreSchedule ( /**
- Convert a driver from the Untrused back to the Scheduled state
+ Convert a driver from the Untrused back to the Scheduled state.
@param FirmwareVolumeHandle The handle of the Firmware Volume that contains
the firmware file specified by DriverName.
@@ -602,8 +602,7 @@ CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter ( @param FvHandle The handle of a FV that's being tested
@retval TRUE Fv protocol on FvHandle has been processed
- @retval FALSE Fv protocol on FvHandle has not yet been
- processed
+ @retval FALSE Fv protocol on FvHandle has not yet been processed
**/
BOOLEAN
@@ -700,7 +699,6 @@ CoreFvToDevicePath ( -
/**
Add an entry to the mDiscoveredList. Allocate memory to store the DriverEntry,
and initilize any state variables. Read the Depex from the FV and store it
@@ -739,7 +737,7 @@ CoreAddToDriverList ( ASSERT (DriverEntry != NULL);
DriverEntry->Signature = EFI_CORE_DRIVER_ENTRY_SIGNATURE;
- CopyMem (&DriverEntry->FileName, DriverName, sizeof (EFI_GUID));
+ CopyGuid (&DriverEntry->FileName, DriverName);
DriverEntry->FvHandle = FvHandle;
DriverEntry->Fv = Fv;
DriverEntry->FvFileDevicePath = CoreFvToDevicePath (Fv, FvHandle, DriverName);
@@ -821,21 +819,21 @@ CoreProcessFvImageFile ( //
// Read the first (and only the first) firmware volume section
//
- SectionType = EFI_SECTION_FIRMWARE_VOLUME_IMAGE;
- FvHeader = NULL;
- FvAlignment = 0;
- Buffer = NULL;
- BufferSize = 0;
+ SectionType = EFI_SECTION_FIRMWARE_VOLUME_IMAGE;
+ FvHeader = NULL;
+ FvAlignment = 0;
+ Buffer = NULL;
+ BufferSize = 0;
AlignedBuffer = NULL;
Status = Fv->ReadSection (
- Fv,
- DriverName,
- SectionType,
- 0,
- &Buffer,
- &BufferSize,
- &AuthenticationStatus
- );
+ Fv,
+ DriverName,
+ SectionType,
+ 0,
+ &Buffer,
+ &BufferSize,
+ &AuthenticationStatus
+ );
if (!EFI_ERROR (Status)) {
//
// FvImage should be at its required alignment.
@@ -848,6 +846,9 @@ CoreProcessFvImageFile ( if (FvAlignment < 8) {
FvAlignment = 8;
}
+ //
+ // Allocate the aligned buffer for the FvImage.
+ //
AlignedBuffer = AllocateAlignedPages (EFI_SIZE_TO_PAGES (BufferSize), (UINTN) FvAlignment);
if (AlignedBuffer == NULL) {
Status = EFI_OUT_OF_RESOURCES;
@@ -935,12 +936,12 @@ CoreFwVolEventProtocolNotify ( while (TRUE) {
BufferSize = sizeof (EFI_HANDLE);
Status = CoreLocateHandle (
- ByRegisterNotify,
- NULL,
- mFwVolEventRegistration,
- &BufferSize,
- &FvHandle
- );
+ ByRegisterNotify,
+ NULL,
+ mFwVolEventRegistration,
+ &BufferSize,
+ &FvHandle
+ );
if (EFI_ERROR (Status)) {
//
// If no more notification events exit
@@ -969,7 +970,6 @@ CoreFwVolEventProtocolNotify ( //
FvIsBeingProcesssed (FvHandle);
-
Status = CoreHandleProtocol (FvHandle, &gEfiFirmwareVolume2ProtocolGuid, (VOID **)&Fv);
if (EFI_ERROR (Status)) {
//
@@ -1012,7 +1012,7 @@ CoreFwVolEventProtocolNotify ( // EFI_FV_FILETYPE_DXE_CORE is processed to produce a Loaded Image protocol for the core
// EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE is processed to create a Fvb
//
- for (Index = 0; Index < sizeof (mDxeFileTypes)/sizeof (EFI_FV_FILETYPE); Index++) {
+ for (Index = 0; Index < sizeof (mDxeFileTypes) / sizeof (EFI_FV_FILETYPE); Index++) {
//
// Initialize the search key
//
@@ -1125,7 +1125,7 @@ CoreFwVolEventProtocolNotify ( /**
Initialize the dispatcher. Initialize the notification function that runs when
- a FV protocol is added to the system.
+ an FV2 protocol is added to the system.
**/
VOID
diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c index 3513179b47..5ca956e68a 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c +++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c @@ -29,6 +29,11 @@ EFI_TIMER_ARCH_PROTOCOL *gTimer = NULL; EFI_BDS_ARCH_PROTOCOL *gBds = NULL;
EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *gWatchdogTimer = NULL;
+//
+// DXE Core Global used to update core loaded image protocol handle
+//
+EFI_GUID *gDxeCoreFileName;
+EFI_LOADED_IMAGE_PROTOCOL *gDxeCoreLoadedImage;
//
// BugBug: I'n not runtime, but is the PPI?
@@ -39,15 +44,6 @@ EFI_STATUS_CODE_PROTOCOL gStatusCodeInstance = { EFI_STATUS_CODE_PROTOCOL *gStatusCode = &gStatusCodeInstance;
-
-//
-// DXE Core Global used to update core loaded image protocol handle
-//
-EFI_GUID *gDxeCoreFileName;
-EFI_LOADED_IMAGE_PROTOCOL *gDxeCoreLoadedImage;
-
-
-
//
// DXE Core Module Variables
//
@@ -215,7 +211,6 @@ EFI_SYSTEM_TABLE *gDxeCoreST = NULL; EFI_RUNTIME_SERVICES *gDxeCoreRT = &mEfiRuntimeServicesTableTemplate;
EFI_HANDLE gDxeCoreImageHandle = NULL;
-VOID *mHobStart;
//
// EFI Decompress Protocol
@@ -232,10 +227,9 @@ EFI_DECOMPRESS_PROTOCOL gEfiDecompress = { /**
Main entry point to DXE Core.
- @param HobStart Pointer to the beginning of the HOB List from
- PEI
+ @param HobStart Pointer to the beginning of the HOB List from PEI.
- @return This function should never return
+ @return This function should never return.
**/
VOID
@@ -248,8 +242,6 @@ DxeMain ( EFI_PHYSICAL_ADDRESS MemoryBaseAddress;
UINT64 MemoryLength;
- mHobStart = HobStart;
-
//
// Initialize Memory Services
//
@@ -287,10 +279,6 @@ DxeMain ( ASSERT_EFI_ERROR (Status);
//
- // The HobStart is relocated in gcd service init. Sync mHobStart varible.
- //
- mHobStart = HobStart;
-
// Install the DXE Services Table into the EFI System Tables's Configuration Table
//
Status = CoreInstallConfigurationTable (&gEfiDxeServicesTableGuid, gDxeCoreDS);
@@ -311,7 +299,7 @@ DxeMain ( //
// Initialize the ReportStatusCode with PEI version, if available
//
- CoreGetPeiProtocol (&gEfiStatusCodeRuntimeProtocolGuid, (VOID **)&gStatusCode->ReportStatusCode);
+ CoreGetPeiProtocol (&gEfiStatusCodeRuntimeProtocolGuid, (VOID **) &gStatusCode->ReportStatusCode);
//
// Report Status Code here for DXE_ENTRY_POINT once it is available
@@ -330,7 +318,7 @@ DxeMain ( gDxeCoreImageHandle
);
- DEBUG ((DEBUG_INFO | DEBUG_LOAD, "HOBLIST address in DXE = 0x%016lx\n", (UINT64) (UINTN) HobStart));
+ DEBUG ((DEBUG_INFO | DEBUG_LOAD, "HOBLIST address in DXE = 0x%p\n", HobStart));
//
// Initialize the Event Services
@@ -355,10 +343,10 @@ DxeMain ( // Publish the EFI, Tiano, and Custom Decompress protocols for use by other DXE components
//
Status = CoreInstallMultipleProtocolInterfaces (
- &mDecompressHandle,
- &gEfiDecompressProtocolGuid, &gEfiDecompress,
- NULL
- );
+ &mDecompressHandle,
+ &gEfiDecompressProtocolGuid, &gEfiDecompress,
+ NULL
+ );
ASSERT_EFI_ERROR (Status);
//
@@ -412,6 +400,7 @@ DxeMain ( // Report Status code before transfer control to BDS
//
CoreReportProgressCode (FixedPcdGet32 (PcdStatusCodeValueDxeCoreHandoffToBds));
+
//
// Display any drivers that were not dispatched because dependency expression
// evaluated to false if this is a debug build
@@ -619,7 +608,7 @@ CoreGetPeiProtocol ( EFI_HOB_GUID_TYPE *GuidHob;
VOID *Buffer;
- GuidHob = GetNextGuidHob (ProtocolGuid, mHobStart);
+ GuidHob = GetFirstGuidHob (ProtocolGuid);
if (GuidHob == NULL) {
return EFI_NOT_FOUND;
}
@@ -679,8 +668,8 @@ CoreExitBootServices ( IN UINTN MapKey
)
{
- EFI_STATUS Status;
- EFI_STATUS StatusTemp;
+ EFI_STATUS Status;
+ EFI_STATUS StatusTemp;
EFI_TCG_PLATFORM_PROTOCOL *TcgPlatformProtocol;
//
@@ -755,7 +744,7 @@ CoreExitBootServices ( //
// Zero out the Boot Service Table
//
- SetMem (gDxeCoreBS, sizeof (EFI_BOOT_SERVICES), 0);
+ ZeroMem (gDxeCoreBS, sizeof (EFI_BOOT_SERVICES));
gDxeCoreBS = NULL;
//
@@ -824,9 +813,7 @@ DxeMainUefiDecompressGetInfo ( OUT UINT32 *ScratchSize
)
{
- if (Source == NULL
- || DestinationSize == NULL
- || ScratchSize == NULL) {
+ if (Source == NULL || DestinationSize == NULL || ScratchSize == NULL) {
return EFI_INVALID_PARAMETER;
}
return UefiDecompressGetInfo (Source, SourceSize, DestinationSize, ScratchSize);
@@ -870,7 +857,7 @@ DxeMainUefiDecompressGetInfo ( EFI_STATUS
EFIAPI
DxeMainUefiDecompress (
- IN EFI_DECOMPRESS_PROTOCOL *This,
+ IN EFI_DECOMPRESS_PROTOCOL *This,
IN VOID *Source,
IN UINT32 SourceSize,
IN OUT VOID *Destination,
@@ -883,9 +870,7 @@ DxeMainUefiDecompress ( UINT32 TestDestinationSize;
UINT32 TestScratchSize;
- if (Source == NULL
- || Destination== NULL
- || Scratch == NULL) {
+ if (Source == NULL || Destination== NULL || Scratch == NULL) {
return EFI_INVALID_PARAMETER;
}
diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c b/MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c index e815df718d..1bad3a3f73 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c +++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c @@ -36,7 +36,7 @@ ARCHITECTURAL_PROTOCOL_ENTRY mArchProtocols[] = { { &gEfiRuntimeArchProtocolGuid, (VOID **)&gRuntime, NULL, NULL, FALSE },
{ &gEfiVariableArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE },
{ &gEfiVariableWriteArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE },
- { &gEfiCapsuleArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE},
+ { &gEfiCapsuleArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE },
{ &gEfiMonotonicCounterArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE },
{ &gEfiResetArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE },
{ &gEfiRealTimeClockArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE },
@@ -48,7 +48,6 @@ ARCHITECTURAL_PROTOCOL_ENTRY mArchProtocols[] = { /**
Return TRUE if all AP services are availible.
-
@retval EFI_SUCCESS All AP services are available
@retval EFI_NOT_FOUND At least one AP service is not available
@@ -170,7 +169,6 @@ GenericArchProtocolNotify ( -
/**
Creates an event that is fired everytime a Protocol of a specific type is installed.
@@ -218,7 +216,7 @@ typedef struct { CHAR16 *GuidString;
} GUID_TO_STRING_PROTOCOL_ENTRY;
-STATIC CONST GUID_TO_STRING_PROTOCOL_ENTRY MissingProtocols[] = {
+CONST GUID_TO_STRING_PROTOCOL_ENTRY MissingProtocols[] = {
{ &gEfiSecurityArchProtocolGuid, (CHAR16 *)L"Security" },
{ &gEfiCpuArchProtocolGuid, (CHAR16 *)L"CPU" },
{ &gEfiMetronomeArchProtocolGuid, (CHAR16 *)L"Metronome" },
@@ -231,7 +229,6 @@ STATIC CONST GUID_TO_STRING_PROTOCOL_ENTRY MissingProtocols[] = { { &gEfiCapsuleArchProtocolGuid, (CHAR16 *)L"Capsule" },
{ &gEfiMonotonicCounterArchProtocolGuid, (CHAR16 *)L"Monotonic Counter" },
{ &gEfiResetArchProtocolGuid, (CHAR16 *)L"Reset" },
-// { &gEfiStatusCodeRuntimeProtocolGuid, (CHAR16 *)L"Status Code" },
{ &gEfiRealTimeClockArchProtocolGuid, (CHAR16 *)L"Real Time Clock" }
};
@@ -246,7 +243,7 @@ CoreDisplayMissingArchProtocols ( VOID
)
{
- const GUID_TO_STRING_PROTOCOL_ENTRY *MissingEntry;
+ CONST GUID_TO_STRING_PROTOCOL_ENTRY *MissingEntry;
ARCHITECTURAL_PROTOCOL_ENTRY *Entry;
for (Entry = mArchProtocols; Entry->ProtocolGuid != NULL; Entry++) {
diff --git a/MdeModulePkg/Core/Dxe/Event/Event.c b/MdeModulePkg/Core/Dxe/Event/Event.c index 5e0b9c70ab..1f458a402a 100644 --- a/MdeModulePkg/Core/Dxe/Event/Event.c +++ b/MdeModulePkg/Core/Dxe/Event/Event.c @@ -92,7 +92,6 @@ CoreReleaseEventLock ( /**
Initializes "event" support and populates parts of the System and Runtime Table.
-
@retval EFI_SUCCESS Always return success
**/
@@ -385,7 +384,7 @@ CoreCreateEventEx ( return EFI_OUT_OF_RESOURCES;
}
- SetMem (IEvent, sizeof (IEVENT), 0);
+ ZeroMem (IEvent, sizeof (IEVENT));
IEvent->Signature = EVENT_SIGNATURE;
IEvent->Type = Type;
@@ -433,9 +432,9 @@ CoreCreateEventEx ( /**
- Signals the event. Queues the event to be notified if needed
+ Signals the event. Queues the event to be notified if needed.
- @param UserEvent The event to signal
+ @param UserEvent The event to signal .
@retval EFI_INVALID_PARAMETER Parameters are not valid.
@retval EFI_SUCCESS The event was signaled.
@@ -521,7 +520,7 @@ CoreCheckEvent ( return EFI_INVALID_PARAMETER;
}
- if (Event->Type & EVT_NOTIFY_SIGNAL) {
+ if ((Event->Type & EVT_NOTIFY_SIGNAL) != 0) {
return EFI_INVALID_PARAMETER;
}
@@ -532,7 +531,6 @@ CoreCheckEvent ( //
// Queue the wait notify function
//
-
CoreAcquireEventLock ();
if (!Event->SignalCount) {
CoreNotifyEvent (Event);
@@ -560,7 +558,6 @@ CoreCheckEvent ( -
/**
Stops execution until an event is signaled.
@@ -616,7 +613,6 @@ CoreWaitForEvent ( }
-
/**
Closes an event and frees the event structure.
@@ -648,7 +644,7 @@ CoreCloseEvent ( //
// If it's a timer event, make sure it's not pending
//
- if (Event->Type & EVT_TIMER) {
+ if ((Event->Type & EVT_TIMER) != 0) {
CoreSetTimer (Event, TimerCancel, 0);
}
diff --git a/MdeModulePkg/Core/Dxe/Event/Timer.c b/MdeModulePkg/Core/Dxe/Event/Timer.c index c163266617..924499e004 100644 --- a/MdeModulePkg/Core/Dxe/Event/Timer.c +++ b/MdeModulePkg/Core/Dxe/Event/Timer.c @@ -60,18 +60,16 @@ CoreInsertEventTimer ( // Internal data
//
-STATIC LIST_ENTRY mEfiTimerList = INITIALIZE_LIST_HEAD_VARIABLE (mEfiTimerList);
-STATIC EFI_LOCK mEfiTimerLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_HIGH_LEVEL - 1);
-STATIC EFI_EVENT mEfiCheckTimerEvent;
+LIST_ENTRY mEfiTimerList = INITIALIZE_LIST_HEAD_VARIABLE (mEfiTimerList);
+EFI_LOCK mEfiTimerLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_HIGH_LEVEL - 1);
+EFI_EVENT mEfiCheckTimerEvent = NULL;
-STATIC EFI_LOCK mEfiSystemTimeLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_HIGH_LEVEL);
-STATIC UINT64 mEfiSystemTime = 0;
+EFI_LOCK mEfiSystemTimeLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_HIGH_LEVEL);
+UINT64 mEfiSystemTime = 0;
//
// Timer functions
//
-
-
/**
Initializes timer support.
@@ -84,12 +82,12 @@ CoreInitializeTimer ( EFI_STATUS Status;
Status = CoreCreateEvent (
- EVT_NOTIFY_SIGNAL,
- TPL_HIGH_LEVEL - 1,
- CoreCheckTimers,
- NULL,
- &mEfiCheckTimerEvent
- );
+ EVT_NOTIFY_SIGNAL,
+ TPL_HIGH_LEVEL - 1,
+ CoreCheckTimers,
+ NULL,
+ &mEfiCheckTimerEvent
+ );
ASSERT_EFI_ERROR (Status);
}
@@ -110,6 +108,7 @@ CoreCurrentSystemTime ( CoreAcquireLock (&mEfiSystemTimeLock);
SystemTime = mEfiSystemTime;
CoreReleaseLock (&mEfiSystemTimeLock);
+
return SystemTime;
}
@@ -132,20 +131,17 @@ CoreTimerTick ( //
// Check runtiem flag in case there are ticks while exiting boot services
//
-
CoreAcquireLock (&mEfiSystemTimeLock);
//
// Update the system time
//
-
mEfiSystemTime += Duration;
//
// If the head of the list is expired, fire the timer event
// to process it
//
-
if (!IsListEmpty (&mEfiTimerList)) {
Event = CR (mEfiTimerList.ForwardLink, IEVENT, u.Timer.Link, EVENT_SIGNATURE);
@@ -179,7 +175,6 @@ CoreCheckTimers ( //
// Check the timer database for expired timers
//
-
CoreAcquireLock (&mEfiTimerLock);
SystemTime = CoreCurrentSystemTime ();
@@ -189,7 +184,6 @@ CoreCheckTimers ( //
// If this timer is not expired, then we're done
//
-
if (Event->u.Timer.TriggerTime > SystemTime) {
break;
}
@@ -210,11 +204,9 @@ CoreCheckTimers ( // If this is a periodic timer, set it
//
if (Event->u.Timer.Period) {
-
//
// Compute the timers new trigger time
//
-
Event->u.Timer.TriggerTime = Event->u.Timer.TriggerTime + Event->u.Timer.Period;
//
@@ -228,7 +220,6 @@ CoreCheckTimers ( //
// Add the timer
//
-
CoreInsertEventTimer (Event);
}
}
@@ -258,13 +249,11 @@ CoreInsertEventTimer ( //
// Get the timer's trigger time
//
-
TriggerTime = Event->u.Timer.TriggerTime;
//
// Insert the timer into the timer database in assending sorted order
//
-
for (Link = mEfiTimerList.ForwardLink; Link != &mEfiTimerList; Link = Link->ForwardLink) {
Event2 = CR (Link, IEVENT, u.Timer.Link, EVENT_SIGNATURE);
@@ -278,7 +267,6 @@ CoreInsertEventTimer ( -
/**
Sets the type of timer and the trigger time for a timer event.
@@ -323,7 +311,6 @@ CoreSetTimer ( //
// If the timer is queued to the timer database, remove it
//
-
if (Event->u.Timer.Link.ForwardLink != NULL) {
RemoveEntryList (&Event->u.Timer.Link);
Event->u.Timer.Link.ForwardLink = NULL;
@@ -347,5 +334,6 @@ CoreSetTimer ( }
CoreReleaseLock (&mEfiTimerLock);
+
return EFI_SUCCESS;
}
diff --git a/MdeModulePkg/Core/Dxe/Event/Tpl.c b/MdeModulePkg/Core/Dxe/Event/Tpl.c index 1fbf39ece3..4f63889709 100644 --- a/MdeModulePkg/Core/Dxe/Event/Tpl.c +++ b/MdeModulePkg/Core/Dxe/Event/Tpl.c @@ -1,5 +1,5 @@ /** @file
- Task priority (TPL) function
+ Task priority (TPL) functions.
Copyright (c) 2006 - 2008, Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials
@@ -52,14 +52,14 @@ CoreHighestSetBit ( IN UINTN Number
)
{
- UINTN msb;
+ UINTN Msb;
- msb = 31;
- while ((msb > 0) && ((Number & (UINTN)(1 << msb)) == 0)) {
- msb--;
+ Msb = 31;
+ while ((Msb > 0) && ((Number & (UINTN)(1 << Msb)) == 0)) {
+ Msb--;
}
- return msb;
+ return Msb;
}
diff --git a/MdeModulePkg/Core/Dxe/FwVol/Ffs.c b/MdeModulePkg/Core/Dxe/FwVol/Ffs.c index 7673352bba..00d07567f7 100644 --- a/MdeModulePkg/Core/Dxe/FwVol/Ffs.c +++ b/MdeModulePkg/Core/Dxe/FwVol/Ffs.c @@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include <DxeMain.h>
-#define PHYSICAL_ADDRESS_TO_POINTER(Address) ((VOID *)((UINTN)(Address)))
-
/**
Get the FFS file state by checking the highest bit set in the header's state field.
@@ -47,7 +45,7 @@ GetFileState ( HighestBit >>= 1;
}
- return (EFI_FFS_FILE_STATE)HighestBit;
+ return (EFI_FFS_FILE_STATE) HighestBit;
}
@@ -183,24 +181,23 @@ IsValidFfsHeader ( *FileState = GetFileState (ErasePolarity, FfsHeader);
switch (*FileState) {
- case EFI_FILE_HEADER_VALID:
- case EFI_FILE_DATA_VALID:
- case EFI_FILE_MARKED_FOR_UPDATE:
- case EFI_FILE_DELETED:
- //
- // Here we need to verify header checksum
- //
- return VerifyHeaderChecksum (FfsHeader);
-
- case EFI_FILE_HEADER_CONSTRUCTION:
- case EFI_FILE_HEADER_INVALID:
- default:
- return FALSE;
+ case EFI_FILE_HEADER_VALID:
+ case EFI_FILE_DATA_VALID:
+ case EFI_FILE_MARKED_FOR_UPDATE:
+ case EFI_FILE_DELETED:
+ //
+ // Here we need to verify header checksum
+ //
+ return VerifyHeaderChecksum (FfsHeader);
+
+ case EFI_FILE_HEADER_CONSTRUCTION:
+ case EFI_FILE_HEADER_INVALID:
+ default:
+ return FALSE;
}
}
-
/**
Check if it's a valid FFS file.
Here we are sure that it has a valid FFS file header since we must call IsValidFfsHeader() first.
@@ -223,17 +220,17 @@ IsValidFfsFile ( FileState = GetFileState (ErasePolarity, FfsHeader);
switch (FileState) {
- case EFI_FILE_DELETED:
- case EFI_FILE_DATA_VALID:
- case EFI_FILE_MARKED_FOR_UPDATE:
- //
- // Some other vliadation like file content checksum might be done here.
- // For performance issue, Tiano only do FileState check.
- //
- return TRUE;
+ case EFI_FILE_DELETED:
+ case EFI_FILE_DATA_VALID:
+ case EFI_FILE_MARKED_FOR_UPDATE:
+ //
+ // Some other vliadation like file content checksum might be done here.
+ // For performance issue, Tiano only do FileState check.
+ //
+ return TRUE;
- default:
- return FALSE;
+ default:
+ return FALSE;
}
}
diff --git a/MdeModulePkg/Core/Dxe/FwVol/FwVol.c b/MdeModulePkg/Core/Dxe/FwVol/FwVol.c index 6a4d7b05b2..f14cce05c7 100644 --- a/MdeModulePkg/Core/Dxe/FwVol/FwVol.c +++ b/MdeModulePkg/Core/Dxe/FwVol/FwVol.c @@ -52,8 +52,6 @@ FV_DEVICE mFvDevice = { //
// FFS helper functions
//
-
-
/**
given the supplied FW_VOL_BLOCK_PROTOCOL, allocate a buffer for output and
copy the volume header into it.
@@ -122,8 +120,6 @@ GetFwVolHeader ( @param FvDevice pointer to the FvDevice to be freed.
- @return None.
-
**/
VOID
FreeFvDeviceResource (
@@ -149,7 +145,7 @@ FreeFvDeviceResource ( CoreFreePool (FfsFileEntry);
- FfsFileEntry = (FFS_FILE_LIST_ENTRY *)NextEntry;
+ FfsFileEntry = (FFS_FILE_LIST_ENTRY *) NextEntry;
}
@@ -169,9 +165,9 @@ FreeFvDeviceResource ( /**
- Check if a FV is consistent and allocate cache
+ Check if an FV is consistent and allocate cache for it.
- @param FvDevice pointer to the FvDevice to be checked.
+ @param FvDevice A pointer to the FvDevice to be checked.
@retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated.
@retval EFI_SUCCESS FV is consistent and cache is allocated.
@@ -245,11 +241,11 @@ FvCheck ( Size -= LbaOffset;
}
Status = Fvb->Read (Fvb,
- LbaIndex,
- LbaOffset,
- &Size,
- CacheLocation
- );
+ LbaIndex,
+ LbaOffset,
+ &Size,
+ CacheLocation
+ );
//
// Not check EFI_BAD_BUFFER_SIZE, for Size = BlockMap->Length
//
@@ -288,11 +284,11 @@ FvCheck ( //
// Build FFS list
//
- FfsHeader = (EFI_FFS_FILE_HEADER *)FvDevice->CachedFv;
+ FfsHeader = (EFI_FFS_FILE_HEADER *) FvDevice->CachedFv;
TopFvAddress = FvDevice->EndOfCachedFv;
- while ((UINT8 *)FfsHeader < TopFvAddress) {
+ while ((UINT8 *) FfsHeader < TopFvAddress) {
- TestLength = TopFvAddress - ((UINT8 *)FfsHeader);
+ TestLength = TopFvAddress - ((UINT8 *) FfsHeader);
if (TestLength > sizeof (EFI_FFS_FILE_HEADER)) {
TestLength = sizeof (EFI_FFS_FILE_HEADER);
}
@@ -308,9 +304,7 @@ FvCheck ( if ((FileState == EFI_FILE_HEADER_INVALID) ||
(FileState == EFI_FILE_HEADER_CONSTRUCTION)) {
FfsHeader++;
-
continue;
-
} else {
//
// File system is corrputed
@@ -476,9 +470,9 @@ NotifyFwVolBlock ( return;
}
- FvDevice->Fvb = Fvb;
- FvDevice->Handle = Handle;
- FvDevice->FwVolHeader = FwVolHeader;
+ FvDevice->Fvb = Fvb;
+ FvDevice->Handle = Handle;
+ FvDevice->FwVolHeader = FwVolHeader;
FvDevice->Fv.ParentHandle = Fvb->ParentHandle;
//
diff --git a/MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c b/MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c index 81e3ad349e..7016ee5b90 100644 --- a/MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c +++ b/MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c @@ -200,7 +200,7 @@ FvGetNextFile ( // Return FileType, NameGuid, and Attributes
//
*FileType = FfsFileHeader->Type;
- CopyMem (NameGuid, &FfsFileHeader->Name, sizeof (EFI_GUID));
+ CopyGuid (NameGuid, &FfsFileHeader->Name);
*Attributes = FfsAttributes2FvFileAttributes (FfsFileHeader->Attributes);
//
@@ -280,7 +280,7 @@ FvReadFile ( EFI_FFS_FILE_HEADER *FfsHeader;
UINTN InputBufferSize;
- if (NULL == NameGuid) {
+ if (NameGuid == NULL) {
return EFI_INVALID_PARAMETER;
}
@@ -412,7 +412,7 @@ FvReadFileSection ( UINT8 *FileBuffer;
FFS_FILE_LIST_ENTRY *FfsEntry;
- if (NULL == NameGuid || Buffer == NULL) {
+ if (NameGuid == NULL || Buffer == NULL) {
return EFI_INVALID_PARAMETER;
}
@@ -434,7 +434,7 @@ FvReadFileSection ( //
// Get the last key used by our call to FvReadFile as it is the FfsEntry for this file.
//
- FfsEntry = (FFS_FILE_LIST_ENTRY *)FvDevice->LastKey;
+ FfsEntry = (FFS_FILE_LIST_ENTRY *) FvDevice->LastKey;
if (EFI_ERROR (Status)) {
return Status;
@@ -453,10 +453,10 @@ FvReadFileSection ( //
if (FfsEntry->StreamHandle == 0) {
Status = OpenSectionStream (
- FileSize,
- FileBuffer,
- &FfsEntry->StreamHandle
- );
+ FileSize,
+ FileBuffer,
+ &FfsEntry->StreamHandle
+ );
if (EFI_ERROR (Status)) {
goto Done;
}
diff --git a/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c b/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c index bc234aa0d0..d35292899b 100644 --- a/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c +++ b/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c @@ -1,9 +1,8 @@ /** @file
- Firmware Volume Block protocol. Consumes FV hobs and creates
- appropriate block protocols.
-
- Also consumes NT_NON_MM_FV envinronment variable and produces appropriate
- block protocols fro them also... (this is TBD)
+ Implementations for Firmware Volume Block protocol.
+
+ It consumes FV HOBs and creates read-lonly Firmare Volume Block protocol
+ instances for each of them.
Copyright (c) 2006 - 2008, Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials
@@ -27,16 +26,22 @@ EFI_FW_VOL_BLOCK_DEVICE mFwVolBlock = { {
HARDWARE_DEVICE_PATH,
HW_MEMMAP_DP,
- { (UINT8)(sizeof (MEMMAP_DEVICE_PATH)), (UINT8)(sizeof (MEMMAP_DEVICE_PATH) >> 8) }
+ {
+ (UINT8)(sizeof (MEMMAP_DEVICE_PATH)),
+ (UINT8)(sizeof (MEMMAP_DEVICE_PATH) >> 8)
+ }
},
EfiMemoryMappedIO,
- (EFI_PHYSICAL_ADDRESS)0,
- (EFI_PHYSICAL_ADDRESS)0,
+ (EFI_PHYSICAL_ADDRESS) 0,
+ (EFI_PHYSICAL_ADDRESS) 0,
},
{
END_DEVICE_PATH_TYPE,
END_ENTIRE_DEVICE_PATH_SUBTYPE,
- { END_DEVICE_PATH_LENGTH, 0 }
+ {
+ END_DEVICE_PATH_LENGTH,
+ 0
+ }
},
},
{
@@ -57,8 +62,6 @@ EFI_FW_VOL_BLOCK_DEVICE mFwVolBlock = { -
-
/**
Retrieves Volume attributes. No polarity translations are done.
@@ -195,7 +198,7 @@ FwVolBlockReadBlock ( return EFI_ACCESS_DENIED;
}
- LbaIndex = (UINTN)Lba;
+ LbaIndex = (UINTN) Lba;
if (LbaIndex >= FvbDevice->NumBlocks) {
//
// Invalid Lba, read nothing.
@@ -221,8 +224,8 @@ FwVolBlockReadBlock ( }
LbaStart = FvbDevice->LbaCache[LbaIndex].Base;
- FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)((UINTN)FvbDevice->BaseAddress);
- LbaOffset = (UINT8 *)FwVolHeader + LbaStart + Offset;
+ FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)((UINTN) FvbDevice->BaseAddress);
+ LbaOffset = (UINT8 *) FwVolHeader + LbaStart + Offset;
//
// Perform read operation
@@ -412,7 +415,7 @@ ProduceFVBProtocolOnBuffer ( EFI_FV_BLOCK_MAP_ENTRY *PtrBlockMapEntry;
FvAlignment = 0;
- FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)BaseAddress;
+ FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)(UINTN) BaseAddress;
//
// Validate FV Header, if not as expected, return
//
@@ -450,8 +453,8 @@ ProduceFVBProtocolOnBuffer ( //
FvbDev->NumBlocks = 0;
for (PtrBlockMapEntry = FwVolHeader->BlockMap;
- PtrBlockMapEntry->NumBlocks != 0;
- PtrBlockMapEntry++) {
+ PtrBlockMapEntry->NumBlocks != 0;
+ PtrBlockMapEntry++) {
FvbDev->NumBlocks += PtrBlockMapEntry->NumBlocks;
}
//
@@ -468,7 +471,7 @@ ProduceFVBProtocolOnBuffer ( BlockIndex = 0;
LinearOffset = 0;
for (PtrBlockMapEntry = FwVolHeader->BlockMap;
- PtrBlockMapEntry->NumBlocks != 0; PtrBlockMapEntry++) {
+ PtrBlockMapEntry->NumBlocks != 0; PtrBlockMapEntry++) {
for (BlockIndex2 = 0; BlockIndex2 < PtrBlockMapEntry->NumBlocks; BlockIndex2++) {
FvbDev->LbaCache[BlockIndex].Base = LinearOffset;
FvbDev->LbaCache[BlockIndex].Length = PtrBlockMapEntry->Length;
@@ -488,12 +491,12 @@ ProduceFVBProtocolOnBuffer ( // Attach FvVolBlock Protocol to new handle
//
Status = CoreInstallMultipleProtocolInterfaces (
- &FvbDev->Handle,
- &gEfiFirmwareVolumeBlockProtocolGuid, &FvbDev->FwVolBlockInstance,
- &gEfiDevicePathProtocolGuid, &FvbDev->DevicePath,
- &gEfiFirmwareVolumeDispatchProtocolGuid, NULL,
- NULL
- );
+ &FvbDev->Handle,
+ &gEfiFirmwareVolumeBlockProtocolGuid, &FvbDev->FwVolBlockInstance,
+ &gEfiDevicePathProtocolGuid, &FvbDev->DevicePath,
+ &gEfiFirmwareVolumeDispatchProtocolGuid, NULL,
+ NULL
+ );
//
// If they want the handle back, set it.
@@ -527,6 +530,7 @@ FwVolBlockDriverInit ( )
{
EFI_PEI_HOB_POINTERS FvHob;
+
//
// Core Needs Firmware Volumes to function
//
@@ -538,6 +542,7 @@ FwVolBlockDriverInit ( ProduceFVBProtocolOnBuffer (FvHob.FirmwareVolume->BaseAddress, FvHob.FirmwareVolume->Length, NULL, NULL);
FvHob.Raw = GET_NEXT_HOB (FvHob);
}
+
return EFI_SUCCESS;
}
@@ -587,7 +592,7 @@ CoreProcessFirmwareVolume ( //
if (!EFI_ERROR(Status)) {
Ptr = NULL;
- Status = CoreHandleProtocol (*FVProtocolHandle, &gEfiFirmwareVolume2ProtocolGuid, (VOID **)&Ptr);
+ Status = CoreHandleProtocol (*FVProtocolHandle, &gEfiFirmwareVolume2ProtocolGuid, (VOID **) &Ptr);
if (EFI_ERROR(Status) || (Ptr == NULL)) {
return EFI_VOLUME_CORRUPTED;
}
diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c index 8536647fe7..a2c9b0e73a 100644 --- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c +++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c @@ -1,7 +1,7 @@ /** @file
The file contains the GCD related services in the EFI Boot Services Table.
- The GCD services are used to manage the memory and I/O regions that
- are accessible to the CPU that is executing the DXE core.
+ The GCD services are used to manage the memory and I/O regions that
+ are accessible to the CPU that is executing the DXE core.
Copyright (c) 2006 - 2008, Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials
@@ -49,7 +49,10 @@ LIST_ENTRY mGcdIoSpaceMap = INITIALIZE_LIST_HEAD_VARIABLE (mGcdIoSp EFI_GCD_MAP_ENTRY mGcdMemorySpaceMapEntryTemplate = {
EFI_GCD_MAP_SIGNATURE,
- { NULL, NULL },
+ {
+ NULL,
+ NULL
+ },
0,
0,
0,
@@ -62,7 +65,10 @@ EFI_GCD_MAP_ENTRY mGcdMemorySpaceMapEntryTemplate = { EFI_GCD_MAP_ENTRY mGcdIoSpaceMapEntryTemplate = {
EFI_GCD_MAP_SIGNATURE,
- { NULL, NULL },
+ {
+ NULL,
+ NULL
+ },
0,
0,
0,
@@ -85,7 +91,7 @@ GCD_ATTRIBUTE_CONVERSION_ENTRY mAttributeConversionTable[] = { { EFI_RESOURCE_ATTRIBUTE_PRESENT, EFI_MEMORY_PRESENT, FALSE },
{ EFI_RESOURCE_ATTRIBUTE_INITIALIZED, EFI_MEMORY_INITIALIZED, FALSE },
{ EFI_RESOURCE_ATTRIBUTE_TESTED, EFI_MEMORY_TESTED, FALSE },
- { 0, 0, FALSE }
+ { 0, 0, FALSE }
};
@@ -147,7 +153,6 @@ CoreReleaseGcdIoLock ( //
// GCD Initialization Worker Functions
//
-
/**
Aligns a value to the specified boundary.
@@ -292,7 +297,7 @@ CoreInsertGcdMapEntry ( /**
- Merge the Gcd region specified by Link and its adjacent entry
+ Merge the Gcd region specified by Link and its adjacent entry.
@param Link Specify the entry to be merged (with its
adjacent entry).
@@ -452,6 +457,7 @@ CoreSearchGcdMapEntry ( }
Link = Link->ForwardLink;
}
+
return EFI_NOT_FOUND;
}
@@ -478,6 +484,7 @@ CoreCountGcdMapEntry ( Count++;
Link = Link->ForwardLink;
}
+
return Count;
}
@@ -655,7 +662,6 @@ CoreConvertSpace ( if ((Attributes & EFI_MEMORY_RUNTIME) != 0) {
if ((BaseAddress & EFI_PAGE_MASK) != 0 || (Length & EFI_PAGE_MASK) != 0) {
Status = EFI_INVALID_PARAMETER;
-
goto Done;
}
}
@@ -677,9 +683,6 @@ CoreConvertSpace ( goto Done;
}
- //
- //
- //
if (Operation == GCD_SET_ATTRIBUTES_MEMORY_OPERATION) {
//
// Call CPU Arch Protocol to attempt to set attributes on the range
@@ -973,7 +976,7 @@ CoreAllocateSpace ( }
if (GcdAllocateType == EfiGcdAllocateMaxAddressSearchTopDown ||
- GcdAllocateType == EfiGcdAllocateAnySearchTopDown ) {
+ GcdAllocateType == EfiGcdAllocateAnySearchTopDown) {
if ((Entry->BaseAddress + Length) > MaxAddress) {
continue;
}
@@ -1859,10 +1862,9 @@ CoreInitializeMemoryServices ( //
// See if this resource descrior HOB describes tested system memory below MaxAddress
//
- if (ResourceHob->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY &&
- (ResourceHob->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) == TESTED_MEMORY_ATTRIBUTES &&
- ResourceHob->PhysicalStart + ResourceHob->ResourceLength <= MaxAddress ) {
-
+ if (ResourceHob->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY &&
+ (ResourceHob->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) == TESTED_MEMORY_ATTRIBUTES &&
+ ResourceHob->PhysicalStart + ResourceHob->ResourceLength <= MaxAddress) {
//
// See if this is the highest tested system memory region below MaxAddress
//
@@ -1886,11 +1888,8 @@ CoreInitializeMemoryServices ( MaxAddress = ResourceHob->PhysicalStart;
} while (Found && MaxMemoryLength < MINIMUM_INITIAL_MEMORY_SIZE);
- //
- //
- //
- if ((Length < MINIMUM_INITIAL_MEMORY_SIZE) ||
- (MaxMemoryBaseAddress > BaseAddress && MaxMemoryLength >= MINIMUM_INITIAL_MEMORY_SIZE) ) {
+ if ((Length < MINIMUM_INITIAL_MEMORY_SIZE) ||
+ (MaxMemoryBaseAddress > BaseAddress && MaxMemoryLength >= MINIMUM_INITIAL_MEMORY_SIZE)) {
BaseAddress = MaxMemoryBaseAddress;
Length = MaxMemoryLength;
Attributes = MaxMemoryAttributes;
@@ -1942,14 +1941,14 @@ CoreInitializeMemoryServices ( **/
EFI_STATUS
CoreInitializeGcdServices (
- IN OUT VOID **HobStart,
+ IN OUT VOID **HobStart,
IN EFI_PHYSICAL_ADDRESS MemoryBaseAddress,
IN UINT64 MemoryLength
)
{
- EFI_PEI_HOB_POINTERS Hob;
+ EFI_PEI_HOB_POINTERS Hob;
VOID *NewHobList;
- EFI_HOB_HANDOFF_INFO_TABLE *PhitHob;
+ EFI_HOB_HANDOFF_INFO_TABLE *PhitHob;
UINT8 SizeOfMemorySpace;
UINT8 SizeOfIoSpace;
EFI_HOB_RESOURCE_DESCRIPTOR *ResourceHob;
@@ -1967,6 +1966,7 @@ CoreInitializeGcdServices ( UINTN Index;
UINT64 Capabilities;
EFI_HOB_CPU * CpuHob;
+
//
// Cache the PHIT HOB for later use
//
@@ -2041,7 +2041,6 @@ CoreInitializeGcdServices ( }
if (GcdMemoryType != EfiGcdMemoryTypeNonExistent) {
-
//
// Convert the Resource HOB Attributes to an EFI Memory Capabilities mask
//
diff --git a/MdeModulePkg/Core/Dxe/Hand.h b/MdeModulePkg/Core/Dxe/Hand.h index c6a698dbd4..e119b9339e 100644 --- a/MdeModulePkg/Core/Dxe/Hand.h +++ b/MdeModulePkg/Core/Dxe/Hand.h @@ -181,6 +181,33 @@ CoreUnregisterProtocolNotify ( IN EFI_EVENT Event
);
+/**
+ Connects a controller to a driver.
+
+ @param ControllerHandle Handle of the controller to be
+ connected.
+ @param ContextDriverImageHandles DriverImageHandle A pointer to an
+ ordered list of driver image
+ handles.
+ @param RemainingDevicePath RemainingDevicePath A pointer to
+ the device path that specifies a
+ child of the controller
+ specified by ControllerHandle.
+
+ @retval EFI_SUCCESS One or more drivers were
+ connected to ControllerHandle.
+ @retval EFI_OUT_OF_RESOURCES No enough system resources to
+ complete the request.
+ @retval EFI_NOT_FOUND No drivers were connected to
+ ControllerHandle.
+
+**/
+EFI_STATUS
+CoreConnectSingleController (
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE *ContextDriverImageHandles OPTIONAL,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
+ );
/**
Attempts to disconnect all drivers that are using the protocol interface being queried.
diff --git a/MdeModulePkg/Core/Dxe/Hand/DriverSupport.c b/MdeModulePkg/Core/Dxe/Hand/DriverSupport.c index 930003304a..3c2980301d 100644 --- a/MdeModulePkg/Core/Dxe/Hand/DriverSupport.c +++ b/MdeModulePkg/Core/Dxe/Hand/DriverSupport.c @@ -14,41 +14,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include <DxeMain.h>
-//
-// Driver Support Function Prototypes
-//
-/**
- Connects a controller to a driver.
-
- @param ControllerHandle Handle of the controller to be
- connected.
- @param ContextDriverImageHandles DriverImageHandle A pointer to an
- ordered list of driver image
- handles.
- @param RemainingDevicePath RemainingDevicePath A pointer to
- the device path that specifies a
- child of the controller
- specified by ControllerHandle.
-
- @retval EFI_SUCCESS One or more drivers were
- connected to ControllerHandle.
- @retval EFI_OUT_OF_RESOURCES No enough system resources to
- complete the request.
- @retval EFI_NOT_FOUND No drivers were connected to
- ControllerHandle.
-
-**/
-EFI_STATUS
-CoreConnectSingleController (
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE *ContextDriverImageHandles OPTIONAL,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
- );
//
// Driver Support Functions
//
-
/**
Connects one or more drivers to a controller.
@@ -114,10 +83,10 @@ CoreConnectController ( //
do {
ReturnStatus = CoreConnectSingleController (
- ControllerHandle,
- DriverImageHandle,
- AlignedRemainingDevicePath
- );
+ ControllerHandle,
+ DriverImageHandle,
+ AlignedRemainingDevicePath
+ );
} while (ReturnStatus == EFI_NOT_READY);
//
@@ -269,7 +238,7 @@ AddSortedDriverBindingProtocol ( Status = CoreHandleProtocol (
DriverBindingHandleBuffer[Index],
&gEfiDriverBindingProtocolGuid,
- (VOID **)&DriverBinding
+ (VOID **) &DriverBinding
);
if (EFI_ERROR (Status) || DriverBinding == NULL) {
continue;
@@ -299,7 +268,7 @@ AddSortedDriverBindingProtocol ( Status = CoreHandleProtocol(
DriverBindingHandle,
&gEfiDriverBindingProtocolGuid,
- (VOID **)&DriverBinding
+ (VOID **) &DriverBinding
);
//
// If DriverBindingHandle does not support the Driver Binding Protocol then return
@@ -435,7 +404,7 @@ CoreConnectSingleController ( Status = CoreLocateProtocol (
&gEfiPlatformDriverOverrideProtocolGuid,
NULL,
- (VOID **)&PlatformDriverOverride
+ (VOID **) &PlatformDriverOverride
);
if (!EFI_ERROR (Status) && (PlatformDriverOverride != NULL)) {
DriverImageHandle = NULL;
@@ -464,7 +433,7 @@ CoreConnectSingleController ( Status = CoreHandleProtocol (
ControllerHandle,
&gEfiBusSpecificDriverOverrideProtocolGuid,
- (VOID **)&BusSpecificDriverOverride
+ (VOID **) &BusSpecificDriverOverride
);
if (!EFI_ERROR (Status) && (BusSpecificDriverOverride != NULL)) {
DriverImageHandle = NULL;
diff --git a/MdeModulePkg/Core/Dxe/Hand/Handle.c b/MdeModulePkg/Core/Dxe/Hand/Handle.c index b07a3a2a58..72657d8756 100644 --- a/MdeModulePkg/Core/Dxe/Hand/Handle.c +++ b/MdeModulePkg/Core/Dxe/Hand/Handle.c @@ -21,7 +21,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. // gProtocolDatabaseLock - Lock to protect the mProtocolDatabase
// gHandleDatabaseKey - The Key to show that the handle has been created/modified
//
-STATIC LIST_ENTRY mProtocolDatabase = INITIALIZE_LIST_HEAD_VARIABLE (mProtocolDatabase);
+LIST_ENTRY mProtocolDatabase = INITIALIZE_LIST_HEAD_VARIABLE (mProtocolDatabase);
LIST_ENTRY gHandleList = INITIALIZE_LIST_HEAD_VARIABLE (gHandleList);
EFI_LOCK gProtocolDatabaseLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_NOTIFY);
UINT64 gHandleDatabaseKey = 0;
@@ -139,7 +139,7 @@ CoreFindProtocolEntry ( // Initialize new protocol entry structure
//
ProtEntry->Signature = PROTOCOL_ENTRY_SIGNATURE;
- CopyMem ((VOID *)&ProtEntry->ProtocolID, Protocol, sizeof (EFI_GUID));
+ CopyGuid ((VOID *)&ProtEntry->ProtocolID, Protocol);
InitializeListHead (&ProtEntry->Protocols);
InitializeListHead (&ProtEntry->Notify);
diff --git a/MdeModulePkg/Core/Dxe/Hand/Locate.c b/MdeModulePkg/Core/Dxe/Hand/Locate.c index c8ea7a83a8..373bf9f2d2 100644 --- a/MdeModulePkg/Core/Dxe/Hand/Locate.c +++ b/MdeModulePkg/Core/Dxe/Hand/Locate.c @@ -139,10 +139,10 @@ CoreLocateHandle ( }
GetNext = NULL;
+
//
// Set initial position
//
-
Position.Protocol = Protocol;
Position.SearchKey = SearchKey;
Position.Position = &gHandleList;
@@ -154,7 +154,6 @@ CoreLocateHandle ( //
// Lock the protocol database
//
-
CoreAcquireProtocolLock ();
//
@@ -267,9 +266,8 @@ CoreLocateHandle ( @param Interface Return the interface structure for the matching
protocol.
- @retval IHANDLE An IHANDLE is returned if the next Position is
- not the end of the list. A NULL_HANDLE is
- returned if it's the end of the list.
+ @return An pointer to IHANDLE if the next Position is not the end of the list.
+ Otherwise,NULL_HANDLE is returned.
**/
IHANDLE *
@@ -307,9 +305,8 @@ CoreGetNextLocateAllHandles ( @param Interface Return the interface structure for the matching
protocol.
- @retval IHANDLE An IHANDLE is returned if the next Position is
- not the end of the list. A NULL_HANDLE is
- returned if it's the end of the list.
+ @return An pointer to IHANDLE if the next Position is not the end of the list.
+ Otherwise,NULL_HANDLE is returned.
**/
IHANDLE *
@@ -349,7 +346,6 @@ CoreGetNextLocateByRegisterNotify ( }
-
/**
Routine to get the next Handle, when you are searching for a given protocol.
@@ -357,9 +353,8 @@ CoreGetNextLocateByRegisterNotify ( @param Interface Return the interface structure for the matching
protocol.
- @retval IHANDLE An IHANDLE is returned if the next Position is
- not the end of the list. A NULL_HANDLE is
- returned if it's the end of the list.
+ @return An pointer to IHANDLE if the next Position is not the end of the list.
+ Otherwise,NULL_HANDLE is returned.
**/
IHANDLE *
@@ -410,8 +405,6 @@ CoreGetNextLocateByProtocol ( }
-
-
/**
Locates the handle to a device on the device path that best matches the specified protocol.
@@ -529,9 +522,7 @@ CoreLocateDevicePath ( }
-
-
-/**
+ /**
Return the first Protocol Interface that matches the Protocol GUID. If
Registration is pasased in return a Protocol Instance that was just add
to the system. If Retistration is NULL return the first Protocol Interface
@@ -585,7 +576,7 @@ CoreLocateProtocol ( mEfiLocateHandleRequest += 1;
- if (NULL == Registration) {
+ if (Registration == NULL) {
//
// Look up the protocol entry and set the head pointer
//
@@ -601,9 +592,9 @@ CoreLocateProtocol ( Handle = CoreGetNextLocateByRegisterNotify (&Position, Interface);
}
- if (NULL == Handle) {
+ if (Handle == NULL) {
Status = EFI_NOT_FOUND;
- } else if (NULL != Registration) {
+ } else if (Registration != NULL) {
//
// If this is a search by register notify and a handle was
// returned, update the register notification position
@@ -618,8 +609,6 @@ Done: }
-
-
/**
Function returns an array of handles that support the requested protocol
in a buffer allocated from pool. This is a version of CoreLocateHandle()
@@ -639,7 +628,7 @@ Done: @retval EFI_NOT_FOUND No handles match the search.
@retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
matching results.
- @retval EFI_INVALID_PARAMETER Invalid parameter
+ @retval EFI_INVALID_PARAMETER One or more paramters are not valid.
**/
EFI_STATUS
@@ -699,7 +688,7 @@ CoreLocateHandleBuffer ( *Buffer
);
- *NumberHandles = BufferSize/sizeof(EFI_HANDLE);
+ *NumberHandles = BufferSize / sizeof(EFI_HANDLE);
if (EFI_ERROR(Status)) {
*NumberHandles = 0;
}
diff --git a/MdeModulePkg/Core/Dxe/Hand/Notify.c b/MdeModulePkg/Core/Dxe/Hand/Notify.c index 395cdd4577..67fce28bd2 100644 --- a/MdeModulePkg/Core/Dxe/Hand/Notify.c +++ b/MdeModulePkg/Core/Dxe/Hand/Notify.c @@ -71,7 +71,6 @@ CoreRemoveInterfaceFromProtocol ( //
// If there's a protocol notify location pointing to this entry, back it up one
//
-
for(Link = ProtEntry->Notify.ForwardLink; Link != &ProtEntry->Notify; Link=Link->ForwardLink) {
ProtNotify = CR(Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE);
@@ -83,7 +82,6 @@ CoreRemoveInterfaceFromProtocol ( //
// Remove the protocol interface entry
//
-
RemoveEntryList (&Prot->ByProtocol);
}
@@ -91,8 +89,6 @@ CoreRemoveInterfaceFromProtocol ( }
-
-
/**
Add a new protocol notification record for the request protocol.
@@ -111,11 +107,11 @@ EFIAPI CoreRegisterProtocolNotify (
IN EFI_GUID *Protocol,
IN EFI_EVENT Event,
- OUT VOID **Registration
+ OUT VOID **Registration
)
{
- PROTOCOL_ENTRY *ProtEntry;
- PROTOCOL_NOTIFY *ProtNotify;
+ PROTOCOL_ENTRY *ProtEntry;
+ PROTOCOL_NOTIFY *ProtNotify;
EFI_STATUS Status;
if ((Protocol == NULL) || (Event == NULL) || (Registration == NULL)) {
@@ -136,9 +132,7 @@ CoreRegisterProtocolNotify ( //
// Allocate a new notification record
//
-
ProtNotify = CoreAllocateBootServicesPool (sizeof(PROTOCOL_NOTIFY));
-
if (ProtNotify != NULL) {
ProtNotify->Signature = PROTOCOL_NOTIFY_SIGNATURE;
@@ -170,8 +164,6 @@ CoreRegisterProtocolNotify ( }
-
-
/**
Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface.
@@ -274,11 +266,11 @@ CoreReinstallProtocolInterface ( //
CoreReleaseProtocolLock ();
Status = CoreConnectController (
- UserHandle,
- NULL,
- NULL,
- TRUE
- );
+ UserHandle,
+ NULL,
+ NULL,
+ TRUE
+ );
CoreAcquireProtocolLock ();
//
diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Image/Image.c index b4a1581f1f..0c4baae2f7 100644 --- a/MdeModulePkg/Core/Dxe/Image/Image.c +++ b/MdeModulePkg/Core/Dxe/Image/Image.c @@ -416,8 +416,8 @@ CoreLoadPeImage ( Status = Image->Ebc->CreateThunk (
Image->Ebc,
Image->Handle,
- (VOID *)(UINTN)Image->ImageContext.EntryPoint,
- (VOID **)&Image->EntryPoint
+ (VOID *)(UINTN) Image->ImageContext.EntryPoint,
+ (VOID **) &Image->EntryPoint
);
if (EFI_ERROR(Status)) {
goto Done;
@@ -466,20 +466,12 @@ CoreLoadPeImage ( UINTN StartIndex;
CHAR8 EfiFileName[256];
- if (Image->ImageContext.Machine != IMAGE_FILE_MACHINE_IA64) {
- DEBUG ((DEBUG_INFO | DEBUG_LOAD,
- "Loading driver at 0x%10p EntryPoint=0x%10p ",
- (VOID *)(UINTN)Image->ImageContext.ImageAddress,
- (VOID *)(UINTN)Image->ImageContext.EntryPoint));
- } else {
- //
- // For IPF Image, the real entry point should be print.
- //
- DEBUG ((DEBUG_INFO | DEBUG_LOAD,
- "Loading driver at 0x%10p EntryPoint=0x%10p ",
- (VOID *)(UINTN)Image->ImageContext.ImageAddress,
- (VOID *)(UINTN)(*(UINT64 *)(UINTN)Image->ImageContext.EntryPoint)));
- }
+
+ DEBUG ((DEBUG_INFO | DEBUG_LOAD,
+ "Loading driver at 0x%10p EntryPoint=0x%10p ",
+ (VOID *)(UINTN) Image->ImageContext.ImageAddress,
+ FUNCTION_ENTRY_POINT ((UINTN) Image->ImageContext.EntryPoint)));
+
//
// Print Module Name by Pdb file path
@@ -559,7 +551,7 @@ CoreLoadedImageInfo ( if (!EFI_ERROR (Status)) {
Image = LOADED_IMAGE_PRIVATE_DATA_FROM_THIS (LoadedImage);
} else {
- DEBUG ((DEBUG_LOAD, "CoreLoadedImageInfo: Not an ImageHandle %x\n", ImageHandle));
+ DEBUG ((DEBUG_LOAD, "CoreLoadedImageInfo: Not an ImageHandle %p\n", ImageHandle));
Image = NULL;
}
@@ -698,7 +690,7 @@ CoreLoadImageCommon ( Status = CoreHandleProtocol (DeviceHandle, &gEfiDevicePathProtocolGuid, (VOID **)&HandleFilePath);
if (!EFI_ERROR (Status)) {
FilePathSize = CoreDevicePathSize (HandleFilePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL);
- FilePath = (EFI_DEVICE_PATH_PROTOCOL *) ( ((UINT8 *)FilePath) + FilePathSize );
+ FilePath = (EFI_DEVICE_PATH_PROTOCOL *) (((UINT8 *)FilePath) + FilePathSize );
}
//
@@ -1061,12 +1053,7 @@ CoreStartImage ( DEBUG_CODE_BEGIN ();
if (Image->ExitDataSize != 0 || Image->ExitData != NULL) {
- DEBUG (
- (DEBUG_LOAD,
- "StartImage: ExitDataSize %d, ExitData %x",
- Image->ExitDataSize,
- Image->ExitData)
- );
+ DEBUG ((DEBUG_LOAD, "StartImage: ExitDataSize %d, ExitData %x", Image->ExitDataSize, Image->ExitData));
if (Image->ExitData != NULL) {
DEBUG ((DEBUG_LOAD, " (%hs)", Image->ExitData));
}
diff --git a/MdeModulePkg/Core/Dxe/Image/ImageFile.c b/MdeModulePkg/Core/Dxe/Image/ImageFile.c index e78b88d608..c9fc6d632d 100644 --- a/MdeModulePkg/Core/Dxe/Image/ImageFile.c +++ b/MdeModulePkg/Core/Dxe/Image/ImageFile.c @@ -79,7 +79,7 @@ CoreOpenImageFile ( if (SourceBuffer != NULL) {
ImageFileHandle->Source = SourceBuffer;
ImageFileHandle->SourceSize = SourceSize;
- *DeviceHandle = NULL;
+ *DeviceHandle = NULL;
CoreLocateDevicePath (&gEfiDevicePathProtocolGuid, FilePath, DeviceHandle);
if (SourceSize > 0) {
Status = EFI_SUCCESS;
@@ -252,7 +252,7 @@ CoreOpenImageFile ( //
// Read the file into the buffer we allocated
//
- ImageFileHandle->SourceSize = (UINTN)FileInfo->FileSize;
+ ImageFileHandle->SourceSize = (UINTN) FileInfo->FileSize;
ImageFileHandle->FreeBuffer = TRUE;
Status = FileHandle->Read (FileHandle, &ImageFileHandle->SourceSize, ImageFileHandle->Source);
@@ -277,11 +277,11 @@ CoreOpenImageFile ( TempFilePath = *FilePath;
Status = CoreDevicePathToInterface (
- &gEfiLoadFileProtocolGuid,
- &TempFilePath,
- (VOID*)&LoadFile,
- DeviceHandle
- );
+ &gEfiLoadFileProtocolGuid,
+ &TempFilePath,
+ (VOID*) &LoadFile,
+ DeviceHandle
+ );
if (!EFI_ERROR (Status)) {
//
// Call LoadFile with the correct buffer size
@@ -333,7 +333,6 @@ Done: -
/**
Read image file (specified by UserHandle) into user specified buffer with specified offset
and length.
@@ -449,7 +448,6 @@ CoreGrowBuffer ( //
// If the status code is "buffer too small", resize the buffer
//
-
if (*Status == EFI_BUFFER_TOO_SMALL) {
if (*Buffer != NULL) {
CoreFreePool (*Buffer);
diff --git a/MdeModulePkg/Core/Dxe/Library/Library.c b/MdeModulePkg/Core/Dxe/Library/Library.c index cdef6a9ec6..34d032bddf 100644 --- a/MdeModulePkg/Core/Dxe/Library/Library.c +++ b/MdeModulePkg/Core/Dxe/Library/Library.c @@ -120,7 +120,7 @@ CoreAllocateZeroBootServicesPool ( VOID *Memory;
Memory = CoreAllocateBootServicesPool (AllocationSize);
- SetMem (Memory, (Memory == NULL) ? 0 : AllocationSize, 0);
+ ZeroMem (Memory, (Memory == NULL) ? 0 : AllocationSize);
return Memory;
}
@@ -321,7 +321,7 @@ CoreDevicePathSize ( //
// Compute the size and add back in the size of the end device path structure
//
- return ((UINTN)DevicePath - (UINTN)Start) + sizeof(EFI_DEVICE_PATH_PROTOCOL);
+ return ((UINTN) DevicePath - (UINTN) Start) + sizeof(EFI_DEVICE_PATH_PROTOCOL);
}
@@ -394,8 +394,6 @@ CoreDuplicateDevicePath ( }
-
-
/**
Function is used to append a Src1 and Src2 together.
@@ -445,8 +443,6 @@ CoreAppendDevicePath ( }
-
-
/**
Create a protocol notification event and return it.
@@ -479,25 +475,23 @@ CoreCreateProtocolNotifyEvent ( //
// Create the event
//
-
Status = CoreCreateEvent (
EVT_NOTIFY_SIGNAL,
NotifyTpl,
NotifyFunction,
NotifyContext,
- &Event
+ &Event
);
ASSERT_EFI_ERROR (Status);
//
// Register for protocol notifactions on this event
//
-
Status = CoreRegisterProtocolNotify (
- ProtocolGuid,
- Event,
- Registration
- );
+ ProtocolGuid,
+ Event,
+ Registration
+ );
ASSERT_EFI_ERROR (Status);
if (SignalFlag) {
diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c index 5da740cb7c..2bf457267a 100644 --- a/MdeModulePkg/Core/Dxe/Mem/Page.c +++ b/MdeModulePkg/Core/Dxe/Mem/Page.c @@ -46,8 +46,8 @@ UINTN mFreeMapStack = 0; //
// This list maintain the free memory map list
//
-LIST_ENTRY mFreeMemoryMapEntryList = INITIALIZE_LIST_HEAD_VARIABLE (mFreeMemoryMapEntryList);
-BOOLEAN mMemoryTypeInformationInitialized = FALSE;
+LIST_ENTRY mFreeMemoryMapEntryList = INITIALIZE_LIST_HEAD_VARIABLE (mFreeMemoryMapEntryList);
+BOOLEAN mMemoryTypeInformationInitialized = FALSE;
EFI_MEMORY_TYPE_STAISTICS mMemoryTypeStatistics[EfiMaxMemoryType + 1] = {
{ 0, EFI_MAX_ADDRESS, 0, 0, EfiMaxMemoryType, TRUE, FALSE }, // EfiReservedMemoryType
@@ -110,8 +110,6 @@ PromoteMemoryResource ( byte of a page
@param Attribute The attributes of the memory range to add
- @return None. The range is added to the memory map
-
**/
VOID
CoreAddRange (
@@ -613,7 +611,7 @@ CoreFreeMemoryMapStack ( **/
VOID
RemoveMemoryMapEntry (
- MEMORY_MAP *Entry
+ IN OUT MEMORY_MAP *Entry
)
{
RemoveEntryList (&Entry->Link);
@@ -1151,9 +1149,6 @@ Done: }
-
-
-
/**
Frees previous allocated pages.
@@ -1235,8 +1230,6 @@ CoreFreePages ( }
-
-
/**
This function returns a copy of the current memory map. The map is an array of
memory descriptors, each of which describes a contiguous block of memory.
@@ -1373,7 +1366,7 @@ CoreGetMemoryMap ( if (mMemoryTypeStatistics[Type].Special &&
mMemoryTypeStatistics[Type].NumberOfPages > 0 &&
Entry->Start >= mMemoryTypeStatistics[Type].BaseAddress &&
- Entry->End <= mMemoryTypeStatistics[Type].MaximumAddress ) {
+ Entry->End <= mMemoryTypeStatistics[Type].MaximumAddress) {
MemoryMap->Type = Type;
}
}
@@ -1467,7 +1460,7 @@ CoreAllocatePoolPages ( CoreConvertPages (Start, NumberOfPages, PoolType);
}
- return (VOID *)(UINTN)Start;
+ return (VOID *)(UINTN) Start;
}
diff --git a/MdeModulePkg/Core/Dxe/Mem/Pool.c b/MdeModulePkg/Core/Dxe/Mem/Pool.c index f0af2b8800..fe1b239dc6 100644 --- a/MdeModulePkg/Core/Dxe/Mem/Pool.c +++ b/MdeModulePkg/Core/Dxe/Mem/Pool.c @@ -68,13 +68,15 @@ typedef struct { LIST_ENTRY Link;
} POOL;
-
-POOL PoolHead[EfiMaxMemoryType];
-LIST_ENTRY PoolHeadList;
-
//
+// Pool header for each memory type.
+//
+POOL mPoolHead[EfiMaxMemoryType];
+
//
+// List of pool header to search for the appropriate memory type.
//
+LIST_ENTRY mPoolHeadList;
/**
@@ -90,14 +92,14 @@ CoreInitializePool ( UINTN Index;
for (Type=0; Type < EfiMaxMemoryType; Type++) {
- PoolHead[Type].Signature = 0;
- PoolHead[Type].Used = 0;
- PoolHead[Type].MemoryType = (EFI_MEMORY_TYPE) Type;
+ mPoolHead[Type].Signature = 0;
+ mPoolHead[Type].Used = 0;
+ mPoolHead[Type].MemoryType = (EFI_MEMORY_TYPE) Type;
for (Index=0; Index < MAX_POOL_LIST; Index++) {
- InitializeListHead (&PoolHead[Type].FreeList[Index]);
+ InitializeListHead (&mPoolHead[Type].FreeList[Index]);
}
}
- InitializeListHead (&PoolHeadList);
+ InitializeListHead (&mPoolHeadList);
}
@@ -119,12 +121,12 @@ LookupPoolHead ( UINTN Index;
if (MemoryType >= 0 && MemoryType < EfiMaxMemoryType) {
- return &PoolHead[MemoryType];
+ return &mPoolHead[MemoryType];
}
if (MemoryType < 0) {
- for (Link = PoolHeadList.ForwardLink; Link != &PoolHeadList; Link = Link->ForwardLink) {
+ for (Link = mPoolHeadList.ForwardLink; Link != &mPoolHeadList; Link = Link->ForwardLink) {
Pool = CR(Link, POOL, Link, POOL_SIGNATURE);
if (Pool->MemoryType == MemoryType) {
return Pool;
@@ -143,7 +145,7 @@ LookupPoolHead ( InitializeListHead (&Pool->FreeList[Index]);
}
- InsertHeadList (&PoolHeadList, &Pool->Link);
+ InsertHeadList (&mPoolHeadList, &Pool->Link);
return Pool;
}
@@ -153,7 +155,6 @@ LookupPoolHead ( -
/**
Allocate pool of a particular type.
@@ -331,14 +332,13 @@ Done: Buffer = Head->Data;
DEBUG_CLEAR_MEMORY (Buffer, Size - POOL_OVERHEAD);
- DEBUG (
- (DEBUG_POOL,
- "AllocatePoolI: Type %x, Addr %x (len %x) %,d\n",
- PoolType,
- Buffer,
- Size - POOL_OVERHEAD,
- Pool->Used)
- );
+ DEBUG ((
+ DEBUG_POOL,
+ "AllocatePoolI: Type %x, Addr %x (len %x) %,d\n", PoolType,
+ Buffer,
+ Size - POOL_OVERHEAD,
+ Pool->Used
+ ));
//
// Account the allocation
@@ -354,7 +354,6 @@ Done: -
/**
Frees pool.
@@ -372,7 +371,7 @@ CoreFreePool ( {
EFI_STATUS Status;
- if (NULL == Buffer) {
+ if (Buffer == NULL) {
return EFI_INVALID_PARAMETER;
}
@@ -486,7 +485,7 @@ CoreFreePoolI ( //
NewPage = (CHAR8 *)((UINTN)Free & ~((DEFAULT_PAGE_ALLOCATION) -1));
Free = (POOL_FREE *) &NewPage[0];
- ASSERT(NULL != Free);
+ ASSERT(Free != NULL);
if (Free->Signature == POOL_FREE_SIGNATURE) {
diff --git a/MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c b/MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c index 56308ed674..80d302659d 100644 --- a/MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c +++ b/MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c @@ -16,13 +16,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include <DxeMain.h>
-STATIC EFI_DEBUG_IMAGE_INFO_TABLE_HEADER mDebugInfoTableHeader = {
+EFI_DEBUG_IMAGE_INFO_TABLE_HEADER mDebugInfoTableHeader = {
0, // volatile UINT32 UpdateStatus;
0, // UINT32 TableSize;
NULL // EFI_DEBUG_IMAGE_INFO *EfiDebugImageInfoTable;
};
-STATIC EFI_SYSTEM_TABLE_POINTER *mDebugTable = NULL;
+EFI_SYSTEM_TABLE_POINTER *mDebugTable = NULL;
diff --git a/MdeModulePkg/Core/Dxe/Misc/InstallConfigurationTable.c b/MdeModulePkg/Core/Dxe/Misc/InstallConfigurationTable.c index 821595a4f2..de7507e72d 100644 --- a/MdeModulePkg/Core/Dxe/Misc/InstallConfigurationTable.c +++ b/MdeModulePkg/Core/Dxe/Misc/InstallConfigurationTable.c @@ -182,7 +182,7 @@ CoreInstallConfigurationTable ( //
// Fill in the new entry
//
- CopyMem ((VOID *)&EfiConfigurationTable[Index].VendorGuid, Guid, sizeof (EFI_GUID));
+ CopyGuid ((VOID *)&EfiConfigurationTable[Index].VendorGuid, Guid);
EfiConfigurationTable[Index].VendorTable = Table;
//
diff --git a/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c b/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c index 48143507e4..07ada03d2c 100644 --- a/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c +++ b/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c @@ -99,7 +99,6 @@ typedef struct { //
// Local prototypes
//
-
/**
Worker function. Determine if the input stream:child matches the input type.
@@ -123,41 +122,6 @@ ChildIsType ( IN EFI_GUID *SectionDefinitionGuid
);
-#if 0
-/**
- RPN callback function. Removes a stale section stream and re-initializes it
- with an updated AuthenticationStatus.
-
- @param Event The event that fired
- @param RpnContext A pointer to the context that allows us to
- identify the relevent encapsulation...
-
-**/
-VOID
-EFIAPI
-NotifyGuidedExtraction (
- IN EFI_EVENT Event,
- IN VOID *RpnContext
- );
-#endif
-
-#if 0
-/**
- Worker function. Constructor for RPN event if needed to keep AuthenticationStatus
- cache correct when a missing GUIDED_SECTION_EXTRACTION_PROTOCOL appears...
-
- @param ParentStream Indicates the parent of the ecnapsulation
- section (child)
- @param ChildNode Indicates the child node that is the
- encapsulation section.
-
-**/
-VOID
-CreateGuidedExtractionRpnEvent (
- IN CORE_SECTION_STREAM_NODE *ParentStream,
- IN CORE_SECTION_CHILD_NODE *ChildNode
- );
-#endif
/**
Worker function. Search stream database for requested stream handle.
@@ -177,6 +141,7 @@ FindStreamNode ( OUT CORE_SECTION_STREAM_NODE **FoundStream
);
+
/**
Worker function Recursively searches / builds section stream database
looking for requested section.
@@ -214,6 +179,7 @@ FindChildNode ( OUT UINT32 *AuthenticationStatus
);
+
/**
Worker function. Constructor for new child nodes.
@@ -242,6 +208,7 @@ CreateChildNode ( OUT CORE_SECTION_CHILD_NODE **ChildNode
);
+
/**
Worker function. Destructor for child nodes.
@@ -252,7 +219,8 @@ VOID FreeChildNode (
IN CORE_SECTION_CHILD_NODE *ChildNode
);
-
+
+
/**
Worker function. Constructor for section streams.
@@ -294,7 +262,8 @@ OpenSectionStreamEx ( IN UINT32 AuthenticationStatus,
OUT UINTN *SectionStreamHandle
);
-
+
+
/**
Check if a stream is valid.
@@ -310,6 +279,7 @@ IsValidSectionStream ( IN UINTN SectionStreamLength
);
+
/**
The ExtractSection() function processes the input section and
allocates a buffer from the pool in which it returns the section
@@ -339,7 +309,6 @@ IsValidSectionStream ( @param This Indicates the
EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL instance.
-
@param InputSection Buffer containing the input GUIDed section
to be processed. OutputBuffer OutputBuffer
is allocated from boot services pool
@@ -354,7 +323,6 @@ IsValidSectionStream ( is stored. If the function returns
anything other than EFI_SUCCESS, the value
of OutputSize is undefined.
-
@param AuthenticationStatus A pointer to a caller-allocated
UINT32 that indicates the
authentication status of the
@@ -403,6 +371,7 @@ CustomGuidedSectionExtract ( OUT UINTN *OutputSize,
OUT UINT32 *AuthenticationStatus
);
+
//
// Module globals
//
@@ -491,12 +460,12 @@ OpenSectionStream ( }
return OpenSectionStreamEx (
- SectionStreamLength,
- SectionStream,
- TRUE,
- 0,
- SectionStreamHandle
- );
+ SectionStreamLength,
+ SectionStream,
+ TRUE,
+ 0,
+ SectionStreamHandle
+ );
}
@@ -608,14 +577,14 @@ GetSection ( // There's a requested section type, so go find it and return it...
//
Status = FindChildNode (
- StreamNode,
- *SectionType,
- &Instance,
- SectionDefinitionGuid,
- &ChildNode,
- &ChildStreamNode,
- &ExtractedAuthenticationStatus
- );
+ StreamNode,
+ *SectionType,
+ &Instance,
+ SectionDefinitionGuid,
+ &ChildNode,
+ &ChildStreamNode,
+ &ExtractedAuthenticationStatus
+ );
if (EFI_ERROR (Status)) {
goto GetSection_Done;
}
@@ -648,6 +617,7 @@ GetSection ( GetSection_Done:
CoreRestoreTpl (OldTpl);
+
return Status;
}
@@ -744,7 +714,6 @@ ChildIsType ( }
-
/**
Worker function Recursively searches / builds section stream database
looking for requested section.
@@ -797,7 +766,7 @@ FindChildNode ( }
if (IsListEmpty (&SourceStream->Children) &&
- SourceStream->StreamLength >= sizeof (EFI_COMMON_SECTION_HEADER)) {
+ SourceStream->StreamLength >= sizeof (EFI_COMMON_SECTION_HEADER)) {
//
// This occurs when a section stream exists, but no child sections
// have been parsed out yet. Therefore, extract the first child and add it
@@ -882,7 +851,7 @@ FindChildNode ( // Round up to 4 byte boundary
//
NextChildOffset += 3;
- NextChildOffset &= ~(UINTN)3;
+ NextChildOffset &= ~(UINTN) 3;
if (NextChildOffset <= SourceStream->StreamLength - sizeof (EFI_COMMON_SECTION_HEADER)) {
//
// There's an unparsed child remaining in the stream, so create a new child node
@@ -900,7 +869,6 @@ FindChildNode ( }
-
/**
Worker function. Constructor for new child nodes.
@@ -1153,120 +1121,6 @@ CreateChildNode ( }
-#if 0
-/**
- Worker function. Constructor for RPN event if needed to keep AuthenticationStatus
- cache correct when a missing GUIDED_SECTION_EXTRACTION_PROTOCOL appears...
-
- @param ParentStream Indicates the parent of the ecnapsulation
- section (child)
- @param ChildNode Indicates the child node that is the
- encapsulation section.
-
-**/
-VOID
-CreateGuidedExtractionRpnEvent (
- IN CORE_SECTION_STREAM_NODE *ParentStream,
- IN CORE_SECTION_CHILD_NODE *ChildNode
- )
-{
- RPN_EVENT_CONTEXT *Context;
-
- //
- // Allocate new event structure and context
- //
- Context = CoreAllocateBootServicesPool (sizeof (RPN_EVENT_CONTEXT));
- ASSERT (Context != NULL);
-
- Context->ChildNode = ChildNode;
- Context->ParentStream = ParentStream;
-
- Context->Event = CoreCreateProtocolNotifyEvent (
- Context->ChildNode->EncapsulationGuid,
- TPL_NOTIFY,
- NotifyGuidedExtraction,
- Context,
- &Context->Registration,
- FALSE
- );
-}
-#endif
-
-
-#if 0
-/**
- RPN callback function. Removes a stale section stream and re-initializes it
- with an updated AuthenticationStatus.
-
- @param Event The event that fired
- @param RpnContext A pointer to the context that allows us to
- identify the relevent encapsulation...
-
-**/
-VOID
-EFIAPI
-NotifyGuidedExtraction (
- IN EFI_EVENT Event,
- IN VOID *RpnContext
- )
-{
- EFI_STATUS Status;
- EFI_GUID_DEFINED_SECTION *GuidedHeader;
- EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL *GuidedExtraction;
- VOID *NewStreamBuffer;
- UINTN NewStreamBufferSize;
- UINT32 AuthenticationStatus;
- RPN_EVENT_CONTEXT *Context;
-
- Context = RpnContext;
-
- Status = CloseSectionStream (Context->ChildNode->EncapsulatedStreamHandle);
- if (!EFI_ERROR (Status)) {
- //
- // The stream closed successfully, so re-open the stream with correct AuthenticationStatus
- //
-
- GuidedHeader = (EFI_GUID_DEFINED_SECTION *)
- (Context->ParentStream->StreamBuffer + Context->ChildNode->OffsetInStream);
- ASSERT (GuidedHeader->CommonHeader.Type == EFI_SECTION_GUID_DEFINED);
-
- Status = CoreLocateProtocol (Context->ChildNode->EncapsulationGuid, NULL, (VOID **)&GuidedExtraction);
- ASSERT_EFI_ERROR (Status);
-
-
- Status = GuidedExtraction->ExtractSection (
- GuidedExtraction,
- GuidedHeader,
- &NewStreamBuffer,
- &NewStreamBufferSize,
- &AuthenticationStatus
- );
- ASSERT_EFI_ERROR (Status);
- //
- // OR in the parent stream's aggregagate status.
- //
- AuthenticationStatus |= Context->ParentStream->AuthenticationStatus & EFI_AUTH_STATUS_ALL;
- Status = OpenSectionStreamEx (
- NewStreamBufferSize,
- NewStreamBuffer,
- FALSE,
- AuthenticationStatus,
- &Context->ChildNode->EncapsulatedStreamHandle
- );
- ASSERT_EFI_ERROR (Status);
- }
-
- //
- // If above, the stream did not close successfully, it indicates it's
- // alread been closed by someone, so just destroy the event and be done with
- // it.
- //
-
- CoreCloseEvent (Event);
- CoreFreePool (Context);
-}
-#endif
-
/**
Worker function. Destructor for child nodes.
@@ -1443,7 +1297,6 @@ FindStreamNode ( }
-
/**
Check if a stream is valid.
@@ -1493,6 +1346,7 @@ IsValidSectionStream ( return FALSE;
}
+
/**
The ExtractSection() function processes the input section and
allocates a buffer from the pool in which it returns the section
@@ -1522,7 +1376,6 @@ IsValidSectionStream ( @param This Indicates the
EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL instance.
-
@param InputSection Buffer containing the input GUIDed section
to be processed. OutputBuffer OutputBuffer
is allocated from boot services pool
@@ -1644,7 +1497,7 @@ CustomGuidedSectionExtract ( OutputBuffer,
ScratchBuffer,
AuthenticationStatus
- );
+ );
if (EFI_ERROR (Status)) {
//
// Decode failed
|