[edk2-devel] [PATCH 1/1] MdePkg: Updated the definition of FileName on EFI_FILE_INFO

2023-12-21 Thread SuqiangX Ren
Add the description of FileName to align with UEFI spec 2.10.

REF: UEFI spec 2.10 Table 13.5.16

Signed-off-by: RenSuqiang 
Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 
Cc: Yi Li 
---
 MdePkg/Include/Guid/FileInfo.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdePkg/Include/Guid/FileInfo.h b/MdePkg/Include/Guid/FileInfo.h
index 2b7edf36aabc..dad547a847d3 100644
--- a/MdePkg/Include/Guid/FileInfo.h
+++ b/MdePkg/Include/Guid/FileInfo.h
@@ -46,7 +46,7 @@ typedef struct {
   ///
   UINT64  Attribute;
   ///
-  /// The Null-terminated name of the file.
+  /// The Null-terminated name of the file.For a root directory, the name is 
an empty string.
   ///
   CHAR16  FileName[1];
 } EFI_FILE_INFO;
-- 
2.26.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112838): https://edk2.groups.io/g/devel/message/112838
Mute This Topic: https://groups.io/mt/103314485/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 1/1] MdePkg: Update the comments of callback in EFI_FORM_BROWSER2_PROTOCOL

2023-12-21 Thread SuqiangX Ren
Add status code return for BROWSER callback in EFI_FORM_BROWSER2_PROTOCOL
to align with UEFI spec 2.10.

REF: UEFI spec 2.10 Table 35.6.3

Signed-off-by: RenSuqiang 
Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 
Cc: Yi Li 
---
 MdePkg/Include/Protocol/FormBrowser2.h | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/MdePkg/Include/Protocol/FormBrowser2.h 
b/MdePkg/Include/Protocol/FormBrowser2.h
index 436a7723c1da..bc214caa7d93 100644
--- a/MdePkg/Include/Protocol/FormBrowser2.h
+++ b/MdePkg/Include/Protocol/FormBrowser2.h
@@ -138,10 +138,13 @@ EFI_STATUS
   @retval EFI_SUCCESS   The results have been distributed or are
 awaiting distribution.
 
-  @retval EFI_OUT_OF_RESOURCES  The ResultsDataSize specified
+  @retval EFI_BUFFER_TOO_SMALL  The ResultsDataSize specified
 was too small to contain the
 results data.
 
+  @retval EFI_UNSUPPORTED   Uncommitted browser state is not available
+at the current stage of execution.
+
 **/
 typedef
 EFI_STATUS
-- 
2.26.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112837): https://edk2.groups.io/g/devel/message/112837
Mute This Topic: https://groups.io/mt/103314459/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature

2023-12-21 Thread Yuting Yang
Hi Liming,

Thank you for reviewing ~
Could you please help me create a Bugzilla account? Currently, I do not have 
access to the Bugzilla.

Best Regards,
Yuting

-Original Message-
From: Zhang, Zifeng  
Sent: Thursday, December 21, 2023 2:44 PM
To: Gao, Liming ; Yang, Yuting2 

Cc: Rebecca Cran ; Feng, Bob C ; Chen, 
Arthur G ; devel@edk2.groups.io; Chen, Christine 

Subject: RE: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature

Hi Liming,

Thanks for reviewing.
For background of this change, we will remove default flags in VFR/HFR in new 
platform. So we need help from VFR complier to make a default flag check to 
avoid manually adding.
@Yang, Yuting2, could you help to create a BZ for this feature and share in 
mail thread?
Then let me make a clarification for your questions.

#1: The purpose of --catch_default
We send --catch_default flag in build option to indicate which platform should 
check default flag in VFR/HFR.
Actually maybe some platforms used same EDK2 downstream branch, so we only send 
--catch_default flag for the platforms which need this check.

#2: The purpose of --except_list
VFR compiler will receive VFR/HFR configurations from all folders including 
Intel and EDK2. But in our expectation VFR compiler only do this check in Intel.
So We use --except_list to deliver package list in EDK2 to avoid this check.

Best Regards,
Zifeng

-Original Message-
From: Yang, Yuting2 
Sent: Tuesday, December 12, 2023 5:12 PM
To: Zhang, Zifeng ; Chen, Arthur G 
; devel@edk2.groups.io
Cc: Rebecca Cran ; Gao, Liming ; 
Feng, Bob C 
Subject: RE: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature

+Cc Zhang, Zifeng, Chen, Arthur G

-Original Message-
From: Chen, Christine 
Sent: Tuesday, December 12, 2023 5:04 PM
To: Yang, Yuting2 ; devel@edk2.groups.io
Cc: Rebecca Cran ; Gao, Liming ; 
Feng, Bob C 
Subject: RE: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature

+Cc Yang, Yuting2

