public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] BaseTools/VolInfo: Correct alignment attributes display
@ 2022-07-13 13:11 Konstantin Aladyshev
  2022-07-22  6:45 ` [edk2-devel] " Yuwei Chen
  2022-07-24  5:28 ` Bob Feng
  0 siblings, 2 replies; 3+ messages in thread
From: Konstantin Aladyshev @ 2022-07-13 13:11 UTC (permalink / raw)
  To: devel; +Cc: bob.c.feng, gaoliming, yuwei.chen, Konstantin Aladyshev

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>
---
 BaseTools/Source/C/VolInfo/VolInfo.c | 198 +++++++++++++--------------
 1 file changed, 96 insertions(+), 102 deletions(-)

diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c b/BaseTools/Source/C/VolInfo/VolInfo.c
index 2457ddd2e7..8b6fcffa48 100644
--- a/BaseTools/Source/C/VolInfo/VolInfo.c
+++ b/BaseTools/Source/C/VolInfo/VolInfo.c
@@ -911,140 +911,134 @@ Returns:
     printf ("       EFI_FVB2_WRITE_LOCK_STATUS\n");
   }
 
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_1) {
+  switch (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT) {
+    case EFI_FVB2_ALIGNMENT_1:
     printf ("       EFI_FVB2_ALIGNMENT_1\n");
-  }
-
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2) {
-    printf ("        EFI_FVB2_ALIGNMENT_2\n");
-  }
-
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_4) {
-    printf ("        EFI_FVB2_ALIGNMENT_4\n");
-  }
+    break;
 
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_8) {
-    printf ("        EFI_FVB2_ALIGNMENT_8\n");
-  }
+    case EFI_FVB2_ALIGNMENT_2:
+    printf ("       EFI_FVB2_ALIGNMENT_2\n");
+    break;
 
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_16) {
-    printf ("        EFI_FVB2_ALIGNMENT_16\n");
-  }
+    case EFI_FVB2_ALIGNMENT_4:
+    printf ("       EFI_FVB2_ALIGNMENT_4\n");
+    break;
 
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_32) {
-    printf ("        EFI_FVB2_ALIGNMENT_32\n");
-  }
+    case EFI_FVB2_ALIGNMENT_8:
+    printf ("       EFI_FVB2_ALIGNMENT_8\n");
+    break;
 
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64) {
-    printf ("        EFI_FVB2_ALIGNMENT_64\n");
-  }
+    case EFI_FVB2_ALIGNMENT_16:
+    printf ("       EFI_FVB2_ALIGNMENT_16\n");
+    break;
 
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_128) {
-    printf ("        EFI_FVB2_ALIGNMENT_128\n");
-  }
+    case EFI_FVB2_ALIGNMENT_32:
+    printf ("       EFI_FVB2_ALIGNMENT_32\n");
+    break;
 
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_256) {
-    printf ("        EFI_FVB2_ALIGNMENT_256\n");
-  }
+    case EFI_FVB2_ALIGNMENT_64:
+    printf ("       EFI_FVB2_ALIGNMENT_64\n");
+    break;
 
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_512) {
-    printf ("        EFI_FVB2_ALIGNMENT_512\n");
-  }
+    case EFI_FVB2_ALIGNMENT_128:
+    printf ("       EFI_FVB2_ALIGNMENT_128\n");
+    break;
 
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_1K) {
-    printf ("        EFI_FVB2_ALIGNMENT_1K\n");
-  }
+    case EFI_FVB2_ALIGNMENT_256:
+    printf ("       EFI_FVB2_ALIGNMENT_256\n");
+    break;
 
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2K) {
-    printf ("        EFI_FVB2_ALIGNMENT_2K\n");
-  }
+    case EFI_FVB2_ALIGNMENT_512:
+    printf ("       EFI_FVB2_ALIGNMENT_512\n");
+    break;
 
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_4K) {
-    printf ("        EFI_FVB2_ALIGNMENT_4K\n");
-  }
+    case EFI_FVB2_ALIGNMENT_1K:
+    printf ("       EFI_FVB2_ALIGNMENT_1K\n");
+    break;
 
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_8K) {
-    printf ("        EFI_FVB2_ALIGNMENT_8K\n");
-  }
+    case EFI_FVB2_ALIGNMENT_2K:
+    printf ("       EFI_FVB2_ALIGNMENT_2K\n");
+    break;
 
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_16K) {
-    printf ("        EFI_FVB2_ALIGNMENT_16K\n");
-  }
+    case EFI_FVB2_ALIGNMENT_4K:
+    printf ("       EFI_FVB2_ALIGNMENT_4K\n");
+    break;
 
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_32K) {
-    printf ("        EFI_FVB2_ALIGNMENT_32K\n");
-  }
+    case EFI_FVB2_ALIGNMENT_8K:
+    printf ("       EFI_FVB2_ALIGNMENT_8K\n");
+    break;
 
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64K) {
-    printf ("        EFI_FVB2_ALIGNMENT_64K\n");
-  }
+    case EFI_FVB2_ALIGNMENT_16K:
+    printf ("       EFI_FVB2_ALIGNMENT_16K\n");
+    break;
 
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_128K) {
-    printf ("        EFI_FVB2_ALIGNMENT_128K\n");
-  }
+    case EFI_FVB2_ALIGNMENT_32K:
+    printf ("       EFI_FVB2_ALIGNMENT_32K\n");
+    break;
 
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_256K) {
-    printf ("        EFI_FVB2_ALIGNMENT_256K\n");
-  }
+    case EFI_FVB2_ALIGNMENT_64K:
+    printf ("       EFI_FVB2_ALIGNMENT_64K\n");
+    break;
 
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_512K) {
-    printf ("        EFI_FVB2_ALIGNMENT_512K\n");
-  }
+    case EFI_FVB2_ALIGNMENT_128K:
+    printf ("       EFI_FVB2_ALIGNMENT_128K\n");
+    break;
 
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_1M) {
-    printf ("        EFI_FVB2_ALIGNMENT_1M\n");
-  }
+    case EFI_FVB2_ALIGNMENT_256K:
+    printf ("       EFI_FVB2_ALIGNMENT_256K\n");
+    break;
 
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2M) {
-    printf ("        EFI_FVB2_ALIGNMENT_2M\n");
-  }
+    case EFI_FVB2_ALIGNMENT_512K:
+    printf ("       EFI_FVB2_ALIGNMENT_512K\n");
+    break;
 
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_4M) {
-    printf ("        EFI_FVB2_ALIGNMENT_4M\n");
-  }
+    case EFI_FVB2_ALIGNMENT_1M:
+    printf ("       EFI_FVB2_ALIGNMENT_1M\n");
+    break;
 
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_8M) {
-    printf ("        EFI_FVB2_ALIGNMENT_8M\n");
-  }
+    case EFI_FVB2_ALIGNMENT_2M:
+    printf ("       EFI_FVB2_ALIGNMENT_2M\n");
+    break;
 
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_16M) {
-    printf ("        EFI_FVB2_ALIGNMENT_16M\n");
-  }
+    case EFI_FVB2_ALIGNMENT_4M:
+    printf ("       EFI_FVB2_ALIGNMENT_4M\n");
+    break;
 
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_32M) {
-    printf ("        EFI_FVB2_ALIGNMENT_32M\n");
-  }
+    case EFI_FVB2_ALIGNMENT_8M:
+    printf ("       EFI_FVB2_ALIGNMENT_8M\n");
+    break;
 
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64M) {
-    printf ("        EFI_FVB2_ALIGNMENT_64M\n");
-  }
+    case EFI_FVB2_ALIGNMENT_16M:
+    printf ("       EFI_FVB2_ALIGNMENT_16M\n");
+    break;
 
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_128M) {
-    printf ("        EFI_FVB2_ALIGNMENT_128M\n");
-  }
+    case EFI_FVB2_ALIGNMENT_32M:
+    printf ("       EFI_FVB2_ALIGNMENT_32M\n");
+    break;
 
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64M) {
-    printf ("        EFI_FVB2_ALIGNMENT_64M\n");
-  }
+    case EFI_FVB2_ALIGNMENT_64M:
+    printf ("       EFI_FVB2_ALIGNMENT_64M\n");
+    break;
 
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_128M) {
-    printf ("        EFI_FVB2_ALIGNMENT_128M\n");
-  }
+    case EFI_FVB2_ALIGNMENT_128M:
+    printf ("       EFI_FVB2_ALIGNMENT_128M\n");
+    break;
 
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_256M) {
-    printf ("        EFI_FVB2_ALIGNMENT_256M\n");
-  }
+    case EFI_FVB2_ALIGNMENT_256M:
+    printf ("       EFI_FVB2_ALIGNMENT_256M\n");
+    break;
 
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_512M) {
-    printf ("        EFI_FVB2_ALIGNMENT_512M\n");
-  }
+    case EFI_FVB2_ALIGNMENT_512M:
+    printf ("       EFI_FVB2_ALIGNMENT_512M\n");
+    break;
 
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_1G) {
-    printf ("        EFI_FVB2_ALIGNMENT_1G\n");
-  }
+    case EFI_FVB2_ALIGNMENT_1G:
+    printf ("       EFI_FVB2_ALIGNMENT_1G\n");
+    break;
 
