public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 1/6] BaseTools/VolInfo: Fix EFI_SECTION_GUID_DEFINED parsing
@ 2022-08-30 10:14 Konstantin Aladyshev
  2022-08-30 10:14 ` [PATCH 2/6] BaseTools/VolInfo: Correct buffer for GenCrc32 tool Konstantin Aladyshev
                   ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: Konstantin Aladyshev @ 2022-08-30 10:14 UTC (permalink / raw)
  To: devel; +Cc: bob.c.feng, gaoliming, yuwei.chen, Konstantin Aladyshev

Currently 'PutFileImage' function is called with arguments that are
not advanced on each section parsing. This would lead to an error if
EFI_SECTION_GUID_DEFINED is not the first in a file.
The same mistake is present in the parsing of CRC32 guided section
case.
Use correct arguments to fix the issue.

Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
---
 BaseTools/Source/C/VolInfo/VolInfo.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c b/BaseTools/Source/C/VolInfo/VolInfo.c
index 135924e028..b5760d185e 100644
--- a/BaseTools/Source/C/VolInfo/VolInfo.c
+++ b/BaseTools/Source/C/VolInfo/VolInfo.c
@@ -2012,8 +2012,8 @@ Returns:
         Status =
           PutFileImage (
             ToolInputFile,
-            (CHAR8*) SectionBuffer + DataOffset,
-            BufferLength - DataOffset
+            (CHAR8*)Ptr + DataOffset,
+            SectionLength - DataOffset
             );
 
         system (SystemCommand);
@@ -2058,8 +2058,8 @@ Returns:
         //
         printf ("/------------ Encapsulation section start -----------------\\\n");
         Status = ParseSection (
-                  SectionBuffer + DataOffset,
-                  BufferLength - DataOffset
+                  Ptr + DataOffset,
+                  SectionLength - DataOffset
                   );
         if (EFI_ERROR (Status)) {
           Error (NULL, 0, 0003, "parse of CRC32 GUIDED section failed", NULL);
-- 
2.25.1


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

* [PATCH 2/6] BaseTools/VolInfo: Correct buffer for GenCrc32 tool
  2022-08-30 10:14 [PATCH 1/6] BaseTools/VolInfo: Fix EFI_SECTION_GUID_DEFINED parsing Konstantin Aladyshev
@ 2022-08-30 10:14 ` Konstantin Aladyshev
  2022-09-27  2:50   ` 回复: " gaoliming
  2022-08-30 10:14 ` [PATCH 3/6] BaseTools/VolInfo: Increase GUID base name string Konstantin Aladyshev
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Konstantin Aladyshev @ 2022-08-30 10:14 UTC (permalink / raw)
  To: devel; +Cc: bob.c.feng, gaoliming, yuwei.chen, Konstantin Aladyshev

If the guided section was encoded with GenCrc32 tool the resulting
'EFI_GUID_DEFINED_SECTION.DataOffset' field points to the start of
the meaningfull data that follows the CRC32 value.
But if we want to decode the section with GenCrc32 tool we need to
provide a buffer that includes the CRC32 value itself.

Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
---
 BaseTools/Source/C/VolInfo/VolInfo.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c b/BaseTools/Source/C/VolInfo/VolInfo.c
index b5760d185e..4628e756d7 100644
--- a/BaseTools/Source/C/VolInfo/VolInfo.c
+++ b/BaseTools/Source/C/VolInfo/VolInfo.c
@@ -2009,6 +2009,13 @@ Returns:
           );
         free (ExtractionTool);
 
+        if (!CompareGuid (
+               EfiGuid,
+               &gEfiCrc32GuidedSectionExtractionProtocolGuid
+               )
+           ) {
+          DataOffset -= 4;
+        }
         Status =
           PutFileImage (
             ToolInputFile,
-- 
2.25.1


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

* [PATCH 3/6] BaseTools/VolInfo: Increase GUID base name string
  2022-08-30 10:14 [PATCH 1/6] BaseTools/VolInfo: Fix EFI_SECTION_GUID_DEFINED parsing Konstantin Aladyshev
  2022-08-30 10:14 ` [PATCH 2/6] BaseTools/VolInfo: Correct buffer for GenCrc32 tool Konstantin Aladyshev
@ 2022-08-30 10:14 ` Konstantin Aladyshev
  2022-09-26  5:25   ` 回复: [edk2-devel] " gaoliming
  2022-08-30 10:14 ` [PATCH 4/6] BaseTools/VolInfo: Update file and section type strings Konstantin Aladyshev
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Konstantin Aladyshev @ 2022-08-30 10:14 UTC (permalink / raw)
  To: devel; +Cc: bob.c.feng, gaoliming, yuwei.chen, Konstantin Aladyshev

The current string lenght (=60) is not enough for cases where basename
is a path to Build folder.
Drop custom define and use MAX_LINE_LEN from the BaseTools codebase
instead.

Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
---
 BaseTools/Source/C/VolInfo/VolInfo.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c b/BaseTools/Source/C/VolInfo/VolInfo.c
index 4628e756d7..d9be3d8c18 100644
--- a/BaseTools/Source/C/VolInfo/VolInfo.c
+++ b/BaseTools/Source/C/VolInfo/VolInfo.c
@@ -51,15 +51,13 @@ EFI_GUID  gEfiCrc32GuidedSectionExtractionProtocolGuid = EFI_CRC32_GUIDED_SECTIO
 
 #define EFI_SECTION_ERROR EFIERR (100)
 
-#define MAX_BASENAME_LEN  60  // not good to hardcode, but let's be reasonable
-
 //
 // Structure to keep a list of guid-to-basenames
 //
 typedef struct _GUID_TO_BASENAME {
   struct _GUID_TO_BASENAME  *Next;
   INT8                      Guid[PRINTED_GUID_BUFFER_SIZE];
-  INT8                      BaseName[MAX_BASENAME_LEN];
+  INT8                      BaseName[MAX_LINE_LEN];
 } GUID_TO_BASENAME;
 
 static GUID_TO_BASENAME *mGuidBaseNameList = NULL;
-- 
2.25.1


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

* [PATCH 4/6] BaseTools/VolInfo: Update file and section type strings
  2022-08-30 10:14 [PATCH 1/6] BaseTools/VolInfo: Fix EFI_SECTION_GUID_DEFINED parsing Konstantin Aladyshev
  2022-08-30 10:14 ` [PATCH 2/6] BaseTools/VolInfo: Correct buffer for GenCrc32 tool Konstantin Aladyshev
  2022-08-30 10:14 ` [PATCH 3/6] BaseTools/VolInfo: Increase GUID base name string Konstantin Aladyshev
@ 2022-08-30 10:14 ` Konstantin Aladyshev
  2022-09-26  5:26   ` 回复: [edk2-devel] " gaoliming
  2022-08-30 10:14 ` [PATCH 5/6] BaseTools/VolInfo: Parse apriori files Konstantin Aladyshev
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Konstantin Aladyshev @ 2022-08-30 10:14 UTC (permalink / raw)
  To: devel; +Cc: bob.c.feng, gaoliming, yuwei.chen, Konstantin Aladyshev

Change SMM to MM in naming according to the recent PI specifications.
Remove trailing whitespaces in some strings.

Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
---
 BaseTools/Source/C/VolInfo/VolInfo.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c b/BaseTools/Source/C/VolInfo/VolInfo.c
index d9be3d8c18..2d7c6212b3 100644
--- a/BaseTools/Source/C/VolInfo/VolInfo.c
+++ b/BaseTools/Source/C/VolInfo/VolInfo.c
@@ -676,11 +676,11 @@ Returns:
     //
     // 0x17
     //
-    "EFI_SECTION_FIRMWARE_VOLUME_IMAGE ",
+    "EFI_SECTION_FIRMWARE_VOLUME_IMAGE",
     //
     // 0x18
     //
-    "EFI_SECTION_FREEFORM_SUBTYPE_GUID ",
+    "EFI_SECTION_FREEFORM_SUBTYPE_GUID",
     //
     // 0x19
     //
@@ -696,7 +696,7 @@ Returns:
     //
     // 0x1C
     //
-    "EFI_SECTION_SMM_DEPEX",
+    "EFI_SECTION_MM_DEPEX",
     //
     // 0x1C+
     //
@@ -1282,7 +1282,7 @@ Returns:
     break;
 
   case EFI_FV_FILETYPE_SMM:
-    printf ("EFI_FV_FILETYPE_SMM\n");
+    printf ("EFI_FV_FILETYPE_MM\n");
     break;
 
   case EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE:
@@ -1290,11 +1290,11 @@ Returns:
     break;
 
   case EFI_FV_FILETYPE_COMBINED_SMM_DXE:
-    printf ("EFI_FV_FILETYPE_COMBINED_SMM_DXE\n");
+    printf ("EFI_FV_FILETYPE_COMBINED_MM_DXE\n");
     break;
 
   case EFI_FV_FILETYPE_SMM_CORE:
-    printf ("EFI_FV_FILETYPE_SMM_CORE\n");
+    printf ("EFI_FV_FILETYPE_MM_CORE\n");
     break;
 
   case EFI_FV_FILETYPE_MM_STANDALONE:
-- 
2.25.1


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

* [PATCH 5/6] BaseTools/VolInfo: Parse apriori files
  2022-08-30 10:14 [PATCH 1/6] BaseTools/VolInfo: Fix EFI_SECTION_GUID_DEFINED parsing Konstantin Aladyshev
                   ` (2 preceding siblings ...)
  2022-08-30 10:14 ` [PATCH 4/6] BaseTools/VolInfo: Update file and section type strings Konstantin Aladyshev
@ 2022-08-30 10:14 ` Konstantin Aladyshev
  2022-09-26  5:27   ` 回复: [edk2-devel] " gaoliming
  2022-08-30 10:14 ` [PATCH 6/6] BaseTools/VolInfo: Update copyright information Konstantin Aladyshev
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Konstantin Aladyshev @ 2022-08-30 10:14 UTC (permalink / raw)
  To: devel; +Cc: bob.c.feng, gaoliming, yuwei.chen, Konstantin Aladyshev

Output file GUIDs from the DXE and PEI apriori files.

Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
---
 BaseTools/Source/C/VolInfo/VolInfo.c | 74 ++++++++++++++++++++++++++++
 1 file changed, 74 insertions(+)

diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c b/BaseTools/Source/C/VolInfo/VolInfo.c
index 2d7c6212b3..28c6806cf0 100644
--- a/BaseTools/Source/C/VolInfo/VolInfo.c
+++ b/BaseTools/Source/C/VolInfo/VolInfo.c
@@ -43,6 +43,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 //
 
 EFI_GUID  gEfiCrc32GuidedSectionExtractionProtocolGuid = EFI_CRC32_GUIDED_SECTION_EXTRACTION_PROTOCOL_GUID;
+EFI_GUID  gPeiAprioriFileNameGuid = { 0x1b45cc0a, 0x156a, 0x428a, { 0XAF, 0x62,  0x49, 0x86, 0x4d, 0xa0, 0xe6, 0xe6 }};
+EFI_GUID  gAprioriGuid = { 0xFC510EE7, 0xFFDC, 0x11D4, { 0xBD, 0x41, 0x00, 0x80, 0xC7, 0x3C, 0x88, 0x81 }};
 
 #define UTILITY_MAJOR_VERSION      1
 #define UTILITY_MINOR_VERSION      0
@@ -107,6 +109,12 @@ ReadHeader (
   OUT BOOLEAN   *ErasePolarity
   );
 
+STATIC
+EFI_STATUS
+PrintAprioriFile (
+  EFI_FFS_FILE_HEADER         *FileHeader
+  );
+
 STATIC
 EFI_STATUS
 PrintFileInfo (
@@ -1083,6 +1091,53 @@ Returns:
   return EFI_SUCCESS;
 }
 
+STATIC
+EFI_STATUS
+PrintAprioriFile (
+  EFI_FFS_FILE_HEADER         *FileHeader
+  )
+/*++
+
+Routine Description:
+
+  Print GUIDs from the APRIORI file
+
+Arguments:
+
+  FileHeader - The file header
+
+Returns:
+
+  EFI_SUCCESS       - The APRIORI file was parsed correctly
+  EFI_SECTION_ERROR - Problem with file parsing
+
+--*/
+{
+  UINT8               GuidBuffer[PRINTED_GUID_BUFFER_SIZE];
+  UINT32              HeaderSize;
+
+  HeaderSize = FvBufGetFfsHeaderSize (FileHeader);
+
+  if (FileHeader->Type != EFI_FV_FILETYPE_FREEFORM)
+    return EFI_SECTION_ERROR;
+
+  EFI_COMMON_SECTION_HEADER* SectionHeader = (EFI_COMMON_SECTION_HEADER *) ((UINTN) FileHeader + HeaderSize);
+  if (SectionHeader->Type != EFI_SECTION_RAW)
+    return EFI_SECTION_ERROR;
+
+  UINT32 SectionLength = GetSectionFileLength (SectionHeader);
+  EFI_GUID* FileName = (EFI_GUID *) ((UINT8 *) SectionHeader + sizeof (EFI_COMMON_SECTION_HEADER));
+  while (((UINT8 *) FileName) < ((UINT8 *) SectionHeader + SectionLength)) {
+    PrintGuidToBuffer (FileName, GuidBuffer, sizeof (GuidBuffer), TRUE);
+    printf ("%s  ", GuidBuffer);
+    PrintGuidName (GuidBuffer);
+    printf ("\n");
+    FileName++;
+  }
+
+  return EFI_SUCCESS;
+}
+
 STATIC
 EFI_STATUS
 PrintFileInfo (
@@ -1339,6 +1394,25 @@ Returns:
     break;
   }
 
+  if (!CompareGuid (
+       &FileHeader->Name,
+       &gPeiAprioriFileNameGuid
+       ))
+  {
+    printf("\n");
+    printf("PEI APRIORI FILE:\n");
+    return PrintAprioriFile (FileHeader);
+  }
+  if (!CompareGuid (
+       &FileHeader->Name,
+       &gAprioriGuid
+       ))
+  {
+    printf("\n");
+    printf("DXE APRIORI FILE:\n");
+    return PrintAprioriFile (FileHeader);
+  }
+
   return EFI_SUCCESS;
 }
 
