From e94a9ff7271367e649ee4f9a86da1f1bea6d112e Mon Sep 17 00:00:00 2001 From: qhuang8 Date: Fri, 18 Jul 2008 09:50:09 +0000 Subject: Code scrub for DxeCore git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5520 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Core/Dxe/Dispatcher/Dependency.c | 18 ++++----- MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c | 58 +++++++++++++-------------- 2 files changed, 37 insertions(+), 39 deletions(-) (limited to 'MdeModulePkg/Core/Dxe/Dispatcher') 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 -- cgit v1.2.3