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/DxeMain/DxeMain.c | 57 +++++++++-------------- MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c | 9 ++-- 2 files changed, 24 insertions(+), 42 deletions(-) (limited to 'MdeModulePkg/Core/Dxe/DxeMain') 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++) { -- cgit v1.2.3