Revision: 17527
http://sourceforge.net/p/edk2/code/17527
Author: oliviermartin
Date: 2015-05-27 15:11:19 +0000 (Wed, 27 May 2015)
Log Message:
-----------
EmbeddedPkg: 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 <[email protected]>
Reviewed-by: Olivier Martin <[email protected]>
Modified Paths:
--------------
trunk/edk2/ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.c
Modified: trunk/edk2/ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.c
===================================================================
--- trunk/edk2/ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.c 2015-05-27
15:10:10 UTC (rev 17526)
+++ trunk/edk2/ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.c 2015-05-27
15:11:19 UTC (rev 17527)
@@ -325,14 +325,23 @@
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 @@
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");
}
------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits