From: "Ni, Ray" <ray.ni@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
"Xie, Yuanhao" <yuanhao.xie@intel.com>
Cc: "Dong, Guo" <guo.dong@intel.com>,
Maurice Ma <maurice.ma@intel.com>,
"You, Benjamin" <benjamin.you@intel.com>,
"Rhodes, Sean" <sean@starlabs.systems>
Subject: Re: [edk2-devel] [PATCH 1/2] UefiPayloadPkg: Add a new DebugPrintErrorLevelLib instance.
Date: Fri, 25 Mar 2022 01:40:39 +0000 [thread overview]
Message-ID: <MWHPR11MB1631EDC75CE99A70DDF2751B8C1A9@MWHPR11MB1631.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20220323100053.373-1-yuanhao.xie@intel.com>
+++ b/UefiPayloadPkg/Library/DebugPrintErrorLevelLibCmos/DebugPrintErrorLevelLibCmos.c
1. Please change the folder and file names to "DebugPrintErrorLevelLibHob/DebugPrintErrorLevelLibHob.c".
Please change the INF file name accordingly.
+#include <Pi/PiHob.h>
2. PiHob.h is included by PiDxe.h. So you can remove the above include.
+#include <Library/DxeHobListLib.h>
3. Can you try to remove the above line? Can build still pass?
+#include <Library/UefiLib.h>
+#include <Library/DebugLib.h>
+#include <Library/DxeHobListLib.h>
4. Similar comment.
+#include <Guid/DebugPrintErrorLevel.h>
+#include <Library/DebugPrintErrorLevelLib.h>
+#include <UniversalPayload/UniversalPayload.h>
+
+/**
+ Returns the debug print error level mask for the current module.
+
+ @return Debug print error level mask for the current module.
+
+**/
+UINT32
+EFIAPI
+GetDebugPrintErrorLevel (
+ VOID
+ )
+{
+ VOID *GuidHob;
+ UNIVERSAL_PAYLOAD_GENERIC_HEADER *GenericHeader;
+ UNIVERSAL_PAYLOAD_DEBUG_PRINT_ERROR_LEVEL *DebugPrintErrorLevel;
+
5. can you please use a global variable to cache the error level so that no need to query from HOB always?
e.g.:
define two below variables in the beginning of the file.
UINT32 gDebugPrintErrorLevel;
BOOLEAN gDebugPrintErrorLevelInitialized = FALSE;
then in this function:
if (!gDebugPrintErrorLevelInitialized) {
// re-use the below logic to get the value from HOB or PCD if HOB doesn't exist
// store the value in gDebugPrintErrorLevel
}
return gDebugPrintErrorLevel;
+ GuidHob = GetFirstGuidHob (&gEdkiiDebugPrintErrorLevelGuid);
+
+ if (GuidHob == NULL) {
+ //
+ // If the HOB is not create, the default value of PcdDebugPrintErrorLevel will be used.
+ //
+ return PcdGet32(PcdDebugPrintErrorLevel);
+ }
+
+ GenericHeader = (UNIVERSAL_PAYLOAD_GENERIC_HEADER *)GET_GUID_HOB_DATA (GuidHob);
+ if ((sizeof (UNIVERSAL_PAYLOAD_GENERIC_HEADER) > GET_GUID_HOB_DATA_SIZE (GuidHob)) ||
+ (GenericHeader->Length > GET_GUID_HOB_DATA_SIZE (GuidHob))) {
+ return PcdGet32(PcdDebugPrintErrorLevel);
+ }
+
+ if (GenericHeader->Revision == UNIVERSAL_PAYLOAD_DEBUG_PRINT_ERROR_LEVEL_REVISION) {
+ DebugPrintErrorLevel = GET_GUID_HOB_DATA (GuidHob);
+ return DebugPrintErrorLevel->ErrorLevel;
+ } else {
+ return PcdGet32(PcdDebugPrintErrorLevel);
+ }
+
+}
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = DebugPrintErrorLevelLib
6. Please change the BASE_NAME to DebugPrintErrorLevelLibHob.
prev parent reply other threads:[~2022-03-25 1:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-23 10:00 [PATCH 1/2] UefiPayloadPkg: Add a new DebugPrintErrorLevelLib instance Yuanhao Xie
2022-03-23 10:00 ` [PATCH 2/2] UefiPayloadPkg: Consume the new added " Yuanhao Xie
2022-03-23 16:29 ` [edk2-devel] [PATCH 1/2] UefiPayloadPkg: Add a new " Guo Dong
2022-03-25 1:40 ` Ni, Ray [this message]
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=MWHPR11MB1631EDC75CE99A70DDF2751B8C1A9@MWHPR11MB1631.namprd11.prod.outlook.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