-- 
2.25.1


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

* [PATCH 6/6] BaseTools/VolInfo: Update copyright information
  2022-08-30 10:14 [PATCH 1/6] BaseTools/VolInfo: Fix EFI_SECTION_GUID_DEFINED parsing Konstantin Aladyshev
                   ` (3 preceding siblings ...)
  2022-08-30 10:14 ` [PATCH 5/6] BaseTools/VolInfo: Parse apriori files Konstantin Aladyshev
@ 2022-08-30 10:14 ` Konstantin Aladyshev
  2022-09-26  5:27   ` 回复: [edk2-devel] " gaoliming
  2022-08-31  1:43 ` 回复: [edk2-devel] [PATCH 1/6] BaseTools/VolInfo: Fix EFI_SECTION_GUID_DEFINED parsing gaoliming
  2022-10-01 15:15 ` Bob Feng
  6 siblings, 1 reply; 13+ messages in thread
From: Konstantin Aladyshev @ 2022-08-30 10:14 UTC (permalink / raw)
  To: devel; +Cc: bob.c.feng, gaoliming, yuwei.chen, Konstantin Aladyshev

Add Konstantin Aladyshev to the copyright header.

Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
---
 BaseTools/Source/C/VolInfo/VolInfo.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c b/BaseTools/Source/C/VolInfo/VolInfo.c
