From: "Konstantin Aladyshev" <aladyshev22@gmail.com>
To: devel@edk2.groups.io
Cc: bob.c.feng@intel.com, gaoliming@byosoft.com.cn,
yuwei.chen@intel.com,
Konstantin Aladyshev <aladyshev22@gmail.com>
Subject: [PATCH 5/6] BaseTools/VolInfo: Parse apriori files
Date: Tue, 30 Aug 2022 13:14:44 +0300 [thread overview]
Message-ID: <20220830101445.18110-5-aladyshev22@gmail.com> (raw)
In-Reply-To: <20220830101445.18110-1-aladyshev22@gmail.com>
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
next prev parent reply other threads:[~2022-08-30 10:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Konstantin Aladyshev [this message]
2022-09-26 5:27 ` 回复: [edk2-devel] [PATCH 5/6] BaseTools/VolInfo: Parse apriori files 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220830101445.18110-5-aladyshev22@gmail.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox