]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools/VolInfo: Correct alignment attributes display
authorKonstantin Aladyshev <aladyshev22@gmail.com>
Wed, 13 Jul 2022 13:11:02 +0000 (21:11 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sun, 24 Jul 2022 07:51:10 +0000 (07:51 +0000)
Alignment attribute is not a bitmask, therefore we need to compare
field value with all alignment defines.
Remove duplicate print statements. Unify indent with other attribute
print statements.

Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Reviewed-by: Yuwei Chen <yuwei.chen@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
BaseTools/Source/C/VolInfo/VolInfo.c

index 2457ddd2e7f2da7b17dd8fe78dce822e2375f6fb..8b6fcffa4872ac48b07a784aba1a8f2d8161e50f 100644 (file)
@@ -911,140 +911,134 @@ Returns:
     printf ("       EFI_FVB2_WRITE_LOCK_STATUS\n");\r
   }\r
 \r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_1) {\r
+  switch (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT) {\r
+    case EFI_FVB2_ALIGNMENT_1:\r
     printf ("       EFI_FVB2_ALIGNMENT_1\n");\r
-  }\r
-\r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2) {\r
-    printf ("        EFI_FVB2_ALIGNMENT_2\n");\r
-  }\r
-\r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_4) {\r
-    printf ("        EFI_FVB2_ALIGNMENT_4\n");\r
-  }\r
+    break;\r
 \r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_8) {\r
-    printf ("        EFI_FVB2_ALIGNMENT_8\n");\r
-  }\r
+    case EFI_FVB2_ALIGNMENT_2:\r
+    printf ("       EFI_FVB2_ALIGNMENT_2\n");\r
+    break;\r
 \r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_16) {\r
-    printf ("        EFI_FVB2_ALIGNMENT_16\n");\r
-  }\r
+    case EFI_FVB2_ALIGNMENT_4:\r
+    printf ("       EFI_FVB2_ALIGNMENT_4\n");\r
+    break;\r
 \r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_32) {\r
-    printf ("        EFI_FVB2_ALIGNMENT_32\n");\r
-  }\r
+    case EFI_FVB2_ALIGNMENT_8:\r
+    printf ("       EFI_FVB2_ALIGNMENT_8\n");\r
+    break;\r
 \r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64) {\r
-    printf ("        EFI_FVB2_ALIGNMENT_64\n");\r
-  }\r
+    case EFI_FVB2_ALIGNMENT_16:\r
+    printf ("       EFI_FVB2_ALIGNMENT_16\n");\r
+    break;\r
 \r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_128) {\r
-    printf ("        EFI_FVB2_ALIGNMENT_128\n");\r
-  }\r
+    case EFI_FVB2_ALIGNMENT_32:\r
+    printf ("       EFI_FVB2_ALIGNMENT_32\n");\r
+    break;\r
 \r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_256) {\r
-    printf ("        EFI_FVB2_ALIGNMENT_256\n");\r
-  }\r
+    case EFI_FVB2_ALIGNMENT_64:\r
+    printf ("       EFI_FVB2_ALIGNMENT_64\n");\r
+    break;\r
 \r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_512) {\r
-    printf ("        EFI_FVB2_ALIGNMENT_512\n");\r
-  }\r
+    case EFI_FVB2_ALIGNMENT_128:\r
+    printf ("       EFI_FVB2_ALIGNMENT_128\n");\r
+    break;\r
 \r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_1K) {\r
-    printf ("        EFI_FVB2_ALIGNMENT_1K\n");\r
-  }\r
+    case EFI_FVB2_ALIGNMENT_256:\r
+    printf ("       EFI_FVB2_ALIGNMENT_256\n");\r
+    break;\r
 \r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2K) {\r
-    printf ("        EFI_FVB2_ALIGNMENT_2K\n");\r
-  }\r
+    case EFI_FVB2_ALIGNMENT_512:\r
+    printf ("       EFI_FVB2_ALIGNMENT_512\n");\r
+    break;\r
 \r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_4K) {\r
-    printf ("        EFI_FVB2_ALIGNMENT_4K\n");\r
-  }\r
+    case EFI_FVB2_ALIGNMENT_1K:\r
+    printf ("       EFI_FVB2_ALIGNMENT_1K\n");\r
+    break;\r
 \r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_8K) {\r
-    printf ("        EFI_FVB2_ALIGNMENT_8K\n");\r
-  }\r
+    case EFI_FVB2_ALIGNMENT_2K:\r
+    printf ("       EFI_FVB2_ALIGNMENT_2K\n");\r
+    break;\r
 \r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_16K) {\r
-    printf ("        EFI_FVB2_ALIGNMENT_16K\n");\r
-  }\r
+    case EFI_FVB2_ALIGNMENT_4K:\r
+    printf ("       EFI_FVB2_ALIGNMENT_4K\n");\r
+    break;\r
 \r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_32K) {\r
-    printf ("        EFI_FVB2_ALIGNMENT_32K\n");\r
-  }\r
+    case EFI_FVB2_ALIGNMENT_8K:\r
+    printf ("       EFI_FVB2_ALIGNMENT_8K\n");\r
+    break;\r
 \r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64K) {\r
-    printf ("        EFI_FVB2_ALIGNMENT_64K\n");\r
-  }\r
+    case EFI_FVB2_ALIGNMENT_16K:\r
+    printf ("       EFI_FVB2_ALIGNMENT_16K\n");\r
+    break;\r
 \r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_128K) {\r
-    printf ("        EFI_FVB2_ALIGNMENT_128K\n");\r
-  }\r
+    case EFI_FVB2_ALIGNMENT_32K:\r
+    printf ("       EFI_FVB2_ALIGNMENT_32K\n");\r
+    break;\r
 \r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_256K) {\r
-    printf ("        EFI_FVB2_ALIGNMENT_256K\n");\r
-  }\r
+    case EFI_FVB2_ALIGNMENT_64K:\r
+    printf ("       EFI_FVB2_ALIGNMENT_64K\n");\r
+    break;\r
 \r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_512K) {\r
-    printf ("        EFI_FVB2_ALIGNMENT_512K\n");\r
-  }\r
+    case EFI_FVB2_ALIGNMENT_128K:\r
+    printf ("       EFI_FVB2_ALIGNMENT_128K\n");\r
+    break;\r
 \r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_1M) {\r
-    printf ("        EFI_FVB2_ALIGNMENT_1M\n");\r
-  }\r
+    case EFI_FVB2_ALIGNMENT_256K:\r
+    printf ("       EFI_FVB2_ALIGNMENT_256K\n");\r
+    break;\r
 \r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2M) {\r
-    printf ("        EFI_FVB2_ALIGNMENT_2M\n");\r
-  }\r
+    case EFI_FVB2_ALIGNMENT_512K:\r
+    printf ("       EFI_FVB2_ALIGNMENT_512K\n");\r
+    break;\r
 \r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_4M) {\r
-    printf ("        EFI_FVB2_ALIGNMENT_4M\n");\r
-  }\r
+    case EFI_FVB2_ALIGNMENT_1M:\r
+    printf ("       EFI_FVB2_ALIGNMENT_1M\n");\r
+    break;\r
 \r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_8M) {\r
-    printf ("        EFI_FVB2_ALIGNMENT_8M\n");\r
-  }\r
+    case EFI_FVB2_ALIGNMENT_2M:\r
+    printf ("       EFI_FVB2_ALIGNMENT_2M\n");\r
+    break;\r
 \r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_16M) {\r
-    printf ("        EFI_FVB2_ALIGNMENT_16M\n");\r
-  }\r
+    case EFI_FVB2_ALIGNMENT_4M:\r
+    printf ("       EFI_FVB2_ALIGNMENT_4M\n");\r
+    break;\r
 \r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_32M) {\r
-    printf ("        EFI_FVB2_ALIGNMENT_32M\n");\r
-  }\r
+    case EFI_FVB2_ALIGNMENT_8M:\r
+    printf ("       EFI_FVB2_ALIGNMENT_8M\n");\r
+    break;\r
 \r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64M) {\r
-    printf ("        EFI_FVB2_ALIGNMENT_64M\n");\r
-  }\r
+    case EFI_FVB2_ALIGNMENT_16M:\r
+    printf ("       EFI_FVB2_ALIGNMENT_16M\n");\r
+    break;\r
 \r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_128M) {\r
-    printf ("        EFI_FVB2_ALIGNMENT_128M\n");\r
-  }\r
+    case EFI_FVB2_ALIGNMENT_32M:\r
+    printf ("       EFI_FVB2_ALIGNMENT_32M\n");\r
+    break;\r
 \r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64M) {\r
-    printf ("        EFI_FVB2_ALIGNMENT_64M\n");\r
-  }\r
+    case EFI_FVB2_ALIGNMENT_64M:\r
+    printf ("       EFI_FVB2_ALIGNMENT_64M\n");\r
+    break;\r
 \r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_128M) {\r
-    printf ("        EFI_FVB2_ALIGNMENT_128M\n");\r
-  }\r
+    case EFI_FVB2_ALIGNMENT_128M:\r
+    printf ("       EFI_FVB2_ALIGNMENT_128M\n");\r
+    break;\r
 \r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_256M) {\r
-    printf ("        EFI_FVB2_ALIGNMENT_256M\n");\r
-  }\r
+    case EFI_FVB2_ALIGNMENT_256M:\r
+    printf ("       EFI_FVB2_ALIGNMENT_256M\n");\r
+    break;\r
 \r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_512M) {\r
-    printf ("        EFI_FVB2_ALIGNMENT_512M\n");\r
-  }\r
+    case EFI_FVB2_ALIGNMENT_512M:\r
+    printf ("       EFI_FVB2_ALIGNMENT_512M\n");\r
+    break;\r
 \r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_1G) {\r
-    printf ("        EFI_FVB2_ALIGNMENT_1G\n");\r
-  }\r
+    case EFI_FVB2_ALIGNMENT_1G:\r
+    printf ("       EFI_FVB2_ALIGNMENT_1G\n");\r
+    break;\r
 \r
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2G) {\r
-    printf ("        EFI_FVB2_ALIGNMENT_2G\n");\r
+    case EFI_FVB2_ALIGNMENT_2G:\r
+    printf ("       EFI_FVB2_ALIGNMENT_2G\n");\r
+    break;\r
   }\r
 \r
 #endif\r