index 28c6806cf0..428011ca04 100644
--- a/BaseTools/Source/C/VolInfo/VolInfo.c
+++ b/BaseTools/Source/C/VolInfo/VolInfo.c
@@ -2,6 +2,7 @@
 The tool dumps the contents of a firmware volume
 
 Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2022, Konstantin Aladyshev <aladyshev22@gmail.com><BR>
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
-- 
2.25.1


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

* 回复: [edk2-devel] [PATCH 1/6] BaseTools/VolInfo: Fix EFI_SECTION_GUID_DEFINED parsing
  2022-08-30 10:14 [PATCH 1/6] BaseTools/VolInfo: Fix EFI_SECTION_GUID_DEFINED parsing Konstantin Aladyshev
                   ` (4 preceding siblings ...)
  2022-08-30 10:14 ` [PATCH 6/6] BaseTools/VolInfo: Update copyright information Konstantin Aladyshev
@ 2022-08-31  1:43 ` gaoliming
  2022-10-01 15:15 ` Bob Feng
  6 siblings, 0 replies; 13+ messages in thread
From: gaoliming @ 2022-08-31  1:43 UTC (permalink / raw)
  To: devel, aladyshev22; +Cc: bob.c.feng, yuwei.chen

Konstantin: 
  The changes for VolInfo tool is good to me . Reviewed-by: Liming Gao
