Re: [edk2-devel] [PATCH v8 9/9] OvmfPkg: Uses SmmSmramSaveStateLib library

2023-04-17 Thread Ni, Ray
Abdul,
What prevents you implementing the OVMF version MmSaveStateLib?
Or I assume OVMF is emulating AMD CPU, why AMD version MmSaveStateLib cannot 
support OVMF?

Thanks,
Ray

From: Attar, AbdulLateef (Abdul Lateef) 
Sent: Tuesday, April 18, 2023 1:22 PM
To: Ni, Ray ; devel@edk2.groups.io; kra...@redhat.com
Cc: Grimes, Paul ; Kirkendall, Garrett 
; Chang, Abner ; Dong, Eric 
; Kumar, Rahul R ; Ard Biesheuvel 
; Yao, Jiewen ; Justen, Jordan 
L 
Subject: RE: [edk2-devel] [PATCH v8 9/9] OvmfPkg: Uses SmmSmramSaveStateLib 
library


[AMD Official Use Only - General]

Hi Ray,
From open-source code I can see OVMF still implements 
SmmCpuFeaturesReadSaveStateRegister.
Hence, we can't directly use SmramSaveStateReadRegister in PiSmmCpuDxe driver,
until we implement the MmSaveStateLib for Ovmf.
I think it's better to keep the code as it is, so that we will not break any 
open-source or closed-source project.

Thanks
AbduL


From: Ni, Ray mailto:ray...@intel.com>>
Sent: 11 April 2023 18:19
To: Attar, AbdulLateef (Abdul Lateef) 
mailto:abdullateef.at...@amd.com>>; 
devel@edk2.groups.io; 
kra...@redhat.com
Cc: Grimes, Paul mailto:paul.gri...@amd.com>>; Kirkendall, 
Garrett mailto:garrett.kirkend...@amd.com>>; Chang, 
Abner mailto:abner.ch...@amd.com>>; Dong, Eric 
mailto:eric.d...@intel.com>>; Kumar, Rahul R 
mailto:rahul.r.ku...@intel.com>>; Ard Biesheuvel 
mailto:ardb+tianoc...@kernel.org>>; Yao, Jiewen 
mailto:jiewen@intel.com>>; Justen, Jordan L 
mailto:jordan.l.jus...@intel.com>>
Subject: Re: [edk2-devel] [PATCH v8 9/9] OvmfPkg: Uses SmmSmramSaveStateLib 
library


[AMD Official Use Only - General]

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

yes

thanks,
ray

From: Attar, AbdulLateef (Abdul Lateef) 
mailto:abdullateef.at...@amd.com>>
Sent: Tuesday, April 11, 2023 7:17:03 PM
To: Ni, Ray mailto:ray...@intel.com>>; 
devel@edk2.groups.io 
mailto:devel@edk2.groups.io>>; 
kra...@redhat.com 
mailto:kra...@redhat.com>>
Cc: Grimes, Paul mailto:paul.gri...@amd.com>>; Kirkendall, 
Garrett mailto:garrett.kirkend...@amd.com>>; Chang, 
Abner mailto:abner.ch...@amd.com>>; Dong, Eric 
mailto:eric.d...@intel.com>>; Kumar, Rahul R 
mailto:rahul.r.ku...@intel.com>>; Ard Biesheuvel 
mailto:ardb+tianoc...@kernel.org>>; Yao, Jiewen 
mailto:jiewen@intel.com>>; Justen, Jordan L 
mailto:jordan.l.jus...@intel.com>>
Subject: RE: [edk2-devel] [PATCH v8 9/9] OvmfPkg: Uses SmmSmramSaveStateLib 
library

[AMD Official Use Only - General]

Hi Ray,
You mean directly call the SmramSaveStateReadRegister instead of below 
code from edk2/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c ?

  Status = SmmCpuFeaturesReadSaveStateRegister (CpuIndex, Register, Width, 
Buffer);
  if (Status == EFI_UNSUPPORTED) {
Status = SmramSaveStateReadRegister (CpuIndex, Register, Width, Buffer);
  }

Thanks
AbduL

-Original Message-
From: Ni, Ray mailto:ray...@intel.com>>
Sent: 11 April 2023 15:40
To: devel@edk2.groups.io; 
kra...@redhat.com; Attar, AbdulLateef (Abdul Lateef) 
mailto:abdullateef.at...@amd.com>>
Cc: Attar, AbdulLateef (Abdul Lateef) 
mailto:abdullateef.at...@amd.com>>; Grimes, Paul 
mailto:paul.gri...@amd.com>>; Kirkendall, Garrett 
mailto:garrett.kirkend...@amd.com>>; Chang, Abner 
mailto:abner.ch...@amd.com>>; Dong, Eric 
mailto:eric.d...@intel.com>>; Kumar, Rahul R 
mailto:rahul.r.ku...@intel.com>>; Ard Biesheuvel 
mailto:ardb+tianoc...@kernel.org>>; Yao, Jiewen 
mailto:jiewen@intel.com>>; Justen, Jordan L 
mailto:jordan.l.jus...@intel.com>>
Subject: RE: [edk2-devel] [PATCH v8 9/9] OvmfPkg: Uses SmmSmramSaveStateLib 
library

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


Gerd,
I am asking Abdul to directly call SaveStateLib from CpuSmm driver.
I don't think SmmCpuFeaturesLib should be in the middle of CpuSmm driver and 
SaveStateLib regarding the save state access.

Thanks,
Ray

> -Original Message-
> From: devel@edk2.groups.io 
> mailto:devel@edk2.groups.io>> On Behalf Of Gerd
> Hoffmann
> Sent: Tuesday, April 11, 2023 5:43 PM
> To: Abdul Lateef Attar mailto:abdat...@amd.com>>
> Cc: devel@edk2.groups.io; Abdul Lateef Attar
> mailto:abdullateef.at...@amd.com>>; Paul Grimes 
> mailto:paul.gri...@amd.com>>;
> Garrett Kirkendall 
> mailto:garrett.kirkend...@amd.com>>; Abner Chang
> mailto:abner.ch...@amd.com>>; Dong, Eric 
> mailto:eric.d...@intel.com>>; Ni, Ray
> mailto:ray...@intel.com>>; Kumar, Rahul R 
> mailto:rahul.r.ku...@intel.com>>; Ard
> Biesheuvel mailto:ardb+tianoc...@kernel.org>>; 
> Yao, Jiewen
> mailto:jiewen@intel.com>>; Justen, Jordan L 
> 

Re: [edk2-devel] [edk2][PATCH v2 1/1] MdeModulePkg: Add EDKII Platform Boot Manager Protocol v2

2023-04-17 Thread Tinh Nguyen via groups.io

Hi Ray,

Many thanks for your feedback.

Yes, but it is just for Boot Options that are automatically created by 
BDS. If users/OS input 2, 3, 4 … boot options without option data 
(mBmAutoCreateBootOptionGuid), the RefreshAllBootOptions() API should 
not modify/delete them, right? Users will be confused when their Boot 
Options change. And I also cannot sort them.


And the RefreshAllBootOptions() API just provides a Boot Options List; 
it doesn’t directly write those to NVRAM. BDS has its rules and then 
selects a Boot option from that list to write into NVRAM.
After BDS has done its work, we can confirm what exact boot options we 
have. This is a suitable time to sort the Boot Options and write this 
sorting to the BootOrder.


Another aspect is that trying to put everything into the 
RefreshAllBootOptions() API makes this function very complex and hard to 
maintain.


Please, let me know your idea.

Thanks

-Tinh


On 4/18/2023 8:24 AM, Ni, Ray wrote:

RefreshAllBootOptions() API internally can keep an ordering rule so that 
platform-level-higher-priority boot options are before
those platform-level-lower-priority options.

So, that means, you could only change RefreshAllOptions() implementation to 
control the order without adding a new API.

Thanks,
ray


-Original Message-
From: devel@edk2.groups.io  On Behalf Of Tinh
Nguyen via groups.io
Sent: Tuesday, April 11, 2023 1:35 AM
To: devel@edk2.groups.io; tinhngu...@os.amperecomputing.com
Cc: patc...@amperecomputing.com; n...@os.amperecomputing.com;
chu...@os.amperecomputing.com;
minhngu...@os.amperecomputing.com; Wang, Jian J
; Gao, Liming ; Gao,
Zhichao ; Ni, Ray ;
rebe...@bsdio.com
Subject: Re: [edk2-devel] [edk2][PATCH v2 1/1] MdeModulePkg: Add EDKII
Platform Boot Manager Protocol v2

Gentle ping, I’m looking for some feedback on this patch. Could someone
please help me to review it?

On 4/6/2023 3:19 PM, Tinh Nguyen via groups.io wrote:

This introduces the

EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_REVISION2,

which adds a new UpdateBootOrder() function to support customizing
the boot options order according to the platform-specific policy.

Signed-off-by: Tinh Nguyen 
---

Changes since v1: Correct the format of the email.

   MdeModulePkg/Include/Protocol/PlatformBootManager.h | 24

+++-

   MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c|  9 
   2 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Include/Protocol/PlatformBootManager.h

b/MdeModulePkg/Include/Protocol/PlatformBootManager.h

index e527b0ee0eaf..758bc2deb774 100644
--- a/MdeModulePkg/Include/Protocol/PlatformBootManager.h
+++ b/MdeModulePkg/Include/Protocol/PlatformBootManager.h
@@ -1,6 +1,7 @@
   /** @file

 Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
+  Copyright (c) 2023, Ampere Computing LLC. All rights reserved.

 SPDX-License-Identifier: BSD-2-Clause-Patent

@@ -29,7 +30,8 @@ typedef struct

_EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL
EDKII_PLATFORM_BOOT_MANAGER

   //  All future revisions must be backwards compatible.
   //  If a future version is not back wards compatible it is not the 
same

GUID.

   //
-#define EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_REVISION

0x0001

+#define EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_REVISION

0x0001

+#define EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_REVISION2

0x0002

   //
   // Function Prototypes
@@ -72,9 +74,29 @@ EFI_STATUS
 OUT   UINTN*UpdatedBootOptionsCount
 );

+/**
+  This function allows platform to update the DriverOrder/BootOrder

variables.

+  And it is available from version 2 of the EDKII Platform Boot Manager

protocol.

+
+  @retval EFI_SUCCESS  Platform successfully modifies
+   the DriverOrder/BootOrder variables as wanted.
+  @retval Others   There are some errors that happen. Check the status

code

+   for details.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PLATFORM_BOOT_MANAGER_UPDATE_BOOT_ORDER)(
+  IN VOID
+  );
+
   struct _EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL {
 UINT64Revision;
 PLATFORM_BOOT_MANAGER_REFRESH_ALL_BOOT_OPTIONS

RefreshAllBootOptions;

+  //
+  // EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_REVISION2
+  //
+  PLATFORM_BOOT_MANAGER_UPDATE_BOOT_ORDER

UpdateBootOrder;

   };

   extern EFI_GUID  gEdkiiPlatformBootManagerProtocolGuid;
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c

b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c

index bde22fa6590e..67d1d54b3c24 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -4,6 +4,7 @@
   Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
   Copyright (c) 2011 - 2021, Intel Corporation. All rights reserved.
   (C) Copyright 2015-2021 Hewlett Packard Enterprise Development LP
+Copyright (c) 2023, Ampere Computing LLC. All rights reserved.
   

Re: [edk2-devel] [PATCH] MdePkg/Include: Add DMTF PLDM Base definitions

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

Hi Maintainers,
Please review this.
Thanks
Abner

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Chang,
> Abner via groups.io
> Sent: Sunday, April 2, 2023 9:52 AM
> To: devel@edk2.groups.io
> Cc: Michael D Kinney ; Liming Gao
> ; Zhiguang Liu ; Nickle
> Wang ; Igor Kulchytskyy ; Isaac
> Oram ; Attar, AbdulLateef (Abdul Lateef)
> 
> Subject: [edk2-devel] [PATCH] MdePkg/Include: Add DMTF PLDM Base
> definitions
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> From: Abner Chang 
> 
> BZ #4396
> This change adds definitions for DMTF PLDM base specification.
> 
> Spec ref:
> https://www.dmtf.org/sites/default/files/standards/documents/DSP0240_1
> .1.0.pdf
> 
> Signed-off-by: Abner Chang 
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> Cc: Zhiguang Liu 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> Cc: Isaac Oram 
> Cc: Abdul Lateef Attar 
> ---
>  MdePkg/Include/IndustryStandard/Pldm.h | 81
> ++
>  1 file changed, 81 insertions(+)
>  create mode 100644 MdePkg/Include/IndustryStandard/Pldm.h
> 
> diff --git a/MdePkg/Include/IndustryStandard/Pldm.h
> b/MdePkg/Include/IndustryStandard/Pldm.h
> new file mode 100644
> index 000..82d65b71874
> --- /dev/null
> +++ b/MdePkg/Include/IndustryStandard/Pldm.h
> @@ -0,0 +1,81 @@
> +/**
> +  The definitions of DMTF Platform Level Data Model (PLDM)
> +  Base Specification.
> +
> +  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +  @par Revision Reference:
> +  DMTF Platform Level Data Model (PLDM) Base Specification  Version
> + 1.1.0
> +
> https://www.dmtf.org/sites/default/files/standards/documents/DSP0240_1
> + .1.0.pdf
> +
> +**/
> +
> +#ifndef PLDM_H_
> +#define PLDM_H_
> +
> +#pragma pack(1)
> +
> +#define PLDM_MESSAGE_HEADER_VERSION  0
> +
> +///
> +/// General definitions from Platform Level Data Model (PLDM) Base ///
> +Specification (DMTF DSP0240) /// typedef struct  {
> +  UINT8InstanceId: 5;  ///< Request instance ID.
> +  UINT8Reserved  : 1;  ///< Reserved bit.
> +  UINT8DatagramBit   : 1;  ///< used to indicate whether the 
> Instance
> ID field is
> +   ///< being used for tracking and 
> matching requests and
> +   ///< responses, or just being used 
> for asynchronous
> +   ///< notifications.
> +  UINT8RequestBit: 1;  ///< Request bit.
> +  UINT8PldmType  : 6;  ///< PLDM message type.
> +  UINT8HeaderVersion : 2;  ///< Header version.
> +  UINT8PldmTypeCommandCode;///< The command code of PLDM
> message type.
> +} PLDM_MESSAGE_HEADER;
> +
> +typedef PLDM_MESSAGE_HEADER PLDM_REQUEST_HEADER;
> +
> +#define PLDM_MESSAGE_HEADER_IS_REQUEST1
> +#define PLDM_MESSAGE_HEADER_IS_DATAGRAM   1
> +#define PLDM_MESSAGE_HEADER_INSTANCE_ID_MASK  0x1f
> +
> +typedef struct {
> +  PLDM_MESSAGE_HEADERPldmHeader;
> +  UINT8  PldmCompletionCode;   ///< PLDM completion  of 
> response
> message.
> +} PLDM_RESPONSE_HEADER;
> +
> +#pragma pack()
> +
> +#define PLDM_HEADER_VERSION  0x00
> +
> +#define PLDM_COMPLETION_CODE_SUCCESS 0x00
> +#define PLDM_COMPLETION_CODE_ERROR   0x01
> +#define PLDM_COMPLETION_CODE_ERROR_INVALID_DATA  0x02
> +#define PLDM_COMPLETION_CODE_ERROR_INVALID_LENGTH0x03
> +#define PLDM_COMPLETION_CODE_ERROR_NOT_READY 0x04
> +#define PLDM_COMPLETION_CODE_ERROR_UNSUPPORTED_PLDM_CMD
> 0x05
> +#define PLDM_COMPLETION_CODE_ERROR_INVALID_PLDM_TYPE 0x20
> +#define PLDM_COMPLETION_CODE_SPECIFIC_START  0x80
> +#define PLDM_COMPLETION_CODE_SPECIFIC_END0xff
> +
> +///
> +/// Type Code definitions from Platform Level Data Model (PLDM) IDs ///
> +and Codes Specification (DMTF DSP0245) ///
> +https://www.dmtf.org/sites/default/files/standards/documents/DSP0245_
> 1.
> +3.0.pdf
> +///
> +#define PLDM_TYPE_MESSAGE_CONTROL_AND_DISCOVERY0x00
> +#define PLDM_TYPE_SMBIOS   0x01
> +#define PLDM_TYPE_PLATFORM_MONITORING_AND_CONTROL  0x02
> +#define PLDM_TYPE_BIOS_CONTROL_AND_CONFIGURATION   0x03
> +
> +#define PLDM_TRANSFER_FLAG_START  0x01
> +#define PLDM_TRANSFER_FLAG_MIDDLE 0x02
> +#define PLDM_TRANSFER_FLAG_END0x04
> +#define PLDM_TRANSFER_FLAG_START_AND_END  0x05
> +
> +#define PLDM_TRANSFER_OPERATION_FLAG_GET_NEXT_PART   0x00
> +#define PLDM_TRANSFER_OPERATION_FLAG_GET_FIRST_PART  0x01
> #endif //
> +PLDM_H_
> --
> 2.37.1.windows.1
> 
> 
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103129): https://edk2.groups.io/g/devel/message/103129
Mute This Topic: 

Re: [edk2-devel] [PATCH] MdePkg/Include: Add DMTF PLDM SMBIOS definitions

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

Hi Maintainers,
Please review this.
Thanks
Abner

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Chang,
> Abner via groups.io
> Sent: Sunday, April 2, 2023 9:57 AM
> To: devel@edk2.groups.io
> Cc: Michael D Kinney ; Liming Gao
> ; Zhiguang Liu ; Nickle
> Wang ; Igor Kulchytskyy ; Isaac
> Oram ; Attar, AbdulLateef (Abdul Lateef)
> 
> Subject: [edk2-devel] [PATCH] MdePkg/Include: Add DMTF PLDM SMBIOS
> definitions
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> From: Abner Chang 
> 
> BZ #4396
> This change adds definitions for DMTF PLDM SMBIOS Transfer specification.
> 
> Spec ref:
> https://www.dmtf.org/sites/default/files/standards/documents/DSP0246_1
> .0.1.pdf
> 
> Signed-off-by: Abner Chang 
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> Cc: Zhiguang Liu 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> Cc: Isaac Oram 
> Cc: Abdul Lateef Attar 
> ---
>  .../IndustryStandard/PldmSmbiosTransfer.h | 182 ++
>  1 file changed, 182 insertions(+)
>  create mode 100644
> MdePkg/Include/IndustryStandard/PldmSmbiosTransfer.h
> 
> diff --git a/MdePkg/Include/IndustryStandard/PldmSmbiosTransfer.h
> b/MdePkg/Include/IndustryStandard/PldmSmbiosTransfer.h
> new file mode 100644
> index 000..2fcbe116abe
> --- /dev/null
> +++ b/MdePkg/Include/IndustryStandard/PldmSmbiosTransfer.h
> @@ -0,0 +1,182 @@
> +/**
> +  The definitions of DMTF Platform Level Data Model (PLDM)
> +  SMBIOS Transfer Specification.
> +
> +  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +  @par Revision Reference:
> +  DMTF Platform Level Data Model (PLDM) SMBIOS Transfer Specification
> + Version 1.0.1
> +
> https://www.dmtf.org/sites/default/files/standards/documents/DSP0246_1
> + .0.1.pdf
> +
> +**/
> +
> +#ifndef PLDM_SMBIOS_H_
> +#define PLDM_SMBIOS_H_
> +
> +#include 
> +
> +#pragma pack(1)
> +
> +///
> +/// Smbios-related definitions from PLDM for SMBIOS Transfer ///
> +Specification (DMTF DSP0246) /// #define
> +PLDM_GET_SMBIOS_STRUCTURE_TABLE_METADATA_COMMAND_CODE
> 0x01 #define
> +PLDM_SET_SMBIOS_STRUCTURE_TABLE_METADATA_COMMAND_CODE
> 0x02
> +#define PLDM_GET_SMBIOS_STRUCTURE_TABLE_COMMAND_CODE
> 0x03
> +#define PLDM_SET_SMBIOS_STRUCTURE_TABLE_COMMAND_CODE
> 0x04
> +#define PLDM_GET_SMBIOS_STRUCTURE_BY_TYPE_COMMAND_CODE
> 0x05
> +#define PLDM_GET_SMBIOS_STRUCTURE_BY_HANDLE_COMMAND_CODE
> 0x06
> +
> +///
> +/// PLDM SMBIOS transfer command specific completion code.
> +///
> +#define PLDM_COMPLETION_CODE_INVALID_DATA_TRANSFER_HANDLE
> 0x80
> +#define
> PLDM_COMPLETION_CODE_INVALID_TRANSFER_OPERATION_FLAG 0x81
> +#define PLDM_COMPLETION_CODE_INVALID_TRANSFER_FLAG
> 0x82
> +#define
> PLDM_COMPLETION_CODE_NO_SMBIOS_STRUCTURE_TABLE_METADATA
> 0x83
> +#define PLDM_COMPLETION_CODE_INVALID_DATA_INTEGRITY_CHECK
> 0x84
> +#define
> PLDM_COMPLETION_CODE_SMBIOS_STRUCTURE_TABLE_UNAVAILABLE
> 0x85
> +
> +///
> +/// Get SMBIOS Structure Table Metadata Response.
> +///
> +typedef struct {
> +  UINT8 SmbiosMajorVersion;
> +  UINT8 SmbiosMinorVersion;
> +  UINT16MaximumStructureSize;
> +  UINT16SmbiosStructureTableLength;
> +  UINT16NumberOfSmbiosStructures;
> +  UINT32SmbiosStructureTableIntegrityChecksum;
> +} PLDM_SMBIOS_STRUCTURE_TABLE_METADATA;
> +
> +typedef struct {
> +  PLDM_RESPONSE_HEADERResponseHeader;
> +  PLDM_SMBIOS_STRUCTURE_TABLE_METADATA
> SmbiosStructureTableMetadata;
> +}
> PLDM_GET_SMBIOS_STRUCTURE_TABLE_METADATA_RESPONSE_FORMAT;
> +
> +///
> +/// Set SMBIOS Structure Table Metadata Request.
> +///
> +typedef struct {
> +  PLDM_REQUEST_HEADER RequestHeader;
> +  PLDM_SMBIOS_STRUCTURE_TABLE_METADATA
> SmbiosStructureTableMetadata;
> +} PLDM_SET_SMBIOS_STRUCTURE_TABLE_METADATA_REQUEST_FORMAT;
> +
> +///
> +/// Set SMBIOS Structure Table Metadata Response.
> +///
> +typedef struct {
> +  PLDM_RESPONSE_HEADERResponseHeader;
> +}
> PLDM_SET_SMBIOS_STRUCTURE_TABLE_METADATA_RESPONSE_FORMAT;
> +
> +///
> +/// Get SMBIOS Structure Table Request.
> +///
> +typedef struct {
> +  UINT32DataTransferHandle;
> +  UINT8 TransferOperationFlag;
> +} PLDM_GET_SMBIOS_STRUCTURE_TABLE_REQUEST;
> +
> +typedef struct {
> +  PLDM_REQUEST_HEADERRequestHeader;
> +  PLDM_GET_SMBIOS_STRUCTURE_TABLE_REQUEST
> GetSmbiosStructureTableRequest;
> +} PLDM_GET_SMBIOS_STRUCTURE_TABLE_REQUEST_FORMAT;
> +
> +///
> +/// Get SMBIOS Structure Table Response.
> +///
> +typedef struct {
> +  UINT32NextDataTransferHandle;
> +  UINT8 TransferFlag;
> +  UINT8 Table[0];
> +} PLDM_GET_SMBIOS_STRUCTURE_TABLE_RESPONSE;
> +
> +typedef struct {
> +  PLDM_RESPONSE_HEADERResponseHeader;
> +  PLDM_GET_SMBIOS_STRUCTURE_TABLE_RESPONSE
> GetSmbiosStructureTableResponse;
> +} 

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

2023-04-17 Thread Group Notification
*Reminder: TianoCore Bug Triage - APAC / NAMO*

*When:*
Tuesday, April 18, 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=1868922 )

*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=teams=conf.intel.com=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=46c98d88-e344-4ed4-8496-4ed7712e255d=19_meeting_OTUyZTg2NjgtNDhlNS00ODVlLTllYTUtYzg1OTNjNjdiZjFh@thread.v2=0=en-US
 )


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




Re: [edk2-devel] [edk2][PATCH v2 1/1] MdeModulePkg: Add EDKII Platform Boot Manager Protocol v2

2023-04-17 Thread Ni, Ray
RefreshAllBootOptions() API internally can keep an ordering rule so that 
platform-level-higher-priority boot options are before
those platform-level-lower-priority options.

So, that means, you could only change RefreshAllOptions() implementation to 
control the order without adding a new API.

Thanks,
ray

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Tinh
> Nguyen via groups.io
> Sent: Tuesday, April 11, 2023 1:35 AM
> To: devel@edk2.groups.io; tinhngu...@os.amperecomputing.com
> Cc: patc...@amperecomputing.com; n...@os.amperecomputing.com;
> chu...@os.amperecomputing.com;
> minhngu...@os.amperecomputing.com; Wang, Jian J
> ; Gao, Liming ; Gao,
> Zhichao ; Ni, Ray ;
> rebe...@bsdio.com
> Subject: Re: [edk2-devel] [edk2][PATCH v2 1/1] MdeModulePkg: Add EDKII
> Platform Boot Manager Protocol v2
> 
> Gentle ping, I’m looking for some feedback on this patch. Could someone
> please help me to review it?
> 
> On 4/6/2023 3:19 PM, Tinh Nguyen via groups.io wrote:
> > This introduces the
> EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_REVISION2,
> > which adds a new UpdateBootOrder() function to support customizing
> > the boot options order according to the platform-specific policy.
> >
> > Signed-off-by: Tinh Nguyen 
> > ---
> >
> > Changes since v1: Correct the format of the email.
> >
> >   MdeModulePkg/Include/Protocol/PlatformBootManager.h | 24
> +++-
> >   MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c|  9 
> >   2 files changed, 32 insertions(+), 1 deletion(-)
> >
> > diff --git a/MdeModulePkg/Include/Protocol/PlatformBootManager.h
> b/MdeModulePkg/Include/Protocol/PlatformBootManager.h
> > index e527b0ee0eaf..758bc2deb774 100644
> > --- a/MdeModulePkg/Include/Protocol/PlatformBootManager.h
> > +++ b/MdeModulePkg/Include/Protocol/PlatformBootManager.h
> > @@ -1,6 +1,7 @@
> >   /** @file
> >
> > Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
> > +  Copyright (c) 2023, Ampere Computing LLC. All rights reserved.
> >
> > SPDX-License-Identifier: BSD-2-Clause-Patent
> >
> > @@ -29,7 +30,8 @@ typedef struct
> _EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL
> EDKII_PLATFORM_BOOT_MANAGER
> >   //  All future revisions must be backwards compatible.
> >   //  If a future version is not back wards compatible it is not 
> > the same
> GUID.
> >   //
> > -#define EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_REVISION
> 0x0001
> > +#define EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_REVISION
> 0x0001
> > +#define EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_REVISION2
> 0x0002
> >
> >   //
> >   // Function Prototypes
> > @@ -72,9 +74,29 @@ EFI_STATUS
> > OUT   UINTN*UpdatedBootOptionsCount
> > );
> >
> > +/**
> > +  This function allows platform to update the DriverOrder/BootOrder
> variables.
> > +  And it is available from version 2 of the EDKII Platform Boot Manager
> protocol.
> > +
> > +  @retval EFI_SUCCESS  Platform successfully modifies
> > +   the DriverOrder/BootOrder variables as wanted.
> > +  @retval Others   There are some errors that happen. Check the status
> code
> > +   for details.
> > +
> > +**/
> > +typedef
> > +EFI_STATUS
> > +(EFIAPI *PLATFORM_BOOT_MANAGER_UPDATE_BOOT_ORDER)(
> > +  IN VOID
> > +  );
> > +
> >   struct _EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL {
> > UINT64Revision;
> > PLATFORM_BOOT_MANAGER_REFRESH_ALL_BOOT_OPTIONS
> RefreshAllBootOptions;
> > +  //
> > +  // EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_REVISION2
> > +  //
> > +  PLATFORM_BOOT_MANAGER_UPDATE_BOOT_ORDER
> UpdateBootOrder;
> >   };
> >
> >   extern EFI_GUID  gEdkiiPlatformBootManagerProtocolGuid;
> > diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> > index bde22fa6590e..67d1d54b3c24 100644
> > --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> > +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> > @@ -4,6 +4,7 @@
> >   Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
> >   Copyright (c) 2011 - 2021, Intel Corporation. All rights reserved.
> >   (C) Copyright 2015-2021 Hewlett Packard Enterprise Development LP
> > +Copyright (c) 2023, Ampere Computing LLC. All rights reserved.
> >   SPDX-License-Identifier: BSD-2-Clause-Patent
> >
> >   **/
> > @@ -2412,6 +2413,8 @@ EfiBootManagerRefreshAllBootOption (
> > BootOptions = UpdatedBootOptions;
> > BootOptionCount = UpdatedBootOptionCount;
> >   }
> > +  } else {
> > +PlatformBootManager = NULL;
> > }
> >
> > NvBootOptions = EfiBootManagerGetLoadOptions
> (, LoadOptionTypeBoot);
> > @@ -2453,6 +2456,12 @@ EfiBootManagerRefreshAllBootOption (
> >
> > EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount);
> > EfiBootManagerFreeLoadOptions (NvBootOptions, NvBootOptionCount);
> > +
> > +  if ((PlatformBootManager != NULL) &&
> > +  

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

2023-04-17 Thread Group Notification
*Tools, CI, Code base construction meeting series*

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

*Where:*
https://github.com/tianocore/edk2/discussions/2614

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

*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 (#103125): https://edk2.groups.io/g/devel/message/103125
Mute This Topic: https://groups.io/mt/98332436/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, April 17, 2023 #cal-reminder

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

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

*Where:*
https://github.com/tianocore/edk2/discussions/2614

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

*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 (#103124): https://edk2.groups.io/g/devel/message/103124
Mute This Topic: https://groups.io/mt/98308919/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 1/2] ArmPkg/AsmMacroIoLibV8: Introduce ASM_FUNC_ALIGN()

2023-04-17 Thread Marvin Häuser
With the current ASM_FUNC() macro, there is no good way to declare an
alignment constraint for a function. As ASM_FUNC() switches sections,
declaring the constraint before the macro invocation applies it to the
current location in the previous section. Declaring the constraint after
the macro invocation lets the function label point to the location prior
to alignment. Depending on toolchain behaviour, this may cause the label
to point to alignment padding preceding the actual function definition.

To address these issues, introduce the ASM_FUNC_ALIGN() macro, which
declares the alignment constraint right before the function label.

Signed-off-by: Marvin Häuser 
Cc: Leif Lindholm 
Cc: Ard Biesheuvel 
Cc: Sami Mujawar 
Cc: Vitaly Cheptsov 
---
 ArmPkg/Include/AsmMacroIoLibV8.h | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/ArmPkg/Include/AsmMacroIoLibV8.h b/ArmPkg/Include/AsmMacroIoLibV8.h
index 135aaeca5d0b..81164ea9c9e7 100644
--- a/ArmPkg/Include/AsmMacroIoLibV8.h
+++ b/ArmPkg/Include/AsmMacroIoLibV8.h
@@ -41,8 +41,19 @@
   Name:   ; \
   AARCH64_BTI(c)
 
+#define _ASM_FUNC_ALIGN(Name, Section, Align)   \
+  .global   Name  ; \
+  .section  #Section, "ax"; \
+  .type Name, %function   ; \
+  .balign   Align ; \
+  Name:   ; \
+  AARCH64_BTI(c)
+
 #define ASM_FUNC(Name)  _ASM_FUNC(ASM_PFX(Name), .text. ## Name)
 
+#define ASM_FUNC_ALIGN(Name, Align)  \
+  _ASM_FUNC_ALIGN(ASM_PFX(Name), .text. ## Name, Align)
+
 #define MOV32(Reg, Val)   \
   movz  Reg, (Val) >> 16, lsl #16   ; \
   movk  Reg, (Val) & 0x
-- 
2.40.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103123): https://edk2.groups.io/g/devel/message/103123
Mute This Topic: https://groups.io/mt/98330366/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/2] ArmPkg/ArmMmuLib: Fix ArmReplaceLiveTranslationEntry() alignment

2023-04-17 Thread Marvin Häuser
As the ASM_FUNC() macro performs a section switch, the preceding
.balign directive applies the alignment constraint to the current
location in the previous section. As the linker may not merge the
sections in-order, ArmReplaceLiveTranslationEntry() may be left
unaligned.

Replace the explicit invocation of .balign with the ASM_FUNC_ALIGN()
macro, which guarantees the alignment constraint is applied correctly.

Reviewed-by: Leif Lindholm 
Signed-off-by: Marvin Häuser 
Cc: Leif Lindholm 
Cc: Ard Biesheuvel 
Cc: Sami Mujawar 
Cc: Vitaly Cheptsov 
---
 ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S 
b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S
index e936a5be4e11..7627aeb95464 100644
--- a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S
+++ b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S
@@ -69,17 +69,16 @@
 .L2_\@:
   .endm
 
-  // Align this routine to a log2 upper bound of its size, so that it is
-  // guaranteed not to cross a page or block boundary.
-  .balign 0x200
-
 //VOID
 //ArmReplaceLiveTranslationEntry (
 //  IN  UINT64  *Entry,
 //  IN  UINT64  Value,
 //  IN  UINT64  Address
 //  )
-ASM_FUNC(ArmReplaceLiveTranslationEntry)
+//
+// Align this routine to a log2 upper bound of its size, so that it is
+// guaranteed not to cross a page or block boundary.
+ASM_FUNC_ALIGN(ArmReplaceLiveTranslationEntry, 0x200)
 
   // disable interrupts
   mrs   x4, daif
-- 
2.40.0



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




Re: [edk2-devel] [PATCH 1/2] ArmPkg/AsmMacroIoLibV8: Introduce ASM_FUNC_ALIGN()

2023-04-17 Thread Ard Biesheuvel
On Mon, 17 Apr 2023 at 21:52, Leif Lindholm  wrote:
>
> Hi Marvin,
>
> First of all - many thanks for tracking down the bug that creates the
> need for this.
>
> On Mon, Apr 17, 2023 at 18:09:15 +, Marvin Häuser wrote:
> > With the current ASM_FUNC() macro, there is no good way to declare an
> > alignment constraint for a function. As ASM_FUNC() switches sections,
> > declaring the constraint before the macro invocation applies it to the
> > current location in the previous section. Declaring the constraint after
> > the macro invocation lets the function label point to the location prior
> > to alignment. Depending on toolchain behaviour, this may cause the label
> > to point to alignment padding preceding the actual function definition.
> >
> > To address these issues, introduce the ASM_FUNC_ALIGN() macro, which
> > declares the alignment constraint right before the function label.
> >
> > Signed-off-by: Marvin Häuser 
> > Cc: Leif Lindholm 
> > Cc: Ard Biesheuvel 
> > Cc: Sami Mujawar 
> > Cc: Vitaly Cheptsov 
> > ---
> >  ArmPkg/Include/AsmMacroIoLibV8.h | 22 ++
> >  1 file changed, 18 insertions(+), 4 deletions(-)
> >
> > diff --git a/ArmPkg/Include/AsmMacroIoLibV8.h 
> > b/ArmPkg/Include/AsmMacroIoLibV8.h
> > index 135aaeca5d0b..919edc70384d 100644
> > --- a/ArmPkg/Include/AsmMacroIoLibV8.h
> > +++ b/ArmPkg/Include/AsmMacroIoLibV8.h
> > @@ -34,15 +34,29 @@
> >  cbnz   SAFE_XREG, 1f;\
> >  b  .;// We should never get here
> >
> > -#define _ASM_FUNC(Name, Section)\
> > -  .global   Name  ; \
> > -  .section  #Section, "ax"; \
> > -  .type Name, %function   ; \
> > +#define _ASM_FUNC_HDR(Name, Section) \
> > +  .global   Name   ; \
> > +  .section  #Section, "ax" ; \
> > +  .type Name, %function
> > +
> > +#define _ASM_FUNC_FTR(Name) \
> >Name:   ; \
> >AARCH64_BTI(c)
> >
> > +#define _ASM_FUNC(Name, Section)\
> > +  _ASM_FUNC_HDR(Name, Section); \
> > +  _ASM_FUNC_FTR(Name)
> > +
> > +#define _ASM_FUNC_ALIGN(Name, Section, Align)   \
>
> I like this solution, but I'd like to hear Ard's opinion.
>
> I probably want to bikeshed some of the implementation details:
> Although I generally dislike duplicate definitions, I think I would
> prefer having _ASM_FUNC and _ASM_FUNC_ALIGN defined self-contained,
> without _HDR and _FTR.
> If we do keep the reused primitives, we need better language; the
> footer of the header is not a footer of the function.
>

Agree with all of this.

And thanks for tracking this down - must not have been fun :-)


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




Re: [edk2-devel] [PATCH 2/2] ArmPkg/ArmMmuLib: Fix ArmReplaceLiveTranslationEntry() alignment

2023-04-17 Thread Leif Lindholm
On Mon, Apr 17, 2023 at 18:09:16 +, Marvin Häuser wrote:
> As the ASM_FUNC() macro performs a section switch, the preceding
> .balign directive applies the alignment constraint to the current
> location in the previous section. As the linker may not merge the
> sections in-order, ArmReplaceLiveTranslationEntry() may be left
> unaligned.
> 
> Replace the explicit invocation of .balign with the ASM_FUNC_ALIGN()
> macro, which guarantees the alignment constraint is applied correctly.
> 
> Signed-off-by: Marvin Häuser 
> Cc: Leif Lindholm 
> Cc: Ard Biesheuvel 
> Cc: Sami Mujawar 
> Cc: Vitaly Cheptsov 

Assuming we reach consensus on the preceding patch, this one is a no
brainer:
Reviewed-by: Leif Lindholm 

> ---
>  ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S | 9 -
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S 
> b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S
> index e936a5be4e11..7627aeb95464 100644
> --- a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S
> +++ b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S
> @@ -69,17 +69,16 @@
>  .L2_\@:
>.endm
>  
> -  // Align this routine to a log2 upper bound of its size, so that it is
> -  // guaranteed not to cross a page or block boundary.
> -  .balign 0x200
> -
>  //VOID
>  //ArmReplaceLiveTranslationEntry (
>  //  IN  UINT64  *Entry,
>  //  IN  UINT64  Value,
>  //  IN  UINT64  Address
>  //  )
> -ASM_FUNC(ArmReplaceLiveTranslationEntry)
> +//
> +// Align this routine to a log2 upper bound of its size, so that it is
> +// guaranteed not to cross a page or block boundary.
> +ASM_FUNC_ALIGN(ArmReplaceLiveTranslationEntry, 0x200)
>  
>// disable interrupts
>mrs   x4, daif
> -- 
> 2.40.0
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103120): https://edk2.groups.io/g/devel/message/103120
Mute This Topic: https://groups.io/mt/98325902/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 1/2] ArmPkg/AsmMacroIoLibV8: Introduce ASM_FUNC_ALIGN()

2023-04-17 Thread Leif Lindholm
Hi Marvin,

First of all - many thanks for tracking down the bug that creates the
need for this.

On Mon, Apr 17, 2023 at 18:09:15 +, Marvin Häuser wrote:
> With the current ASM_FUNC() macro, there is no good way to declare an
> alignment constraint for a function. As ASM_FUNC() switches sections,
> declaring the constraint before the macro invocation applies it to the
> current location in the previous section. Declaring the constraint after
> the macro invocation lets the function label point to the location prior
> to alignment. Depending on toolchain behaviour, this may cause the label
> to point to alignment padding preceding the actual function definition.
> 
> To address these issues, introduce the ASM_FUNC_ALIGN() macro, which
> declares the alignment constraint right before the function label.
> 
> Signed-off-by: Marvin Häuser 
> Cc: Leif Lindholm 
> Cc: Ard Biesheuvel 
> Cc: Sami Mujawar 
> Cc: Vitaly Cheptsov 
> ---
>  ArmPkg/Include/AsmMacroIoLibV8.h | 22 ++
>  1 file changed, 18 insertions(+), 4 deletions(-)
> 
> diff --git a/ArmPkg/Include/AsmMacroIoLibV8.h 
> b/ArmPkg/Include/AsmMacroIoLibV8.h
> index 135aaeca5d0b..919edc70384d 100644
> --- a/ArmPkg/Include/AsmMacroIoLibV8.h
> +++ b/ArmPkg/Include/AsmMacroIoLibV8.h
> @@ -34,15 +34,29 @@
>  cbnz   SAFE_XREG, 1f;\
>  b  .;// We should never get here
>  
> -#define _ASM_FUNC(Name, Section)\
> -  .global   Name  ; \
> -  .section  #Section, "ax"; \
> -  .type Name, %function   ; \
> +#define _ASM_FUNC_HDR(Name, Section) \
> +  .global   Name   ; \
> +  .section  #Section, "ax" ; \
> +  .type Name, %function
> +
> +#define _ASM_FUNC_FTR(Name) \
>Name:   ; \
>AARCH64_BTI(c)
>  
> +#define _ASM_FUNC(Name, Section)\
> +  _ASM_FUNC_HDR(Name, Section); \
> +  _ASM_FUNC_FTR(Name)
> +
> +#define _ASM_FUNC_ALIGN(Name, Section, Align)   \

I like this solution, but I'd like to hear Ard's opinion.

I probably want to bikeshed some of the implementation details:
Although I generally dislike duplicate definitions, I think I would
prefer having _ASM_FUNC and _ASM_FUNC_ALIGN defined self-contained,
without _HDR and _FTR.
If we do keep the reused primitives, we need better language; the
footer of the header is not a footer of the function.

/
Leif

> +  _ASM_FUNC_HDR(Name, Section); \
> +  .balign Align   ; \
> +  _ASM_FUNC_FTR(Name)
> +
>  #define ASM_FUNC(Name)  _ASM_FUNC(ASM_PFX(Name), .text. ## Name)
>  
> +#define ASM_FUNC_ALIGN(Name, Align)  \
> +  _ASM_FUNC_ALIGN(ASM_PFX(Name), .text. ## Name, Align)
> +
>  #define MOV32(Reg, Val)   \
>movz  Reg, (Val) >> 16, lsl #16   ; \
>movk  Reg, (Val) & 0x
> -- 
> 2.40.0
> 


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




[edk2-devel] [PATCH 2/2] ArmPkg/ArmMmuLib: Fix ArmReplaceLiveTranslationEntry() alignment

2023-04-17 Thread Marvin Häuser
As the ASM_FUNC() macro performs a section switch, the preceding
.balign directive applies the alignment constraint to the current
location in the previous section. As the linker may not merge the
sections in-order, ArmReplaceLiveTranslationEntry() may be left
unaligned.

Replace the explicit invocation of .balign with the ASM_FUNC_ALIGN()
macro, which guarantees the alignment constraint is applied correctly.

Signed-off-by: Marvin Häuser 
Cc: Leif Lindholm 
Cc: Ard Biesheuvel 
Cc: Sami Mujawar 
Cc: Vitaly Cheptsov 
---
 ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S 
b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S
index e936a5be4e11..7627aeb95464 100644
--- a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S
+++ b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S
@@ -69,17 +69,16 @@
 .L2_\@:
   .endm
 
-  // Align this routine to a log2 upper bound of its size, so that it is
-  // guaranteed not to cross a page or block boundary.
-  .balign 0x200
-
 //VOID
 //ArmReplaceLiveTranslationEntry (
 //  IN  UINT64  *Entry,
 //  IN  UINT64  Value,
 //  IN  UINT64  Address
 //  )
-ASM_FUNC(ArmReplaceLiveTranslationEntry)
+//
+// Align this routine to a log2 upper bound of its size, so that it is
+// guaranteed not to cross a page or block boundary.
+ASM_FUNC_ALIGN(ArmReplaceLiveTranslationEntry, 0x200)
 
   // disable interrupts
   mrs   x4, daif
-- 
2.40.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103118): https://edk2.groups.io/g/devel/message/103118
Mute This Topic: https://groups.io/mt/98325902/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] ArmPkg/AsmMacroIoLibV8: Introduce ASM_FUNC_ALIGN()

2023-04-17 Thread Marvin Häuser
With the current ASM_FUNC() macro, there is no good way to declare an
alignment constraint for a function. As ASM_FUNC() switches sections,
declaring the constraint before the macro invocation applies it to the
current location in the previous section. Declaring the constraint after
the macro invocation lets the function label point to the location prior
to alignment. Depending on toolchain behaviour, this may cause the label
to point to alignment padding preceding the actual function definition.

To address these issues, introduce the ASM_FUNC_ALIGN() macro, which
declares the alignment constraint right before the function label.

Signed-off-by: Marvin Häuser 
Cc: Leif Lindholm 
Cc: Ard Biesheuvel 
Cc: Sami Mujawar 
Cc: Vitaly Cheptsov 
---
 ArmPkg/Include/AsmMacroIoLibV8.h | 22 ++
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/ArmPkg/Include/AsmMacroIoLibV8.h b/ArmPkg/Include/AsmMacroIoLibV8.h
index 135aaeca5d0b..919edc70384d 100644
--- a/ArmPkg/Include/AsmMacroIoLibV8.h
+++ b/ArmPkg/Include/AsmMacroIoLibV8.h
@@ -34,15 +34,29 @@
 cbnz   SAFE_XREG, 1f;\
 b  .;// We should never get here
 
-#define _ASM_FUNC(Name, Section)\
-  .global   Name  ; \
-  .section  #Section, "ax"; \
-  .type Name, %function   ; \
+#define _ASM_FUNC_HDR(Name, Section) \
+  .global   Name   ; \
+  .section  #Section, "ax" ; \
+  .type Name, %function
+
+#define _ASM_FUNC_FTR(Name) \
   Name:   ; \
   AARCH64_BTI(c)
 
+#define _ASM_FUNC(Name, Section)\
+  _ASM_FUNC_HDR(Name, Section); \
+  _ASM_FUNC_FTR(Name)
+
+#define _ASM_FUNC_ALIGN(Name, Section, Align)   \
+  _ASM_FUNC_HDR(Name, Section); \
+  .balign Align   ; \
+  _ASM_FUNC_FTR(Name)
+
 #define ASM_FUNC(Name)  _ASM_FUNC(ASM_PFX(Name), .text. ## Name)
 
+#define ASM_FUNC_ALIGN(Name, Align)  \
+  _ASM_FUNC_ALIGN(ASM_PFX(Name), .text. ## Name, Align)
+
 #define MOV32(Reg, Val)   \
   movz  Reg, (Val) >> 16, lsl #16   ; \
   movk  Reg, (Val) & 0x
-- 
2.40.0



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




Re: [edk2-devel] [PATCH 2/5] RedfishPkg: Prevent assertion of allocate zero length region

2023-04-17 Thread Minh Nguyen OS via groups.io
Hi Wang,

 Thanks for this point, you're right. It's a redundant change and I will update 
in v2 patches, but the second change is necessary. How do you think about that?

Thanks,
Minh Nguyen

-Original Message-
From: Nickle Wang  
Sent: Friday, April 14, 2023 4:04 PM
To: Minh Nguyen OS ; devel@edk2.groups.io
Cc: Open Source Submission ; abner.ch...@amd.com; 
ig...@ami.com; Nhi Pham OS ; Tinh Nguyen OS 
; Vu Nguyen OS 

Subject: RE: [PATCH 2/5] RedfishPkg: Prevent assertion of allocate zero length 
region

Hi Minh,

> Prevent assertion of allocate zero length region

May I know where does zero length allocation happen? According to my 
understanding, setting the "SubnetAddrInfoIPv6Number" to zero here and it will 
be handled by below condition check:

https://github.com/tianocore/edk2/blob/55b67b6950e648338adfe8ec54aeb26ed89d2c97/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c#L1005

Then the code leaves function with EFI_NOT_FOUND error. 

Thanks,
Nickle

> -Original Message-
> From: Minh Nguyen 
> Sent: Friday, April 14, 2023 4:19 PM
> To: devel@edk2.groups.io
> Cc: patc...@amperecomputing.com; abner.ch...@amd.com; Nickle Wang 
> ; ig...@ami.com; n...@os.amperecomputing.com; 
> tinhngu...@os.amperecomputing.com; Vu Nguyen 
> ; Minh Nguyen 
> 
> Subject: [PATCH 2/5] RedfishPkg: Prevent assertion of allocate zero 
> length region
> 
> External email: Use caution opening links or attachments
> 
> 
> From: Vu Nguyen 
> 
> This change also fix miscellaneous errors on condition checking and 
> debug argument missing.
> 
> Signed-off-by: Minh Nguyen 
> ---
>  RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> index 583c6f78e19c..29e7b0624ebf 100644
> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> @@ -5,6 +5,7 @@
>(C) Copyright 2021 Hewlett Packard Enterprise Development LP
>Copyright (c) 2022, AMD Incorporated. All rights reserved.
>Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
> +  Copyright (c) 2023, Ampere Computing LLC. All rights reserved.
> 
>SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> @@ -272,7 +273,7 @@ Tcp6GetSubnetInfo (
>if (IpModedata.AddressCount == 0) {
>  DEBUG ((DEBUG_INFO, "%a: No IPv6 address configured.\n", __func__));
>  Instance->SubnetAddrInfoIPv6Number = 0;
> -return EFI_SUCCESS;
> +return EFI_NOT_FOUND;
>}
> 
>if (Instance->SubnetAddrInfoIPv6 != NULL) { @@ -926,7 +927,7 @@ 
> AddAndSignalNewRedfishService (
>  }
> 
>  Status = gBS->SignalEvent (Instance->DiscoverToken->Event);
> -if (!EFI_ERROR (Status)) {
> +if (EFI_ERROR (Status)) {
>DEBUG ((DEBUG_ERROR, "%a:No event to signal!\n", __func__));
>  }
>}
> --
> 2.39.0



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




Re: [edk2-devel] [PATCH 2/5] RedfishPkg: Prevent assertion of allocate zero length region

2023-04-17 Thread Minh Nguyen via groups.io
Hi Wang,

 Thanks for this point, you're right. It's a redundant change and I will update 
in v2 patches, but the second change is necessary. How do you think about that?

Thanks,
Minh Nguyen

-Original Message-
From: Nickle Wang  
Sent: Friday, April 14, 2023 4:04 PM
To: Minh Nguyen OS ; devel@edk2.groups.io
Cc: Open Source Submission ; abner.ch...@amd.com; 
ig...@ami.com; Nhi Pham OS ; Tinh Nguyen OS 
; Vu Nguyen OS 

Subject: RE: [PATCH 2/5] RedfishPkg: Prevent assertion of allocate zero length 
region

[EXTERNAL EMAIL NOTICE: This email originated from an external sender. Please 
be mindful of safe email handling and proprietary information protection 
practices.]


Hi Minh,

> Prevent assertion of allocate zero length region

May I know where does zero length allocation happen? According to my 
understanding, setting the "SubnetAddrInfoIPv6Number" to zero here and it will 
be handled by below condition check:

https://github.com/tianocore/edk2/blob/55b67b6950e648338adfe8ec54aeb26ed89d2c97/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c#L1005

Then the code leaves function with EFI_NOT_FOUND error.

Thanks,
Nickle

> -Original Message-
> From: Minh Nguyen 
> Sent: Friday, April 14, 2023 4:19 PM
> To: devel@edk2.groups.io
> Cc: patc...@amperecomputing.com; abner.ch...@amd.com; Nickle Wang 
> ; ig...@ami.com; n...@os.amperecomputing.com; 
> tinhngu...@os.amperecomputing.com; Vu Nguyen 
> ; Minh Nguyen 
> 
> Subject: [PATCH 2/5] RedfishPkg: Prevent assertion of allocate zero 
> length region
>
> External email: Use caution opening links or attachments
>
>
> From: Vu Nguyen 
>
> This change also fix miscellaneous errors on condition checking and 
> debug argument missing.
>
> Signed-off-by: Minh Nguyen 
> ---
>  RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> index 583c6f78e19c..29e7b0624ebf 100644
> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> @@ -5,6 +5,7 @@
>(C) Copyright 2021 Hewlett Packard Enterprise Development LP
>Copyright (c) 2022, AMD Incorporated. All rights reserved.
>Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
> +  Copyright (c) 2023, Ampere Computing LLC. All rights reserved.
>
>SPDX-License-Identifier: BSD-2-Clause-Patent
>
> @@ -272,7 +273,7 @@ Tcp6GetSubnetInfo (
>if (IpModedata.AddressCount == 0) {
>  DEBUG ((DEBUG_INFO, "%a: No IPv6 address configured.\n", __func__));
>  Instance->SubnetAddrInfoIPv6Number = 0;
> -return EFI_SUCCESS;
> +return EFI_NOT_FOUND;
>}
>
>if (Instance->SubnetAddrInfoIPv6 != NULL) { @@ -926,7 +927,7 @@ 
> AddAndSignalNewRedfishService (
>  }
>
>  Status = gBS->SignalEvent (Instance->DiscoverToken->Event);
> -if (!EFI_ERROR (Status)) {
> +if (EFI_ERROR (Status)) {
>DEBUG ((DEBUG_ERROR, "%a:No event to signal!\n", __func__));
>  }
>}
> --
> 2.39.0



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




[edk2-devel] [PATCH 5/5] RedfishPkg: Fix compile issue on Linux

2023-04-17 Thread Minh Nguyen via groups.io
From: Vu Nguyen 

It requires a fixed size array to store the content of device path PCD.
Add the array size to solve this issue.

Signed-off-by: Minh Nguyen 
---
 RedfishPkg/Include/Pcd/RestExServiceDevicePath.h | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h 
b/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h
index 91b1198297c2..57fc199f61f2 100644
--- a/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h
+++ b/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h
@@ -4,6 +4,7 @@
 
   Copyright (c) 2019, Intel Corporation. All rights reserved.
   (C) Copyright 2020 Hewlett Packard Enterprise Development LP
+  Copyright (c) 2023, Ampere Computing LLC. All rights reserved.
 
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -14,6 +15,8 @@
 
 #include 
 
+#define MAX_DEVICE_PATH_NODE  40
+
 typedef enum {
   DEVICE_PATH_MATCH_MAC_NODE = 1,
   DEVICE_PATH_MATCH_PCI_NODE = 2,
@@ -32,7 +35,7 @@ typedef struct {
   //
0x03,0x0b,0x25,0x00,0x00,0x50,0x56,0xc0,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
   //0x7f,0xff,0x04,0x00}
   //
-  EFI_DEVICE_PATH_PROTOCOLDevicePath[];
+  EFI_DEVICE_PATH_PROTOCOL  DevicePath[MAX_DEVICE_PATH_NODE];
 } REST_EX_SERVICE_DEVICE_PATH_DATA;
 
 #endif
-- 
2.39.0



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




[edk2-devel] [PATCH 4/5] RedfishPkg: Add missing newline character

2023-04-17 Thread Minh Nguyen via groups.io
From: Nhi Pham 

This adds a missing newline character to make the error log
readable in case the module is failed.

Signed-off-by: Minh Nguyen 
---
 RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c 
b/RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c
index 45fc6e2182bc..c4fa59193a2f 100644
--- a/RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c
+++ b/RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c
@@ -8,6 +8,7 @@
   (C) Copyright 2020 Hewlett Packard Enterprise Development LP
   Copyright (C) 2022 Advanced Micro Devices, Inc. All rights reserved.
   Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+  Copyright (c) 2023, Ampere Computing LLC. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -59,7 +60,7 @@ RedfishCreateSmbiosTable42 (
   Status = RedfishPlatformHostInterfaceDeviceDescriptor (, 
);
   if (EFI_ERROR (Status)) {
 if (Status == EFI_NOT_FOUND) {
-  DEBUG ((DEBUG_ERROR, "%a: No Redfish host interface descriptor is 
provided on this platform.", __func__));
+  DEBUG ((DEBUG_ERROR, "%a: No Redfish host interface descriptor is 
provided on this platform.\n", __func__));
   return EFI_NOT_FOUND;
 }
 
-- 
2.39.0



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




[edk2-devel] [PATCH 3/5] RedfishPkg: Create RestEx child on selected interface

2023-04-17 Thread Minh Nguyen via groups.io
From: Vu Nguyen 

When a MAC address matching interface is found, a RestEx child will be
created to provide the Redfish communication on that interface.
Currently, It will try to locate all RestEx binding services and choose
the first satisfied instance without taking care about current selected
interface. This might raise an issue on the system with multiple network
devices that the RestEx child was installed on wrong interface.

Signed-off-by: Minh Nguyen 
---
 RedfishPkg/Include/Library/RestExLib.h |   3 +
 RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c | 153 
 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c |   1 +
 3 files changed, 63 insertions(+), 94 deletions(-)

diff --git a/RedfishPkg/Include/Library/RestExLib.h 
b/RedfishPkg/Include/Library/RestExLib.h
index bc4e4ca6caa7..2c32c3684cf4 100644
--- a/RedfishPkg/Include/Library/RestExLib.h
+++ b/RedfishPkg/Include/Library/RestExLib.h
@@ -2,6 +2,7 @@
   This library provides help functions for REST EX Protocol.
 
   (C) Copyright 2020 Hewlett Packard Enterprise Development LP
+  Copyright (c) 2023, Ampere Computing LLC. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -20,6 +21,7 @@
   This function allows the caller to create child handle for specific
   REST server.
 
+  @param[in]  Controller   The controller handle used of selected 
interface.
   @param[in]  ImageThe image handle used to open service.
   @param[in]  AccessMode   Access mode of REST server.
   @param[in]  ConfigType   Underlying configuration to communicate 
with REST server.
@@ -32,6 +34,7 @@
 **/
 EFI_STATUS
 RestExLibCreateChild (
+  IN EFI_HANDLE   Controller,
   IN EFI_HANDLE   Image,
   IN EFI_REST_EX_SERVICE_ACCESS_MODE  AccessMode,
   IN EFI_REST_EX_CONFIG_TYPE  ConfigType,
diff --git a/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c 
b/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c
index d9acad24dec1..6002be93c54e 100644
--- a/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c
+++ b/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c
@@ -2,6 +2,7 @@
   This library provides help functions for REST EX Protocol.
 
   (C) Copyright 2020 Hewlett Packard Enterprise Development LP
+  Copyright (c) 2023, Ampere Computing LLC. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -9,6 +10,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -21,6 +23,7 @@
   This function allows the caller to create child handle for specific
   REST server.
 
+  @param[in]  Controller   The controller handle used of selected 
interface.
   @param[in]  ImageThe image handle used to open service.
   @param[in]  AccessMode   Access mode of REST server.
   @param[in]  ConfigType   Underlying configuration to communicate 
with REST server.
@@ -33,6 +36,7 @@
 **/
 EFI_STATUS
 RestExLibCreateChild (
+  IN EFI_HANDLE   Controller,
   IN EFI_HANDLE   Image,
   IN EFI_REST_EX_SERVICE_ACCESS_MODE  AccessMode,
   IN EFI_REST_EX_CONFIG_TYPE  ConfigType,
@@ -41,8 +45,6 @@ RestExLibCreateChild (
   )
 {
   EFI_STATUSStatus;
-  UINTN NoBuffer;
-  EFI_HANDLE*Handle;
   EFI_HANDLEChildHandle;
   EFI_REST_EX_PROTOCOL  *RestEx;
   EFI_REST_EX_SERVICE_INFO  *RestExServiceInfo;
@@ -59,116 +61,79 @@ RestExLibCreateChild (
   }
 
   *ChildInstanceHandle = NULL;
-  //
-  // Locate all REST EX binding service.
-  //
-  Handle   = NULL;
-  NoBuffer = 0;
-  Status   = gBS->LocateHandleBuffer (
-ByProtocol,
-,
-NULL,
-,
-
-);
-  if (EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL)) {
+
+  ChildHandle = NULL;
+  Status = NetLibCreateServiceChild (
+ Controller,
+ Image,
+ ,
+ 
+ );
+  if (EFI_ERROR (Status)) {
+DEBUG ((
+  DEBUG_ERROR,
+  "%a: Failed to create service child - %r \n",
+  __FUNCTION__,
+  Status
+  ));
 return Status;
   }
-
-  Handle = (EFI_HANDLE *)AllocateZeroPool (sizeof (EFI_HANDLE) * NoBuffer);
-  if (Handle == NULL) {
-return EFI_OUT_OF_RESOURCES;
-  }
-
-  Status = gBS->LocateHandleBuffer (
-  ByProtocol,
-  ,
+  Status = gBS->OpenProtocol (
+  ChildHandle,
+  ,
+  (VOID **),
+  Image,
   NULL,
-  ,
-  
+  EFI_OPEN_PROTOCOL_GET_PROTOCOL
   );
   if (EFI_ERROR (Status)) {
-FreePool (Handle);
-return Status;
+goto ON_ERROR;
   }
 
   //
-  // Search for the proper REST EX instance.
+  // Get the information of REST service provided by this EFI REST EX driver
   //

[edk2-devel] [PATCH 2/5] RedfishPkg: Prevent assertion of allocate zero length region

2023-04-17 Thread Minh Nguyen via groups.io
From: Vu Nguyen 

This change also fix miscellaneous errors on condition checking and
debug argument missing.

Signed-off-by: Minh Nguyen 
---
 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index 583c6f78e19c..29e7b0624ebf 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -5,6 +5,7 @@
   (C) Copyright 2021 Hewlett Packard Enterprise Development LP
   Copyright (c) 2022, AMD Incorporated. All rights reserved.
   Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+  Copyright (c) 2023, Ampere Computing LLC. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -272,7 +273,7 @@ Tcp6GetSubnetInfo (
   if (IpModedata.AddressCount == 0) {
 DEBUG ((DEBUG_INFO, "%a: No IPv6 address configured.\n", __func__));
 Instance->SubnetAddrInfoIPv6Number = 0;
-return EFI_SUCCESS;
+return EFI_NOT_FOUND;
   }
 
   if (Instance->SubnetAddrInfoIPv6 != NULL) {
@@ -926,7 +927,7 @@ AddAndSignalNewRedfishService (
 }
 
 Status = gBS->SignalEvent (Instance->DiscoverToken->Event);
-if (!EFI_ERROR (Status)) {
+if (EFI_ERROR (Status)) {
   DEBUG ((DEBUG_ERROR, "%a:No event to signal!\n", __func__));
 }
   }
-- 
2.39.0



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




[edk2-devel] [PATCH 1/5] RedfishPkg: Correct variable type to prevent memory corruption

2023-04-17 Thread Minh Nguyen via groups.io
From: Vu Nguyen 

Id will be casted by CoreOpenProtocol, declare this variable with a
wrong type might result in the corruption of other local variables.

Signed-off-by: Minh Nguyen 
---
 RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h 
b/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h
index 4a9e9f7b81a4..6b94e5814c43 100644
--- a/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h
+++ b/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h
@@ -3,6 +3,7 @@
 
   Copyright (c) 2019, Intel Corporation. All rights reserved.
   (C) Copyright 2020 Hewlett Packard Enterprise Development LP
+  Copyright (c) 2023, Ampere Computing LLC. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -84,7 +85,7 @@ struct _RESTEX_SERVICE {
   //
   EFI_HANDLE  HttpChildHandle;
 
-  UINT32  Id;
+  UINT32  *Id;
 
   EFI_REST_EX_SERVICE_INFORestExServiceInfo;
 };
-- 
2.39.0



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




[edk2-devel] [PATCH 0/5] Adding necessary changes for RedfishPkg

2023-04-17 Thread Minh Nguyen via groups.io
This patchset adds necessary changes for RedfishPkg to avoid 
some unexpected cases and fix compilation.

Nhi Pham (1):
  RedfishPkg: Add missing newline character

Vu Nguyen (4):
  RedfishPkg: Correct variable type to prevent memory corruption
  RedfishPkg: Prevent assertion of allocate zero length region
  RedfishPkg: Create RestEx child on selected interface
  RedfishPkg: Fix compile issue on Linux

 RedfishPkg/Include/Library/RestExLib.h   |   3 +
 RedfishPkg/Include/Pcd/RestExServiceDevicePath.h |   5 +-
 RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h|   3 +-
 RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c   | 153 

 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c   |   6 +-
 RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c |   3 +-
 6 files changed, 74 insertions(+), 99 deletions(-)

-- 
2.39.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103108): https://edk2.groups.io/g/devel/message/103108
Mute This Topic: https://groups.io/mt/98324140/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 3/3] Maintainers.txt: Adds AMD/AmdMinBoardPkg maintainers

2023-04-17 Thread Attar, AbdulLateef (Abdul Lateef) via groups.io
[AMD Official Use Only - General]

Hi @Ard Biesheuvel , @Leif Lindholm, @Michael D Kinney,
I had renamed the folder from MinBoardPkg to AmdMinBoardPkg, could you 
please review it.
Thanks
AbduL

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Abdul Lateef 
Attar via groups.io
Sent: 03 April 2023 16:53
To: devel@edk2.groups.io
Cc: Attar, AbdulLateef (Abdul Lateef) ; Attar, 
AbdulLateef (Abdul Lateef) ; Ard Biesheuvel 
; Leif Lindholm ; Chang, 
Abner ; Michael D Kinney 
Subject: [edk2-devel] [PATCH v4 3/3] Maintainers.txt: Adds AMD/AmdMinBoardPkg 
maintainers

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


From: Abdul Lateef Attar 

Adds maintainers for AMD/AmdMinBoardPkg

Signed-off-by: Abdul Lateef Attar 
Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Cc: Abner Chang 
Cc: Michael D Kinney 
---
 Maintainers.txt | 5 +
 1 file changed, 5 insertions(+)

diff --git a/Maintainers.txt b/Maintainers.txt index 1871ffaa26bd..24918d1c6ede 
100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -91,6 +91,11 @@ F: Silicon/AMD/Styx/
 M: Ard Biesheuvel 
 M: Leif Lindholm 

+AMD MinBoard package for MinPlatformPkg
+F: Platform/AMD/AmdMinBoardPkg
+M: Abner Chang 
+M: Abdul Lateef Attar 
+
 Ampere Computing
 F: Platform/Ampere
 F: Silicon/Ampere
--
2.25.1








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




Re: [edk2-devel] [PATCH v8 2/9] UefiCpuPkg: Adds SmmSmramSaveStateLib library class

2023-04-17 Thread Attar, AbdulLateef (Abdul Lateef) via groups.io
[AMD Official Use Only - General]

Thanks for review comment, will update accordingly.

-Original Message-
From: Ni, Ray 
Sent: 11 April 2023 13:21
To: devel@edk2.groups.io; Attar, AbdulLateef (Abdul Lateef) 

Cc: Grimes, Paul ; Kirkendall, Garrett 
; Chang, Abner ; Dong, Eric 
; Kumar, Rahul R ; Gerd Hoffmann 

Subject: RE: [edk2-devel] [PATCH v8 2/9] UefiCpuPkg: Adds SmmSmramSaveStateLib 
library class

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


> +  ## @libraryclass   Provides functions for manipulating Smram savestate
> registers.
> +  SmmSmramSaveSateLib|Include/Library/SmmSmramSaveStateLib.h

1. Can you please rename the lib class to MmSaveStateLib? So the lib can be 
potentially linked with standalone MM CPU driver.
2. Also the lib header file name can be "MmSaveStateLib.h".

> +EFI_STATUS
> +EFIAPI
> +SmramSaveStateReadRegister (
3. The API can be MmSaveStateReadRegister().


> +  IN  UINTNCpuIndex,
> +  IN  EFI_SMM_SAVE_STATE_REGISTER  Register,
4. "EFI_MM_SAVE_STATE_REGISTER"



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103107): https://edk2.groups.io/g/devel/message/103107
Mute This Topic: https://groups.io/mt/98172965/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 2/3] ManageabilityPkg: Use SMBUS I2C instead of I2C

2023-04-17 Thread Attar, AbdulLateef (Abdul Lateef) via groups.io
[AMD Official Use Only - General]

Hi Abner,
I think EDK2 uses the below naming convention for variables which are 
acronyms.
First letter is capitalized, and rest all are smaller.
Its better to rename below variables from I2C to 
I2c.

-Original Message-
From: Chang, Abner  
Sent: Saturday, April 15, 2023 5:27 PM
To: devel@edk2.groups.io
Cc: Isaac Oram ; Attar, AbdulLateef (Abdul Lateef) 
; Nickle Wang ; Tinh Nguyen 

Subject: [edk2-platforms][PATCH 2/3] ManageabilityPkg: Use SMBUS I2C instead of 
I2C

From: Abner Chang 

Signed-off-by: Abner Chang 
Cc: Isaac Oram 
Cc: Abdul Lateef Attar 
Cc: Nickle Wang 
Cc: Tinh Nguyen 
---
 Features/ManageabilityPkg/ManageabilityPkg.dec | 10 +-
 .../BaseManageabilityTransportHelper.inf   |  2 +-
 .../BaseManageabilityTransportHelper.c | 14 +++---
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dec 
b/Features/ManageabilityPkg/ManageabilityPkg.dec
index 9a930d3e4b..3656190a70 100644
--- a/Features/ManageabilityPkg/ManageabilityPkg.dec
+++ b/Features/ManageabilityPkg/ManageabilityPkg.dec
@@ -32,13 +32,13 @@
   # Manageability Transport Interface type
   #
   # Manageability Transport KCS
-  gManageabilityTransportKcsGuid= { 0x5A6E64E9, 0xFD47, 0x4086, { 0xAA, 
0xB0, 0x7A, 0x5F, 0xD7, 0x6B, 0x02, 0x2E } }
-  # Manageability Transport I2C
-  gManageabilityTransportI2CGuid= { 0x5B174658, 0x8263, 0x4CB8, { 0xA0, 
0x0F, 0xD6, 0x82, 0xE6, 0xBC, 0x74, 0x93 } }
Change to I2c
+  gManageabilityTransportKcsGuid  = { 0x5A6E64E9, 0xFD47, 0x4086, { 0xAA, 
0xB0, 0x7A, 0x5F, 0xD7, 0x6B, 0x02, 0x2E } }
+  # Manageability Transport SMBUS I2C
+  gManageabilityTransportSmbusI2CGuid = { 0x5B174658, 0x8263, 0x4CB8, { 0xA0, 
0x0F, 0xD6, 0x82, 0xE6, 0xBC, 0x74, 0x93 } }
Change to I2c
   # Manageability Transport PCI VDM
-  gManageabilityTransportPciVdmGuid = { 0x388021A7, 0xFB59, 0x4811, { 0x9D, 
0xA7, 0xD5, 0x63, 0x7D, 0x04, 0xA7, 0x2F } }
+  gManageabilityTransportPciVdmGuid   = { 0x388021A7, 0xFB59, 0x4811, { 0x9D, 
0xA7, 0xD5, 0x63, 0x7D, 0x04, 0xA7, 0x2F } }
   # Manageability Transport MCTP
-  gManageabilityTransportMctpGuid   = { 0x6798448D, 0x1200, 0x4577, { 0x82, 
0x50, 0xA9, 0x83, 0xBA, 0x2B, 0x45, 0xD9 } }
+  gManageabilityTransportMctpGuid = { 0x6798448D, 0x1200, 0x4577, { 0x82, 
0x50, 0xA9, 0x83, 0xBA, 0x2B, 0x45, 0xD9 } }
 
   # Manageability Protocol Specification
   #
diff --git 
a/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.inf
 
b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.inf
index 95c3362ddb..8876e36480 100644
--- 
a/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.inf
+++ 
b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.inf
@@ -32,7 +32,7 @@
 
 [Guids]
   gManageabilityTransportKcsGuid
-  gManageabilityTransportI2CGuid
+  gManageabilityTransportSmbusI2CGuid
Change to I2c
   gManageabilityTransportPciVdmGuid
   gManageabilityTransportMctpGuid
   gManageabilityProtocolIpmiGuid
diff --git 
a/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.c
 
b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.c
index 81da209764..6454f32670 100644
--- 
a/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.c
+++ 
b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.c
@@ -15,13 +15,13 @@
 // Make sure the global variables added here should be unchangable.
 //
 MANAGEABILITY_SPECIFICATION_NAME  ManageabilitySpecNameTable[] = {
-  { ,L"KCS" },
-  { ,L"I2C" },
-  { , L"PCI VDM" },
-  { ,   L"MCTP"},
-  { ,L"IPMI"},
-  { ,L"MCTP"},
-  { ,L"PLDM"}
+  { , L"KCS"  },
+  { ,L"SMBUS I2C"},
Change to I2c
+  { ,  L"PCI VDM"  },
+  { ,L"MCTP" },
+  { , L"IPMI" },
+  { , L"MCTP" },
+  { , L"PLDM" }
 };
 
 UINT16  mManageabilitySpecNum = sizeof (ManageabilitySpecNameTable)/ sizeof 
(MANAGEABILITY_SPECIFICATION_NAME);
-- 
2.37.1.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103104): https://edk2.groups.io/g/devel/message/103104
Mute This Topic: https://groups.io/mt/98280327/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 1/3] ManageabilityPkg/IpmiPpi: Fix duplicate library instance

2023-04-17 Thread Attar, AbdulLateef (Abdul Lateef) via groups.io
[AMD Official Use Only - General]

Reviewed-by: Abdul Lateef Attar 

-Original Message-
From: Chang, Abner  
Sent: Saturday, April 15, 2023 5:27 PM
To: devel@edk2.groups.io
Cc: Isaac Oram ; Attar, AbdulLateef (Abdul Lateef) 
; Nickle Wang ; Tinh Nguyen 

Subject: [edk2-platforms][PATCH 1/3] ManageabilityPkg/IpmiPpi: Fix duplicate 
library instance

From: Abner Chang 

Remove duplicate library instance in [LibraryClass] section.

Signed-off-by: Abner Chang 
Cc: Isaac Oram 
Cc: Abdul Lateef Attar 
Cc: Nickle Wang 
Cc: Tinh Nguyen 
---
 .../ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf   | 1 -
 1 file changed, 1 deletion(-)

diff --git 
a/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf 
b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf
index 8d59b46d48..3f839625ac 100644
--- a/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf
+++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.in
+++ f
@@ -37,7 +37,6 @@
   ManageabilityTransportHelperLib
   ManageabilityTransportLib
   PeimEntryPoint
-  ManageabilityTransportLib
 
 [Ppis]
   gPeiIpmiPpiGuid   # PPI ALWAYS PRODUCED
--
2.37.1.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103103): https://edk2.groups.io/g/devel/message/103103
Mute This Topic: https://groups.io/mt/98280323/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 3/3] ManageabilityPkg: Support AARCH64

2023-04-17 Thread Attar, AbdulLateef (Abdul Lateef) via groups.io
[AMD Official Use Only - General]

Reviewed-by: Abdul Lateef Attar 

-Original Message-
From: Chang, Abner  
Sent: Saturday, April 15, 2023 5:27 PM
To: devel@edk2.groups.io
Cc: Isaac Oram ; Attar, AbdulLateef (Abdul Lateef) 
; Nickle Wang ; Tinh Nguyen 

Subject: [edk2-platforms][PATCH 3/3] ManageabilityPkg: Support AARCH64

From: Abner Chang 

Add AARCH64 support in Manageability.dsc

Signed-off-by: Abner Chang 
Cc: Isaac Oram 
Cc: Abdul Lateef Attar 
Cc: Nickle Wang 
Cc: Tinh Nguyen 
---
 .../ManageabilityPkg/Include/Dsc/Manageability.dsc| 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc 
b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
index 0d868fdf4a..7f8d8df3f0 100644
--- a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
+++ b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
@@ -15,11 +15,18 @@
   NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
   ArmSoftFloatLib|ArmPkg/Library/ArmSoftFloatLib/ArmSoftFloatLib.inf
+  ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
+  BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
 
-[Components.IA32]
+[LibraryClasses.AARCH64.PEIM]
+  
PeiServicesTablePointerLib|ArmPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
+
+[Components.IA32, Components.AARCH64]
   ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf
 
-[Components.X64]
+[Components.X64, Components.AARCH64]
   ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocolDxe.inf
+
+[Components.X64]
   ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocolSmm.inf
 
-- 
2.37.1.windows.1


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




Re: [edk2-devel] [PATCH 1/1] OvmfPkg/BhyveBhf: install bhyve's ACPI tables

2023-04-17 Thread Corvin Köhne
On Mon, 2023-04-17 at 14:14 +0200, Gerd Hoffmann wrote:
> On Mon, Apr 17, 2023 at 01:46:01PM +0200, Corvin Köhne wrote:
> > It's much easier to create configuration dependend ACPI tables for
> > bhyve
> > than for OVMF. For this reason, don't use the statically created
> > ACPI
> > tables provided by OVMF. Instead prefer the dynamically created
> > ACPI
> > tables of bhyve. If bhyve provides no ACPI tables or we are unable
> > to
> > detect those, fall back to OVMF tables.
> > 
> > Ideally, we use the qemu fwcfg interface to pass the ACPI tables
> > from
> > bhyve to OVMF. bhyve will support this in the future. However,
> > current
> > bhyve executables don't support passing ACPI tables by the qemu
> > fwcfg
> > interface. They just copy the ACPI into main memory. For that
> > reason,
> > pick up the ACPI tables from main memory.
> > 
> > Implementation is similar to OvmfPkg/XenAcpiPlatformDxe/Xen.c.
> 
> Can both Xen and Bhyve share the same implementation?
> 
> Given in both cases RAM is scanned for the RSDP I'd expect it should
> not be very hard and we avoid duplicating the code.
> 
> take care,
>   Gerd
> 

Hi Gerd,

thanks for your reply. It's mostly the same code. Only the start and
end of the scanned range differ. So, it does make sense to share the
same implementation.
Where's the right place for this shared implementation? Is it
"OvmfPkg/Library"?


-- 
Kind regards,
Corvin


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




signature.asc
Description: This is a digitally signed message part


[edk2-devel] [PATCH v2 1/1] OvmfPkg/BhyveBhf: install bhyve's ACPI tables

2023-04-17 Thread Corvin Köhne
It's much easier to create configuration dependend ACPI tables for bhyve
than for OVMF. For this reason, don't use the statically created ACPI
tables provided by OVMF. Instead prefer the dynamically created ACPI
tables of bhyve. If bhyve provides no ACPI tables or we are unable to
detect those, fall back to OVMF tables.

Ideally, we use the qemu fwcfg interface to pass the ACPI tables from
bhyve to OVMF. bhyve will support this in the future. However, current
bhyve executables don't support passing ACPI tables by the qemu fwcfg
interface. They just copy the ACPI into main memory. For that reason,
pick up the ACPI tables from main memory.

Implementation is similar to OvmfPkg/XenAcpiPlatformDxe/Xen.c.

Signed-off-by: Corvin Köhne 
Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 
Cc: Ard Biesheuvel 
Cc: Jiewen Yao 
Cc: Jordan Justen 
Cc: Gerd Hoffmann 
Cc: Rebecca Cran 
Cc: Peter Grehan 
---
 MdePkg/Include/Uefi/UefiBaseType.h   |   2 +
 OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.h |   6 +
 OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c |  17 ++
 OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c| 258 +++
 4 files changed, 283 insertions(+)

diff --git a/MdePkg/Include/Uefi/UefiBaseType.h 
b/MdePkg/Include/Uefi/UefiBaseType.h
index 83975a08eb4c..b18a0760ee61 100644
--- a/MdePkg/Include/Uefi/UefiBaseType.h
+++ b/MdePkg/Include/Uefi/UefiBaseType.h
@@ -54,6 +54,8 @@ typedef UINT64 EFI_PHYSICAL_ADDRESS;
 ///
 typedef UINT64 EFI_VIRTUAL_ADDRESS;
 
+#define NUMERIC_VALUE_AS_POINTER(Type, Value)  ((Type *) ((UINTN)(Value)))
+
 ///
 /// EFI Time Abstraction:
 ///  Year:   1900 - 
diff --git a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.h 
b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.h
index 54d1af073eab..b2724135d09f 100644
--- a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.h
+++ b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.h
@@ -46,6 +46,12 @@ BhyveInstallAcpiTable (
   OUT  UINTN*TableKey
   );
 
+EFI_STATUS
+EFIAPI
+InstallBhyveTables (
+  IN   EFI_ACPI_TABLE_PROTOCOL  *AcpiProtocol
+  );
+
 EFI_STATUS
 EFIAPI
 InstallXenTables (
diff --git a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c 
b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c
index 999e9f151ebb..6077d4d313a3 100644
--- a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c
+++ b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c
@@ -243,6 +243,23 @@ InstallAcpiTables (
 {
   EFI_STATUS  Status;
 
+  Status = InstallBhyveTables (AcpiTable);
+  if (!EFI_ERROR (Status)) {
+return EFI_SUCCESS;
+  }
+
+  if (Status != EFI_NOT_FOUND) {
+DEBUG (
+  (
+   DEBUG_WARN,
+   "%a: unable to install bhyve's ACPI tables (%r)\n",
+   __func__,
+   Status
+  )
+  );
+return Status;
+  }
+
   Status = InstallOvmfFvTables (AcpiTable);
 
   return Status;
diff --git a/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c 
b/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c
index e216a21bfaed..fa5e79bfe3b4 100644
--- a/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c
+++ b/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c
@@ -13,6 +13,18 @@
 #include 
 #include  // QemuFwCfgFindFile()
 
+#define BHYVE_ACPI_PHYSICAL_ADDRESS  ((UINTN)0x000F2400)
+#define BHYVE_BIOS_PHYSICAL_END  ((UINTN)0x0010)
+
+#pragma pack (1)
+
+typedef struct {
+  EFI_ACPI_DESCRIPTION_HEADERHeader;
+  UINT64 Tables[0];
+} EFI_ACPI_2_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE;
+
+#pragma pack ()
+
 STATIC
 EFI_STATUS
 EFIAPI
@@ -164,3 +176,249 @@ BhyveInstallAcpiTable (
TableKey
);
 }
+
+/**
+  Get the address of bhyve's ACPI Root System Description Pointer (RSDP).
+
+  @param  RsdpPtr Return pointer to RSDP.
+
+  @retval EFI_SUCCESS Bhyve's RSDP successfully found.
+  @retval EFI_NOT_FOUND   Couldn't find bhyve's RSDP.
+  @retval EFI_UNSUPPORTED Revision is lower than 2.
+  @retval EFI_PROTOCOL_ERROR  Invalid RSDP found.
+
+**/
+EFI_STATUS
+EFIAPI
+BhyveGetAcpiRsdp (
+  OUT   EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER  **RsdpPtr
+  )
+{
+  UINTN RsdpAddress;
+  EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER  *Rsdp;
+  UINT8 Sum;
+
+  if (RsdpPtr == NULL) {
+return EFI_INVALID_PARAMETER;
+  }
+
+  //
+  // Detect the RSDP
+  //
+  for (RsdpAddress = BHYVE_ACPI_PHYSICAL_ADDRESS;
+   RsdpAddress < BHYVE_BIOS_PHYSICAL_END;
+   RsdpAddress += 0x10)
+  {
+Rsdp = NUMERIC_VALUE_AS_POINTER (
+ EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER,
+ RsdpAddress
+ );
+if (Rsdp->Signature != 
EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER_SIGNATURE) {
+  continue;
+}
+
+if (Rsdp->Revision < 2) {
+  DEBUG ((DEBUG_WARN, "%a: unsupported RSDP found\n", __func__));
+  return EFI_UNSUPPORTED;
+}
+
+//
+// For ACPI 1.0/2.0/3.0 the checksum of first 20 bytes should be 0.
+// For ACPI 2.0/3.0 the checksum of the entire table should be 0.
+//
+

Re: [edk2-devel] [edk2-platforms][PATCH V2 2/3] ManageabilityPkg: Use SMBUS I2C instead of I2C

2023-04-17 Thread Tinh Nguyen via groups.io

|||Reviewed-by: Tinh Nguyen |

On 4/17/2023 7:55 PM, abner.ch...@amd.com wrote:

From: Abner Chang

Signed-off-by: Abner Chang
Cc: Isaac Oram
Cc: Abdul Lateef Attar
Cc: Nickle Wang
Cc: Tinh Nguyen
---
  Features/ManageabilityPkg/ManageabilityPkg.dec | 10 +-
  .../BaseManageabilityTransportHelper.inf   |  2 +-
  .../BaseManageabilityTransportHelper.c | 14 +++---
  3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dec 
b/Features/ManageabilityPkg/ManageabilityPkg.dec
index 9a930d3e4b..3d279ef033 100644
--- a/Features/ManageabilityPkg/ManageabilityPkg.dec
+++ b/Features/ManageabilityPkg/ManageabilityPkg.dec
@@ -32,13 +32,13 @@
# Manageability Transport Interface type
#
# Manageability Transport KCS
-  gManageabilityTransportKcsGuid= { 0x5A6E64E9, 0xFD47, 0x4086, { 0xAA, 
0xB0, 0x7A, 0x5F, 0xD7, 0x6B, 0x02, 0x2E } }
-  # Manageability Transport I2C
-  gManageabilityTransportI2CGuid= { 0x5B174658, 0x8263, 0x4CB8, { 0xA0, 
0x0F, 0xD6, 0x82, 0xE6, 0xBC, 0x74, 0x93 } }
+  gManageabilityTransportKcsGuid  = { 0x5A6E64E9, 0xFD47, 0x4086, { 0xAA, 
0xB0, 0x7A, 0x5F, 0xD7, 0x6B, 0x02, 0x2E } }
+  # Manageability Transport SMBUS I2C
+  gManageabilityTransportSmbusI2cGuid = { 0x5B174658, 0x8263, 0x4CB8, { 0xA0, 
0x0F, 0xD6, 0x82, 0xE6, 0xBC, 0x74, 0x93 } }
# Manageability Transport PCI VDM
-  gManageabilityTransportPciVdmGuid = { 0x388021A7, 0xFB59, 0x4811, { 0x9D, 
0xA7, 0xD5, 0x63, 0x7D, 0x04, 0xA7, 0x2F } }
+  gManageabilityTransportPciVdmGuid   = { 0x388021A7, 0xFB59, 0x4811, { 0x9D, 
0xA7, 0xD5, 0x63, 0x7D, 0x04, 0xA7, 0x2F } }
# Manageability Transport MCTP
-  gManageabilityTransportMctpGuid   = { 0x6798448D, 0x1200, 0x4577, { 0x82, 
0x50, 0xA9, 0x83, 0xBA, 0x2B, 0x45, 0xD9 } }
+  gManageabilityTransportMctpGuid = { 0x6798448D, 0x1200, 0x4577, { 0x82, 
0x50, 0xA9, 0x83, 0xBA, 0x2B, 0x45, 0xD9 } }
  
# Manageability Protocol Specification

#
diff --git 
a/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.inf
 
b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.inf
index 95c3362ddb..5447954144 100644
--- 
a/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.inf
+++ 
b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.inf
@@ -32,7 +32,7 @@
  
  [Guids]

gManageabilityTransportKcsGuid
-  gManageabilityTransportI2CGuid
+  gManageabilityTransportSmbusI2cGuid
gManageabilityTransportPciVdmGuid
gManageabilityTransportMctpGuid
gManageabilityProtocolIpmiGuid
diff --git 
a/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.c
 
b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.c
index 81da209764..c3f35b7beb 100644
--- 
a/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.c
+++ 
b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.c
@@ -15,13 +15,13 @@
  // Make sure the global variables added here should be unchangable.
  //
  MANAGEABILITY_SPECIFICATION_NAME  ManageabilitySpecNameTable[] = {
-  { ,L"KCS" },
-  { ,L"I2C" },
-  { , L"PCI VDM" },
-  { ,   L"MCTP"},
-  { ,L"IPMI"},
-  { ,L"MCTP"},
-  { ,L"PLDM"}
+  { , L"KCS"  },
+  { ,L"SMBUS I2C"},
+  { ,  L"PCI VDM"  },
+  { ,L"MCTP" },
+  { , L"IPMI" },
+  { , L"MCTP" },
+  { , L"PLDM" }
  };
  
  UINT16  mManageabilitySpecNum = sizeof (ManageabilitySpecNameTable)/ sizeof (MANAGEABILITY_SPECIFICATION_NAME);



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




Re: [edk2-devel] [PATCH 1/1] OvmfPkg/BhyveBhf: install bhyve's ACPI tables

2023-04-17 Thread Gerd Hoffmann
> Hi Gerd,
> 
> thanks for your reply. It's mostly the same code. Only the start and
> end of the scanned range differ. So, it does make sense to share the
> same implementation.
> Where's the right place for this shared implementation? Is it
> "OvmfPkg/Library"?

Yes.

take care,
  Gerd



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




Re: [edk2-devel] [PATCH v3 09/13] BaseTools/Conf/tools_def.template: Add GCC and GCCNOLTO toolchains

2023-04-17 Thread Rebecca Cran

On 4/17/23 5:03 AM, Gerd Hoffmann wrote:

Does it make sense to have a separate prefix for each gcc variant?

I guess it makes sense for the existing GCC5 and GCC4x configs for
backward compatibility reasons, but for the new GCC / GCCNOLTO variants
not so much.
I think I'd prefer to add the new prefixes just since it's something 
people might expect.

Trying to build ia32 ovmf with clang (15) and openssl fails btw:

ld.lld: error: undefined symbol: __lshrdi3

But I guess that isn't something new introduced by this series.


If it's an existing issue, then I won't try and fix it in this patch 
series but revisit it later on.



--
Rebecca Cran



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103098): https://edk2.groups.io/g/devel/message/103098
Mute This Topic: https://groups.io/mt/98302347/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 0/2] Set Firmware Version from build command line

2023-04-17 Thread Rebecca Cran

On 4/17/23 4:17 AM, Gerd Hoffmann wrote:

On Fri, Apr 14, 2023 at 06:13:03AM -0600, Rebecca Cran wrote:

Sorry for not commenting on this earlier.

Would it be better to have people use the build `--pcd` option instead? e.g.
build 
--pcd="gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString=edk2-stable202302".

Possible, but the syntax is not that simple, you need 'L' prefix (so
CHAR16 not CHAR8 is used) and '\0' postfix (so the string is properly
terminated), i.e. --pcd=PcdFirmwareVersionString="L${version}\\0".

Providing a shorter and less error prone way to specify the version
looks sensible to me.


Agreed. Thanks.


--
Rebecca Cran



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




[edk2-devel] [PATCH edk2-platforms v1 1/1] Platform/ARM: Reduce System Memory Size for FVP with RME extensions

2023-04-17 Thread Sami Mujawar
For older FVPs (without support for RME extension) the top 16MB of
DRAM1 is reserved as Trusted DRAM. However, the latest FVP Base RevC
AEM Model [1] has support for RME extension. When RME extension is
present the top 64MB of DRAM1 (i.e. at the top of the 32bit address
space) is carved out for four-world support in TF-A [2].

Therefore, reduce the System Memory size by 64MB.

Reference:
[1] FVP Base RevC AEM Model (available on x86_64 / Arm64 Linux)
(https://developer.arm.com/Tools%20and%20Software/
Fixed%20Virtual%20Platforms)

[2] commit c872072 (https://review.trustedfirmware.org/plugins/gitiles/
TF-A/trusted-firmware-a/+/c8720729726faffc39ec64f3a02440a48c8c305a))

Signed-off-by: Sami Mujawar 
---
 Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc 
b/Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc
index 
dc081794cf98a27c667ef85bd27dacd80e9e8bd2..f70a4d52ba06f570e017ab5286f06d87193753e5
 100644
--- a/Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc
+++ b/Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc
@@ -107,9 +107,12 @@ [PcdsFixedAtBuild.common]
   gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x4000
   gArmPlatformTokenSpaceGuid.PcdCPUCoreSecondaryStackSize|0x0
 
-  # System Memory (2GB - 16MB of Trusted DRAM at the top of the 32bit address 
space)
+  # System Memory
+  # When RME is supported by the FVP the top 64MB of DRAM1 (i.e. at the top
+  # of the 32bit address space) is reserved for four-world support in TF-A.
+  # Therefore, set the default System Memory size to (2GB - 64MB).
   gArmTokenSpaceGuid.PcdSystemMemoryBase|0x8000
-  gArmTokenSpaceGuid.PcdSystemMemorySize|0x7F00
+  gArmTokenSpaceGuid.PcdSystemMemorySize|0x7C00
 
   # Size of the region used by UEFI in permanent memory (Reserved 64MB)
   gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x0400
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103096): https://edk2.groups.io/g/devel/message/103096
Mute This Topic: https://groups.io/mt/98319017/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 1/3] ManageabilityPkg/IpmiPpi: Fix duplicate library instance

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

Sure, I fixed it. Please check V2

Thanks
Abner

> -Original Message-
> From: Tinh Nguyen 
> Sent: Monday, April 17, 2023 6:40 PM
> To: Chang, Abner ; devel@edk2.groups.io
> Cc: Isaac Oram ; Attar, AbdulLateef (Abdul Lateef)
> ; Nickle Wang 
> Subject: Re: [edk2-platforms][PATCH 1/3] ManageabilityPkg/IpmiPpi: Fix
> duplicate library instance
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> Hi Abner,
> 
> Please assist me in changing the email address to
> tinhngu...@os.amperecomputing.com.
> 
> Reviewed-by: Tinh Nguyen 
> 
> On 15/04/2023 18:57, abner.ch...@amd.com wrote:
> > [EXTERNAL EMAIL NOTICE: This email originated from an external sender.
> > Please be mindful of safe email handling and proprietary information
> > protection practices.]
> >
> >
> > From: Abner Chang 
> >
> > Remove duplicate library instance in [LibraryClass] section.
> >
> > Signed-off-by: Abner Chang 
> > Cc: Isaac Oram 
> > Cc: Abdul Lateef Attar 
> > Cc: Nickle Wang 
> > Cc: Tinh Nguyen 
> > ---
> >   .../ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf   | 1 -
> >   1 file changed, 1 deletion(-)
> >
> > diff --git
> > a/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf
> > b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf
> > index 8d59b46d48..3f839625ac 100644
> > ---
> > a/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf
> > +++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.
> > +++ inf
> > @@ -37,7 +37,6 @@
> > ManageabilityTransportHelperLib
> > ManageabilityTransportLib
> > PeimEntryPoint
> > -  ManageabilityTransportLib
> >
> >   [Ppis]
> > gPeiIpmiPpiGuid   # PPI ALWAYS PRODUCED
> > --
> > 2.37.1.windows.1
> >


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




[edk2-devel] [edk2-platforms][PATCH V2 3/3] ManageabilityPkg: Support AARCH64

2023-04-17 Thread Chang, Abner via groups.io
From: Abner Chang 

Add AARCH64 support in Manageability.dsc

Signed-off-by: Abner Chang 
Cc: Isaac Oram 
Cc: Abdul Lateef Attar 
Cc: Nickle Wang 
Cc: Tinh Nguyen 
Reviewed-by: Abdul Lateef Attar 
Reviewed-by: Tinh Nguyen 
---
 .../ManageabilityPkg/Include/Dsc/Manageability.dsc| 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc 
b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
index 0d868fdf4a..7f8d8df3f0 100644
--- a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
+++ b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
@@ -15,11 +15,18 @@
   NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
   ArmSoftFloatLib|ArmPkg/Library/ArmSoftFloatLib/ArmSoftFloatLib.inf
+  ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
+  BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
 
-[Components.IA32]
+[LibraryClasses.AARCH64.PEIM]
+  
PeiServicesTablePointerLib|ArmPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
+
+[Components.IA32, Components.AARCH64]
   ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf
 
-[Components.X64]
+[Components.X64, Components.AARCH64]
   ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocolDxe.inf
+
+[Components.X64]
   ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocolSmm.inf
 
-- 
2.37.1.windows.1



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




[edk2-devel] [edk2-platforms][PATCH V2 2/3] ManageabilityPkg: Use SMBUS I2C instead of I2C

2023-04-17 Thread Chang, Abner via groups.io
From: Abner Chang 

Signed-off-by: Abner Chang 
Cc: Isaac Oram 
Cc: Abdul Lateef Attar 
Cc: Nickle Wang 
Cc: Tinh Nguyen 
---
 Features/ManageabilityPkg/ManageabilityPkg.dec | 10 +-
 .../BaseManageabilityTransportHelper.inf   |  2 +-
 .../BaseManageabilityTransportHelper.c | 14 +++---
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dec 
b/Features/ManageabilityPkg/ManageabilityPkg.dec
index 9a930d3e4b..3d279ef033 100644
--- a/Features/ManageabilityPkg/ManageabilityPkg.dec
+++ b/Features/ManageabilityPkg/ManageabilityPkg.dec
@@ -32,13 +32,13 @@
   # Manageability Transport Interface type
   #
   # Manageability Transport KCS
-  gManageabilityTransportKcsGuid= { 0x5A6E64E9, 0xFD47, 0x4086, { 0xAA, 
0xB0, 0x7A, 0x5F, 0xD7, 0x6B, 0x02, 0x2E } }
-  # Manageability Transport I2C
-  gManageabilityTransportI2CGuid= { 0x5B174658, 0x8263, 0x4CB8, { 0xA0, 
0x0F, 0xD6, 0x82, 0xE6, 0xBC, 0x74, 0x93 } }
+  gManageabilityTransportKcsGuid  = { 0x5A6E64E9, 0xFD47, 0x4086, { 0xAA, 
0xB0, 0x7A, 0x5F, 0xD7, 0x6B, 0x02, 0x2E } }
+  # Manageability Transport SMBUS I2C
+  gManageabilityTransportSmbusI2cGuid = { 0x5B174658, 0x8263, 0x4CB8, { 0xA0, 
0x0F, 0xD6, 0x82, 0xE6, 0xBC, 0x74, 0x93 } }
   # Manageability Transport PCI VDM
-  gManageabilityTransportPciVdmGuid = { 0x388021A7, 0xFB59, 0x4811, { 0x9D, 
0xA7, 0xD5, 0x63, 0x7D, 0x04, 0xA7, 0x2F } }
+  gManageabilityTransportPciVdmGuid   = { 0x388021A7, 0xFB59, 0x4811, { 0x9D, 
0xA7, 0xD5, 0x63, 0x7D, 0x04, 0xA7, 0x2F } }
   # Manageability Transport MCTP
-  gManageabilityTransportMctpGuid   = { 0x6798448D, 0x1200, 0x4577, { 0x82, 
0x50, 0xA9, 0x83, 0xBA, 0x2B, 0x45, 0xD9 } }
+  gManageabilityTransportMctpGuid = { 0x6798448D, 0x1200, 0x4577, { 0x82, 
0x50, 0xA9, 0x83, 0xBA, 0x2B, 0x45, 0xD9 } }
 
   # Manageability Protocol Specification
   #
diff --git 
a/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.inf
 
b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.inf
index 95c3362ddb..5447954144 100644
--- 
a/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.inf
+++ 
b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.inf
@@ -32,7 +32,7 @@
 
 [Guids]
   gManageabilityTransportKcsGuid
-  gManageabilityTransportI2CGuid
+  gManageabilityTransportSmbusI2cGuid
   gManageabilityTransportPciVdmGuid
   gManageabilityTransportMctpGuid
   gManageabilityProtocolIpmiGuid
diff --git 
a/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.c
 
b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.c
index 81da209764..c3f35b7beb 100644
--- 
a/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.c
+++ 
b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.c
@@ -15,13 +15,13 @@
 // Make sure the global variables added here should be unchangable.
 //
 MANAGEABILITY_SPECIFICATION_NAME  ManageabilitySpecNameTable[] = {
-  { ,L"KCS" },
-  { ,L"I2C" },
-  { , L"PCI VDM" },
-  { ,   L"MCTP"},
-  { ,L"IPMI"},
-  { ,L"MCTP"},
-  { ,L"PLDM"}
+  { , L"KCS"  },
+  { ,L"SMBUS I2C"},
+  { ,  L"PCI VDM"  },
+  { ,L"MCTP" },
+  { , L"IPMI" },
+  { , L"MCTP" },
+  { , L"PLDM" }
 };
 
 UINT16  mManageabilitySpecNum = sizeof (ManageabilitySpecNameTable)/ sizeof 
(MANAGEABILITY_SPECIFICATION_NAME);
-- 
2.37.1.windows.1



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




[edk2-devel] [edk2-platforms][PATCH V2 1/3] ManageabilityPkg/IpmiPpi: Fix duplicate library instance

2023-04-17 Thread Chang, Abner via groups.io
From: Abner Chang 

Remove duplicate library instance in [LibraryClass]
section.

Signed-off-by: Abner Chang 
Cc: Isaac Oram 
Cc: Abdul Lateef Attar 
Cc: Nickle Wang 
Cc: Tinh Nguyen 
Reviewed-by: Abdul Lateef Attar 
Reviewed-by: Tinh Nguyen 
---
 .../ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf   | 1 -
 1 file changed, 1 deletion(-)

diff --git 
a/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf 
b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf
index 8d59b46d48..3f839625ac 100644
--- a/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf
+++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf
@@ -37,7 +37,6 @@
   ManageabilityTransportHelperLib
   ManageabilityTransportLib
   PeimEntryPoint
-  ManageabilityTransportLib
 
 [Ppis]
   gPeiIpmiPpiGuid   # PPI ALWAYS PRODUCED
-- 
2.37.1.windows.1



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




Re: [edk2-devel] [PATCH tianocore-docs v3 2/2] Readme.md: Update the Gitbook documentation section

2023-04-17 Thread Leif Lindholm
Hi Mike,

Have been thinking on this (and been on holiday last week).

On Thu, Apr 06, 2023 at 16:28:57 +, Michael D Kinney wrote:
> I am not sure.  The current contributors agreement has support for code and 
> documentation.
>
> The specific sections on documents are:
> * 
> https://github.com/tianocore-docs/edk2-BuildSpecification/blob/db69f5661caec977fac9730e21e5a1132f6ff80b/CONTRIBUTIONS.txt#L29
> * 
> https://github.com/tianocore-docs/edk2-BuildSpecification/blob/db69f5661caec977fac9730e21e5a1132f6ff80b/CONTRIBUTIONS.txt#L60
> 
> There is an SPDX identifier for Free BSD Docs:
> * https://spdx.org/licenses/FreeBSD-DOC.html
> 
> What is not clear to me is if a COO indicated by Signed-off-by
> Combined with SPDX of FreeBSD-DOC is equivalent to the current
> contributors agreement or not.
> 
> Can you evaluate?

It's not *equivalent*, so the question is whether dropping it would be
problematic to anyone (be that practically, legally or politically).
- The TianoCore Contribution Agreement (TCA) explicitly grants rights
  to Intel, as opposed to the project, beyond what the FreeBSD license
  does.
- The FreeBSD Documentation License (FDL) as documented by SPDX
  explicitly references SGML (lol), whereas the license pointed to by
  the link now says AsciiDoc.
  - We could carry a copy of the licenseto disambiguate, but this is
as much a problem today as it would be if we dropped the TCA.

My view of the individual sections of the TCA:
- Section 1 - definitions. Feels redundant to me.
- Section 2 - license.
  - Sneaks in a non-endorsement clause. Do we need that?
  - Adds an explixit patent grant. Do we need that for the
*documentation* of software covered by an explicit patent grant?
  - Liability statement looks identical to BDL.
- Section 3 - Representations.
  - My view is the DCO(/COO) makes this section redundant.
- Section 4 - Third Party Contributions.
  - Feels conflicting/redundant with DCO, and less relevant for
documentation?
- Section 5 - Miscellaneous.
  - Feels at best redundant and at worst not compatible with either
FDL or DCO as applied to an open source project - feels yanked out
of a proprietary license.

/
Leif

> > -Original Message-
> > From: devel@edk2.groups.io  On Behalf Of Leif Lindholm
> > Sent: Thursday, April 6, 2023 2:47 AM
> > To: devel@edk2.groups.io
> > Cc: rebe...@bsdio.com; Ard Biesheuvel ; Demeter, 
> > Miki ; Kinney, Michael
> > D 
> > Subject: Re: [edk2-devel] [PATCH tianocore-docs v3 2/2] Readme.md: Update 
> > the Gitbook documentation section
> > 
> > On Thu, Apr 06, 2023 at 10:42:34 +0100, Leif Lindholm wrote:
> > > On Wed, Apr 05, 2023 at 19:06:18 -0600, Rebecca Cran wrote:
> > > > We no longer use Gitbook for publishing the documentation.
> > > > Update the section to direct users to use the mailing list to
> > > > send feedback, and since we use GitHub Flavored Markdown, remove the
> > > > link to Gitbook.
> > > >
> > > > Contributed-under: TianoCore Contribution Agreement 1.1
> > >
> > > We don't use that any more, please drop (old template?).
> > 
> > Or, err, have we not fixed that for tianocore-docs?
> > This feels suboptimal.
> > 
> > Mike: is this something we can address?
> > 
> > /
> > Leif
> > 
> > > With that:
> > > Reviewed-by: Leif Lindholm 
> > >
> > > > Signed-off-by: Rebecca Cran 
> > > > ---
> > > >  Readme.md | 7 +++
> > > >  1 file changed, 3 insertions(+), 4 deletions(-)
> > > >
> > > > diff --git a/Readme.md b/Readme.md
> > > > index 1e4a5d25bd6f..494b23af3ac7 100644
> > > > --- a/Readme.md
> > > > +++ b/Readme.md
> > > > @@ -30,12 +30,11 @@ documentation.
> > > >
> > > >  # EDK II GitBook Documents
> > > >
> > > > -These are the latest draft revisions published using 
> > > > [Gitbook](https://legacy.gitbook.com/).
> > > > +These are the latest draft revisions.
> > > >  The source content for these documents are in GIT repositories in the
> > > >  [Tianocore-docs](https://github.com/tianocore-docs) organization 
> > > > hosted by [GitHub](https://github.com).
> > > > -Feedback on these documents may be provided using the 
> > > > [Gitbook](https://www.gitbook.com) commenting feature
> > > > -available when reading the **HTML** versions of the documents. 
> > > > Document issues and feature requests can also
> > > > -be entered in [Tianocore Bugzilla](https://bugzilla.tianocore.org).
> > > > +Feedback on these documents may be provided via the mailing list.
> > > > +Document issues and feature requests can also be entered in [Tianocore 
> > > > Bugzilla](https://bugzilla.tianocore.org).
> > > >
> > > >  * **_EDK II Build Specification_** \[
> > > >  [HTML   
> > > > ](https://tianocore-docs.github.io/edk2-BuildSpecification/draft/),
> > > > --
> > > > 2.39.2 (Apple Git-143)
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> > >
> > 
> > 
> > 
> > 
> 
> 
> 
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online 

Re: [edk2-devel] [PATCH 1/1] OvmfPkg/BhyveBhf: install bhyve's ACPI tables

2023-04-17 Thread Gerd Hoffmann
On Mon, Apr 17, 2023 at 01:46:01PM +0200, Corvin Köhne wrote:
> It's much easier to create configuration dependend ACPI tables for bhyve
> than for OVMF. For this reason, don't use the statically created ACPI
> tables provided by OVMF. Instead prefer the dynamically created ACPI
> tables of bhyve. If bhyve provides no ACPI tables or we are unable to
> detect those, fall back to OVMF tables.
> 
> Ideally, we use the qemu fwcfg interface to pass the ACPI tables from
> bhyve to OVMF. bhyve will support this in the future. However, current
> bhyve executables don't support passing ACPI tables by the qemu fwcfg
> interface. They just copy the ACPI into main memory. For that reason,
> pick up the ACPI tables from main memory.
> 
> Implementation is similar to OvmfPkg/XenAcpiPlatformDxe/Xen.c.

Can both Xen and Bhyve share the same implementation?

Given in both cases RAM is scanned for the RSDP I'd expect it should
not be very hard and we avoid duplicating the code.

take care,
  Gerd



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




Re: [edk2-devel] [PATCH 1/1] OvmfPkg/BhyveBhf: install bhyve's ACPI tables

2023-04-17 Thread Rebecca Cran

On 4/17/23 5:46 AM, Corvin Köhne wrote:

+
+/**
+  Get the address of bhyve's ACPI Root System Description Pointer (RSDP).
+
+  @param  RsdpPtr Return pointer to RSDP.
+
+  @return EFI_SUCCESS Bhyve's RSDP successfully found.
+  @return EFI_NOT_FOUND   Couldn't find bhyve's RSDP.
+  @return EFI_UNSUPPORTED Revision is lower than 2.
+  @return EFI_PROTOCOL_ERROR  Invalid RSDP found.


I think these should be @retval instead of @return ?


+if (Rsdp->Revision < 2) {
+  DEBUG ((DEBUG_INFO, "%a: unsupported RSDP found\n", __FUNCTION__));


You missed converting this __FUNCTION__ to __func__.


+//
+// For ACPI 1.0/2.0/3.0 the checksum of first 20 bytes should be 0.
+// For ACPI 2.0/3.0 the checksum of the entire table should be 0.
+//
+UINT8  Sum = CalculateCheckSum8 (
+   (CONST UINT8 *)Rsdp,
+   sizeof (EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER)
+   );


Variables should be declared at the top of the function, and initialized 
separately.



+if (Sum != 0) {
+  DEBUG ((
+DEBUG_INFO,
+"%a: RSDP header checksum not valid: 0x%02x\n",
+__func__,
+Sum
+));
+  return EFI_PROTOCOL_ERROR;
+}
+
+Sum = CalculateCheckSum8 (
+(CONST UINT8 *)Rsdp,
+sizeof (EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER)
+);
+if (Sum != 0) {
+  DEBUG ((
+DEBUG_INFO,
+"%a: RSDP table checksum not valid: 0x%02x\n",
+__func__,
+Sum
+));
+  return EFI_PROTOCOL_ERROR;
+}
+
+//
+// RSDP was found and is valid
+//
+*RsdpPtr = Rsdp;
+
+return EFI_SUCCESS;
+  }
+
+  DEBUG ((DEBUG_INFO, "%a: RSDP not found\n", __func__));
Should these DEBUG_INFO messages which appear to be warnings/errors use 
DEBUG_WARN or DEBUG_ERROR, instead?



--
Rebecca Cran



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103089): https://edk2.groups.io/g/devel/message/103089
Mute This Topic: https://groups.io/mt/98317333/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 3/3] Maintainers.txt: Adds AMD/AmdMinBoardPkg maintainers

2023-04-17 Thread Leif Lindholm
On Mon, Apr 17, 2023 at 05:56:37 +, Attar, AbdulLateef (Abdul Lateef) wrote:
> [AMD Official Use Only - General]
> 
> Hi @Ard Biesheuvel , @Leif Lindholm, @Michael D Kinney,
> I had renamed the folder from MinBoardPkg to AmdMinBoardPkg, could 
> you please review it.

Ah, sorry, didn't notice you'd dropped my R-b.
Since my concern was with the name being specific enough, and this
change made it more specific, I have no issues with it - so the series
can keep:

Reviewed-by: Leif Lindholm 

/
Leif

> Thanks
> AbduL
> 
> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Abdul Lateef 
> Attar via groups.io
> Sent: 03 April 2023 16:53
> To: devel@edk2.groups.io
> Cc: Attar, AbdulLateef (Abdul Lateef) ; Attar, 
> AbdulLateef (Abdul Lateef) ; Ard Biesheuvel 
> ; Leif Lindholm ; 
> Chang, Abner ; Michael D Kinney 
> 
> Subject: [edk2-devel] [PATCH v4 3/3] Maintainers.txt: Adds AMD/AmdMinBoardPkg 
> maintainers
> 
> Caution: This message originated from an External Source. Use proper caution 
> when opening attachments, clicking links, or responding.
> 
> 
> From: Abdul Lateef Attar 
> 
> Adds maintainers for AMD/AmdMinBoardPkg
> 
> Signed-off-by: Abdul Lateef Attar 
> Cc: Ard Biesheuvel 
> Cc: Leif Lindholm 
> Cc: Abner Chang 
> Cc: Michael D Kinney 
> ---
>  Maintainers.txt | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/Maintainers.txt b/Maintainers.txt index 
> 1871ffaa26bd..24918d1c6ede 100644
> --- a/Maintainers.txt
> +++ b/Maintainers.txt
> @@ -91,6 +91,11 @@ F: Silicon/AMD/Styx/
>  M: Ard Biesheuvel 
>  M: Leif Lindholm 
> 
> +AMD MinBoard package for MinPlatformPkg
> +F: Platform/AMD/AmdMinBoardPkg
> +M: Abner Chang 
> +M: Abdul Lateef Attar 
> +
>  Ampere Computing
>  F: Platform/Ampere
>  F: Silicon/Ampere
> --
> 2.25.1
> 
> 
> 
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103088): https://edk2.groups.io/g/devel/message/103088
Mute This Topic: https://groups.io/mt/98317247/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] [edk2-platforms][PATCH] ManageabilityPkg: add support for the phosphor ipmi blob transfer protocol

2023-04-17 Thread Mike Maslenkin
Hello Nick,

CalculateCrc16 function has already defined in
edk2-platforms/Platform/Intel/WhitleyOpenBoardPkg/Include/Library/CrcLib.h
and edk2/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c.
This patch adds another CalculateCrc16 declaration.
There was an attempt to unify Crc16 calculation [*], but it left
implementations mentioned above untouched.
I would suggest to rename CalculateCrc16 provided by this path to
something like CalculateCrc16Ccitt.
It could be easy moved to MdePkg later.

[*] https://bugzilla.tianocore.org/show_bug.cgi?id=3871

On Wed, Apr 12, 2023 at 6:17 AM Nickle Wang via groups.io
 wrote:
>
> This change implements the blob transfer protocol used in OpenBmc
> documented here: https://github.com/openbmc/phosphor-ipmi-blobs
>
> Signed-off-by: Nick Ramirez 
> Cc: Abner Chang 
> Cc: Isaac Oram 
> Cc: Abdul Lateef Attar 
> Cc: Nickle Wang 
> Cc: Tinh Nguyen 
> ---
>  .../ManageabilityPkg/ManageabilityPkg.dec |6 +
>  .../Include/Dsc/Manageability.dsc |4 +-
>  .../IpmiBlobTransferDxe.inf   |   39 +
>  .../IpmiBlobTransferTestUnitTestsHost.inf |   40 +
>  .../Include/Protocol/IpmiBlobTransfer.h   |  136 ++
>  .../InternalIpmiBlobTransfer.h|  363 ++
>  .../IpmiBlobTransferDxe/IpmiBlobTransferDxe.c |  799 
>  .../UnitTest/IpmiBlobTransferTestUnitTests.c  | 1113 +
>  .../Universal/IpmiBlobTransferDxe/Readme.md   |   24 +
>  9 files changed, 2523 insertions(+), 1 deletion(-)
>  create mode 100644 
> Features/ManageabilityPkg/Universal/IpmiBlobTransferDxe/IpmiBlobTransferDxe.inf
>  create mode 100644 
> Features/ManageabilityPkg/Universal/IpmiBlobTransferDxe/UnitTest/IpmiBlobTransferTestUnitTestsHost.inf
>  create mode 100644 
> Features/ManageabilityPkg/Include/Protocol/IpmiBlobTransfer.h
>  create mode 100644 
> Features/ManageabilityPkg/Universal/IpmiBlobTransferDxe/InternalIpmiBlobTransfer.h
>  create mode 100644 
> Features/ManageabilityPkg/Universal/IpmiBlobTransferDxe/IpmiBlobTransferDxe.c
>  create mode 100644 
> Features/ManageabilityPkg/Universal/IpmiBlobTransferDxe/UnitTest/IpmiBlobTransferTestUnitTests.c
>  create mode 100644 
> Features/ManageabilityPkg/Universal/IpmiBlobTransferDxe/Readme.md
>
> diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dec 
> b/Features/ManageabilityPkg/ManageabilityPkg.dec
> index 9a930d3e4b..e2d650 100644
> --- a/Features/ManageabilityPkg/ManageabilityPkg.dec
> +++ b/Features/ManageabilityPkg/ManageabilityPkg.dec
> @@ -4,6 +4,7 @@
>  # those are related to the platform management.
>  #
>  # Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
> +# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
>  # SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
>  ##
> @@ -48,3 +49,8 @@
>gManageabilityProtocolMctpGuid= { 0x76FED8F1, 0x0BE5, 0x4269, { 0xA3, 
> 0x1A, 0x38, 0x0F, 0x54, 0xF1, 0xA1, 0x8A } }
># Manageability Protocol PLDM
>gManageabilityProtocolPldmGuid= { 0x3958090D, 0x69DD, 0x4868, { 0x9C, 
> 0x41, 0xC9, 0xAC, 0x31, 0xB5, 0x25, 0xC5 } }
> +
> +[Protocols]
> +
> +  ## Include/Protocol/IpmiBlobTransfer.h
> +  gEdkiiIpmiBlobTransferProtocolGuid = { 0x05837c75, 0x1d65, 0x468b, { 0xb1, 
> 0xc2, 0x81, 0xaf, 0x9a, 0x31, 0x5b, 0x2c } }
> diff --git a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc 
> b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
> index 0d868fdf4a..111d6b91dc 100644
> --- a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
> +++ b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
> @@ -2,11 +2,13 @@
>  # Common libraries for Manageabilty Package
>  #
>  # Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
> +# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
>  # SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
>  ##
>  [LibraryClasses]
>
> ManageabilityTransportHelperLib|ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.inf
> +  
> IpmiLib|MdeModulePkg/Library/DxeIpmiLibIpmiProtocol/DxeIpmiLibIpmiProtocol.inf
>
>  [LibraryClasses.ARM, LibraryClasses.AARCH64]
>#
> @@ -22,4 +24,4 @@
>  [Components.X64]
>ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocolDxe.inf
>ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocolSmm.inf
> -
> +  ManageabilityPkg/Universal/IpmiBlobTransferDxe/IpmiBlobTransferDxe.inf
> diff --git 
> a/Features/ManageabilityPkg/Universal/IpmiBlobTransferDxe/IpmiBlobTransferDxe.inf
>  
> b/Features/ManageabilityPkg/Universal/IpmiBlobTransferDxe/IpmiBlobTransferDxe.inf
> new file mode 100644
> index 00..28e9d293c1
> --- /dev/null
> +++ 
> b/Features/ManageabilityPkg/Universal/IpmiBlobTransferDxe/IpmiBlobTransferDxe.inf
> @@ -0,0 +1,39 @@
> +## @file
> +# IPMI Blob Transfer Protocol DXE Driver.
> +#
> +#  Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights 
> reserved.
> +#
> +#  

Re: [edk2-devel] [PATCH v3 00/13] BaseTools,CryptoPkg,EmulatorPkg,MdePkg,others: Delete CLANG35,CLANG38,VS2008-2013,EBC, deprecate GCC48,GCC49,GCC5, add GCC and GCCNOLTO, update CLANGDWARF

2023-04-17 Thread Gerd Hoffmann
On Sun, Apr 16, 2023 at 11:05:19AM -0600, Rebecca Cran wrote:
> Update the toolchain definitions:
> 
> - Delete the CLANG35 and CLANG38 toolchains, and replace CLANG38 with
>   CLANGDWARF, updating it to support ARM and AARCH64 in addition to X64
> and IA32.

ARM not working for me in the cross build case:

/usr/bin/ld: unrecognised emulation mode: armelf_linux_eabi
Supported emulations: elf_x86_64 elf32_x86_64 elf_i386 elf_iamcu elf_l1om 
elf_k1om i386pep i386pe elf64bpf

I guess that is just the wrong linker (ld instead of lld)?

take care,
  Gerd



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




Re: [edk2-devel] [PATCH v3 09/13] BaseTools/Conf/tools_def.template: Add GCC and GCCNOLTO toolchains

2023-04-17 Thread Gerd Hoffmann
> +DEFINE GCCNOLTO_IA32_PREFIX= ENV(GCCNOLTO_BIN)
> +DEFINE GCCNOLTO_X64_PREFIX = ENV(GCCNOLTO_BIN)
> +
>  DEFINE GCC5_IA32_PREFIX= ENV(GCC5_BIN)
>  DEFINE GCC5_X64_PREFIX = ENV(GCC5_BIN)
> +DEFINE GCC_IA32_PREFIX = ENV(GCC_BIN)
> +DEFINE GCC_X64_PREFIX  = ENV(GCC_BIN)

Does it make sense to have a separate prefix for each gcc variant?

I guess it makes sense for the existing GCC5 and GCC4x configs for
backward compatibility reasons, but for the new GCC / GCCNOLTO variants
not so much.

Trying to build ia32 ovmf with clang (15) and openssl fails btw:

ld.lld: error: undefined symbol: __lshrdi3

But I guess that isn't something new introduced by this series.

take care,
  Gerd



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103085): https://edk2.groups.io/g/devel/message/103085
Mute This Topic: https://groups.io/mt/98302347/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 3/3] ManageabilityPkg: Support AARCH64

2023-04-17 Thread Tinh Nguyen via groups.io



Reviewed-by: Tinh Nguyen 

On 15/04/2023 18:57, abner.ch...@amd.com wrote:

[EXTERNAL EMAIL NOTICE: This email originated from an external sender. Please 
be mindful of safe email handling and proprietary information protection 
practices.]


From: Abner Chang 

Add AARCH64 support in Manageability.dsc

Signed-off-by: Abner Chang 
Cc: Isaac Oram 
Cc: Abdul Lateef Attar 
Cc: Nickle Wang 
Cc: Tinh Nguyen 
---
  .../ManageabilityPkg/Include/Dsc/Manageability.dsc| 11 +--
  1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc 
b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
index 0d868fdf4a..7f8d8df3f0 100644
--- a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
+++ b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
@@ -15,11 +15,18 @@
NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
ArmSoftFloatLib|ArmPkg/Library/ArmSoftFloatLib/ArmSoftFloatLib.inf
+  ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
+  BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf

-[Components.IA32]
+[LibraryClasses.AARCH64.PEIM]
+  
PeiServicesTablePointerLib|ArmPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
+
+[Components.IA32, Components.AARCH64]
ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf

-[Components.X64]
+[Components.X64, Components.AARCH64]
ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocolDxe.inf
+
+[Components.X64]
ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocolSmm.inf

--
2.37.1.windows.1




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103084): https://edk2.groups.io/g/devel/message/103084
Mute This Topic: https://groups.io/mt/98280324/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 1/3] ManageabilityPkg/IpmiPpi: Fix duplicate library instance

2023-04-17 Thread Tinh Nguyen via groups.io

Hi Abner,

Please assist me in changing the email address to 
tinhngu...@os.amperecomputing.com.

Reviewed-by: Tinh Nguyen 

On 15/04/2023 18:57, abner.ch...@amd.com wrote:

[EXTERNAL EMAIL NOTICE: This email originated from an external sender. Please 
be mindful of safe email handling and proprietary information protection 
practices.]


From: Abner Chang 

Remove duplicate library instance in [LibraryClass]
section.

Signed-off-by: Abner Chang 
Cc: Isaac Oram 
Cc: Abdul Lateef Attar 
Cc: Nickle Wang 
Cc: Tinh Nguyen 
---
  .../ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf   | 1 -
  1 file changed, 1 deletion(-)

diff --git 
a/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf 
b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf
index 8d59b46d48..3f839625ac 100644
--- a/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf
+++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf
@@ -37,7 +37,6 @@
ManageabilityTransportHelperLib
ManageabilityTransportLib
PeimEntryPoint
-  ManageabilityTransportLib

  [Ppis]
gPeiIpmiPpiGuid   # PPI ALWAYS PRODUCED
--
2.37.1.windows.1




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




Re: [edk2-devel] [PATCH 0/5] Platforms cleanup v1

2023-04-17 Thread Sunil V L
On Thu, Apr 13, 2023 at 08:38:24AM +, Chai, Evan wrote:
> Hi Sunil, 
>Sorry to remind, do we need one more reviewer for it? Or you can help to 
> merge it now? 
> 
Merged.

Thanks,
Sunil


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103082): https://edk2.groups.io/g/devel/message/103082
Mute This Topic: https://groups.io/mt/98015394/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 0/2] Set Firmware Version from build command line

2023-04-17 Thread Gerd Hoffmann
On Fri, Apr 14, 2023 at 06:13:03AM -0600, Rebecca Cran wrote:
> Sorry for not commenting on this earlier.
> 
> Would it be better to have people use the build `--pcd` option instead? e.g.
> build 
> --pcd="gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString=edk2-stable202302".

Possible, but the syntax is not that simple, you need 'L' prefix (so
CHAR16 not CHAR8 is used) and '\0' postfix (so the string is properly
terminated), i.e. --pcd=PcdFirmwareVersionString="L${version}\\0".

Providing a shorter and less error prone way to specify the version
looks sensible to me.

take care,
  Gerd



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




Re: [edk2-devel] Strange behavior between GCC 11 and GCC 12

2023-04-17 Thread Gerd Hoffmann
On Fri, Apr 14, 2023 at 04:39:23PM -0500, Tom Lendacky wrote:
> On 4/14/23 15:23, Tom Lendacky wrote:
> > I've been trying to debug a problem I'm seeing when I moved to the GCC 12
> > compiler. Under SEV it results in the guest crashing.
> 
> False alarm, I was on the wrong branch that does not have ff36b2550f94
> ("OvmfPkg/Sec: fix stack switch")... disregard.

FYI: You need 129404f6e439 too.

HTH,
  Gerd



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




[edk2-devel] [PATCH 2/4] OvmfPkg/VirtioSerialDxe: add driver

2023-04-17 Thread Gerd Hoffmann
Add a driver for the virtio serial device.

The virtio serial device also known as virtio console device because
initially it had only support for a single tty, intended to be used as
console.  Support for multiple streams and named data ports has been
added later on.

The driver supports tty ports only, they are registered as SerialIo
UART in the system.

Named ports are detected and logged, but not exposed as devices.  They
are usually used by guest agents to communicate with the host.  It's not
clear whenever it makes sense for the firmware to run such agents and if
so which efi protocol could be to expose the ports.  So leaving that for
another day.

Signed-off-by: Gerd Hoffmann 
---
 OvmfPkg/VirtioSerialDxe/VirtioSerial.inf   |  40 ++
 OvmfPkg/VirtioSerialDxe/VirtioSerial.h | 226 ++
 OvmfPkg/VirtioSerialDxe/VirtioSerial.c | 789 +
 OvmfPkg/VirtioSerialDxe/VirtioSerialPort.c | 443 
 OvmfPkg/VirtioSerialDxe/VirtioSerialRing.c | 345 +
 5 files changed, 1843 insertions(+)
 create mode 100644 OvmfPkg/VirtioSerialDxe/VirtioSerial.inf
 create mode 100644 OvmfPkg/VirtioSerialDxe/VirtioSerial.h
 create mode 100644 OvmfPkg/VirtioSerialDxe/VirtioSerial.c
 create mode 100644 OvmfPkg/VirtioSerialDxe/VirtioSerialPort.c
 create mode 100644 OvmfPkg/VirtioSerialDxe/VirtioSerialRing.c

diff --git a/OvmfPkg/VirtioSerialDxe/VirtioSerial.inf 
b/OvmfPkg/VirtioSerialDxe/VirtioSerial.inf
new file mode 100644
index ..d63a08b928c0
--- /dev/null
+++ b/OvmfPkg/VirtioSerialDxe/VirtioSerial.inf
@@ -0,0 +1,40 @@
+## @file
+# This driver produces FIXME instances for virtio-serial devices.
+#
+# Copyright (C) 2016, Linaro Ltd.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION= 0x00010005
+  BASE_NAME  = VirtioSerialDxe
+  FILE_GUID  = 23CACE14-EBA4-49F6-9681-C697FF0B649E
+  MODULE_TYPE= UEFI_DRIVER
+  VERSION_STRING = 1.0
+  ENTRY_POINT= VirtioSerialEntryPoint
+
+[Sources]
+  VirtioSerial.h
+  VirtioSerial.c
+  VirtioSerialPort.c
+  VirtioSerialRing.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  OvmfPkg/OvmfPkg.dec
+
+[LibraryClasses]
+  BaseMemoryLib
+  DebugLib
+  DevicePathLib
+  MemoryAllocationLib
+  UefiBootServicesTableLib
+  UefiDriverEntryPoint
+  UefiLib
+  VirtioLib
+
+[Protocols]
+  gVirtioDeviceProtocolGuid## TO_START
+  gEfiSerialIoProtocolGuid
diff --git a/OvmfPkg/VirtioSerialDxe/VirtioSerial.h 
b/OvmfPkg/VirtioSerialDxe/VirtioSerial.h
new file mode 100644
index ..e626fdf43095
--- /dev/null
+++ b/OvmfPkg/VirtioSerialDxe/VirtioSerial.h
@@ -0,0 +1,226 @@
+/** @file
+
+  Private definitions of the VirtioRng RNG driver
+
+  Copyright (C) 2016, Linaro Ltd.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _VIRTIO_SERIAL_DXE_H_
+#define _VIRTIO_SERIAL_DXE_H_
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#define VIRTIO_SERIAL_SIG  SIGNATURE_32 ('V', 'S', 'I', 'O')
+
+#define MAX_PORTS  8
+#define MAX_RINGS  (MAX_PORTS * 2 + 2)
+
+#define CTRL_RX_BUFSIZE  128
+#define CTRL_TX_BUFSIZE  sizeof(VIRTIO_SERIAL_CONTROL)
+#define PORT_RX_BUFSIZE  128
+#define PORT_TX_BUFSIZE  128
+
+//
+// Data structures
+//
+
+typedef struct _VIRTIO_SERIAL_DEV  VIRTIO_SERIAL_DEV;
+typedef struct _VIRTIO_SERIAL_RING VIRTIO_SERIAL_RING;
+typedef struct _VIRTIO_SERIAL_PORT VIRTIO_SERIAL_PORT;
+typedef struct _VIRTIO_SERIAL_IO_PROTOCOL  VIRTIO_SERIAL_IO_PROTOCOL;
+
+struct _VIRTIO_SERIAL_RING {
+  VRING   Ring;
+  VOID*RingMap;
+  DESC_INDICESIndices;/* Avail Ring */
+  UINT16  LastUsedIdx;/* Used Ring */
+
+  UINT32  BufferSize;
+  UINT32  BufferCount;
+  UINT32  BufferPages;
+  UINT8   *Buffers;
+  VOID*BufferMap;
+  EFI_PHYSICAL_ADDRESSDeviceAddress;
+
+  BOOLEAN Ready;
+};
+
+struct _VIRTIO_SERIAL_PORT {
+  BOOLEAN  Ready;
+  BOOLEAN  Console;
+  BOOLEAN  DeviceOpen;
+
+  CHAR16   Name[32];
+
+  VIRTIO_SERIAL_IO_PROTOCOL*SerialIo;
+};
+
+struct _VIRTIO_SERIAL_DEV {
+  UINT32  Signature;
+  LIST_ENTRY  Link;
+
+  EFI_HANDLE  DriverBindingHandle;
+  EFI_HANDLE  DeviceHandle;
+  EFI_DEVICE_PATH_PROTOCOL*DevicePath;
+
+  VIRTIO_DEVICE_PROTOCOL  *VirtIo;
+  EFI_EVENT   ExitBoot;
+  VIRTIO_SERIAL_CONFIGConfig;
+  VIRTIO_SERIAL_PORT  Ports[MAX_PORTS];
+  VIRTIO_SERIAL_RING  Rings[MAX_RINGS];
+  EFI_EVENT   Timer;
+
+  UINT32  NumPorts;
+  UINT32  NumConsoles;
+  UINT32  NumNamedPorts;
+};
+
+struct _VIRTIO_SERIAL_IO_PROTOCOL {

[edk2-devel] [PATCH 4/4] OvmfPkg/PlatformBootManagerLib: setup virtio serial console

2023-04-17 Thread Gerd Hoffmann
In case a virtio-serial device is present in the system register the
first serial port as console.

Signed-off-by: Gerd Hoffmann 
---
 .../PlatformBootManagerLib/BdsPlatform.c  | 47 +++
 1 file changed, 47 insertions(+)

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c 
b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index a90076c9e672..3b7dc53e9f86 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -976,6 +976,45 @@ PreparePciSerialDevicePath (
   return EFI_SUCCESS;
 }
 
+EFI_STATUS
+PrepareVirtioSerialDevicePath (
+  IN EFI_HANDLE  DeviceHandle
+  )
+{
+  EFI_STATUSStatus;
+  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;
+
+  DevicePath = NULL;
+  Status = gBS->HandleProtocol (
+  DeviceHandle,
+  ,
+  (VOID *)
+  );
+  if (EFI_ERROR (Status)) {
+return Status;
+  }
+
+  gPnp16550ComPortDeviceNode.UID = 0;
+  DevicePath = AppendDevicePathNode (
+ DevicePath,
+ (EFI_DEVICE_PATH_PROTOCOL 
*)
+ );
+  DevicePath = AppendDevicePathNode (
+ DevicePath,
+ (EFI_DEVICE_PATH_PROTOCOL *)
+ );
+  DevicePath = AppendDevicePathNode (
+ DevicePath,
+ (EFI_DEVICE_PATH_PROTOCOL *)
+ );
+
+  EfiBootManagerUpdateConsoleVariable (ConOut, DevicePath, NULL);
+  EfiBootManagerUpdateConsoleVariable (ConIn, DevicePath, NULL);
+  EfiBootManagerUpdateConsoleVariable (ErrOut, DevicePath, NULL);
+
+  return EFI_SUCCESS;
+}
+
 EFI_STATUS
 VisitAllInstancesOfProtocol (
   IN EFI_GUID*Id,
@@ -1144,6 +1183,14 @@ DetectAndPreparePlatformPciDevicePath (
 return EFI_SUCCESS;
   }
 
+  if (((Pci->Hdr.VendorId == 0x1af4) && (Pci->Hdr.DeviceId == 0x1003)) ||
+  ((Pci->Hdr.VendorId == 0x1af4) && (Pci->Hdr.DeviceId == 0x1043)))
+  {
+DEBUG ((DEBUG_INFO, "Found virtio serial device\n"));
+PrepareVirtioSerialDevicePath (Handle);
+return EFI_SUCCESS;
+  }
+
   return Status;
 }
 
-- 
2.39.2



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




[edk2-devel] [PATCH 3/4] OvmfPkg/VirtioSerialDxe: wire up in OvmfPkg*

2023-04-17 Thread Gerd Hoffmann
Add the driver to the ovmf builds.

Signed-off-by: Gerd Hoffmann 
---
 OvmfPkg/Microvm/MicrovmX64.dsc | 1 +
 OvmfPkg/OvmfPkgIa32.dsc| 1 +
 OvmfPkg/OvmfPkgIa32X64.dsc | 1 +
 OvmfPkg/OvmfPkgX64.dsc | 1 +
 OvmfPkg/Microvm/MicrovmX64.fdf | 1 +
 OvmfPkg/OvmfPkgIa32.fdf| 1 +
 OvmfPkg/OvmfPkgIa32X64.fdf | 1 +
 OvmfPkg/OvmfPkgX64.fdf | 1 +
 8 files changed, 8 insertions(+)

diff --git a/OvmfPkg/Microvm/MicrovmX64.dsc b/OvmfPkg/Microvm/MicrovmX64.dsc
index e9aab515592f..3da60875516a 100644
--- a/OvmfPkg/Microvm/MicrovmX64.dsc
+++ b/OvmfPkg/Microvm/MicrovmX64.dsc
@@ -751,6 +751,7 @@ [Components]
   OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
   OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
   OvmfPkg/VirtioRngDxe/VirtioRng.inf
+  OvmfPkg/VirtioSerialDxe/VirtioSerial.inf
   MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
   
MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
   MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 86177bb94899..d0d63ba8b92b 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -802,6 +802,7 @@ [Components]
   OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
   OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
   OvmfPkg/VirtioRngDxe/VirtioRng.inf
+  OvmfPkg/VirtioSerialDxe/VirtioSerial.inf
 !if $(PVSCSI_ENABLE) == TRUE
   OvmfPkg/PvScsiDxe/PvScsiDxe.inf
 !endif
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 065b54450647..a6d1ebabb783 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -816,6 +816,7 @@ [Components.X64]
   OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
   OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
   OvmfPkg/VirtioRngDxe/VirtioRng.inf
+  OvmfPkg/VirtioSerialDxe/VirtioSerial.inf
 !if $(PVSCSI_ENABLE) == TRUE
   OvmfPkg/PvScsiDxe/PvScsiDxe.inf
 !endif
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 3d405cd4ade0..3a4aa913c2a4 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -890,6 +890,7 @@ [Components]
   OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
   OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
   OvmfPkg/VirtioRngDxe/VirtioRng.inf
+  OvmfPkg/VirtioSerialDxe/VirtioSerial.inf
 !if $(PVSCSI_ENABLE) == TRUE
   OvmfPkg/PvScsiDxe/PvScsiDxe.inf
 !endif
diff --git a/OvmfPkg/Microvm/MicrovmX64.fdf b/OvmfPkg/Microvm/MicrovmX64.fdf
index b83fd1e6e4fe..0d44e8dfbae8 100644
--- a/OvmfPkg/Microvm/MicrovmX64.fdf
+++ b/OvmfPkg/Microvm/MicrovmX64.fdf
@@ -205,6 +205,7 @@ [FV.DXEFV]
 INF  OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
 INF  OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
 INF  OvmfPkg/VirtioRngDxe/VirtioRng.inf
+INF  OvmfPkg/VirtioSerialDxe/VirtioSerial.inf
 
 !if $(SECURE_BOOT_ENABLE) == TRUE
   INF  
SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
index 5451bfb84525..15a25f1be5e5 100644
--- a/OvmfPkg/OvmfPkgIa32.fdf
+++ b/OvmfPkg/OvmfPkgIa32.fdf
@@ -238,6 +238,7 @@ [FV.DXEFV]
 INF  OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
 INF  OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
 INF  OvmfPkg/VirtioRngDxe/VirtioRng.inf
+INF  OvmfPkg/VirtioSerialDxe/VirtioSerial.inf
 !if $(PVSCSI_ENABLE) == TRUE
 INF  OvmfPkg/PvScsiDxe/PvScsiDxe.inf
 !endif
diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
index 4c5bd0dbc3b0..138cbd382d4e 100644
--- a/OvmfPkg/OvmfPkgIa32X64.fdf
+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
@@ -239,6 +239,7 @@ [FV.DXEFV]
 INF  OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
 INF  OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
 INF  OvmfPkg/VirtioRngDxe/VirtioRng.inf
+INF  OvmfPkg/VirtioSerialDxe/VirtioSerial.inf
 !if $(PVSCSI_ENABLE) == TRUE
 INF  OvmfPkg/PvScsiDxe/PvScsiDxe.inf
 !endif
diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
index 1ba24440..4f24051ae994 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -264,6 +264,7 @@ [FV.DXEFV]
 INF  OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
 INF  OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
 INF  OvmfPkg/VirtioRngDxe/VirtioRng.inf
+INF  OvmfPkg/VirtioSerialDxe/VirtioSerial.inf
 !if $(PVSCSI_ENABLE) == TRUE
 INF  OvmfPkg/PvScsiDxe/PvScsiDxe.inf
 !endif
-- 
2.39.2



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




[edk2-devel] [PATCH 0/4] OvmfPkg: add virtio serial driver

2023-04-17 Thread Gerd Hoffmann



Gerd Hoffmann (4):
  OvmfPkg: add IndustryStandard/VirtioSerial.h
  OvmfPkg/VirtioSerialDxe: add driver
  OvmfPkg/VirtioSerialDxe: wire up in OvmfPkg*
  OvmfPkg/PlatformBootManagerLib: setup virtio serial console

 OvmfPkg/Microvm/MicrovmX64.dsc|   1 +
 OvmfPkg/OvmfPkgIa32.dsc   |   1 +
 OvmfPkg/OvmfPkgIa32X64.dsc|   1 +
 OvmfPkg/OvmfPkgX64.dsc|   1 +
 OvmfPkg/Microvm/MicrovmX64.fdf|   1 +
 OvmfPkg/OvmfPkgIa32.fdf   |   1 +
 OvmfPkg/OvmfPkgIa32X64.fdf|   1 +
 OvmfPkg/OvmfPkgX64.fdf|   1 +
 OvmfPkg/VirtioSerialDxe/VirtioSerial.inf  |  40 +
 .../Include/IndustryStandard/VirtioSerial.h   |  64 ++
 OvmfPkg/VirtioSerialDxe/VirtioSerial.h| 226 +
 .../PlatformBootManagerLib/BdsPlatform.c  |  47 ++
 OvmfPkg/VirtioSerialDxe/VirtioSerial.c| 789 ++
 OvmfPkg/VirtioSerialDxe/VirtioSerialPort.c| 443 ++
 OvmfPkg/VirtioSerialDxe/VirtioSerialRing.c| 345 
 15 files changed, 1962 insertions(+)
 create mode 100644 OvmfPkg/VirtioSerialDxe/VirtioSerial.inf
 create mode 100644 OvmfPkg/Include/IndustryStandard/VirtioSerial.h
 create mode 100644 OvmfPkg/VirtioSerialDxe/VirtioSerial.h
 create mode 100644 OvmfPkg/VirtioSerialDxe/VirtioSerial.c
 create mode 100644 OvmfPkg/VirtioSerialDxe/VirtioSerialPort.c
 create mode 100644 OvmfPkg/VirtioSerialDxe/VirtioSerialRing.c

-- 
2.39.2



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




[edk2-devel] [PATCH 1/4] OvmfPkg: add IndustryStandard/VirtioSerial.h

2023-04-17 Thread Gerd Hoffmann
Add header files with structs and defines for the virtio serial device.

The virtio serial device also known as virtio console device because
initially it had only support for a single tty, intended to be used as
console.  Support for multiple streams and named data ports has been
added later on.

https://docs.oasis-open.org/virtio/virtio/v1.2/cs01/virtio-v1.2-cs01.html#x1-293

Signed-off-by: Gerd Hoffmann 
---
 .../Include/IndustryStandard/VirtioSerial.h   | 64 +++
 1 file changed, 64 insertions(+)
 create mode 100644 OvmfPkg/Include/IndustryStandard/VirtioSerial.h

diff --git a/OvmfPkg/Include/IndustryStandard/VirtioSerial.h 
b/OvmfPkg/Include/IndustryStandard/VirtioSerial.h
new file mode 100644
index ..ffc8f84d03cc
--- /dev/null
+++ b/OvmfPkg/Include/IndustryStandard/VirtioSerial.h
@@ -0,0 +1,64 @@
+/** @file
+  Virtio Serial Device specific type and macro definitions.
+
+  Copyright (C) 2013-2016, Red Hat, Inc.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _VIRTIO_SERIAL_H_
+#define _VIRTIO_SERIAL_H_
+
+#include 
+#include 
+
+//
+// Device Configuration
+//
+typedef struct {
+  UINT16Cols;
+  UINT16Rows;
+  UINT32MaxPorts;
+  UINT32EmergWrite;
+} VIRTIO_SERIAL_CONFIG;
+
+//
+// Control Queue
+//
+typedef struct {
+  UINT32Id;
+  UINT16Event;
+  UINT16Value;
+} VIRTIO_SERIAL_CONTROL;
+
+//
+// Queue Identifiers
+//
+#define VIRTIO_SERIAL_Q_RX_PORT0  0
+#define VIRTIO_SERIAL_Q_TX_PORT0  1
+#define VIRTIO_SERIAL_Q_RX_CTRL   2
+#define VIRTIO_SERIAL_Q_TX_CTRL   3
+#define VIRTIO_SERIAL_Q_RX_BASE   4
+#define VIRTIO_SERIAL_Q_TX_BASE   5
+
+//
+// Feature Bits
+//
+#define VIRTIO_SERIAL_F_SIZE BIT0
+#define VIRTIO_SERIAL_F_MULTIPORTBIT1
+#define VIRTIO_SERIAL_F_EMERG_WRITE  BIT2
+
+//
+// Events
+//
+#define VIRTIO_SERIAL_DEVICE_READY   0
+#define VIRTIO_SERIAL_DEVICE_ADD 1
+#define VIRTIO_SERIAL_DEVICE_REMOVE  2
+#define VIRTIO_SERIAL_PORT_READY 3
+#define VIRTIO_SERIAL_CONSOLE_PORT   4
+#define VIRTIO_SERIAL_RESIZE 5
+#define VIRTIO_SERIAL_PORT_OPEN  6
+#define VIRTIO_SERIAL_PORT_NAME  7
+
+#endif /* _VIRTIO_SERIAL_H_ */
-- 
2.39.2



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