> -Original Message-
> From: Yang, Yuting2 
> Sent: Tuesday, December 12, 2023 5:01 PM
> To: devel@edk2.groups.io
> Cc: Rebecca Cran ; Gao, Liming 
> ; Feng, Bob C ; Chen, 
> Christine 
> Subject: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError 
> Feature
> 
> Add --catch_default option
> Raise a DefaultValueError when encountering VFR default definitions to 
> help remove default variables.
> Add --except_list option
> Exclude packages that don't require enabling the catch_default function.
> 
> Cc: Rebecca Cran 
> Cc: Liming Gao 
> Cc: Bob Feng 
> Cc: Christine Chen 
> Cc: Yuting Yang 
> 
> Signed-off-by: Yuting Yang 
> ---
>  BaseTools/Source/C/VfrCompile/VfrCompiler.cpp |  40 ++-
>  BaseTools/Source/C/VfrCompile/VfrCompiler.h   |   3 +
>  BaseTools/Source/C/VfrCompile/VfrError.cpp|   3 +-
>  BaseTools/Source/C/VfrCompile/VfrError.h  |   3 +-
>  BaseTools/Source/C/VfrCompile/VfrFormPkg.h|   1 +
>  BaseTools/Source/C/VfrCompile/VfrSyntax.g | 238 ++
>  6 files changed, 184 insertions(+), 104 deletions(-)
> 
> diff --git a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> index 5f4d262d85..e97cebff65 100644
> --- a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> +++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> @@ -78,6 +78,9 @@ CVfrCompiler::OptionInitialization (
>mOptions.WarningAsError= FALSE;   mOptions.AutoDefault
> = FALSE;   mOptions.CheckDefault  = FALSE;+
> mOptions.IsCatchDefaultEnable  = FALSE;+  mOptions.ExceptionList
> = NULL;+  mOptions.ExceptionListSize = 0;   memset
> (, 0, sizeof (EFI_GUID));if (Argc == 1) {@@ -
> 95,6 +98,23 @@ CVfrCompiler::OptionInitialization (
>Version ();   SET_RUN_STATUS (STATUS_DEAD);   return;+} 
> else if
> (stricmp(Argv[Index], "--catch_default") == 0){+
> mOptions.IsCatchDefaultEnable = TRUE;+} else if (stricmp(Argv[Index], "--
> except_list") == 0){+  INT32 Start = ++Index;+  if ((Start >= Argc) ||
> (Argv[Start][0] == '-')) {+DebugError (NULL, 0, 1001, "Missing 
> option", "-
> exception_list missing except list");+goto Fail;+  }+  while
> ((Argv[Index][0] != '-') && (Index < Argc - 1)) {+Index++;+  }+   
>INT32
> End = Index--;+  mOptions.ExceptionListSize = End - Start;+  for 
> (INT32 i =
> Start; i < End; i++) {+mOptions.ExceptionList = (CHAR8**)
> realloc(mOptions.ExceptionList, (i - Start + 1) * sizeof(CHAR8*));+
> mOptions.ExceptionList[i-Start] = Argv[i];+  } } else if 
> (stricmp(Argv[Index],
> "-l") == 0) {   mOptions.CreateRecordListFile = TRUE;
> gCIfrRecordInfoDB.TurnOn ();@@ -179,7 +199,11 @@ 
> CVfrCompiler::OptionInitialization (
>goto Fail; } strcpy (mOptions.VfrFileName, Argv[Index]);-+
> for (int i =
> 0; i < mOptions.ExceptionListSize; i++) {+  if 
> (strstr(mOptions.VfrFileName,
> mOptions.ExceptionList[i]) != 

Re: [edk2-devel] [Resend PATCH v5 3/4] DynamicTablesPkg: Corrects function pointer typedef of AML_PARSE_FUNCTION

2023-12-21 Thread Abdul Lateef Attar via groups.io
[AMD Official Use Only - General]

Hi Sami,
Currently we are using the AML library and evaluating the 
Dynamic Tables Framework.
Soon we will be publishing(upstreaming) the usage of AML library under the 
edk2-platforms/Platform/AMD/AmdPlatformPkg.

Thanks
AbduL

From: Sami Mujawar 
Sent: Thursday, December 21, 2023 7:24 PM
To: Attar, AbdulLateef (Abdul Lateef) ; 
devel@edk2.groups.io
Cc: Attar, AbdulLateef (Abdul Lateef) ; Pierre 
Gondois ; n...@arm.com
Subject: Re: [Resend PATCH v5 3/4] DynamicTablesPkg: Corrects function pointer 
typedef of AML_PARSE_FUNCTION

Caution: This message originated from an External Source. Use proper caution 
when opening attachments, clicking links, or responding.


Hi Abdul,

Thank you for this fix.

For Arm EFIAPI evaluates to nothing, hence we could not catch such issues.

Do you use the rest of the Dynamic Tables Framework? I guess we have not 
included the calling convention at other places e.g. 
https://github.com/tianocore/edk2/blob/master/DynamicTablesPkg/Include/AcpiTableGenerator.h#L217

Maybe we need to find and fix those issues as well.

In either case, this patch looks good to me.

Reviewed-by: Sami Mujawar



Regards,

Sami Mujawar


On 20/12/2023 09:38 am, Abdul Lateef Attar wrote:

From: Abdul Lateef Attar 




Corrects the function pointer typedef AML_PARSE_FUNCTION,

otherwise some compiler like VS2019 gives error.



Cc: Pierre Gondois 

Cc: Sami Mujawar 

Signed-off-by: Abdul Lateef Attar 


Reviewed-by: Pierre Gondois 


---

 DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.c | 3 +--

 1 file changed, 1 insertion(+), 2 deletions(-)



diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.c 
b/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.c

index 8e584d4930..d3a51a94c7 100644

--- a/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.c

+++ b/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.c

@@ -100,8 +100,7 @@ AmlParseStream (

 **/

 typedef

 EFI_STATUS

-EFIAPI

-(*AML_PARSE_FUNCTION) (

+(EFIAPI *AML_PARSE_FUNCTION)(

   IN  CONST AML_NODE_HEADER   *Node,

   INAML_PARSE_FORMAT  ExpectedFormat,

   IN  OUT   AML_STREAM*FStream,


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112835): https://edk2.groups.io/g/devel/message/112835
Mute This Topic: https://groups.io/mt/103278520/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [Resend PATCH v5 4/4] DynamicTablesPkg: AML Code generation to invoke a method

2023-12-21 Thread Abdul Lateef Attar via groups.io
[AMD Official Use Only - General]

Hi Sami,
Thanks for the in-depth review and making the changes.
Regarding below comment.
[SAMI] This does not seem to be related to this patch. Were you getting any 
issues when building? If so, can you submit a separate patch, please?

If you agree, I will drop the above line from this patch and merge.

[/SAMI]

[Abdul] With VS2019 I am seeing compilation error, I'll submit a separate patch 
for this.

Thanks
AbduL


-Original Message-
From: Sami Mujawar 
Sent: Thursday, December 21, 2023 7:26 PM
To: Attar, AbdulLateef (Abdul Lateef) ; 
devel@edk2.groups.io
Cc: Attar, AbdulLateef (Abdul Lateef) ; Pierre 
Gondois ; n...@arm.com
Subject: Re: [Resend PATCH v5 4/4] DynamicTablesPkg: AML Code generation to 
invoke a method

Caution: This message originated from an External Source. Use proper caution 
when opening attachments, clicking links, or responding.


Hi Abdul,

I have some minor feedback maked inline as [SAMI].

I think other than the typecast change for the value returned by StrSize(), the 
remainder of the patch looks ok to me (i.e. with the minor changes I suggested).

Please let me know if you agree with my suggestions and I will make the changes 
and get this patch merged.

Regards,

Sami Mujawar

On 20/12/2023 09:38 am, Abdul Lateef Attar wrote:
> From: Abdul Lateef Attar 
>
> Adds API to generate AML code to invoke/call another method. Also
> provides ability to pass arguments of type integer, string, ArgObj or
> LocalObj.
>
> Cc: Pierre Gondois 
> Cc: Sami Mujawar 
> Signed-off-by: Abdul Lateef Attar 
> ---
>   .../Include/Library/AmlLib/AmlLib.h   | 112 +
>   .../Common/AmlLib/CodeGen/AmlCodeGen.c| 235 +-
>   2 files changed, 346 insertions(+), 1 deletion(-)
>
> diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
> b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
> index eb8740692f..043ec3d842 100644
> --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
> +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
> @@ -101,6 +101,56 @@ typedef enum {
> AmlAddressRangeMax  = 4
>   } AML_MEMORY_ATTRIBUTES_MTP;
>
> +/** Method parameter types
> +
> +  Possible values are:
> +0 - AmlMethodParamTypeInteger
> +1 - AmlMethodParamTypeString
> +2 - AmlMethodParamTypeArg
> +3 - AmlMethodParamTypeLocal
> +
> +  @par Reference(s)
> +  - ACPI 6.5, s20.2.5 "Term Objects Encoding"
> +
> +**/
> +typedef enum {
> +  AmlMethodParamTypeInteger = 0,
> +  AmlMethodParamTypeString  = 1,
> +  AmlMethodParamTypeArg = 2,
> +  AmlMethodParamTypeLocal   = 3
> +} AML_METHOD_PARAM_TYPE;
> +
> +/** AML Method parameter data
> +  holds the AML method parameter data.
> +**/
> +typedef union {
> +  UINT8 Arg;
> +  UINT8 Local;
> +  UINT64Integer;
> +  VOID  *Buffer;
> +} AML_METHOD_PARAM_DATA;
> +
> +/** structure to hold AML method parameter types
> +  Type  -   Type of parameter
> +  Data  -   holds data of parameter
> +if Type is AmlMethodParamTypeInteger
> +  then Data is of type Integer to hold integer value.
> +if Type is AmlMethodParamTypeString
> +  then Data contains null terminated string.
> +If Type is AmlMethodParamTypeArg
> +  then Data contains the Argument number,
> +  0 to 6 are supported value.
> +If Type is AmlMethodParamTypeLocal
> +  then Data contains the Local variable number,
> +  0 to 7 are supported value.
> +  DataSize - for future use
> +**/
> +typedef struct {
> +  AML_METHOD_PARAM_TYPEType;
> +  AML_METHOD_PARAM_DATAData;
> +  UINTNDataSize;
> +} AML_METHOD_PARAM;
> +
>   /** Parse the definition block.
>
> The function parses the whole AML blob. It starts with the ACPI
> DSDT/SSDT @@ -1693,4 +1743,66 @@ AmlAddNameStringToNamedPackage (
> IN AML_OBJECT_NODE_HANDLE  NamedNode
> );
>
> +/** AML code generation to invoke/call another method.
> +
> +  This method is a subset implementation of MethodInvocation  defined
> + in the ACPI specification 6.5,  section 20.2.5 "Term Objects
> + Encoding".
> +  Added integer, string, ArgObj and LocalObj support.
> +
> +  Example 1:
> +AmlCodeGenInvokeMethod ("MET0", 0, NULL, ParentNode);
> +is equivalent to the following ASL code:
> +  MET0 ();
> +
> +  Example 2:
> +AML_METHOD_PARAM  Param[4];
> +Param[0].Data.Integer = 0x100;
> +Param[0].Type = AmlMethodParamTypeInteger;
> +Param[1].Data.Buffer = "TEST";
> +Param[1].Type = AmlMethodParamTypeString;
> +Param[2].Data.Arg = 0;
> +Param[2].Type = AmlMethodParamTypeArg;
> +Param[3].Data.Local = 2;
> +Param[3].Type = AmlMethodParamTypeLocal;
> +AmlCodeGenInvokeMethod ("MET0", 4, Param, ParentNode);
> +
> +is equivalent to the following ASL code:
> +  MET0 (0x100, "TEST", Arg0, Local2);
> +
> +  Example 3:
> +AML_METHOD_PARAM  Param[2];
> +

Re: [edk2-devel] [Resend PATCH v5 0/4] DynamicTablesPkg: Adds WordIO and method invocation ability

2023-12-21 Thread Abdul Lateef Attar via groups.io
[AMD Official Use Only - General]

Hi Sami,
Below mentioned patch looks good; 
https://github.com/samimujawar/edk2/tree/REVIEW_2923_dynamictables_word_io_method_invocatio
 .
Please go ahead and merge the patch series.
Thanks
AbduL

-Original Message-
From: Sami Mujawar 
Sent: Thursday, December 21, 2023 10:04 PM
To: devel@edk2.groups.io; Attar, AbdulLateef (Abdul Lateef) 

Cc: Attar, AbdulLateef (Abdul Lateef) ; Pierre 
Gondois ; n...@arm.com
Subject: Re: [edk2-devel] [Resend PATCH v5 0/4] DynamicTablesPkg: Adds WordIO 
and method invocation ability

Caution: This message originated from an External Source. Use proper caution 
when opening attachments, clicking links, or responding.


Hi Abdul,

Can you check if the patch 4/4 at
https://github.com/samimujawar/edk2/tree/REVIEW_2923_dynamictables_word_io_method_invocation_v5
looks ok to you,  please?

If you confim, I will apply the push label.

Regards,

Sami Mujawar

On 21/12/2023 01:56 pm, Sami Mujawar via groups.io wrote:
> Hi Abdul,
>
> Glad to see your contribution to the Dynamic Tables Framework. It
> would be great to hear how you are using this package.
>
> I have some minor comments for the last patch 4/4. If you can reply
> back, I will try to get the changes merged before the end of this week.
>
> Regards,
>
> Sami Mujawar
>
> On 20/12/2023 09:38 am, Abdul Lateef Attar wrote:
>> From: Abdul Lateef Attar 
>>
>> PR: https://github.com/tianocore/edk2/pull/5171/
>>
>> V5: delta changes
>>Addressed review comments.
>> V4:
>>Address Pierre's review comments.
>>Merged patch 4 & patch 5.
>>Also added parameter logic suggested by Pierre.
>> V3: delta changes
>>CI fix and error handling for
>>  DynamicTablesPkg: Adds API to generate a method with ArgN.
>>Added new patch "DynamicTablesPkg: Adds wrapper API
>> AmlCodeGenMethodInvokeMethodArgn"
>> V2:
>>Added new API to generate a method which
>>invokes another method with argument.
>> V1:
>> Code changes to
>> Add API to generate word I/O ranges.
>> Correct the parameter to generate word bus number.
>> Corrects the function pointer typedef
>>
>> Cc: Pierre Gondois 
>> Cc: Sami Mujawar 
>> Cc: Abdul Lateef Attar 
>>
>> Abdul Lateef Attar (4):
>>DynamicTablesPkg: AML Code generation for word I/O ranges
>>DynamicTablesPkg: Corrects AmlCodeGenRdWordBusNumber parameters
>>DynamicTablesPkg: Corrects function pointer typedef of
>>  AML_PARSE_FUNCTION
>>DynamicTablesPkg: AML Code generation to invoke a method
>>
>>   .../Include/Library/AmlLib/AmlLib.h   | 187 +-
>>   .../Common/AmlLib/CodeGen/AmlCodeGen.c| 235 +-
>>   .../AmlLib/CodeGen/AmlResourceDataCodeGen.c   |  98 +++-
>>   .../Library/Common/AmlLib/Parser/AmlParser.c  |   3 +-
>>   4 files changed, 510 insertions(+), 13 deletions(-)
>>
>
>
> 
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112833): https://edk2.groups.io/g/devel/message/112833
Mute This Topic: https://groups.io/mt/103278517/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 2/2] BaseTools: Update keybaord map based on UEFI spec 2.10

2023-12-21 Thread Li, Yi
REF: UEFI SPEC 2.10 34.8.10 EFI_KEY

Add EfiKeyIntl0-9.

Signed-off-by: Yi Li 

Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
Cc: Yuwei Chen 
---
 .../Include/Common/UefiInternalFormRepresentation.h  | 12 +++-
 BaseTools/Source/C/Include/Protocol/HiiFramework.h   | 12 +++-
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h 
b/BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h
index b9fa8c39a6d0..cb009ed68ecb 100644
--- a/BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h
+++ b/BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h
@@ -1556,7 +1556,17 @@ typedef enum {
   EfiKeyF12,
   EfiKeyPrint,
   EfiKeySLck,
-  EfiKeyPause
+  EfiKeyPause,
+  EfiKeyIntl0,
+  EfiKeyIntl1,
+  EfiKeyIntl2,
+  EfiKeyIntl3,
+  EfiKeyIntl4,
+  EfiKeyIntl5,
+  EfiKeyIntl6,
+  EfiKeyIntl7,
+  EfiKeyIntl8,
+  EfiKeyIntl9
 } EFI_KEY;
 
 typedef struct {
diff --git a/BaseTools/Source/C/Include/Protocol/HiiFramework.h 
b/BaseTools/Source/C/Include/Protocol/HiiFramework.h
index 448350967bbf..874889095700 100644
--- a/BaseTools/Source/C/Include/Protocol/HiiFramework.h
+++ b/BaseTools/Source/C/Include/Protocol/HiiFramework.h
@@ -350,7 +350,17 @@ typedef enum {
   EfiKeyF12,
   EfiKeyPrint,
   EfiKeySLck,
-  EfiKeyPause
+  EfiKeyPause,
+  EfiKeyIntl0,
+  EfiKeyIntl1,
+  EfiKeyIntl2,
+  EfiKeyIntl3,
+  EfiKeyIntl4,
+  EfiKeyIntl5,
+  EfiKeyIntl6,
+  EfiKeyIntl7,
+  EfiKeyIntl8,
+  EfiKeyIntl9
 } EFI_KEY;
 
 typedef struct {
-- 
2.42.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112832): https://edk2.groups.io/g/devel/message/112832
Mute This Topic: https://groups.io/mt/103313001/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 1/2] MdePkg: Update keybaord map based on UEFI spec 2.10

2023-12-21 Thread Li, Yi
REF: UEFI SPEC 2.10 34.8.10 EFI_KEY

Add EfiKeyIntl0-9.

Signed-off-by: Yi Li 

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 
---
 MdePkg/Include/Uefi/UefiInternalFormRepresentation.h | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h 
b/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h
index 3be9a0d7d66b..3f8974857258 100644
--- a/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h
+++ b/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h
@@ -1696,7 +1696,17 @@ typedef enum {
   EfiKeyF12,
   EfiKeyPrint,
   EfiKeySLck,
-  EfiKeyPause
+  EfiKeyPause,
+  EfiKeyIntl0,
+  EfiKeyIntl1,
+  EfiKeyIntl2,
+  EfiKeyIntl3,
+  EfiKeyIntl4,
+  EfiKeyIntl5,
+  EfiKeyIntl6,
+  EfiKeyIntl7,
+  EfiKeyIntl8,
+  EfiKeyIntl9
 } EFI_KEY;
 
 typedef struct {
-- 
2.42.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112831): https://edk2.groups.io/g/devel/message/112831
Mute This Topic: https://groups.io/mt/103312999/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 0/2] Update keybaord map based on UEFI spec 2.10

2023-12-21 Thread Li, Yi
REF: UEFI SPEC 2.10 34.8.10 EFI_KEY

Add EfiKeyIntl0-9.

Signed-off-by: Yi Li 

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 
Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
Cc: Yuwei Chen 

Yi Li (2):
  MdePkg: Update keybaord map based on UEFI spec 2.10
  BaseTools: Update keybaord map based on UEFI spec 2.10

 .../Include/Common/UefiInternalFormRepresentation.h  | 12 +++-
 BaseTools/Source/C/Include/Protocol/HiiFramework.h   | 12 +++-
 MdePkg/Include/Uefi/UefiInternalFormRepresentation.h | 12 +++-
 3 files changed, 33 insertions(+), 3 deletions(-)

-- 
2.42.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112830): https://edk2.groups.io/g/devel/message/112830
Mute This Topic: https://groups.io/mt/103312998/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v2] EmulatorPkg: Add EFI_STATUS return to EMU_THUNK_PROTOCOL.SetTime()

2023-12-21 Thread Ni, Ray
Reviewed-by: Ray Ni 

Thanks,
Ray
> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of
> Desimone, Nathaniel L
> Sent: Saturday, September 30, 2023 6:12 AM
> To: devel@edk2.groups.io
> Cc: Andrew Fish ; Ni, Ray ; Kinney,
> Michael D ; Chiu, Chasel
> 
> Subject: [edk2-devel] [PATCH v2] EmulatorPkg: Add EFI_STATUS return to
> EMU_THUNK_PROTOCOL.SetTime()
> 
> There is an inconsistency between the UNIX and Windows
> implementations of EMU_THUNK_PROTOCOL.SetTime(). The Windows
> version returns an EFI_STATUS value whereas the the UNIX
> implementation is VOID. However, the UNIX implementation is an
> unimplemented stub whereas the Windows version is implementated.
> 
> The current EMU_THUNK_PROTOCOL function pointer definition
> specifies a VOID return type. However, EMU_THUNK_PROTOCOL.SetTime()
> is close to the spec defined gRT->SetTime() except for missing the
> EFI_STATUS return type.
> 
> Therefore, I conclude that the most sensible reconciliation is to
> add the EFI_STATUS return type to the protocol definition.
> 
> Cc: Andrew Fish 
> Cc: Ray Ni 
> Cc: Michael D Kinney 
> Cc: Chasel Chiu 
> Signed-off-by: Nate DeSimone 
> ---
>  EmulatorPkg/Include/Protocol/EmuThunk.h | 5 +++--
>  EmulatorPkg/Unix/Host/EmuThunk.c| 4 ++--
>  2 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/EmulatorPkg/Include/Protocol/EmuThunk.h
> b/EmulatorPkg/Include/Protocol/EmuThunk.h
> index c419d0a677..bdd57f410b 100644
> --- a/EmulatorPkg/Include/Protocol/EmuThunk.h
> +++ b/EmulatorPkg/Include/Protocol/EmuThunk.h
> @@ -2,6 +2,7 @@
>Emulator Thunk to abstract OS services from pure EFI code
> 
>Copyright (c) 2008 - 2011, Apple Inc. All rights reserved.
> +  Copyright (c) 2023, Intel Corporation. All rights reserved.
> 
>SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> @@ -148,12 +149,12 @@ VOID
>  typedef
>  VOID
>  (EFIAPI *EMU_GET_TIME)(
> -  OUT  EFI_TIME   *Time,
> +  OUT EFI_TIME*Time,
>OUT EFI_TIME_CAPABILITIES   *Capabilities OPTIONAL
>);
> 
>  typedef
> -VOID
> +EFI_STATUS
>  (EFIAPI *EMU_SET_TIME)(
>IN   EFI_TIME   *Time
>);
> diff --git a/EmulatorPkg/Unix/Host/EmuThunk.c
> b/EmulatorPkg/Unix/Host/EmuThunk.c
> index ee0843eebf..c57c105a53 100644
> --- a/EmulatorPkg/Unix/Host/EmuThunk.c
> +++ b/EmulatorPkg/Unix/Host/EmuThunk.c
> @@ -387,14 +387,14 @@ SecGetTime (
>}
>  }
> 
> -VOID
> +EFI_STATUS
>  SecSetTime (
>IN  EFI_TIME  *Time
>)
>  {
>// Don't change the time on the system
>// We could save delta to localtime() and have SecGetTime adjust return
> values?
> -  return;
> +  return EFI_UNSUPPORTED;
>  }
> 
>  EFI_STATUS
> --
> 2.39.2.windows.1
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112829): https://edk2.groups.io/g/devel/message/112829
Mute This Topic: https://groups.io/mt/103312902/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: 
https://edk2.groups.io/g/devel/leave/9847357/21656/1706620634/xyzzy 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v2] MdeModulePkg/UefiBootManagerLib: Signal ReadyToBoot on platform recovery

2023-12-21 Thread Neal Gompa
On Tue, Dec 19, 2023 at 9:11 AM Samer El-Haj-Mahmoud
 wrote:
>
> Thank you all!
>

Thank you everyone, I see that it has landed in the repository now:
https://github.com/tianocore/edk2/commit/8c1e9f9c6fa7b5137003b0cfa6d54a6bada16d8e



-- 
真実はいつも一つ!/ Always, there's only one truth!


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112828): https://edk2.groups.io/g/devel/message/112828
Mute This Topic: https://groups.io/mt/103262405/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v1] Platform/Intel: Specifies SmmCpuSyncLib instance

2023-12-21 Thread Chiu, Chasel


Patch merged: 
https://github.com/tianocore/edk2-platforms/commit/9c9a4821e0866f219f1d03ba24a6a433ea408223

Thanks,
Chasel



> -Original Message-
> From: Wu, Jiaxin 
> Sent: Wednesday, December 20, 2023 7:42 PM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel ; Desimone, Nathaniel L
> ; Kinney, Michael D
> ; Gao, Liming ; Ni,
> Ray 
> Subject: [PATCH v1] Platform/Intel: Specifies SmmCpuSyncLib instance
> 
> This patch is to specify SmmCpuSyncLib instance for MinPlatformPkg
> 
> Cc: Chasel Chiu 
> Cc: Nate DeSimone 
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> Cc: Ray Ni 
> Signed-off-by: Jiaxin Wu 
> ---
>  Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
> b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
> index e40b2ff6e1..790fccf400 100644
> --- a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
> +++ b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
> @@ -105,10 +105,11 @@
>MtrrLib|UefiCpuPkg/Library/MtrrLib/MtrrLib.inf
>LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
> 
> SmmCpuFeaturesLib|UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeatures
> Lib.inf
>MicrocodeLib|UefiCpuPkg/Library/MicrocodeLib/MicrocodeLib.inf
>CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf
> +  SmmCpuSyncLib|UefiCpuPkg/Library/SmmCpuSyncLib/SmmCpuSyncLib.inf
> 
>#
># Platform
>#
>TimerLib|PcAtChipsetPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf
> --
> 2.16.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112827): https://edk2.groups.io/g/devel/message/112827
Mute This Topic: https://groups.io/mt/103294650/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v4 19/37] UefiCpuPkg: Add MMIO method in CpuIo2Dxe

2023-12-21 Thread Ni, Ray
Good to me.

Thanks,
Ray
From: Chao Li 
Sent: Friday, December 22, 2023 9:15 AM
To: devel@edk2.groups.io; a...@kernel.org; Ni, Ray 
Cc: Kumar, Rahul R ; Gerd Hoffmann 
; Leif Lindholm ; Ard Biesheuvel 
; Sami Mujawar 
Subject: Re: [edk2-devel] [PATCH v4 19/37] UefiCpuPkg: Add MMIO method in 
CpuIo2Dxe




Thanks,
Chao
On 2023/12/21 21:59, Ard Biesheuvel wrote:

On Thu, 21 Dec 2023 at 13:41, Chao Li 
 wrote:



...

A given platform will either be able to use port IO, or it will need

to use MMIO translation. So a driver that can do both based on a PCD

is not very useful, it makes more sense to have two different drivers,

and the platform incorporates the one it can use.



Ok, I get it, I think you are more inclined to move the ArmCpuIo2Dxe to a new 
place and rename it, maybe: CpuMmio2Dxe, while some platforms choose the 
different CpuIo2 drvier by themselves when building FW, right?





Yes.

Ok, I agree. If there are no issues with Ray, I will adjust this patch in V5. I 
tund is move it under UefiCpuPkg and name it CpuMmio2Dxe, it will be in the 
same directory as CpuIo2Dxe, is that OK?

Ray, what do you think of this plan?












-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112826): https://edk2.groups.io/g/devel/message/112826
Mute This Topic: https://groups.io/mt/103261693/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: 
https://edk2.groups.io/g/devel/leave/9847357/21656/1706620634/xyzzy 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v1] Platform/Intel: Specifies SmmCpuSyncLib instance

2023-12-21 Thread Chiu, Chasel


Reviewed-by: Chasel Chiu 

Thanks,
Chasel



> -Original Message-
> From: Wu, Jiaxin 
> Sent: Wednesday, December 20, 2023 7:42 PM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel ; Desimone, Nathaniel L
> ; Kinney, Michael D
> ; Gao, Liming ; Ni,
> Ray 
> Subject: [PATCH v1] Platform/Intel: Specifies SmmCpuSyncLib instance
> 
> This patch is to specify SmmCpuSyncLib instance for MinPlatformPkg
> 
> Cc: Chasel Chiu 
> Cc: Nate DeSimone 
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> Cc: Ray Ni 
> Signed-off-by: Jiaxin Wu 
> ---
>  Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
> b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
> index e40b2ff6e1..790fccf400 100644
> --- a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
> +++ b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
> @@ -105,10 +105,11 @@
>MtrrLib|UefiCpuPkg/Library/MtrrLib/MtrrLib.inf
>LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
> 
> SmmCpuFeaturesLib|UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeatures
> Lib.inf
>MicrocodeLib|UefiCpuPkg/Library/MicrocodeLib/MicrocodeLib.inf
>CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf
> +  SmmCpuSyncLib|UefiCpuPkg/Library/SmmCpuSyncLib/SmmCpuSyncLib.inf
> 
>#
># Platform
>#
>TimerLib|PcAtChipsetPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf
> --
> 2.16.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112825): https://edk2.groups.io/g/devel/message/112825
Mute This Topic: https://groups.io/mt/103294650/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH] StandaloneMmPkg/Core: Remove dead code

2023-12-21 Thread Ni, Ray
> >Copyright (c) 2014, Hewlett-Packard Development Company, L.P.
> > -  Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
> > +  Copyright (c) 2009 - 2023, Intel Corporation. All rights reserved.
> I know this is standard procedure, but you are extending Intel's
> copyright claim on this file by 9 years by /removing/ 180 lines?

:)

I will remove the copy right year change.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112824): https://edk2.groups.io/g/devel/message/112824
Mute This Topic: https://groups.io/mt/103278283/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: 
https://edk2.groups.io/g/devel/leave/9847357/21656/1706620634/xyzzy 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v4 19/37] UefiCpuPkg: Add MMIO method in CpuIo2Dxe

2023-12-21 Thread Chao Li



Thanks,
Chao
On 2023/12/21 21:59, Ard Biesheuvel wrote:

On Thu, 21 Dec 2023 at 13:41, Chao Li  wrote:
...

A given platform will either be able to use port IO, or it will need
to use MMIO translation. So a driver that can do both based on a PCD
is not very useful, it makes more sense to have two different drivers,
and the platform incorporates the one it can use.

Ok, I get it, I think you are more inclined to move the ArmCpuIo2Dxe to a new 
place and rename it, maybe: CpuMmio2Dxe, while some platforms choose the 
different CpuIo2 drvier by themselves when building FW, right?


Yes.


Ok, I agree. If there are no issues with Ray, I will adjust this patch 
in V5. I tund is move it under UefiCpuPkg and name it CpuMmio2Dxe, it 
will be in the same directory as CpuIo2Dxe, is that OK?


Ray, what do you think of this plan?









-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112823): https://edk2.groups.io/g/devel/message/112823
Mute This Topic: https://groups.io/mt/103261693/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [Resend PATCH v5 0/4] DynamicTablesPkg: Adds WordIO and method invocation ability

2023-12-21 Thread Sami Mujawar

Hi Abdul,

Can you check if the patch 4/4 at 
https://github.com/samimujawar/edk2/tree/REVIEW_2923_dynamictables_word_io_method_invocation_v5 
looks ok to you,  please?


If you confim, I will apply the push label.

Regards,

Sami Mujawar

On 21/12/2023 01:56 pm, Sami Mujawar via groups.io wrote:

Hi Abdul,

Glad to see your contribution to the Dynamic Tables Framework. It 
would be great to hear how you are using this package.


I have some minor comments for the last patch 4/4. If you can reply 
back, I will try to get the changes merged before the end of this week.


Regards,

Sami Mujawar

On 20/12/2023 09:38 am, Abdul Lateef Attar wrote:

From: Abdul Lateef Attar 

PR: https://github.com/tianocore/edk2/pull/5171/

V5: delta changes
   Addressed review comments.
V4:
   Address Pierre's review comments.
   Merged patch 4 & patch 5.
   Also added parameter logic suggested by Pierre.
V3: delta changes
   CI fix and error handling for
 DynamicTablesPkg: Adds API to generate a method with ArgN.
   Added new patch "DynamicTablesPkg: Adds wrapper API 
AmlCodeGenMethodInvokeMethodArgn"

V2:
   Added new API to generate a method which
   invokes another method with argument.
V1:
Code changes to
Add API to generate word I/O ranges.
Correct the parameter to generate word bus number.
Corrects the function pointer typedef

Cc: Pierre Gondois 
Cc: Sami Mujawar 
Cc: Abdul Lateef Attar 

Abdul Lateef Attar (4):
   DynamicTablesPkg: AML Code generation for word I/O ranges
   DynamicTablesPkg: Corrects AmlCodeGenRdWordBusNumber parameters
   DynamicTablesPkg: Corrects function pointer typedef of
 AML_PARSE_FUNCTION
   DynamicTablesPkg: AML Code generation to invoke a method

  .../Include/Library/AmlLib/AmlLib.h   | 187 +-
  .../Common/AmlLib/CodeGen/AmlCodeGen.c    | 235 +-
  .../AmlLib/CodeGen/AmlResourceDataCodeGen.c   |  98 +++-
  .../Library/Common/AmlLib/Parser/AmlParser.c  |   3 +-
  4 files changed, 510 insertions(+), 13 deletions(-)










-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112822): https://edk2.groups.io/g/devel/message/112822
Mute This Topic: https://groups.io/mt/103278517/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH] EmbeddedPkg/PrePiMemoryAllocationLib: Add ReallocatePool

2023-12-21 Thread Ard Biesheuvel
On Thu, 21 Dec 2023 at 15:39, Ard Biesheuvel  wrote:
>
> On Mon, 18 Dec 2023 at 03:23, Chang, Abner  wrote:
> >
> > [AMD Official Use Only - General]
> >
> > Reviewed-by: Abner Chang 
> >
>
> I've queued this up, along with the mock one - thanks.
>

Rejected by CI:
https://github.com/tianocore/edk2/pull/5184


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112821): https://edk2.groups.io/g/devel/message/112821
Mute This Topic: https://groups.io/mt/103110962/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH] EmbeddedPkg/PrePiMemoryAllocationLib: Add ReallocatePool

2023-12-21 Thread Ard Biesheuvel
On Mon, 18 Dec 2023 at 03:23, Chang, Abner  wrote:
>
> [AMD Official Use Only - General]
>
> Reviewed-by: Abner Chang 
>

I've queued this up, along with the mock one - thanks.

> > -Original Message-
> > From: Jeff Brasen 
> > Sent: Monday, December 11, 2023 11:48 PM
> > To: devel@edk2.groups.io
> > Cc: Chang, Abner ; ardb+tianoc...@kernel.org;
> > quic_llind...@quicinc.com; Jeff Brasen 
> > Subject: [PATCH] EmbeddedPkg/PrePiMemoryAllocationLib: Add
> > ReallocatePool
> >
> > Caution: This message originated from an External Source. Use proper caution
> > when opening attachments, clicking links, or responding.
> >
> >
> > Add implementation of ReallocatePool which is defined in the
> > MemoryAllocationLib header file to allow components to not
> > need special handling for PrePi module types.
> >
> > Signed-off-by: Jeff Brasen 
> > ---
> >  .../MemoryAllocationLib.c | 57 +++
> >  1 file changed, 57 insertions(+)
> >
> > diff --git
> > a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c
> > b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c
> > index 08a0add340..39fbe243dd 100644
> > ---
> > a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c
> > +++
> > b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c
> > @@ -269,3 +269,60 @@ FreePool (
> >  {
> >// Not implemented yet
> >  }
> > +
> > +/**
> > +  Reallocates a buffer of type EfiBootServicesData.
> > +
> > +  Allocates and zeros the number bytes specified by NewSize from memory of
> > type
> > +  EfiBootServicesData.  If OldBuffer is not NULL, then the smaller of 
> > OldSize
> > and
> > +  NewSize bytes are copied from OldBuffer to the newly allocated buffer, 
> > and
> > +  OldBuffer is freed.  A pointer to the newly allocated buffer is returned.
> > +  If NewSize is 0, then a valid buffer of 0 size is  returned.  If there 
> > is not
> > +  enough memory remaining to satisfy the request, then NULL is returned.
> > +
> > +  If the allocation of the new buffer is successful and the smaller of 
> > NewSize
> > and OldSize
> > +  is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
> > +
> > +  @param  OldSizeThe size, in bytes, of OldBuffer.
> > +  @param  NewSizeThe size, in bytes, of the buffer to reallocate.
> > +  @param  OldBuffer  The buffer to copy to the allocated buffer.  This 
> > is an
> > optional
> > + parameter that may be NULL.
> > +
> > +  @return A pointer to the allocated buffer or NULL if allocation fails.
> > +
> > +**/
> > +VOID *
> > +EFIAPI
> > +ReallocatePool (
> > +  IN UINTN  OldSize,
> > +  IN UINTN  NewSize,
> > +  IN VOID   *OldBuffer  OPTIONAL
> > +  )
> > +{
> > +  VOID  *NewBuffer;
> > +
> > +  // Validate the OldBuffer is HobAllocated.
> > +  DEBUG_CODE_BEGIN ();
> > +  EFI_HOB_HANDOFF_INFO_TABLE  *HandOffHob;
> > +
> > +  if (OldBuffer != NULL) {
> > +HandOffHob = GetHobList ();
> > +ASSERT (((EFI_PHYSICAL_ADDRESS)OldBuffer >= HandOffHob-
> > >EfiMemoryBottom));
> > +ASSERT (((EFI_PHYSICAL_ADDRESS)(OldBuffer + OldSize) <= HandOffHob-
> > >EfiFreeMemoryBottom));
> > +  }
> > +
> > +  DEBUG_CODE_END ();
> > +
> > +  // If new buffer would be smaller just return old buffer as FreePool 
> > isn't
> > supported.
> > +  if ((OldBuffer != NULL) && (OldSize >= NewSize)) {
> > +return OldBuffer;
> > +  }
> > +
> > +  NewBuffer = AllocateZeroPool (NewSize);
> > +  if ((NewBuffer != NULL) && (OldBuffer != NULL)) {
> > +CopyMem (NewBuffer, OldBuffer, MIN (OldSize, NewSize));
> > +FreePool (OldBuffer);
> > +  }
> > +
> > +  return NewBuffer;
> > +}
> > --
> > 2.34.1
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112820): https://edk2.groups.io/g/devel/message/112820
Mute This Topic: https://groups.io/mt/103110962/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v4 19/37] UefiCpuPkg: Add MMIO method in CpuIo2Dxe

2023-12-21 Thread Ard Biesheuvel
On Thu, 21 Dec 2023 at 13:41, Chao Li  wrote:
>
...
> A given platform will either be able to use port IO, or it will need
> to use MMIO translation. So a driver that can do both based on a PCD
> is not very useful, it makes more sense to have two different drivers,
> and the platform incorporates the one it can use.
>
> Ok, I get it, I think you are more inclined to move the ArmCpuIo2Dxe to a new 
> place and rename it, maybe: CpuMmio2Dxe, while some platforms choose the 
> different CpuIo2 drvier by themselves when building FW, right?
>

Yes.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112819): https://edk2.groups.io/g/devel/message/112819
Mute This Topic: https://groups.io/mt/103261693/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [Resend PATCH v5 0/4] DynamicTablesPkg: Adds WordIO and method invocation ability

2023-12-21 Thread Sami Mujawar

Hi Abdul,

Glad to see your contribution to the Dynamic Tables Framework. It would 
be great to hear how you are using this package.


I have some minor comments for the last patch 4/4. If you can reply 
back, I will try to get the changes merged before the end of this week.


Regards,

Sami Mujawar

On 20/12/2023 09:38 am, Abdul Lateef Attar wrote:

From: Abdul Lateef Attar 

PR: https://github.com/tianocore/edk2/pull/5171/

V5: delta changes
   Addressed review comments.
V4:
   Address Pierre's review comments.
   Merged patch 4 & patch 5.
   Also added parameter logic suggested by Pierre.
V3: delta changes
   CI fix and error handling for
 DynamicTablesPkg: Adds API to generate a method with ArgN.
   Added new patch "DynamicTablesPkg: Adds wrapper API 
AmlCodeGenMethodInvokeMethodArgn"
V2:
   Added new API to generate a method which
   invokes another method with argument.
V1:
Code changes to
Add API to generate word I/O ranges.
Correct the parameter to generate word bus number.
Corrects the function pointer typedef

Cc: Pierre Gondois 
Cc: Sami Mujawar 
Cc: Abdul Lateef Attar 

Abdul Lateef Attar (4):
   DynamicTablesPkg: AML Code generation for word I/O ranges
   DynamicTablesPkg: Corrects AmlCodeGenRdWordBusNumber parameters
   DynamicTablesPkg: Corrects function pointer typedef of
 AML_PARSE_FUNCTION
   DynamicTablesPkg: AML Code generation to invoke a method

  .../Include/Library/AmlLib/AmlLib.h   | 187 +-
  .../Common/AmlLib/CodeGen/AmlCodeGen.c| 235 +-
  .../AmlLib/CodeGen/AmlResourceDataCodeGen.c   |  98 +++-
  .../Library/Common/AmlLib/Parser/AmlParser.c  |   3 +-
  4 files changed, 510 insertions(+), 13 deletions(-)




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112818): https://edk2.groups.io/g/devel/message/112818
Mute This Topic: https://groups.io/mt/103278517/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [Resend PATCH v5 4/4] DynamicTablesPkg: AML Code generation to invoke a method

2023-12-21 Thread Sami Mujawar

Hi Abdul,

I have some minor feedback maked inline as [SAMI].

I think other than the typecast change for the value returned by 
StrSize(), the remainder of the patch looks ok to me (i.e. with the 
minor changes I suggested).


Please let me know if you agree with my suggestions and I will make the 
changes and get this patch merged.


Regards,

Sami Mujawar

On 20/12/2023 09:38 am, Abdul Lateef Attar wrote:

From: Abdul Lateef Attar 

Adds API to generate AML code to invoke/call another
method. Also provides ability to pass arguments of
type integer, string, ArgObj or LocalObj.

Cc: Pierre Gondois 
Cc: Sami Mujawar 
Signed-off-by: Abdul Lateef Attar 
---
  .../Include/Library/AmlLib/AmlLib.h   | 112 +
  .../Common/AmlLib/CodeGen/AmlCodeGen.c| 235 +-
  2 files changed, 346 insertions(+), 1 deletion(-)

diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h 
b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
index eb8740692f..043ec3d842 100644
--- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
+++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
@@ -101,6 +101,56 @@ typedef enum {
AmlAddressRangeMax  = 4
  } AML_MEMORY_ATTRIBUTES_MTP;
  
+/** Method parameter types

+
+  Possible values are:
+0 - AmlMethodParamTypeInteger
+1 - AmlMethodParamTypeString
+2 - AmlMethodParamTypeArg
+3 - AmlMethodParamTypeLocal
+
+  @par Reference(s)
+  - ACPI 6.5, s20.2.5 "Term Objects Encoding"
+
+**/
+typedef enum {
+  AmlMethodParamTypeInteger = 0,
+  AmlMethodParamTypeString  = 1,
+  AmlMethodParamTypeArg = 2,
+  AmlMethodParamTypeLocal   = 3
+} AML_METHOD_PARAM_TYPE;
+
+/** AML Method parameter data
+  holds the AML method parameter data.
+**/
+typedef union {
+  UINT8 Arg;
+  UINT8 Local;
+  UINT64Integer;
+  VOID  *Buffer;
+} AML_METHOD_PARAM_DATA;
+
+/** structure to hold AML method parameter types
+  Type  -   Type of parameter
+  Data  -   holds data of parameter
+if Type is AmlMethodParamTypeInteger
+  then Data is of type Integer to hold integer value.
+if Type is AmlMethodParamTypeString
+  then Data contains null terminated string.
+If Type is AmlMethodParamTypeArg
+  then Data contains the Argument number,
+  0 to 6 are supported value.
+If Type is AmlMethodParamTypeLocal
+  then Data contains the Local variable number,
+  0 to 7 are supported value.
+  DataSize - for future use
+**/
+typedef struct {
+  AML_METHOD_PARAM_TYPEType;
+  AML_METHOD_PARAM_DATAData;
+  UINTNDataSize;
+} AML_METHOD_PARAM;
+
  /** Parse the definition block.
  
The function parses the whole AML blob. It starts with the ACPI DSDT/SSDT

@@ -1693,4 +1743,66 @@ AmlAddNameStringToNamedPackage (
IN AML_OBJECT_NODE_HANDLE  NamedNode
);
  
+/** AML code generation to invoke/call another method.

+
+  This method is a subset implementation of MethodInvocation
+  defined in the ACPI specification 6.5,
+  section 20.2.5 "Term Objects Encoding".
+  Added integer, string, ArgObj and LocalObj support.
+
+  Example 1:
+AmlCodeGenInvokeMethod ("MET0", 0, NULL, ParentNode);
+is equivalent to the following ASL code:
+  MET0 ();
+
+  Example 2:
+AML_METHOD_PARAM  Param[4];
+Param[0].Data.Integer = 0x100;
+Param[0].Type = AmlMethodParamTypeInteger;
+Param[1].Data.Buffer = "TEST";
+Param[1].Type = AmlMethodParamTypeString;
+Param[2].Data.Arg = 0;
+Param[2].Type = AmlMethodParamTypeArg;
+Param[3].Data.Local = 2;
+Param[3].Type = AmlMethodParamTypeLocal;
+AmlCodeGenInvokeMethod ("MET0", 4, Param, ParentNode);
+
+is equivalent to the following ASL code:
+  MET0 (0x100, "TEST", Arg0, Local2);
+
+  Example 3:
+AML_METHOD_PARAM  Param[2];
+Param[0].Data.Arg = 0;
+Param[0].Type = AmlMethodParamTypeArg;
+Param[1].Data.Integer = 0x100;
+Param[1].Type = AmlMethodParamTypeInteger;
+AmlCodeGenMethodRetNameString ("MET2", NULL, 2, TRUE, 0, ParentNode, 
);
+AmlCodeGenInvokeMethod ("MET3", 2, Param, MethodNode);
+
+is equivalent to the following ASL code:
+Method (MET2, 2, Serialized)
+{
+  MET3 (Arg0, 0x0100)
+}
+
+  @param [in] MethodNameString  The method name to be called or invoked.
+  @param [in] NumArgs   Number of arguments to be passed,
+0 to 7 are permissible values.
+  @param [in] ParametersContains the parameter data.
+  @param [in] ParentNodeThe parent node to which the method invocation
+nodes are attached.
+
+  @retval EFI_SUCCESS Success.
+  @retval EFI_INVALID_PARAMETER   Invalid parameter.
+  @retval EFI_OUT_OF_RESOURCESFailed to allocate memory.
+ **/
+EFI_STATUS
+EFIAPI
+AmlCodeGenInvokeMethod (
+  IN  CONST CHAR8 *MethodNameString,
+  INUINT8 NumArgs,
+  IN   

Re: [edk2-devel] [Resend PATCH v5 3/4] DynamicTablesPkg: Corrects function pointer typedef of AML_PARSE_FUNCTION

2023-12-21 Thread Sami Mujawar

Hi Abdul,

Thank you for this fix.

For Arm EFIAPI evaluates to nothing, hence we could not catch such issues.

Do you use the rest of the Dynamic Tables Framework? I guess we have not 
included the calling convention at other places e.g. 
https://github.com/tianocore/edk2/blob/master/DynamicTablesPkg/Include/AcpiTableGenerator.h#L217


Maybe we need to find and fix those issues as well.

In either case, this patch looks good to me.

Reviewed-by: Sami Mujawar 

Regards,

Sami Mujawar

On 20/12/2023 09:38 am, Abdul Lateef Attar wrote:

From: Abdul Lateef Attar

Corrects the function pointer typedef AML_PARSE_FUNCTION,
otherwise some compiler like VS2019 gives error.

Cc: Pierre Gondois
Cc: Sami Mujawar
Signed-off-by: Abdul Lateef Attar
Reviewed-by: Pierre Gondois
---
  DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.c 
b/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.c
index 8e584d4930..d3a51a94c7 100644
--- a/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.c
+++ b/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.c
@@ -100,8 +100,7 @@ AmlParseStream (
  **/
  typedef
  EFI_STATUS
-EFIAPI
-(*AML_PARSE_FUNCTION) (
+(EFIAPI *AML_PARSE_FUNCTION)(
IN  CONST AML_NODE_HEADER   *Node,
INAML_PARSE_FORMAT  ExpectedFormat,
IN  OUT   AML_STREAM*FStream,



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112816): https://edk2.groups.io/g/devel/message/112816
Mute This Topic: https://groups.io/mt/103278520/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [Resend PATCH v5 2/4] DynamicTablesPkg: Corrects AmlCodeGenRdWordBusNumber parameters

2023-12-21 Thread Sami Mujawar

Hi Abdul,

Thank you for this fix. These changes look good to me.

Reviewed-by: Sami Mujawar 

Regards,

Sami Mujawar

On 20/12/2023 09:38 am, Abdul Lateef Attar wrote:

From: Abdul Lateef Attar 

Corrects the parameters of AmlCodeGenRdWordBusNumber() to
UINT16 to generate word bus number.

Cc: Pierre Gondois 
Cc: Sami Mujawar 
Signed-off-by: Abdul Lateef Attar 
Reviewed-by: Pierre Gondois 
---
  DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h   | 10 +-
  .../Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c | 10 +-
  2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h 
b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
index 5e340b94ce..eb8740692f 100644
--- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
+++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
@@ -714,11 +714,11 @@ AmlCodeGenRdWordBusNumber (
INBOOLEAN IsMinFixed,
INBOOLEAN IsMaxFixed,
INBOOLEAN IsPosDecode,
-  INUINT32 AddressGranularity,
-  INUINT32 AddressMinimum,
-  INUINT32 AddressMaximum,
-  INUINT32 AddressTranslation,
-  INUINT32 RangeLength,
+  INUINT16 AddressGranularity,
+  INUINT16 AddressMinimum,
+  INUINT16 AddressMaximum,
+  INUINT16 AddressTranslation,
+  INUINT16 RangeLength,
INUINT8 ResourceSourceIndex,
IN  CONST CHAR8 *ResourceSource,
INAML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL
diff --git 
a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c 
b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c
index 60fe69ba6d..46243f981c 100644
--- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c
+++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c
@@ -848,11 +848,11 @@ AmlCodeGenRdWordBusNumber (
INBOOLEAN IsMinFixed,
INBOOLEAN IsMaxFixed,
INBOOLEAN IsPosDecode,
-  INUINT32 AddressGranularity,
-  INUINT32 AddressMinimum,
-  INUINT32 AddressMaximum,
-  INUINT32 AddressTranslation,
-  INUINT32 RangeLength,
+  INUINT16 AddressGranularity,
+  INUINT16 AddressMinimum,
+  INUINT16 AddressMaximum,
+  INUINT16 AddressTranslation,
+  INUINT16 RangeLength,
INUINT8 ResourceSourceIndex,
IN  CONST CHAR8 *ResourceSource,
INAML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112815): https://edk2.groups.io/g/devel/message/112815
Mute This Topic: https://groups.io/mt/103278519/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [Resend PATCH v5 1/4] DynamicTablesPkg: AML Code generation for word I/O ranges

2023-12-21 Thread Sami Mujawar

Hi Abdul,

Thank you for this patch.

These changes look good to me.

Reviewed-by: Sami Mujawar 

Regards,

Sami Mujawar

On 20/12/2023 09:38 am, Abdul Lateef Attar wrote:

From: Abdul Lateef Attar 

Add helper functions to generate AML resource data
for word I/O.

Cc: Pierre Gondois 
Cc: Sami Mujawar 
Signed-off-by: Abdul Lateef Attar 
Reviewed-by: Pierre Gondois 
---
  .../Include/Library/AmlLib/AmlLib.h   | 65 ++
  .../AmlLib/CodeGen/AmlResourceDataCodeGen.c   | 88 +++
  2 files changed, 153 insertions(+)

diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h 
b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
index 71e8539b30..5e340b94ce 100644
--- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
+++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
@@ -2,6 +2,7 @@
AML Lib.
  
Copyright (c) 2019 - 2021, Arm Limited. All rights reserved.

+  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
  
SPDX-License-Identifier: BSD-2-Clause-Patent

  **/
@@ -724,6 +725,70 @@ AmlCodeGenRdWordBusNumber (
OUT   AML_DATA_NODE_HANDLE*NewRdNode  OPTIONAL
);
  
+/** Code generation for the "WordIO ()" ASL function.

+
+  The Resource Data effectively created is a Word Address Space Resource
+  Data. Cf ACPI 6.5:
+   - s6.4.3.5.3 "Word Address Space Descriptor".
+
+  The created resource data node can be:
+   - appended to the list of resource data elements of the NameOpNode.
+ In such case NameOpNode must be defined by a the "Name ()" ASL statement
+ and initially contain a "ResourceTemplate ()".
+   - returned through the NewRdNode parameter.
+
+  @param [in]  IsResourceConsumer   ResourceUsage parameter.
+  @param [in]  IsMinFixed   Minimum address is fixed.
+  @param [in]  IsMaxFixed   Maximum address is fixed.
+  @param [in]  IsPosDecode  Decode parameter
+  @param [in]  IsaRangesPossible values are:
+ 0-Reserved
+ 1-NonISAOnly
+ 2-ISAOnly
+ 3-EntireRange
+  @param [in]  AddressGranularity   Address granularity.
+  @param [in]  AddressMinimum   Minimum address.
+  @param [in]  AddressMaximum   Maximum address.
+  @param [in]  AddressTranslation   Address translation.
+  @param [in]  RangeLength  Range length.
+  @param [in]  ResourceSourceIndex  Resource Source index.
+Not supported. Must be 0.
+  @param [in]  ResourceSource   Resource Source.
+Not supported. Must be NULL.
+  @param [in]  IsDenseTranslation   TranslationDensity parameter.
+  @param [in]  IsTypeStatic TranslationType parameter.
+  @param [in]  NameOpNode   NameOp object node defining a named object.
+If provided, append the new resource data
+node to the list of resource data elements
+of this node.
+  @param [out] NewRdNodeIf provided and success,
+contain the created node.
+
+  @retval EFI_SUCCESS The function completed successfully.
+  @retval EFI_INVALID_PARAMETER   Invalid parameter.
+  @retval EFI_OUT_OF_RESOURCESCould not allocate memory.
+**/
+EFI_STATUS
+EFIAPI
+AmlCodeGenRdWordIo (
+  INBOOLEAN IsResourceConsumer,
+  INBOOLEAN IsMinFixed,
+  INBOOLEAN IsMaxFixed,
+  INBOOLEAN IsPosDecode,
+  INUINT8 IsaRanges,
+  INUINT16 AddressGranularity,
+  INUINT16 AddressMinimum,
+  INUINT16 AddressMaximum,
+  INUINT16 AddressTranslation,
+  INUINT16 RangeLength,
+  INUINT8 ResourceSourceIndex,
+  IN  CONST CHAR8 *ResourceSource,
+  INBOOLEAN IsDenseTranslation,
+  INBOOLEAN IsTypeStatic,
+  INAML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL
+  OUT   AML_DATA_NODE_HANDLE*NewRdNode  OPTIONAL
+  );
+
  /** Code generation for the "QWordIO ()" ASL function.
  
The Resource Data effectively created is a QWord Address Space Resource

diff --git 
a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c 
b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c
index 0bc1c1d119..60fe69ba6d 100644
--- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c
+++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c
@@ -2,6 +2,7 @@
AML Resource Data Code Generation.
  
Copyright (c) 2020 - 2021, Arm Limited. All rights reserved.

+  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
  
SPDX-License-Identifier: BSD-2-Clause-Patent
  
@@ -878,6 +879,93 @@ AmlCodeGenRdWordBusNumber (

 );
  }
  
+/** Code generation for the "WordIO ()" ASL function.

+
+  The Resource Data effectively 

Re: [edk2-devel] [PATCH v4 19/37] UefiCpuPkg: Add MMIO method in CpuIo2Dxe

2023-12-21 Thread Chao Li



Thanks,
Chao
On 2023/12/21 20:31, Ard Biesheuvel wrote:

On Thu, 21 Dec 2023 at 13:11, Chao Li  wrote:

Hi Ard,


Thanks,
Chao
On 2023/12/21 15:31, Ard Biesheuvel wrote:

On Thu, 21 Dec 2023 at 04:48, Chao Li  wrote:

...

Ard,

PcdPciIoTranslationIsEnabled is only use for whether to trigger the Ffio read 
or write, it seem that only x86 or x64 need them, not others.

When I was submitted the patch V2, CpuIo2Dxe was private to LoongArch, just 
like Arm and RISC-V. Gerd recommended finding a better place for 
ArmPciCpuIo2Dxe so that other ARCH can easily use it. And then I found the 
UefiCpuPkg/CpuIo2Dxe might be able to accommodate the MMIO methods, so I merged 
them togeter in this change.

I think it makes sense to have a shared implementation under
UefiCpuPkg or even MdeModulePkg. But merging it with the x86
implementation using function pointers that are dereferenced at
runtime seems unnecessary to me.

So what do you suggest? Write some new functions to handle the MMIO method 
under the CpuIo2Dxe?


A given platform will either be able to use port IO, or it will need
to use MMIO translation. So a driver that can do both based on a PCD
is not very useful, it makes more sense to have two different drivers,
and the platform incorporates the one it can use.
Ok, I get it, I think you are more inclined to move the ArmCpuIo2Dxe to 
a new place and rename it, maybe: CpuMmio2Dxe, while some platforms 
choose the different CpuIo2 drvier by themselves when building FW, right?








-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112813): https://edk2.groups.io/g/devel/message/112813
Mute This Topic: https://groups.io/mt/103261693/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v4 19/37] UefiCpuPkg: Add MMIO method in CpuIo2Dxe

2023-12-21 Thread Ard Biesheuvel
On Thu, 21 Dec 2023 at 13:11, Chao Li  wrote:
>
> Hi Ard,
>
>
> Thanks,
> Chao
> On 2023/12/21 15:31, Ard Biesheuvel wrote:
>
> On Thu, 21 Dec 2023 at 04:48, Chao Li  wrote:
>
> ...
>
> Ard,
>
> PcdPciIoTranslationIsEnabled is only use for whether to trigger the Ffio read 
> or write, it seem that only x86 or x64 need them, not others.
>
> When I was submitted the patch V2, CpuIo2Dxe was private to LoongArch, just 
> like Arm and RISC-V. Gerd recommended finding a better place for 
> ArmPciCpuIo2Dxe so that other ARCH can easily use it. And then I found the 
> UefiCpuPkg/CpuIo2Dxe might be able to accommodate the MMIO methods, so I 
> merged them togeter in this change.
>
> I think it makes sense to have a shared implementation under
> UefiCpuPkg or even MdeModulePkg. But merging it with the x86
> implementation using function pointers that are dereferenced at
> runtime seems unnecessary to me.
>
> So what do you suggest? Write some new functions to handle the MMIO method 
> under the CpuIo2Dxe?
>

A given platform will either be able to use port IO, or it will need
to use MMIO translation. So a driver that can do both based on a PCD
is not very useful, it makes more sense to have two different drivers,
and the platform incorporates the one it can use.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112812): https://edk2.groups.io/g/devel/message/112812
Mute This Topic: https://groups.io/mt/103261693/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v4 19/37] UefiCpuPkg: Add MMIO method in CpuIo2Dxe

2023-12-21 Thread Chao Li

Hi Ard,


Thanks,
Chao
On 2023/12/21 15:31, Ard Biesheuvel wrote:

On Thu, 21 Dec 2023 at 04:48, Chao Li  wrote:
...

Ard,

PcdPciIoTranslationIsEnabled is only use for whether to trigger the Ffio read 
or write, it seem that only x86 or x64 need them, not others.

When I was submitted the patch V2, CpuIo2Dxe was private to LoongArch, just 
like Arm and RISC-V. Gerd recommended finding a better place for 
ArmPciCpuIo2Dxe so that other ARCH can easily use it. And then I found the 
UefiCpuPkg/CpuIo2Dxe might be able to accommodate the MMIO methods, so I merged 
them togeter in this change.


I think it makes sense to have a shared implementation under
UefiCpuPkg or even MdeModulePkg. But merging it with the x86
implementation using function pointers that are dereferenced at
runtime seems unnecessary to me.
So what do you suggest? Write some new functions to handle the MMIO 
method under the CpuIo2Dxe?


My preference would be to put this into MdeModulePkg, but Ray may have
a different view.

Let's wait for Ray together. :)


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112811): https://edk2.groups.io/g/devel/message/112811
Mute This Topic: https://groups.io/mt/103261693/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: 回复: 回复: [edk2-devel] [PATCH v4 09/37] MdePkg: Add a new library named PeiServicesTablePointerLibKs0

2023-12-21 Thread Chao Li

Hi Liming,

Sorry, I forget to CC you when I submitted the patch that modified the 
DebugSupport.h, I originally planned to CC you when I submitted V5.


My answer:


Thanks,
Chao
On 2023/12/21 15:16, gaoliming wrote:


Chao:

 For the changes in MdePkg, I have two comments here.

1)DebugSupport.h definition is from UEFI spec. Current definitions 
match the latest spec UEFI2.10. And, current definitions follow the 
same style to other archs.


I have submit the ECR to 
USWG(https://mantis.uefi.org/mantis/view.php?id=2431), and the ECR was 
marked "Added to homework pile" at 12/06/2023 USWG meeting, here is the 
meeting minutes link: https://members.uefi.org/wg/uswg/mail/thread/9948.


The USWG meeting saied may be V2.11 will release 2024, I'm not sure, so 
the ECR is code first.


Can I submit the code and merge the code first, and wait for the V2.11 
to be release? If we wait for the V2.11 to be release first, I guss we 
will probably wait a long time. In fact, RISC-V also modified this file 
when submitting the virtual-machine code, and the code does not match to 
the V2.10...


So, please help to merge first, please...

2)CpuLib.h. The patch removes #if defined (MDE_CPU_IA32) || defined 
(MDE_CPU_X64), then these APIs are exposed for all archs, but ARM and 
RISCV don’t support them. So, I suggest to update it as below.


#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)

è

#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64) || defined 
(MDE_CPU_LOONGARCH64)



Agree, I will fix it in V5.


Thanks

Liming

*发件人:*Chao Li 
*发送时间:*2023年12月20日9:21
*收件人:*gaoliming ; devel@edk2.groups.io; 
'Michael D Kinney' 
*抄送:*'Zhiguang Liu' ; 'Laszlo Ersek' 

*主题:*Re: 回复: [edk2-devel] [PATCH v4 09/37] MdePkg: Add a new library 
named PeiServicesTablePointerLibKs0


Hi Liming,

Yes, the code branch is in my private repo, here is the link: 
https://github.com/kilaterlee/edk2/tree/push1102


Thanks,
Chao

On 2023/12/19 21:07, gaoliming wrote:

Chao:

 Is there a branch or pull request for this patch set? I would
like to check how this new library instance be used.

Thanks

Liming

*发件人:*devel@edk2.groups.io 
 *代表 *Chao Li
*发送时间:*2023年12月19日 21:01
*收件人:*devel@edk2.groups.io; Michael D Kinney
 ;
Liming Gao 

*抄送:*Zhiguang Liu 
; Laszlo Ersek 

*主题:*Re: [edk2-devel] [PATCH v4 09/37] MdePkg: Add a new library
named PeiServicesTablePointerLibKs0

Hi Mike and Liming,

Can you please review this patch? Thank you!

Thanks,
Chao

On 2023/12/12 21:11, Chao Li wrote:

Adding PeiServicesTablePointerLibKs0 for LoongArch64, which
provides

setting and getting the PEI service table pointer through the
CSR KS0

register.

The idea of this library is derived from

ArmPkg/Library/PeiServicesTablePointerLib/

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4584

Cc: Michael D Kinney 


Cc: Liming Gao 


Cc: Zhiguang Liu 


Cc: Laszlo Ersek  

Signed-off-by: Chao Li 


---

.../Library/PeiServicesTablePointerLib.h  |  9 +-

.../PeiServicesTablePointer.c | 87
+++

.../PeiServicesTablePointerLibKs0.inf | 37 

.../PeiServicesTablePointerLibKs0.uni | 20 +

MdePkg/MdePkg.dsc |  3 +

5 files changed, 152 insertions(+), 4 deletions(-)

create mode 100644
MdePkg/Library/PeiServicesTablePointerLibKs0/PeiServicesTablePointer.c

create mode 100644

MdePkg/Library/PeiServicesTablePointerLibKs0/PeiServicesTablePointerLibKs0.inf

create mode 100644

MdePkg/Library/PeiServicesTablePointerLibKs0/PeiServicesTablePointerLibKs0.uni

diff --git
a/MdePkg/Include/Library/PeiServicesTablePointerLib.h
b/MdePkg/Include/Library/PeiServicesTablePointerLib.h

index 61635eff00..f85c38363c 100644

--- a/MdePkg/Include/Library/PeiServicesTablePointerLib.h

+++ b/MdePkg/Include/Library/PeiServicesTablePointerLib.h

@@ -52,10 +52,11 @@ SetPeiServicesTablePointer (

   immediately preceding the Interrupt Descriptor Table (IDT)
in memory.

   For X64 CPUs, the PEI Services Table pointer is stored in
the 8 bytes

   immediately preceding the Interrupt Descriptor Table (IDT)
in memory.

-  For Itanium and ARM CPUs, a the PEI Services Table Pointer
is stored in

-  a dedicated CPU register.  This means that there is no

Re: [edk2-devel] [RFC PATCH 1/1] ArmPkg,MdePkg: move ArmLib.h to MdePkg

2023-12-21 Thread PierreGondois

Hello Leif,

I think the following files:
- ArmPkg/Include/Chipset/AArch64.h
- ArmPkg/Include/Chipset/AArch64Mmu.h
- ArmPkg/Include/Chipset/ArmV7.h
- ArmPkg/Include/Chipset/ArmV7Mmu.h
also need to be moved to the MdePkg. Otherwise the MdePkg
would depend on the ArmPkg, cf. ArmLib.h:

#ifdef MDE_CPU_ARM
  #include 
#elif defined (MDE_CPU_AARCH64)
  #include 

Depending on where these files are placed in the MdePkg, this
might imply some renaming to include them. Meaning that all
  #include 
might need to be renamed
  #include <[New path]/AArch64.h>
but it should be ok.

A ArmLibNull.inf library might also need to be created. If the
OpensslLibFullAccel.inf module will depend on the ArmLib library,
a Null implementation will be necessary for non-Arm architectures.

Otherwise I could apply and run the CryptoPkg/Arm native instructions
patchset on top of this patch.

---

As a side note, it also seems that:
- ArmPkg/Include/Chipset/ArmCortexA5x.h
  isn't used anymore in edk2/edk2-platorms
- ArmPkg/Include/Chipset/ArmCortexA9.h
  is barely used in edk2-platforms.
Maybe the files should have been removed/simplified as part of
- cffa7925a293 ("ArmPkg: remove ArmCpuLib header and implementations")
- a913ad02479d ("ArmPlatformPkg: remove ArmVExpressPkg")

Regards,
Pierre

On 11/21/23 17:42, Leif Lindholm wrote:

Related to https://bugzilla.tianocore.org/show_bug.cgi?id=4121, but not
resolving it. (Nearly?) all of ArmPkg describes industry standard
behaviour, and hence according to general rules, ought to live in MdePkg.

Addressing this will however be a substantial task.
Take a first step by moving the ArmLib interface definition to MdePkg,
as discussed in
https://edk2.groups.io/g/devel/topic/patch_v5_2_6/102725178

Cc: Pierre Gondois 
Cc: Jiewen Yao 
Cc: Ard Biesheuvel 
Cc: Liming Gao 
Cc: Michael D Kinney 
Cc: Sami Mujawar 
Cc: Zhiguang Liu 
Signed-off-by: Leif Lindholm 
---

This should have no functional differences (and the set of
platforms I have test built didn't find any problems).
This may result in some modules depending on ArmPkg only
for ArmLib now being able to drop ArmPkg dependency.

  ArmPkg/ArmPkg.dec   | 4 
  MdePkg/MdePkg.dec   | 5 +
  {ArmPkg => MdePkg}/Include/Library/ArmLib.h | 0
  Maintainers.txt | 6 ++
  4 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/ArmPkg/ArmPkg.dec b/ArmPkg/ArmPkg.dec
index 7fe2b9bca43b..4ce59f3e1fbd 100644
--- a/ArmPkg/ArmPkg.dec
+++ b/ArmPkg/ArmPkg.dec
@@ -50,10 +50,6 @@ [LibraryClasses.common]
#
ArmHvcLib|Include/Library/ArmHvcLib.h
  
-  ##  @libraryclass  Provides an interface to Arm registers.

-  #
-  ArmLib|Include/Library/ArmLib.h
-
##  @libraryclass  Provides a Mmu interface.
#
ArmMmuLib|Include/Library/ArmMmuLib.h
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index ac54338089e8..78e18ee444cd 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -339,6 +339,11 @@ [LibraryClasses.RISCV64]
##  @libraryclass  Provides function to make ecalls to SBI
BaseRiscVSbiLib|Include/Library/BaseRiscVSbiLib.h
  
+[LibraryClasses.ARM, LibraryClasses.AARCH64]

+  ##  @libraryclass  Provides an interface to Arm registers.
+  #
+  ArmLib|Include/Library/ArmLib.h
+
  [Guids]
#
# GUID defined in UEFI2.1/UEFI2.0/EFI1.1
diff --git a/ArmPkg/Include/Library/ArmLib.h b/MdePkg/Include/Library/ArmLib.h
similarity index 100%
rename from ArmPkg/Include/Library/ArmLib.h
rename to MdePkg/Include/Library/ArmLib.h
diff --git a/Maintainers.txt b/Maintainers.txt
index 7c0b4cb58cfd..0315fa23dfce 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -450,6 +450,12 @@ M: Abner Chang  [changab]
  R: Abdul Lateef Attar  [abdattar]
  R: Nickle Wang  [nicklela]
  
+MdePkg: ARM/AARCH64 standard interfaces

+F: MdePkg/Include/Library/ArmLib.h
+M: Leif Lindholm  [leiflindholm]
+M: Ard Biesheuvel  [ardbiesheuvel]
+R: Sami Mujawar  [samimujawar]
+
  NetworkPkg
  F: NetworkPkg/
  W: https://github.com/tianocore/tianocore.github.io/wiki/NetworkPkg



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112809): https://edk2.groups.io/g/devel/message/112809
Mute This Topic: https://groups.io/mt/102731845/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel][edk2-platforms][PATCH v1] MinPlatformPkg: Support SecFspWrapperPlatformSecLib in X64

2023-12-21 Thread Kuo, Ted
Thanks Nate for the feedback. I've sent out patch v2 according to your 
comments. Can you please review again?

Thanks,
Ted

-Original Message-
From: Desimone, Nathaniel L  
Sent: Thursday, December 21, 2023 8:13 AM
To: Kuo, Ted ; devel@edk2.groups.io
Cc: Chaganty, Rangasai V ; Chiu, Chasel 
; Dong, Eric ; S, Ashraf Ali 
; Duggapu, Chinni B ; Gao, 
Liming 
Subject: RE: [edk2-devel][edk2-platforms][PATCH v1] MinPlatformPkg: Support 
SecFspWrapperPlatformSecLib in X64

Hi Ted,

Looking at this code, the X64 version will only work if 
PcdFspWrapperResetVectorInFsp == TRUE. Moreover, the IA32 version will only 
work if PcdFspWrapperResetVectorInFsp == FALSE. So... what is the point of 
having a PCD if the PCD must always be set to one value or the other? Please 
choose one of these options:

Option 1: Make the PCD work correctly for all the 4 cases:

- IA32 + Bootloader Reset Vector
- IA32 + FSP Reset Vector
- X64 + Bootloader Reset Vector
- X64 + FSP Reset Vector

Option 2: Make a separate instance of PlatformSecLib for the case of FSP-O 
providing the reset vector.

Additional feedback is below inline.

Thanks,
Nate

> -Original Message-
> From: Kuo, Ted 
> Sent: Sunday, December 17, 2023 8:03 PM
> To: devel@edk2.groups.io
> Cc: Chaganty, Rangasai V ; Chiu, Chasel 
> ; Desimone, Nathaniel L 
> ; Dong, Eric ; S, 
> Ashraf Ali ; Duggapu, Chinni B 
> ; Gao, Liming 
> Subject: [edk2-devel][edk2-platforms][PATCH v1] MinPlatformPkg: 
> Support SecFspWrapperPlatformSecLib in X64
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=4623
> 1.Added PeiCoreEntry.nasm, SecEntry.nasm and Stack.nasm for X64.
> 2.Made changes in common file to support both IA32 and X64.
> 3.Added the PCDs below for FSP-T UPD revsions and X64 feature.
>  - PcdFspWrapperResetVectorInFsp
>  - PcdFspWrapperBfvforResetVectorInFsp
>  - PcdFsptUpdHeaderRevision
>  - PcdFsptArchUpdHeaderRevision
> 
> Cc: Sai Chaganty 
> Cc: Chasel Chiu 
> Cc: Nate DeSimone 
> Cc: Eric Dong 
> Cc: Ashraf Ali S 
> Cc: Chinni B Duggapu 
> Cc: Liming Gao 
> Signed-off-by: Ted Kuo 
> ---
>  .../SecFspWrapperPlatformSecLib/FsptCoreUpd.h |  25 +-
>  .../Ia32/SecEntry.nasm|   4 +-
>  .../SecFspWrapperPlatformSecLib.inf   |  12 +-
>  .../SecGetPerformance.c   |  11 +-
>  .../SecPlatformInformation.c  |   8 +-
>  .../SecRamInitData.c  |  56 -
>  .../X64/PeiCoreEntry.nasm | 224 ++
>  .../X64/SecEntry.nasm | 214 +
>  .../X64/Stack.nasm|  72 ++
>  .../Ia32 => Include}/Fsp.h|   4 +-
>  .../Intel/MinPlatformPkg/MinPlatformPkg.dec   |  21 ++
>  11 files changed, 629 insertions(+), 22 deletions(-)  create mode 
> 100644 
> Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatform
> SecLib/X64/PeiCoreEntry.nasm  create mode 100644 
> Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatform
> SecLib/X64/SecEntry.nasm  create mode 100644 
> Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatform
> SecLib/X64/Stack.nasm  rename 
> Platform/Intel/MinPlatformPkg/{FspWrapper/Library/SecFspWrapperPlatfor
> mSecLib/Ia32 => Include}/Fsp.h (86%)
> 
> diff --git 
> a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatfo
> rmSecLib/FsptCoreUpd.h 
> b/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatfo
> rmSecLib/FsptCoreUpd.h
> index 7c0f605b92..7c4ddc09a8 100644
> --- 
> a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatfo
> rmSecLib/FsptCoreUpd.h
> +++ b/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPl
> +++ atformSecLib/FsptCoreUpd.h
> @@ -1,6 +1,6 @@
>  /** @file
>  
> -Copyright (c) 2017, Intel Corporation. All rights reserved.
> +Copyright (c) 2017 - 2023, Intel Corporation. All rights 
> +reserved.
>  SPDX-License-Identifier: BSD-2-Clause-Patent
>  
>  **/
> @@ -10,6 +10,28 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>  
>  #pragma pack(1)
>  
> +#if defined (MDE_CPU_X64)
> +/** Fsp T Core UPD
> +**/
> +typedef struct {
> +
> +/** Offset 0x0040
> +**/
> +  EFI_PHYSICAL_ADDRESSMicrocodeRegionBase;
> +
> +/** Offset 0x0048
> +**/
> +  UINT64  MicrocodeRegionSize;
> +
> +/** Offset 0x0050
> +**/
> +  EFI_PHYSICAL_ADDRESSCodeRegionBase;
> +
> +/** Offset 0x0058
> +**/
> +  UINT64  CodeRegionSize;
> +} FSPT_CORE_UPD;
> +#else
>  /** Fsp T Core UPD
>  **/
>  typedef struct {
> @@ -34,6 +56,7 @@ typedef struct {
>  **/
>UINT8   Reserved[16];
>  } FSPT_CORE_UPD;
> +#endif
>  
>  #pragma pack()
>  
> diff --git 
> a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatfo
> rmSecLib/Ia32/SecEntry.nasm 
> b/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatfo
> rmSecLib/Ia32/SecEntry.nasm
> index 7f6d771e41..de44066a20 100644
> --- 
> 

[edk2-devel][edk2-platforms][PATCH v2] MinPlatformPkg: Support SecFspWrapperPlatformSecLib in X64

2023-12-21 Thread Kuo, Ted
https://bugzilla.tianocore.org/show_bug.cgi?id=4623
1.Added PeiCoreEntry.nasm, SecEntry.nasm and Stack.nasm for X64.
2.Made changes in common file to support both IA32 and X64.
3.Added the PCDs below for FSP-T UPD revisions and reset vector in FSP.
 - PcdFspWrapperBfvforResetVectorInFsp
 - PcdFsptUpdHeaderRevision
 - PcdFsptArchUpdRevision

Cc: Sai Chaganty 
Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Eric Dong 
Cc: Ashraf Ali S 
Cc: Chinni B Duggapu 
Cc: Liming Gao 
Signed-off-by: Ted Kuo 
---
 .../SecFspWrapperPlatformSecLib/FsptCoreUpd.h |  25 +-
 .../Ia32/SecEntry.nasm|   4 +-
 .../SecFspWrapperPlatformSecLib.inf   |   9 +-
 .../SecFspWrapperPlatformSecLibFspO.inf   | 101 
 .../SecGetPerformance.c   |  11 +-
 .../SecPlatformInformation.c  |   8 +-
 .../SecRamInitData.c  |  73 --
 .../X64/PeiCoreEntry.nasm | 218 ++
 .../X64/SecEntry.nasm |  71 ++
 .../X64/Stack.nasm|  72 ++
 .../Ia32 => Include}/Fsp.h|   4 +-
 .../Intel/MinPlatformPkg/MinPlatformPkg.dec   |  15 ++
 12 files changed, 579 insertions(+), 32 deletions(-)
 create mode 100644 
Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/SecFspWrapperPlatformSecLibFspO.inf
 create mode 100644 
Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/X64/PeiCoreEntry.nasm
 create mode 100644 
Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/X64/SecEntry.nasm
 create mode 100644 
Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/X64/Stack.nasm
 rename 
Platform/Intel/MinPlatformPkg/{FspWrapper/Library/SecFspWrapperPlatformSecLib/Ia32
 => Include}/Fsp.h (86%)

diff --git 
a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/FsptCoreUpd.h
 
b/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/FsptCoreUpd.h
index 7c0f605b92..7c4ddc09a8 100644
--- 
a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/FsptCoreUpd.h
+++ 
b/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/FsptCoreUpd.h
@@ -1,6 +1,6 @@
 /** @file
 
-Copyright (c) 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2023, Intel Corporation. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -10,6 +10,28 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 #pragma pack(1)
 
+#if defined (MDE_CPU_X64)
+/** Fsp T Core UPD
+**/
+typedef struct {
+
+/** Offset 0x0040
+**/
+  EFI_PHYSICAL_ADDRESSMicrocodeRegionBase;
+
+/** Offset 0x0048
+**/
+  UINT64  MicrocodeRegionSize;
+
+/** Offset 0x0050
+**/
+  EFI_PHYSICAL_ADDRESSCodeRegionBase;
+
+/** Offset 0x0058
+**/
+  UINT64  CodeRegionSize;
+} FSPT_CORE_UPD;
+#else
 /** Fsp T Core UPD
 **/
 typedef struct {
@@ -34,6 +56,7 @@ typedef struct {
 **/
   UINT8   Reserved[16];
 } FSPT_CORE_UPD;
+#endif
 
 #pragma pack()
 
diff --git 
a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/Ia32/SecEntry.nasm
 
b/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/Ia32/SecEntry.nasm
index 7f6d771e41..de44066a20 100644
--- 
a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/Ia32/SecEntry.nasm
+++ 
b/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/Ia32/SecEntry.nasm
@@ -1,6 +1,6 @@
 ;--
 ;
-; Copyright (c) 2019, Intel Corporation. All rights reserved.
+; Copyright (c) 2019 - 2023, Intel Corporation. All rights reserved.
 ; SPDX-License-Identifier: BSD-2-Clause-Patent
 ; Module Name:
 ;
@@ -13,7 +13,7 @@
 ;
 ;--
 
-#include "Fsp.h"
+#include 
 
 SECTION .text
 
diff --git 
a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/SecFspWrapperPlatformSecLib.inf
 
b/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/SecFspWrapperPlatformSecLib.inf
index 2e0d67eae4..2ff931bfe8 100644
--- 
a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/SecFspWrapperPlatformSecLib.inf
+++ 
b/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/SecFspWrapperPlatformSecLib.inf
@@ -1,7 +1,7 @@
 ## @file
-#  Provide FSP wrapper platform sec related function.
+#  Provide FSP wrapper platform sec related function for IA32.
 #
-#  Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
+#  Copyright (c) 2017 - 2023, Intel Corporation. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -25,7 +25,7 @@
 #
 # The following information is for reference only and not required 

Re: [edk2-devel] [PATCH v2] BaseTools/GenFw: Correct offset when relocating an ADR

2023-12-21 Thread Ard Biesheuvel
On Wed, 20 Dec 2023 at 22:26, Rebecca Cran  wrote:
>
> Reviewed-by: Rebecca Cran 
>

Merged as #5183

Thanks all

>
> On 12/20/2023 12:31 PM, Jake Garver wrote:
> > In the R_AARCH64_ADR_GOT_PAGE case on AARCH64, we may encounter an ADR
> > instead of an ADRP when the toolchain is working around Cortex-A53
> > erratum #843419.  If that's the case, be sure to calculate the offset
> > appropriately.
> >
> > This resolves an issue experienced when building a StandaloneMm image
> > with stack protection enabled on GCC compiled with
> > "--enable-fix-cortex-a53-843419".  This scenario sometimes generates an
> > ADR with a R_AARCH64_ADR_GOT_PAGE relocation.
> >
> > In this scenario, the following code is being generated by the
> > toolchain:
> >
> >  # Load to set the stack canary
> >  2ffc:10028020adr x0, 8000 
> >  3008:f940d400ldr x0, [x0, #424]
> >
> >  # Load to check the stack canary
> >  30cc:b020adrpx0, 8000 
> >  30d0:f940d400ldr x0, [x0, #424]
> >
> > GenFw rewrote that to:
> >
> >  # Load to set the stack canary
> >  2ffc:1480adr x0, 0x308c
> >  3008:912ec000add x0, x0, #0xbb0
> >
> >  # Load to check the stack canary
> >  30cc:f460adrpx0, 0x92000
> >  30d0:912ec000add x0, x0, #0xbb0
> >
> > Note that we're now setting the stack canary from the wrong address,
> > resulting in an erroneous stack fault.
> >
> > After this fix, the offset will be calculated correctly for an ADR and
> > the stack canary is set correctly.
> >
> > Signed-off-by: Jake Garver 
> > ---
> >
> > Notes:
> >v2: Implement approach proposed by Ard Biesheuvel.
> >  - title changed to: Correct offset when relocating an ADR
> >v1: Original title: Change opcode when converting ADR to ADRP
> >
> >   BaseTools/Source/C/GenFw/Elf64Convert.c | 22 +-
> >   1 file changed, 21 insertions(+), 1 deletion(-)
> >
> > diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c 
> > b/BaseTools/Source/C/GenFw/Elf64Convert.c
> > index 9911db65af..9d04fc612e 100644
> > --- a/BaseTools/Source/C/GenFw/Elf64Convert.c
> > +++ b/BaseTools/Source/C/GenFw/Elf64Convert.c
> > @@ -1562,7 +1562,27 @@ WriteSections64 (
> >   // subsequent LDR instruction (covered by a 
> > R_AARCH64_LD64_GOT_LO12_NC
> >   // relocation) into an ADD instruction - this is handled 
> > above.
> >   //
> > -Offset = (Sym->st_value - (Rel->r_offset & ~0xfff)) >> 12;
> > +// In order to handle Cortex-A53 erratum #843419, the GCC 
> > toolchain
> > +// may convert an ADRP instruction at the end of a page (0xffc
> > +// offset) into an ADR instruction. If so, be sure to 
> > calculate the
> > +// offset for an ADR instead of ADRP.
> > +//
> > +if ((*(UINT32 *)Targ & BIT31) == 0) {
> > +  //
> > +  // Calculate the offset for an ADR.
> > +  //
> > +  Offset = (Sym->st_value & ~0xfff) - Rel->r_offset;
> > +  if (Offset < -0x10 || Offset > 0xf) {
> > +Error (NULL, 0, 3000, "Invalid", "WriteSections64(): %s  
> > due to its size (> 1 MB), unable to relocate ADR.",
> > +  mInImageName);
> > +break;
> > +  }
> > +} else {
> > +  //
> > +  // Calculate the offset for an ADRP.
> > +  //
> > +  Offset = (Sym->st_value - (Rel->r_offset & ~0xfff)) >> 12;
> > +}
> >
> >   *(UINT32 *)Targ &= 0x901f;
> >   *(UINT32 *)Targ |= ((Offset & 0x1c) << (5 - 2)) | 
> > ((Offset & 0x3) << 29);
>
>
>
>
> 
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112806): https://edk2.groups.io/g/devel/message/112806
Mute This Topic: https://groups.io/mt/103287393/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2 1/1] BaseTools/Scripts/PatchCheck.py: Check for Change-id

2023-12-21 Thread PierreGondois
Code review tools like gerrit might use a 'Change-id' tag to track
the evolution of patches. This tag should be removed before
submitting a patch to the mailing-list.
It has been observed that contributors sometimes forget to remove
this tag. Add a check in PatchCheck.py to automate this.

Also add a '--ignore-change-id' command line parameter to ignore
the above check.

Signed-off-by: Pierre Gondois 
Acked-by: Pedro Falcato 
Reviewed-by: Yuwei Chen 
Reviewed-by: Rebecca Cran 
---

Notes:
v2:
- Fix capitalization in helper: Change-id -> Change-Id

 BaseTools/Scripts/PatchCheck.py | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py
index 7f372d40b570..1675dcbd7321 100755
--- a/BaseTools/Scripts/PatchCheck.py
+++ b/BaseTools/Scripts/PatchCheck.py
@@ -3,7 +3,7 @@
 #
 #  Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.
 #  Copyright (C) 2020, Red Hat, Inc.
-#  Copyright (c) 2020, ARM Ltd. All rights reserved.
+#  Copyright (c) 2020 - 2023, Arm Limited. All rights reserved.
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -26,6 +26,9 @@ class Verbose:
 SILENT, ONELINE, NORMAL = range(3)
 level = NORMAL
 
+class PatchCheckConf:
+ignore_change_id = False
+
 class EmailAddressCheck:
 """Checks an email address."""
 
@@ -111,6 +114,8 @@ class CommitMessageCheck:
 self.check_signed_off_by()
 self.check_misc_signatures()
 self.check_overall_format()
+if not PatchCheckConf.ignore_change_id:
+self.check_change_id_format()
 self.report_message_result()
 
 url = 
'https://github.com/tianocore/tianocore.github.io/wiki/Commit-Message-Format'
@@ -307,6 +312,12 @@ class CommitMessageCheck:
 break
 last_sig_line = line.strip()
 
+def check_change_id_format(self):
+cid='Change-Id:'
+if self.msg.find(cid) != -1:
+self.error('\"%s\" found in commit message:' % cid)
+return
+
 (START, PRE_PATCH, PATCH) = range(3)
 
 class GitDiffCheck:
@@ -780,11 +791,16 @@ class PatchCheckApp:
 group.add_argument("--silent",
action="store_true",
help="Print nothing")
+group.add_argument("--ignore-change-id",
+   action="store_true",
+   help="Ignore the presence of 'Change-Id:' tags in 
commit message")
 self.args = parser.parse_args()
 if self.args.oneline:
 Verbose.level = Verbose.ONELINE
 if self.args.silent:
 Verbose.level = Verbose.SILENT
+if self.args.ignore_change_id:
+PatchCheckConf.ignore_change_id = True
 
 if __name__ == "__main__":
 sys.exit(PatchCheckApp().retval)
-- 
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112805): https://edk2.groups.io/g/devel/message/112805
Mute This Topic: https://groups.io/mt/103297083/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-