<gaoliming@byosoft.com.cn>

Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Konstantin
> Aladyshev
> 发送时间: 2022年8月30日 18:15
> 收件人: devel@edk2.groups.io
> 抄送: bob.c.feng@intel.com; gaoliming@byosoft.com.cn;
> yuwei.chen@intel.com; Konstantin Aladyshev <aladyshev22@gmail.com>
> 主题: [edk2-devel] [PATCH 1/6] BaseTools/VolInfo: Fix
> EFI_SECTION_GUID_DEFINED parsing
> 
> Currently 'PutFileImage' function is called with arguments that are
> not advanced on each section parsing. This would lead to an error if
> EFI_SECTION_GUID_DEFINED is not the first in a file.
> The same mistake is present in the parsing of CRC32 guided section
> case.
> Use correct arguments to fix the issue.
> 
> Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
> ---
>  BaseTools/Source/C/VolInfo/VolInfo.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c
> b/BaseTools/Source/C/VolInfo/VolInfo.c
> index 135924e028..b5760d185e 100644
> --- a/BaseTools/Source/C/VolInfo/VolInfo.c
> +++ b/BaseTools/Source/C/VolInfo/VolInfo.c
> @@ -2012,8 +2012,8 @@ Returns:
>          Status =
> 
>            PutFileImage (
> 
>              ToolInputFile,
> 
> -            (CHAR8*) SectionBuffer + DataOffset,
> 
> -            BufferLength - DataOffset
> 
> +            (CHAR8*)Ptr + DataOffset,
> 
> +            SectionLength - DataOffset
> 
>              );
> 
> 
> 
>          system (SystemCommand);
> 
> @@ -2058,8 +2058,8 @@ Returns:
>          //
> 
>          printf ("/------------ Encapsulation section start
> -----------------\\\n");
> 
>          Status = ParseSection (
> 
> -                  SectionBuffer + DataOffset,
> 
> -                  BufferLength - DataOffset
> 
> +                  Ptr + DataOffset,
> 
> +                  SectionLength - DataOffset
> 
>                    );
> 
>          if (EFI_ERROR (Status)) {
> 
>            Error (NULL, 0, 0003, "parse of CRC32 GUIDED section failed",
> NULL);
> 
> --
> 2.25.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#92968): https://edk2.groups.io/g/devel/message/92968
> Mute This Topic: https://groups.io/mt/93345656/4905953
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [gaoliming@byosoft.com.cn]
> -=-=-=-=-=-=
> 




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

* 回复: [edk2-devel] [PATCH 3/6] BaseTools/VolInfo: Increase GUID base name string
  2022-08-30 10:14 ` [PATCH 3/6] BaseTools/VolInfo: Increase GUID base name string Konstantin Aladyshev
@ 2022-09-26  5:25   ` gaoliming
  0 siblings, 0 replies; 13+ messages in thread
From: gaoliming @ 2022-09-26  5:25 UTC (permalink / raw)
  To: devel, aladyshev22; +Cc: bob.c.feng, yuwei.chen

Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>

> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Konstantin
> Aladyshev
> 发送时间: 2022年8月30日 18:15
> 收件人: devel@edk2.groups.io
> 抄送: bob.c.feng@intel.com; gaoliming@byosoft.com.cn;
> yuwei.chen@intel.com; Konstantin Aladyshev <aladyshev22@gmail.com>
> 主题: [edk2-devel] [PATCH 3/6] BaseTools/VolInfo: Increase GUID base name
> string
> 
> The current string lenght (=60) is not enough for cases where basename
> is a path to Build folder.
> Drop custom define and use MAX_LINE_LEN from the BaseTools codebase
> instead.
> 
> Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
> ---
>  BaseTools/Source/C/VolInfo/VolInfo.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c
> b/BaseTools/Source/C/VolInfo/VolInfo.c
> index 4628e756d7..d9be3d8c18 100644
> --- a/BaseTools/Source/C/VolInfo/VolInfo.c
> +++ b/BaseTools/Source/C/VolInfo/VolInfo.c
> @@ -51,15 +51,13 @@ EFI_GUID
> gEfiCrc32GuidedSectionExtractionProtocolGuid =
> EFI_CRC32_GUIDED_SECTIO
> 
> 
>  #define EFI_SECTION_ERROR EFIERR (100)
> 
> 
> 
> -#define MAX_BASENAME_LEN  60  // not good to hardcode, but let's be
> reasonable
> 
> -
> 
>  //
> 
>  // Structure to keep a list of guid-to-basenames
> 
>  //
> 
>  typedef struct _GUID_TO_BASENAME {
> 
>    struct _GUID_TO_BASENAME  *Next;
> 
>    INT8                      Guid[PRINTED_GUID_BUFFER_SIZE];
> 
> -  INT8                      BaseName[MAX_BASENAME_LEN];
> 
> +  INT8                      BaseName[MAX_LINE_LEN];
> 
>  } GUID_TO_BASENAME;
> 
> 
> 
>  static GUID_TO_BASENAME *mGuidBaseNameList = NULL;
> 
> --
> 2.25.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#92970): https://edk2.groups.io/g/devel/message/92970
> Mute This Topic: https://groups.io/mt/93345658/4905953
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [gaoliming@byosoft.com.cn]
> -=-=-=-=-=-=
> 




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

* 回复: [edk2-devel] [PATCH 4/6] BaseTools/VolInfo: Update file and section type strings
  2022-08-30 10:14 ` [PATCH 4/6] BaseTools/VolInfo: Update file and section type strings Konstantin Aladyshev
@ 2022-09-26  5:26   ` gaoliming
  0 siblings, 0 replies; 13+ messages in thread
From: gaoliming @ 2022-09-26  5:26 UTC (permalink / raw)
  To: devel, aladyshev22; +Cc: bob.c.feng, yuwei.chen

Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>

> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Konstantin
> Aladyshev
> 发送时间: 2022年8月30日 18:15
> 收件人: devel@edk2.groups.io
> 抄送: bob.c.feng@intel.com; gaoliming@byosoft.com.cn;
> yuwei.chen@intel.com; Konstantin Aladyshev <aladyshev22@gmail.com>
> 主题: [edk2-devel] [PATCH 4/6] BaseTools/VolInfo: Update file and section
> type strings
> 
> Change SMM to MM in naming according to the recent PI specifications.
> Remove trailing whitespaces in some strings.
> 
> Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
> ---
>  BaseTools/Source/C/VolInfo/VolInfo.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c
> b/BaseTools/Source/C/VolInfo/VolInfo.c
> index d9be3d8c18..2d7c6212b3 100644
> --- a/BaseTools/Source/C/VolInfo/VolInfo.c
> +++ b/BaseTools/Source/C/VolInfo/VolInfo.c
> @@ -676,11 +676,11 @@ Returns:
>      //
> 
>      // 0x17
> 
>      //
> 
> -    "EFI_SECTION_FIRMWARE_VOLUME_IMAGE ",
> 
> +    "EFI_SECTION_FIRMWARE_VOLUME_IMAGE",
> 
>      //
> 
>      // 0x18
> 
>      //
> 
> -    "EFI_SECTION_FREEFORM_SUBTYPE_GUID ",
> 
> +    "EFI_SECTION_FREEFORM_SUBTYPE_GUID",
> 
>      //
> 
>      // 0x19
> 
>      //
> 
> @@ -696,7 +696,7 @@ Returns:
>      //
> 
>      // 0x1C
> 
>      //
> 
> -    "EFI_SECTION_SMM_DEPEX",
> 
> +    "EFI_SECTION_MM_DEPEX",
> 
>      //
> 
>      // 0x1C+
> 
>      //
> 
> @@ -1282,7 +1282,7 @@ Returns:
>      break;
> 
> 
> 
>    case EFI_FV_FILETYPE_SMM:
> 
> -    printf ("EFI_FV_FILETYPE_SMM\n");
> 
> +    printf ("EFI_FV_FILETYPE_MM\n");
> 
>      break;
> 
> 
> 
>    case EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE:
> 
> @@ -1290,11 +1290,11 @@ Returns:
>      break;
> 
> 
> 
>    case EFI_FV_FILETYPE_COMBINED_SMM_DXE:
> 
> -    printf ("EFI_FV_FILETYPE_COMBINED_SMM_DXE\n");
> 
> +    printf ("EFI_FV_FILETYPE_COMBINED_MM_DXE\n");
> 
>      break;
> 
> 
> 
>    case EFI_FV_FILETYPE_SMM_CORE:
> 
> -    printf ("EFI_FV_FILETYPE_SMM_CORE\n");
> 
> +    printf ("EFI_FV_FILETYPE_MM_CORE\n");
> 
>      break;
> 
> 
> 
>    case EFI_FV_FILETYPE_MM_STANDALONE:
> 
> --
> 2.25.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#92971): https://edk2.groups.io/g/devel/message/92971
> Mute This Topic: https://groups.io/mt/93345659/4905953
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [gaoliming@byosoft.com.cn]
> -=-=-=-=-=-=
> 




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

* 回复: [edk2-devel] [PATCH 5/6] BaseTools/VolInfo: Parse apriori files
  2022-08-30 10:14 ` [PATCH 5/6] BaseTools/VolInfo: Parse apriori files Konstantin Aladyshev
@ 2022-09-26  5:27   ` gaoliming
  0 siblings, 0 replies; 13+ messages in thread
From: gaoliming @ 2022-09-26  5:27 UTC (permalink / raw)
  To: devel, aladyshev22; +Cc: bob.c.feng, yuwei.chen

Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>

> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Konstantin
> Aladyshev
> 发送时间: 2022年8月30日 18:15
> 收件人: devel@edk2.groups.io
> 抄送: bob.c.feng@intel.com; gaoliming@byosoft.com.cn;
> yuwei.chen@intel.com; Konstantin Aladyshev <aladyshev22@gmail.com>
> 主题: [edk2-devel] [PATCH 5/6] BaseTools/VolInfo: Parse apriori files
> 
> Output file GUIDs from the DXE and PEI apriori files.
> 
> Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
> ---
>  BaseTools/Source/C/VolInfo/VolInfo.c | 74
> ++++++++++++++++++++++++++++
>  1 file changed, 74 insertions(+)
> 
> diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c
> b/BaseTools/Source/C/VolInfo/VolInfo.c
> index 2d7c6212b3..28c6806cf0 100644
> --- a/BaseTools/Source/C/VolInfo/VolInfo.c
> +++ b/BaseTools/Source/C/VolInfo/VolInfo.c
> @@ -43,6 +43,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>  //
> 
> 
> 
>  EFI_GUID  gEfiCrc32GuidedSectionExtractionProtocolGuid =
> EFI_CRC32_GUIDED_SECTION_EXTRACTION_PROTOCOL_GUID;
> 
> +EFI_GUID  gPeiAprioriFileNameGuid = { 0x1b45cc0a, 0x156a, 0x428a,
> { 0XAF, 0x62,  0x49, 0x86, 0x4d, 0xa0, 0xe6, 0xe6 }};
> 
> +EFI_GUID  gAprioriGuid = { 0xFC510EE7, 0xFFDC, 0x11D4, { 0xBD, 0x41,
> 0x00, 0x80, 0xC7, 0x3C, 0x88, 0x81 }};
> 
> 
> 
>  #define UTILITY_MAJOR_VERSION      1
> 
>  #define UTILITY_MINOR_VERSION      0
> 
> @@ -107,6 +109,12 @@ ReadHeader (
>    OUT BOOLEAN   *ErasePolarity
> 
>    );
> 
> 
> 
> +STATIC
> 
> +EFI_STATUS
> 
> +PrintAprioriFile (
> 
> +  EFI_FFS_FILE_HEADER         *FileHeader
> 
> +  );
> 
> +
> 
>  STATIC
> 
>  EFI_STATUS
> 
>  PrintFileInfo (
> 
> @@ -1083,6 +1091,53 @@ Returns:
>    return EFI_SUCCESS;
> 
>  }
> 
> 
> 
> +STATIC
> 
> +EFI_STATUS
> 
> +PrintAprioriFile (
> 
> +  EFI_FFS_FILE_HEADER         *FileHeader
> 
> +  )
> 
> +/*++
> 
> +
> 
> +Routine Description:
> 
> +
> 
> +  Print GUIDs from the APRIORI file
> 
> +
> 
> +Arguments:
> 
> +
> 
> +  FileHeader - The file header
> 
> +
> 
> +Returns:
> 
> +
> 
> +  EFI_SUCCESS       - The APRIORI file was parsed correctly
> 
> +  EFI_SECTION_ERROR - Problem with file parsing
> 
> +
> 
> +--*/
> 
> +{
> 
> +  UINT8               GuidBuffer[PRINTED_GUID_BUFFER_SIZE];
> 
> +  UINT32              HeaderSize;
> 
> +
> 
> +  HeaderSize = FvBufGetFfsHeaderSize (FileHeader);
> 
> +
> 
> +  if (FileHeader->Type != EFI_FV_FILETYPE_FREEFORM)
> 
> +    return EFI_SECTION_ERROR;
> 
> +
> 
> +  EFI_COMMON_SECTION_HEADER* SectionHeader =
> (EFI_COMMON_SECTION_HEADER *) ((UINTN) FileHeader + HeaderSize);
> 
> +  if (SectionHeader->Type != EFI_SECTION_RAW)
> 
> +    return EFI_SECTION_ERROR;
> 
> +
> 
> +  UINT32 SectionLength = GetSectionFileLength (SectionHeader);
> 
> +  EFI_GUID* FileName = (EFI_GUID *) ((UINT8 *) SectionHeader + sizeof
> (EFI_COMMON_SECTION_HEADER));
> 
> +  while (((UINT8 *) FileName) < ((UINT8 *) SectionHeader +
SectionLength))
> {
> 
> +    PrintGuidToBuffer (FileName, GuidBuffer, sizeof (GuidBuffer), TRUE);
> 
> +    printf ("%s  ", GuidBuffer);
> 
> +    PrintGuidName (GuidBuffer);
> 
> +    printf ("\n");
> 
> +    FileName++;
> 
> +  }
> 
> +
> 
> +  return EFI_SUCCESS;
> 
> +}
> 
> +
> 
>  STATIC
> 
>  EFI_STATUS
> 
>  PrintFileInfo (
> 
> @@ -1339,6 +1394,25 @@ Returns:
>      break;
> 
>    }
> 
> 
> 
> +  if (!CompareGuid (
> 
> +       &FileHeader->Name,
> 
> +       &gPeiAprioriFileNameGuid
> 
> +       ))
> 
> +  {
> 
> +    printf("\n");
> 
> +    printf("PEI APRIORI FILE:\n");
> 
> +    return PrintAprioriFile (FileHeader);
> 
> +  }
> 
> +  if (!CompareGuid (
> 
> +       &FileHeader->Name,
> 
> +       &gAprioriGuid
> 
> +       ))
> 
> +  {
> 
> +    printf("\n");
> 
> +    printf("DXE APRIORI FILE:\n");
> 
> +    return PrintAprioriFile (FileHeader);
> 
> +  }
> 
> +
> 
>    return EFI_SUCCESS;
> 
>  }
> 
> 
> 
> --
> 2.25.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#92972): https://edk2.groups.io/g/devel/message/92972
> Mute This Topic: https://groups.io/mt/93345661/4905953
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [gaoliming@byosoft.com.cn]
> -=-=-=-=-=-=
> 




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

* 回复: [edk2-devel] [PATCH 6/6] BaseTools/VolInfo: Update copyright information
  2022-08-30 10:14 ` [PATCH 6/6] BaseTools/VolInfo: Update copyright information Konstantin Aladyshev
@ 2022-09-26  5:27   ` gaoliming
  0 siblings, 0 replies; 13+ messages in thread
From: gaoliming @ 2022-09-26  5:27 UTC (permalink / raw)
  To: devel, aladyshev22; +Cc: bob.c.feng, yuwei.chen

Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>

> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Konstantin
> Aladyshev
> 发送时间: 2022年8月30日 18:15
> 收件人: devel@edk2.groups.io
> 抄送: bob.c.feng@intel.com; gaoliming@byosoft.com.cn;
> yuwei.chen@intel.com; Konstantin Aladyshev <aladyshev22@gmail.com>
> 主题: [edk2-devel] [PATCH 6/6] BaseTools/VolInfo: Update copyright
> information
> 
> Add Konstantin Aladyshev to the copyright header.
> 
> Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
> ---
>  BaseTools/Source/C/VolInfo/VolInfo.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c
> b/BaseTools/Source/C/VolInfo/VolInfo.c
> index 28c6806cf0..428011ca04 100644
> --- a/BaseTools/Source/C/VolInfo/VolInfo.c
> +++ b/BaseTools/Source/C/VolInfo/VolInfo.c
> @@ -2,6 +2,7 @@
>  The tool dumps the contents of a firmware volume
> 
> 
> 
>  Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.<BR>
> 
> +Copyright (c) 2022, Konstantin Aladyshev <aladyshev22@gmail.com><BR>
> 
>  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> 
> 
>  **/
> 
> --
> 2.25.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#92973): https://edk2.groups.io/g/devel/message/92973
> Mute This Topic: https://groups.io/mt/93345662/4905953
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [gaoliming@byosoft.com.cn]
> -=-=-=-=-=-=
> 




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

* 回复: [PATCH 2/6] BaseTools/VolInfo: Correct buffer for GenCrc32 tool
  2022-08-30 10:14 ` [PATCH 2/6] BaseTools/VolInfo: Correct buffer for GenCrc32 tool Konstantin Aladyshev
@ 2022-09-27  2:50   ` gaoliming
  0 siblings, 0 replies; 13+ messages in thread
From: gaoliming @ 2022-09-27  2:50 UTC (permalink / raw)
  To: 'Konstantin Aladyshev', devel; +Cc: bob.c.feng, yuwei.chen

Konstantin:
  I agree this change. CRC32 guid section doesn't set
EFI_GUIDED_SECTION_PROCESSING_REQUIRED. 
  It places CRC32 checksum in its guided header. When its data is verified,
its checksum and data will be required together. 

  Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>

Thanks
Liming
> -----邮件原件-----
> 发件人: Konstantin Aladyshev <aladyshev22@gmail.com>
> 发送时间: 2022年8月30日 18:15
> 收件人: devel@edk2.groups.io
> 抄送: bob.c.feng@intel.com; gaoliming@byosoft.com.cn;
> yuwei.chen@intel.com; Konstantin Aladyshev <aladyshev22@gmail.com>
> 主题: [PATCH 2/6] BaseTools/VolInfo: Correct buffer for GenCrc32 tool
> 
> If the guided section was encoded with GenCrc32 tool the resulting
> 'EFI_GUID_DEFINED_SECTION.DataOffset' field points to the start of
> the meaningfull data that follows the CRC32 value.
> But if we want to decode the section with GenCrc32 tool we need to
> provide a buffer that includes the CRC32 value itself.
> 
> Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
> ---
>  BaseTools/Source/C/VolInfo/VolInfo.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c
> b/BaseTools/Source/C/VolInfo/VolInfo.c
> index b5760d185e..4628e756d7 100644
> --- a/BaseTools/Source/C/VolInfo/VolInfo.c
> +++ b/BaseTools/Source/C/VolInfo/VolInfo.c
> @@ -2009,6 +2009,13 @@ Returns:
>            );
> 
>          free (ExtractionTool);
> 
> 
> 
> +        if (!CompareGuid (
> 
> +               EfiGuid,
> 
> +               &gEfiCrc32GuidedSectionExtractionProtocolGuid
> 
> +               )
> 
> +           ) {
> 
> +          DataOffset -= 4;
> 
> +        }
> 
>          Status =
> 
>            PutFileImage (
> 
>              ToolInputFile,
> 
> --
> 2.25.1




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

* Re: [edk2-devel] [PATCH 1/6] BaseTools/VolInfo: Fix EFI_SECTION_GUID_DEFINED parsing
  2022-08-30 10:14 [PATCH 1/6] BaseTools/VolInfo: Fix EFI_SECTION_GUID_DEFINED parsing Konstantin Aladyshev
                   ` (5 preceding siblings ...)
  2022-08-31  1:43 ` 回复: [edk2-devel] [PATCH 1/6] BaseTools/VolInfo: Fix EFI_SECTION_GUID_DEFINED parsing gaoliming
@ 2022-10-01 15:15 ` Bob Feng
  6 siblings, 0 replies; 13+ messages in thread
From: Bob Feng @ 2022-10-01 15:15 UTC (permalink / raw)
  To: devel@edk2.groups.io, aladyshev22@gmail.com; +Cc: Gao, Liming, Chen, Christine

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

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Konstantin Aladyshev
Sent: Tuesday, August 30, 2022 6:15 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 1/6] BaseTools/VolInfo: Fix EFI_SECTION_GUID_DEFINED parsing

Currently 'PutFileImage' function is called with arguments that are not advanced on each section parsing. This would lead to an error if EFI_SECTION_GUID_DEFINED is not the first in a file.
The same mistake is present in the parsing of CRC32 guided section case.
Use correct arguments to fix the issue.

Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
---
 BaseTools/Source/C/VolInfo/VolInfo.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c b/BaseTools/Source/C/VolInfo/VolInfo.c
index 135924e028..b5760d185e 100644
--- a/BaseTools/Source/C/VolInfo/VolInfo.c
+++ b/BaseTools/Source/C/VolInfo/VolInfo.c
@@ -2012,8 +2012,8 @@ Returns:
         Status =           PutFileImage (             ToolInputFile,-            (CHAR8*) SectionBuffer + DataOffset,-            BufferLength - DataOffset+            (CHAR8*)Ptr + DataOffset,+            SectionLength - DataOffset             );          system (SystemCommand);@@ -2058,8 +2058,8 @@ Returns:
         //         printf ("/------------ Encapsulation section start -----------------\\\n");         Status = ParseSection (-                  SectionBuffer + DataOffset,-                  BufferLength - DataOffset+                  Ptr + DataOffset,+                  SectionLength - DataOffset                   );         if (EFI_ERROR (Status)) {           Error (NULL, 0, 0003, "parse of CRC32 GUIDED section failed", NULL);-- 
2.25.1



-=-=-=-=-=-=
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92968): https://edk2.groups.io/g/devel/message/92968
Mute This Topic: https://groups.io/mt/93345656/1768742
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [bob.c.feng@intel.com] -=-=-=-=-=-=



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

end of thread, other threads:[~2022-10-01 15:15 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-30 10:14 [PATCH 1/6] BaseTools/VolInfo: Fix EFI_SECTION_GUID_DEFINED parsing Konstantin Aladyshev
2022-08-30 10:14 ` [PATCH 2/6] BaseTools/VolInfo: Correct buffer for GenCrc32 tool Konstantin Aladyshev
2022-09-27  2:50   ` 回复: " gaoliming
2022-08-30 10:14 ` [PATCH 3/6] BaseTools/VolInfo: Increase GUID base name string Konstantin Aladyshev
2022-09-26  5:25   ` 回复: [edk2-devel] " gaoliming
2022-08-30 10:14 ` [PATCH 4/6] BaseTools/VolInfo: Update file and section type strings Konstantin Aladyshev
2022-09-26  5:26   ` 回复: [edk2-devel] " gaoliming
2022-08-30 10:14 ` [PATCH 5/6] BaseTools/VolInfo: Parse apriori files Konstantin Aladyshev
2022-09-26  5:27   ` 回复: [edk2-devel] " gaoliming
2022-08-30 10:14 ` [PATCH 6/6] BaseTools/VolInfo: Update copyright information Konstantin Aladyshev
2022-09-26  5:27   ` 回复: [edk2-devel] " gaoliming
2022-08-31  1:43 ` 回复: [edk2-devel] [PATCH 1/6] BaseTools/VolInfo: Fix EFI_SECTION_GUID_DEFINED parsing gaoliming
2022-10-01 15:15 ` Bob Feng

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