* [PATCH-V2] Fix Setup numeric default value incorrect issue
@ 2022-04-01 6:09 Chen Lin Z
2022-04-07 1:46 ` Chen Lin Z
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Chen Lin Z @ 2022-04-01 6:09 UTC (permalink / raw)
To: jian.j.wang, gaoliming, dandan.bi, eric.dong, devel
Cc: zhuangzhi.li, di.zhang, Chen Lin Z
When default/manufacturing flag get removed from numeric varid, it can't
get default value from StructurePcd in 'UpdateDefaultSettingInFormPackage'
function since there is no EFI_IFR_DEFAULT_OP opcode in IFR file. Add a
chance to get numeric default value from StructurePcd in the case that
numeric minimum value will be used as default value.
Signed-off-by: Chen Lin Z <lin.z.chen@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
.../Universal/HiiDatabaseDxe/ConfigRouting.c | 22 ++++++++++++++++++
.../Universal/HiiDatabaseDxe/HiiDatabase.h | 23 +++++++++++++++++++
2 files changed, 45 insertions(+)
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
index 2f792d2965..1c6af853b3 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
@@ -2171,6 +2171,7 @@ ParseIfrData (
UINTN PackageOffset;
EFI_IFR_VARSTORE *IfrVarStore;
EFI_IFR_VARSTORE_EFI *IfrEfiVarStore;
+ EFI_IFR_VARSTORE_EFI *IfrEfiVarStoreTmp;
EFI_IFR_OP_HEADER *IfrOpHdr;
EFI_IFR_ONE_OF *IfrOneOf;
EFI_IFR_REF4 *IfrRef;
@@ -2187,6 +2188,7 @@ ParseIfrData (
IFR_BLOCK_DATA *BlockData;
CHAR16 *VarStoreName;
UINTN NameSize;
+ UINTN NvDefaultStoreSize;
UINT16 VarWidth;
UINT16 VarDefaultId;
BOOLEAN FirstOneOfOption;
@@ -2212,6 +2214,7 @@ ParseIfrData (
SmallestDefaultId = 0xFFFF;
FromOtherDefaultOpcode = FALSE;
QuestionReferBitField = FALSE;
+ IfrEfiVarStoreTmp = NULL;
//
// Go through the form package to parse OpCode one by one.
@@ -2303,6 +2306,17 @@ ParseIfrData (
}
AsciiStrToUnicodeStrS ((CHAR8 *)IfrEfiVarStore->Name, VarStoreName, NameSize);
+ if (IfrEfiVarStoreTmp != NULL) {
+ FreePool (IfrEfiVarStoreTmp);
+ }
+ IfrEfiVarStoreTmp = AllocatePool (IfrEfiVarStore->Header.Length + AsciiStrSize ((CHAR8 *)IfrEfiVarStore->Name));
+ if (IfrEfiVarStoreTmp == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ goto Done;
+ }
+
+ CopyMem (IfrEfiVarStoreTmp, IfrEfiVarStore, IfrEfiVarStore->Header.Length);
+ AsciiStrToUnicodeStrS ((CHAR8 *)IfrEfiVarStore->Name, (CHAR16 *)&(IfrEfiVarStoreTmp->Name[0]), AsciiStrSize ((CHAR8 *)IfrEfiVarStore->Name) * sizeof (CHAR16));
if (IsThisVarstore (&IfrEfiVarStore->Guid, VarStoreName, ConfigHdr)) {
//
@@ -2502,9 +2516,13 @@ ParseIfrData (
//
// Set default value base on the DefaultId list get from IFR data.
//
+ NvDefaultStoreSize = PcdGetSize (PcdNvStoreDefaultValueBuffer);
for (LinkData = DefaultIdArray->Entry.ForwardLink; LinkData != &DefaultIdArray->Entry; LinkData = LinkData->ForwardLink) {
DefaultDataPtr = BASE_CR (LinkData, IFR_DEFAULT_DATA, Entry);
DefaultData.DefaultId = DefaultDataPtr->DefaultId;
+ if (NvDefaultStoreSize > sizeof (PCD_NV_STORE_DEFAULT_BUFFER_HEADER)) {
+ FindQuestionDefaultSetting (DefaultData.DefaultId, IfrEfiVarStoreTmp, &(IfrOneOf->Question), &DefaultData.Value, VarWidth, QuestionReferBitField);
+ }
InsertDefaultValue (BlockData, &DefaultData);
}
}
@@ -3192,6 +3210,10 @@ Done:
}
}
+ if (IfrEfiVarStoreTmp != NULL) {
+ FreePool (IfrEfiVarStoreTmp);
+ }
+
return Status;
}
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
index c4ca6ad6ee..421c293cfc 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
@@ -2308,6 +2308,29 @@ HiiGetConfigRespInfo (
IN CONST EFI_HII_DATABASE_PROTOCOL *This
);
+/**
+ Find question default value from PcdNvStoreDefaultValueBuffer
+
+ @param DefaultId Default store ID
+ @param EfiVarStore Point to EFI VarStore header
+ @param IfrQuestionHdr Point to Question header
+ @param ValueBuffer Point to Buffer includes the found default setting
+ @param Width Width of the default value
+ @param BitFieldQuestion Whether the Question is stored in Bit field.
+
+ @retval EFI_SUCCESS Question default value is found.
+ @retval EFI_NOT_FOUND Question default value is not found.
+**/
+EFI_STATUS
+FindQuestionDefaultSetting (
+ IN UINT16 DefaultId,
+ IN EFI_IFR_VARSTORE_EFI *EfiVarStore,
+ IN EFI_IFR_QUESTION_HEADER *IfrQuestionHdr,
+ OUT VOID *ValueBuffer,
+ IN UINTN Width,
+ IN BOOLEAN BitFieldQuestion
+ );
+
//
// Global variables
//
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH-V2] Fix Setup numeric default value incorrect issue
2022-04-01 6:09 [PATCH-V2] Fix Setup numeric default value incorrect issue Chen Lin Z
@ 2022-04-07 1:46 ` Chen Lin Z
2022-04-07 5:04 ` 回复: " gaoliming
[not found] ` <16E384C9AA220AC9.11968@groups.io>
2 siblings, 0 replies; 6+ messages in thread
From: Chen Lin Z @ 2022-04-07 1:46 UTC (permalink / raw)
To: Wang, Jian J, Gao, Liming, Bi, Dandan, Dong, Eric,
devel@edk2.groups.io
Cc: Li, Zhuangzhi, Zhang, Di
@Gao, Liming, Any comment about patch V2 ? we need to this patch to fix our issues, Pls help review it.
Thanks,
Lin
-----Original Message-----
From: Chen, Lin Z <lin.z.chen@intel.com>
Sent: Friday, April 1, 2022 2:09 PM
To: Wang, Jian J <jian.j.wang@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Bi, Dandan <dandan.bi@intel.com>; Dong, Eric <eric.dong@intel.com>; devel@edk2.groups.io
Cc: Li, Zhuangzhi <zhuangzhi.li@intel.com>; Zhang, Di <di.zhang@intel.com>; Chen, Lin Z <lin.z.chen@intel.com>
Subject: [PATCH-V2] Fix Setup numeric default value incorrect issue
When default/manufacturing flag get removed from numeric varid, it can't get default value from StructurePcd in 'UpdateDefaultSettingInFormPackage'
function since there is no EFI_IFR_DEFAULT_OP opcode in IFR file. Add a chance to get numeric default value from StructurePcd in the case that numeric minimum value will be used as default value.
Signed-off-by: Chen Lin Z <lin.z.chen@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
.../Universal/HiiDatabaseDxe/ConfigRouting.c | 22 ++++++++++++++++++
.../Universal/HiiDatabaseDxe/HiiDatabase.h | 23 +++++++++++++++++++
2 files changed, 45 insertions(+)
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
index 2f792d2965..1c6af853b3 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
@@ -2171,6 +2171,7 @@ ParseIfrData (
UINTN PackageOffset; EFI_IFR_VARSTORE *IfrVarStore; EFI_IFR_VARSTORE_EFI *IfrEfiVarStore;+ EFI_IFR_VARSTORE_EFI *IfrEfiVarStoreTmp; EFI_IFR_OP_HEADER *IfrOpHdr; EFI_IFR_ONE_OF *IfrOneOf; EFI_IFR_REF4 *IfrRef;@@ -2187,6 +2188,7 @@ ParseIfrData (
IFR_BLOCK_DATA *BlockData; CHAR16 *VarStoreName; UINTN NameSize;+ UINTN NvDefaultStoreSize; UINT16 VarWidth; UINT16 VarDefaultId; BOOLEAN FirstOneOfOption;@@ -2212,6 +2214,7 @@ ParseIfrData (
SmallestDefaultId = 0xFFFF; FromOtherDefaultOpcode = FALSE; QuestionReferBitField = FALSE;+ IfrEfiVarStoreTmp = NULL; // // Go through the form package to parse OpCode one by one.@@ -2303,6 +2306,17 @@ ParseIfrData (
} AsciiStrToUnicodeStrS ((CHAR8 *)IfrEfiVarStore->Name, VarStoreName, NameSize);+ if (IfrEfiVarStoreTmp != NULL) {+ FreePool (IfrEfiVarStoreTmp);+ }+ IfrEfiVarStoreTmp = AllocatePool (IfrEfiVarStore->Header.Length + AsciiStrSize ((CHAR8 *)IfrEfiVarStore->Name));+ if (IfrEfiVarStoreTmp == NULL) {+ Status = EFI_OUT_OF_RESOURCES;+ goto Done;+ }++ CopyMem (IfrEfiVarStoreTmp, IfrEfiVarStore, IfrEfiVarStore->Header.Length);+ AsciiStrToUnicodeStrS ((CHAR8 *)IfrEfiVarStore->Name, (CHAR16 *)&(IfrEfiVarStoreTmp->Name[0]), AsciiStrSize ((CHAR8 *)IfrEfiVarStore->Name) * sizeof (CHAR16)); if (IsThisVarstore (&IfrEfiVarStore->Guid, VarStoreName, ConfigHdr)) { //@@ -2502,9 +2516,13 @@ ParseIfrData (
// // Set default value base on the DefaultId list get from IFR data. //+ NvDefaultStoreSize = PcdGetSize (PcdNvStoreDefaultValueBuffer); for (LinkData = DefaultIdArray->Entry.ForwardLink; LinkData != &DefaultIdArray->Entry; LinkData = LinkData->ForwardLink) { DefaultDataPtr = BASE_CR (LinkData, IFR_DEFAULT_DATA, Entry); DefaultData.DefaultId = DefaultDataPtr->DefaultId;+ if (NvDefaultStoreSize > sizeof (PCD_NV_STORE_DEFAULT_BUFFER_HEADER)) {+ FindQuestionDefaultSetting (DefaultData.DefaultId, IfrEfiVarStoreTmp, &(IfrOneOf->Question), &DefaultData.Value, VarWidth, QuestionReferBitField);+ } InsertDefaultValue (BlockData, &DefaultData); } }@@ -3192,6 +3210,10 @@ Done:
} } + if (IfrEfiVarStoreTmp != NULL) {+ FreePool (IfrEfiVarStoreTmp);+ }+ return Status; } diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
index c4ca6ad6ee..421c293cfc 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
@@ -2308,6 +2308,29 @@ HiiGetConfigRespInfo (
IN CONST EFI_HII_DATABASE_PROTOCOL *This ); +/**+ Find question default value from PcdNvStoreDefaultValueBuffer++ @param DefaultId Default store ID+ @param EfiVarStore Point to EFI VarStore header+ @param IfrQuestionHdr Point to Question header+ @param ValueBuffer Point to Buffer includes the found default setting+ @param Width Width of the default value+ @param BitFieldQuestion Whether the Question is stored in Bit field.++ @retval EFI_SUCCESS Question default value is found.+ @retval EFI_NOT_FOUND Question default value is not found.+**/+EFI_STATUS+FindQuestionDefaultSetting (+ IN UINT16 DefaultId,+ IN EFI_IFR_VARSTORE_EFI *EfiVarStore,+ IN EFI_IFR_QUESTION_HEADER *IfrQuestionHdr,+ OUT VOID *ValueBuffer,+ IN UINTN Width,+ IN BOOLEAN BitFieldQuestion+ );+ // // Global variables //--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* 回复: [PATCH-V2] Fix Setup numeric default value incorrect issue
2022-04-01 6:09 [PATCH-V2] Fix Setup numeric default value incorrect issue Chen Lin Z
2022-04-07 1:46 ` Chen Lin Z
@ 2022-04-07 5:04 ` gaoliming
[not found] ` <16E384C9AA220AC9.11968@groups.io>
2 siblings, 0 replies; 6+ messages in thread
From: gaoliming @ 2022-04-07 5:04 UTC (permalink / raw)
To: 'Chen Lin Z', jian.j.wang, dandan.bi, eric.dong, devel
Cc: zhuangzhi.li, di.zhang
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
> -----邮件原件-----
> 发件人: Chen Lin Z <lin.z.chen@intel.com>
> 发送时间: 2022年4月1日 14:09
> 收件人: jian.j.wang@intel.com; gaoliming@byosoft.com.cn;
> dandan.bi@intel.com; eric.dong@intel.com; devel@edk2.groups.io
> 抄送: zhuangzhi.li@intel.com; di.zhang@intel.com; Chen Lin Z
> <lin.z.chen@intel.com>
> 主题: [PATCH-V2] Fix Setup numeric default value incorrect issue
>
> When default/manufacturing flag get removed from numeric varid, it can't
> get default value from StructurePcd in 'UpdateDefaultSettingInFormPackage'
> function since there is no EFI_IFR_DEFAULT_OP opcode in IFR file. Add a
> chance to get numeric default value from StructurePcd in the case that
> numeric minimum value will be used as default value.
>
> Signed-off-by: Chen Lin Z <lin.z.chen@intel.com>
> Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> ---
> .../Universal/HiiDatabaseDxe/ConfigRouting.c | 22 ++++++++++++++++++
> .../Universal/HiiDatabaseDxe/HiiDatabase.h | 23
> +++++++++++++++++++
> 2 files changed, 45 insertions(+)
>
> diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
> b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
> index 2f792d2965..1c6af853b3 100644
> --- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
> +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
> @@ -2171,6 +2171,7 @@ ParseIfrData (
> UINTN PackageOffset;
>
> EFI_IFR_VARSTORE *IfrVarStore;
>
> EFI_IFR_VARSTORE_EFI *IfrEfiVarStore;
>
> + EFI_IFR_VARSTORE_EFI *IfrEfiVarStoreTmp;
>
> EFI_IFR_OP_HEADER *IfrOpHdr;
>
> EFI_IFR_ONE_OF *IfrOneOf;
>
> EFI_IFR_REF4 *IfrRef;
>
> @@ -2187,6 +2188,7 @@ ParseIfrData (
> IFR_BLOCK_DATA *BlockData;
>
> CHAR16 *VarStoreName;
>
> UINTN NameSize;
>
> + UINTN NvDefaultStoreSize;
>
> UINT16 VarWidth;
>
> UINT16 VarDefaultId;
>
> BOOLEAN FirstOneOfOption;
>
> @@ -2212,6 +2214,7 @@ ParseIfrData (
> SmallestDefaultId = 0xFFFF;
>
> FromOtherDefaultOpcode = FALSE;
>
> QuestionReferBitField = FALSE;
>
> + IfrEfiVarStoreTmp = NULL;
>
>
>
> //
>
> // Go through the form package to parse OpCode one by one.
>
> @@ -2303,6 +2306,17 @@ ParseIfrData (
> }
>
>
>
> AsciiStrToUnicodeStrS ((CHAR8 *)IfrEfiVarStore->Name,
> VarStoreName, NameSize);
>
> + if (IfrEfiVarStoreTmp != NULL) {
>
> + FreePool (IfrEfiVarStoreTmp);
>
> + }
>
> + IfrEfiVarStoreTmp = AllocatePool (IfrEfiVarStore->Header.Length +
> AsciiStrSize ((CHAR8 *)IfrEfiVarStore->Name));
>
> + if (IfrEfiVarStoreTmp == NULL) {
>
> + Status = EFI_OUT_OF_RESOURCES;
>
> + goto Done;
>
> + }
>
> +
>
> + CopyMem (IfrEfiVarStoreTmp, IfrEfiVarStore,
> IfrEfiVarStore->Header.Length);
>
> + AsciiStrToUnicodeStrS ((CHAR8 *)IfrEfiVarStore->Name, (CHAR16
> *)&(IfrEfiVarStoreTmp->Name[0]), AsciiStrSize ((CHAR8
> *)IfrEfiVarStore->Name) * sizeof (CHAR16));
>
>
>
> if (IsThisVarstore (&IfrEfiVarStore->Guid, VarStoreName,
> ConfigHdr)) {
>
> //
>
> @@ -2502,9 +2516,13 @@ ParseIfrData (
> //
>
> // Set default value base on the DefaultId list get from IFR
data.
>
> //
>
> + NvDefaultStoreSize = PcdGetSize
> (PcdNvStoreDefaultValueBuffer);
>
> for (LinkData = DefaultIdArray->Entry.ForwardLink; LinkData !=
> &DefaultIdArray->Entry; LinkData = LinkData->ForwardLink) {
>
> DefaultDataPtr = BASE_CR (LinkData,
> IFR_DEFAULT_DATA, Entry);
>
> DefaultData.DefaultId = DefaultDataPtr->DefaultId;
>
> + if (NvDefaultStoreSize > sizeof
> (PCD_NV_STORE_DEFAULT_BUFFER_HEADER)) {
>
> + FindQuestionDefaultSetting (DefaultData.DefaultId,
> IfrEfiVarStoreTmp, &(IfrOneOf->Question), &DefaultData.Value, VarWidth,
> QuestionReferBitField);
>
> + }
>
> InsertDefaultValue (BlockData, &DefaultData);
>
> }
>
> }
>
> @@ -3192,6 +3210,10 @@ Done:
> }
>
> }
>
>
>
> + if (IfrEfiVarStoreTmp != NULL) {
>
> + FreePool (IfrEfiVarStoreTmp);
>
> + }
>
> +
>
> return Status;
>
> }
>
>
>
> diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
> b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
> index c4ca6ad6ee..421c293cfc 100644
> --- a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
> +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
> @@ -2308,6 +2308,29 @@ HiiGetConfigRespInfo (
> IN CONST EFI_HII_DATABASE_PROTOCOL *This
>
> );
>
>
>
> +/**
>
> + Find question default value from PcdNvStoreDefaultValueBuffer
>
> +
>
> + @param DefaultId Default store ID
>
> + @param EfiVarStore Point to EFI VarStore header
>
> + @param IfrQuestionHdr Point to Question header
>
> + @param ValueBuffer Point to Buffer includes the found default
> setting
>
> + @param Width Width of the default value
>
> + @param BitFieldQuestion Whether the Question is stored in Bit field.
>
> +
>
> + @retval EFI_SUCCESS Question default value is found.
>
> + @retval EFI_NOT_FOUND Question default value is not found.
>
> +**/
>
> +EFI_STATUS
>
> +FindQuestionDefaultSetting (
>
> + IN UINT16 DefaultId,
>
> + IN EFI_IFR_VARSTORE_EFI *EfiVarStore,
>
> + IN EFI_IFR_QUESTION_HEADER *IfrQuestionHdr,
>
> + OUT VOID *ValueBuffer,
>
> + IN UINTN Width,
>
> + IN BOOLEAN BitFieldQuestion
>
> + );
>
> +
>
> //
>
> // Global variables
>
> //
>
> --
> 2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* 回复: [edk2-devel] 回复: [PATCH-V2] Fix Setup numeric default value incorrect issue
[not found] ` <16E384C9AA220AC9.11968@groups.io>
@ 2022-04-08 0:47 ` gaoliming
2022-04-08 2:12 ` Dandan Bi
0 siblings, 1 reply; 6+ messages in thread
From: gaoliming @ 2022-04-08 0:47 UTC (permalink / raw)
To: devel, gaoliming, 'Chen Lin Z', jian.j.wang, dandan.bi,
eric.dong
Cc: zhuangzhi.li, di.zhang
Lin:
Here is PR https://github.com/tianocore/edk2/pull/2748. There is the issue
in the change. Please check it.
ERROR -
/home/vsts/work/1/s/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
ERROR - --->Test Failed: Uncrustify Coding Standard Test NO-TARGET returned
1
Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 gaoliming
> 发送时间: 2022年4月7日 13:05
> 收件人: 'Chen Lin Z' <lin.z.chen@intel.com>; jian.j.wang@intel.com;
> dandan.bi@intel.com; eric.dong@intel.com; devel@edk2.groups.io
> 抄送: zhuangzhi.li@intel.com; di.zhang@intel.com
> 主题: [edk2-devel] 回复: [PATCH-V2] Fix Setup numeric default value
> incorrect issue
>
> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
>
> > -----邮件原件-----
> > 发件人: Chen Lin Z <lin.z.chen@intel.com>
> > 发送时间: 2022年4月1日 14:09
> > 收件人: jian.j.wang@intel.com; gaoliming@byosoft.com.cn;
> > dandan.bi@intel.com; eric.dong@intel.com; devel@edk2.groups.io
> > 抄送: zhuangzhi.li@intel.com; di.zhang@intel.com; Chen Lin Z
> > <lin.z.chen@intel.com>
> > 主题: [PATCH-V2] Fix Setup numeric default value incorrect issue
> >
> > When default/manufacturing flag get removed from numeric varid, it can't
> > get default value from StructurePcd in
> 'UpdateDefaultSettingInFormPackage'
> > function since there is no EFI_IFR_DEFAULT_OP opcode in IFR file. Add a
> > chance to get numeric default value from StructurePcd in the case that
> > numeric minimum value will be used as default value.
> >
> > Signed-off-by: Chen Lin Z <lin.z.chen@intel.com>
> > Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> > ---
> > .../Universal/HiiDatabaseDxe/ConfigRouting.c | 22
> ++++++++++++++++++
> > .../Universal/HiiDatabaseDxe/HiiDatabase.h | 23
> > +++++++++++++++++++
> > 2 files changed, 45 insertions(+)
> >
> > diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
> > b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
> > index 2f792d2965..1c6af853b3 100644
> > --- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
> > +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
> > @@ -2171,6 +2171,7 @@ ParseIfrData (
> > UINTN PackageOffset;
> >
> > EFI_IFR_VARSTORE *IfrVarStore;
> >
> > EFI_IFR_VARSTORE_EFI *IfrEfiVarStore;
> >
> > + EFI_IFR_VARSTORE_EFI *IfrEfiVarStoreTmp;
> >
> > EFI_IFR_OP_HEADER *IfrOpHdr;
> >
> > EFI_IFR_ONE_OF *IfrOneOf;
> >
> > EFI_IFR_REF4 *IfrRef;
> >
> > @@ -2187,6 +2188,7 @@ ParseIfrData (
> > IFR_BLOCK_DATA *BlockData;
> >
> > CHAR16 *VarStoreName;
> >
> > UINTN NameSize;
> >
> > + UINTN NvDefaultStoreSize;
> >
> > UINT16 VarWidth;
> >
> > UINT16 VarDefaultId;
> >
> > BOOLEAN FirstOneOfOption;
> >
> > @@ -2212,6 +2214,7 @@ ParseIfrData (
> > SmallestDefaultId = 0xFFFF;
> >
> > FromOtherDefaultOpcode = FALSE;
> >
> > QuestionReferBitField = FALSE;
> >
> > + IfrEfiVarStoreTmp = NULL;
> >
> >
> >
> > //
> >
> > // Go through the form package to parse OpCode one by one.
> >
> > @@ -2303,6 +2306,17 @@ ParseIfrData (
> > }
> >
> >
> >
> > AsciiStrToUnicodeStrS ((CHAR8 *)IfrEfiVarStore->Name,
> > VarStoreName, NameSize);
> >
> > + if (IfrEfiVarStoreTmp != NULL) {
> >
> > + FreePool (IfrEfiVarStoreTmp);
> >
> > + }
> >
> > + IfrEfiVarStoreTmp = AllocatePool (IfrEfiVarStore->Header.Length
> +
> > AsciiStrSize ((CHAR8 *)IfrEfiVarStore->Name));
> >
> > + if (IfrEfiVarStoreTmp == NULL) {
> >
> > + Status = EFI_OUT_OF_RESOURCES;
> >
> > + goto Done;
> >
> > + }
> >
> > +
> >
> > + CopyMem (IfrEfiVarStoreTmp, IfrEfiVarStore,
> > IfrEfiVarStore->Header.Length);
> >
> > + AsciiStrToUnicodeStrS ((CHAR8 *)IfrEfiVarStore->Name, (CHAR16
> > *)&(IfrEfiVarStoreTmp->Name[0]), AsciiStrSize ((CHAR8
> > *)IfrEfiVarStore->Name) * sizeof (CHAR16));
> >
> >
> >
> > if (IsThisVarstore (&IfrEfiVarStore->Guid, VarStoreName,
> > ConfigHdr)) {
> >
> > //
> >
> > @@ -2502,9 +2516,13 @@ ParseIfrData (
> > //
> >
> > // Set default value base on the DefaultId list get from IFR
> data.
> >
> > //
> >
> > + NvDefaultStoreSize = PcdGetSize
> > (PcdNvStoreDefaultValueBuffer);
> >
> > for (LinkData = DefaultIdArray->Entry.ForwardLink;
> LinkData !=
> > &DefaultIdArray->Entry; LinkData = LinkData->ForwardLink) {
> >
> > DefaultDataPtr = BASE_CR (LinkData,
> > IFR_DEFAULT_DATA, Entry);
> >
> > DefaultData.DefaultId = DefaultDataPtr->DefaultId;
> >
> > + if (NvDefaultStoreSize > sizeof
> > (PCD_NV_STORE_DEFAULT_BUFFER_HEADER)) {
> >
> > + FindQuestionDefaultSetting (DefaultData.DefaultId,
> > IfrEfiVarStoreTmp, &(IfrOneOf->Question), &DefaultData.Value, VarWidth,
> > QuestionReferBitField);
> >
> > + }
> >
> > InsertDefaultValue (BlockData, &DefaultData);
> >
> > }
> >
> > }
> >
> > @@ -3192,6 +3210,10 @@ Done:
> > }
> >
> > }
> >
> >
> >
> > + if (IfrEfiVarStoreTmp != NULL) {
> >
> > + FreePool (IfrEfiVarStoreTmp);
> >
> > + }
> >
> > +
> >
> > return Status;
> >
> > }
> >
> >
> >
> > diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
> > b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
> > index c4ca6ad6ee..421c293cfc 100644
> > --- a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
> > +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
> > @@ -2308,6 +2308,29 @@ HiiGetConfigRespInfo (
> > IN CONST EFI_HII_DATABASE_PROTOCOL *This
> >
> > );
> >
> >
> >
> > +/**
> >
> > + Find question default value from PcdNvStoreDefaultValueBuffer
> >
> > +
> >
> > + @param DefaultId Default store ID
> >
> > + @param EfiVarStore Point to EFI VarStore header
> >
> > + @param IfrQuestionHdr Point to Question header
> >
> > + @param ValueBuffer Point to Buffer includes the found default
> > setting
> >
> > + @param Width Width of the default value
> >
> > + @param BitFieldQuestion Whether the Question is stored in Bit
field.
> >
> > +
> >
> > + @retval EFI_SUCCESS Question default value is found.
> >
> > + @retval EFI_NOT_FOUND Question default value is not found.
> >
> > +**/
> >
> > +EFI_STATUS
> >
> > +FindQuestionDefaultSetting (
> >
> > + IN UINT16 DefaultId,
> >
> > + IN EFI_IFR_VARSTORE_EFI *EfiVarStore,
> >
> > + IN EFI_IFR_QUESTION_HEADER *IfrQuestionHdr,
> >
> > + OUT VOID *ValueBuffer,
> >
> > + IN UINTN Width,
> >
> > + IN BOOLEAN BitFieldQuestion
> >
> > + );
> >
> > +
> >
> > //
> >
> > // Global variables
> >
> > //
> >
> > --
> > 2.25.1
>
>
>
>
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [edk2-devel] 回复: [PATCH-V2] Fix Setup numeric default value incorrect issue
2022-04-08 0:47 ` 回复: [edk2-devel] " gaoliming
@ 2022-04-08 2:12 ` Dandan Bi
2022-04-08 2:56 ` Chen Lin Z
0 siblings, 1 reply; 6+ messages in thread
From: Dandan Bi @ 2022-04-08 2:12 UTC (permalink / raw)
To: devel@edk2.groups.io, Gao, Liming, Chen, Lin Z, Wang, Jian J,
Dong, Eric
Cc: Li, Zhuangzhi, Zhang, Di
The coding style issue is addressed and pushed via https://github.com/tianocore/edk2/pull/2753
Thanks,
Dandan
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of
> gaoliming
> Sent: Friday, April 8, 2022 8:48 AM
> To: devel@edk2.groups.io; Gao, Liming <gaoliming@byosoft.com.cn>; Chen,
> Lin Z <lin.z.chen@intel.com>; Wang, Jian J <jian.j.wang@intel.com>; Bi,
> Dandan <dandan.bi@intel.com>; Dong, Eric <eric.dong@intel.com>
> Cc: Li, Zhuangzhi <zhuangzhi.li@intel.com>; Zhang, Di <di.zhang@intel.com>
> Subject: 回复: [edk2-devel] 回复: [PATCH-V2] Fix Setup numeric default value
> incorrect issue
>
> Lin:
> Here is PR https://github.com/tianocore/edk2/pull/2748. There is the issue
> in the change. Please check it.
>
> ERROR -
> /home/vsts/work/1/s/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRou
> ting.c
> ERROR - --->Test Failed: Uncrustify Coding Standard Test NO-TARGET
> returned
> 1
>
> Thanks
> Liming
> > -----邮件原件-----
> > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 gaoliming
> > 发送时间: 2022年4月7日 13:05
> > 收件人: 'Chen Lin Z' <lin.z.chen@intel.com>; jian.j.wang@intel.com;
> > dandan.bi@intel.com; eric.dong@intel.com; devel@edk2.groups.io
> > 抄送: zhuangzhi.li@intel.com; di.zhang@intel.com
> > 主题: [edk2-devel] 回复: [PATCH-V2] Fix Setup numeric default value
> > incorrect issue
> >
> > Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
> >
> > > -----邮件原件-----
> > > 发件人: Chen Lin Z <lin.z.chen@intel.com>
> > > 发送时间: 2022年4月1日 14:09
> > > 收件人: jian.j.wang@intel.com; gaoliming@byosoft.com.cn;
> > > dandan.bi@intel.com; eric.dong@intel.com; devel@edk2.groups.io
> > > 抄送: zhuangzhi.li@intel.com; di.zhang@intel.com; Chen Lin Z
> > > <lin.z.chen@intel.com>
> > > 主题: [PATCH-V2] Fix Setup numeric default value incorrect issue
> > >
> > > When default/manufacturing flag get removed from numeric varid, it
> > > can't get default value from StructurePcd in
> > 'UpdateDefaultSettingInFormPackage'
> > > function since there is no EFI_IFR_DEFAULT_OP opcode in IFR file.
> > > Add a chance to get numeric default value from StructurePcd in the
> > > case that numeric minimum value will be used as default value.
> > >
> > > Signed-off-by: Chen Lin Z <lin.z.chen@intel.com>
> > > Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> > > ---
> > > .../Universal/HiiDatabaseDxe/ConfigRouting.c | 22
> > ++++++++++++++++++
> > > .../Universal/HiiDatabaseDxe/HiiDatabase.h | 23
> > > +++++++++++++++++++
> > > 2 files changed, 45 insertions(+)
> > >
> > > diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
> > > b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
> > > index 2f792d2965..1c6af853b3 100644
> > > --- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
> > > +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
> > > @@ -2171,6 +2171,7 @@ ParseIfrData (
> > > UINTN PackageOffset;
> > >
> > > EFI_IFR_VARSTORE *IfrVarStore;
> > >
> > > EFI_IFR_VARSTORE_EFI *IfrEfiVarStore;
> > >
> > > + EFI_IFR_VARSTORE_EFI *IfrEfiVarStoreTmp;
> > >
> > > EFI_IFR_OP_HEADER *IfrOpHdr;
> > >
> > > EFI_IFR_ONE_OF *IfrOneOf;
> > >
> > > EFI_IFR_REF4 *IfrRef;
> > >
> > > @@ -2187,6 +2188,7 @@ ParseIfrData (
> > > IFR_BLOCK_DATA *BlockData;
> > >
> > > CHAR16 *VarStoreName;
> > >
> > > UINTN NameSize;
> > >
> > > + UINTN NvDefaultStoreSize;
> > >
> > > UINT16 VarWidth;
> > >
> > > UINT16 VarDefaultId;
> > >
> > > BOOLEAN FirstOneOfOption;
> > >
> > > @@ -2212,6 +2214,7 @@ ParseIfrData (
> > > SmallestDefaultId = 0xFFFF;
> > >
> > > FromOtherDefaultOpcode = FALSE;
> > >
> > > QuestionReferBitField = FALSE;
> > >
> > > + IfrEfiVarStoreTmp = NULL;
> > >
> > >
> > >
> > > //
> > >
> > > // Go through the form package to parse OpCode one by one.
> > >
> > > @@ -2303,6 +2306,17 @@ ParseIfrData (
> > > }
> > >
> > >
> > >
> > > AsciiStrToUnicodeStrS ((CHAR8 *)IfrEfiVarStore->Name,
> > > VarStoreName, NameSize);
> > >
> > > + if (IfrEfiVarStoreTmp != NULL) {
> > >
> > > + FreePool (IfrEfiVarStoreTmp);
> > >
> > > + }
> > >
> > > + IfrEfiVarStoreTmp = AllocatePool
> > > + (IfrEfiVarStore->Header.Length
> > +
> > > AsciiStrSize ((CHAR8 *)IfrEfiVarStore->Name));
> > >
> > > + if (IfrEfiVarStoreTmp == NULL) {
> > >
> > > + Status = EFI_OUT_OF_RESOURCES;
> > >
> > > + goto Done;
> > >
> > > + }
> > >
> > > +
> > >
> > > + CopyMem (IfrEfiVarStoreTmp, IfrEfiVarStore,
> > > IfrEfiVarStore->Header.Length);
> > >
> > > + AsciiStrToUnicodeStrS ((CHAR8 *)IfrEfiVarStore->Name,
> > > + (CHAR16
> > > *)&(IfrEfiVarStoreTmp->Name[0]), AsciiStrSize ((CHAR8
> > > *)IfrEfiVarStore->Name) * sizeof (CHAR16));
> > >
> > >
> > >
> > > if (IsThisVarstore (&IfrEfiVarStore->Guid, VarStoreName,
> > > ConfigHdr)) {
> > >
> > > //
> > >
> > > @@ -2502,9 +2516,13 @@ ParseIfrData (
> > > //
> > >
> > > // Set default value base on the DefaultId list get from
> > > IFR
> > data.
> > >
> > > //
> > >
> > > + NvDefaultStoreSize = PcdGetSize
> > > (PcdNvStoreDefaultValueBuffer);
> > >
> > > for (LinkData = DefaultIdArray->Entry.ForwardLink;
> > LinkData !=
> > > &DefaultIdArray->Entry; LinkData = LinkData->ForwardLink) {
> > >
> > > DefaultDataPtr = BASE_CR (LinkData,
> > > IFR_DEFAULT_DATA, Entry);
> > >
> > > DefaultData.DefaultId = DefaultDataPtr->DefaultId;
> > >
> > > + if (NvDefaultStoreSize > sizeof
> > > (PCD_NV_STORE_DEFAULT_BUFFER_HEADER)) {
> > >
> > > + FindQuestionDefaultSetting (DefaultData.DefaultId,
> > > IfrEfiVarStoreTmp, &(IfrOneOf->Question), &DefaultData.Value,
> > > VarWidth, QuestionReferBitField);
> > >
> > > + }
> > >
> > > InsertDefaultValue (BlockData, &DefaultData);
> > >
> > > }
> > >
> > > }
> > >
> > > @@ -3192,6 +3210,10 @@ Done:
> > > }
> > >
> > > }
> > >
> > >
> > >
> > > + if (IfrEfiVarStoreTmp != NULL) {
> > >
> > > + FreePool (IfrEfiVarStoreTmp);
> > >
> > > + }
> > >
> > > +
> > >
> > > return Status;
> > >
> > > }
> > >
> > >
> > >
> > > diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
> > > b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
> > > index c4ca6ad6ee..421c293cfc 100644
> > > --- a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
> > > +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
> > > @@ -2308,6 +2308,29 @@ HiiGetConfigRespInfo (
> > > IN CONST EFI_HII_DATABASE_PROTOCOL *This
> > >
> > > );
> > >
> > >
> > >
> > > +/**
> > >
> > > + Find question default value from PcdNvStoreDefaultValueBuffer
> > >
> > > +
> > >
> > > + @param DefaultId Default store ID
> > >
> > > + @param EfiVarStore Point to EFI VarStore header
> > >
> > > + @param IfrQuestionHdr Point to Question header
> > >
> > > + @param ValueBuffer Point to Buffer includes the found default
> > > setting
> > >
> > > + @param Width Width of the default value
> > >
> > > + @param BitFieldQuestion Whether the Question is stored in Bit
> field.
> > >
> > > +
> > >
> > > + @retval EFI_SUCCESS Question default value is found.
> > >
> > > + @retval EFI_NOT_FOUND Question default value is not found.
> > >
> > > +**/
> > >
> > > +EFI_STATUS
> > >
> > > +FindQuestionDefaultSetting (
> > >
> > > + IN UINT16 DefaultId,
> > >
> > > + IN EFI_IFR_VARSTORE_EFI *EfiVarStore,
> > >
> > > + IN EFI_IFR_QUESTION_HEADER *IfrQuestionHdr,
> > >
> > > + OUT VOID *ValueBuffer,
> > >
> > > + IN UINTN Width,
> > >
> > > + IN BOOLEAN BitFieldQuestion
> > >
> > > + );
> > >
> > > +
> > >
> > > //
> > >
> > > // Global variables
> > >
> > > //
> > >
> > > --
> > > 2.25.1
> >
> >
> >
> >
> >
> >
> >
>
>
>
>
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [edk2-devel] 回复: [PATCH-V2] Fix Setup numeric default value incorrect issue
2022-04-08 2:12 ` Dandan Bi
@ 2022-04-08 2:56 ` Chen Lin Z
0 siblings, 0 replies; 6+ messages in thread
From: Chen Lin Z @ 2022-04-08 2:56 UTC (permalink / raw)
To: Bi, Dandan, devel@edk2.groups.io, Gao, Liming, Wang, Jian J,
Dong, Eric
Cc: Li, Zhuangzhi, Zhang, Di
Thanks Dandan's update, I see patch got merged : )
Thanks,
Lin
-----Original Message-----
From: Bi, Dandan <dandan.bi@intel.com>
Sent: Friday, April 8, 2022 10:12 AM
To: devel@edk2.groups.io; Gao, Liming <gaoliming@byosoft.com.cn>; Chen, Lin Z <lin.z.chen@intel.com>; Wang, Jian J <jian.j.wang@intel.com>; Dong, Eric <eric.dong@intel.com>
Cc: Li, Zhuangzhi <zhuangzhi.li@intel.com>; Zhang, Di <di.zhang@intel.com>
Subject: RE: [edk2-devel] 回复: [PATCH-V2] Fix Setup numeric default value incorrect issue
The coding style issue is addressed and pushed via https://github.com/tianocore/edk2/pull/2753
Thanks,
Dandan
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of
> gaoliming
> Sent: Friday, April 8, 2022 8:48 AM
> To: devel@edk2.groups.io; Gao, Liming <gaoliming@byosoft.com.cn>;
> Chen, Lin Z <lin.z.chen@intel.com>; Wang, Jian J
> <jian.j.wang@intel.com>; Bi, Dandan <dandan.bi@intel.com>; Dong, Eric
> <eric.dong@intel.com>
> Cc: Li, Zhuangzhi <zhuangzhi.li@intel.com>; Zhang, Di
> <di.zhang@intel.com>
> Subject: 回复: [edk2-devel] 回复: [PATCH-V2] Fix Setup numeric default
> value incorrect issue
>
> Lin:
> Here is PR https://github.com/tianocore/edk2/pull/2748. There is the
> issue in the change. Please check it.
>
> ERROR -
> /home/vsts/work/1/s/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRou
> ting.c
> ERROR - --->Test Failed: Uncrustify Coding Standard Test NO-TARGET
> returned
> 1
>
> Thanks
> Liming
> > -----邮件原件-----
> > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 gaoliming
> > 发送时间: 2022年4月7日 13:05
> > 收件人: 'Chen Lin Z' <lin.z.chen@intel.com>; jian.j.wang@intel.com;
> > dandan.bi@intel.com; eric.dong@intel.com; devel@edk2.groups.io
> > 抄送: zhuangzhi.li@intel.com; di.zhang@intel.com
> > 主题: [edk2-devel] 回复: [PATCH-V2] Fix Setup numeric default value
> > incorrect issue
> >
> > Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
> >
> > > -----邮件原件-----
> > > 发件人: Chen Lin Z <lin.z.chen@intel.com>
> > > 发送时间: 2022年4月1日 14:09
> > > 收件人: jian.j.wang@intel.com; gaoliming@byosoft.com.cn;
> > > dandan.bi@intel.com; eric.dong@intel.com; devel@edk2.groups.io
> > > 抄送: zhuangzhi.li@intel.com; di.zhang@intel.com; Chen Lin Z
> > > <lin.z.chen@intel.com>
> > > 主题: [PATCH-V2] Fix Setup numeric default value incorrect issue
> > >
> > > When default/manufacturing flag get removed from numeric varid, it
> > > can't get default value from StructurePcd in
> > 'UpdateDefaultSettingInFormPackage'
> > > function since there is no EFI_IFR_DEFAULT_OP opcode in IFR file.
> > > Add a chance to get numeric default value from StructurePcd in the
> > > case that numeric minimum value will be used as default value.
> > >
> > > Signed-off-by: Chen Lin Z <lin.z.chen@intel.com>
> > > Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> > > ---
> > > .../Universal/HiiDatabaseDxe/ConfigRouting.c | 22
> > ++++++++++++++++++
> > > .../Universal/HiiDatabaseDxe/HiiDatabase.h | 23
> > > +++++++++++++++++++
> > > 2 files changed, 45 insertions(+)
> > >
> > > diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
> > > b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
> > > index 2f792d2965..1c6af853b3 100644
> > > --- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
> > > +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
> > > @@ -2171,6 +2171,7 @@ ParseIfrData (
> > > UINTN PackageOffset;
> > >
> > > EFI_IFR_VARSTORE *IfrVarStore;
> > >
> > > EFI_IFR_VARSTORE_EFI *IfrEfiVarStore;
> > >
> > > + EFI_IFR_VARSTORE_EFI *IfrEfiVarStoreTmp;
> > >
> > > EFI_IFR_OP_HEADER *IfrOpHdr;
> > >
> > > EFI_IFR_ONE_OF *IfrOneOf;
> > >
> > > EFI_IFR_REF4 *IfrRef;
> > >
> > > @@ -2187,6 +2188,7 @@ ParseIfrData (
> > > IFR_BLOCK_DATA *BlockData;
> > >
> > > CHAR16 *VarStoreName;
> > >
> > > UINTN NameSize;
> > >
> > > + UINTN NvDefaultStoreSize;
> > >
> > > UINT16 VarWidth;
> > >
> > > UINT16 VarDefaultId;
> > >
> > > BOOLEAN FirstOneOfOption;
> > >
> > > @@ -2212,6 +2214,7 @@ ParseIfrData (
> > > SmallestDefaultId = 0xFFFF;
> > >
> > > FromOtherDefaultOpcode = FALSE;
> > >
> > > QuestionReferBitField = FALSE;
> > >
> > > + IfrEfiVarStoreTmp = NULL;
> > >
> > >
> > >
> > > //
> > >
> > > // Go through the form package to parse OpCode one by one.
> > >
> > > @@ -2303,6 +2306,17 @@ ParseIfrData (
> > > }
> > >
> > >
> > >
> > > AsciiStrToUnicodeStrS ((CHAR8 *)IfrEfiVarStore->Name,
> > > VarStoreName, NameSize);
> > >
> > > + if (IfrEfiVarStoreTmp != NULL) {
> > >
> > > + FreePool (IfrEfiVarStoreTmp);
> > >
> > > + }
> > >
> > > + IfrEfiVarStoreTmp = AllocatePool
> > > + (IfrEfiVarStore->Header.Length
> > +
> > > AsciiStrSize ((CHAR8 *)IfrEfiVarStore->Name));
> > >
> > > + if (IfrEfiVarStoreTmp == NULL) {
> > >
> > > + Status = EFI_OUT_OF_RESOURCES;
> > >
> > > + goto Done;
> > >
> > > + }
> > >
> > > +
> > >
> > > + CopyMem (IfrEfiVarStoreTmp, IfrEfiVarStore,
> > > IfrEfiVarStore->Header.Length);
> > >
> > > + AsciiStrToUnicodeStrS ((CHAR8 *)IfrEfiVarStore->Name,
> > > + (CHAR16
> > > *)&(IfrEfiVarStoreTmp->Name[0]), AsciiStrSize ((CHAR8
> > > *)IfrEfiVarStore->Name) * sizeof (CHAR16));
> > >
> > >
> > >
> > > if (IsThisVarstore (&IfrEfiVarStore->Guid, VarStoreName,
> > > ConfigHdr)) {
> > >
> > > //
> > >
> > > @@ -2502,9 +2516,13 @@ ParseIfrData (
> > > //
> > >
> > > // Set default value base on the DefaultId list get
> > > from IFR
> > data.
> > >
> > > //
> > >
> > > + NvDefaultStoreSize = PcdGetSize
> > > (PcdNvStoreDefaultValueBuffer);
> > >
> > > for (LinkData = DefaultIdArray->Entry.ForwardLink;
> > LinkData !=
> > > &DefaultIdArray->Entry; LinkData = LinkData->ForwardLink) {
> > >
> > > DefaultDataPtr = BASE_CR (LinkData,
> > > IFR_DEFAULT_DATA, Entry);
> > >
> > > DefaultData.DefaultId = DefaultDataPtr->DefaultId;
> > >
> > > + if (NvDefaultStoreSize > sizeof
> > > (PCD_NV_STORE_DEFAULT_BUFFER_HEADER)) {
> > >
> > > + FindQuestionDefaultSetting (DefaultData.DefaultId,
> > > IfrEfiVarStoreTmp, &(IfrOneOf->Question), &DefaultData.Value,
> > > VarWidth, QuestionReferBitField);
> > >
> > > + }
> > >
> > > InsertDefaultValue (BlockData, &DefaultData);
> > >
> > > }
> > >
> > > }
> > >
> > > @@ -3192,6 +3210,10 @@ Done:
> > > }
> > >
> > > }
> > >
> > >
> > >
> > > + if (IfrEfiVarStoreTmp != NULL) {
> > >
> > > + FreePool (IfrEfiVarStoreTmp);
> > >
> > > + }
> > >
> > > +
> > >
> > > return Status;
> > >
> > > }
> > >
> > >
> > >
> > > diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
> > > b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
> > > index c4ca6ad6ee..421c293cfc 100644
> > > --- a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
> > > +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
> > > @@ -2308,6 +2308,29 @@ HiiGetConfigRespInfo (
> > > IN CONST EFI_HII_DATABASE_PROTOCOL *This
> > >
> > > );
> > >
> > >
> > >
> > > +/**
> > >
> > > + Find question default value from PcdNvStoreDefaultValueBuffer
> > >
> > > +
> > >
> > > + @param DefaultId Default store ID
> > >
> > > + @param EfiVarStore Point to EFI VarStore header
> > >
> > > + @param IfrQuestionHdr Point to Question header
> > >
> > > + @param ValueBuffer Point to Buffer includes the found default
> > > setting
> > >
> > > + @param Width Width of the default value
> > >
> > > + @param BitFieldQuestion Whether the Question is stored in Bit
> field.
> > >
> > > +
> > >
> > > + @retval EFI_SUCCESS Question default value is found.
> > >
> > > + @retval EFI_NOT_FOUND Question default value is not found.
> > >
> > > +**/
> > >
> > > +EFI_STATUS
> > >
> > > +FindQuestionDefaultSetting (
> > >
> > > + IN UINT16 DefaultId,
> > >
> > > + IN EFI_IFR_VARSTORE_EFI *EfiVarStore,
> > >
> > > + IN EFI_IFR_QUESTION_HEADER *IfrQuestionHdr,
> > >
> > > + OUT VOID *ValueBuffer,
> > >
> > > + IN UINTN Width,
> > >
> > > + IN BOOLEAN BitFieldQuestion
> > >
> > > + );
> > >
> > > +
> > >
> > > //
> > >
> > > // Global variables
> > >
> > > //
> > >
> > > --
> > > 2.25.1
> >
> >
> >
> >
> >
> >
> >
>
>
>
>
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-04-08 2:56 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-01 6:09 [PATCH-V2] Fix Setup numeric default value incorrect issue Chen Lin Z
2022-04-07 1:46 ` Chen Lin Z
2022-04-07 5:04 ` 回复: " gaoliming
[not found] ` <16E384C9AA220AC9.11968@groups.io>
2022-04-08 0:47 ` 回复: [edk2-devel] " gaoliming
2022-04-08 2:12 ` Dandan Bi
2022-04-08 2:56 ` Chen Lin Z
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox