From e862cd50c6a12183204ba0fa93403d88fd2e0376 Mon Sep 17 00:00:00 2001 From: oliviermartin Date: Wed, 15 Jun 2011 19:53:15 +0000 Subject: [PATCH] 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 +- .../Library/ArmVExpressLibCTA9x4/CTA9x4.c | 2 +- ArmPlatformPkg/Bds/Bds.c | 13 +-- ArmPlatformPkg/Bds/BootMenu.c | 4 +- ArmPlatformPkg/MemoryInitPei/MemoryInit.c | 2 +- ArmPlatformPkg/PlatformPei/PlatformPei.c | 1 + ArmPlatformPkg/PlatformPei/PlatformPei.inf | 1 + ArmPlatformPkg/Sec/Sec.c | 2 +- EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c | 2 + 12 files changed, 36 insertions(+), 89 deletions(-) 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 { diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4.c b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4.c index 8415842fb5..c72a5a4cba 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4.c +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4.c @@ -23,7 +23,7 @@ #include #include -#define SerialPrint(txt) SerialPortWrite (txt, AsciiStrLen(txt)+1); +#define SerialPrint(txt) SerialPortWrite ((UINT8*)(txt), AsciiStrLen(txt)+1); // DDR2 timings PL341_DMC_CONFIG DDRTimings = { diff --git a/ArmPlatformPkg/Bds/Bds.c b/ArmPlatformPkg/Bds/Bds.c index 415f0a9cb2..8f6e82073f 100644 --- a/ArmPlatformPkg/Bds/Bds.c +++ b/ArmPlatformPkg/Bds/Bds.c @@ -117,13 +117,16 @@ InitializeConsolePipe ( // We convert back to the text representation of the device Path EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol; CHAR16* DevicePathTxt; + EFI_STATUS Status; + + Status = gBS->LocateProtocol(&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol); + if (!EFI_ERROR(Status)) { + DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText (DevicePath, TRUE, TRUE); - ASSERT_EFI_ERROR(gBS->LocateProtocol(&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol)); - DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText (DevicePath, TRUE, TRUE); + DEBUG((EFI_D_ERROR,"Fail to start the console with the Device Path '%s'. (Error '%r')\n", DevicePathTxt, Status)); - DEBUG((EFI_D_ERROR,"Fail to start the console with the Device Path '%s'. (Error '%r')\n", DevicePathTxt, Status)); - - FreePool (DevicePathTxt); + FreePool (DevicePathTxt); + } } DEBUG_CODE_END(); diff --git a/ArmPlatformPkg/Bds/BootMenu.c b/ArmPlatformPkg/Bds/BootMenu.c index a2360d14f5..1bcf2ad00f 100644 --- a/ArmPlatformPkg/Bds/BootMenu.c +++ b/ArmPlatformPkg/Bds/BootMenu.c @@ -38,7 +38,8 @@ BootMenuAddBootOption ( EFI_DEVICE_PATH* DevicePath; EFI_DEVICE_PATH_PROTOCOL *DevicePathNode; - Attributes = 0; + Attributes = 0; + SupportedBootDevice = NULL; // // List the Boot Devices supported @@ -402,6 +403,7 @@ BootMenuMain ( UINTN Index; UINTN BootMainEntryCount; + BootOption = NULL; BootMainEntryCount = sizeof(BootMainEntries) / sizeof(struct BOOT_MAIN_ENTRY); // Get Boot#### list diff --git a/ArmPlatformPkg/MemoryInitPei/MemoryInit.c b/ArmPlatformPkg/MemoryInitPei/MemoryInit.c index 4b31de96b1..3c7588f8c2 100644 --- a/ArmPlatformPkg/MemoryInitPei/MemoryInit.c +++ b/ArmPlatformPkg/MemoryInitPei/MemoryInit.c @@ -122,7 +122,7 @@ InitializeMemory ( // Ensure PcdSystemMemorySize has been set ASSERT (FixedPcdGet32 (PcdSystemMemorySize) != 0); - SystemMemoryTop = FixedPcdGet32 (PcdSystemMemoryBase) + FixedPcdGet32 (PcdSystemMemorySize); + SystemMemoryTop = (UINTN)FixedPcdGet32 (PcdSystemMemoryBase) + (UINTN)FixedPcdGet32 (PcdSystemMemorySize); // // Initialize the System Memory (DRAM) diff --git a/ArmPlatformPkg/PlatformPei/PlatformPei.c b/ArmPlatformPkg/PlatformPei/PlatformPei.c index 4c0ae2141d..3ccbbfd2d7 100644 --- a/ArmPlatformPkg/PlatformPei/PlatformPei.c +++ b/ArmPlatformPkg/PlatformPei/PlatformPei.c @@ -24,6 +24,7 @@ // // The Library classes this module consumes // +#include #include #include #include diff --git a/ArmPlatformPkg/PlatformPei/PlatformPei.inf b/ArmPlatformPkg/PlatformPei/PlatformPei.inf index 92cf3aa4dc..bbc5f1a028 100644 --- a/ArmPlatformPkg/PlatformPei/PlatformPei.inf +++ b/ArmPlatformPkg/PlatformPei/PlatformPei.inf @@ -32,6 +32,7 @@ [Packages] MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec EmbeddedPkg/EmbeddedPkg.dec ArmPkg/ArmPkg.dec ArmPlatformPkg/ArmPlatformPkg.dec diff --git a/ArmPlatformPkg/Sec/Sec.c b/ArmPlatformPkg/Sec/Sec.c index 64cf0f0d7e..98fe51256c 100644 --- a/ArmPlatformPkg/Sec/Sec.c +++ b/ArmPlatformPkg/Sec/Sec.c @@ -27,7 +27,7 @@ #define ARM_PRIMARY_CORE 0 -#define SerialPrint(txt) SerialPortWrite (txt, AsciiStrLen(txt)+1); +#define SerialPrint(txt) SerialPortWrite ((UINT8*)txt, AsciiStrLen(txt)+1); extern VOID *monitor_vector_table; diff --git a/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c b/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c index 138e87e7a8..7341d9f9b8 100644 --- a/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c +++ b/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c @@ -89,8 +89,10 @@ PrintCSD ( ) { UINTN Value; +#if !defined(MDEPKG_NDEBUG) CONST CHAR8* str_unit[] = { "100kbit/s","1Mbit/s","10Mbit/s","100MBit/s","Unkbown","Unkbown","Unkbown","Unkbown" }; CONST CHAR8* str_value[] = { "1.0","1.2","1.3","1.5","2.0","2.5","3.0","3.5","4.0","4.5","5.0","Unknown","Unknown","Unknown","Unknown" }; +#endif if (((Csd[2] >> 30) & 0x3) == 0) { DEBUG((EFI_D_ERROR, "- PrintCSD Version 1.01-1.10/Version 2.00/Standard Capacity\n")); -- 2.39.2