Re: [edk2-devel] ArmVirtPkg: non-executable EFI_LOADER_DATA breaks GRUB on Ubuntu 22.04

2023-07-10 Thread Gerd Hoffmann
On Mon, Jul 10, 2023 at 04:58:15PM +0100, Pedro Falcato wrote:
> On Mon, Jul 10, 2023 at 2:28 PM  wrote:
> >
> > I have an existing install of Ubuntu 22.04 on a QEMU virtual machine which 
> > I've decided to update the UEFI firmware. After doing so, GRUB no longer 
> > boots ("Synchronous Exception" message seen). After a git bisect session, I 
> > found the problematic 2997ae38739756ecba9b0de19e86032ebc689ef9. The comment 
> > says GRUB should have been fixed in 2017, but for one reason or another, my 
> > VM which was built in 2022 still had the issue. Regardless, I don't think 
> > it's a good idea to break GRUB, even if it's fixed in 2017. In the very 
> > least, a better error message would be preferable to crashing with an 
> > "Synchronous Exception." Googling this error message shows that other 
> > people may be hitting this issue as well but the vague error symptom means 
> > its impossible to know if it's the same issue or not.
> 
> +CC Some of the folks involved in the original discussion
> 
> In the original thread, people discussed some alternative behavior to
> just crashing on a NX fault. Is this still an alternative?

The idea is: Improve page fault handler to (a) print a big'n'fat
warning, and (b) loosening up memory permissions for the faulting
page address.

No patch for that emerged (yet?).

> I'm kind of thinking this should be addressed by distros anyway
> How is $CURRENT_YEAR Ubuntu still shipping bad GRUBs? I know the
> situation around GRUB and distro patching is complicated but...
> Do we have any idea of how many distros/GRUBs are affected by this?

Too many :(

> Personally, I would like to avoid loosening up memory permissions.

Well, you can't have both.  You have to pick between strict nx handling
and grub bug compatibility ...

take care,
  Gerd



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




Re: [edk2-devel] [PATCH] UefiPayloadPkg: Integrate UiApp and BootManagerMenuApp into MultiFv

2023-07-10 Thread Lu, James
Reviewed-by: James Lu 


Thanks,
James

-Original Message-
From: Lin, MarsX  
Sent: Monday, July 10, 2023 5:02 PM
To: devel@edk2.groups.io
Cc: Lin, MarsX ; Dong, Guo ; Ni, Ray 
; Rhodes, Sean ; Lu, James 
; Guo, Gua 
Subject: [PATCH] UefiPayloadPkg: Integrate UiApp and BootManagerMenuApp into 
MultiFv

From: MarsX Lin 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4347

To put UiApp.inf and BootManagerMenuApp.inf to proper FV(BDSFV)

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 

Signed-off-by: MarsX Lin 
---
 .../PlatformBootManager.c | 55 ---
 .../PlatformBootManagerLib.inf|  4 --
 UefiPayloadPkg/UefiPayloadEntry/PrintHob.c| 25 +
 .../UniversalPayloadEntry.inf |  1 -
 UefiPayloadPkg/UefiPayloadPkg.dec |  2 -
 UefiPayloadPkg/UefiPayloadPkg.dsc |  8 +--
 UefiPayloadPkg/UefiPayloadPkg.fdf |  9 ++-
 7 files changed, 11 insertions(+), 93 deletions(-)

diff --git 
a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c 
b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
index 4a0219624d..a4a49da0e9 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
@@ -9,8 +9,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 

 #include "PlatformBootManager.h"

 #include "PlatformConsole.h"

-#include 

-#include 

 #include 

 

 /**

@@ -364,56 +362,3 @@ PlatformBootManagerUnableToBoot (
 {

   return;

 }

-

-/**

-  Get/update PcdBootManagerMenuFile from GUID HOB which will be assigned in 
bootloader.

-

-  @param  ImageHandle   The firmware allocated handle for the EFI image.

-  @param  SystemTable   A pointer to the EFI System Table.

-

-  @retval EFI_SUCCESS   The entry point is executed successfully.

-  @retval other Some error occurs.

-

-**/

-EFI_STATUS

-EFIAPI

-PlatformBootManagerLibConstructor (

-  IN EFI_HANDLEImageHandle,

-  IN EFI_SYSTEM_TABLE  *SystemTable

-  )

-{

-  EFI_STATUS   Status;

-  UINTNSize;

-  VOID *GuidHob;

-  UNIVERSAL_PAYLOAD_GENERIC_HEADER *GenericHeader;

-  UNIVERSAL_PAYLOAD_BOOT_MANAGER_MENU  *BootManagerMenuFile;

-

-  GuidHob = GetFirstGuidHob (&gEdkiiBootManagerMenuFileGuid);

-

-  if (GuidHob == NULL) {

-//

-// If the HOB is not create, the default value of PcdBootManagerMenuFile 
will be used.

-//

-return EFI_SUCCESS;

-  }

-

-  GenericHeader = (UNIVERSAL_PAYLOAD_GENERIC_HEADER *)GET_GUID_HOB_DATA 
(GuidHob);

-  if ((sizeof (UNIVERSAL_PAYLOAD_GENERIC_HEADER) > GET_GUID_HOB_DATA_SIZE 
(GuidHob)) || (GenericHeader->Length > GET_GUID_HOB_DATA_SIZE (GuidHob))) {

-return EFI_NOT_FOUND;

-  }

-

-  if (GenericHeader->Revision == UNIVERSAL_PAYLOAD_BOOT_MANAGER_MENU_REVISION) 
{

-BootManagerMenuFile = (UNIVERSAL_PAYLOAD_BOOT_MANAGER_MENU 
*)GET_GUID_HOB_DATA (GuidHob);

-if (BootManagerMenuFile->Header.Length < 
UNIVERSAL_PAYLOAD_SIZEOF_THROUGH_FIELD (UNIVERSAL_PAYLOAD_BOOT_MANAGER_MENU, 
FileName)) {

-  return EFI_NOT_FOUND;

-}

-

-Size   = sizeof (BootManagerMenuFile->FileName);

-Status = PcdSetPtrS (PcdBootManagerMenuFile, &Size, 
&BootManagerMenuFile->FileName);

-ASSERT_EFI_ERROR (Status);

-  } else {

-return EFI_NOT_FOUND;

-  }

-

-  return EFI_SUCCESS;

-}

diff --git 
a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf 
b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index a3951b7a7e..ff92c95227 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -13,7 +13,6 @@
   MODULE_TYPE= DXE_DRIVER

   VERSION_STRING = 1.0

   LIBRARY_CLASS  = PlatformBootManagerLib|DXE_DRIVER

-  CONSTRUCTOR= PlatformBootManagerLibConstructor

 

 #

 # The following information is for reference only and not required by the 
build tools.

@@ -48,11 +47,9 @@
   HiiLib

   PrintLib

   PlatformHookLib

-  HobLib

 

 [Guids]

   gEfiEndOfDxeEventGroupGuid

-  gEdkiiBootManagerMenuFileGuid

   gUefiShellFileGuid

 

 [Protocols]

@@ -75,5 +72,4 @@
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits

   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity

   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits

-  gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile

   gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape

diff --git a/UefiPayloadPkg/UefiPayloadEntry/PrintHob.c 
b/UefiPayloadPkg/UefiPayloadEntry/PrintHob.c
index e959be5d95..3b2b7788d4 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/PrintHob.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/PrintHob.c
@@ -10,7 +10,6 @@
 #include 

 #include 

 #include 

-#

Re: [edk2-devel] [edk2-platforms][PATCH v1 1/1] ManageabilityPkg: Ipmi Get/Set Boot Options

2023-07-10 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

Thank you Brit for the contribution! Let's wait for 1-2 days to see if there is 
any other comments for this change.

Reviewed-by: Abner Chang 

> -Original Message-
> From: Chesley, Brit 
> Sent: Tuesday, July 11, 2023 3:23 AM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Isaac Oram
> ; Attar, AbdulLateef (Abdul Lateef)
> ; Nickle Wang 
> Subject: [edk2-platforms][PATCH v1 1/1] ManageabilityPkg: Ipmi Get/Set
> Boot Options
>
> From: Brit Chesley 
>
> BZ #: 4455.
> Support parameter selectors for IPMI Get/Set boot options. The size of
> the response data is now dependent on the parameter selector, rather
> than being fixed.
>
> Cc: Abner Chang 
> Cc: Isaac Oram 
> Cc: Abdul Lateef Attar 
> Cc: Nickle Wang 
> Signed-off-by: Brit Chesley 
> ---
>  .../IpmiCommandLibNetFnChassis.c  | 124 ++
>  1 file changed, 102 insertions(+), 22 deletions(-)
>
> diff --git
> a/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNe
> tFnChassis.c
> b/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNe
> tFnChassis.c
> index 0c40ad20b98a..01682f55b36d 100644
> ---
> a/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNe
> tFnChassis.c
> +++
> b/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNe
> tFnChassis.c
> @@ -152,17 +152,58 @@ IpmiSetSystemBootOptions (
>)
>  {
>EFI_STATUS  Status;
> -  UINT32  DataSize;
> -
> -  DataSize = sizeof (*BootOptionsResponse);
> -  Status   = IpmiSubmitCommand (
> -   IPMI_NETFN_CHASSIS,
> -   IPMI_CHASSIS_SET_SYSTEM_BOOT_OPTIONS,
> -   (VOID *)BootOptionsRequest,
> -   sizeof (*BootOptionsRequest),
> -   (VOID *)BootOptionsResponse,
> -   &DataSize
> -   );
> +  UINT32  RequestDataSize;
> +  UINT32  ResponseDataSize;
> +
> +  ResponseDataSize = sizeof (*BootOptionsResponse);
> +  RequestDataSize  = sizeof (*BootOptionsRequest);
> +
> +  switch (BootOptionsRequest->ParameterValid.Bits.ParameterSelector) {
> +case IPMI_BOOT_OPTIONS_PARAMETER_SELECTOR_SET_IN_PROGRESS:
> +  RequestDataSize += sizeof
> (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_0);
> +  break;
> +
> +case
> IPMI_BOOT_OPTIONS_PARAMETER_SELECTOR_SERVICE_PARTITION_SELECT
> OR:
> +  RequestDataSize += sizeof
> (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_1);
> +  break;
> +
> +case
> IPMI_BOOT_OPTIONS_PARAMETER_SELECTOR_SERVICE_PARTITION_SCAN:
> +  RequestDataSize += sizeof
> (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_2);
> +  break;
> +
> +case IPMI_BOOT_OPTIONS_PARAMETER_SELECTOR_BMC_BOOT_FLAG:
> +  RequestDataSize += sizeof
> (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_3);
> +  break;
> +
> +case IPMI_BOOT_OPTIONS_PARAMETER_BOOT_INFO_ACK:
> +  RequestDataSize += sizeof
> (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_4);
> +  break;
> +
> +case IPMI_BOOT_OPTIONS_PARAMETER_BOOT_FLAGS:
> +  RequestDataSize += sizeof
> (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_5);
> +  break;
> +
> +case IPMI_BOOT_OPTIONS_PARAMETER_BOOT_INITIATOR_INFO:
> +  RequestDataSize += sizeof
> (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_6);
> +  break;
> +
> +case IPMI_BOOT_OPTIONS_PARAMETER_BOOT_INITIATOR_MAILBOX:
> +  RequestDataSize += sizeof
> (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_7);
> +  break;
> +
> +default:
> +  return EFI_INVALID_PARAMETER;
> +  break;
> +  }
> +
> +  Status = IpmiSubmitCommand (
> + IPMI_NETFN_CHASSIS,
> + IPMI_CHASSIS_SET_SYSTEM_BOOT_OPTIONS,
> + (VOID *)BootOptionsRequest,
> + RequestDataSize,
> + (VOID *)BootOptionsResponse,
> + &ResponseDataSize
> + );
>return Status;
>  }
>
> @@ -184,16 +225,55 @@ IpmiGetSystemBootOptions (
>)
>  {
>EFI_STATUS  Status;
> -  UINT32  DataSize;
> -
> -  DataSize = sizeof (*BootOptionsResponse);
> -  Status   = IpmiSubmitCommand (
> -   IPMI_NETFN_CHASSIS,
> -   IPMI_CHASSIS_GET_SYSTEM_BOOT_OPTIONS,
> -   (VOID *)BootOptionsRequest,
> -   sizeof (*BootOptionsRequest),
> -   (VOID *)BootOptionsResponse,
> -   &DataSize
> -   );
> +  UINT32  ResponseDataSize;
> +
> +  ResponseDataSize = sizeof (*BootOptionsResponse);
> +
> +  switch (BootOptionsRequest->ParameterSelector.Bits.ParameterSelector) {
> +case IPMI_BOOT_OPTIONS_PARAMETER_SELECTOR_SET_IN_PROGRESS:
> +  ResponseDataSize += sizeof
> (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_0);
> +  break;
> +
> +case
> IPMI_BOOT_OPTIONS_PARAMETER_SELECTOR_SERVICE_PARTITION_SELECT
> OR:
> +  ResponseDataSize += sizeof
> (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_1);
> +  break;
> +
> +case
> IPMI_BOOT_OPTIONS_PARAMETER_SELECTOR_SERVICE_PARTITION_SCAN:
> +  ResponseDataSize += sizeof
> (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_2);
> +  break;
> +
> +case IPM

[edk2-devel] Event: TianoCore Bug Triage - APAC / NAMO - Tuesday, July 11, 2023 #cal-reminder

2023-07-10 Thread Group Notification
*Reminder: TianoCore Bug Triage - APAC / NAMO*

*When:*
Tuesday, July 11, 2023
6:30pm to 7:30pm
(UTC-07:00) America/Los Angeles

*Where:*
https://teams.microsoft.com/l/meetup-join/19%3ameeting_OTk1YzJhN2UtOGQwNi00NjY4LWEwMTktY2JiODRlYTY1NmY0%40thread.v2/0?context=%7b%22Tid%22%3a%2246c98d88-e344-4ed4-8496-4ed7712e255d%22%2c%22Oid%22%3a%226e4ce4c4-1242-431b-9a51-92cd01a5df3c%22%7d

*Organizer:* Liming Gao gaolim...@byosoft.com.cn ( 
gaolim...@byosoft.com.cn?subject=Re:%20Event:%20TianoCore%20Bug%20Triage%20-%20APAC%20%2F%20NAMO
 )

View Event ( https://edk2.groups.io/g/devel/viewevent?eventid=1949446 )

*Description:*

TianoCore Bug Triage - APAC / NAMO

Hosted by Liming Gao



Microsoft Teams meeting

*Join on your computer or mobile app*

Click here to join the meeting ( 
https://teams.microsoft.com/l/meetup-join/19%3ameeting_OTk1YzJhN2UtOGQwNi00NjY4LWEwMTktY2JiODRlYTY1NmY0%40thread.v2/0?context=%7b%22Tid%22%3a%2246c98d88-e344-4ed4-8496-4ed7712e255d%22%2c%22Oid%22%3a%226e4ce4c4-1242-431b-9a51-92cd01a5df3c%22%7d
 )

*Join with a video conferencing device*

te...@conf.intel.com

Video Conference ID: 116 062 094 0

Alternate VTC dialing instructions ( 
https://conf.intel.com/teams/?conf=1160620940&ivr=teams&d=conf.intel.com&test=test_call
 )

*Or call in (audio only)*

+1 916-245-6934,,77463821# ( tel:+19162456934,,77463821# ) United States, 
Sacramento

Phone Conference ID: 774 638 21#

Find a local number ( 
https://dialin.teams.microsoft.com/d195d438-2daa-420e-b9ea-da26f9d1d6d5?id=77463821
 ) | Reset PIN ( https://mysettings.lync.com/pstnconferencing )

Learn More ( https://aka.ms/JoinTeamsMeeting ) | Meeting options ( 
https://teams.microsoft.com/meetingOptions/?organizerId=b286b53a-1218-4db3-bfc9-3d4c5aa7669e&tenantId=46c98d88-e344-4ed4-8496-4ed7712e255d&threadId=19_meeting_OTUyZTg2NjgtNDhlNS00ODVlLTllYTUtYzg1OTNjNjdiZjFh@thread.v2&messageId=0&language=en-US
 )


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




[edk2-devel] Now: Tools, CI, Code base construction meeting series - Monday, July 10, 2023 #cal-notice

2023-07-10 Thread Group Notification
*Tools, CI, Code base construction meeting series*

*When:*
Monday, July 10, 2023
4:30pm to 5:30pm
(UTC-07:00) America/Los Angeles

*Where:*
https://teams.microsoft.com/l/meetup-join/19%3ameeting_ZDI2ZDg4NmMtMjI1My00MzI5LWFmYjAtMGQyNjUzNTBjZGYw%40thread.v2/0?context=%7b%22Tid%22%3a%2272f988bf-86f1-41af-91ab-2d7cd011db47%22%2c%22Oid%22%3a%2223af6561-6e1c-450d-b917-d9d674eb3cb6%22%7d

View Event ( https://edk2.groups.io/g/devel/viewevent?eventid=1949450 )

*Description:*

TianoCore community,

Microsoft and Intel will be hosting a series of open meetings to discuss build, 
CI, tools, and other related topics. If you are interested, have ideas/opinions 
please join us. These meetings will be Monday 4:30pm Pacific Time on Microsoft 
Teams.

MS Teams Link in following discussion: * 
https://github.com/tianocore/edk2/discussions/2614

Anyone is welcome to join.

* tianocore/edk2: EDK II (github.com)
* tianocore/edk2-basetools: EDK II BaseTools Python tools as a PIP module 
(github.com) https://github.com/tianocore/edk2-basetools
* tianocore/edk2-pytool-extensions: Extensions to the edk2 build system 
allowing for a more robust and plugin based build system and tool execution 
environment (github.com) https://github.com/tianocore/edk2-pytool-extensions
* tianocore/edk2-pytool-library: Python library package that supports UEFI 
development (github.com) https://github.com/tianocore/edk2-pytool-library

MS Teams Browser Clients * 
https://docs.microsoft.com/en-us/microsoftteams/get-clients?tabs=Windows#browser-client


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




[edk2-devel] Event: Tools, CI, Code base construction meeting series - Monday, July 10, 2023 #cal-reminder

2023-07-10 Thread Group Notification
*Reminder: Tools, CI, Code base construction meeting series*

*When:*
Monday, July 10, 2023
4:30pm to 5:30pm
(UTC-07:00) America/Los Angeles

*Where:*
https://teams.microsoft.com/l/meetup-join/19%3ameeting_ZDI2ZDg4NmMtMjI1My00MzI5LWFmYjAtMGQyNjUzNTBjZGYw%40thread.v2/0?context=%7b%22Tid%22%3a%2272f988bf-86f1-41af-91ab-2d7cd011db47%22%2c%22Oid%22%3a%2223af6561-6e1c-450d-b917-d9d674eb3cb6%22%7d

View Event ( https://edk2.groups.io/g/devel/viewevent?eventid=1949450 )

*Description:*

TianoCore community,

Microsoft and Intel will be hosting a series of open meetings to discuss build, 
CI, tools, and other related topics. If you are interested, have ideas/opinions 
please join us. These meetings will be Monday 4:30pm Pacific Time on Microsoft 
Teams.

MS Teams Link in following discussion: * 
https://github.com/tianocore/edk2/discussions/2614

Anyone is welcome to join.

* tianocore/edk2: EDK II (github.com)
* tianocore/edk2-basetools: EDK II BaseTools Python tools as a PIP module 
(github.com) https://github.com/tianocore/edk2-basetools
* tianocore/edk2-pytool-extensions: Extensions to the edk2 build system 
allowing for a more robust and plugin based build system and tool execution 
environment (github.com) https://github.com/tianocore/edk2-pytool-extensions
* tianocore/edk2-pytool-library: Python library package that supports UEFI 
development (github.com) https://github.com/tianocore/edk2-pytool-library

MS Teams Browser Clients * 
https://docs.microsoft.com/en-us/microsoftteams/get-clients?tabs=Windows#browser-client


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




[edk2-devel] [PATCH v2 4/4] DynamicTablesPkg: Add Aml NameUnicodeString API

2023-07-10 Thread Jeff Brasen via groups.io
Add API to generate a Name that contains a Unicode string buffer.

Signed-off-by: Jeff Brasen 
Reviewed-by: Swatisri Kantamsetti 
Reviewed-by: Ashish Singhal 
---
 .../Include/Library/AmlLib/AmlLib.h   | 31 +++
 .../Common/AmlLib/CodeGen/AmlCodeGen.c| 86 +++
 2 files changed, 117 insertions(+)

diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h 
b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
index f4a490875365..e0dc1340ab50 100644
--- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
+++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
@@ -958,6 +958,37 @@ AmlCodeGenNameResourceTemplate (
   OUT   AML_OBJECT_NODE_HANDLE  *NewObjectNode   OPTIONAL
   );
 
+/** AML code generation for a Name object node, containing a String.
+
+  AmlCodeGenNameUnicodeString ("_STR", L"String", ParentNode, NewObjectNode) is
+  equivalent of the following ASL code:
+Name(_STR, Unicode ("String"))
+
+  @ingroup CodeGenApis
+
+  @param  [in] NameString The new variable name.
+  Must be a NULL-terminated ASL NameString
+  e.g.: "DEV0", "DV15.DEV0", etc.
+  The input string is copied.
+  @param [in]  String NULL terminated Unicode String to associate to 
the
+  NameString.
+  @param [in]  ParentNode If provided, set ParentNode as the parent
+  of the node created.
+  @param [out] NewObjectNode  If success, contains the created node.
+
+  @retval EFI_SUCCESS Success.
+  @retval EFI_INVALID_PARAMETER   Invalid parameter.
+  @retval EFI_OUT_OF_RESOURCESFailed to allocate memory.
+**/
+EFI_STATUS
+EFIAPI
+AmlCodeGenNameUnicodeString (
+  IN  CONST CHAR8   *NameString,
+  INCHAR16  *String,
+  INAML_NODE_HANDLE ParentNode  OPTIONAL,
+  OUT   AML_OBJECT_NODE_HANDLE  *NewObjectNode   OPTIONAL
+  );
+
 /** Add a _PRT entry.
 
   AmlCodeGenPrtEntry (0x0, 0, "LNKA", 0, PrtNameNode) is
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c 
b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
index a2009d9805b5..ffc809ba1b0a 100644
--- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
+++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
@@ -869,6 +869,92 @@ AmlCodeGenNameResourceTemplate (
   return Status;
 }
 
+/** AML code generation for a Name object node, containing a String.
+
+ AmlCodeGenNameUnicodeString ("_STR", L"String", ParentNode, NewObjectNode) is
+ equivalent of the following ASL code:
+   Name(_STR, Unicode ("String"))
+
+ @ingroup CodeGenApis
+
+ @param  [in] NameString The new variable name.
+ Must be a NULL-terminated ASL NameString
+ e.g.: "DEV0", "DV15.DEV0", etc.
+ The input string is copied.
+ @param [in]  String NULL terminated Unicode String to associate to the
+ NameString.
+ @param [in]  ParentNode If provided, set ParentNode as the parent
+ of the node created.
+ @param [out] NewObjectNode  If success, contains the created node.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER   Invalid parameter.
+ @retval EFI_OUT_OF_RESOURCESFailed to allocate memory.
+**/
+EFI_STATUS
+EFIAPI
+AmlCodeGenNameUnicodeString (
+  IN  CONST CHAR8   *NameString,
+  INCHAR16  *String,
+  INAML_NODE_HANDLE ParentNode  OPTIONAL,
+  OUT   AML_OBJECT_NODE_HANDLE  *NewObjectNode   OPTIONAL
+  )
+{
+  EFI_STATUS   Status;
+  AML_OBJECT_NODE  *ObjectNode;
+  AML_DATA_NODE*DataNode;
+
+  if ((NameString == NULL)  ||
+  (String == NULL)  ||
+  ((ParentNode == NULL) && (NewObjectNode == NULL)))
+  {
+ASSERT (0);
+return EFI_INVALID_PARAMETER;
+  }
+
+  Status = AmlCodeGenBuffer (NULL, 0, &ObjectNode);
+  if (EFI_ERROR (Status)) {
+ASSERT_EFI_ERROR (Status);
+return Status;
+  }
+
+  Status = AmlCreateDataNode (
+ EAmlNodeDataTypeRaw,
+ (CONST UINT8 *)String,
+ StrSize (String),
+ &DataNode
+ );
+  if (EFI_ERROR (Status)) {
+ASSERT_EFI_ERROR (Status);
+AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode);
+return Status;
+  }
+
+  Status = AmlVarListAddTail (
+ (AML_NODE_HEADER *)ObjectNode,
+ (AML_NODE_HEADER *)DataNode
+ );
+  if (EFI_ERROR (Status)) {
+ASSERT_EFI_ERROR (Status);
+AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode);
+AmlDeleteTree ((AML_NODE_HANDLE)DataNode);
+return Status;
+  }
+
+  Status = AmlCodeGenName (
+ NameString,
+ ObjectNode,
+ ParentNode,
+ NewObjectNode
+ );
+  if (EFI_ERROR (Status)) {
+ASSERT (0);
+AmlDelet

[edk2-devel] [PATCH v2 3/4] DynamicTablesPkg: Add support to add Strings to package

2023-07-10 Thread Jeff Brasen via groups.io
Add API to add a String to a package created with NamedPackage API.

Signed-off-by: Jeff Brasen 
Reviewed-by: Swatisri Kantamsetti 
Reviewed-by: Ashish Singhal 
---
 .../Include/Library/AmlLib/AmlLib.h   | 17 
 .../Common/AmlLib/CodeGen/AmlCodeGen.c| 82 +++
 2 files changed, 99 insertions(+)

diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h 
b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
index b82c7a3ce874..f4a490875365 100644
--- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
+++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
@@ -1472,4 +1472,21 @@ AmlCreateCpcNode (
   OUT AML_OBJECT_NODE_HANDLE  *NewCpcNode   OPTIONAL
   );
 
+/** AML code generation to add a NameString to the package in a named node.
+
+
+  @param [in]  NameString NameString to add
+  @param [in]  NamedNode  Node to add the string to the included package.
+
+  @retval EFI_SUCCESS Success.
+  @retval EFI_INVALID_PARAMETER   Invalid parameter.
+  @retval EFI_OUT_OF_RESOURCESFailed to allocate memory.
+**/
+EFI_STATUS
+EFIAPI
+AmlAddNameStringToNamedPackage (
+  IN CHAR8   *NameString,
+  IN AML_OBJECT_NODE_HANDLE  NamedNode
+  );
+
 #endif // AML_LIB_H_
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c 
b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
index d31a86e98c4c..a2009d9805b5 100644
--- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
+++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
@@ -3665,3 +3665,85 @@ AmlCreateCpcNode (
   AmlDeleteTree ((AML_NODE_HANDLE)CpcNode);
   return Status;
 }
+
+/** AML code generation to add a NameString to the package in a named node.
+
+
+  @param [in]  NameString NameString to add
+  @param [in]  NamedNode  Node to add the string to the included package.
+
+  @retval EFI_SUCCESS Success.
+  @retval EFI_INVALID_PARAMETER   Invalid parameter.
+  @retval EFI_OUT_OF_RESOURCESFailed to allocate memory.
+**/
+EFI_STATUS
+EFIAPI
+AmlAddNameStringToNamedPackage (
+  IN CHAR8   *NameString,
+  IN AML_OBJECT_NODE_HANDLE  NamedNode
+  )
+{
+  EFI_STATUS  Status;
+  AML_DATA_NODE   *DataNode;
+  CHAR8   *AmlNameString;
+  UINT32  AmlNameStringSize;
+  AML_OBJECT_NODE_HANDLE  PackageNode;
+
+  DataNode = NULL;
+
+  if ((NamedNode == NULL)  ||
+  (AmlGetNodeType ((AML_NODE_HANDLE)NamedNode) != EAmlNodeObject)  ||
+  (!AmlNodeHasOpCode (NamedNode, AML_NAME_OP, 0)))
+  {
+ASSERT (0);
+return EFI_INVALID_PARAMETER;
+  }
+
+  PackageNode = (AML_OBJECT_NODE_HANDLE)AmlGetFixedArgument (
+  NamedNode,
+  EAmlParseIndexTerm1
+  );
+  if ((PackageNode == NULL) ||
+  (AmlGetNodeType ((AML_NODE_HANDLE)PackageNode) != EAmlNodeObject) ||
+  (!AmlNodeHasOpCode (PackageNode, AML_PACKAGE_OP, 0)))
+  {
+ASSERT (0);
+return EFI_INVALID_PARAMETER;
+  }
+
+  Status = ConvertAslNameToAmlName (NameString, &AmlNameString);
+  if (EFI_ERROR (Status)) {
+ASSERT (0);
+return Status;
+  }
+
+  Status = AmlGetNameStringSize (AmlNameString, &AmlNameStringSize);
+  if (EFI_ERROR (Status)) {
+ASSERT (0);
+goto exit_handler;
+  }
+
+  Status = AmlCreateDataNode (
+ EAmlNodeDataTypeNameString,
+ (UINT8 *)AmlNameString,
+ AmlNameStringSize,
+ &DataNode
+ );
+  if (EFI_ERROR (Status)) {
+ASSERT (0);
+goto exit_handler;
+  }
+
+  Status = AmlVarListAddTail (
+ (AML_NODE_HANDLE)PackageNode,
+ (AML_NODE_HANDLE)DataNode
+ );
+  ASSERT_EFI_ERROR (Status);
+
+exit_handler:
+  if (AmlNameString != NULL) {
+FreePool (AmlNameString);
+  }
+
+  return Status;
+}
-- 
2.25.1



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




[edk2-devel] [PATCH v2 2/4] DynamicTablesPkg: Add support for simple method invocation.

2023-07-10 Thread Jeff Brasen via groups.io
Add support to add Return objects via AML that pass a single integer
argument to the named method.

Reviewed-by: Swatisri Kantamsetti 
Reviewed-by: Ashish Singhal 
---
 .../Include/Library/AmlLib/AmlLib.h   |  54 +
 .../Common/AmlLib/CodeGen/AmlCodeGen.c| 224 ++
 2 files changed, 278 insertions(+)

diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h 
b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
index d201ae9499fa..b82c7a3ce874 100644
--- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
+++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
@@ -1194,6 +1194,60 @@ AmlCodeGenMethodRetInteger (
   OUT   AML_OBJECT_NODE_HANDLE  *NewObjectNodeOPTIONAL
   );
 
+/** AML code generation for a method returning a NameString that takes an
+integer argument.
+
+  AmlCodeGenMethodRetNameStringIntegerArgument (
+"MET0", "MET1", 1, TRUE, 3, 5, ParentNode, NewObjectNode
+);
+  is equivalent of the following ASL code:
+Method(MET0, 1, Serialized, 3) {
+  Return (MET1 (5))
+}
+
+  The ASL parameters "ReturnType" and "ParameterTypes" are not asked
+  in this function. They are optional parameters in ASL.
+
+  @param [in]  MethodNameString The new Method's name.
+Must be a NULL-terminated ASL NameString
+e.g.: "MET0", "_SB.MET0", etc.
+The input string is copied.
+  @param [in]  ReturnedNameString   The name of the object returned by the
+method. Optional parameter, can be:
+ - NULL (ignored).
+ - A NULL-terminated ASL NameString.
+   e.g.: "MET0", "_SB.MET0", etc.
+   The input string is copied.
+  @param [in]  NumArgs  Number of arguments.
+Must be 0 <= NumArgs <= 6.
+  @param [in]  IsSerialized TRUE is equivalent to Serialized.
+FALSE is equivalent to NotSerialized.
+Default is NotSerialized in ASL spec.
+  @param [in]  SyncLevelSynchronization level for the method.
+Must be 0 <= SyncLevel <= 15.
+Default is 0 in ASL.
+  @param [in]  IntegerArgument  Argument to pass to the NameString.
+  @param [in]  ParentNode   If provided, set ParentNode as the parent
+of the node created.
+  @param [out] NewObjectNodeIf success, contains the created node.
+
+  @retval EFI_SUCCESS Success.
+  @retval EFI_INVALID_PARAMETER   Invalid parameter.
+  @retval EFI_OUT_OF_RESOURCESFailed to allocate memory.
+**/
+EFI_STATUS
+EFIAPI
+AmlCodeGenMethodRetNameStringIntegerArgument (
+  IN  CONST CHAR8   *MethodNameString,
+  IN  CONST CHAR8   *ReturnedNameString   OPTIONAL,
+  INUINT8   NumArgs,
+  INBOOLEAN IsSerialized,
+  INUINT8   SyncLevel,
+  INUINT64  IntegerArgument,
+  INAML_NODE_HANDLE ParentNode   OPTIONAL,
+  OUT   AML_OBJECT_NODE_HANDLE  *NewObjectNodeOPTIONAL
+  );
+
 /** Create a _LPI name.
 
   AmlCreateLpiNode ("_LPI", 0, 1, ParentNode, &LpiNode) is
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c 
b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
index 88537b7e2d27..d31a86e98c4c 100644
--- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
+++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
@@ -1881,6 +1881,118 @@ AmlCodeGenReturnInteger (
   return Status;
 }
 
+/** AML code generation for a Return object node,
+returning the object as an input NameString with a integer argument.
+
+  AmlCodeGenReturn ("NAM1", 6, ParentNode, NewObjectNode) is
+  equivalent of the following ASL code:
+Return(NAM1 (6))
+
+  The ACPI 6.3 specification, s20.2.5.3 "Type 1 Opcodes Encoding" states:
+DefReturn := ReturnOp ArgObject
+ReturnOp := 0xA4
+ArgObject := TermArg => DataRefObject
+
+  Thus, the ReturnNode must be evaluated as a DataRefObject. It can
+  be a NameString referencing an object. As this CodeGen Api doesn't
+  do semantic checking, it is strongly advised to check the AML bytecode
+  generated by this function against an ASL compiler.
+
+  The ReturnNode must be generated inside a Method body scope.
+
+  @param [in]  NameString The object referenced by this NameString
+  is returned by the Return ASL statement.
+  Must be a NULL-terminated ASL NameString
+  e.g.: "NAM1", "_SB.NAM1", etc.
+  The input string is copied.
+  @param 

[edk2-devel] [PATCH v2 0/4] Add support for generating ACPI ThermalZones

2023-07-10 Thread Jeff Brasen via groups.io
Add APIs needed to create thermal zones dynamically.
Does not add a generator for this as creating the TMP method generically may
be difficult.

Change log:

v2 - renamed NameString function and added goto dones in a couple error cases

Jeff Brasen (4):
  DynamicTablesPkg: Add ThermalZone CodeGen function
  DynamicTablesPkg: Add support for simple method invocation.
  DynamicTablesPkg: Add support to add Strings to package
  DynamicTablesPkg: Add Aml NameUnicodeString API

 .../Include/Library/AmlLib/AmlLib.h   | 130 +
 .../Common/AmlLib/CodeGen/AmlCodeGen.c| 508 ++
 2 files changed, 638 insertions(+)

-- 
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#106774): https://edk2.groups.io/g/devel/message/106774
Mute This Topic: https://groups.io/mt/100068075/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/4] DynamicTablesPkg: Add ThermalZone CodeGen function

2023-07-10 Thread Jeff Brasen via groups.io
Add API to generate a ThermalZone object to AmlLib.

Reviewed-by: Swatisri Kantamsetti 
Reviewed-by: Ashish Singhal 
---
 .../Include/Library/AmlLib/AmlLib.h   |  28 +
 .../Common/AmlLib/CodeGen/AmlCodeGen.c| 116 ++
 2 files changed, 144 insertions(+)

diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h 
b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
index 9210c5091548..d201ae9499fa 100644
--- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
+++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
@@ -1038,6 +1038,34 @@ AmlCodeGenDevice (
   OUT   AML_OBJECT_NODE_HANDLE  *NewObjectNode   OPTIONAL
   );
 
+/** AML code generation for a ThermalZone object node.
+
+  AmlCodeGenThermalZone ("TZ00", ParentNode, NewObjectNode) is
+  equivalent of the following ASL code:
+ThermalZone(TZ00) {}
+
+  @ingroup CodeGenApis
+
+  @param  [in] NameString The new ThermalZone's name.
+  Must be a NULL-terminated ASL NameString
+  e.g.: "DEV0", "DV15.DEV0", etc.
+  The input string is copied.
+  @param [in]  ParentNode If provided, set ParentNode as the parent
+  of the node created.
+  @param [out] NewObjectNode  If success, contains the created node.
+
+  @retval EFI_SUCCESS Success.
+  @retval EFI_INVALID_PARAMETER   Invalid parameter.
+  @retval EFI_OUT_OF_RESOURCESFailed to allocate memory.
+**/
+EFI_STATUS
+EFIAPI
+AmlCodeGenThermalZone (
+  IN  CONST CHAR8   *NameString,
+  INAML_NODE_HANDLE ParentNode  OPTIONAL,
+  OUT   AML_OBJECT_NODE_HANDLE  *NewObjectNode   OPTIONAL
+  );
+
 /** AML code generation for a Scope object node.
 
   AmlCodeGenScope ("_SB", ParentNode, NewObjectNode) is
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c 
b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
index 0b223379fa4b..88537b7e2d27 100644
--- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
+++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
@@ -1218,6 +1218,122 @@ AmlCodeGenDevice (
   return Status;
 }
 
+/** AML code generation for a ThermalZone object node.
+
+  AmlCodeGenThermalZone ("TZ00", ParentNode, NewObjectNode) is
+  equivalent of the following ASL code:
+ThermalZone(TZ00) {}
+
+  @ingroup CodeGenApis
+
+  @param  [in] NameString The new ThermalZone's name.
+  Must be a NULL-terminated ASL NameString
+  e.g.: "DEV0", "DV15.DEV0", etc.
+  The input string is copied.
+  @param [in]  ParentNode If provided, set ParentNode as the parent
+  of the node created.
+  @param [out] NewObjectNode  If success, contains the created node.
+
+  @retval EFI_SUCCESS Success.
+  @retval EFI_INVALID_PARAMETER   Invalid parameter.
+  @retval EFI_OUT_OF_RESOURCESFailed to allocate memory.
+**/
+EFI_STATUS
+EFIAPI
+AmlCodeGenThermalZone (
+  IN  CONST CHAR8   *NameString,
+  INAML_NODE_HANDLE ParentNode  OPTIONAL,
+  OUT   AML_OBJECT_NODE_HANDLE  *NewObjectNode   OPTIONAL
+  )
+{
+  EFI_STATUS   Status;
+  AML_OBJECT_NODE  *ObjectNode;
+  AML_DATA_NODE*DataNode;
+  CHAR8*AmlNameString;
+  UINT32   AmlNameStringSize;
+
+  if ((NameString == NULL)  ||
+  ((ParentNode == NULL) && (NewObjectNode == NULL)))
+  {
+ASSERT (0);
+return EFI_INVALID_PARAMETER;
+  }
+
+  ObjectNode= NULL;
+  DataNode  = NULL;
+  AmlNameString = NULL;
+
+  Status = ConvertAslNameToAmlName (NameString, &AmlNameString);
+  if (EFI_ERROR (Status)) {
+ASSERT (0);
+return Status;
+  }
+
+  Status = AmlGetNameStringSize (AmlNameString, &AmlNameStringSize);
+  if (EFI_ERROR (Status)) {
+ASSERT (0);
+goto error_handler1;
+  }
+
+  Status = AmlCreateObjectNode (
+ AmlGetByteEncodingByOpCode (AML_EXT_OP, AML_EXT_THERMAL_ZONE_OP),
+ AmlNameStringSize + AmlComputePkgLengthWidth (AmlNameStringSize),
+ &ObjectNode
+ );
+  if (EFI_ERROR (Status)) {
+ASSERT (0);
+goto error_handler1;
+  }
+
+  Status = AmlCreateDataNode (
+ EAmlNodeDataTypeNameString,
+ (UINT8 *)AmlNameString,
+ AmlNameStringSize,
+ &DataNode
+ );
+  if (EFI_ERROR (Status)) {
+ASSERT (0);
+goto error_handler2;
+  }
+
+  Status = AmlSetFixedArgument (
+ ObjectNode,
+ EAmlParseIndexTerm0,
+ (AML_NODE_HEADER *)DataNode
+ );
+  if (EFI_ERROR (Status)) {
+ASSERT (0);
+AmlDeleteTree ((AML_NODE_HEADER *)DataNode);
+goto error_handler2;
+  }
+
+  Status = LinkNode (
+ ObjectNode,
+ ParentNode,
+ NewObjectNode
+ );
+  if (EFI_ERROR (Status)) {
+ASSERT (0);
+goto 

[edk2-devel] [edk2-platforms][PATCH v1 1/1] ManageabilityPkg: Ipmi Get/Set Boot Options

2023-07-10 Thread brit.chesley via groups.io
From: Brit Chesley 

BZ #: 4455.
Support parameter selectors for IPMI Get/Set boot options. The size of
the response data is now dependent on the parameter selector, rather
than being fixed.

Cc: Abner Chang 
Cc: Isaac Oram 
Cc: Abdul Lateef Attar 
Cc: Nickle Wang 
Signed-off-by: Brit Chesley 
---
 .../IpmiCommandLibNetFnChassis.c  | 124 ++
 1 file changed, 102 insertions(+), 22 deletions(-)

diff --git 
a/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNetFnChassis.c 
b/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNetFnChassis.c
index 0c40ad20b98a..01682f55b36d 100644
--- 
a/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNetFnChassis.c
+++ 
b/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNetFnChassis.c
@@ -152,17 +152,58 @@ IpmiSetSystemBootOptions (
   )
 {
   EFI_STATUS  Status;
-  UINT32  DataSize;
-
-  DataSize = sizeof (*BootOptionsResponse);
-  Status   = IpmiSubmitCommand (
-   IPMI_NETFN_CHASSIS,
-   IPMI_CHASSIS_SET_SYSTEM_BOOT_OPTIONS,
-   (VOID *)BootOptionsRequest,
-   sizeof (*BootOptionsRequest),
-   (VOID *)BootOptionsResponse,
-   &DataSize
-   );
+  UINT32  RequestDataSize;
+  UINT32  ResponseDataSize;
+
+  ResponseDataSize = sizeof (*BootOptionsResponse);
+  RequestDataSize  = sizeof (*BootOptionsRequest);
+
+  switch (BootOptionsRequest->ParameterValid.Bits.ParameterSelector) {
+case IPMI_BOOT_OPTIONS_PARAMETER_SELECTOR_SET_IN_PROGRESS:
+  RequestDataSize += sizeof (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_0);
+  break;
+
+case IPMI_BOOT_OPTIONS_PARAMETER_SELECTOR_SERVICE_PARTITION_SELECTOR:
+  RequestDataSize += sizeof (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_1);
+  break;
+
+case IPMI_BOOT_OPTIONS_PARAMETER_SELECTOR_SERVICE_PARTITION_SCAN:
+  RequestDataSize += sizeof (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_2);
+  break;
+
+case IPMI_BOOT_OPTIONS_PARAMETER_SELECTOR_BMC_BOOT_FLAG:
+  RequestDataSize += sizeof (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_3);
+  break;
+
+case IPMI_BOOT_OPTIONS_PARAMETER_BOOT_INFO_ACK:
+  RequestDataSize += sizeof (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_4);
+  break;
+
+case IPMI_BOOT_OPTIONS_PARAMETER_BOOT_FLAGS:
+  RequestDataSize += sizeof (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_5);
+  break;
+
+case IPMI_BOOT_OPTIONS_PARAMETER_BOOT_INITIATOR_INFO:
+  RequestDataSize += sizeof (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_6);
+  break;
+
+case IPMI_BOOT_OPTIONS_PARAMETER_BOOT_INITIATOR_MAILBOX:
+  RequestDataSize += sizeof (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_7);
+  break;
+
+default:
+  return EFI_INVALID_PARAMETER;
+  break;
+  }
+
+  Status = IpmiSubmitCommand (
+ IPMI_NETFN_CHASSIS,
+ IPMI_CHASSIS_SET_SYSTEM_BOOT_OPTIONS,
+ (VOID *)BootOptionsRequest,
+ RequestDataSize,
+ (VOID *)BootOptionsResponse,
+ &ResponseDataSize
+ );
   return Status;
 }
 
@@ -184,16 +225,55 @@ IpmiGetSystemBootOptions (
   )
 {
   EFI_STATUS  Status;
-  UINT32  DataSize;
-
-  DataSize = sizeof (*BootOptionsResponse);
-  Status   = IpmiSubmitCommand (
-   IPMI_NETFN_CHASSIS,
-   IPMI_CHASSIS_GET_SYSTEM_BOOT_OPTIONS,
-   (VOID *)BootOptionsRequest,
-   sizeof (*BootOptionsRequest),
-   (VOID *)BootOptionsResponse,
-   &DataSize
-   );
+  UINT32  ResponseDataSize;
+
+  ResponseDataSize = sizeof (*BootOptionsResponse);
+
+  switch (BootOptionsRequest->ParameterSelector.Bits.ParameterSelector) {
+case IPMI_BOOT_OPTIONS_PARAMETER_SELECTOR_SET_IN_PROGRESS:
+  ResponseDataSize += sizeof (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_0);
+  break;
+
+case IPMI_BOOT_OPTIONS_PARAMETER_SELECTOR_SERVICE_PARTITION_SELECTOR:
+  ResponseDataSize += sizeof (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_1);
+  break;
+
+case IPMI_BOOT_OPTIONS_PARAMETER_SELECTOR_SERVICE_PARTITION_SCAN:
+  ResponseDataSize += sizeof (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_2);
+  break;
+
+case IPMI_BOOT_OPTIONS_PARAMETER_SELECTOR_BMC_BOOT_FLAG:
+  ResponseDataSize += sizeof (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_3);
+  break;
+
+case IPMI_BOOT_OPTIONS_PARAMETER_BOOT_INFO_ACK:
+  ResponseDataSize += sizeof (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_4);
+  break;
+
+case IPMI_BOOT_OPTIONS_PARAMETER_BOOT_FLAGS:
+  ResponseDataSize += sizeof (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_5);
+  break;
+
+case IPMI_BOOT_OPTIONS_PARAMETER_BOOT_INITIATOR_INFO:
+  ResponseDataSize += sizeof (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_6);
+  break;
+
+case IPMI_BOOT_OPTIONS_PARAMETER_BOOT_INITIATOR_MAILBOX:
+  ResponseDataSize += sizeof (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_7);
+  break;
+
+default:
+  return EFI_INV

Re: [edk2-devel] ArmVirtPkg: non-executable EFI_LOADER_DATA breaks GRUB on Ubuntu 22.04

2023-07-10 Thread osy
On Mon, Jul 10, 2023 at 8:58 AM Pedro Falcato  wrote:
>
> On Mon, Jul 10, 2023 at 2:28 PM  wrote:
> >
> > I have an existing install of Ubuntu 22.04 on a QEMU virtual machine which 
> > I've decided to update the UEFI firmware. After doing so, GRUB no longer 
> > boots ("Synchronous Exception" message seen). After a git bisect session, I 
> > found the problematic 2997ae38739756ecba9b0de19e86032ebc689ef9. The comment 
> > says GRUB should have been fixed in 2017, but for one reason or another, my 
> > VM which was built in 2022 still had the issue. Regardless, I don't think 
> > it's a good idea to break GRUB, even if it's fixed in 2017. In the very 
> > least, a better error message would be preferable to crashing with an 
> > "Synchronous Exception." Googling this error message shows that other 
> > people may be hitting this issue as well but the vague error symptom means 
> > its impossible to know if it's the same issue or not.
>
> +CC Some of the folks involved in the original discussion
>
> In the original thread, people discussed some alternative behavior to
> just crashing on a NX fault. Is this still an alternative?
> I'm kind of thinking this should be addressed by distros anyway
> How is $CURRENT_YEAR Ubuntu still shipping bad GRUBs? I know the
> situation around GRUB and distro patching is complicated but...
> Do we have any idea of how many distros/GRUBs are affected by this?
>
> Personally, I would like to avoid loosening up memory permissions.
>
> --
> Pedro

I agree with the desire to be more secure, but the way I see it is
that the firmware's first priority is to load the bootloader and
gracefully hand off control. The fact that a bootloader is "too old"
shouldn't be a reason to just crash and die. Once downstream projects
like QEMU start picking up this change, this could potentially become
an issue for a lot of users. If the EDK2 project decides that there is
no technical way to both have secure memory permissions and support
older GRUB installs, I think this breakage must be communicated
effectively and be made explicit. I agree that distros probably
shouldn't ship bad GRUBs (here's a bug report in Fedora addressing the
same issue https://bugzilla.redhat.com/show_bug.cgi?id=2149020) and
perhaps they have already fixed it but at the end of the day, the UEFI
firmware likely isn't maintained by the distros. When a user updates
their firmware (from QEMU or from a board vendor), they don't expect
their OS to stop booting. If this happened on real hardware, it could
actually be a real pain to downgrade the firmware or recover and
update GRUB.


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




Re: [edk2-devel] ArmVirtPkg: non-executable EFI_LOADER_DATA breaks GRUB on Ubuntu 22.04

2023-07-10 Thread Pedro Falcato
On Mon, Jul 10, 2023 at 2:28 PM  wrote:
>
> I have an existing install of Ubuntu 22.04 on a QEMU virtual machine which 
> I've decided to update the UEFI firmware. After doing so, GRUB no longer 
> boots ("Synchronous Exception" message seen). After a git bisect session, I 
> found the problematic 2997ae38739756ecba9b0de19e86032ebc689ef9. The comment 
> says GRUB should have been fixed in 2017, but for one reason or another, my 
> VM which was built in 2022 still had the issue. Regardless, I don't think 
> it's a good idea to break GRUB, even if it's fixed in 2017. In the very 
> least, a better error message would be preferable to crashing with an 
> "Synchronous Exception." Googling this error message shows that other people 
> may be hitting this issue as well but the vague error symptom means its 
> impossible to know if it's the same issue or not.

+CC Some of the folks involved in the original discussion

In the original thread, people discussed some alternative behavior to
just crashing on a NX fault. Is this still an alternative?
I'm kind of thinking this should be addressed by distros anyway
How is $CURRENT_YEAR Ubuntu still shipping bad GRUBs? I know the
situation around GRUB and distro patching is complicated but...
Do we have any idea of how many distros/GRUBs are affected by this?

Personally, I would like to avoid loosening up memory permissions.

--
Pedro


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#106771): https://edk2.groups.io/g/devel/message/106771
Mute This Topic: https://groups.io/mt/100057351/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 1/1] BaseTools: scan Edk2ToolsBuild.py make output

2023-07-10 Thread Joey Vagedes via groups.io
Thanks Rebecca! Let me know if you need anything else from me before you
get it merged. I appreciate your time!

Joey

On Sun, Jul 9, 2023 at 4:18 PM Rebecca Cran  wrote:

> Sorry for the delay.
>
>
> Reviewed-by: Rebecca Cran 
>
>
> On 6/21/23 9:59 AM, Joey Vagedes wrote:
> > Adds edk2_logging.scan_compiler_output() to Edk2ToolsBuild.py to catch
> > some compilation errors and log them as an error.
> >
> > Cc: Rebecca Cran 
> > Cc: Liming Gao 
> > Cc: Bob Feng 
> > Cc: Yuwei Chen 
> > Signed-off-by: Joey Vagedes 
> > ---
> >   BaseTools/Edk2ToolsBuild.py | 11 +++
> >   1 file changed, 11 insertions(+)
> >
> > diff --git a/BaseTools/Edk2ToolsBuild.py b/BaseTools/Edk2ToolsBuild.py
> > index f862468ce275..425bb1b63963 100644
> > --- a/BaseTools/Edk2ToolsBuild.py
> > +++ b/BaseTools/Edk2ToolsBuild.py
> > @@ -133,8 +133,13 @@ class Edk2ToolsBuild(BaseAbstractInvocable):
> >   shell_env.insert_path(self.OutputDir)
> >
> >   # Actually build the tools.
> > +output_stream = edk2_logging.create_output_stream()
> >   ret = RunCmd('nmake.exe', None,
> >
> workingdir=shell_env.get_shell_var("EDK_TOOLS_PATH"))
> > +edk2_logging.remove_output_stream(output_stream)
> > +problems = edk2_logging.scan_compiler_output(output_stream)
> > +for level, problem in problems:
> > +logging.log(level, problem)
> >   if ret != 0:
> >   raise Exception("Failed to build.")
> >
> > @@ -143,7 +148,13 @@ class Edk2ToolsBuild(BaseAbstractInvocable):
> >
> >   elif self.tool_chain_tag.lower().startswith("gcc"):
> >   cpu_count = self.GetCpuThreads()
> > +
> > +output_stream = edk2_logging.create_output_stream()
> >   ret = RunCmd("make", f"-C .  -j {cpu_count}",
> workingdir=shell_env.get_shell_var("EDK_TOOLS_PATH"))
> > +edk2_logging.remove_output_stream(output_stream)
> > +problems = edk2_logging.scan_compiler_output(output_stream)
> > +for level, problem in problems:
> > +logging.log(level, problem)
> >   if ret != 0:
> >   raise Exception("Failed to build.")
> >
>


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




[edk2-devel] ArmVirtPkg: non-executable EFI_LOADER_DATA breaks GRUB on Ubuntu 22.04

2023-07-10 Thread osy
I have an existing install of Ubuntu 22.04 on a QEMU virtual machine which I've 
decided to update the UEFI firmware. After doing so, GRUB no longer boots 
("Synchronous Exception" message seen). After a git bisect session, I found the 
problematic 2997ae38739756ecba9b0de19e86032ebc689ef9. The comment says GRUB 
should have been fixed in 2017, but for one reason or another, my VM which was 
built in 2022 still had the issue. Regardless, I don't think it's a good idea 
to break GRUB, even if it's fixed in 2017. In the very least, a better error 
message would be preferable to crashing with an "Synchronous Exception." 
Googling this error message shows that other people may be hitting this issue 
as well but the vague error symptom means its impossible to know if it's the 
same issue or not.


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




[edk2-devel] [PATCH] UefiPayloadPkg: Integrate UiApp and BootManagerMenuApp into MultiFv

2023-07-10 Thread marsx . lin
From: MarsX Lin 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4347

To put UiApp.inf and BootManagerMenuApp.inf to proper FV(BDSFV)

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 

Signed-off-by: MarsX Lin 
---
 .../PlatformBootManager.c | 55 ---
 .../PlatformBootManagerLib.inf|  4 --
 UefiPayloadPkg/UefiPayloadEntry/PrintHob.c| 25 +
 .../UniversalPayloadEntry.inf |  1 -
 UefiPayloadPkg/UefiPayloadPkg.dec |  2 -
 UefiPayloadPkg/UefiPayloadPkg.dsc |  8 +--
 UefiPayloadPkg/UefiPayloadPkg.fdf |  9 ++-
 7 files changed, 11 insertions(+), 93 deletions(-)

diff --git 
a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c 
b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
index 4a0219624d..a4a49da0e9 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
@@ -9,8 +9,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 #include "PlatformBootManager.h"
 #include "PlatformConsole.h"
-#include 
-#include 
 #include 
 
 /**
@@ -364,56 +362,3 @@ PlatformBootManagerUnableToBoot (
 {
   return;
 }
-
-/**
-  Get/update PcdBootManagerMenuFile from GUID HOB which will be assigned in 
bootloader.
-
-  @param  ImageHandle   The firmware allocated handle for the EFI image.
-  @param  SystemTable   A pointer to the EFI System Table.
-
-  @retval EFI_SUCCESS   The entry point is executed successfully.
-  @retval other Some error occurs.
-
-**/
-EFI_STATUS
-EFIAPI
-PlatformBootManagerLibConstructor (
-  IN EFI_HANDLEImageHandle,
-  IN EFI_SYSTEM_TABLE  *SystemTable
-  )
-{
-  EFI_STATUS   Status;
-  UINTNSize;
-  VOID *GuidHob;
-  UNIVERSAL_PAYLOAD_GENERIC_HEADER *GenericHeader;
-  UNIVERSAL_PAYLOAD_BOOT_MANAGER_MENU  *BootManagerMenuFile;
-
-  GuidHob = GetFirstGuidHob (&gEdkiiBootManagerMenuFileGuid);
-
-  if (GuidHob == NULL) {
-//
-// If the HOB is not create, the default value of PcdBootManagerMenuFile 
will be used.
-//
-return EFI_SUCCESS;
-  }
-
-  GenericHeader = (UNIVERSAL_PAYLOAD_GENERIC_HEADER *)GET_GUID_HOB_DATA 
(GuidHob);
-  if ((sizeof (UNIVERSAL_PAYLOAD_GENERIC_HEADER) > GET_GUID_HOB_DATA_SIZE 
(GuidHob)) || (GenericHeader->Length > GET_GUID_HOB_DATA_SIZE (GuidHob))) {
-return EFI_NOT_FOUND;
-  }
-
-  if (GenericHeader->Revision == UNIVERSAL_PAYLOAD_BOOT_MANAGER_MENU_REVISION) 
{
-BootManagerMenuFile = (UNIVERSAL_PAYLOAD_BOOT_MANAGER_MENU 
*)GET_GUID_HOB_DATA (GuidHob);
-if (BootManagerMenuFile->Header.Length < 
UNIVERSAL_PAYLOAD_SIZEOF_THROUGH_FIELD (UNIVERSAL_PAYLOAD_BOOT_MANAGER_MENU, 
FileName)) {
-  return EFI_NOT_FOUND;
-}
-
-Size   = sizeof (BootManagerMenuFile->FileName);
-Status = PcdSetPtrS (PcdBootManagerMenuFile, &Size, 
&BootManagerMenuFile->FileName);
-ASSERT_EFI_ERROR (Status);
-  } else {
-return EFI_NOT_FOUND;
-  }
-
-  return EFI_SUCCESS;
-}
diff --git 
a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf 
b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index a3951b7a7e..ff92c95227 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -13,7 +13,6 @@
   MODULE_TYPE= DXE_DRIVER
   VERSION_STRING = 1.0
   LIBRARY_CLASS  = PlatformBootManagerLib|DXE_DRIVER
-  CONSTRUCTOR= PlatformBootManagerLibConstructor
 
 #
 # The following information is for reference only and not required by the 
build tools.
@@ -48,11 +47,9 @@
   HiiLib
   PrintLib
   PlatformHookLib
-  HobLib
 
 [Guids]
   gEfiEndOfDxeEventGroupGuid
-  gEdkiiBootManagerMenuFileGuid
   gUefiShellFileGuid
 
 [Protocols]
@@ -75,5 +72,4 @@
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits
-  gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile
   gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape
diff --git a/UefiPayloadPkg/UefiPayloadEntry/PrintHob.c 
b/UefiPayloadPkg/UefiPayloadEntry/PrintHob.c
index e959be5d95..3b2b7788d4 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/PrintHob.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/PrintHob.c
@@ -10,7 +10,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #define ROW_LIMITER  16
 
@@ -437,27 +436,6 @@ PrintMemoryTypeInfoGuidHob (
   return EFI_SUCCESS;
 }
 
-/**
-  Print the information in EdkiiBootManagerMenuFileGuid.
-  @param[in] HobRaw  A pointer to the start of 
gEdkiiBootManagerMenuFileGuid HOB.
-  @param[in] HobLength   The size of the HOB data buffer.
-  @retval EFI_SUCCESSIf it completed successfully.
-**/
-EF

Re: [edk2-devel] [PATCH] UefiPayloadPkg: Integrate UiApp and BootManagerMenuApp into MultiFv

2023-07-10 Thread Guo, Gua
Reviewed-by: Gua Guo  

-Original Message-
From: Lin, MarsX  
Sent: Monday, July 10, 2023 5:02 PM
To: devel@edk2.groups.io
Cc: Lin, MarsX ; Dong, Guo ; Ni, Ray 
; Rhodes, Sean ; Lu, James 
; Guo, Gua 
Subject: [PATCH] UefiPayloadPkg: Integrate UiApp and BootManagerMenuApp into 
MultiFv

From: MarsX Lin 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4347

To put UiApp.inf and BootManagerMenuApp.inf to proper FV(BDSFV)

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 

Signed-off-by: MarsX Lin 
---
 .../PlatformBootManager.c | 55 ---
 .../PlatformBootManagerLib.inf|  4 --
 UefiPayloadPkg/UefiPayloadEntry/PrintHob.c| 25 +
 .../UniversalPayloadEntry.inf |  1 -
 UefiPayloadPkg/UefiPayloadPkg.dec |  2 -
 UefiPayloadPkg/UefiPayloadPkg.dsc |  8 +--
 UefiPayloadPkg/UefiPayloadPkg.fdf |  9 ++-
 7 files changed, 11 insertions(+), 93 deletions(-)

diff --git 
a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c 
b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
index 4a0219624d..a4a49da0e9 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
@@ -9,8 +9,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 

 #include "PlatformBootManager.h"

 #include "PlatformConsole.h"

-#include 

-#include 

 #include 

 

 /**

@@ -364,56 +362,3 @@ PlatformBootManagerUnableToBoot (
 {

   return;

 }

-

-/**

-  Get/update PcdBootManagerMenuFile from GUID HOB which will be assigned in 
bootloader.

-

-  @param  ImageHandle   The firmware allocated handle for the EFI image.

-  @param  SystemTable   A pointer to the EFI System Table.

-

-  @retval EFI_SUCCESS   The entry point is executed successfully.

-  @retval other Some error occurs.

-

-**/

-EFI_STATUS

-EFIAPI

-PlatformBootManagerLibConstructor (

-  IN EFI_HANDLEImageHandle,

-  IN EFI_SYSTEM_TABLE  *SystemTable

-  )

-{

-  EFI_STATUS   Status;

-  UINTNSize;

-  VOID *GuidHob;

-  UNIVERSAL_PAYLOAD_GENERIC_HEADER *GenericHeader;

-  UNIVERSAL_PAYLOAD_BOOT_MANAGER_MENU  *BootManagerMenuFile;

-

-  GuidHob = GetFirstGuidHob (&gEdkiiBootManagerMenuFileGuid);

-

-  if (GuidHob == NULL) {

-//

-// If the HOB is not create, the default value of PcdBootManagerMenuFile 
will be used.

-//

-return EFI_SUCCESS;

-  }

-

-  GenericHeader = (UNIVERSAL_PAYLOAD_GENERIC_HEADER *)GET_GUID_HOB_DATA 
(GuidHob);

-  if ((sizeof (UNIVERSAL_PAYLOAD_GENERIC_HEADER) > GET_GUID_HOB_DATA_SIZE 
(GuidHob)) || (GenericHeader->Length > GET_GUID_HOB_DATA_SIZE (GuidHob))) {

-return EFI_NOT_FOUND;

-  }

-

-  if (GenericHeader->Revision == UNIVERSAL_PAYLOAD_BOOT_MANAGER_MENU_REVISION) 
{

-BootManagerMenuFile = (UNIVERSAL_PAYLOAD_BOOT_MANAGER_MENU 
*)GET_GUID_HOB_DATA (GuidHob);

-if (BootManagerMenuFile->Header.Length < 
UNIVERSAL_PAYLOAD_SIZEOF_THROUGH_FIELD (UNIVERSAL_PAYLOAD_BOOT_MANAGER_MENU, 
FileName)) {

-  return EFI_NOT_FOUND;

-}

-

-Size   = sizeof (BootManagerMenuFile->FileName);

-Status = PcdSetPtrS (PcdBootManagerMenuFile, &Size, 
&BootManagerMenuFile->FileName);

-ASSERT_EFI_ERROR (Status);

-  } else {

-return EFI_NOT_FOUND;

-  }

-

-  return EFI_SUCCESS;

-}

diff --git 
a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf 
b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index a3951b7a7e..ff92c95227 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -13,7 +13,6 @@
   MODULE_TYPE= DXE_DRIVER

   VERSION_STRING = 1.0

   LIBRARY_CLASS  = PlatformBootManagerLib|DXE_DRIVER

-  CONSTRUCTOR= PlatformBootManagerLibConstructor

 

 #

 # The following information is for reference only and not required by the 
build tools.

@@ -48,11 +47,9 @@
   HiiLib

   PrintLib

   PlatformHookLib

-  HobLib

 

 [Guids]

   gEfiEndOfDxeEventGroupGuid

-  gEdkiiBootManagerMenuFileGuid

   gUefiShellFileGuid

 

 [Protocols]

@@ -75,5 +72,4 @@
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits

   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity

   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits

-  gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile

   gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape

diff --git a/UefiPayloadPkg/UefiPayloadEntry/PrintHob.c 
b/UefiPayloadPkg/UefiPayloadEntry/PrintHob.c
index e959be5d95..3b2b7788d4 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/PrintHob.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/PrintHob.c
@@ -10,7 +10,6 @@
 #include 

 #include 

 #include 

-#include 

 

 #d

回复: [edk2-devel] [PATCH 1/4] BaseTools: Remove logic to create AP waking vector in GenFv

2023-07-10 Thread gaoliming via groups.io
Zhiguang:
  If there is no such usage any more, I agree to remove this logic.
Reviewed-by: Liming Gao 

Thanks
Liming
> -邮件原件-
> 发件人: devel@edk2.groups.io  代表 Zhiguang Liu
> 发送时间: 2023年7月10日 11:17
> 收件人: devel@edk2.groups.io
> 抄送: Zhiguang Liu ; Rebecca Cran
> ; Liming Gao ; Bob Feng
> ; Yuwei Chen 
> 主题: [edk2-devel] [PATCH 1/4] BaseTools: Remove logic to create AP waking
> vector in GenFv
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4494
> 
> Today for SEC core(not VTF-0), GenFv finds free 4K aligned space in
> FV for AP waking vector and JMP to 4G-30h in the waking vector.
> There is no usage of this today. Remove the logic to avoid confusing
> and save spaces in reset vector.
> 
> Cc: Rebecca Cran 
> Cc: Liming Gao 
> Cc: Bob Feng 
> Cc: Yuwei Chen 
> Signed-off-by: Zhiguang Liu 
> ---
>  BaseTools/Source/C/GenFv/GenFvInternalLib.c | 199 
>  1 file changed, 199 deletions(-)
> 
> diff --git a/BaseTools/Source/C/GenFv/GenFvInternalLib.c
> b/BaseTools/Source/C/GenFv/GenFvInternalLib.c
> index f466324d61..29c3363a50 100644
> --- a/BaseTools/Source/C/GenFv/GenFvInternalLib.c
> +++ b/BaseTools/Source/C/GenFv/GenFvInternalLib.c
> @@ -116,63 +116,6 @@ CHAR8  *mFvbAlignmentName[] = {
>EFI_FVB2_ALIGNMENT_2G_STRING
>  };
> 
> -//
> -// This data array will be located at the base of the Firmware Volume
Header
> (FVH)
> -// in the boot block.  It must not exceed 14 bytes of code.  The last 2
bytes
> -// will be used to keep the FVH checksum consistent.
> -// This code will be run in response to a startup IPI for HT-enabled
systems.
> -//
> -#define SIZEOF_STARTUP_DATA_ARRAY 0x10
> -
> -UINT8
> m128kRecoveryStartupApDataArray[SIZEOF_STARTUP_DATA_ARRAY] = {
> -  //
> -  // EA D0 FF 00 F0   ; far jmp F000:FFD0
> -  // 0, 0, 0, 0, 0, 0, 0, 0, 0,   ; Reserved bytes
> -  // 0, 0 ; Checksum Padding
> -  //
> -  0xEA,
> -  0xD0,
> -  0xFF,
> -  0x0,
> -  0xF0,
> -  0x00,
> -  0x00,
> -  0x00,
> -  0x00,
> -  0x00,
> -  0x00,
> -  0x00,
> -  0x00,
> -  0x00,
> -  0x00,
> -  0x00
> -};
> -
> -UINT8
> m64kRecoveryStartupApDataArray[SIZEOF_STARTUP_DATA_ARRAY] = {
> -  //
> -  // EB CE   ; jmp short ($-0x30)
> -  // ; (from offset 0x0 to offset 0xFFD0)
> -  // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ; Reserved bytes
> -  // 0, 0; Checksum Padding
> -  //
> -  0xEB,
> -  0xCE,
> -  0x00,
> -  0x00,
> -  0x00,
> -  0x00,
> -  0x00,
> -  0x00,
> -  0x00,
> -  0x00,
> -  0x00,
> -  0x00,
> -  0x00,
> -  0x00,
> -  0x00,
> -  0x00
> -};
> -
>  FV_INFO mFvDataInfo;
>  CAP_INFOmCapDataInfo;
>  BOOLEAN mIsLargeFfs = FALSE;
> @@ -1568,12 +1511,6 @@ Returns:
>EFI_PHYSICAL_ADDRESS  SecCorePhysicalAddress;
>INT32 Ia32SecEntryOffset;
>UINT32*Ia32ResetAddressPtr;
> -  UINT8 *BytePointer;
> -  UINT8 *BytePointer2;
> -  UINT16*WordPointer;
> -  UINT16CheckSum;
> -  UINT32IpiVector;
> -  UINTN Index;
>EFI_FFS_FILE_STATESavedState;
>BOOLEAN   Vtf0Detected;
>UINT32FfsHeaderSize;
> @@ -1745,65 +1682,6 @@ if (MachineType == IMAGE_FILE_MACHINE_I386
> || MachineType == IMAGE_FILE_MACHINE_
>  Ia32ResetAddressPtr   = (UINT32 *) ((UINTN) FvImage->Eof - 4);
>  *Ia32ResetAddressPtr  = (UINT32) (FvInfo->BaseAddress);
>  DebugMsg (NULL, 0, 9, "update BFV base address in the top FV image",
> "BFV base address = 0x%llX.", (unsigned long long) FvInfo->BaseAddress);
> -
> -//
> -// Update the Startup AP in the FVH header block ZeroVector region.
> -//
> -BytePointer   = (UINT8 *) ((UINTN) FvImage->FileImage);
> -if (FvInfo->Size <= 0x1) {
> -  BytePointer2 = m64kRecoveryStartupApDataArray;
> -} else if (FvInfo->Size <= 0x2) {
> -  BytePointer2 = m128kRecoveryStartupApDataArray;
> -} else {
> -  BytePointer2 = m128kRecoveryStartupApDataArray;
> -  //
> -  // Find the position to place Ap reset vector, the offset
> -  // between the position and the end of Fvrecovery.fv file
> -  // should not exceed 128kB to prevent Ap reset vector from
> -  // outside legacy E and F segment
> -  //
> -  Status = FindApResetVectorPosition (FvImage, &BytePointer);
> -  if (EFI_ERROR (Status)) {
> -Error (NULL, 0, 3000, "Invalid", "FV image does not have enough
> space to place AP reset vector. The FV image needs to reserve at least 4KB
of
> unused space.");
> -return EFI_ABORTED;
> -  }
> -}
> -
> -for (Index = 0; Index < SIZEOF_STARTUP_DATA_ARRAY; Index++) {
> -  BytePointer[Index] = BytePointer2[Index];
> -}
> -//
> -// Calculate the checksum
> -//
> -CheckSum  = 0x;
> -WordPointer = (UINT16 *

Re: [edk2-devel] [PATCH V1] OvmfPkg/PeilessStartupLib: Updated with PcdSecureBootSupported

2023-07-10 Thread Gerd Hoffmann
On Mon, Jul 10, 2023 at 06:05:39PM +0800, sunceping wrote:
> SECURE_BOOT_FEATURE_ENABLED was dropped by the commit(92da8a154f), but the
> PeilessStartupLib was not updated with PcdSecureBootSupported, that made
> SecureBoot no longer work in IntelTdxX64.
> 
> Fix this by replacing SECURE_BOOT_FEATURE_ENABLED with
> PcdSecureBootSupported in PeilessStartupLib.
> 
> Cc: Erdem Aktas 
> Cc: James Bottomley 
> Cc: Jiewen Yao 
> Cc: Gerd Hoffmann 
> Cc: Min Xu 
> Cc: Tom Lendacky 
> Cc: Michael Roth 
> Signed-off-by: Ceping Sun 

Acked-by: Gerd Hoffmann 



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




[edk2-devel] [PATCH V1] OvmfPkg/PeilessStartupLib: Updated with PcdSecureBootSupported

2023-07-10 Thread sunceping
SECURE_BOOT_FEATURE_ENABLED was dropped by the commit(92da8a154f), but the
PeilessStartupLib was not updated with PcdSecureBootSupported, that made
SecureBoot no longer work in IntelTdxX64.

Fix this by replacing SECURE_BOOT_FEATURE_ENABLED with
PcdSecureBootSupported in PeilessStartupLib.

Cc: Erdem Aktas 
Cc: James Bottomley 
Cc: Jiewen Yao 
Cc: Gerd Hoffmann 
Cc: Min Xu 
Cc: Tom Lendacky 
Cc: Michael Roth 
Signed-off-by: Ceping Sun 
---
 OvmfPkg/Library/PeilessStartupLib/PeilessStartup.c  | 6 +++---
 OvmfPkg/Library/PeilessStartupLib/PeilessStartupLib.inf | 1 +
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/OvmfPkg/Library/PeilessStartupLib/PeilessStartup.c 
b/OvmfPkg/Library/PeilessStartupLib/PeilessStartup.c
index 164aa2d619..1632a23177 100644
--- a/OvmfPkg/Library/PeilessStartupLib/PeilessStartup.c
+++ b/OvmfPkg/Library/PeilessStartupLib/PeilessStartup.c
@@ -82,9 +82,9 @@ InitializePlatform (
 
   VariableStore  = 
PlatformReserveEmuVariableNvStore ();
   PlatformInfoHob->PcdEmuVariableNvStoreReserved = 
(UINT64)(UINTN)VariableStore;
- #ifdef SECURE_BOOT_FEATURE_ENABLED
-  PlatformInitEmuVariableNvStore (VariableStore);
- #endif
+  if (FeaturePcdGet (PcdSecureBootSupported)) {
+PlatformInitEmuVariableNvStore (VariableStore);
+  }
 
   if (TdIsEnabled ()) {
 PlatformTdxPublishRamRegions ();
diff --git a/OvmfPkg/Library/PeilessStartupLib/PeilessStartupLib.inf 
b/OvmfPkg/Library/PeilessStartupLib/PeilessStartupLib.inf
index 7719b5031d..585d504637 100644
--- a/OvmfPkg/Library/PeilessStartupLib/PeilessStartupLib.inf
+++ b/OvmfPkg/Library/PeilessStartupLib/PeilessStartupLib.inf
@@ -83,3 +83,4 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdNullPointerDetectionPropertyMask## 
CONSUMES
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvBase
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvSize
+  gUefiOvmfPkgTokenSpaceGuid.PcdSecureBootSupported
-- 
2.34.1



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




Re: [edk2-devel] 回复: [PATCH 3/4] BaseTools/tools_def: Add CLANGDWARF support for RISC-V

2023-07-10 Thread Sunil V L
Hi Liming,

On Mon, Jul 10, 2023 at 09:52:18AM +0800, gaoliming via groups.io wrote:
> Sunil:
>   I add my comments below. 
> 
> > -邮件原件-
> > 发件人: Sunil V L 
> > 发送时间: 2023年7月3日 16:09
> > 收件人: devel@edk2.groups.io
> > 抄送: Sunil V L ; Rebecca Cran
> > ; Liming Gao ; Bob Feng
> > ; Yuwei Chen ; Ard
> > Biesheuvel 
> > 主题: [PATCH 3/4] BaseTools/tools_def: Add CLANGDWARF support for
> > RISC-V
> > 
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4478
> > 
> > Add tools_def definitions to support CLANGDWARF toolchain
> > for RISC-V. This uses clang and the llvm LLD linker. This
> > helps people by not requiring to install multiple
> > cross compilers for different architectures.
> > 
> > Cc: Rebecca Cran 
> > Cc: Liming Gao 
> > Cc: Bob Feng 
> > Cc: Yuwei Chen 
> > Cc: Ard Biesheuvel 
> > 
> > Signed-off-by: Sunil V L 
> > ---
> >  BaseTools/Conf/tools_def.template | 52
> > +++
> >  1 file changed, 52 insertions(+)
> > 
> > diff --git a/BaseTools/Conf/tools_def.template
> > b/BaseTools/Conf/tools_def.template
> > index 90f4105506e5..47d8c379d9f2 100755
> > --- a/BaseTools/Conf/tools_def.template
> > +++ b/BaseTools/Conf/tools_def.template
> > @@ -745,6 +745,7 @@ DEFINE GCC_LOONGARCH64_CC_FLAGS=
> > DEF(GCC_ALL_CC_FLAGS) -mabi=lp64d -fno-asyn
> >  DEFINE GCC_ARM_CC_XIPFLAGS = -mno-unaligned-access
> >  DEFINE GCC_AARCH64_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS)
> > -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char
> > -ffunction-sections -fdata-sections -Wno-address
> > -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-pic -fno-pie
> > -ffixed-x18
> >  DEFINE GCC_AARCH64_CC_XIPFLAGS = -mstrict-align
> > -mgeneral-regs-only
> > +DEFINE GCC_RISCV64_CC_XIPFLAGS = -mstrict-align
> > -mgeneral-regs-only
> >  DEFINE GCC_DLINK_FLAGS_COMMON  = -nostdlib --pie
> >  DEFINE GCC_DLINK2_FLAGS_COMMON =
> > -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
> >  DEFINE GCC_IA32_X64_DLINK_COMMON   =
> > DEF(GCC_DLINK_FLAGS_COMMON) --gc-sections
> > @@ -2023,6 +2024,57 @@ DEFINE CLANGDWARF_AARCH64_DLINK_FLAGS
> > = DEF(CLANGDWARF_AARCH64_TARGET) DEF(GCC_
> >  RELEASE_CLANGDWARF_AARCH64_CC_FLAGS=
> > DEF(CLANGDWARF_AARCH64_CC_FLAGS) $(PLATFORM_FLAGS) -flto -O3
> >  RELEASE_CLANGDWARF_AARCH64_DLINK_FLAGS =
> > DEF(CLANGDWARF_AARCH64_DLINK_FLAGS) -flto -Wl,-O3 -fuse-ld=lld
> > -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-aarch64
> > -Wl,-plugin-opt=-pass-through=-llto-aarch64 -Wl,--no-pie,--no-relax
> > 
> > +##
> > +# CLANGDWARF RISCV64 definitions
> > +##
> > +DEFINE CLANGDWARF_RISCV64_TARGET= -target riscv64-linux-gnu
> > +DEFINE CLANGDWARF_RISCV64_CC_FLAGS  =
> > DEF(GCC5_RISCV64_CC_FLAGS) DEF(CLANGDWARF_RISCV64_TARGET)
> > DEF(CLANGDWARF_WARNING_OVERRIDES)
> > +
> > +# This is similar to GCC flags but without -n
> > +DEFINE CLANGDWARF_RISCV64_ALL_DLINK_COMMON  = -nostdlib
> > -Wl,-q,--gc-sections -z common-page-size=0x40
> > +DEFINE CLANGDWARF_RISCV64_ALL_DLINK_FLAGS   =
> > DEF(CLANGDWARF_RISCV64_ALL_DLINK_COMMON)
> > -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT)
> > -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map
> > +DEFINE CLANGDWARF_RISCV64_DLINK_FLAGS   =
> > DEF(CLANGDWARF_RISCV64_TARGET)
> > DEF(CLANGDWARF_RISCV64_ALL_DLINK_FLAGS)
> > -Wl,-melf64lriscv,--oformat=elf64-littleriscv,--no-relax
> > +
> > +*_CLANGDWARF_RISCV64_PP_FLAGS   = DEF(GCC_PP_FLAGS)
> > +*_CLANGDWARF_RISCV64_ASLCC_FLAGS= DEF(GCC_ASLCC_FLAGS)
> > +*_CLANGDWARF_RISCV64_APP_FLAGS  =
> > +*_CLANGDWARF_RISCV64_ASL_FLAGS  = DEF(IASL_FLAGS)
> > +*_CLANGDWARF_RISCV64_ASL_OUTFLAGS   = DEF(IASL_OUTFLAGS)
> > +*_CLANGDWARF_RISCV64_DTCPP_FLAGS= DEF(GCC_DTCPP_FLAGS)
> > +*_CLANGDWARF_RISCV64_DEPS_FLAGS = DEF(GCC_DEPS_FLAGS)
> > +
> > +*_CLANGDWARF_RISCV64_CC_PATH=
> > ENV(CLANGDWARF_BIN)clang
> > +*_CLANGDWARF_RISCV64_ASM_PATH   =
> > ENV(CLANGDWARF_BIN)clang
> > +*_CLANGDWARF_RISCV64_PP_PATH=
> > ENV(CLANGDWARF_BIN)clang
> > +*_CLANGDWARF_RISCV64_VFRPP_PATH =
> > ENV(CLANGDWARF_BIN)clang
> > +*_CLANGDWARF_RISCV64_ASLCC_PATH =
> > ENV(CLANGDWARF_BIN)clang
> > +*_CLANGDWARF_RISCV64_ASLPP_PATH =
> > ENV(CLANGDWARF_BIN)clang
> > +*_CLANGDWARF_RISCV64_DLINK_PATH =
> > ENV(CLANGDWARF_BIN)clang
> > +*_CLANGDWARF_RISCV64_ASLDLINK_PATH  =
> > ENV(CLANGDWARF_BIN)clang
> > +
> > +*_CLANGDWARF_RISCV64_SLINK_PATH =
> > ENV(CLANGDWARF_BIN)llvm-ar
> > +*_CLANGDWARF_RISCV64_RC_PATH=
> > ENV(CLANGDWARF_BIN)llvm-objcopy
> > +
> > +*_CLANGDWARF_RISCV64_ASLCC_FLAGS= DEF(GCC_ASLCC_FLAGS)
> > -flto
> Here should be -fno-lto. This option should be same for the different ARCHs.
> 
> 
> > +*_CLANGDWARF_RISCV64_ASLDLINK_FLAGS =
> > DEF(CLANGDWARF_RISCV64_TARGET)
> > DEF(GCC5_RISCV32_RISCV64_ASLDLINK_FLAGS)
> > +*_CLANGDWARF_RISCV64_ASM_FLAGS  = DEF(GCC_ASM_FLAGS)
> > DEF(CLANGDWARF_RISCV64_TARGET) $(PLATFORM_FLAGS)
> > -Qunused-arguments  -mabi=lp64 -mno-relax -flto
> 
>