From e862cd50c6a12183204ba0fa93403d88fd2e0376 Mon Sep 17 00:00:00 2001 From: oliviermartin Date: Wed, 15 Jun 2011 19:53:15 +0000 Subject: ArmPkg: Fix warnings raised by ARMGCC git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11829 6f19259b-4bc3-4df7-8a09-765794883524 --- ArmPkg/Drivers/PL180MciDxe/PL180Mci.c | 6 ++ ArmPkg/Library/BdsLib/BdsAppLoader.c | 79 +--------------------- ArmPkg/Library/BdsLib/BdsFilePath.c | 7 +- .../DebugPeCoffExtraActionLib.c | 6 +- 4 files changed, 18 insertions(+), 80 deletions(-) (limited to 'ArmPkg') diff --git a/ArmPkg/Drivers/PL180MciDxe/PL180Mci.c b/ArmPkg/Drivers/PL180MciDxe/PL180Mci.c index 0a2a02aacf..697e33f0d0 100644 --- a/ArmPkg/Drivers/PL180MciDxe/PL180Mci.c +++ b/ArmPkg/Drivers/PL180MciDxe/PL180Mci.c @@ -60,6 +60,11 @@ MciIsReadOnly ( return (MmioRead32(FixedPcdGet32(PcdPL180SysMciRegAddress)) & 2); } +#if 0 +//Note: This function has been commented out because it is not used yet. +// This function could be used to remove the hardcoded BlockLen used +// in MciPrepareDataPath + // Convert block size to 2^n STATIC UINT32 @@ -79,6 +84,7 @@ GetPow2BlockLen ( return Pow2BlockLen; } +#endif VOID MciPrepareDataPath ( diff --git a/ArmPkg/Library/BdsLib/BdsAppLoader.c b/ArmPkg/Library/BdsLib/BdsAppLoader.c index d14e3c5dcc..8b778b27f7 100644 --- a/ArmPkg/Library/BdsLib/BdsAppLoader.c +++ b/ArmPkg/Library/BdsLib/BdsAppLoader.c @@ -14,82 +14,7 @@ #include "BdsInternal.h" -//#include -#include - -//TODO: RemoveMe -#include - -/** - Retrieves the magic value from the PE/COFF header. - - @param Hdr The buffer in which to return the PE32, PE32+, or TE header. - - @return EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC - Image is PE32 - @return EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC - Image is PE32+ - -**/ -UINT16 -PeCoffLoaderGetPeHeaderMagicValue ( - IN EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr - ) -{ - // - // NOTE: Some versions of Linux ELILO for Itanium have an incorrect magic value - // in the PE/COFF Header. If the MachineType is Itanium(IA64) and the - // Magic value in the OptionalHeader is EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC - // then override the returned value to EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC - // - if (Hdr.Pe32->FileHeader.Machine == IMAGE_FILE_MACHINE_IA64 && Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) { - return EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC; - } - // - // Return the magic value from the PC/COFF Optional Header - // - return Hdr.Pe32->OptionalHeader.Magic; -} - -STATIC -BOOLEAN -IsLoadableImage ( - VOID* Image - ) -{ - UINT16 Magic; - EFI_IMAGE_DOS_HEADER *DosHeader; - EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Header; - - if (Image == NULL) { - return FALSE; - } - - DosHeader = (EFI_IMAGE_DOS_HEADER*)Image; - if (DosHeader->e_magic == EFI_IMAGE_DOS_SIGNATURE) { - Header.Pe32 = (EFI_IMAGE_NT_HEADERS32*)((UINT8*)Image + DosHeader->e_lfanew); - } else { - Header.Pe32 = (EFI_IMAGE_NT_HEADERS32*)(Image); - } - - if (Header.Te->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) { - // It is a TE Image - return TRUE; - } else if (Header.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) { - Magic = PeCoffLoaderGetPeHeaderMagicValue (Header); - if (Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) { - // It is a PE32 Image - return TRUE; - } else if (Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) { - // It is a PE32+ Image - return TRUE; - } else { - DEBUG ((EFI_D_ERROR,"BdsLoadBinaryFromPath(): Fail unrecognized PE Image\n")); - } - } else { - DEBUG ((EFI_D_ERROR,"BdsLoadBinaryFromPath(): Fail unrecognize image\n")); - } - - return FALSE; -} +//#include STATIC EFI_STATUS @@ -186,7 +111,6 @@ BdsLoadApplication ( EFI_STATUS Status; UINTN NoHandles, HandleIndex; EFI_HANDLE *Handles; - EFI_DEVICE_PATH *FvDevicePath; EFI_DEVICE_PATH *EfiAppDevicePath; // Need to connect every drivers to ensure no dependencies are missing for the application @@ -205,6 +129,7 @@ BdsLoadApplication ( // Search in all Firmware Volume for the EFI Application for (HandleIndex = 0; HandleIndex < NoHandles; HandleIndex++) { + EfiAppDevicePath = NULL; Status = BdsLoadFileFromFirmwareVolume (Handles[HandleIndex], EfiApp, EFI_FV_FILETYPE_APPLICATION, &EfiAppDevicePath); if (!EFI_ERROR (Status)) { // Start the application diff --git a/ArmPkg/Library/BdsLib/BdsFilePath.c b/ArmPkg/Library/BdsLib/BdsFilePath.c index f7a06e5a89..be1a824d50 100644 --- a/ArmPkg/Library/BdsLib/BdsFilePath.c +++ b/ArmPkg/Library/BdsLib/BdsFilePath.c @@ -264,8 +264,11 @@ TryRemovableDevice ( EFI_DEVICE_PATH* RemovableDevicePath; BOOLEAN RemovableFound; - RemovableFound = FALSE; - TmpDevicePath = DevicePath; + RemovableDevice = NULL; + RemovableDevicePath = NULL; + RemovableFound = FALSE; + TmpDevicePath = DevicePath; + while (!IsDevicePathEnd (TmpDevicePath) && !RemovableFound) { for (Index = 0; Index < sizeof(RemovableDeviceSupport) / sizeof(BDS_REMOVABLE_DEVICE_SUPPORT); Index++) { RemovableDevice = &RemovableDeviceSupport[Index]; diff --git a/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.c b/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.c index 4b95bdf54c..ad75f616ee 100755 --- a/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.c +++ b/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.c @@ -77,7 +77,9 @@ PeCoffLoaderRelocateImageExtraAction ( IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext ) { - CHAR8 Temp[512]; +#if !defined(MDEPKG_NDEBUG) + CHAR8 Temp[512]; +#endif #ifdef __CC_ARM // Print out the command for the RVD debugger to load symbols for this image @@ -108,7 +110,9 @@ PeCoffLoaderUnloadImageExtraAction ( IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext ) { +#if !defined(MDEPKG_NDEBUG) CHAR8 Temp[512]; +#endif #ifdef __CC_ARM { -- cgit v1.2.3