[Patch V2 1/2] MdeModulePkg: Change the PldHeader to Header in ExtraData.h
Change the PldHeader to Header in UNIVERSAL_PAYLOAD_EXTRA_DATA The meaning of Pld is too general
Cc: Zhiguang Liu <zhiguang.liu@...> Cc: Ray Ni <ray.ni@...> Cc: Jian J Wang <jian.j.wang@...> Cc: Hao A Wu <hao.a.wu@...> Reviewed-by: Zhiguang Liu <zhiguang.liu@...> Acked-by: Hao A Wu <hao.a.wu@...>
Signed-off-by: DunTan <dun.tan@...> --- MdeModulePkg/Include/UniversalPayload/ExtraData.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/MdeModulePkg/Include/UniversalPayload/ExtraData.h b/MdeModulePkg/Include/UniversalPayload/ExtraData.h index 146ec845f6..1128f5f47b 100644 --- a/MdeModulePkg/Include/UniversalPayload/ExtraData.h +++ b/MdeModulePkg/Include/UniversalPayload/ExtraData.h @@ -18,11 +18,13 @@ typedef struct { } UNIVERSAL_PAYLOAD_EXTRA_DATA_ENTRY; typedef struct { - UNIVERSAL_PAYLOAD_GENERIC_HEADER PldHeader; + UNIVERSAL_PAYLOAD_GENERIC_HEADER Header; UINT32 Count; UNIVERSAL_PAYLOAD_EXTRA_DATA_ENTRY Entry[0]; } UNIVERSAL_PAYLOAD_EXTRA_DATA; #pragma pack() +#define UNIVERSAL_PAYLOAD_EXTRA_DATA_REVISION 1 + #endif -- 2.31.1.windows.1
|
|
[Patch V2 0/2] Fix the length and PldHeader for UniversalPayload ExtraData
Change PldHeader to Header in ExtraData.h Assign the length and revision of UniversalPayload ExtraData
duntan (2): MdeModulePkg: Change the PldHeader to Header in ExtraData.h UefiPayloadPkg: Assign the length of UniversalPayload ExtraData
MdeModulePkg/Include/UniversalPayload/ExtraData.h | 4 +++- UefiPayloadPkg/PayloadLoaderPeim/PayloadLoaderPeim.c | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-)
-- 2.31.1.windows.1
|
|
Re: [PATCH] MdeModulePkg/RegularExpressionDxe: Fix memory assert in FreePool()
toggle quoted message
Show quoted text
-----Original Message----- From: gaoliming <gaoliming@...> Sent: Monday, July 5, 2021 9:46 AM To: devel@edk2.groups.io; Wang, Nickle (HPS SW) <nickle.wang@...>; lersek@... Cc: jian.j.wang@...; hao.a.wu@... Subject: 回复: [edk2-devel] [PATCH] MdeModulePkg/RegularExpressionDxe: Fix memory assert in FreePool() Please also add this file into the ignored file list. Thanks Liming -----邮件原件----- 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Nickle Wang 发送时间: 2021年7月5日 8:55 收件人: devel@edk2.groups.io; gaoliming@...; lersek@... 抄送: jian.j.wang@...; hao.a.wu@...; Wang, Nickle (HPS SW) <nickle.wang@...> 主题: Re: [edk2-devel] [PATCH] MdeModulePkg/RegularExpressionDxe: Fix memory assert in FreePool()
Thanks Liming! I create personal PR below and I also see CI error on OnigurumaUefiPort.h. It looks like "Ubuntu GCC PR" does not like the coding style on OnigurumaUefiPort.h. However, I just follow the coding style of other functions in this file.
https://github.com/tianocore/edk2/pull/1788
So, should I add this file into exception list too? Or I just follow the coding style on what I modified?
Thanks, Nickle
-----Original Message----- From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of gaoliming Sent: Thursday, July 1, 2021 1:19 PM To: devel@edk2.groups.io; Wang, Nickle (HPS SW) <nickle.wang@...>; lersek@... Cc: jian.j.wang@...; hao.a.wu@... Subject: 回复: [edk2-devel] [PATCH] MdeModulePkg/RegularExpressionDxe: Fix memory assert in FreePool()
Nickle: You can create personal PR to verify this change first. If it passes CI, please send the updated patch set.
Thanks Liming
-----邮件原件----- 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Nickle Wang
发送时间: 2021年6月30日 21:11 收件人: devel@edk2.groups.io; Wang, Nickle (HPS SW) <nickle.wang@...>; gaoliming <gaoliming@...>; lersek@... 抄送: jian.j.wang@...; hao.a.wu@...; Wang, Nickle (HPS SW) <nickle.wang@...> 主题: Re: [edk2-devel] [PATCH] MdeModulePkg/RegularExpressionDxe: Fix memory assert in FreePool()
Hi Liming,
I got my patch ready. Should I test it by creating PR on Github like https://github.com/tianocore/edk2/pull/1735? Or I just send out new patch for review?
Thanks, Nickle
-----Original Message----- From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Nickle Wang Sent: Wednesday, June 30, 2021 9:49 AM To: gaoliming <gaoliming@...>; devel@edk2.groups.io; lersek@... Cc: jian.j.wang@...; hao.a.wu@...; Wang, Nickle (HPS SW) <nickle.wang@...> Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/RegularExpressionDxe: Fix memory assert in FreePool()
I see. Thanks for your quick response. I will work on it.
Nickle
-----Original Message----- From: gaoliming <gaoliming@...> Sent: Wednesday, June 30, 2021 9:43 AM To: Wang, Nickle (HPS SW) <nickle.wang@...>; devel@edk2.groups.io;
lersek@... Cc: jian.j.wang@...; hao.a.wu@... Subject: 回复: [edk2-devel] [PATCH] MdeModulePkg/RegularExpressionDxe:
Fix memory assert in FreePool()
This is a separate commit. You can send it together with previous patch.
Thanks Liming
-----邮件原件----- 发件人: Wang, Nickle (HPS SW) <nickle.wang@...> 发送时间: 2021年6月30日 9:29 收件人: gaoliming <gaoliming@...>; devel@edk2.groups.io; lersek@... 抄送: jian.j.wang@...; hao.a.wu@...; Wang, Nickle (HPS SW)
<nickle.wang@...> 主题: RE: [edk2-devel] [PATCH] MdeModulePkg/RegularExpressionDxe: Fix
memory assert in FreePool()
Hi Liming,
No problem. It looks like I have to add OnigurumaUefiPort.c into "IgnoreFiles"
object in MdeModulePkg.ci.yaml. And should I send this patch alone? Or I have to send it as a part of patch in early fix?
Thanks, Nickle
-----Original Message----- From: gaoliming <gaoliming@...> Sent: Wednesday, June 30, 2021 9:06 AM To: devel@edk2.groups.io; lersek@...; Wang, Nickle (HPS SW) <nickle.wang@...> Cc: jian.j.wang@...; hao.a.wu@... Subject: 回复: [edk2-devel] [PATCH] MdeModulePkg/RegularExpressionDxe:
Fix memory assert in FreePool()
Laszlo: Yes. I agree to add OnigurumaUefiPort.c into ECC exception in MdeModulePkg.ci.yaml.
Nickle: Can you provide the patch to update MdeModulePkg.ci.yaml?
Thanks Liming
-----邮件原件----- 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Laszlo Ersek
发送时间: 2021年6月29日 22:52 收件人: devel@edk2.groups.io; nickle.wang@... 抄送: gaoliming@...; jian.j.wang@...; hao.a.wu@... 主题: Re: [edk2-devel] [PATCH] MdeModulePkg/RegularExpressionDxe: Fix
memory assert in FreePool()
On 06/10/21 06:56, Nickle Wang wrote:
Memory buffer that is allocated by malloc() and realloc() will be shifted by 8 bytes because Oniguruma keeps its memory signature. This 8 bytes shift is not handled while calling free() to release memory. Add free() function to check Oniguruma signature before release memory because memory buffer is not touched when using calloc().
Signed-off-by: Nickle Wang <nickle.wang@...> --- .../RegularExpressionDxe/OnigurumaUefiPort.c | 19 ++++++++++++++++++-
.../RegularExpressionDxe/OnigurumaUefiPort.h | 14 ++------------ 2 files changed, 20 insertions(+), 13 deletions(-)
diff --git
a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c
b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c
index 9aa7b0a68e..5c34324db8 100644 ---
a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c
+++
b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c
@@ -2,7 +2,7 @@
Module to rewrite stdlib references within Oniguruma
- (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP<BR>
+ (C) Copyright 2014-2021 Hewlett Packard Enterprise + Development LP<BR>
Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -96,3 +96,20
@@
void* memset (void *dest, char ch, unsigned int count)
return SetMem (dest, count, ch); }
+void free(void *ptr) +{ + VOID *EvalOnce; + ONIGMEM_HEAD *PoolHdr; + + EvalOnce = ptr; + if (EvalOnce == NULL) { + return; + } + + PoolHdr = (ONIGMEM_HEAD *)EvalOnce - 1; + if (PoolHdr->Signature == ONIGMEM_HEAD_SIGNATURE) { + FreePool (PoolHdr); + } else { + FreePool (EvalOnce); + } +} diff --git
a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h
b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h
index 20b75c3361..0bdb7be529 100644 ---
a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h
+++
b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h
@@ -2,7 +2,7 @@
Module to rewrite stdlib references within Oniguruma
- (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP<BR>
+ (C) Copyright 2014-2021 Hewlett Packard Enterprise + Development LP<BR>
Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -46,17 +46,6 @@ typedef INTN intptr_t; #endif
#define calloc(n,s) AllocateZeroPool((n)*(s)) - -#define free(p) \ - do { \ - VOID *EvalOnce; \ - \ - EvalOnce = (p); \ - if (EvalOnce != NULL) { \ - FreePool (EvalOnce); \ - } \ - } while (FALSE) - #define xmemmove(Dest,Src,Length) CopyMem(Dest,Src,Length) #define
xmemcpy(Dest,Src,Length) CopyMem(Dest,Src,Length) #define xmemset(Buffer,Value,Length) SetMem(Buffer,Length,Value) @@ -98,6 +87,7 @@ void* malloc(size_t size); void* realloc(void *ptr, size_t size); void* memcpy (void *dest, const void *src, unsigned int count); void* memset (void *dest, char ch, unsigned int count); +void free(void *ptr);
#define exit(n) ASSERT(FALSE);
This patch cannot be merged, due to a number of EccCheck complaints:
2021-06-21T01:44:13.4327861Z PROGRESS - --Running MdeModulePkg: EccCheck Test NO-TARGET -- 2021-06-21T01:44:20.4922300Z ERROR -
2021-06-21T01:44:20.4924178Z
ERROR - EFI coding style error 2021-06-21T01:44:20.4925524Z ERROR - *Error code: 4002 2021-06-21T01:44:20.4927323Z ERROR - *Function header doesn't exist 2021-06-21T01:44:20.4936437Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.c 2021-06-21T01:44:20.4937669Z ERROR - *Line number: 99 2021-06-21T01:44:20.4938737Z ERROR - *Function [free] has NO comment
immediately preceding it. 2021-06-21T01:44:20.4945489Z ERROR -
2021-06-21T01:44:20.4951382Z
ERROR - EFI coding style error 2021-06-21T01:44:20.4960149Z ERROR - *Error code: 4002 2021-06-21T01:44:20.4961161Z ERROR - *Function header doesn't exist 2021-06-21T01:44:20.4966674Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.h 2021-06-21T01:44:20.4973232Z ERROR - *Line number: 90 2021-06-21T01:44:20.4978337Z ERROR - *Function [free] has NO comment
immediately preceding it. 2021-06-21T01:44:20.4981257Z ERROR -
2021-06-21T01:44:20.4983805Z
ERROR - EFI coding style error 2021-06-21T01:44:20.4986537Z ERROR - *Error code: 5001 2021-06-21T01:44:20.4989508Z ERROR - *Return type of a function should exist and in the first line 2021-06-21T01:44:20.4997043Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.h 2021-06-21T01:44:20.4997804Z ERROR - *Line number: 90 2021-06-21T01:44:20.4998331Z ERROR - *[free] Return Type should appear on its own line 2021-06-21T01:44:20.4998762Z ERROR - 2021-06-21T01:44:20.4999175Z ERROR - EFI coding style error 2021-06-21T01:44:20.5017351Z ERROR - *Error code: 5003 2021-06-21T01:44:20.5023282Z ERROR - *Function name should be left justified, followed by the beginning of the parameter list, with the closing parenthesis on its own line, indented two spaces 2021-06-21T01:44:20.5024931Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.c 2021-06-21T01:44:20.5025818Z ERROR - *Line number: 99 2021-06-21T01:44:20.5026960Z ERROR - *Function name [free] should appear at the start of a line 2021-06-21T01:44:20.5027533Z ERROR - 2021-06-21T01:44:20.5027982Z ERROR - EFI coding style error 2021-06-21T01:44:20.5028454Z ERROR - *Error code: 5003 2021-06-21T01:44:20.5029279Z ERROR - *Function name should be left justified, followed by the beginning of the parameter list, with the closing parenthesis on its own line, indented two spaces 2021-06-21T01:44:20.5030177Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.h 2021-06-21T01:44:20.5030770Z ERROR - *Line number: 90 2021-06-21T01:44:20.5031330Z ERROR - *Function name [free] should appear at the start of a line 2021-06-21T01:44:20.5031788Z ERROR - 2021-06-21T01:44:20.5032240Z ERROR - EFI coding style error 2021-06-21T01:44:20.5032706Z ERROR - *Error code: 5003 2021-06-21T01:44:20.5033554Z ERROR - *Function name should be left justified, followed by the beginning of the parameter list, with the closing parenthesis on its own line, indented two spaces 2021-06-21T01:44:20.5036470Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.h 2021-06-21T01:44:20.5040063Z ERROR - *Line number: 90 2021-06-21T01:44:20.5043513Z ERROR - *Parameter ptr should be in its own line. 2021-06-21T01:44:20.5046782Z ERROR -
2021-06-21T01:44:20.5049909Z
ERROR - EFI coding style error 2021-06-21T01:44:20.5053571Z ERROR - *Error code: 5003 2021-06-21T01:44:20.5057415Z ERROR - *Function name should be left justified, followed by the beginning of the parameter list, with the closing parenthesis on its own line, indented two spaces 2021-06-21T01:44:20.5066200Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.h 2021-06-21T01:44:20.5066831Z ERROR - *Line number: 90 2021-06-21T01:44:20.5067378Z ERROR - *')' should be on a new line and indented two spaces 2021-06-21T01:44:20.5067799Z ERROR - 2021-06-21T01:44:20.5068211Z ERROR - EFI coding style error 2021-06-21T01:44:20.5070600Z ERROR - *Error code: 7001 2021-06-21T01:44:20.5074448Z ERROR - *There should be no use of int, unsigned, char, void, long in any .c, .h or .asl files 2021-06-21T01:44:20.5077965Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.c 2021-06-21T01:44:20.5081222Z ERROR - *Line number: 110 2021-06-21T01:44:20.5084248Z ERROR - *Parameter ptr 2021-06-21T01:44:20.5090115Z ERROR -
2021-06-21T01:44:20.5090517Z
ERROR - EFI coding style error 2021-06-21T01:44:20.5090923Z ERROR - *Error code: 7001 2021-06-21T01:44:20.5093481Z ERROR - *There should
be no use of int, unsigned, char, void, long in any .c, .h or .asl files 2021-06-21T01:44:20.5096387Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.h 2021-06-21T01:44:20.5099658Z ERROR - *Line number: 90 2021-06-21T01:44:20.5103008Z ERROR - *free Return type void 2021-06-21T01:44:20.5105878Z ERROR -
2021-06-21T01:44:20.5108537Z
ERROR - EFI coding style error 2021-06-21T01:44:20.5111630Z ERROR - *Error code: 7001 2021-06-21T01:44:20.5115083Z ERROR - *There should
be no use of int, unsigned, char, void, long in any .c, .h or .asl files 2021-06-21T01:44:20.5118600Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.h 2021-06-21T01:44:20.5126189Z ERROR - *Line number: 90 2021-06-21T01:44:20.5142100Z ERROR - *Parameter ptr 2021-06-21T01:44:20.5142574Z ERROR -
2021-06-21T01:44:20.5142979Z
ERROR - EFI coding style error 2021-06-21T01:44:20.5143429Z ERROR - *Error code: 8005 2021-06-21T01:44:20.5144332Z ERROR - *Variable name does not follow the rules: 1. First character should be upper case 2. Must contain lower case characters 3. No white space characters 4. Global variable name must start with a 'g' 2021-06-21T01:44:20.5145416Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.h 2021-06-21T01:44:20.5146050Z ERROR - *Line number: 90 2021-06-21T01:44:20.5146555Z ERROR - *Parameter [ptr] NOT follow naming convention. 2021-06-21T01:44:20.5146963Z ERROR -
2021-06-21T01:44:20.5147366Z
ERROR - EFI coding style error 2021-06-21T01:44:20.5147794Z ERROR - *Error code: 8006 2021-06-21T01:44:20.5148562Z ERROR - *Function name does not follow the rules: 1. First character should be upper case 2. Must contain lower case characters 3. No white space characters 2021-06-21T01:44:20.5149399Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.c 2021-06-21T01:44:20.5149932Z ERROR - *Line number: 99 2021-06-21T01:44:20.5150445Z ERROR - *The function name [free] does not follow the rules 2021-06-21T01:44:20.5155470Z ERROR - --->Test Failed: EccCheck Test NO-TARGET returned 1
These are all (or mostly) related to preexistent code, so I think the EccCheck plugin config should be updated in MdeModulePkg, to permit an exception for these files.
For now, I've closed <https://github.com/tianocore/edk2/pull/1735> without merging it.
Thanks Laszlo
|
|
[PATCH v2 2/2] MdeModulePkg: Update YAML file to fix CI error
Add OnigurumaUefiPort.h and OnigurumaUefiPort.c into ECC exception in MdeModulePkg.ci.yaml in order to fix CI error.
Signed-off-by: Nickle Wang <nickle.wang@...> --- MdeModulePkg/MdeModulePkg.ci.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/MdeModulePkg/MdeModulePkg.ci.yaml b/MdeModulePkg/MdeModulePkg.= ci.yaml index 4c71468bd3..8e01caf94c 100644 --- a/MdeModulePkg/MdeModulePkg.ci.yaml +++ b/MdeModulePkg/MdeModulePkg.ci.yaml @@ -3,6 +3,7 @@ #=0D # Copyright (c) Microsoft Corporation=0D # Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>=0D +# (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>=0D # SPDX-License-Identifier: BSD-2-Clause-Patent=0D ##=0D {=0D @@ -24,7 +25,9 @@ "Library/BrotliCustomDecompressLib/brotli",=0D "Universal/RegularExpressionDxe/oniguruma",=0D "Library/LzmaCustomDecompressLib/Sdk/DOC",=0D - "Library/LzmaCustomDecompressLib/Sdk/C"=0D + "Library/LzmaCustomDecompressLib/Sdk/C",=0D + "Universal/RegularExpressionDxe/OnigurumaUefiPort.h",=0D + "Universal/RegularExpressionDxe/OnigurumaUefiPort.c"=0D ]=0D },=0D ## options defined ci/Plugin/CompilerPlugin=0D --=20 2.31.1.windows.1
|
|
[PATCH v2 1/2] MdeModulePkg/RegularExpressionDxe: Fix memory assert in FreePool()
Memory buffer that is allocated by malloc() and realloc() will be shifted by 8 bytes because Oniguruma keeps its memory signature. This 8 bytes shift is not handled while calling free() to release memory. Add free() function to check Oniguruma signature before release memory because memory buffer is not touched when using calloc().
Signed-off-by: Nickle Wang <nickle.wang@...> --- .../RegularExpressionDxe/OnigurumaUefiPort.c | 19 ++++++++++++++++++- .../RegularExpressionDxe/OnigurumaUefiPort.h | 14 ++------------ 2 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.= c b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c index 9aa7b0a68e..4659c4473e 100644 --- a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c +++ b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c @@ -2,7 +2,7 @@ =0D Module to rewrite stdlib references within Oniguruma=0D =0D - (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP<BR>=0D + (C) Copyright 2014-2021 Hewlett Packard Enterprise Development LP<BR>=0D Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>=0D =0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D @@ -96,3 +96,20 @@ void* memset (void *dest, char ch, unsigned int count) return SetMem (dest, count, ch);=0D }=0D =0D +void free(void *ptr)=0D +{=0D + VOID *EvalOnce;=0D + ONIGMEM_HEAD *PoolHdr;=0D +=0D + EvalOnce =3D ptr;=0D + if (EvalOnce =3D=3D NULL) {=0D + return;=0D + }=0D +=0D + PoolHdr =3D (ONIGMEM_HEAD *)EvalOnce - 1;=0D + if (PoolHdr->Signature =3D=3D ONIGMEM_HEAD_SIGNATURE) {=0D + FreePool (PoolHdr);=0D + } else {=0D + FreePool (EvalOnce);=0D + }=0D +}=0D diff --git a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.= h b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h index 20b75c3361..0bdb7be529 100644 --- a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h +++ b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h @@ -2,7 +2,7 @@ =0D Module to rewrite stdlib references within Oniguruma=0D =0D - (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP<BR>=0D + (C) Copyright 2014-2021 Hewlett Packard Enterprise Development LP<BR>=0D Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>=0D =0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D @@ -46,17 +46,6 @@ typedef INTN intptr_t; #endif=0D =0D #define calloc(n,s) AllocateZeroPool((n)*(s))=0D -=0D -#define free(p) \=0D - do { \=0D - VOID *EvalOnce; \=0D - \=0D - EvalOnce =3D (p); \=0D - if (EvalOnce !=3D NULL) { \=0D - FreePool (EvalOnce); \=0D - } \=0D - } while (FALSE)=0D -=0D #define xmemmove(Dest,Src,Length) CopyMem(Dest,Src,Length)=0D #define xmemcpy(Dest,Src,Length) CopyMem(Dest,Src,Length)=0D #define xmemset(Buffer,Value,Length) SetMem(Buffer,Length,Value)=0D @@ -98,6 +87,7 @@ void* malloc(size_t size); void* realloc(void *ptr, size_t size);=0D void* memcpy (void *dest, const void *src, unsigned int count);=0D void* memset (void *dest, char ch, unsigned int count);=0D +void free(void *ptr);=0D =0D #define exit(n) ASSERT(FALSE);=0D =0D --=20 2.31.1.windows.1
|
|
回复: [edk2-devel] [PATCH] MdeModulePkg/RegularExpressionDxe: Fix memory assert in FreePool()
Please also add this file into the ignored file list.
Thanks Liming
toggle quoted message
Show quoted text
-----邮件原件----- 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Nickle Wang 发送时间: 2021年7月5日 8:55 收件人: devel@edk2.groups.io; gaoliming@...; lersek@... 抄送: jian.j.wang@...; hao.a.wu@...; Wang, Nickle (HPS SW) <nickle.wang@...> 主题: Re: [edk2-devel] [PATCH] MdeModulePkg/RegularExpressionDxe: Fix memory assert in FreePool()
Thanks Liming! I create personal PR below and I also see CI error on OnigurumaUefiPort.h. It looks like "Ubuntu GCC PR" does not like the coding style on OnigurumaUefiPort.h. However, I just follow the coding style of other functions in this file.
https://github.com/tianocore/edk2/pull/1788
So, should I add this file into exception list too? Or I just follow the coding style on what I modified?
Thanks, Nickle
-----Original Message----- From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of gaoliming Sent: Thursday, July 1, 2021 1:19 PM To: devel@edk2.groups.io; Wang, Nickle (HPS SW) <nickle.wang@...>; lersek@... Cc: jian.j.wang@...; hao.a.wu@... Subject: 回复: [edk2-devel] [PATCH] MdeModulePkg/RegularExpressionDxe: Fix memory assert in FreePool()
Nickle: You can create personal PR to verify this change first. If it passes CI, please send the updated patch set.
Thanks Liming
-----邮件原件----- 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Nickle Wang
发送时间: 2021年6月30日 21:11 收件人: devel@edk2.groups.io; Wang, Nickle (HPS SW) <nickle.wang@...>; gaoliming <gaoliming@...>; lersek@... 抄送: jian.j.wang@...; hao.a.wu@...; Wang, Nickle (HPS SW) <nickle.wang@...> 主题: Re: [edk2-devel] [PATCH] MdeModulePkg/RegularExpressionDxe: Fix memory assert in FreePool()
Hi Liming,
I got my patch ready. Should I test it by creating PR on Github like https://github.com/tianocore/edk2/pull/1735? Or I just send out new patch for review?
Thanks, Nickle
-----Original Message----- From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Nickle Wang Sent: Wednesday, June 30, 2021 9:49 AM To: gaoliming <gaoliming@...>; devel@edk2.groups.io; lersek@... Cc: jian.j.wang@...; hao.a.wu@...; Wang, Nickle (HPS SW) <nickle.wang@...> Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/RegularExpressionDxe: Fix memory assert in FreePool()
I see. Thanks for your quick response. I will work on it.
Nickle
-----Original Message----- From: gaoliming <gaoliming@...> Sent: Wednesday, June 30, 2021 9:43 AM To: Wang, Nickle (HPS SW) <nickle.wang@...>; devel@edk2.groups.io;
lersek@... Cc: jian.j.wang@...; hao.a.wu@... Subject: 回复: [edk2-devel] [PATCH] MdeModulePkg/RegularExpressionDxe:
Fix memory assert in FreePool()
This is a separate commit. You can send it together with previous patch.
Thanks Liming
-----邮件原件----- 发件人: Wang, Nickle (HPS SW) <nickle.wang@...> 发送时间: 2021年6月30日 9:29 收件人: gaoliming <gaoliming@...>; devel@edk2.groups.io; lersek@... 抄送: jian.j.wang@...; hao.a.wu@...; Wang, Nickle (HPS SW)
<nickle.wang@...> 主题: RE: [edk2-devel] [PATCH] MdeModulePkg/RegularExpressionDxe: Fix
memory assert in FreePool()
Hi Liming,
No problem. It looks like I have to add OnigurumaUefiPort.c into "IgnoreFiles"
object in MdeModulePkg.ci.yaml. And should I send this patch alone? Or I have to send it as a part of patch in early fix?
Thanks, Nickle
-----Original Message----- From: gaoliming <gaoliming@...> Sent: Wednesday, June 30, 2021 9:06 AM To: devel@edk2.groups.io; lersek@...; Wang, Nickle (HPS SW) <nickle.wang@...> Cc: jian.j.wang@...; hao.a.wu@... Subject: 回复: [edk2-devel] [PATCH] MdeModulePkg/RegularExpressionDxe:
Fix memory assert in FreePool()
Laszlo: Yes. I agree to add OnigurumaUefiPort.c into ECC exception in MdeModulePkg.ci.yaml.
Nickle: Can you provide the patch to update MdeModulePkg.ci.yaml?
Thanks Liming
-----邮件原件----- 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Laszlo Ersek
发送时间: 2021年6月29日 22:52 收件人: devel@edk2.groups.io; nickle.wang@... 抄送: gaoliming@...; jian.j.wang@...; hao.a.wu@... 主题: Re: [edk2-devel] [PATCH] MdeModulePkg/RegularExpressionDxe: Fix
memory assert in FreePool()
On 06/10/21 06:56, Nickle Wang wrote:
Memory buffer that is allocated by malloc() and realloc() will be shifted by 8 bytes because Oniguruma keeps its memory signature. This 8 bytes shift is not handled while calling free() to release memory. Add free() function to check Oniguruma signature before release memory because memory buffer is not touched when using calloc().
Signed-off-by: Nickle Wang <nickle.wang@...> --- .../RegularExpressionDxe/OnigurumaUefiPort.c | 19 ++++++++++++++++++-
.../RegularExpressionDxe/OnigurumaUefiPort.h | 14 ++------------ 2 files changed, 20 insertions(+), 13 deletions(-)
diff --git
a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c
b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c
index 9aa7b0a68e..5c34324db8 100644 ---
a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c
+++
b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c
@@ -2,7 +2,7 @@
Module to rewrite stdlib references within Oniguruma
- (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP<BR>
+ (C) Copyright 2014-2021 Hewlett Packard Enterprise + Development LP<BR>
Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -96,3 +96,20
@@
void* memset (void *dest, char ch, unsigned int count)
return SetMem (dest, count, ch); }
+void free(void *ptr) +{ + VOID *EvalOnce; + ONIGMEM_HEAD *PoolHdr; + + EvalOnce = ptr; + if (EvalOnce == NULL) { + return; + } + + PoolHdr = (ONIGMEM_HEAD *)EvalOnce - 1; + if (PoolHdr->Signature == ONIGMEM_HEAD_SIGNATURE) { + FreePool (PoolHdr); + } else { + FreePool (EvalOnce); + } +} diff --git
a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h
b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h
index 20b75c3361..0bdb7be529 100644 ---
a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h
+++
b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h
@@ -2,7 +2,7 @@
Module to rewrite stdlib references within Oniguruma
- (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP<BR>
+ (C) Copyright 2014-2021 Hewlett Packard Enterprise + Development LP<BR>
Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -46,17 +46,6 @@ typedef INTN intptr_t; #endif
#define calloc(n,s) AllocateZeroPool((n)*(s)) - -#define free(p) \ - do { \ - VOID *EvalOnce; \ - \ - EvalOnce = (p); \ - if (EvalOnce != NULL) { \ - FreePool (EvalOnce); \ - } \ - } while (FALSE) - #define xmemmove(Dest,Src,Length) CopyMem(Dest,Src,Length) #define
xmemcpy(Dest,Src,Length) CopyMem(Dest,Src,Length) #define xmemset(Buffer,Value,Length) SetMem(Buffer,Length,Value) @@ -98,6 +87,7 @@ void* malloc(size_t size); void* realloc(void *ptr, size_t size); void* memcpy (void *dest, const void *src, unsigned int count); void* memset (void *dest, char ch, unsigned int count); +void free(void *ptr);
#define exit(n) ASSERT(FALSE);
This patch cannot be merged, due to a number of EccCheck complaints:
2021-06-21T01:44:13.4327861Z PROGRESS - --Running MdeModulePkg: EccCheck Test NO-TARGET -- 2021-06-21T01:44:20.4922300Z ERROR -
2021-06-21T01:44:20.4924178Z
ERROR - EFI coding style error 2021-06-21T01:44:20.4925524Z ERROR - *Error code: 4002 2021-06-21T01:44:20.4927323Z ERROR - *Function header doesn't exist 2021-06-21T01:44:20.4936437Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.c 2021-06-21T01:44:20.4937669Z ERROR - *Line number: 99 2021-06-21T01:44:20.4938737Z ERROR - *Function [free] has NO comment
immediately preceding it. 2021-06-21T01:44:20.4945489Z ERROR -
2021-06-21T01:44:20.4951382Z
ERROR - EFI coding style error 2021-06-21T01:44:20.4960149Z ERROR - *Error code: 4002 2021-06-21T01:44:20.4961161Z ERROR - *Function header doesn't exist 2021-06-21T01:44:20.4966674Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.h 2021-06-21T01:44:20.4973232Z ERROR - *Line number: 90 2021-06-21T01:44:20.4978337Z ERROR - *Function [free] has NO comment
immediately preceding it. 2021-06-21T01:44:20.4981257Z ERROR -
2021-06-21T01:44:20.4983805Z
ERROR - EFI coding style error 2021-06-21T01:44:20.4986537Z ERROR - *Error code: 5001 2021-06-21T01:44:20.4989508Z ERROR - *Return type of a function should exist and in the first line 2021-06-21T01:44:20.4997043Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.h 2021-06-21T01:44:20.4997804Z ERROR - *Line number: 90 2021-06-21T01:44:20.4998331Z ERROR - *[free] Return Type should appear on its own line 2021-06-21T01:44:20.4998762Z ERROR - 2021-06-21T01:44:20.4999175Z ERROR - EFI coding style error 2021-06-21T01:44:20.5017351Z ERROR - *Error code: 5003 2021-06-21T01:44:20.5023282Z ERROR - *Function name should be left justified, followed by the beginning of the parameter list, with the closing parenthesis on its own line, indented two spaces 2021-06-21T01:44:20.5024931Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.c 2021-06-21T01:44:20.5025818Z ERROR - *Line number: 99 2021-06-21T01:44:20.5026960Z ERROR - *Function name [free] should appear at the start of a line 2021-06-21T01:44:20.5027533Z ERROR - 2021-06-21T01:44:20.5027982Z ERROR - EFI coding style error 2021-06-21T01:44:20.5028454Z ERROR - *Error code: 5003 2021-06-21T01:44:20.5029279Z ERROR - *Function name should be left justified, followed by the beginning of the parameter list, with the closing parenthesis on its own line, indented two spaces 2021-06-21T01:44:20.5030177Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.h 2021-06-21T01:44:20.5030770Z ERROR - *Line number: 90 2021-06-21T01:44:20.5031330Z ERROR - *Function name [free] should appear at the start of a line 2021-06-21T01:44:20.5031788Z ERROR - 2021-06-21T01:44:20.5032240Z ERROR - EFI coding style error 2021-06-21T01:44:20.5032706Z ERROR - *Error code: 5003 2021-06-21T01:44:20.5033554Z ERROR - *Function name should be left justified, followed by the beginning of the parameter list, with the closing parenthesis on its own line, indented two spaces 2021-06-21T01:44:20.5036470Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.h 2021-06-21T01:44:20.5040063Z ERROR - *Line number: 90 2021-06-21T01:44:20.5043513Z ERROR - *Parameter ptr should be in its own line. 2021-06-21T01:44:20.5046782Z ERROR -
2021-06-21T01:44:20.5049909Z
ERROR - EFI coding style error 2021-06-21T01:44:20.5053571Z ERROR - *Error code: 5003 2021-06-21T01:44:20.5057415Z ERROR - *Function name should be left justified, followed by the beginning of the parameter list, with the closing parenthesis on its own line, indented two spaces 2021-06-21T01:44:20.5066200Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.h 2021-06-21T01:44:20.5066831Z ERROR - *Line number: 90 2021-06-21T01:44:20.5067378Z ERROR - *')' should be on a new line and indented two spaces 2021-06-21T01:44:20.5067799Z ERROR - 2021-06-21T01:44:20.5068211Z ERROR - EFI coding style error 2021-06-21T01:44:20.5070600Z ERROR - *Error code: 7001 2021-06-21T01:44:20.5074448Z ERROR - *There should be no use of int, unsigned, char, void, long in any .c, .h or .asl files 2021-06-21T01:44:20.5077965Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.c 2021-06-21T01:44:20.5081222Z ERROR - *Line number: 110 2021-06-21T01:44:20.5084248Z ERROR - *Parameter ptr 2021-06-21T01:44:20.5090115Z ERROR -
2021-06-21T01:44:20.5090517Z
ERROR - EFI coding style error 2021-06-21T01:44:20.5090923Z ERROR - *Error code: 7001 2021-06-21T01:44:20.5093481Z ERROR - *There should
be no use of int, unsigned, char, void, long in any .c, .h or .asl files 2021-06-21T01:44:20.5096387Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.h 2021-06-21T01:44:20.5099658Z ERROR - *Line number: 90 2021-06-21T01:44:20.5103008Z ERROR - *free Return type void 2021-06-21T01:44:20.5105878Z ERROR -
2021-06-21T01:44:20.5108537Z
ERROR - EFI coding style error 2021-06-21T01:44:20.5111630Z ERROR - *Error code: 7001 2021-06-21T01:44:20.5115083Z ERROR - *There should
be no use of int, unsigned, char, void, long in any .c, .h or .asl files 2021-06-21T01:44:20.5118600Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.h 2021-06-21T01:44:20.5126189Z ERROR - *Line number: 90 2021-06-21T01:44:20.5142100Z ERROR - *Parameter ptr 2021-06-21T01:44:20.5142574Z ERROR -
2021-06-21T01:44:20.5142979Z
ERROR - EFI coding style error 2021-06-21T01:44:20.5143429Z ERROR - *Error code: 8005 2021-06-21T01:44:20.5144332Z ERROR - *Variable name does not follow the rules: 1. First character should be upper case 2. Must contain lower case characters 3. No white space characters 4. Global variable name must start with a 'g' 2021-06-21T01:44:20.5145416Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.h 2021-06-21T01:44:20.5146050Z ERROR - *Line number: 90 2021-06-21T01:44:20.5146555Z ERROR - *Parameter [ptr] NOT follow naming convention. 2021-06-21T01:44:20.5146963Z ERROR -
2021-06-21T01:44:20.5147366Z
ERROR - EFI coding style error 2021-06-21T01:44:20.5147794Z ERROR - *Error code: 8006 2021-06-21T01:44:20.5148562Z ERROR - *Function name does not follow the rules: 1. First character should be upper case 2. Must contain lower case characters 3. No white space characters 2021-06-21T01:44:20.5149399Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.c 2021-06-21T01:44:20.5149932Z ERROR - *Line number: 99 2021-06-21T01:44:20.5150445Z ERROR - *The function name [free] does not follow the rules 2021-06-21T01:44:20.5155470Z ERROR - --->Test Failed: EccCheck Test NO-TARGET returned 1
These are all (or mostly) related to preexistent code, so I think the EccCheck plugin config should be updated in MdeModulePkg, to permit an exception for these files.
For now, I've closed <https://github.com/tianocore/edk2/pull/1735> without merging it.
Thanks Laszlo
|
|
Re: [PATCH] IntelFsp2Pkg: PatchFv parseInfFile function modification
Thanks Ashraf. Adding my comments below inline.
toggle quoted message
Show quoted text
-----Original Message----- From: S, Ashraf Ali <ashraf.ali.s@...> Sent: Sunday, July 4, 2021 7:23 PM To: devel@edk2.groups.io Cc: S, Ashraf Ali <ashraf.ali.s@...>; Ni, Ray <ray.ni@...>; Chiu, Chasel <chasel.chiu@...>; Desimone, Nathaniel L <nathaniel.l.desimone@...>; Zeng, Star <star.zeng@...> Subject: [PATCH] IntelFsp2Pkg: PatchFv parseInfFile function modification
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3476
parseInfFile currently reading the EFI_BASE_ADDRESS from INF, once the address found still it's continues to read the complete inf file which is not required. once the EFI_BASE_ADDRESS read from the INF no need to read the INF further. MSFT compiler can generate the map file address 8 or 16 based on which architecture the INF is compiler. currently it's support for IA32, it can be update the X64 in future. modification of few typo errors in parseModMapFile, getCurr function required
Signed-off-by: Ashraf Ali S <ashraf.ali.s@...> Cc: Ray Ni <ray.ni@...> Cc: Chasel Chiu <chasel.chiu@...> Cc: Nate DeSimone <nathaniel.l.desimone@...> Cc: Star Zeng <star.zeng@...> --- IntelFsp2Pkg/Tools/PatchFv.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/IntelFsp2Pkg/Tools/PatchFv.py b/IntelFsp2Pkg/Tools/PatchFv.py index 112de4077a..236019b62d 100644 --- a/IntelFsp2Pkg/Tools/PatchFv.py +++ b/IntelFsp2Pkg/Tools/PatchFv.py @@ -1,6 +1,6 @@ ## @ PatchFv.py # -# Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.<BR> +# Copyright (c) 2014 - 2021, Intel Corporation. All rights +reserved.<BR> # SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -297,17 +297,17 @@ class Symbols: # fvOffset = self.getFvOffsetInFd(infFile[0:-4] + ".Fv") fdIn = open(infFile, "r") - rptLine = fdIn.readline() + rptLines = fdIn.readlines() The target line "EFI_BASE_ADDRESS = 0x********" is usually the second line in the generated INF file, do you think we really need to change to "readlines()" to read whole file? It looks to me original readline() implementation is better in efficiency, but just need to break when the match found. self.fdBase = 0xFFFFFFFF - while (rptLine != "" ): + for line in rptLines: #EFI_BASE_ADDRESS = 0xFFFDF400 - match = re.match("^EFI_BASE_ADDRESS\s*=\s*(0x[a-fA-F0-9]+)", rptLine) + match = + re.match("^EFI_BASE_ADDRESS\s*=\s*(0x[a-fA-F0-9]+)", line) if match is not None: self.fdBase = int(match.group(1), 16) - fvOffset - rptLine = fdIn.readline() + break fdIn.close() if self.fdBase == 0xFFFFFFFF: - raise Exception("Could not find EFI_BASE_ADDRESS in INF file!" % fvFile) + raise Exception("Could not find EFI_BASE_ADDRESS in INF + file!" % infFile) return 0
# @@ -402,6 +402,7 @@ class Symbols: # # retval 0 Parsed MOD MAP file successfully # retval 1 There is no moduleEntryPoint in modSymbols + # retval 2 There is no offset for moduleEntryPoint in modSymbols # def parseModMapFile(self, moduleName, mapFile): # @@ -426,7 +427,7 @@ class Symbols: else: #MSFT #0003:00000190 _gComBase 00007a50 SerialPo - patchMapFileMatchString = "^\s[0-9a-fA-F]{4}:[0-9a-fA- F]{8}\s+(\w+)\s+([0-9a-fA-F]{8}\s+)" + patchMapFileMatchString = "^\s[0-9a-fA-F]{4}:[0-9a-fA- F]{8}\s+(\w+)\s+([0-9a-fA-F]{8,16}\s+)" matchKeyGroupIndex = 1 matchSymbolGroupIndex = 2 prefix = '' @@ -498,7 +499,7 @@ class Symbols: # # Get current character # - # retval elf.string[self.index] + # retval self.string[self.index] # retval '' Exception # def getCurr(self): -- 2.30.2.windows.1
|
|
[PATCH] MdeModulePkg PiSmmCore: Change MemoryAttributes message to DEBUG_VERBOSE level
1. Reduce the debug message during boot. 2. Update SmmCore debug level of MemoryAttributesTable align to DxeCore.
Signed-off-by: Yang Gang <yanggang@...> Cc: Eric Dong <eric.dong@...> Cc: Ray Ni <ray.ni@...> Cc: Liming Gao <gaoliming@...> --- .../Core/PiSmmCore/MemoryAttributesTable.c | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c b/MdeMod= ulePkg/Core/PiSmmCore/MemoryAttributesTable.c index de8262ecb9..3e8a80dd7d 100644 --- a/MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c +++ b/MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c @@ -1208,10 +1208,10 @@ PublishMemoryAttributesTable ( ASSERT (Status =3D=3D EFI_BUFFER_TOO_SMALL); =20 do { - DEBUG ((DEBUG_INFO, "MemoryMapSize - 0x%x\n", MemoryMapSize)); + DEBUG ((DEBUG_VERBOSE, "MemoryMapSize - 0x%x\n", MemoryMapSize)); MemoryMap =3D AllocatePool (MemoryMapSize); ASSERT (MemoryMap !=3D NULL); - DEBUG ((DEBUG_INFO, "MemoryMap - 0x%x\n", MemoryMap)); + DEBUG ((DEBUG_VERBOSE, "MemoryMap - 0x%x\n", MemoryMap)); =20 Status =3D SmmCoreGetMemoryMapMemoryAttributesTable ( &MemoryMapSize, @@ -1236,19 +1236,19 @@ PublishMemoryAttributesTable ( MemoryAttributesTable->NumberOfEntries =3D (UINT32)RuntimeEntryCount; MemoryAttributesTable->DescriptorSize =3D (UINT32)DescriptorSize; MemoryAttributesTable->Reserved =3D 0; - DEBUG ((DEBUG_INFO, "MemoryAttributesTable:\n")); - DEBUG ((DEBUG_INFO, " Version - 0x%08x\n", MemoryAttribu= tesTable->Version)); - DEBUG ((DEBUG_INFO, " NumberOfEntries - 0x%08x\n", MemoryAttribu= tesTable->NumberOfEntries)); - DEBUG ((DEBUG_INFO, " DescriptorSize - 0x%08x\n", MemoryAttribu= tesTable->DescriptorSize)); + DEBUG ((DEBUG_VERBOSE, "MemoryAttributesTable:\n")); + DEBUG ((DEBUG_VERBOSE, " Version - 0x%08x\n", MemoryAttr= ibutesTable->Version)); + DEBUG ((DEBUG_VERBOSE, " NumberOfEntries - 0x%08x\n", MemoryAttr= ibutesTable->NumberOfEntries)); + DEBUG ((DEBUG_VERBOSE, " DescriptorSize - 0x%08x\n", MemoryAttr= ibutesTable->DescriptorSize)); MemoryAttributesEntry =3D (EFI_MEMORY_DESCRIPTOR *)(MemoryAttributesTa= ble + 1); for (Index =3D 0; Index < MemoryMapSize/DescriptorSize; Index++) { CopyMem (MemoryAttributesEntry, MemoryMap, DescriptorSize); - DEBUG ((DEBUG_INFO, "Entry (0x%x)\n", MemoryAttributesEntry)); - DEBUG ((DEBUG_INFO, " Type - 0x%x\n", MemoryAttributes= Entry->Type)); - DEBUG ((DEBUG_INFO, " PhysicalStart - 0x%016lx\n", MemoryAttrib= utesEntry->PhysicalStart)); - DEBUG ((DEBUG_INFO, " VirtualStart - 0x%016lx\n", MemoryAttrib= utesEntry->VirtualStart)); - DEBUG ((DEBUG_INFO, " NumberOfPages - 0x%016lx\n", MemoryAttrib= utesEntry->NumberOfPages)); - DEBUG ((DEBUG_INFO, " Attribute - 0x%016lx\n", MemoryAttrib= utesEntry->Attribute)); + DEBUG ((DEBUG_VERBOSE, "Entry (0x%x)\n", MemoryAttributesEntry)); + DEBUG ((DEBUG_VERBOSE, " Type - 0x%x\n", MemoryAttribu= tesEntry->Type)); + DEBUG ((DEBUG_VERBOSE, " PhysicalStart - 0x%016lx\n", MemoryAtt= ributesEntry->PhysicalStart)); + DEBUG ((DEBUG_VERBOSE, " VirtualStart - 0x%016lx\n", MemoryAtt= ributesEntry->VirtualStart)); + DEBUG ((DEBUG_VERBOSE, " NumberOfPages - 0x%016lx\n", MemoryAtt= ributesEntry->NumberOfPages)); + DEBUG ((DEBUG_VERBOSE, " Attribute - 0x%016lx\n", MemoryAtt= ributesEntry->Attribute)); MemoryAttributesEntry =3D NEXT_MEMORY_DESCRIPTOR(MemoryAttributesEnt= ry, DescriptorSize); =20 MemoryMap =3D NEXT_MEMORY_DESCRIPTOR(MemoryMap, DescriptorSize); @@ -1331,7 +1331,7 @@ SmmInstallMemoryAttributesTable ( { SmmInstallImageRecord (); =20 - DEBUG ((DEBUG_INFO, "SMM MemoryProtectionAttribute - 0x%016lx\n", mMem= oryProtectionAttribute)); + DEBUG ((DEBUG_VERBOSE, "SMM MemoryProtectionAttribute - 0x%016lx\n", m= MemoryProtectionAttribute)); if ((mMemoryProtectionAttribute & EFI_MEMORY_ATTRIBUTES_RUNTIME_MEMORY= _PROTECTION_NON_EXECUTABLE_PE_DATA) =3D=3D 0) { return EFI_SUCCESS; } --=20 2.23.0.windows.1
|
|
Re: [PATCH] MdeModulePkg/RegularExpressionDxe: Fix memory assert in FreePool()
Thanks Liming! I create personal PR below and I also see CI error on OnigurumaUefiPort.h. It looks like "Ubuntu GCC PR" does not like the coding style on OnigurumaUefiPort.h. However, I just follow the coding style of other functions in this file. https://github.com/tianocore/edk2/pull/1788So, should I add this file into exception list too? Or I just follow the coding style on what I modified? Thanks, Nickle
toggle quoted message
Show quoted text
-----Original Message----- From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of gaoliming Sent: Thursday, July 1, 2021 1:19 PM To: devel@edk2.groups.io; Wang, Nickle (HPS SW) <nickle.wang@...>; lersek@... Cc: jian.j.wang@...; hao.a.wu@... Subject: 回复: [edk2-devel] [PATCH] MdeModulePkg/RegularExpressionDxe: Fix memory assert in FreePool() Nickle: You can create personal PR to verify this change first. If it passes CI, please send the updated patch set. Thanks Liming -----邮件原件----- 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Nickle Wang 发送时间: 2021年6月30日 21:11 收件人: devel@edk2.groups.io; Wang, Nickle (HPS SW) <nickle.wang@...>; gaoliming <gaoliming@...>; lersek@... 抄送: jian.j.wang@...; hao.a.wu@...; Wang, Nickle (HPS SW) <nickle.wang@...> 主题: Re: [edk2-devel] [PATCH] MdeModulePkg/RegularExpressionDxe: Fix memory assert in FreePool()
Hi Liming,
I got my patch ready. Should I test it by creating PR on Github like https://github.com/tianocore/edk2/pull/1735? Or I just send out new patch for review?
Thanks, Nickle
-----Original Message----- From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Nickle Wang Sent: Wednesday, June 30, 2021 9:49 AM To: gaoliming <gaoliming@...>; devel@edk2.groups.io; lersek@... Cc: jian.j.wang@...; hao.a.wu@...; Wang, Nickle (HPS SW) <nickle.wang@...> Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/RegularExpressionDxe: Fix memory assert in FreePool()
I see. Thanks for your quick response. I will work on it.
Nickle
-----Original Message----- From: gaoliming <gaoliming@...> Sent: Wednesday, June 30, 2021 9:43 AM To: Wang, Nickle (HPS SW) <nickle.wang@...>; devel@edk2.groups.io; lersek@... Cc: jian.j.wang@...; hao.a.wu@... Subject: 回复: [edk2-devel] [PATCH] MdeModulePkg/RegularExpressionDxe: Fix memory assert in FreePool()
This is a separate commit. You can send it together with previous patch.
Thanks Liming
-----邮件原件----- 发件人: Wang, Nickle (HPS SW) <nickle.wang@...> 发送时间: 2021年6月30日 9:29 收件人: gaoliming <gaoliming@...>; devel@edk2.groups.io; lersek@... 抄送: jian.j.wang@...; hao.a.wu@...; Wang, Nickle (HPS SW) <nickle.wang@...> 主题: RE: [edk2-devel] [PATCH] MdeModulePkg/RegularExpressionDxe: Fix memory assert in FreePool()
Hi Liming,
No problem. It looks like I have to add OnigurumaUefiPort.c into "IgnoreFiles"
object in MdeModulePkg.ci.yaml. And should I send this patch alone? Or I have to send it as a part of patch in early fix?
Thanks, Nickle
-----Original Message----- From: gaoliming <gaoliming@...> Sent: Wednesday, June 30, 2021 9:06 AM To: devel@edk2.groups.io; lersek@...; Wang, Nickle (HPS SW) <nickle.wang@...> Cc: jian.j.wang@...; hao.a.wu@... Subject: 回复: [edk2-devel] [PATCH] MdeModulePkg/RegularExpressionDxe:
Fix memory assert in FreePool()
Laszlo: Yes. I agree to add OnigurumaUefiPort.c into ECC exception in MdeModulePkg.ci.yaml.
Nickle: Can you provide the patch to update MdeModulePkg.ci.yaml?
Thanks Liming
-----邮件原件----- 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Laszlo Ersek
发送时间: 2021年6月29日 22:52 收件人: devel@edk2.groups.io; nickle.wang@... 抄送: gaoliming@...; jian.j.wang@...; hao.a.wu@... 主题: Re: [edk2-devel] [PATCH] MdeModulePkg/RegularExpressionDxe: Fix
memory assert in FreePool()
On 06/10/21 06:56, Nickle Wang wrote:
Memory buffer that is allocated by malloc() and realloc() will be shifted by 8 bytes because Oniguruma keeps its memory signature. This 8 bytes shift is not handled while calling free() to release memory. Add free() function to check Oniguruma signature before release memory because memory buffer is not touched when using calloc().
Signed-off-by: Nickle Wang <nickle.wang@...> --- .../RegularExpressionDxe/OnigurumaUefiPort.c | 19 ++++++++++++++++++-
.../RegularExpressionDxe/OnigurumaUefiPort.h | 14 ++------------ 2 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c
index 9aa7b0a68e..5c34324db8 100644 --- a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c
+++ b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c
@@ -2,7 +2,7 @@
Module to rewrite stdlib references within Oniguruma
- (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP<BR>
+ (C) Copyright 2014-2021 Hewlett Packard Enterprise + Development LP<BR>
Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -96,3 +96,20 @@
void* memset (void *dest, char ch, unsigned int count)
return SetMem (dest, count, ch); }
+void free(void *ptr) +{ + VOID *EvalOnce; + ONIGMEM_HEAD *PoolHdr; + + EvalOnce = ptr; + if (EvalOnce == NULL) { + return; + } + + PoolHdr = (ONIGMEM_HEAD *)EvalOnce - 1; + if (PoolHdr->Signature == ONIGMEM_HEAD_SIGNATURE) { + FreePool (PoolHdr); + } else { + FreePool (EvalOnce); + } +} diff --git a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h
index 20b75c3361..0bdb7be529 100644 --- a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h
+++ b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h
@@ -2,7 +2,7 @@
Module to rewrite stdlib references within Oniguruma
- (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP<BR>
+ (C) Copyright 2014-2021 Hewlett Packard Enterprise + Development LP<BR>
Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -46,17 +46,6 @@ typedef INTN intptr_t; #endif
#define calloc(n,s) AllocateZeroPool((n)*(s)) - -#define free(p) \ - do { \ - VOID *EvalOnce; \ - \ - EvalOnce = (p); \ - if (EvalOnce != NULL) { \ - FreePool (EvalOnce); \ - } \ - } while (FALSE) - #define xmemmove(Dest,Src,Length) CopyMem(Dest,Src,Length) #define
xmemcpy(Dest,Src,Length) CopyMem(Dest,Src,Length) #define xmemset(Buffer,Value,Length) SetMem(Buffer,Length,Value) @@ -98,6 +87,7 @@ void* malloc(size_t size); void* realloc(void *ptr, size_t size); void* memcpy (void *dest, const void *src, unsigned int count); void* memset (void *dest, char ch, unsigned int count); +void free(void *ptr);
#define exit(n) ASSERT(FALSE);
This patch cannot be merged, due to a number of EccCheck complaints:
2021-06-21T01:44:13.4327861Z PROGRESS - --Running MdeModulePkg: EccCheck Test NO-TARGET -- 2021-06-21T01:44:20.4922300Z ERROR - 2021-06-21T01:44:20.4924178Z ERROR - EFI coding style error 2021-06-21T01:44:20.4925524Z ERROR - *Error code: 4002 2021-06-21T01:44:20.4927323Z ERROR - *Function header doesn't exist 2021-06-21T01:44:20.4936437Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.c 2021-06-21T01:44:20.4937669Z ERROR - *Line number: 99 2021-06-21T01:44:20.4938737Z ERROR - *Function [free] has NO comment
immediately preceding it. 2021-06-21T01:44:20.4945489Z ERROR - 2021-06-21T01:44:20.4951382Z ERROR - EFI coding style error 2021-06-21T01:44:20.4960149Z ERROR - *Error code: 4002 2021-06-21T01:44:20.4961161Z ERROR - *Function header doesn't exist 2021-06-21T01:44:20.4966674Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.h 2021-06-21T01:44:20.4973232Z ERROR - *Line number: 90 2021-06-21T01:44:20.4978337Z ERROR - *Function [free] has NO comment
immediately preceding it. 2021-06-21T01:44:20.4981257Z ERROR - 2021-06-21T01:44:20.4983805Z ERROR - EFI coding style error 2021-06-21T01:44:20.4986537Z ERROR - *Error code: 5001 2021-06-21T01:44:20.4989508Z ERROR - *Return type of a function should exist and in the first line 2021-06-21T01:44:20.4997043Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.h 2021-06-21T01:44:20.4997804Z ERROR - *Line number: 90 2021-06-21T01:44:20.4998331Z ERROR - *[free] Return Type should appear on its own line 2021-06-21T01:44:20.4998762Z ERROR - 2021-06-21T01:44:20.4999175Z ERROR - EFI coding style error 2021-06-21T01:44:20.5017351Z ERROR - *Error code: 5003 2021-06-21T01:44:20.5023282Z ERROR - *Function name should be left justified, followed by the beginning of the parameter list, with the closing parenthesis on its own line, indented two spaces 2021-06-21T01:44:20.5024931Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.c 2021-06-21T01:44:20.5025818Z ERROR - *Line number: 99 2021-06-21T01:44:20.5026960Z ERROR - *Function name [free] should appear at the start of a line 2021-06-21T01:44:20.5027533Z ERROR - 2021-06-21T01:44:20.5027982Z ERROR - EFI coding style error 2021-06-21T01:44:20.5028454Z ERROR - *Error code: 5003 2021-06-21T01:44:20.5029279Z ERROR - *Function name should be left justified, followed by the beginning of the parameter list, with the closing parenthesis on its own line, indented two spaces 2021-06-21T01:44:20.5030177Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.h 2021-06-21T01:44:20.5030770Z ERROR - *Line number: 90 2021-06-21T01:44:20.5031330Z ERROR - *Function name [free] should appear at the start of a line 2021-06-21T01:44:20.5031788Z ERROR - 2021-06-21T01:44:20.5032240Z ERROR - EFI coding style error 2021-06-21T01:44:20.5032706Z ERROR - *Error code: 5003 2021-06-21T01:44:20.5033554Z ERROR - *Function name should be left justified, followed by the beginning of the parameter list, with the closing parenthesis on its own line, indented two spaces 2021-06-21T01:44:20.5036470Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.h 2021-06-21T01:44:20.5040063Z ERROR - *Line number: 90 2021-06-21T01:44:20.5043513Z ERROR - *Parameter ptr should be in its own line. 2021-06-21T01:44:20.5046782Z ERROR - 2021-06-21T01:44:20.5049909Z ERROR - EFI coding style error 2021-06-21T01:44:20.5053571Z ERROR - *Error code: 5003 2021-06-21T01:44:20.5057415Z ERROR - *Function name should be left justified, followed by the beginning of the parameter list, with the closing parenthesis on its own line, indented two spaces 2021-06-21T01:44:20.5066200Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.h 2021-06-21T01:44:20.5066831Z ERROR - *Line number: 90 2021-06-21T01:44:20.5067378Z ERROR - *')' should be on a new line and indented two spaces 2021-06-21T01:44:20.5067799Z ERROR - 2021-06-21T01:44:20.5068211Z ERROR - EFI coding style error 2021-06-21T01:44:20.5070600Z ERROR - *Error code: 7001 2021-06-21T01:44:20.5074448Z ERROR - *There should be no use of int, unsigned, char, void, long in any .c, .h or .asl files 2021-06-21T01:44:20.5077965Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.c 2021-06-21T01:44:20.5081222Z ERROR - *Line number: 110 2021-06-21T01:44:20.5084248Z ERROR - *Parameter ptr 2021-06-21T01:44:20.5090115Z ERROR - 2021-06-21T01:44:20.5090517Z ERROR - EFI coding style error 2021-06-21T01:44:20.5090923Z ERROR - *Error code: 7001 2021-06-21T01:44:20.5093481Z ERROR - *There should
be no use of int, unsigned, char, void, long in any .c, .h or .asl files 2021-06-21T01:44:20.5096387Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.h 2021-06-21T01:44:20.5099658Z ERROR - *Line number: 90 2021-06-21T01:44:20.5103008Z ERROR - *free Return type void 2021-06-21T01:44:20.5105878Z ERROR - 2021-06-21T01:44:20.5108537Z ERROR - EFI coding style error 2021-06-21T01:44:20.5111630Z ERROR - *Error code: 7001 2021-06-21T01:44:20.5115083Z ERROR - *There should
be no use of int, unsigned, char, void, long in any .c, .h or .asl files 2021-06-21T01:44:20.5118600Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.h 2021-06-21T01:44:20.5126189Z ERROR - *Line number: 90 2021-06-21T01:44:20.5142100Z ERROR - *Parameter ptr 2021-06-21T01:44:20.5142574Z ERROR - 2021-06-21T01:44:20.5142979Z ERROR - EFI coding style error 2021-06-21T01:44:20.5143429Z ERROR - *Error code: 8005 2021-06-21T01:44:20.5144332Z ERROR - *Variable name does not follow the rules: 1. First character should be upper case 2. Must contain lower case characters 3. No white space characters 4. Global variable name must start with a 'g' 2021-06-21T01:44:20.5145416Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.h 2021-06-21T01:44:20.5146050Z ERROR - *Line number: 90 2021-06-21T01:44:20.5146555Z ERROR - *Parameter [ptr] NOT follow naming convention. 2021-06-21T01:44:20.5146963Z ERROR - 2021-06-21T01:44:20.5147366Z ERROR - EFI coding style error 2021-06-21T01:44:20.5147794Z ERROR - *Error code: 8006 2021-06-21T01:44:20.5148562Z ERROR - *Function name does not follow the rules: 1. First character should be upper case 2. Must contain lower case characters 3. No white space characters 2021-06-21T01:44:20.5149399Z ERROR - *file:
//home/vsts/work/1/s/MdeModulePkg/Universal/RegularExpressionDxe/Oni
gurumaUefiPort.c 2021-06-21T01:44:20.5149932Z ERROR - *Line number: 99 2021-06-21T01:44:20.5150445Z ERROR - *The function name [free] does not follow the rules 2021-06-21T01:44:20.5155470Z ERROR - --->Test Failed: EccCheck Test NO-TARGET returned 1
These are all (or mostly) related to preexistent code, so I think the EccCheck plugin config should be updated in MdeModulePkg, to permit an exception for these files.
For now, I've closed <https://github.com/tianocore/edk2/pull/1735> without merging it.
Thanks Laszlo
|
|
Update stable tag release date for future stable tag
Hi, all Based on the proposal in https://edk2.groups.io/g/rfc/message/684, Soft Feature Freeze phase (SFF) will be shorten to 5 days for the reviewed patch merge, Hard Feature Freeze phase (HFF) will be extended to 2 weeks for downstream verification. Meanwhile, tag edk2-stableYYYYMM-rc0 will be created for SFF, and edk2-stableYYYYMM-rc1 will be created for HFF. The detail proposal can refer to https://edk2.groups.io/g/rfc/message/684. For next stable tag 202108, the proposed new date will be the below one. If you have any comments, please reply this mail before July 12th. Date (00:00:00 UTC-8) Description for stable tag 202108 2021-05-28 Beginning of development 2021-08-09 Soft Feature Freeze 2021-08-13 Hard Feature Freeze 2021-08-27 Release Thanks Liming
|
|
Re: [PATCH 1/2] MdeModulePkg: Change the PldHeader to Header in ExtraData.h
Acked-by: Hao A Wu <hao.a.wu@...>
toggle quoted message
Show quoted text
From: Liu, Zhiguang <zhiguang.liu@...>
Sent: Monday, July 5, 2021 9:07 AM
To: Tan, Dun <dun.tan@...>; devel@edk2.groups.io; Wu, Hao A <hao.a.wu@...>; Wang, Jian J <jian.j.wang@...>
Cc: Ni, Ray <ray.ni@...>
Subject: Re: [PATCH 1/2] MdeModulePkg: Change the PldHeader to Header in ExtraData.h
Add MdeModulePkg's maintainers.
Change the PldHeader to Header in UNIVERSAL_PAYLOAD_EXTRA_DATA
The meaning of Pld is too general
Cc: Zhiguang Liu <zhiguang.liu@...>
Cc: Ray Ni <ray.ni@...>
Signed-off-by: DunTan <dun.tan@...>
---
MdeModulePkg/Include/UniversalPayload/ExtraData.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/MdeModulePkg/Include/UniversalPayload/ExtraData.h b/MdeModulePkg/Include/UniversalPayload/ExtraData.h
index 146ec845f6..1128f5f47b 100644
--- a/MdeModulePkg/Include/UniversalPayload/ExtraData.h
+++ b/MdeModulePkg/Include/UniversalPayload/ExtraData.h
@@ -18,11 +18,13 @@ typedef struct {
} UNIVERSAL_PAYLOAD_EXTRA_DATA_ENTRY;
typedef struct {
- UNIVERSAL_PAYLOAD_GENERIC_HEADER PldHeader;
+ UNIVERSAL_PAYLOAD_GENERIC_HEADER Header;
UINT32 Count;
UNIVERSAL_PAYLOAD_EXTRA_DATA_ENTRY Entry[0];
} UNIVERSAL_PAYLOAD_EXTRA_DATA;
#pragma pack()
+#define UNIVERSAL_PAYLOAD_EXTRA_DATA_REVISION 1
+
#endif
--
2.31.1.windows.1
|
|
Re: [PATCH 1/2] MdeModulePkg: Change the PldHeader to Header in ExtraData.h
Reviewed-by: Zhiguang Liu <zhiguang.liu@...>
Add MdeModulePkg's maintainers.
toggle quoted message
Show quoted text
From: Tan, Dun <dun.tan@...>
Sent: Friday, July 2, 2021 15:35
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Liu, Zhiguang <zhiguang.liu@...>; Ni, Ray <ray.ni@...>; Tan, Dun <dun.tan@...>
Subject: [PATCH 1/2] MdeModulePkg: Change the PldHeader to Header in ExtraData.h
Change the PldHeader to Header in UNIVERSAL_PAYLOAD_EXTRA_DATA
The meaning of Pld is too general
Cc: Zhiguang Liu <zhiguang.liu@...>
Cc: Ray Ni <ray.ni@...>
Signed-off-by: DunTan <dun.tan@...>
---
MdeModulePkg/Include/UniversalPayload/ExtraData.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/MdeModulePkg/Include/UniversalPayload/ExtraData.h b/MdeModulePkg/Include/UniversalPayload/ExtraData.h
index 146ec845f6..1128f5f47b 100644
--- a/MdeModulePkg/Include/UniversalPayload/ExtraData.h
+++ b/MdeModulePkg/Include/UniversalPayload/ExtraData.h
@@ -18,11 +18,13 @@ typedef struct {
} UNIVERSAL_PAYLOAD_EXTRA_DATA_ENTRY;
typedef struct {
- UNIVERSAL_PAYLOAD_GENERIC_HEADER PldHeader;
+ UNIVERSAL_PAYLOAD_GENERIC_HEADER Header;
UINT32 Count;
UNIVERSAL_PAYLOAD_EXTRA_DATA_ENTRY Entry[0];
} UNIVERSAL_PAYLOAD_EXTRA_DATA;
#pragma pack()
+#define UNIVERSAL_PAYLOAD_EXTRA_DATA_REVISION 1
+
#endif
--
2.31.1.windows.1
|
|
回复: [edk2-devel] 回复: [edk2][PATCH V3] MdePkg : Add IPMI Macro and Structure Defintions to resolve build errors
This patch in MdePkg has been merged at 55dee4947b20103fc48858b18307bd2b114dc145 on edk2 master. Thanks Liming 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 gaoliming 发送时间: 2021年6月30日 9:22 收件人: devel@edk2.groups.io; gaoliming@...; lateefcs@... 抄送: 'manickavasakam karpagavinayagam' <manickavasakamk@...>; isaac.w.oram@...; nathaniel.l.desimone@...; Felixp@...; Harikrishnad@...; manishj@...; zacharyb@... 主题: 回复: [edk2-devel] 回复: [edk2][PATCH V3] MdePkg : Add IPMI Macro and Structure Defintions to resolve build errors If no other comment, I will create PR to merge this patch. Thanks Liming AbduL: This is same to the definition of UINT8 CompletionCode without bitfield. Thanks Liming whats the use of bitfield:8 for UINT8 variable type? +typedef struct { + UINT8 CompletionCode:8; +} IPMI_SET_BOOT_OPTIONS_RESPONSE;
toggle quoted message
Show quoted text
On Mon, Jun 21, 2021 at 7:19 AM gaoliming <gaoliming@...> wrote:Thanks for you update.
Reviewed-by: Liming Gao <gaoliming@...>
Thanks Liming > -----邮件原件----- > 发件人: manickavasakam karpagavinayagam <manickavasakamk@...> > 发送时间: 2021年6月18日 23:38 > 收件人: devel@edk2.groups.io > 抄送: isaac.w.oram@...; nathaniel.l.desimone@...; > Felixp@...; Harikrishnad@...; manishj@...; > zacharyb@...; manickavasakamk@...; > gaoliming@... > 主题: [edk2][PATCH V3] MdePkg : Add IPMI Macro and Structure Defintions > to resolve build errors > > Build error reported for missing structures > IPMI_SET_BOOT_OPTIONS_RESPONSE, > EFI_IPMI_MSG_GET_BMC_EXEC_RSP and > macros EFI_FIRMWARE_GET_BMC_EXECUTION_CONTEXT > EFI_FIRMWARE_BMC_IN_FULL_RUNTIME/EFI_FIRMWARE_BMC_IN_FORCE > D_UPDATE_MODE > when using > edk2-platforms\Features\Intel\OutOfBandManagement\IpmiFeaturePkg > > MdePkg : Rename IPMI Macro and Structure Defintions > > Rename the EFI_IPMI_MSG_GET_BMC_EXEC_RSPB, > EFI_FIRMWARE_GET_BMC_EXECUTION_CONTEXT > EFI_FIRMWARE_BMC_IN_FORCED_UPDATE_MODE to > IPMI_MSG_GET_BMC_EXEC_RSPB,IPMI_GET_BMC_EXECUTION_CONTEXT > IPMI_BMC_IN_FORCED_UPDATE_MODE > > Notes: > V1 : > Rename the EFI_IPMI_MSG_GET_BMC_EXEC_RSPB, > EFI_FIRMWARE_GET_BMC_EXECUTION_CONTEXT > EFI_FIRMWARE_BMC_IN_FORCED_UPDATE_MODE to > IPMI_MSG_GET_BMC_EXEC_RSPB,IPMI_GET_BMC_EXECUTION_CONTEXT > IPMI_BMC_IN_FORCED_UPDATE_MODE > > V2: > > Remove 0001-MdePkg-Add-IPMI-Macro-and-Structure-Defintions-to-re.patch > > V3: > > Add Signed-off-by information > > Signed-off-by: Manickavasakam Karpagavinayagam > <manickavasakamk@...> > --- > .../IndustryStandard/IpmiNetFnChassis.h | 4 ++++ > .../IndustryStandard/IpmiNetFnFirmware.h | 18 > ++++++++++++++++++ > 2 files changed, 22 insertions(+) > > diff --git a/MdePkg/Include/IndustryStandard/IpmiNetFnChassis.h > b/MdePkg/Include/IndustryStandard/IpmiNetFnChassis.h > index 79db55523d..d7cdd3a865 100644 > --- a/MdePkg/Include/IndustryStandard/IpmiNetFnChassis.h > +++ b/MdePkg/Include/IndustryStandard/IpmiNetFnChassis.h > @@ -186,6 +186,10 @@ typedef struct { > UINT8 ParameterData[0]; > > } IPMI_SET_BOOT_OPTIONS_REQUEST; > > > > +typedef struct { > > + UINT8 CompletionCode:8; > > +} IPMI_SET_BOOT_OPTIONS_RESPONSE; > > + > > // > > // Definitions for Get System Boot options command > > // > > diff --git a/MdePkg/Include/IndustryStandard/IpmiNetFnFirmware.h > b/MdePkg/Include/IndustryStandard/IpmiNetFnFirmware.h > index 2d892dbd5a..c4cbe2349b 100644 > --- a/MdePkg/Include/IndustryStandard/IpmiNetFnFirmware.h > +++ b/MdePkg/Include/IndustryStandard/IpmiNetFnFirmware.h > @@ -17,4 +17,22 @@ > // All Firmware commands and their structure definitions to follow here > > // > > > > +// ---------------------------------------------------------------------------- ------------ > > +// Definitions for Get BMC Execution Context > > +// ---------------------------------------------------------------------------- ------------ > > +#define IPMI_GET_BMC_EXECUTION_CONTEXT 0x23 > > + > > +// > > +// Constants and Structure definitions for "Get Device ID" command to > follow here > > +// > > +typedef struct { > > + UINT8 CurrentExecutionContext; > > + UINT8 PartitionPointer; > > +} IPMI_MSG_GET_BMC_EXEC_RSP; > > + > > +// > > +// Current Execution Context responses > > +// > > +#define IPMI_BMC_IN_FORCED_UPDATE_MODE 0x11 > > + > > #endif > > -- > 2.25.0.windows.1 > > > Please consider the environment before printing this email. > > The information contained in this message may be confidential and > proprietary to American Megatrends (AMI). This communication is intended > to be read only by the individual or entity to whom it is addressed or by their > designee. If the reader of this message is not the intended recipient, you are > on notice that any distribution of this message, in any form, is strictly > prohibited. Please promptly notify the sender by reply e-mail or by > telephone at 770-246-8600, and then delete or destroy all copies of the > transmission.
-- Thanks and Regards Abdul Lateef Attar Bangalore
|
|
[PATCH] IntelFsp2Pkg: PatchFv parseInfFile function modification

Ashraf Ali S
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3476parseInfFile currently reading the EFI_BASE_ADDRESS from INF, once the address found still it's continues to read the complete inf file which is not required. once the EFI_BASE_ADDRESS read from the INF no need to read the INF further. MSFT compiler can generate the map file address 8 or 16 based on which architecture the INF is compiler. currently it's support for IA32, it can be update the X64 in future. modification of few typo errors in parseModMapFile, getCurr function required Signed-off-by: Ashraf Ali S <ashraf.ali.s@...> Cc: Ray Ni <ray.ni@...> Cc: Chasel Chiu <chasel.chiu@...> Cc: Nate DeSimone <nathaniel.l.desimone@...> Cc: Star Zeng <star.zeng@...> --- IntelFsp2Pkg/Tools/PatchFv.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/IntelFsp2Pkg/Tools/PatchFv.py b/IntelFsp2Pkg/Tools/PatchFv.py index 112de4077a..236019b62d 100644 --- a/IntelFsp2Pkg/Tools/PatchFv.py +++ b/IntelFsp2Pkg/Tools/PatchFv.py @@ -1,6 +1,6 @@ ## @ PatchFv.py # -# Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.<BR> +# Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.<BR> # SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -297,17 +297,17 @@ class Symbols: # fvOffset = self.getFvOffsetInFd(infFile[0:-4] + ".Fv") fdIn = open(infFile, "r") - rptLine = fdIn.readline() + rptLines = fdIn.readlines() self.fdBase = 0xFFFFFFFF - while (rptLine != "" ): + for line in rptLines: #EFI_BASE_ADDRESS = 0xFFFDF400 - match = re.match("^EFI_BASE_ADDRESS\s*=\s*(0x[a-fA-F0-9]+)", rptLine) + match = re.match("^EFI_BASE_ADDRESS\s*=\s*(0x[a-fA-F0-9]+)", line) if match is not None: self.fdBase = int(match.group(1), 16) - fvOffset - rptLine = fdIn.readline() + break fdIn.close() if self.fdBase == 0xFFFFFFFF: - raise Exception("Could not find EFI_BASE_ADDRESS in INF file!" % fvFile) + raise Exception("Could not find EFI_BASE_ADDRESS in INF file!" % infFile) return 0 # @@ -402,6 +402,7 @@ class Symbols: # # retval 0 Parsed MOD MAP file successfully # retval 1 There is no moduleEntryPoint in modSymbols + # retval 2 There is no offset for moduleEntryPoint in modSymbols # def parseModMapFile(self, moduleName, mapFile): # @@ -426,7 +427,7 @@ class Symbols: else: #MSFT #0003:00000190 _gComBase 00007a50 SerialPo - patchMapFileMatchString = "^\s[0-9a-fA-F]{4}:[0-9a-fA-F]{8}\s+(\w+)\s+([0-9a-fA-F]{8}\s+)" + patchMapFileMatchString = "^\s[0-9a-fA-F]{4}:[0-9a-fA-F]{8}\s+(\w+)\s+([0-9a-fA-F]{8,16}\s+)" matchKeyGroupIndex = 1 matchSymbolGroupIndex = 2 prefix = '' @@ -498,7 +499,7 @@ class Symbols: # # Get current character # - # retval elf.string[self.index] + # retval self.string[self.index] # retval '' Exception # def getCurr(self): -- 2.30.2.windows.1
|
|
[PATCH] IntelFsp2Pkg: PatchFv parseInfFile function modification

Ashraf Ali S
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3476parseInfFile currently reading the EFI_BASE_ADDRESS from INF, once the address found still it's continues to read the complete inf file which is not required. once the EFI_BASE_ADDRESS read from the INF no need to read the INF further. MSFT compiler can generate the map file address 8 or 16 based on which architecture the INF is compiler. currently it's support for IA32, it can be update the X64 in future. modification of few typo errors in parseModMapFile, getCurr function required Signed-off-by: Ashraf Ali S <ashraf.ali.s@...> Cc: Ray Ni <ray.ni@...> Cc: Chasel Chiu <chasel.chiu@...> Cc: Nate DeSimone <nathaniel.l.desimone@...> Cc: Star Zeng <star.zeng@...> --- IntelFsp2Pkg/Tools/PatchFv.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/IntelFsp2Pkg/Tools/PatchFv.py b/IntelFsp2Pkg/Tools/PatchFv.py index 112de4077a..765dfed8ef 100644 --- a/IntelFsp2Pkg/Tools/PatchFv.py +++ b/IntelFsp2Pkg/Tools/PatchFv.py @@ -1,6 +1,6 @@ ## @ PatchFv.py # -# Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.<BR> +# Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.<BR> # SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -297,17 +297,16 @@ class Symbols: # fvOffset = self.getFvOffsetInFd(infFile[0:-4] + ".Fv") fdIn = open(infFile, "r") - rptLine = fdIn.readline() + rptLines = fdIn.readlines() self.fdBase = 0xFFFFFFFF - while (rptLine != "" ): - #EFI_BASE_ADDRESS = 0xFFFDF400 - match = re.match("^EFI_BASE_ADDRESS\s*=\s*(0x[a-fA-F0-9]+)", rptLine) + for line in rptLines: + match = re.match("^EFI_BASE_ADDRESS\s*=\s*(0x[a-fA-F0-9]+)", line) if match is not None: self.fdBase = int(match.group(1), 16) - fvOffset - rptLine = fdIn.readline() + break fdIn.close() if self.fdBase == 0xFFFFFFFF: - raise Exception("Could not find EFI_BASE_ADDRESS in INF file!" % fvFile) + raise Exception("Could not find EFI_BASE_ADDRESS in INF file!" % infFile) return 0 # @@ -402,6 +401,7 @@ class Symbols: # # retval 0 Parsed MOD MAP file successfully # retval 1 There is no moduleEntryPoint in modSymbols + # retval 2 There is no offset for moduleEntryPoint in modSymbols # def parseModMapFile(self, moduleName, mapFile): # @@ -426,7 +426,7 @@ class Symbols: else: #MSFT #0003:00000190 _gComBase 00007a50 SerialPo - patchMapFileMatchString = "^\s[0-9a-fA-F]{4}:[0-9a-fA-F]{8}\s+(\w+)\s+([0-9a-fA-F]{8}\s+)" + patchMapFileMatchString = "^\s[0-9a-fA-F]{4}:[0-9a-fA-F]{8}\s+(\w+)\s+([0-9a-fA-F]{8,16}\s+)" matchKeyGroupIndex = 1 matchSymbolGroupIndex = 2 prefix = '' @@ -498,7 +498,7 @@ class Symbols: # # Get current character # - # retval elf.string[self.index] + # retval self.string[self.index] # retval '' Exception # def getCurr(self): -- 2.26.2.windows.1
|
|
Event: TianoCore Design Meeting - APAC/NAMO - 07/09/2021
#cal-reminder
devel@edk2.groups.io Calendar <noreply@...>
|
|
Re: EFI_AUDIO_OUTPUT_PROTOCOL: assistance with VirtIO initialization
Update: I just realized I'd made a typo -- the unknown request is actually a get_min request.
toggle quoted message
Show quoted text
On 7/2/21, Ethin Probst <harlydavidsen@...> wrote: Thank you for all that information, both of you. I didn't realize that VirtIO sound would be so complicated. The specification seemed simple enough -- but, alas, all things seem simple until you actually go and try to implement them.
I did manage to retrieve a packet dump, from both myself and from somebody else that Leif contacted. The one from myself was from a USB mixer that I have -- its how my audio headphones work, and that generated far too many packets -- well over 5,000 at least. Utilizing display filters wasn't much of a help either -- it doesn't seem like my mixer makes available an audio device class descriptor anywhere, which is odd because it should. But I also might not have been filtering it properly. The other packet dump was sort-of helpful, but did contain some confusing elements:
* There were four unknown URB transfer types (0x7F) that Wireshark claimed were "malformed". I asked around on the OSDev.org forum and I don't think anyone recognizes that either. * The primary init sequence was understandable, along with the get string requests, but after that there were a bunch of URB control transfers from device-to-host and some requests from host-to-device containing data that I didn't understand. I wasn't sure what those were for. They looked something like this:
Frame 29: 36 bytes on wire (288 bits), 36 bytes captured (288 bits) on interface wireshark_extcap1868, id 0 Interface id: 0 (wireshark_extcap1868) Interface name: wireshark_extcap1868 Encapsulation type: USB packets with USBPcap header (152) Arrival Time: Jul 1, 2021 02:21:45.291271000 CDT [Time shift for this packet: 0.000000000 seconds] Epoch Time: 1625124105.291271000 seconds [Time delta from previous captured frame: 0.000008000 seconds] [Time delta from previous displayed frame: 0.000008000 seconds] [Time since reference or first frame: 0.035324000 seconds] Frame Number: 29 Frame Length: 36 bytes (288 bits) Capture Length: 36 bytes (288 bits) [Frame is marked: False] [Frame is ignored: False] [Protocols in frame: usb] USB URB [Source: host] [Destination: 2.7.0] USBPcap pseudoheader length: 28 IRP ID: 0xffffa90f548b8a20 IRP USBD_STATUS: USBD_STATUS_SUCCESS (0x00000000) URB Function: URB_FUNCTION_CLASS_INTERFACE (0x001b) IRP information: 0x00, Direction: FDO -> PDO 0000 000. = Reserved: 0x00 .... ...0 = Direction: FDO -> PDO (0x0) URB bus id: 2 Device address: 7 Endpoint: 0x80, Direction: IN 1... .... = Direction: IN (1) .... 0000 = Endpoint number: 0 URB transfer type: URB_CONTROL (0x02) Packet Data Length: 8 [Response in: 30] Control transfer stage: Setup (0) [bInterfaceClass: Audio (0x01)] Setup Data bmRequestType: 0xa1 1... .... = Direction: Device-to-host .01. .... = Type: Class (0x1) ...0 0001 = Recipient: Interface (0x01) bRequest: 130 wValue: 0x0201 wIndex: 1536 (0x0600) wLength: 2
Frame 30: 30 bytes on wire (240 bits), 30 bytes captured (240 bits) on interface wireshark_extcap1868, id 0 Interface id: 0 (wireshark_extcap1868) Interface name: wireshark_extcap1868 Encapsulation type: USB packets with USBPcap header (152) Arrival Time: Jul 1, 2021 02:21:45.291389000 CDT [Time shift for this packet: 0.000000000 seconds] Epoch Time: 1625124105.291389000 seconds [Time delta from previous captured frame: 0.000118000 seconds] [Time delta from previous displayed frame: 0.000118000 seconds] [Time since reference or first frame: 0.035442000 seconds] Frame Number: 30 Frame Length: 30 bytes (240 bits) Capture Length: 30 bytes (240 bits) [Frame is marked: False] [Frame is ignored: False] [Protocols in frame: usb] USB URB [Source: 2.7.0] [Destination: host] USBPcap pseudoheader length: 28 IRP ID: 0xffffa90f548b8a20 IRP USBD_STATUS: USBD_STATUS_SUCCESS (0x00000000) URB Function: URB_FUNCTION_CONTROL_TRANSFER (0x0008) IRP information: 0x01, Direction: PDO -> FDO 0000 000. = Reserved: 0x00 .... ...1 = Direction: PDO -> FDO (0x1) URB bus id: 2 Device address: 7 Endpoint: 0x80, Direction: IN 1... .... = Direction: IN (1) .... 0000 = Endpoint number: 0 URB transfer type: URB_CONTROL (0x02) Packet Data Length: 2 [Request in: 29] [Time from request: 0.000118000 seconds] Control transfer stage: Complete (3) [bInterfaceClass: Audio (0x01)] CONTROL response data: 00d3
According to the audio 1.0 specification, this is a "get_cur" request (appendix 9: Audio Class-Specific Request Codes). However, I wasn't really sure what it was trying to get. The spec (SEC. B.3.3.3) indicates that this is an input terminal descriptor. I'll continue following this chain of requests and responses and see if I can figure out exactly what its doing -- I need to map the request IDs onto their actual values since Wireshark isn't doing that for me automatically.
On 7/2/21, Michael Brown <mcb30@...> wrote:
On 02/07/2021 10:41, Michael Brown wrote:
UsbIo->UsbControlTransfer(UsbIo, &Req, EfiUsbDataIn, PcdGet32 (PcdUsbTransferTimeoutValue), &Header, sizeof(Header), &Status);
(Error handling etc omitted for brevity)
That would get you the first 8 bytes of the class-specific AC interface header descriptor. You would then need to extract the TotalLength field, allocate that length of memory, and repeat the UsbControlTransfer() call to fetch the full-length descriptor into the newly allocated block.
Hope that helps, BTW, in case you aren't already aware of this: wireshark is pretty good at dissecting USB traffic. You can capture it by doing a "modprobe usbmon", after which you'll see a number of usbmonN devices show up in the wireshark interface list. Try them each in turn until you find which one corresponds to the host controller to which your device is attached.
My normal method for developing or debugging iPXE USB drivers will typically involve using wireshark to capture the USB traffic that happens when the device is being used by a known-working driver (e.g. the Linux driver for that device) and comparing it to the traffic that happens when I'm using my own driver (via USB pass-through in a VM). This is often a lot faster than trying to pull together all of the information from the multiple USB spec documents.
Good luck!
Michael
-- Signed, Ethin D. Probst
-- Signed, Ethin D. Probst
|
|
Re: EFI_AUDIO_OUTPUT_PROTOCOL: assistance with VirtIO initialization
Thank you for all that information, both of you. I didn't realize that VirtIO sound would be so complicated. The specification seemed simple enough -- but, alas, all things seem simple until you actually go and try to implement them.
I did manage to retrieve a packet dump, from both myself and from somebody else that Leif contacted. The one from myself was from a USB mixer that I have -- its how my audio headphones work, and that generated far too many packets -- well over 5,000 at least. Utilizing display filters wasn't much of a help either -- it doesn't seem like my mixer makes available an audio device class descriptor anywhere, which is odd because it should. But I also might not have been filtering it properly. The other packet dump was sort-of helpful, but did contain some confusing elements:
* There were four unknown URB transfer types (0x7F) that Wireshark claimed were "malformed". I asked around on the OSDev.org forum and I don't think anyone recognizes that either. * The primary init sequence was understandable, along with the get string requests, but after that there were a bunch of URB control transfers from device-to-host and some requests from host-to-device containing data that I didn't understand. I wasn't sure what those were for. They looked something like this:
Frame 29: 36 bytes on wire (288 bits), 36 bytes captured (288 bits) on interface wireshark_extcap1868, id 0 Interface id: 0 (wireshark_extcap1868) Interface name: wireshark_extcap1868 Encapsulation type: USB packets with USBPcap header (152) Arrival Time: Jul 1, 2021 02:21:45.291271000 CDT [Time shift for this packet: 0.000000000 seconds] Epoch Time: 1625124105.291271000 seconds [Time delta from previous captured frame: 0.000008000 seconds] [Time delta from previous displayed frame: 0.000008000 seconds] [Time since reference or first frame: 0.035324000 seconds] Frame Number: 29 Frame Length: 36 bytes (288 bits) Capture Length: 36 bytes (288 bits) [Frame is marked: False] [Frame is ignored: False] [Protocols in frame: usb] USB URB [Source: host] [Destination: 2.7.0] USBPcap pseudoheader length: 28 IRP ID: 0xffffa90f548b8a20 IRP USBD_STATUS: USBD_STATUS_SUCCESS (0x00000000) URB Function: URB_FUNCTION_CLASS_INTERFACE (0x001b) IRP information: 0x00, Direction: FDO -> PDO 0000 000. = Reserved: 0x00 .... ...0 = Direction: FDO -> PDO (0x0) URB bus id: 2 Device address: 7 Endpoint: 0x80, Direction: IN 1... .... = Direction: IN (1) .... 0000 = Endpoint number: 0 URB transfer type: URB_CONTROL (0x02) Packet Data Length: 8 [Response in: 30] Control transfer stage: Setup (0) [bInterfaceClass: Audio (0x01)] Setup Data bmRequestType: 0xa1 1... .... = Direction: Device-to-host .01. .... = Type: Class (0x1) ...0 0001 = Recipient: Interface (0x01) bRequest: 130 wValue: 0x0201 wIndex: 1536 (0x0600) wLength: 2
Frame 30: 30 bytes on wire (240 bits), 30 bytes captured (240 bits) on interface wireshark_extcap1868, id 0 Interface id: 0 (wireshark_extcap1868) Interface name: wireshark_extcap1868 Encapsulation type: USB packets with USBPcap header (152) Arrival Time: Jul 1, 2021 02:21:45.291389000 CDT [Time shift for this packet: 0.000000000 seconds] Epoch Time: 1625124105.291389000 seconds [Time delta from previous captured frame: 0.000118000 seconds] [Time delta from previous displayed frame: 0.000118000 seconds] [Time since reference or first frame: 0.035442000 seconds] Frame Number: 30 Frame Length: 30 bytes (240 bits) Capture Length: 30 bytes (240 bits) [Frame is marked: False] [Frame is ignored: False] [Protocols in frame: usb] USB URB [Source: 2.7.0] [Destination: host] USBPcap pseudoheader length: 28 IRP ID: 0xffffa90f548b8a20 IRP USBD_STATUS: USBD_STATUS_SUCCESS (0x00000000) URB Function: URB_FUNCTION_CONTROL_TRANSFER (0x0008) IRP information: 0x01, Direction: PDO -> FDO 0000 000. = Reserved: 0x00 .... ...1 = Direction: PDO -> FDO (0x1) URB bus id: 2 Device address: 7 Endpoint: 0x80, Direction: IN 1... .... = Direction: IN (1) .... 0000 = Endpoint number: 0 URB transfer type: URB_CONTROL (0x02) Packet Data Length: 2 [Request in: 29] [Time from request: 0.000118000 seconds] Control transfer stage: Complete (3) [bInterfaceClass: Audio (0x01)] CONTROL response data: 00d3
According to the audio 1.0 specification, this is a "get_cur" request (appendix 9: Audio Class-Specific Request Codes). However, I wasn't really sure what it was trying to get. The spec (SEC. B.3.3.3) indicates that this is an input terminal descriptor. I'll continue following this chain of requests and responses and see if I can figure out exactly what its doing -- I need to map the request IDs onto their actual values since Wireshark isn't doing that for me automatically.
toggle quoted message
Show quoted text
On 7/2/21, Michael Brown <mcb30@...> wrote: On 02/07/2021 10:41, Michael Brown wrote:
UsbIo->UsbControlTransfer(UsbIo, &Req, EfiUsbDataIn, PcdGet32 (PcdUsbTransferTimeoutValue), &Header, sizeof(Header), &Status);
(Error handling etc omitted for brevity)
That would get you the first 8 bytes of the class-specific AC interface header descriptor. You would then need to extract the TotalLength field, allocate that length of memory, and repeat the UsbControlTransfer() call to fetch the full-length descriptor into the newly allocated block.
Hope that helps, BTW, in case you aren't already aware of this: wireshark is pretty good at dissecting USB traffic. You can capture it by doing a "modprobe usbmon", after which you'll see a number of usbmonN devices show up in the wireshark interface list. Try them each in turn until you find which one corresponds to the host controller to which your device is attached.
My normal method for developing or debugging iPXE USB drivers will typically involve using wireshark to capture the USB traffic that happens when the device is being used by a known-working driver (e.g. the Linux driver for that device) and comparing it to the traffic that happens when I'm using my own driver (via USB pass-through in a VM). This is often a lot faster than trying to pull together all of the information from the multiple USB spec documents.
Good luck!
Michael
-- Signed, Ethin D. Probst
|
|
Re: [PATCH v3 2/2] OvmfPkg/Bhyve: use static PCI32Base address
Acked-by: Rebecca Cran <rebecca@...>
toggle quoted message
Show quoted text
On 7/1/21 6:01 AM, Corvin Köhne wrote: It's neccessary to allocate a Graphics Stolen Memory area to enable GPU-Passthrough for integrated Intel GPUs. Therefore, use a new memory layout with a static Pci32Baseaddress.
Old layout: [... , lowmemlimit] RAM [lowmemlimit, 0xE000 0000] PCI Space New layout: [... , lowmemlimit] RAM [lowmemlimit, gsmbase ] Memory hole (may be absent) [gsmbase , 0xC000 0000] GSM (may be absent) [0xC000 0000, 0xE000 0000] PCI Space --- OvmfPkg/Bhyve/BhyveX64.dsc | 4 ++-- OvmfPkg/Bhyve/PlatformPei/Platform.c | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc index a0a2071b86..c435dadc0a 100644 --- a/OvmfPkg/Bhyve/BhyveX64.dsc +++ b/OvmfPkg/Bhyve/BhyveX64.dsc @@ -537,8 +537,8 @@ gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId|0 gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase|0x0 gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize|0x0 - gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Base|0x0 - gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Size|0x0 + gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Base|0xC0000000 + gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Size|0x20000000 gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Base|0x0 gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size|0x800000000 diff --git a/OvmfPkg/Bhyve/PlatformPei/Platform.c b/OvmfPkg/Bhyve/PlatformPei/Platform.c index 3a414ffcb7..f38e74ccfc 100644 --- a/OvmfPkg/Bhyve/PlatformPei/Platform.c +++ b/OvmfPkg/Bhyve/PlatformPei/Platform.c @@ -191,7 +191,9 @@ MemMapInitialization ( ASSERT (PciExBarBase <= MAX_UINT32 - SIZE_256MB); PciBase = (UINT32)(PciExBarBase + SIZE_256MB); } else { - PciBase = (TopOfLowRam < BASE_2GB) ? BASE_2GB : TopOfLowRam; + PciBase = PcdGet64(PcdPciMmio32Base); + if (PciBase == 0) + PciBase = (TopOfLowRam < BASE_2GB) ? BASE_2GB : TopOfLowRam; } //
|
|
Re: [PATCH 1/1] MdeModulePkg: Add BootDiscoveryPolicyUiLib.
Hi Greg, In our offline discussion, we found some reasons below to change PcdBootDiscoveryPolicy default value from 0 (minimal discovery/fast boot) to 2 (full discovery). Could you update your patch for this? 1. The minimal discovery/fast boot causes issues with system deployment and testing. For example, we saw several issues reported in https://github.com/pftf/RPi4/issues. 2. On ARM systems, the fast boot doesn't save a lot of boot time. On RPi4, I saw it only reduces boot time by less than 1 second. 3. For the platforms that need Fast boot to work by default, we can still modify the platform's dsc file. Best Regards, Sunny Wang
toggle quoted message
Show quoted text
-----Original Message----- From: Sunny Wang <Sunny.Wang@...> Sent: Wednesday, June 30, 2021 2:55 PM To: Grzegorz Bernacki <gjb@...>; devel@edk2.groups.io; ray.ni@...; zhichao.gao@... Cc: leif@...; ardb+tianocore@...; Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@...>; mw@...; upstream@...; pete@...; jian.j.wang@...; hao.a.wu@...; dandan.bi@...; eric.dong@...; Sunny Wang <Sunny.Wang@...> Subject: RE: [PATCH 1/1] MdeModulePkg: Add BootDiscoveryPolicyUiLib.
Internally reviewed this patch before sending the edk2 mailing list and Greg already addressed all my comments, so It looks good to me. Reviewed-by: Sunny Wang <sunny.wang@...>
Add Ray and Zhichao. They're BDS modules reviewers.
Hi Ray and Zhichao, Could you help review this patch?
-----Original Message----- From: Grzegorz Bernacki <gjb@...> Sent: Tuesday, June 22, 2021 4:52 PM To: devel@edk2.groups.io Cc: leif@...; ardb+tianocore@...; Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@...>; Sunny Wang <Sunny.Wang@...>; mw@...; upstream@...; pete@...; jian.j.wang@...; hao.a.wu@...; dandan.bi@...; eric.dong@...; Grzegorz Bernacki <gjb@...> Subject: [PATCH 1/1] MdeModulePkg: Add BootDiscoveryPolicyUiLib.
This library extends Boot Maintenance Menu and allows to select Boot Discovery Policy. When choice is made BootDiscoveryPolicy variable is set. Platform code can use this variable to decide which class of device shall be connected.
Signed-off-by: Grzegorz Bernacki <gjb@...> --- MdeModulePkg/MdeModulePkg.dec | 6 + MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLib.inf | 52 +++++++ MdeModulePkg/Include/Guid/BootDiscoveryPolicy.h | 22 +++ MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLib.c | 160 ++++++++++++++++++++ MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLib.uni | 18 +++ MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLibStrings.uni | 29 ++++ MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLibVfr.Vfr | 44 ++++++ 7 files changed, 331 insertions(+) create mode 100644 MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLib.inf create mode 100644 MdeModulePkg/Include/Guid/BootDiscoveryPolicy.h create mode 100644 MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLib.c create mode 100644 MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLib.uni create mode 100644 MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLibStrings.uni create mode 100644 MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLibVfr.Vfr
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 10602a8f79..1e65ad2dd7 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -422,6 +422,9 @@ ## Include/UniversalPayload/ExtraData.h gUniversalPayloadExtraDataGuid = {0x15a5baf6, 0x1c91, 0x467d, {0x9d, 0xfb, 0x31, 0x9d, 0x17, 0x8d, 0x4b, 0xb4}}
+ ## GUID used for Boot Discovery Policy FormSet guid and related variables. + gBootDiscoveryPolicyMgrFormsetGuid = { 0x5b6f7107, 0xbb3c, 0x4660, { 0x92, 0xcd, 0x54, 0x26, 0x90, 0x28, 0x0b, 0xbd } } + [Ppis] ## Include/Ppi/AtaController.h gPeiAtaControllerPpiGuid = { 0xa45e60d1, 0xc719, 0x44aa, { 0xb0, 0x7a, 0xaa, 0x77, 0x7f, 0x85, 0x90, 0x6d }} @@ -1597,6 +1600,9 @@ # @Prompt Console Output Row of Text Setup gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutRow|25|UINT32|0x4000000e
+ ## Specify the Boot Discovery Policy settings + gEfiMdeModulePkgTokenSpaceGuid.PcdBootDiscoveryPolicy|0|UINT32|0x4000000f + [PcdsFixedAtBuild.AARCH64, PcdsPatchableInModule.AARCH64] gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions|0x20|UINT32|0x0001004c
diff --git a/MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLib.inf b/MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLib.inf new file mode 100644 index 0000000000..1fb4d43caa --- /dev/null +++ b/MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLib.inf @@ -0,0 +1,52 @@ +## @file +# Library for BDS phase to use Boot Discovery Policy +# +# Copyright (c) 2021, ARM Ltd. All rights reserved.<BR> +# Copyright (c) 2021, Semihalf All rights reserved.<BR> +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = BootDiscoveryPolicyUiLib + MODULE_UNI_FILE = BootDiscoveryPolicyUiLib.uni + FILE_GUID = BE73105A-B13D-4B57-A41A-463DBD15FE10 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = NULL|DXE_DRIVER UEFI_APPLICATION + CONSTRUCTOR = BootDiscoveryPolicyUiLibConstructor + DESTRUCTOR = BootDiscoveryPolicyUiLibDestructor +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 AARCH64 +# + +[Sources] + BootDiscoveryPolicyUiLib.c + BootDiscoveryPolicyUiLibStrings.uni + BootDiscoveryPolicyUiLibVfr.Vfr + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + +[LibraryClasses] + DevicePathLib + BaseLib + UefiRuntimeServicesTableLib + UefiBootServicesTableLib + DebugLib + HiiLib + UefiLib + BaseMemoryLib + +[Guids] + gBootDiscoveryPolicyMgrFormsetGuid + +[Pcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdBootDiscoveryPolicy ## PRODUCES + +[Depex] + gEfiHiiDatabaseProtocolGuid AND gPcdProtocolGuid diff --git a/MdeModulePkg/Include/Guid/BootDiscoveryPolicy.h b/MdeModulePkg/Include/Guid/BootDiscoveryPolicy.h new file mode 100644 index 0000000000..8eb0968a16 --- /dev/null +++ b/MdeModulePkg/Include/Guid/BootDiscoveryPolicy.h @@ -0,0 +1,22 @@ +/** @file + Definition for structure & defines exported by Boot Discovery Policy UI + + Copyright (c) 2021, ARM Ltd. All rights reserved.<BR> + Copyright (c) 2021, Semihalf All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _BOOT_DISCOVERY_POLICY_UI_LIB_H_ +#define _BOOT_DISCOVERY_POLICY_UI_LIB_H_ + +#define BDP_CONNECT_MINIMAL 0 /* Do not connect any additional devices */ +#define BDP_CONNECT_NET 1 +#define BDP_CONNECT_ALL 2 + +#define BOOT_DISCOVERY_POLICY_MGR_FORMSET_GUID { 0x5b6f7107, 0xbb3c, 0x4660, { 0x92, 0xcd, 0x54, 0x26, 0x90, 0x28, 0x0b, 0xbd } } + +#define BOOT_DISCOVERY_POLICY_VAR L"BootDiscoveryPolicy" + +#endif diff --git a/MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLib.c b/MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLib.c new file mode 100644 index 0000000000..6814d0bb8f --- /dev/null +++ b/MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLib.c @@ -0,0 +1,160 @@ +/** @file + Boot Discovery Policy UI for Boot Maintenance menu. + + Copyright (c) 2021, ARM Ltd. All rights reserved.<BR> + Copyright (c) 2021, Semihalf All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <Guid/BootDiscoveryPolicy.h> +#include <Library/UefiDriverEntryPoint.h> +#include <Library/UefiBootServicesTableLib.h> +#include <Library/UefiRuntimeServicesTableLib.h> +#include <Library/BaseLib.h> +#include <Library/DevicePathLib.h> +#include <Library/DebugLib.h> +#include <Library/HiiLib.h> +#include <Library/UefiLib.h> +#include <Library/BaseMemoryLib.h> +#include <Include/Library/PcdLib.h> + +/// +/// HII specific Vendor Device Path definition. +/// +typedef struct { + VENDOR_DEVICE_PATH VendorDevicePath; + EFI_DEVICE_PATH_PROTOCOL End; +} HII_VENDOR_DEVICE_PATH; + +extern unsigned char BootDiscoveryPolicyUiLibVfrBin[]; + +EFI_HII_HANDLE mBPHiiHandle = NULL; +EFI_HANDLE mBPDriverHandle = NULL; + +STATIC HII_VENDOR_DEVICE_PATH mVendorDevicePath = { + { + { + HARDWARE_DEVICE_PATH, + HW_VENDOR_DP, + { + (UINT8)(sizeof (VENDOR_DEVICE_PATH)), + (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8) + } + }, + BOOT_DISCOVERY_POLICY_MGR_FORMSET_GUID + }, + { + END_DEVICE_PATH_TYPE, + END_ENTIRE_DEVICE_PATH_SUBTYPE, + { + (UINT8)(END_DEVICE_PATH_LENGTH), + (UINT8)((END_DEVICE_PATH_LENGTH) >> 8) + } + } +}; + +/** + + Initialize Boot Maintenance Menu library. + + @param ImageHandle The image handle. + @param SystemTable The system table. + + @retval EFI_SUCCESS Install Boot manager menu success. + @retval Other Return error status.gBPDisplayLibGuid + +**/ +EFI_STATUS +EFIAPI +BootDiscoveryPolicyUiLibConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + UINTN Size; + UINT32 BootDiscoveryPolicy; + + Size = sizeof (UINT32); + Status = gRT->GetVariable ( + BOOT_DISCOVERY_POLICY_VAR, + &gBootDiscoveryPolicyMgrFormsetGuid, + NULL, + &Size, + &BootDiscoveryPolicy + ); + if (EFI_ERROR (Status)) { + Status = PcdSet32S (PcdBootDiscoveryPolicy, PcdGet32 (PcdBootDiscoveryPolicy)); + ASSERT_EFI_ERROR (Status); + } + + Status = gBS->InstallMultipleProtocolInterfaces ( + &mBPDriverHandle, + &gEfiDevicePathProtocolGuid, + &mVendorDevicePath, + NULL + ); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // Publish our HII data + // + mBPHiiHandle = HiiAddPackages ( + &gBootDiscoveryPolicyMgrFormsetGuid, + mBPDriverHandle, + BootDiscoveryPolicyUiLibVfrBin, + BootDiscoveryPolicyUiLibStrings, + NULL + ); + if (mBPHiiHandle == NULL) { + gBS->UninstallMultipleProtocolInterfaces ( + mBPDriverHandle, + &gEfiDevicePathProtocolGuid, + &mVendorDevicePath, + NULL + ); + + return EFI_OUT_OF_RESOURCES; + } + + return EFI_SUCCESS; +} + +/** + Destructor of Boot Maintenance menu library. + + @param ImageHandle The firmware allocated handle for the EFI image. + @param SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The destructor completed successfully. + @retval Other value The destructor did not complete successfully. + +**/ +EFI_STATUS +EFIAPI +BootDiscoveryPolicyUiLibDestructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + + if (mBPDriverHandle != NULL) { + gBS->UninstallProtocolInterface ( + mBPDriverHandle, + &gEfiDevicePathProtocolGuid, + &mVendorDevicePath + ); + mBPDriverHandle = NULL; + } + + if (mBPHiiHandle != NULL) { + HiiRemovePackages (mBPHiiHandle); + mBPHiiHandle = NULL; + } + + return EFI_SUCCESS; +} diff --git a/MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLib.uni b/MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLib.uni new file mode 100644 index 0000000000..eea3ca6c8d --- /dev/null +++ b/MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLib.uni @@ -0,0 +1,18 @@ +// /** @file +// Boot Discovery Policy UI module. +// +// Copyright (c) 2021, ARM Ltd. All rights reserved.<BR> +// Copyright (c) 2021, Semihalf All rights reserved.<BR> +// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// **/ + + +#string STR_MODULE_ABSTRACT +#language en-US "Boot Discovery Policy UI module." + +#string STR_MODULE_DESCRIPTION +#language en-US "Boot Discovery Policy UI module." + + diff --git a/MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLibStrings.uni b/MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLibStrings.uni new file mode 100644 index 0000000000..736011c9bb --- /dev/null +++ b/MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLibStrings.uni @@ -0,0 +1,29 @@ +// *++ +// +// Copyright (c) 2021, ARM Ltd. All rights reserved.<BR> +// Copyright (c) 2021, Semihalf All rights reserved.<BR> +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// Module Name: +// +// BootDiscoveryPolicyUiLibStrings.uni +// +// Abstract: +// +// String definitions for Boot Discovery Policy UI. +// +// --*/ + +/=# + + +#langdef en-US "English" + +#string STR_FORM_BDP_MAIN_TITLE #language en-US "Boot Discovery Policy" + +#string STR_FORM_BDP_CONN_MIN #language en-US "Minimal" + +#string STR_FORM_BDP_CONN_NET #language en-US "Connect Network Devices" + +#string STR_FORM_BDP_CONN_ALL #language en-US "Connect All Devices" + diff --git a/MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLibVfr.Vfr b/MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLibVfr.Vfr new file mode 100644 index 0000000000..0de87ec34f --- /dev/null +++ b/MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLibVfr.Vfr @@ -0,0 +1,44 @@ +///** @file +// +// Formset for Boot Discovery Policy UI +// +// Copyright (c) 2021, ARM Ltd. All rights reserved.<BR> +// Copyright (c) 2021, Semihalf All rights reserved.<BR> +// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +//**/ + +#include <Uefi/UefiMultiPhase.h> +#include "Guid/BootDiscoveryPolicy.h" +#include <Guid/HiiBootMaintenanceFormset.h> + +typedef struct { + UINT32 BootDiscoveryPolicy; +} BOOT_DISCOVERY_POLICY_VARSTORE_DATA; + +formset + guid = BOOT_DISCOVERY_POLICY_MGR_FORMSET_GUID, + title = STRING_TOKEN(STR_FORM_BDP_MAIN_TITLE), + help = STRING_TOKEN(STR_FORM_BDP_MAIN_TITLE), + classguid = EFI_IFR_BOOT_MAINTENANCE_GUID, + + efivarstore BOOT_DISCOVERY_POLICY_VARSTORE_DATA, + attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE, + name = BootDiscoveryPolicy, + guid = BOOT_DISCOVERY_POLICY_MGR_FORMSET_GUID; + + form formid = 0x0001, + title = STRING_TOKEN(STR_FORM_BDP_MAIN_TITLE); + + oneof varid = BootDiscoveryPolicy.BootDiscoveryPolicy, + prompt = STRING_TOKEN(STR_FORM_BDP_MAIN_TITLE), + help = STRING_TOKEN(STR_FORM_BDP_MAIN_TITLE), + flags = NUMERIC_SIZE_4 | INTERACTIVE | RESET_REQUIRED, + option text = STRING_TOKEN(STR_FORM_BDP_CONN_MIN), value = BDP_CONNECT_MINIMAL, flags = DEFAULT; + option text = STRING_TOKEN(STR_FORM_BDP_CONN_NET), value = BDP_CONNECT_NET, flags = 0; + option text = STRING_TOKEN(STR_FORM_BDP_CONN_ALL), value = BDP_CONNECT_ALL, flags = 0; + endoneof; + + endform; +endformset; -- 2.25.1
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
|
|