Thanks for catching that! Reviewed-By: Olivier Martin <olivier.mar...@arm.com>
-----Original Message----- From: Heyi Guo [mailto:heyi....@linaro.org] Sent: 19 May 2015 02:29 To: Olivier Martin Cc: edk2-devel@lists.sourceforge.net; leif.lindh...@linaro.org; ilias.bi...@linaro.org; Heyi Guo Subject: [edk2] [PATCH] Fix Ebl dumpgcd bug with memory type and IO type 1. Data type for GcdMemoryType and GcdIoType is enumeration type rather than bit field, so we need to use strict equation "==" instead of bit-and "&"; 2. Testing for GcdIoType should use EfiGcdIoType*** constants rather than EfiGcdMemoryType***; 3. As we are going to use strict equation, it is clearer to use switch-case than if-else. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Heyi Guo <heyi....@linaro.org> --- ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.c | 31 +++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.c b/ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.c index 8999910..4a5f2be 100644 --- a/ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.c +++ b/ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.c @@ -325,14 +325,23 @@ EblDumpGcd ( if (MemorySpaceMap[i].Attributes & EFI_MEMORY_XP) AsciiPrint (" MEM_XP"); - if (MemorySpaceMap[i].GcdMemoryType & EfiGcdMemoryTypeNonExistent) + switch (MemorySpaceMap[i].GcdMemoryType) { + case EfiGcdMemoryTypeNonExistent: AsciiPrint (" TYPE_NONEXISTENT"); - if (MemorySpaceMap[i].GcdMemoryType & EfiGcdMemoryTypeReserved) + break; + case EfiGcdMemoryTypeReserved: AsciiPrint (" TYPE_RESERVED"); - if (MemorySpaceMap[i].GcdMemoryType & EfiGcdMemoryTypeSystemMemory) + break; + case EfiGcdMemoryTypeSystemMemory: AsciiPrint (" TYPE_SYSMEM"); - if (MemorySpaceMap[i].GcdMemoryType & EfiGcdMemoryTypeMemoryMappedIo) + break; + case EfiGcdMemoryTypeMemoryMappedIo: AsciiPrint (" TYPE_MEMMAP"); + break; + default: + AsciiPrint (" TYPE_UNKNOWN"); + break; + } AsciiPrint ("\n"); } @@ -347,12 +356,20 @@ EblDumpGcd ( AsciiPrint ("IO %08lx - %08lx",IoSpaceMap[i].BaseAddress,IoSpaceMap[i].BaseAddress+IoSpaceMap[i].Length); AsciiPrint ("\t%08x %08x",IoSpaceMap[i].ImageHandle,IoSpaceMap[i].DeviceHandle); - if (IoSpaceMap[i].GcdIoType & EfiGcdMemoryTypeNonExistent) + switch (IoSpaceMap[i].GcdIoType) { + case EfiGcdIoTypeNonExistent: AsciiPrint (" TYPE_NONEXISTENT"); - if (IoSpaceMap[i].GcdIoType & EfiGcdMemoryTypeReserved) + break; + case EfiGcdIoTypeReserved: AsciiPrint (" TYPE_RESERVED"); - if (IoSpaceMap[i].GcdIoType & EfiGcdIoTypeIo) + break; + case EfiGcdIoTypeIo: AsciiPrint (" TYPE_IO"); + break; + default: + AsciiPrint (" TYPE_UNKNOWN"); + break; + } AsciiPrint ("\n"); } -- 2.1.4 -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2557590 ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2548782 ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel