]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Code scrub for DxeCore
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 18 Jul 2008 09:50:09 +0000 (09:50 +0000)
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 18 Jul 2008 09:50:09 +0000 (09:50 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5520 6f19259b-4bc3-4df7-8a09-765794883524

25 files changed:
MdeModulePkg/Core/Dxe/Dispatcher/Dependency.c
MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c
MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c
MdeModulePkg/Core/Dxe/Event/Event.c
MdeModulePkg/Core/Dxe/Event/Timer.c
MdeModulePkg/Core/Dxe/Event/Tpl.c
MdeModulePkg/Core/Dxe/FwVol/Ffs.c
MdeModulePkg/Core/Dxe/FwVol/FwVol.c
MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c
MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
MdeModulePkg/Core/Dxe/Gcd/Gcd.c
MdeModulePkg/Core/Dxe/Hand.h
MdeModulePkg/Core/Dxe/Hand/DriverSupport.c
MdeModulePkg/Core/Dxe/Hand/Handle.c
MdeModulePkg/Core/Dxe/Hand/Locate.c
MdeModulePkg/Core/Dxe/Hand/Notify.c
MdeModulePkg/Core/Dxe/Image/Image.c
MdeModulePkg/Core/Dxe/Image/ImageFile.c
MdeModulePkg/Core/Dxe/Library/Library.c
MdeModulePkg/Core/Dxe/Mem/Page.c
MdeModulePkg/Core/Dxe/Mem/Pool.c
MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c
MdeModulePkg/Core/Dxe/Misc/InstallConfigurationTable.c
MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c

index a3c974b9d9b8959d2c78ffa6802a5cff4d2af17a..a77dc31073e52e5f4e8cd23a842d04027c2a4cd1 100644 (file)
@@ -1,5 +1,5 @@
 /** @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
@@ -34,8 +34,7 @@ BOOLEAN *mDepexEvaluationStackPointer = NULL;
   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
@@ -85,13 +84,12 @@ GrowDepexStack (
 \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
@@ -131,7 +129,7 @@ PushBool (
   @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
@@ -163,7 +161,7 @@ PopBool (
   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
@@ -203,7 +201,7 @@ CorePreProcessDepex (
   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
@@ -243,7 +241,7 @@ CoreIsSchedulable (
 \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
index c97d1b85da5db94ea40845cc4ab4385bcdf5ed8b..27f18326e02047b0d1c3fa94c730c6cdd53f28eb 100644 (file)
@@ -76,7 +76,7 @@ VOID            *mFwVolEventRegistration;
 //\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
@@ -135,7 +135,7 @@ CoreFwVolEventProtocolNotify (
   );\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
@@ -341,7 +341,7 @@ CoreSchedule (
 \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
@@ -602,8 +602,7 @@ CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter (
   @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
@@ -700,7 +699,6 @@ CoreFvToDevicePath (
 \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
@@ -739,7 +737,7 @@ CoreAddToDriverList (
   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
@@ -821,21 +819,21 @@ CoreProcessFvImageFile (
   //\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
@@ -848,6 +846,9 @@ CoreProcessFvImageFile (
     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
@@ -935,12 +936,12 @@ CoreFwVolEventProtocolNotify (
   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
@@ -969,7 +970,6 @@ CoreFwVolEventProtocolNotify (
     //\r
     FvIsBeingProcesssed (FvHandle);\r
 \r
-\r
     Status = CoreHandleProtocol (FvHandle, &gEfiFirmwareVolume2ProtocolGuid, (VOID **)&Fv);\r
     if (EFI_ERROR (Status)) {\r
       //\r
@@ -1012,7 +1012,7 @@ CoreFwVolEventProtocolNotify (
     //  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
@@ -1125,7 +1125,7 @@ CoreFwVolEventProtocolNotify (
 \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
index 3513179b4780de4c9183ef133dbb2692427b2c8e..5ca956e68a94c5c9ba38866e4d98da6929047f56 100644 (file)
@@ -29,6 +29,11 @@ EFI_TIMER_ARCH_PROTOCOL           *gTimer         = NULL;
 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
@@ -39,15 +44,6 @@ EFI_STATUS_CODE_PROTOCOL     gStatusCodeInstance = {
 \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
@@ -215,7 +211,6 @@ EFI_SYSTEM_TABLE      *gDxeCoreST = NULL;
 EFI_RUNTIME_SERVICES  *gDxeCoreRT = &mEfiRuntimeServicesTableTemplate;\r
 EFI_HANDLE            gDxeCoreImageHandle = NULL;\r
 \r
-VOID  *mHobStart;\r
 \r
 //\r
 // EFI Decompress Protocol\r
@@ -232,10 +227,9 @@ EFI_DECOMPRESS_PROTOCOL  gEfiDecompress = {
 /**\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
@@ -248,8 +242,6 @@ DxeMain (
   EFI_PHYSICAL_ADDRESS               MemoryBaseAddress;\r
   UINT64                             MemoryLength;\r
 \r
-  mHobStart = HobStart;\r
-\r
   //\r
   // Initialize Memory Services\r
   //\r
@@ -287,10 +279,6 @@ DxeMain (
   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
@@ -311,7 +299,7 @@ DxeMain (
   //\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
@@ -330,7 +318,7 @@ DxeMain (
     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
@@ -355,10 +343,10 @@ DxeMain (
   // 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
@@ -412,6 +400,7 @@ DxeMain (
   // 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
@@ -619,7 +608,7 @@ CoreGetPeiProtocol (
   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
@@ -679,8 +668,8 @@ CoreExitBootServices (
   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
@@ -755,7 +744,7 @@ CoreExitBootServices (
   //\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
@@ -824,9 +813,7 @@ DxeMainUefiDecompressGetInfo (
   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
@@ -870,7 +857,7 @@ DxeMainUefiDecompressGetInfo (
 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
@@ -883,9 +870,7 @@ DxeMainUefiDecompress (
   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
index e815df718d1748e6230c2d092c0626b6d87365c3..1bad3a3f7303140f0e721d7ed9ecccdd55d40832 100644 (file)
@@ -36,7 +36,7 @@ ARCHITECTURAL_PROTOCOL_ENTRY  mArchProtocols[] = {
   { &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
@@ -48,7 +48,6 @@ ARCHITECTURAL_PROTOCOL_ENTRY  mArchProtocols[] = {
 /**\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
@@ -170,7 +169,6 @@ GenericArchProtocolNotify (
 \r
 \r
 \r
-\r
 /**\r
   Creates an event that is fired everytime a Protocol of a specific type is installed.\r
 \r
@@ -218,7 +216,7 @@ typedef struct {
   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
@@ -231,7 +229,6 @@ STATIC CONST GUID_TO_STRING_PROTOCOL_ENTRY MissingProtocols[] = {
   { &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
@@ -246,7 +243,7 @@ CoreDisplayMissingArchProtocols (
   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
index 5e0b9c70abf6598bccaeef006d4d6e264bfd4f61..1f458a402a871ae72db8550d827a40d7d76530c1 100644 (file)
@@ -92,7 +92,6 @@ CoreReleaseEventLock (
 /**\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
@@ -385,7 +384,7 @@ CoreCreateEventEx (
     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
@@ -433,9 +432,9 @@ CoreCreateEventEx (
 \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
@@ -521,7 +520,7 @@ CoreCheckEvent (
     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
@@ -532,7 +531,6 @@ CoreCheckEvent (
     //\r
     // Queue the wait notify function\r
     //\r
-\r
     CoreAcquireEventLock ();\r
     if (!Event->SignalCount) {\r
       CoreNotifyEvent (Event);\r
@@ -560,7 +558,6 @@ CoreCheckEvent (
 \r
 \r
 \r
-\r
 /**\r
   Stops execution until an event is signaled.\r
 \r
@@ -616,7 +613,6 @@ CoreWaitForEvent (
 }\r
 \r
 \r
-\r
 /**\r
   Closes an event and frees the event structure.\r
 \r
@@ -648,7 +644,7 @@ CoreCloseEvent (
   //\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
index c16326661720841a167d1e20d25ac1084d14336f..924499e004f369514c966630d6b73a0d874f2356 100644 (file)
@@ -60,18 +60,16 @@ CoreInsertEventTimer (
 // 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
@@ -84,12 +82,12 @@ CoreInitializeTimer (
   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
@@ -110,6 +108,7 @@ CoreCurrentSystemTime (
   CoreAcquireLock (&mEfiSystemTimeLock);\r
   SystemTime = mEfiSystemTime;\r
   CoreReleaseLock (&mEfiSystemTimeLock);\r
+  \r
   return SystemTime;\r
 }\r
 \r
@@ -132,20 +131,17 @@ CoreTimerTick (
   //\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
@@ -179,7 +175,6 @@ CoreCheckTimers (
   //\r
   // Check the timer database for expired timers\r
   //\r
-\r
   CoreAcquireLock (&mEfiTimerLock);\r
   SystemTime = CoreCurrentSystemTime ();\r
 \r
@@ -189,7 +184,6 @@ CoreCheckTimers (
     //\r
     // If this timer is not expired, then we're done\r
     //\r
-\r
     if (Event->u.Timer.TriggerTime > SystemTime) {\r
       break;\r
     }\r
@@ -210,11 +204,9 @@ CoreCheckTimers (
     // 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
@@ -228,7 +220,6 @@ CoreCheckTimers (
       //\r
       // Add the timer\r
       //\r
-\r
       CoreInsertEventTimer (Event);\r
     }\r
   }\r
@@ -258,13 +249,11 @@ CoreInsertEventTimer (
   //\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
@@ -278,7 +267,6 @@ CoreInsertEventTimer (
 \r
 \r
 \r
-\r
 /**\r
   Sets the type of timer and the trigger time for a timer event.\r
 \r
@@ -323,7 +311,6 @@ CoreSetTimer (
   //\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
@@ -347,5 +334,6 @@ CoreSetTimer (
   }\r
 \r
   CoreReleaseLock (&mEfiTimerLock);\r
+\r
   return EFI_SUCCESS;\r
 }\r
index 1fbf39ece34c6ca49b38c480693e45a05fe7dfc4..4f63889709412612f8f932f12c2d712aaee615fd 100644 (file)
@@ -1,5 +1,5 @@
 /** @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
@@ -52,14 +52,14 @@ CoreHighestSetBit (
   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
index 7673352bbadb0643203415cee643bf16b93ff796..00d07567f79e6518d39593d89402af9c7bbbe06d 100644 (file)
@@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \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
@@ -47,7 +45,7 @@ GetFileState (
     HighestBit >>= 1;\r
   }\r
 \r
-  return (EFI_FFS_FILE_STATE)HighestBit;\r
+  return (EFI_FFS_FILE_STATE) HighestBit;\r
 }\r
 \r
 \r
@@ -183,24 +181,23 @@ IsValidFfsHeader (
   *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
@@ -223,17 +220,17 @@ IsValidFfsFile (
   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
index 6a4d7b05b2abe521dcf4b39854de73ca7a932980..f14cce05c7c820e1983c84df0409eda9fbe172fd 100644 (file)
@@ -52,8 +52,6 @@ FV_DEVICE mFvDevice = {
 //\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
@@ -122,8 +120,6 @@ GetFwVolHeader (
 \r
   @param  FvDevice              pointer to the FvDevice to be freed. \r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 FreeFvDeviceResource (\r
@@ -149,7 +145,7 @@ FreeFvDeviceResource (
 \r
     CoreFreePool (FfsFileEntry);\r
 \r
-    FfsFileEntry = (FFS_FILE_LIST_ENTRY *)NextEntry;\r
+    FfsFileEntry = (FFS_FILE_LIST_ENTRY *) NextEntry;\r
   }\r
 \r
 \r
@@ -169,9 +165,9 @@ FreeFvDeviceResource (
 \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              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
@@ -245,11 +241,11 @@ FvCheck (
         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
@@ -288,11 +284,11 @@ FvCheck (
   //\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
@@ -308,9 +304,7 @@ FvCheck (
       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
@@ -476,9 +470,9 @@ NotifyFwVolBlock (
         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
index 81e3ad349e9dd038246848a08745adfec565e5fd..7016ee5b9095419a7ab8f2a6a09b103a25af6604 100644 (file)
@@ -200,7 +200,7 @@ FvGetNextFile (
   // 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
@@ -280,7 +280,7 @@ FvReadFile (
   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
@@ -412,7 +412,7 @@ FvReadFileSection (
   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
@@ -434,7 +434,7 @@ FvReadFileSection (
   //\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
@@ -453,10 +453,10 @@ FvReadFileSection (
   //\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
index bc234aa0d01080276286375ae3850782e6949fd7..d35292899be034253db0c7a9fdb11095a0875bc2 100644 (file)
@@ -1,9 +1,8 @@
 /** @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
@@ -27,16 +26,22 @@ EFI_FW_VOL_BLOCK_DEVICE  mFwVolBlock = {
       {\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
@@ -57,8 +62,6 @@ EFI_FW_VOL_BLOCK_DEVICE  mFwVolBlock = {
 \r
 \r
 \r
-\r
-\r
 /**\r
   Retrieves Volume attributes.  No polarity translations are done.\r
 \r
@@ -195,7 +198,7 @@ FwVolBlockReadBlock (
     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
@@ -221,8 +224,8 @@ FwVolBlockReadBlock (
   }\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
@@ -412,7 +415,7 @@ ProduceFVBProtocolOnBuffer (
   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
@@ -450,8 +453,8 @@ ProduceFVBProtocolOnBuffer (
   //\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
@@ -468,7 +471,7 @@ ProduceFVBProtocolOnBuffer (
   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
@@ -488,12 +491,12 @@ ProduceFVBProtocolOnBuffer (
   // 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
@@ -527,6 +530,7 @@ FwVolBlockDriverInit (
   )\r
 {\r
   EFI_PEI_HOB_POINTERS          FvHob;\r
+\r
   //\r
   // Core Needs Firmware Volumes to function\r
   //\r
@@ -538,6 +542,7 @@ FwVolBlockDriverInit (
     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
@@ -587,7 +592,7 @@ CoreProcessFirmwareVolume (
   //\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
index 8536647fe7eb6025ec89b7e70d22cebef41966c6..a2c9b0e73aac064ee2d78354f7b51eb361a8d6a8 100644 (file)
@@ -1,7 +1,7 @@
 /** @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
@@ -49,7 +49,10 @@ LIST_ENTRY         mGcdIoSpaceMap      = INITIALIZE_LIST_HEAD_VARIABLE (mGcdIoSp
 \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
@@ -62,7 +65,10 @@ EFI_GCD_MAP_ENTRY mGcdMemorySpaceMapEntryTemplate = {
 \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
@@ -85,7 +91,7 @@ GCD_ATTRIBUTE_CONVERSION_ENTRY mAttributeConversionTable[] = {
   { 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
@@ -147,7 +153,6 @@ CoreReleaseGcdIoLock (
 //\r
 // GCD Initialization Worker Functions\r
 //\r
-\r
 /**\r
   Aligns a value to the specified boundary.\r
 \r
@@ -292,7 +297,7 @@ CoreInsertGcdMapEntry (
 \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
@@ -452,6 +457,7 @@ CoreSearchGcdMapEntry (
     }\r
     Link = Link->ForwardLink;\r
   }\r
+\r
   return EFI_NOT_FOUND;\r
 }\r
 \r
@@ -478,6 +484,7 @@ CoreCountGcdMapEntry (
     Count++;\r
     Link = Link->ForwardLink;\r
   }\r
+  \r
   return Count;\r
 }\r
 \r
@@ -655,7 +662,6 @@ CoreConvertSpace (
       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
@@ -677,9 +683,6 @@ CoreConvertSpace (
     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
@@ -973,7 +976,7 @@ CoreAllocateSpace (
       }\r
 \r
       if (GcdAllocateType == EfiGcdAllocateMaxAddressSearchTopDown ||\r
-          GcdAllocateType == EfiGcdAllocateAnySearchTopDown           ) {\r
+          GcdAllocateType == EfiGcdAllocateAnySearchTopDown) {\r
         if ((Entry->BaseAddress + Length) > MaxAddress) {\r
           continue;\r
         }\r
@@ -1859,10 +1862,9 @@ CoreInitializeMemoryServices (
         //\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
@@ -1886,11 +1888,8 @@ CoreInitializeMemoryServices (
     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
@@ -1942,14 +1941,14 @@ CoreInitializeMemoryServices (
 **/\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
@@ -1967,6 +1966,7 @@ CoreInitializeGcdServices (
   UINTN                              Index;\r
   UINT64                             Capabilities;\r
   EFI_HOB_CPU *                      CpuHob;\r
+\r
   //\r
   // Cache the PHIT HOB for later use\r
   //\r
@@ -2041,7 +2041,6 @@ CoreInitializeGcdServices (
       }\r
 \r
       if (GcdMemoryType != EfiGcdMemoryTypeNonExistent) {\r
-\r
         //\r
         // Convert the Resource HOB Attributes to an EFI Memory Capabilities mask\r
         //\r
index c6a698dbd4302c0e4200194430263a2648303dc1..e119b9339e89166f88583958f12bbd56968dfacf 100644 (file)
@@ -181,6 +181,33 @@ CoreUnregisterProtocolNotify (
   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
index 930003304a8969af62b5a99d0f38de6be4d7e982..3c2980301d18817fc68544cbcd2d2e8b5dfa8edc 100644 (file)
@@ -14,41 +14,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \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
@@ -114,10 +83,10 @@ CoreConnectController (
   //\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
@@ -269,7 +238,7 @@ AddSortedDriverBindingProtocol (
       Status = CoreHandleProtocol (\r
                 DriverBindingHandleBuffer[Index],\r
                 &gEfiDriverBindingProtocolGuid,\r
-                (VOID **)&DriverBinding\r
+                (VOID **) &DriverBinding\r
                 );\r
       if (EFI_ERROR (Status) || DriverBinding == NULL) {\r
         continue;\r
@@ -299,7 +268,7 @@ AddSortedDriverBindingProtocol (
   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
@@ -435,7 +404,7 @@ CoreConnectSingleController (
   Status = CoreLocateProtocol (\r
              &gEfiPlatformDriverOverrideProtocolGuid, \r
              NULL, \r
-             (VOID **)&PlatformDriverOverride\r
+             (VOID **) &PlatformDriverOverride\r
              );\r
   if (!EFI_ERROR (Status) && (PlatformDriverOverride != NULL)) {\r
     DriverImageHandle = NULL;\r
@@ -464,7 +433,7 @@ CoreConnectSingleController (
   Status = CoreHandleProtocol (\r
              ControllerHandle,  \r
              &gEfiBusSpecificDriverOverrideProtocolGuid, \r
-             (VOID **)&BusSpecificDriverOverride\r
+             (VOID **) &BusSpecificDriverOverride\r
              );\r
   if (!EFI_ERROR (Status) && (BusSpecificDriverOverride != NULL)) {\r
     DriverImageHandle = NULL;\r
index b07a3a2a58a8e56b899059b80d4b69b0aac716c1..72657d8756cf2d92a5d732e95422c683f87937ee 100644 (file)
@@ -21,7 +21,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 // 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
@@ -139,7 +139,7 @@ CoreFindProtocolEntry (
       // 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
index c8ea7a83a8cf557ef0215bb1f042b677d1a5bf96..373bf9f2d208e0d27cd9f6f94daca7e55d193b58 100644 (file)
@@ -139,10 +139,10 @@ CoreLocateHandle (
   }\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
@@ -154,7 +154,6 @@ CoreLocateHandle (
   //\r
   // Lock the protocol database\r
   //\r
-  \r
   CoreAcquireProtocolLock ();\r
 \r
   //\r
@@ -267,9 +266,8 @@ CoreLocateHandle (
   @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
@@ -307,9 +305,8 @@ CoreGetNextLocateAllHandles (
   @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
@@ -349,7 +346,6 @@ CoreGetNextLocateByRegisterNotify (
 }\r
 \r
 \r
-\r
 /**\r
   Routine to get the next Handle, when you are searching for a given protocol.\r
 \r
@@ -357,9 +353,8 @@ CoreGetNextLocateByRegisterNotify (
   @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
@@ -410,8 +405,6 @@ CoreGetNextLocateByProtocol (
 }\r
 \r
 \r
-\r
-\r
 /**\r
   Locates the handle to a device on the device path that best matches the specified protocol.\r
 \r
@@ -529,9 +522,7 @@ CoreLocateDevicePath (
 }\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
@@ -585,7 +576,7 @@ CoreLocateProtocol (
 \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
@@ -601,9 +592,9 @@ CoreLocateProtocol (
     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
@@ -618,8 +609,6 @@ Done:
 }\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
@@ -639,7 +628,7 @@ Done:
   @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
@@ -699,7 +688,7 @@ CoreLocateHandleBuffer (
              *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
index 395cdd45773520fd9b59eed3bfe855fdb80390e3..67fce28bd2de44d42df92fce92a4164a7ebb37cf 100644 (file)
@@ -71,7 +71,6 @@ CoreRemoveInterfaceFromProtocol (
     //\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
@@ -83,7 +82,6 @@ CoreRemoveInterfaceFromProtocol (
     //\r
     // Remove the protocol interface entry\r
     //\r
-\r
     RemoveEntryList (&Prot->ByProtocol);\r
   }\r
 \r
@@ -91,8 +89,6 @@ CoreRemoveInterfaceFromProtocol (
 }\r
 \r
 \r
-\r
-\r
 /**\r
   Add a new protocol notification record for the request protocol.\r
 \r
@@ -111,11 +107,11 @@ EFIAPI
 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
@@ -136,9 +132,7 @@ CoreRegisterProtocolNotify (
     //\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
@@ -170,8 +164,6 @@ CoreRegisterProtocolNotify (
 }\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
@@ -274,11 +266,11 @@ CoreReinstallProtocolInterface (
   //\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
index b4a1581f1f79b1c6bb1dfdc3a89256aaf91e7bf4..0c4baae2f7e565e10a6ee6a6a80e452534942bfd 100644 (file)
@@ -416,8 +416,8 @@ CoreLoadPeImage (
     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
@@ -466,20 +466,12 @@ CoreLoadPeImage (
     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
@@ -559,7 +551,7 @@ CoreLoadedImageInfo (
   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
@@ -698,7 +690,7 @@ CoreLoadImageCommon (
   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
@@ -1061,12 +1053,7 @@ CoreStartImage (
   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
index e78b88d608d8e9e3dbd2ea359cb637de598cb5eb..c9fc6d632dc4a89a73dbd6b1ce47208a522badbc 100644 (file)
@@ -79,7 +79,7 @@ CoreOpenImageFile (
   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
@@ -252,7 +252,7 @@ CoreOpenImageFile (
             //\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
@@ -277,11 +277,11 @@ CoreOpenImageFile (
 \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
@@ -333,7 +333,6 @@ Done:
 \r
 \r
 \r
-\r
 /**\r
   Read image file (specified by UserHandle) into user specified buffer with specified offset\r
   and length.\r
@@ -449,7 +448,6 @@ CoreGrowBuffer (
   //\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
index cdef6a9ec61394e9c373c544d6953e5ecbd95fdf..34d032bddfeddb006404d772c4b9bd8ae59dc493 100644 (file)
@@ -120,7 +120,7 @@ CoreAllocateZeroBootServicesPool (
   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
@@ -321,7 +321,7 @@ CoreDevicePathSize (
   //\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
@@ -394,8 +394,6 @@ CoreDuplicateDevicePath (
 }\r
 \r
 \r
-\r
-\r
 /**\r
   Function is used to append a Src1 and Src2 together.\r
 \r
@@ -445,8 +443,6 @@ CoreAppendDevicePath (
 }\r
 \r
 \r
-\r
-\r
 /**\r
   Create a protocol notification event and return it.\r
 \r
@@ -479,25 +475,23 @@ CoreCreateProtocolNotifyEvent (
   //\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
index 5da740cb7c4081b3e871d7639cda572fdd9c066a..2bf457267a99b8e338a7cb5491811f5596eeb15c 100644 (file)
@@ -46,8 +46,8 @@ UINTN         mFreeMapStack = 0;
 //\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
@@ -110,8 +110,6 @@ PromoteMemoryResource (
                                  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
@@ -613,7 +611,7 @@ CoreFreeMemoryMapStack (
 **/\r
 VOID\r
 RemoveMemoryMapEntry (\r
-  MEMORY_MAP      *Entry\r
+  IN OUT MEMORY_MAP      *Entry\r
   )\r
 {\r
   RemoveEntryList (&Entry->Link);\r
@@ -1151,9 +1149,6 @@ Done:
 }\r
 \r
 \r
-\r
-\r
-\r
 /**\r
   Frees previous allocated pages.\r
 \r
@@ -1235,8 +1230,6 @@ CoreFreePages (
 }\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
@@ -1373,7 +1366,7 @@ CoreGetMemoryMap (
         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
@@ -1467,7 +1460,7 @@ CoreAllocatePoolPages (
     CoreConvertPages (Start, NumberOfPages, PoolType);\r
   }\r
 \r
-  return (VOID *)(UINTN)Start;\r
+  return (VOID *)(UINTN) Start;\r
 }\r
 \r
 \r
index f0af2b88004493ecf3b4564b283d203aca888955..fe1b239dc68571f28e2607962bf4c281280785b1 100644 (file)
@@ -68,13 +68,15 @@ typedef struct {
     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
@@ -90,14 +92,14 @@ CoreInitializePool (
   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
@@ -119,12 +121,12 @@ LookupPoolHead (
   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
@@ -143,7 +145,7 @@ LookupPoolHead (
       InitializeListHead (&Pool->FreeList[Index]);\r
     }\r
 \r
-    InsertHeadList (&PoolHeadList, &Pool->Link);\r
+    InsertHeadList (&mPoolHeadList, &Pool->Link);\r
 \r
     return Pool;\r
   }\r
@@ -153,7 +155,6 @@ LookupPoolHead (
 \r
  \r
 \r
-\r
 /**\r
   Allocate pool of a particular type.\r
 \r
@@ -331,14 +332,13 @@ Done:
     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
@@ -354,7 +354,6 @@ Done:
   \r
 \r
 \r
-\r
 /**\r
   Frees pool.\r
 \r
@@ -372,7 +371,7 @@ CoreFreePool (
 {\r
   EFI_STATUS Status;\r
 \r
-  if (NULL == Buffer) {\r
+  if (Buffer == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
@@ -486,7 +485,7 @@ CoreFreePoolI (
     //\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
index 56308ed67469f2eb2577c59b6d171834359e5575..80d302659ddab3f6e4a56f64a80c1cd42de9d6da 100644 (file)
@@ -16,13 +16,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #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
index 821595a4f27ed24edf2041dd1308cea17a623b31..de7507e72db1c93c3e624cefaed68aec81d11e24 100644 (file)
@@ -182,7 +182,7 @@ CoreInstallConfigurationTable (
     //\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
index 48143507e4b28448dab48ccf6c2df7a120c78edc..07ada03d2ce72c119ea8465035c80047e3a50f6c 100644 (file)
@@ -99,7 +99,6 @@ typedef struct {
 //\r
 // Local prototypes\r
 //\r
-\r
 /**\r
   Worker function.  Determine if the input stream:child matches the input type.\r
 \r
@@ -123,41 +122,6 @@ ChildIsType (
   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
@@ -177,6 +141,7 @@ FindStreamNode (
   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
@@ -214,6 +179,7 @@ FindChildNode (
   OUT    UINT32                                     *AuthenticationStatus\r
   );\r
   \r
+\r
 /**\r
   Worker function.  Constructor for new child nodes.\r
 \r
@@ -242,6 +208,7 @@ CreateChildNode (
      OUT CORE_SECTION_CHILD_NODE               **ChildNode\r
   );\r
   \r
+\r
 /**\r
   Worker function.  Destructor for child nodes.\r
 \r
@@ -252,7 +219,8 @@ VOID
 FreeChildNode (\r
   IN  CORE_SECTION_CHILD_NODE                   *ChildNode\r
   );\r
-  \r
+\r
+\r
 /**\r
   Worker function.  Constructor for section streams.\r
 \r
@@ -294,7 +262,8 @@ OpenSectionStreamEx (
   IN     UINT32                                    AuthenticationStatus,   \r
      OUT UINTN                                     *SectionStreamHandle\r
   );\r
-  \r
+\r
+\r
 /**\r
   Check if a stream is valid.\r
 \r
@@ -310,6 +279,7 @@ IsValidSectionStream (
   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
@@ -339,7 +309,6 @@ IsValidSectionStream (
   \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
@@ -354,7 +323,6 @@ IsValidSectionStream (
                       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
@@ -403,6 +371,7 @@ CustomGuidedSectionExtract (
   OUT       UINTN                                  *OutputSize,\r
   OUT       UINT32                                 *AuthenticationStatus\r
   );  \r
+\r
 //\r
 // Module globals\r
 //\r
@@ -491,12 +460,12 @@ OpenSectionStream (
   }\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
@@ -608,14 +577,14 @@ GetSection (
     // 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
@@ -648,6 +617,7 @@ GetSection (
   \r
 GetSection_Done:\r
   CoreRestoreTpl (OldTpl);\r
+  \r
   return Status;\r
 }\r
 \r
@@ -744,7 +714,6 @@ ChildIsType (
 }\r
 \r
 \r
-\r
 /**\r
   Worker function  Recursively searches / builds section stream database\r
   looking for requested section.\r
@@ -797,7 +766,7 @@ FindChildNode (
   }\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
@@ -882,7 +851,7 @@ FindChildNode (
       // 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
@@ -900,7 +869,6 @@ FindChildNode (
 }\r
 \r
 \r
-\r
 /**\r
   Worker function.  Constructor for new child nodes.\r
 \r
@@ -1153,120 +1121,6 @@ CreateChildNode (
 }\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
@@ -1443,7 +1297,6 @@ FindStreamNode (
 }\r
 \r
 \r
-\r
 /**\r
   Check if a stream is valid.\r
 \r
@@ -1493,6 +1346,7 @@ IsValidSectionStream (
   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
@@ -1522,7 +1376,6 @@ IsValidSectionStream (
   \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
@@ -1644,7 +1497,7 @@ CustomGuidedSectionExtract (
              OutputBuffer,\r
              ScratchBuffer,\r
              AuthenticationStatus\r
-           );\r
+             );\r
   if (EFI_ERROR (Status)) {\r
     //\r
     // Decode failed\r