-  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2G) {
-    printf ("        EFI_FVB2_ALIGNMENT_2G\n");
+    case EFI_FVB2_ALIGNMENT_2G:
+    printf ("       EFI_FVB2_ALIGNMENT_2G\n");
+    break;
   }
 
 #endif
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [edk2-devel] [PATCH] BaseTools/VolInfo: Correct alignment attributes display
  2022-07-13 13:11 [PATCH] BaseTools/VolInfo: Correct alignment attributes display Konstantin Aladyshev
@ 2022-07-22  6:45 ` Yuwei Chen
  2022-07-24  5:28 ` Bob Feng
  1 sibling, 0 replies; 3+ messages in thread
From: Yuwei Chen @ 2022-07-22  6:45 UTC (permalink / raw)
  To: devel@edk2.groups.io, aladyshev22@gmail.com; +Cc: Feng, Bob C, Gao, Liming

Reviewed-by: Yuwei Chen<yuwei.chen@intel.com>

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of
> Konstantin Aladyshev
> Sent: Wednesday, July 13, 2022 9:11 PM
> To: devel@edk2.groups.io
> Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming
> <gaoliming@byosoft.com.cn>; Chen, Christine <yuwei.chen@intel.com>;
> Konstantin Aladyshev <aladyshev22@gmail.com>
> Subject: [edk2-devel] [PATCH] BaseTools/VolInfo: Correct alignment
> attributes display
> 
> 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>
> ---
>  BaseTools/Source/C/VolInfo/VolInfo.c | 198 +++++++++++++--------------
>  1 file changed, 96 insertions(+), 102 deletions(-)
> 
> diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c
> b/BaseTools/Source/C/VolInfo/VolInfo.c
> index 2457ddd2e7..8b6fcffa48 100644
> --- a/BaseTools/Source/C/VolInfo/VolInfo.c
> +++ b/BaseTools/Source/C/VolInfo/VolInfo.c
> @@ -911,140 +911,134 @@ Returns:
>      printf ("       EFI_FVB2_WRITE_LOCK_STATUS\n");   } -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_1) {+  switch
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT) {+    case
> EFI_FVB2_ALIGNMENT_1:     printf ("       EFI_FVB2_ALIGNMENT_1\n");-  }--  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2) {-    printf ("
> EFI_FVB2_ALIGNMENT_2\n");-  }--  if (VolumeHeader.Attributes &
> EFI_FVB2_ALIGNMENT_4) {-    printf ("        EFI_FVB2_ALIGNMENT_4\n");-  }+
> break; -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_8) {-    printf
> ("        EFI_FVB2_ALIGNMENT_8\n");-  }+    case EFI_FVB2_ALIGNMENT_2:+
> printf ("       EFI_FVB2_ALIGNMENT_2\n");+    break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_16) {-    printf ("
> EFI_FVB2_ALIGNMENT_16\n");-  }+    case EFI_FVB2_ALIGNMENT_4:+
> printf ("       EFI_FVB2_ALIGNMENT_4\n");+    break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_32) {-    printf ("
> EFI_FVB2_ALIGNMENT_32\n");-  }+    case EFI_FVB2_ALIGNMENT_8:+
> printf ("       EFI_FVB2_ALIGNMENT_8\n");+    break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64) {-    printf ("
> EFI_FVB2_ALIGNMENT_64\n");-  }+    case EFI_FVB2_ALIGNMENT_16:+
> printf ("       EFI_FVB2_ALIGNMENT_16\n");+    break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_128) {-    printf ("
> EFI_FVB2_ALIGNMENT_128\n");-  }+    case EFI_FVB2_ALIGNMENT_32:+
> printf ("       EFI_FVB2_ALIGNMENT_32\n");+    break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_256) {-    printf ("
> EFI_FVB2_ALIGNMENT_256\n");-  }+    case EFI_FVB2_ALIGNMENT_64:+
> printf ("       EFI_FVB2_ALIGNMENT_64\n");+    break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_512) {-    printf ("
> EFI_FVB2_ALIGNMENT_512\n");-  }+    case EFI_FVB2_ALIGNMENT_128:+
> printf ("       EFI_FVB2_ALIGNMENT_128\n");+    break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_1K) {-    printf ("
> EFI_FVB2_ALIGNMENT_1K\n");-  }+    case EFI_FVB2_ALIGNMENT_256:+
> printf ("       EFI_FVB2_ALIGNMENT_256\n");+    break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2K) {-    printf ("
> EFI_FVB2_ALIGNMENT_2K\n");-  }+    case EFI_FVB2_ALIGNMENT_512:+
> printf ("       EFI_FVB2_ALIGNMENT_512\n");+    break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_4K) {-    printf ("
> EFI_FVB2_ALIGNMENT_4K\n");-  }+    case EFI_FVB2_ALIGNMENT_1K:+
> printf ("       EFI_FVB2_ALIGNMENT_1K\n");+    break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_8K) {-    printf ("
> EFI_FVB2_ALIGNMENT_8K\n");-  }+    case EFI_FVB2_ALIGNMENT_2K:+
> printf ("       EFI_FVB2_ALIGNMENT_2K\n");+    break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_16K) {-    printf ("
> EFI_FVB2_ALIGNMENT_16K\n");-  }+    case EFI_FVB2_ALIGNMENT_4K:+
> printf ("       EFI_FVB2_ALIGNMENT_4K\n");+    break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_32K) {-    printf ("
> EFI_FVB2_ALIGNMENT_32K\n");-  }+    case EFI_FVB2_ALIGNMENT_8K:+
> printf ("       EFI_FVB2_ALIGNMENT_8K\n");+    break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64K) {-    printf ("
> EFI_FVB2_ALIGNMENT_64K\n");-  }+    case EFI_FVB2_ALIGNMENT_16K:+
> printf ("       EFI_FVB2_ALIGNMENT_16K\n");+    break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_128K) {-    printf ("
> EFI_FVB2_ALIGNMENT_128K\n");-  }+    case EFI_FVB2_ALIGNMENT_32K:+
> printf ("       EFI_FVB2_ALIGNMENT_32K\n");+    break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_256K) {-    printf ("
> EFI_FVB2_ALIGNMENT_256K\n");-  }+    case EFI_FVB2_ALIGNMENT_64K:+
> printf ("       EFI_FVB2_ALIGNMENT_64K\n");+    break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_512K) {-    printf ("
> EFI_FVB2_ALIGNMENT_512K\n");-  }+    case EFI_FVB2_ALIGNMENT_128K:+
> printf ("       EFI_FVB2_ALIGNMENT_128K\n");+    break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_1M) {-    printf ("
> EFI_FVB2_ALIGNMENT_1M\n");-  }+    case EFI_FVB2_ALIGNMENT_256K:+
> printf ("       EFI_FVB2_ALIGNMENT_256K\n");+    break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2M) {-    printf ("
> EFI_FVB2_ALIGNMENT_2M\n");-  }+    case EFI_FVB2_ALIGNMENT_512K:+
> printf ("       EFI_FVB2_ALIGNMENT_512K\n");+    break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_4M) {-    printf ("
> EFI_FVB2_ALIGNMENT_4M\n");-  }+    case EFI_FVB2_ALIGNMENT_1M:+
> printf ("       EFI_FVB2_ALIGNMENT_1M\n");+    break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_8M) {-    printf ("
> EFI_FVB2_ALIGNMENT_8M\n");-  }+    case EFI_FVB2_ALIGNMENT_2M:+
> printf ("       EFI_FVB2_ALIGNMENT_2M\n");+    break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_16M) {-    printf ("
> EFI_FVB2_ALIGNMENT_16M\n");-  }+    case EFI_FVB2_ALIGNMENT_4M:+
> printf ("       EFI_FVB2_ALIGNMENT_4M\n");+    break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_32M) {-    printf ("
> EFI_FVB2_ALIGNMENT_32M\n");-  }+    case EFI_FVB2_ALIGNMENT_8M:+
> printf ("       EFI_FVB2_ALIGNMENT_8M\n");+    break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64M) {-    printf ("
> EFI_FVB2_ALIGNMENT_64M\n");-  }+    case EFI_FVB2_ALIGNMENT_16M:+
> printf ("       EFI_FVB2_ALIGNMENT_16M\n");+    break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_128M) {-    printf ("
> EFI_FVB2_ALIGNMENT_128M\n");-  }+    case EFI_FVB2_ALIGNMENT_32M:+
> printf ("       EFI_FVB2_ALIGNMENT_32M\n");+    break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64M) {-    printf ("
> EFI_FVB2_ALIGNMENT_64M\n");-  }+    case EFI_FVB2_ALIGNMENT_64M:+
> printf ("       EFI_FVB2_ALIGNMENT_64M\n");+    break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_128M) {-    printf ("
> EFI_FVB2_ALIGNMENT_128M\n");-  }+    case
> EFI_FVB2_ALIGNMENT_128M:+    printf ("
> EFI_FVB2_ALIGNMENT_128M\n");+    break; -  if (VolumeHeader.Attributes
> & EFI_FVB2_ALIGNMENT_256M) {-    printf ("
> EFI_FVB2_ALIGNMENT_256M\n");-  }+    case
> EFI_FVB2_ALIGNMENT_256M:+    printf ("
> EFI_FVB2_ALIGNMENT_256M\n");+    break; -  if (VolumeHeader.Attributes
> & EFI_FVB2_ALIGNMENT_512M) {-    printf ("
> EFI_FVB2_ALIGNMENT_512M\n");-  }+    case
> EFI_FVB2_ALIGNMENT_512M:+    printf ("
> EFI_FVB2_ALIGNMENT_512M\n");+    break; -  if (VolumeHeader.Attributes
> & EFI_FVB2_ALIGNMENT_1G) {-    printf ("
> EFI_FVB2_ALIGNMENT_1G\n");-  }+    case EFI_FVB2_ALIGNMENT_1G:+
> printf ("       EFI_FVB2_ALIGNMENT_1G\n");+    break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2G) {-    printf ("
> EFI_FVB2_ALIGNMENT_2G\n");+    case EFI_FVB2_ALIGNMENT_2G:+    printf
> ("       EFI_FVB2_ALIGNMENT_2G\n");+    break;   }  #endif--
> 2.25.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#91311): https://edk2.groups.io/g/devel/message/91311
> Mute This Topic: https://groups.io/mt/92356890/4546272
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [yuwei.chen@intel.com]
> -=-=-=-=-=-=
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] BaseTools/VolInfo: Correct alignment attributes display
  2022-07-13 13:11 [PATCH] BaseTools/VolInfo: Correct alignment attributes display Konstantin Aladyshev
  2022-07-22  6:45 ` [edk2-devel] " Yuwei Chen
@ 2022-07-24  5:28 ` Bob Feng
  1 sibling, 0 replies; 3+ messages in thread
From: Bob Feng @ 2022-07-24  5:28 UTC (permalink / raw)
  To: Konstantin Aladyshev, devel@edk2.groups.io; +Cc: Gao, Liming, Chen, Christine

Reviewed-by: Bob Feng <bob.c.feng@intel.com>

-----Original Message-----
From: Konstantin Aladyshev <aladyshev22@gmail.com> 
Sent: Wednesday, July 13, 2022 9:11 PM
To: devel@edk2.groups.io
Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Chen, Christine <yuwei.chen@intel.com>; Konstantin Aladyshev <aladyshev22@gmail.com>
Subject: [PATCH] BaseTools/VolInfo: Correct alignment attributes display

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>
---
 BaseTools/Source/C/VolInfo/VolInfo.c | 198 +++++++++++++--------------
 1 file changed, 96 insertions(+), 102 deletions(-)

diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c b/BaseTools/Source/C/VolInfo/VolInfo.c
index 2457ddd2e7..8b6fcffa48 100644
--- a/BaseTools/Source/C/VolInfo/VolInfo.c
+++ b/BaseTools/Source/C/VolInfo/VolInfo.c
@@ -911,140 +911,134 @@ Returns:
     printf ("       EFI_FVB2_WRITE_LOCK_STATUS\n");   } -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_1) {+  switch (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT) {+    case EFI_FVB2_ALIGNMENT_1:     printf ("       EFI_FVB2_ALIGNMENT_1\n");-  }--  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2) {-    printf ("        EFI_FVB2_ALIGNMENT_2\n");-  }--  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_4) {-    printf ("        EFI_FVB2_ALIGNMENT_4\n");-  }+    break; -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_8) {-    printf ("        EFI_FVB2_ALIGNMENT_8\n");-  }+    case EFI_FVB2_ALIGNMENT_2:+    printf ("       EFI_FVB2_ALIGNMENT_2\n");+    break; -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_16) {-    printf ("        EFI_FVB2_ALIGNMENT_16\n");-  }+    case EFI_FVB2_ALIGNMENT_4:+    printf ("       EFI_FVB2_ALIGNMENT_4\n");+    break; -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_32) {-    printf ("        EFI_FVB2_ALIGNMENT_32\n");-  }+    case EFI_FVB2_ALIGNMENT_8:+    printf ("       EFI_FVB2_ALIGNMENT_8\n");+    break; -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64) {-    printf ("        EFI_FVB2_ALIGNMENT_64\n");-  }+    case EFI_FVB2_ALIGNMENT_16:+    printf ("       EFI_FVB2_ALIGNMENT_16\n");+    break; -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_128) {-    printf ("        EFI_FVB2_ALIGNMENT_128\n");-  }+    case EFI_FVB2_ALIGNMENT_32:+    printf ("       EFI_FVB2_ALIGNMENT_32\n");+    break; -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_256) {-    printf ("        EFI_FVB2_ALIGNMENT_256\n");-  }+    case EFI_FVB2_ALIGNMENT_64:+    printf ("       EFI_FVB2_ALIGNMENT_64\n");+    break; -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_512) {-    printf ("        EFI_FVB2_ALIGNMENT_512\n");-  }+    case EFI_FVB2_ALIGNMENT_128:+    printf ("       EFI_FVB2_ALIGNMENT_128\n");+    break; -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_1K) {-    printf ("        EFI_FVB2_ALIGNMENT_1K\n");-  }+    case EFI_FVB2_ALIGNMENT_256:+    printf ("       EFI_FVB2_ALIGNMENT_256\n");+    break; -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2K) {-    printf ("        EFI_FVB2_ALIGNMENT_2K\n");-  }+    case EFI_FVB2_ALIGNMENT_512:+    printf ("       EFI_FVB2_ALIGNMENT_512\n");+    break; -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_4K) {-    printf ("        EFI_FVB2_ALIGNMENT_4K\n");-  }+    case EFI_FVB2_ALIGNMENT_1K:+    printf ("       EFI_FVB2_ALIGNMENT_1K\n");+    break; -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_8K) {-    printf ("        EFI_FVB2_ALIGNMENT_8K\n");-  }+    case EFI_FVB2_ALIGNMENT_2K:+    printf ("       EFI_FVB2_ALIGNMENT_2K\n");+    break; -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_16K) {-    printf ("        EFI_FVB2_ALIGNMENT_16K\n");-  }+    case EFI_FVB2_ALIGNMENT_4K:+    printf ("       EFI_FVB2_ALIGNMENT_4K\n");+    break; -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_32K) {-    printf ("        EFI_FVB2_ALIGNMENT_32K\n");-  }+    case EFI_FVB2_ALIGNMENT_8K:+    printf ("       EFI_FVB2_ALIGNMENT_8K\n");+    break; -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64K) {-    printf ("        EFI_FVB2_ALIGNMENT_64K\n");-  }+    case EFI_FVB2_ALIGNMENT_16K:+    printf ("       EFI_FVB2_ALIGNMENT_16K\n");+    break; -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_128K) {-    printf ("        EFI_FVB2_ALIGNMENT_128K\n");-  }+    case EFI_FVB2_ALIGNMENT_32K:+    printf ("       EFI_FVB2_ALIGNMENT_32K\n");+    break; -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_256K) {-    printf ("        EFI_FVB2_ALIGNMENT_256K\n");-  }+    case EFI_FVB2_ALIGNMENT_64K:+    printf ("       EFI_FVB2_ALIGNMENT_64K\n");+    break; -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_512K) {-    printf ("        EFI_FVB2_ALIGNMENT_512K\n");-  }+    case EFI_FVB2_ALIGNMENT_128K:+    printf ("       EFI_FVB2_ALIGNMENT_128K\n");+    break; -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_1M) {-    printf ("        EFI_FVB2_ALIGNMENT_1M\n");-  }+    case EFI_FVB2_ALIGNMENT_256K:+    printf ("       EFI_FVB2_ALIGNMENT_256K\n");+    break; -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2M) {-    printf ("        EFI_FVB2_ALIGNMENT_2M\n");-  }+    case EFI_FVB2_ALIGNMENT_512K:+    printf ("       EFI_FVB2_ALIGNMENT_512K\n");+    break; -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_4M) {-    printf ("        EFI_FVB2_ALIGNMENT_4M\n");-  }+    case EFI_FVB2_ALIGNMENT_1M:+    printf ("       EFI_FVB2_ALIGNMENT_1M\n");+    break; -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_8M) {-    printf ("        EFI_FVB2_ALIGNMENT_8M\n");-  }+    case EFI_FVB2_ALIGNMENT_2M:+    printf ("       EFI_FVB2_ALIGNMENT_2M\n");+    break; -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_16M) {-    printf ("        EFI_FVB2_ALIGNMENT_16M\n");-  }+    case EFI_FVB2_ALIGNMENT_4M:+    printf ("       EFI_FVB2_ALIGNMENT_4M\n");+    break; -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_32M) {-    printf ("        EFI_FVB2_ALIGNMENT_32M\n");-  }+    case EFI_FVB2_ALIGNMENT_8M:+    printf ("       EFI_FVB2_ALIGNMENT_8M\n");+    break; -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64M) {-    printf ("        EFI_FVB2_ALIGNMENT_64M\n");-  }+    case EFI_FVB2_ALIGNMENT_16M:+    printf ("       EFI_FVB2_ALIGNMENT_16M\n");+    break; -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_128M) {-    printf ("        EFI_FVB2_ALIGNMENT_128M\n");-  }+    case EFI_FVB2_ALIGNMENT_32M:+    printf ("       EFI_FVB2_ALIGNMENT_32M\n");+    break; -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64M) {-    printf ("        EFI_FVB2_ALIGNMENT_64M\n");-  }+    case EFI_FVB2_ALIGNMENT_64M:+    printf ("       EFI_FVB2_ALIGNMENT_64M\n");+    break; -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_128M) {-    printf ("        EFI_FVB2_ALIGNMENT_128M\n");-  }+    case EFI_FVB2_ALIGNMENT_128M:+    printf ("       EFI_FVB2_ALIGNMENT_128M\n");+    break; -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_256M) {-    printf ("        EFI_FVB2_ALIGNMENT_256M\n");-  }+    case EFI_FVB2_ALIGNMENT_256M:+    printf ("       EFI_FVB2_ALIGNMENT_256M\n");+    break; -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_512M) {-    printf ("        EFI_FVB2_ALIGNMENT_512M\n");-  }+    case EFI_FVB2_ALIGNMENT_512M:+    printf ("       EFI_FVB2_ALIGNMENT_512M\n");+    break; -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_1G) {-    printf ("        EFI_FVB2_ALIGNMENT_1G\n");-  }+    case EFI_FVB2_ALIGNMENT_1G:+    printf ("       EFI_FVB2_ALIGNMENT_1G\n");+    break; -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2G) {-    printf ("        EFI_FVB2_ALIGNMENT_2G\n");+    case EFI_FVB2_ALIGNMENT_2G:+    printf ("       EFI_FVB2_ALIGNMENT_2G\n");+    break;   }  #endif-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-24  5:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-13 13:11 [PATCH] BaseTools/VolInfo: Correct alignment attributes display Konstantin Aladyshev
2022-07-22  6:45 ` [edk2-devel] " Yuwei Chen
2022-07-24  5:28 ` Bob Feng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox