Re: [edk2-devel] [edk2-redfish-client][PATCH] Initial edk2 redfish client repository

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

Reviewed-by: Abner Chang 

I have no feedbacks to this patch as we had reviewed this off line. However I 
would like to see @Michael D Kinney's comment on it.

Thanks
Abner

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Nickle
> Wang via groups.io
> Sent: Friday, April 21, 2023 11:26 AM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Igor Kulchytskyy
> ; Michael D Kinney 
> Subject: [edk2-devel] [edk2-redfish-client][PATCH] Initial edk2 redfish client
> repository
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> Add required files to initial edk2 redfish client repository.
> 
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
> Cc: Michael D Kinney 
> ---
>  .gitignore  |  6 +
>  CONTRIBUTING.md |  3 +++
>  LICENSE | 51 ++
>  Maintainers.txt | 48 +++
>  README.md   | 66
> +
>  5 files changed, 174 insertions(+)
>  create mode 100644 .gitignore
>  create mode 100644 CONTRIBUTING.md
>  create mode 100644 LICENSE
>  create mode 100644 Maintainers.txt
>  create mode 100644 README.md
> 
> diff --git a/.gitignore b/.gitignore
> new file mode 100644
> index 000..df38443
> --- /dev/null
> +++ b/.gitignore
> @@ -0,0 +1,6 @@
> +.DS_Store
> +*_extdep/
> +*.pyc
> +__pycache__/
> +tags/
> +.vscode/
> diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644
> index 000..39a1732
> --- /dev/null
> +++ b/CONTRIBUTING.md
> @@ -0,0 +1,3 @@
> +# Contributing to EDK Redfish Client
> +
> +Contributor documentation is maintained on the wiki:
> +https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Developmen
> +t-Process
> diff --git a/LICENSE b/LICENSE
> new file mode 100644
> index 000..fd0e199
> --- /dev/null
> +++ b/LICENSE
> @@ -0,0 +1,51 @@
> +Copyright (c) 2021, TianoCore and contributors.  All rights reserved.
> +
> +SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +Redistribution and use in source and binary forms, with or without
> +modification, are permitted provided that the following conditions are met:
> +
> +1. Redistributions of source code must retain the above copyright notice,
> +   this list of conditions and the following disclaimer.
> +
> +2. Redistributions in binary form must reproduce the above copyright notice,
> +   this list of conditions and the following disclaimer in the documentation
> +   and/or other materials provided with the distribution.
> +
> +Subject to the terms and conditions of this license, each copyright
> +holder and contributor hereby grants to those receiving rights under
> +this license a perpetual, worldwide, non-exclusive, no-charge,
> +royalty-free, irrevocable (except for failure to satisfy the conditions
> +of this license) patent license to make, have made, use, offer to sell,
> +sell, import, and otherwise transfer this software, where such license
> +applies only to those patent claims, already acquired or hereafter
> +acquired, licensable by such copyright holder or contributor that are
> necessarily infringed by:
> +
> +(a) their Contribution(s) (the licensed copyrights of copyright holders and
> +non-copyrightable additions of contributors, in source or binary form)
> +alone; or
> +
> +(b) combination of their Contribution(s) with the work of authorship to
> +which such Contribution(s) was added by such copyright holder or
> +contributor, if, at the time the Contribution is added, such addition
> +causes such combination to be necessarily infringed. The patent license
> +shall not apply to any other combinations which include the
> +Contribution.
> +
> +Except as expressly stated above, no rights or licenses from any
> +copyright holder or contributor is granted under this license, whether
> +expressly, by implication, estoppel or otherwise.
> +
> +DISCLAIMER
> +
> +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
> CONTRIBUTORS "AS IS"
> +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> LIMITED TO,
> +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
> PARTICULAR
> +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
> OR
> +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
> +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> LIMITED TO,
> +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
> OR
> +PROFITS; OR BUSINESS
> +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
> WHETHER IN
> +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
> OTHERWISE)
> +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
> ADVISED OF
> +THE POSSIBILITY OF SUCH DAMAGE.
> diff --git a/Maintainers.txt b/Maintainers.txt new file mode 100644 index
> 000..88fd03a
> --- /dev/null
> +++ b/Maintainers.txt
> @@ 

Re: [edk2-devel] [edk2-platforms][PATCH V2 02/14] ManageabilityPkg: Support Maximum Transfer Unit

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

Hi Tinh,
V3 patch just sent, I will wait for your feedback on my response below.

Thanks
Abner

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Chang,
> Abner via groups.io
> Sent: Friday, April 21, 2023 8:51 AM
> To: Tinh Nguyen ;
> devel@edk2.groups.io
> Cc: Isaac Oram ; Attar, AbdulLateef (Abdul Lateef)
> ; Nickle Wang ; Igor
> Kulchytskyy 
> Subject: Re: [edk2-devel] [edk2-platforms][PATCH V2 02/14]
> ManageabilityPkg: Support Maximum Transfer Unit
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> [AMD Official Use Only - General]
> 
> 
> 
> > -Original Message-
> > From: Tinh Nguyen 
> > Sent: Thursday, April 20, 2023 2:08 PM
> > To: devel@edk2.groups.io; Chang, Abner 
> > Cc: Isaac Oram ; Attar, AbdulLateef (Abdul
> > Lateef) ; Nickle Wang
> ;
> > Igor Kulchytskyy 
> > Subject: Re: [edk2-devel] [edk2-platforms][PATCH V2 02/14]
> > ManageabilityPkg: Support Maximum Transfer Unit
> >
> > Caution: This message originated from an External Source. Use proper
> > caution when opening attachments, clicking links, or responding.
> >
> >
> > Hi Abner,
> >
> > I have some inline comments below
> >
> > On 18/04/2023 14:15, Chang, Abner via groups.io wrote:
> > > From: Abner Chang 
> > >
> > > Update GetTransportCapability to support Maximum Transfer Unit (MTU)
> > > of transport interface.
> > >
> > > Signed-off-by: Abner Chang 
> > > Cc: Isaac Oram 
> > > Cc: Abdul Lateef Attar 
> > > Cc: Nickle Wang 
> > > Cc: Igor Kulchytskyy 
> > > ---
> > >   .../Library/ManageabilityTransportLib.h   | 33 ---
> > >   .../Common/ManageabilityTransportKcs.h|  2 +
> > >   .../IpmiProtocol/Pei/IpmiPpiInternal.h|  8 ++-
> > >   .../BaseManageabilityTransportNull.c  | 18 --
> > >   .../Dxe/ManageabilityTransportKcs.c   | 57 +++
> > >   .../Universal/IpmiProtocol/Dxe/IpmiProtocol.c | 24 ++--
> > >   .../Universal/IpmiProtocol/Pei/IpmiPpi.c  | 51 ++---
> > >   .../Universal/IpmiProtocol/Smm/IpmiProtocol.c | 24 ++--
> > >   8 files changed, 145 insertions(+), 72 deletions(-)
> > >
> > > diff --git
> > > a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.
> > > h
> > > b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.
> > > h
> > > index c022b4ac5c..d86d0d87d5 100644
> > > ---
> > > a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.
> > > h
> > > +++ b/Features/ManageabilityPkg/Include/Library/ManageabilityTranspo
> > > +++ rt
> > > +++ Lib.h
> > > @@ -14,6 +14,9 @@
> > >   #define MANAGEABILITY_TRANSPORT_TOKEN_VERSION
> > ((MANAGEABILITY_TRANSPORT_TOKEN_VERSION_MAJOR << 8) |\
> > >
> > > MANAGEABILITY_TRANSPORT_TOKEN_VERSION_MINOR)
> > >
> > > +#define
> > MANAGEABILITY_TRANSPORT_PAYLOAD_SIZE_FROM_CAPABILITY(a)  (1
> << ((a &
> > MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_MASK)
> > >>\
> > > +
> > >
> >
> +MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_BIT_PO
> > SITION))
> > > +
> > >   typedef struct  _MANAGEABILITY_TRANSPORT_FUNCTION_V1_0
> > MANAGEABILITY_TRANSPORT_FUNCTION_V1_0;
> > >   typedef struct  _MANAGEABILITY_TRANSPORT
> > MANAGEABILITY_TRANSPORT;
> > >   typedef struct  _MANAGEABILITY_TRANSPORT_TOKEN
> > MANAGEABILITY_TRANSPORT_TOKEN;
> > > @@ -68,8 +71,17 @@ typedef UINT32
> > MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS;
> > >   /// Additional transport interface features.
> > >   ///
> > >   typedef UINT32 MANAGEABILITY_TRANSPORT_CAPABILITY;
> > > +/// Bit 0
> > >   #define
> >
> MANAGEABILITY_TRANSPORT_CAPABILITY_MULTIPLE_TRANSFER_TOKENS
> > 0x0001
> > > -#define
> > MANAGEABILITY_TRANSPORT_CAPABILITY_ASYNCHRONOUS_TRANSFER
> > 0x0002
> > > +/// Bit 1
> > > +#define
> > MANAGEABILITY_TRANSPORT_CAPABILITY_ASYNCHRONOUS_TRANSFER
> > 0x0002
> > > +/// Bit 2   - Reserved
> > > +/// Bit 7:3 - Transport interface maximum payload size, which is (2
> > > +^ bit[7:3]
> > - 1)
> > > +///   bit[7:3] means no maximum payload.
> >
> > I am confused with your definition here.
> >
> > Why does it have to be a power of 2?
> Usually the maximum/minimum is in  power of 2 and use power of 2 has less
> bits occupied from MANAGEABILITY_TRANSPORT_CAPABILITY.
> 
> >
> > And we should separate request payload size and response payload size
> >
> > Can you clarify more about that?
> Do we really need the maximum size for response? Response is initiated by
> target endpoint and suppose the payload header should have some fields
> that indicate the return payload is only part of response. The size of payload
> returned is actually maximum transfer size that target endpoint can handle.
> Do you know any case that receiver has no idea about if the payload sent
> back from target endpoint is a partial of response or not?  We should have
> MTU response if it is required for the transport interface.
> 
> >
> > 

[edk2-devel] [edk2-platforms][PATCH V3 14/14] ManageabilityPkg: Add Manageability FDFs

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

Add FDF include files for build in ManageabilityPkg
modules to firmware device.

Signed-off-by: Abner Chang 
Cc: Isaac Oram 
Cc: Abdul Lateef Attar 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Cc: Tinh Nguyen 
Reviewed-by: Tinh Nguyen 
Reviewed-by: Nickle Wang 
---
 .../ManageabilityPkg/Include/PostMemory.fdf   | 28 +++
 .../ManageabilityPkg/Include/PreMemory.fdf| 12 
 2 files changed, 40 insertions(+)
 create mode 100644 Features/ManageabilityPkg/Include/PostMemory.fdf
 create mode 100644 Features/ManageabilityPkg/Include/PreMemory.fdf

diff --git a/Features/ManageabilityPkg/Include/PostMemory.fdf 
b/Features/ManageabilityPkg/Include/PostMemory.fdf
new file mode 100644
index 00..9100cb2646
--- /dev/null
+++ b/Features/ManageabilityPkg/Include/PostMemory.fdf
@@ -0,0 +1,28 @@
+## @file
+# Manageabilty Package post memory initialization firmware
+# volume description.
+#
+# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiEnable == TRUE
+  INF ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocolDxe.inf
+!endif
+
+!if gManageabilityPkgTokenSpaceGuid.PcdManageabilitySmmIpmiEnable == TRUE
+  INF ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocolSmm.inf
+!endif
+
+!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmEnable == TRUE
+  INF ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProtocolDxe.inf
+!endif
+
+!if 
gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmSmbiosTransferEnable == 
TRUE
+  INF 
ManageabilityPkg/Universal/PldmSmbiosTransferDxe/PldmSmbiosTransferDxe.inf
+!endif
+
+!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable == TRUE
+  INF ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocolDxe.inf
+!endif
diff --git a/Features/ManageabilityPkg/Include/PreMemory.fdf 
b/Features/ManageabilityPkg/Include/PreMemory.fdf
new file mode 100644
index 00..16e079f494
--- /dev/null
+++ b/Features/ManageabilityPkg/Include/PreMemory.fdf
@@ -0,0 +1,12 @@
+## @file
+# Manageabilty Package pre-memory initialization firmware
+# volume description.
+#
+# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityPeiIpmiEnable == TRUE
+  INF  ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf
+!endif
-- 
2.37.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103368): https://edk2.groups.io/g/devel/message/103368
Mute This Topic: https://groups.io/mt/98404968/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 V3 13/14] ManageabilityPkg: Relocate Manageability.dsc

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

Relocate Manageability.dsc to just under \Include
folder.

Signed-off-by: Abner Chang 
Cc: Isaac Oram 
Cc: Abdul Lateef Attar 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Cc: Tinh Nguyen 
Reviewed-by: Tinh Nguyen 
Reviewed-by: Nickle Wang 
---
 Features/ManageabilityPkg/Include/{Dsc => }/Manageability.dsc | 0
 Features/ManageabilityPkg/ManageabilityPkg.dsc| 2 +-
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename Features/ManageabilityPkg/Include/{Dsc => }/Manageability.dsc (100%)

diff --git a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc 
b/Features/ManageabilityPkg/Include/Manageability.dsc
similarity index 100%
rename from Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
rename to Features/ManageabilityPkg/Include/Manageability.dsc
diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dsc 
b/Features/ManageabilityPkg/ManageabilityPkg.dsc
index 41a8957954..a0712d1c0a 100644
--- a/Features/ManageabilityPkg/ManageabilityPkg.dsc
+++ b/Features/ManageabilityPkg/ManageabilityPkg.dsc
@@ -53,4 +53,4 @@
 [LibraryClasses]
   
ManageabilityTransportLib|ManageabilityPkg/Library/BaseManageabilityTransportNullLib/BaseManageabilityTransportNull.inf
 
-!include Include/Dsc/Manageability.dsc
+!include Include/Manageability.dsc
-- 
2.37.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103367): https://edk2.groups.io/g/devel/message/103367
Mute This Topic: https://groups.io/mt/98404967/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 V3 11/14] ManageabilityPkg/PldmProtocol: Add PLDM protocol

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

PldmProtocol that transmits PLDM message
over manageability transport interface
library.

Signed-off-by: Abner Chang 
Cc: Isaac Oram 
Cc: Abdul Lateef Attar 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Reviewed-by: Nickle Wang 
---
 .../Include/Dsc/Manageability.dsc |   1 +
 .../PldmProtocol/Dxe/PldmProtocolDxe.inf  |  50 ++
 .../PldmProtocol/Common/PldmProtocolCommon.h  | 109 +
 .../PldmProtocol/Common/PldmProtocolCommon.c  | 437 ++
 .../Universal/PldmProtocol/Dxe/PldmProtocol.c | 181 
 5 files changed, 778 insertions(+)
 create mode 100644 
Features/ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProtocolDxe.inf
 create mode 100644 
Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolCommon.h
 create mode 100644 
Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolCommon.c
 create mode 100644 
Features/ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProtocol.c

diff --git a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc 
b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
index 17f067c6d0..0fab562844 100644
--- a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
+++ b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
@@ -32,6 +32,7 @@
 
 [Components.X64]
   ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocolSmm.inf
+  ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProtocolDxe.inf
   ManageabilityPkg/Universal/PldmSmbiosTransferDxe/PldmSmbiosTransferDxe.inf
   ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocolDxe.inf
 
diff --git 
a/Features/ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProtocolDxe.inf 
b/Features/ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProtocolDxe.inf
new file mode 100644
index 00..006f77b09a
--- /dev/null
+++ b/Features/ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProtocolDxe.inf
@@ -0,0 +1,50 @@
+## @file
+# EDKII PLDM Pootocol module INF file.
+#
+# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+  INF_VERSION= 0x0001001d
+  BASE_NAME  = PldmProtocolDxe
+  FILE_GUID  = DA83FBDC-ECFE-4094-9ED3-EAFD1342333F
+  MODULE_TYPE= DXE_DRIVER
+  VERSION_STRING = 1.0
+  ENTRY_POINT= DxePldmProtocolEntry
+  UNLOAD_IMAGE   = PldmProtocolUnloadImage
+
+#
+#  VALID_ARCHITECTURES   = IA32 X64 ARM AARCH64
+#
+
+[Sources]
+  PldmProtocol.c
+  ../Common/PldmProtocolCommon.c
+  ../Common/PldmProtocolCommon.h
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  ManageabilityPkg/ManageabilityPkg.dec
+
+[LibraryClasses]
+  BaseMemoryLib
+  DebugLib
+  ManageabilityTransportHelperLib
+  ManageabilityTransportLib
+  UefiDriverEntryPoint
+  UefiBootServicesTableLib
+
+[Guids]
+  gManageabilityTransportMctpGuid
+
+[Protocols]
+  gEdkiiPldmProtocolGuid
+
+[FixedPcd]
+  gManageabilityPkgTokenSpaceGuid.PcdMctpSourceEndpointId
+  gManageabilityPkgTokenSpaceGuid.PcdMctpDestinationEndpointId
+
+[Depex]
+  TRUE
diff --git 
a/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolCommon.h 
b/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolCommon.h
new file mode 100644
index 00..231d6e802e
--- /dev/null
+++ 
b/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolCommon.h
@@ -0,0 +1,109 @@
+/** @file
+
+  EDKII PLDM Protocol common header file.
+
+  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef MANAGEABILITY_EDKII_PLDM_COMMON_H_
+#define MANAGEABILITY_EDKII_PLDM_COMMON_H_
+
+#include 
+#include 
+
+typedef struct {
+  UINT8 PldmType;
+  UINT8 PldmCommand;
+  UINT32ResponseSize;
+} PLDM_MESSAGE_PACKET_MAPPING;
+
+/**
+  This functions setup the PLDM transport hardware information according
+  to the specification of transport token acquired from transport library.
+
+  @param[in] TransportToken   The transport interface.
+  @param[out]HardwareInformation  Pointer to receive the hardware 
information.
+
+  @retval EFI_SUCCESSHardware information is returned in 
HardwareInformation.
+ Caller must free the memory allocated for 
HardwareInformation
+ once it doesn't need it.
+  @retval EFI_UNSUPPORTEDNo hardware information for the specification 
specified
+ in the transport token.
+**/
+EFI_STATUS
+SetupPldmTransportHardwareInformation (
+  IN   MANAGEABILITY_TRANSPORT_TOKEN *TransportToken,
+  OUT  MANAGEABILITY_TRANSPORT_HARDWARE_INFORMATION  *HardwareInformation
+  );
+
+/**
+  This functions setup the final header/body/trailer packets for
+  the acquired transport interface.
+
+  @param[in] TransportToken The transport 

[edk2-devel] [edk2-platforms][PATCH V3 12/14] ManageabilityPkg: Add Manageability PCDs

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

Add PCDs to control ManageabilityPkg
modules.

Signed-off-by: Abner Chang 
Cc: Isaac Oram 
Cc: Abdul Lateef Attar 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Cc: Tinh Nguyen 
Reviewed-by: Tinh Nguyen 
Reviewed-by: Nickle Wang 
---
 Features/ManageabilityPkg/ManageabilityPkg.dec   |  8 
 .../Include/Dsc/Manageability.dsc| 16 +++-
 Features/ManageabilityPkg/ManageabilityPkg.dsc   | 10 ++
 3 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dec 
b/Features/ManageabilityPkg/ManageabilityPkg.dec
index 6b198e6a3c..6f58ab4f45 100644
--- a/Features/ManageabilityPkg/ManageabilityPkg.dec
+++ b/Features/ManageabilityPkg/ManageabilityPkg.dec
@@ -68,3 +68,11 @@
   # @Prompt MCTP KCS (Memory mapped) I/O base address
   gManageabilityPkgTokenSpaceGuid.PcdMctpKcsBaseAddress|0xca2|UINT32|0x0004
 
+[PcdsFeatureFlag]
+  
gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiEnable|FALSE|BOOLEAN|0x1001
+  
gManageabilityPkgTokenSpaceGuid.PcdManageabilitySmmIpmiEnable|FALSE|BOOLEAN|0x1002
+  
gManageabilityPkgTokenSpaceGuid.PcdManageabilityPeiIpmiEnable|FALSE|BOOLEAN|0x1003
+  
gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmEnable|FALSE|BOOLEAN|0x1004
+  
gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable|FALSE|BOOLEAN|0x1005
+  
gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmSmbiosTransferEnable|FALSE|BOOLEAN|0x1006
+
diff --git a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc 
b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
index 0fab562844..5e7cdb885f 100644
--- a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
+++ b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
@@ -25,14 +25,28 @@
   
PeiServicesTablePointerLib|ArmPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
 
 [Components.IA32, Components.AARCH64]
+!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityPeiIpmiEnable == TRUE
   ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf
+!endif
 
 [Components.X64, Components.AARCH64]
+!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiEnable == TRUE
   ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocolDxe.inf
+!endif
 
 [Components.X64]
+!if gManageabilityPkgTokenSpaceGuid.PcdManageabilitySmmIpmiEnable == TRUE
   ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocolSmm.inf
+!endif
+
+!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmEnable == TRUE
   ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProtocolDxe.inf
+!endif
+
+!if 
gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmSmbiosTransferEnable == 
TRUE
   ManageabilityPkg/Universal/PldmSmbiosTransferDxe/PldmSmbiosTransferDxe.inf
-  ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocolDxe.inf
+!endif
 
+!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable == TRUE
+  ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocolDxe.inf
+!endif
diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dsc 
b/Features/ManageabilityPkg/ManageabilityPkg.dsc
index 959b3eabd2..41a8957954 100644
--- a/Features/ManageabilityPkg/ManageabilityPkg.dsc
+++ b/Features/ManageabilityPkg/ManageabilityPkg.dsc
@@ -28,6 +28,16 @@
   gMinPlatformPkgTokenSpaceGuid.PcdUefiSecureBootEnable   
|FALSE
   gMinPlatformPkgTokenSpaceGuid.PcdPerformanceEnable  
|FALSE
 
+  #
+  # Manageability modules
+  #
+  gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiEnable  
|TRUE
+  gManageabilityPkgTokenSpaceGuid.PcdManageabilitySmmIpmiEnable  
|TRUE
+  gManageabilityPkgTokenSpaceGuid.PcdManageabilityPeiIpmiEnable  
|TRUE
+  gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmEnable  
|TRUE
+  gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable  
|TRUE
+  
gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmSmbiosTransferEnable|TRUE
+
 #
 # Include common libraries
 #
-- 
2.37.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103366): https://edk2.groups.io/g/devel/message/103366
Mute This Topic: https://groups.io/mt/98404966/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 V3 10/14] ManageabilityPkg: Add MCTP transport interface

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

Add MCTP manageability transport interface library.

The functionality is verified by checking the binary
debug output of payload.

Signed-off-by: Abner Chang 
Cc: Isaac Oram 
Cc: Abdul Lateef Attar 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
---
 .../ManageabilityPkg/ManageabilityPkg.dsc |   1 +
 .../Dxe/DxeManageabilityTransportMctp.inf |  44 +++
 .../Dxe/ManageabilityTransportMctp.h  |  26 ++
 .../Dxe/ManageabilityTransportMctp.c  | 367 ++
 .../Dxe/ManageabilityTransportMctp.uni|  13 +
 5 files changed, 451 insertions(+)
 create mode 100644 
Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/DxeManageabilityTransportMctp.inf
 create mode 100644 
Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/ManageabilityTransportMctp.h
 create mode 100644 
Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/ManageabilityTransportMctp.c
 create mode 100644 
Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/ManageabilityTransportMctp.uni

diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dsc 
b/Features/ManageabilityPkg/ManageabilityPkg.dsc
index 412029ef6c..959b3eabd2 100644
--- a/Features/ManageabilityPkg/ManageabilityPkg.dsc
+++ b/Features/ManageabilityPkg/ManageabilityPkg.dsc
@@ -37,6 +37,7 @@
 
 [Components]
   
ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/DxeManageabilityTransportKcs.inf
+  
ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/DxeManageabilityTransportMctp.inf
   ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtocolLib.inf
 
 [LibraryClasses]
diff --git 
a/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/DxeManageabilityTransportMctp.inf
 
b/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/DxeManageabilityTransportMctp.inf
new file mode 100644
index 00..22ea37c516
--- /dev/null
+++ 
b/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/DxeManageabilityTransportMctp.inf
@@ -0,0 +1,44 @@
+## @file
+# MCTP instance of Manageability Transport Library
+#
+# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION= 0x0001001B
+  BASE_NAME  = DxeManageabilityTransportMctp
+  MODULE_UNI_FILE= ManageabilityTransportMctp.uni
+  FILE_GUID  = 7770FA0F-4808-47BD-89F4-717185332486
+  MODULE_TYPE= DXE_DRIVER
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = ManageabilityTransportLib
+
+#
+#  VALID_ARCHITECTURES   = IA32 X64 ARM AARCH64
+#
+
+[Sources]
+  ManageabilityTransportMctp.c
+  ManageabilityTransportMctp.h
+
+[Packages]
+  ManageabilityPkg/ManageabilityPkg.dec
+  MdePkg/MdePkg.dec
+
+[LibraryClasses]
+  DebugLib
+  MemoryAllocationLib
+  UefiBootServicesTableLib
+
+[Protocols]
+  gEdkiiMctpProtocolGuid
+
+[Guids]
+  gManageabilityProtocolPldmGuid
+  gManageabilityTransportMctpGuid
+
+[Depex]
+  gEdkiiMctpProtocolGuid  ## ALWAYS_CONSUMES
+
diff --git 
a/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/ManageabilityTransportMctp.h
 
b/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/ManageabilityTransportMctp.h
new file mode 100644
index 00..1ce0d3a8bc
--- /dev/null
+++ 
b/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/ManageabilityTransportMctp.h
@@ -0,0 +1,26 @@
+/** @file
+
+  Manageability transport MCTP internal used definitions.
+
+  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef MANAGEABILITY_TRANSPORT_MCTP_LIB_INTERNAL_H_
+#define MANAGEABILITY_TRANSPORT_MCTP_LIB_INTERNAL_H_
+
+#include 
+
+#define MANAGEABILITY_TRANSPORT_MCTP_SIGNATURE  SIGNATURE_32 ('M', 'T', 'M', 
'C')
+
+///
+/// Manageability transport KCS internal data structure.
+///
+typedef struct {
+  UINTNSignature;
+  MANAGEABILITY_TRANSPORT_TOKENToken;
+} MANAGEABILITY_TRANSPORT_MCTP;
+
+#define MANAGEABILITY_TRANSPORT_MCTP_FROM_LINK(a)  CR (a, 
MANAGEABILITY_TRANSPORT_MCTP, Token, MANAGEABILITY_TRANSPORT_MCTP_SIGNATURE)
+
+#endif // MANAGEABILITY_TRANSPORT_MCTP_LIB_INTERNAL_H_
diff --git 
a/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/ManageabilityTransportMctp.c
 
b/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/ManageabilityTransportMctp.c
new file mode 100644
index 00..eaf02bbb0a
--- /dev/null
+++ 
b/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/ManageabilityTransportMctp.c
@@ -0,0 +1,367 @@
+/** @file
+
+  MCTP instance of Manageability Transport Library
+
+  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+*/
+
+#include 
+#include 
+#include 
+#include 

[edk2-devel] [edk2-platforms][PATCH V3 09/14] ManageabilityPkg/MctpProtocol: Add MctpProtocol

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

MctpProtocol that transmits MCTP message
over manageability transport interface
library.

Signed-off-by: Abner Chang 
Cc: Isaac Oram 
Cc: Abdul Lateef Attar 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
---
 .../Include/Dsc/Manageability.dsc |   1 +
 .../MctpProtocol/Dxe/MctpProtocolDxe.inf  |  53 ++
 .../Include/Protocol/MctpProtocol.h   | 102 
 .../MctpProtocol/Common/MctpProtocolCommon.h  | 139 ++
 .../MctpProtocol/Common/MctpProtocolCommon.c  | 472 ++
 .../Universal/MctpProtocol/Dxe/MctpProtocol.c | 218 
 6 files changed, 985 insertions(+)
 create mode 100644 
Features/ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocolDxe.inf
 create mode 100644 Features/ManageabilityPkg/Include/Protocol/MctpProtocol.h
 create mode 100644 
Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpProtocolCommon.h
 create mode 100644 
Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpProtocolCommon.c
 create mode 100644 
Features/ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocol.c

diff --git a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc 
b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
index 2a354ad898..17f067c6d0 100644
--- a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
+++ b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
@@ -33,4 +33,5 @@
 [Components.X64]
   ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocolSmm.inf
   ManageabilityPkg/Universal/PldmSmbiosTransferDxe/PldmSmbiosTransferDxe.inf
+  ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocolDxe.inf
 
diff --git 
a/Features/ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocolDxe.inf 
b/Features/ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocolDxe.inf
new file mode 100644
index 00..483fbcc04b
--- /dev/null
+++ b/Features/ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocolDxe.inf
@@ -0,0 +1,53 @@
+## @file
+# MCTP Protocol DXE Driver.
+#
+# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+  INF_VERSION= 0x0001001d
+  BASE_NAME  = MctpDxe
+  FILE_GUID  = 58AF169A-AA3F-462B-B0F1-25FBE6C97978
+  MODULE_TYPE= DXE_DRIVER
+  VERSION_STRING = 1.0
+  ENTRY_POINT= DxeMctpEntry
+  UNLOAD_IMAGE   = MctpUnloadImage
+
+#
+#  VALID_ARCHITECTURES   = IA32 X64 ARM AARCH64
+#
+
+[Sources]
+  MctpProtocol.c
+  ../Common/MctpProtocolCommon.c
+  ../Common/MctpProtocolCommon.h
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  ManageabilityPkg/ManageabilityPkg.dec
+
+[LibraryClasses]
+  BaseMemoryLib
+  DebugLib
+  MemoryAllocationLib
+  ManageabilityTransportHelperLib
+  ManageabilityTransportLib
+  UefiDriverEntryPoint
+  UefiBootServicesTableLib
+
+[Guids]
+  gManageabilityProtocolMctpGuid
+
+[Protocols]
+  gEdkiiMctpProtocolGuid
+
+[FixedPcd]
+  gManageabilityPkgTokenSpaceGuid.PcdMctpKcsMemoryMappedIo
+  gManageabilityPkgTokenSpaceGuid.PcdMctpKcsBaseAddress
+  gManageabilityPkgTokenSpaceGuid.PcdMctpSourceEndpointId
+  gManageabilityPkgTokenSpaceGuid.PcdMctpDestinationEndpointId
+
+[Depex]
+  TRUE
diff --git a/Features/ManageabilityPkg/Include/Protocol/MctpProtocol.h 
b/Features/ManageabilityPkg/Include/Protocol/MctpProtocol.h
new file mode 100644
index 00..85e42f157d
--- /dev/null
+++ b/Features/ManageabilityPkg/Include/Protocol/MctpProtocol.h
@@ -0,0 +1,102 @@
+/** @file
+  Protocol of EDKII MCTP Protocol.
+
+  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef EDKII_MCTP_PROTOCOL_H_
+#define EDKII_MCTP_PROTOCOL_H_
+
+#include 
+
+typedef struct  _EDKII_MCTP_PROTOCOL EDKII_MCTP_PROTOCOL;
+
+#define EDKII_MCTP_PROTOCOL_GUID \
+  { \
+0xE93465C1, 0x9A31, 0x4C96, 0x92, 0x56, 0x22, 0x0A, 0xE1, 0x80, 0xB4, 0x1B 
\
+  }
+
+#define EDKII_MCTP_PROTOCOL_VERSION_MAJOR  1
+#define EDKII_MCTP_PROTOCOL_VERSION_MINOR  0
+#define EDKII_MCTP_PROTOCOL_VERSION((EDKII_MCTP_PROTOCOL_VERSION_MAJOR 
<< 8) |\
+   EDKII_MCTP_PROTOCOL_VERSION_MINOR)
+
+/**
+  This service enables submitting message via EDKII MCTP protocol.
+
+  @param[in] This   EDKII_MCTP_PROTOCOL instance.
+  @param[in] MctpType   MCTP message type.
+  @param[in] MctpSourceEndpointId   MCTP source endpoint ID.
+  @param[in] MctpDestinationEndpointId  MCTP source endpoint ID.
+  @param[in] RequestDataIntegrityCheck  Indicates whether MCTP message 
has
+integrity check byte.
+  @param[in] RequestDataMessage Data.
+  @param[in] RequestDataSizeSize of message Data.
+  @param[in] RequestTimeout Timeout 

[edk2-devel] [edk2-platforms][PATCH V3 08/14] ManageabilityPkg: Add MCTP manageability header file

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

Add C header file of MCTP manageability transport
interface library.

Signed-off-by: Abner Chang 
Cc: Isaac Oram 
Cc: Abdul Lateef Attar 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Reviewed-by: Nickle Wang 
---
 .../Library/ManageabilityTransportMctpLib.h   | 54 +++
 1 file changed, 54 insertions(+)
 create mode 100644 
Features/ManageabilityPkg/Include/Library/ManageabilityTransportMctpLib.h

diff --git 
a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportMctpLib.h 
b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportMctpLib.h
new file mode 100644
index 00..43bd142f4c
--- /dev/null
+++ b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportMctpLib.h
@@ -0,0 +1,54 @@
+/** @file
+
+  This file defines the manageability MCTP protocol specific transport data.
+
+  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef MANAGEABILITY_TRANSPORT_MCTP_LIB_H_
+#define MANAGEABILITY_TRANSPORT_MCTP_LIB_H_
+
+#include 
+
+#define MCTP_KCS_HEADER_VERSION  0x01
+
+// According to SMBUS spec, the polynomial is:
+// C(x) = X^8 + X^2 + X^1 + 1, which is 0x107,
+// just ignore bit8 in definition.
+#define MCTP_KCS_PACKET_ERROR_CODE_POLY  0x07
+
+///
+/// The MCTP Message header which is apart from
+/// the payload.
+///
+
+typedef struct {
+  UINT8IntegrityCheck : 1; ///< Message integrity check.
+  UINT8MessageType: 7; ///< Message type.
+} MANAGEABILITY_MCTP_MESSAGE_HEADER;
+
+typedef struct {
+  UINT8SourceEndpointId;
+  UINT8DestinationEndpointId;
+  MANAGEABILITY_MCTP_MESSAGE_HEADERMessageHeader;
+} MANAGEABILITY_MCTP_TRANSPORT_HEADER;
+
+typedef struct {
+  UINT8NetFunc;  ///< Message integrity check.
+  UINT8DefiningBody; ///< Message type.
+  UINT8ByteCount;///< Byte count of payload.
+} MANAGEABILITY_MCTP_KCS_HEADER;
+#define MCTP_KCS_NETFN_LUN   0xb0
+#define DEFINING_BODY_DMTF_PRE_OS_WORKING_GROUP  0x01
+
+// This is used to track the response message. This value
+// is not defined by the specification.
+#define MCTP_MESSAGE_TAG  0x1
+
+#define MCTP_MESSAGE_TAG_OWNER_REQUEST   0x01
+#define MCTP_MESSAGE_TAG_OWNER_RESPONSE  0x01
+
+#define MCTP_PACKET_SEQUENCE_MASK  0x3
+
+#endif // MANAGEABILITY_TRANSPORT_MCTP_LIB_H_
-- 
2.37.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103362): https://edk2.groups.io/g/devel/message/103362
Mute This Topic: https://groups.io/mt/98404959/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 V3 07/14] ManageabilityPkg: Add definitions of MCTP

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

Add definitions of MCTP manageability transport
interface library.

Signed-off-by: Abner Chang 
Cc: Isaac Oram 
Cc: Abdul Lateef Attar 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Reviewed-by: Nickle Wang 
---
 Features/ManageabilityPkg/ManageabilityPkg.dec | 16 
 1 file changed, 16 insertions(+)

diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dec 
b/Features/ManageabilityPkg/ManageabilityPkg.dec
index 9c9f0d8232..6b198e6a3c 100644
--- a/Features/ManageabilityPkg/ManageabilityPkg.dec
+++ b/Features/ManageabilityPkg/ManageabilityPkg.dec
@@ -45,6 +45,7 @@
   # Manageability Protocol IPMI
   gManageabilityProtocolIpmiGuid= { 0x36ACA47C, 0xCC80, 0x473B, { 0xAB, 
0xEC, 0xF3, 0x98, 0xFF, 0x87, 0x74, 0x5B } }
   # Manageability Protocol MCTP
+  #  MCTP is a transport interface but also a protocol that can be trasmitted 
over other transport interfaces.
   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 } }
@@ -52,3 +53,18 @@
 [Protocols]
   gEdkiiPldmProtocolGuid= { 0x60997616, 0xDB70, 0x4B5F, { 
0x86, 0xA4, 0x09, 0x58, 0xA3, 0x71, 0x47, 0xB4 } }
   gEdkiiPldmSmbiosTransferProtocolGuid  = { 0xFA431C3C, 0x816B, 0x4B32, { 
0xA3, 0xE0, 0xAD, 0x9B, 0x7F, 0x64, 0x27, 0x2E } }
+  gEdkiiMctpProtocolGuid= { 0xE93465C1, 0x9A31, 0x4C96, { 
0x92, 0x56, 0x22, 0x0A, 0xE1, 0x80, 0xB4, 0x1B } }
+
+[PcdsFixedAtBuild]
+  ## This value is the MCTP Interface source and destination endpoint ID for 
transmiting MCTP message.
+  # @Prompt MCTP source endpoint ID
+  gManageabilityPkgTokenSpaceGuid.PcdMctpSourceEndpointId|0|UINT8|0x0001
+  # @Prompt MCTP destination endpoint ID
+  
gManageabilityPkgTokenSpaceGuid.PcdMctpDestinationEndpointId|0|UINT8|0x0002
+  ## This is the value of MCTP KCS I/O base address mode
+  # @Prompt MCTP KCS I/O base address mode
+  gManageabilityPkgTokenSpaceGuid.PcdMctpKcsMemoryMappedIo|0|BOOLEAN|0x0003
+  ## This is the value of MCTP KCS I/O base address
+  # @Prompt MCTP KCS (Memory mapped) I/O base address
+  gManageabilityPkgTokenSpaceGuid.PcdMctpKcsBaseAddress|0xca2|UINT32|0x0004
+
-- 
2.37.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103361): https://edk2.groups.io/g/devel/message/103361
Mute This Topic: https://groups.io/mt/98404957/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 V3 05/14] ManageabilityPkg: Add PldmSmbiosTransferDxe driver

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

Add edk2 driver that supports PLDM SMBIOS Transfer
Specification.
https://www.dmtf.org/sites/default/files/standards/documents/DSP0246_1.0.1.pdf

We currently only support "Push" mode of PLDM SMBIOS
transfer. That says only BIOS to BMC direction is
supported.
The functionality is verified by checking the binary
debug output of payload.

Signed-off-by: Abner Chang 
Cc: Isaac Oram 
Cc: Abdul Lateef Attar 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Reviewed-by: Nickle Wang 
---
 .../ManageabilityPkg/ManageabilityPkg.dec |   1 +
 .../Include/Dsc/Manageability.dsc |   1 +
 .../PldmSmbiosTransferDxe.inf |  47 ++
 .../Protocol/PldmSmbiosTransferProtocol.h | 184 ++
 .../PldmSmbiosTransferDxe.c   | 525 ++
 5 files changed, 758 insertions(+)
 create mode 100644 
Features/ManageabilityPkg/Universal/PldmSmbiosTransferDxe/PldmSmbiosTransferDxe.inf
 create mode 100644 
Features/ManageabilityPkg/Include/Protocol/PldmSmbiosTransferProtocol.h
 create mode 100644 
Features/ManageabilityPkg/Universal/PldmSmbiosTransferDxe/PldmSmbiosTransferDxe.c

diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dec 
b/Features/ManageabilityPkg/ManageabilityPkg.dec
index e4d147fede..9c9f0d8232 100644
--- a/Features/ManageabilityPkg/ManageabilityPkg.dec
+++ b/Features/ManageabilityPkg/ManageabilityPkg.dec
@@ -51,3 +51,4 @@
 
 [Protocols]
   gEdkiiPldmProtocolGuid= { 0x60997616, 0xDB70, 0x4B5F, { 
0x86, 0xA4, 0x09, 0x58, 0xA3, 0x71, 0x47, 0xB4 } }
+  gEdkiiPldmSmbiosTransferProtocolGuid  = { 0xFA431C3C, 0x816B, 0x4B32, { 
0xA3, 0xE0, 0xAD, 0x9B, 0x7F, 0x64, 0x27, 0x2E } }
diff --git a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc 
b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
index eda1a36bb9..2a354ad898 100644
--- a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
+++ b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
@@ -32,4 +32,5 @@
 
 [Components.X64]
   ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocolSmm.inf
+  ManageabilityPkg/Universal/PldmSmbiosTransferDxe/PldmSmbiosTransferDxe.inf
 
diff --git 
a/Features/ManageabilityPkg/Universal/PldmSmbiosTransferDxe/PldmSmbiosTransferDxe.inf
 
b/Features/ManageabilityPkg/Universal/PldmSmbiosTransferDxe/PldmSmbiosTransferDxe.inf
new file mode 100644
index 00..da49057982
--- /dev/null
+++ 
b/Features/ManageabilityPkg/Universal/PldmSmbiosTransferDxe/PldmSmbiosTransferDxe.inf
@@ -0,0 +1,47 @@
+## @file
+# PLDM SMBIOS Transfer DXE Driver.
+#
+# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+  INF_VERSION= 0x0001001d
+  BASE_NAME  = PldmSmbiosTransferDxe
+  FILE_GUID  = 71BF5CF0-CE09-4C7C-912B-944BF4E4CBC0
+  MODULE_TYPE= DXE_DRIVER
+  VERSION_STRING = 1.0
+  ENTRY_POINT= DxePldmSmbiosTransferEntry
+  UNLOAD_IMAGE   = PldmSmbiosTransferUnloadImage
+
+#
+#  VALID_ARCHITECTURES   = IA32 X64 ARM AARCH64
+#
+
+[Sources]
+  PldmSmbiosTransferDxe.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  ManageabilityPkg/ManageabilityPkg.dec
+
+[LibraryClasses]
+  BaseMemoryLib
+  DebugLib
+  ManageabilityTransportLib
+  ManageabilityTransportHelperLib
+  PldmProtocolLib
+  UefiLib
+  UefiDriverEntryPoint
+  UefiBootServicesTableLib
+
+[Guids]
+  gEfiSmbios3TableGuid
+
+[Protocols]
+  gEfiSmbiosProtocolGuid
+  gEdkiiPldmSmbiosTransferProtocolGuid
+
+[Depex]
+  gEdkiiPldmProtocolGuid  ## ALWAYS_CONSUMES
diff --git 
a/Features/ManageabilityPkg/Include/Protocol/PldmSmbiosTransferProtocol.h 
b/Features/ManageabilityPkg/Include/Protocol/PldmSmbiosTransferProtocol.h
new file mode 100644
index 00..7903e12726
--- /dev/null
+++ b/Features/ManageabilityPkg/Include/Protocol/PldmSmbiosTransferProtocol.h
@@ -0,0 +1,184 @@
+/** @file
+  Protocol of EDKII PLDM SMBIOS Transfer Protocol.
+
+  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef EDKII_PLDM_SMBIOS_TRANSFER_PROTOCOL_H_
+#define EDKII_PLDM_SMBIOS_TRANSFER_PROTOCOL_H_
+
+#include 
+
+typedef struct  _EDKII_PLDM_SMBIOS_TRANSFER_PROTOCOL 
EDKII_PLDM_SMBIOS_TRANSFER_PROTOCOL;
+
+#define EDKII_PLDM_SMBIOS_TRANSFER_PROTOCOL_GUID \
+  { \
+0xFA431C3C, 0x816B, 0x4B32, 0xA3, 0xE0, 0xAD, 0x9B, 0x7F, 0x64, 0x27, 0x2E 
\
+  }
+
+#define EDKII_PLDM_SMBIOS_TRANSFER_PROTOCOL_VERSION_MAJOR  1
+#define EDKII_PLDM_SMBIOS_TRANSFER_PROTOCOL_VERSION_MINOR  0
+#define EDKII_PLDM_SMBIOS_TRANSFER_PROTOCOL_VERSION
((EDKII_PLDM_SMBIOS_TRANSFER_PROTOCOL_VERSION_MAJOR << 8) |\
+   
EDKII_PLDM_SMBIOS_TRANSFER_PROTOCOL_VERSION_MINOR)
+
+/**
+  This function gets SMBIOS table metadata.
+
+  @param [in]   This 

[edk2-devel] [edk2-platforms][PATCH V3 03/14] ManageabilityPkg: Add HeaderSize and TrailerSize

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

Add HeaderSize and TrailerSize in
MANAGEABILITY_TRANSFER_TOKEN structure.
Manageability transport interface may used by
multiple protocols which have different header
and trailer of payload. (e.g. MCTP over KCS and
IPMI over KCS).

Signed-off-by: Abner Chang 
Cc: Isaac Oram 
Cc: Abdul Lateef Attar 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Reviewed-by: Nickle Wang 
---
 .../Library/ManageabilityTransportLib.h   |   2 +
 .../Common/ManageabilityTransportKcs.h|  20 ++-
 .../IpmiProtocol/Common/IpmiProtocolCommon.h  |  36 +++--
 .../Common/KcsCommon.c| 152 --
 .../Dxe/ManageabilityTransportKcs.c   |  14 +-
 .../IpmiProtocol/Common/IpmiProtocolCommon.c  |  63 +---
 Features/ManageabilityPkg/Readme.md   |  10 ++
 7 files changed, 194 insertions(+), 103 deletions(-)

diff --git 
a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h 
b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h
index d86d0d87d5..04072aee89 100644
--- a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h
+++ b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h
@@ -168,10 +168,12 @@ struct _MANAGEABILITY_TRANSFER_TOKEN {
   ///< 
which is sent discretely of payload.
   ///< 
This field can be NULL if the transport
   ///< 
doesn't require this.
+  UINT16   TransmitHeaderSize;///< 
Transmit header size in byte.
   MANAGEABILITY_TRANSPORT_TRAILER  TransmitTrailer;   ///< 
This is the transport-specific trailer
   ///< 
which is sent discretely of payload.
   ///< 
This field can be NULL if the transport
   ///< 
doesn't require this.
+  UINT16   TransmitTrailerSize;   ///< 
Transmit trailer size in byte.
   MANAGEABILITY_TRANSMIT_PACKAGE   TransmitPackage;   ///< 
The payload sent to transport interface.
   MANAGEABILITY_RECEIVE_PACKAGEReceivePackage;///< 
The buffer to receive the response.
   EFI_STATUS   TransferStatus;///< 
The EFI Status of the transfer.
diff --git 
a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/ManageabilityTransportKcs.h
 
b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/ManageabilityTransportKcs.h
index 2cdf60ba7e..d6685c165e 100644
--- 
a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/ManageabilityTransportKcs.h
+++ 
b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/ManageabilityTransportKcs.h
@@ -41,8 +41,10 @@ typedef struct {
 /**
   This service communicates with BMC using KCS protocol.
 
-  @param[in]  NetFunction   Net function of the command.
-  @param[in]  Command   IPMI Command.
+  @param[in]  TransmitHeaderKCS packet header.
+  @param[in]  TransmitHeaderSizeKCS packet header size in byte.
+  @param[in]  TransmitTrailer   KCS packet trailer.
+  @param[in]  TransmitTrailerSize   KCS packet trailer size in byte.
   @param[in]  RequestData   Command Request Data.
   @param[in]  RequestDataSize   Size of Command Request Data.
   @param[out] ResponseData  Command Response Data. The completion
@@ -69,12 +71,14 @@ typedef struct {
 EFI_STATUS
 EFIAPI
 KcsTransportSendCommand (
-  IN  UINT8  NetFunction,
-  IN  UINT8  Command,
-  IN  UINT8  *RequestData OPTIONAL,
-  IN  UINT32 RequestDataSize,
-  OUT UINT8  *ResponseData OPTIONAL,
-  IN OUT UINT32  *ResponseDataSize OPTIONAL
+  IN  MANAGEABILITY_TRANSPORT_HEADER   TransmitHeader,
+  IN  UINT16   TransmitHeaderSize,
+  IN  MANAGEABILITY_TRANSPORT_TRAILER  TransmitTrailer OPTIONAL,
+  IN  UINT16   TransmitTrailerSize,
+  IN  UINT8*RequestData OPTIONAL,
+  IN  UINT32   RequestDataSize,
+  OUT UINT8*ResponseData OPTIONAL,
+  IN OUT UINT32*ResponseDataSize OPTIONAL
   );
 
 /**
diff --git 
a/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolCommon.h 
b/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolCommon.h
index 5a7236e9a6..8bf16e6277 100644
--- 
a/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolCommon.h
+++ 

[edk2-devel] [edk2-platforms][PATCH V3 02/14] ManageabilityPkg: Support Maximum Transfer Unit

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

Update GetTransportCapability to support
Maximum Transfer Unit (MTU) of transport interface.

Signed-off-by: Abner Chang 
Cc: Isaac Oram 
Cc: Abdul Lateef Attar 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Reviewed-by: Abdul Lateef Attar 
Reviewed-by: Nickle Wang 
---
 .../Library/ManageabilityTransportLib.h   | 33 ---
 .../Common/ManageabilityTransportKcs.h|  2 +
 .../IpmiProtocol/Pei/IpmiPpiInternal.h|  8 ++-
 .../BaseManageabilityTransportNull.c  | 18 --
 .../Dxe/ManageabilityTransportKcs.c   | 57 +++
 .../Universal/IpmiProtocol/Dxe/IpmiProtocol.c | 24 ++--
 .../Universal/IpmiProtocol/Pei/IpmiPpi.c  | 51 ++---
 .../Universal/IpmiProtocol/Smm/IpmiProtocol.c | 24 ++--
 8 files changed, 145 insertions(+), 72 deletions(-)

diff --git 
a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h 
b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h
index c022b4ac5c..d86d0d87d5 100644
--- a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h
+++ b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h
@@ -14,6 +14,9 @@
 #define MANAGEABILITY_TRANSPORT_TOKEN_VERSION
((MANAGEABILITY_TRANSPORT_TOKEN_VERSION_MAJOR << 8) |\
 
MANAGEABILITY_TRANSPORT_TOKEN_VERSION_MINOR)
 
+#define MANAGEABILITY_TRANSPORT_PAYLOAD_SIZE_FROM_CAPABILITY(a)  (1 << ((a & 
MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_MASK) >>\
+   MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_BIT_POSITION))
+
 typedef struct  _MANAGEABILITY_TRANSPORT_FUNCTION_V1_0  
MANAGEABILITY_TRANSPORT_FUNCTION_V1_0;
 typedef struct  _MANAGEABILITY_TRANSPORT
MANAGEABILITY_TRANSPORT;
 typedef struct  _MANAGEABILITY_TRANSPORT_TOKEN  
MANAGEABILITY_TRANSPORT_TOKEN;
@@ -68,8 +71,17 @@ typedef UINT32 MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS;
 /// Additional transport interface features.
 ///
 typedef UINT32 MANAGEABILITY_TRANSPORT_CAPABILITY;
+/// Bit 0
 #define MANAGEABILITY_TRANSPORT_CAPABILITY_MULTIPLE_TRANSFER_TOKENS  0x0001
-#define MANAGEABILITY_TRANSPORT_CAPABILITY_ASYNCHRONOUS_TRANSFER 0x0002
+/// Bit 1
+#define MANAGEABILITY_TRANSPORT_CAPABILITY_ASYNCHRONOUS_TRANSFER  0x0002
+/// Bit 2   - Reserved
+/// Bit 7:3 - Transport interface maximum payload size, which is (2 ^ bit[7:3] 
- 1)
+///   bit[7:3] means no maximum payload.
+#define MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_MASK   
0x00f8
+#define MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_BIT_POSITION   3
+#define MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_NOT_AVAILABLE  0x00
+/// Bit 8:31 - Reserved
 
 ///
 /// Definitions of Manageability transport interface functions.
@@ -187,15 +199,20 @@ AcquireTransportSession (
   );
 
 /**
-  This function returns the transport capabilities.
-
-  @param [out]  TransportFeaturePointer to receive transport 
capabilities.
-See the definitions of
-MANAGEABILITY_TRANSPORT_CAPABILITY.
-
+  This function returns the transport capabilities according to
+  the manageability protocol.
+
+  @param [in]   TransportToken Transport token acquired from 
manageability
+   transport library.
+  @param [out]  TransportFeature   Pointer to receive transport 
capabilities.
+   See the definitions of
+   MANAGEABILITY_TRANSPORT_CAPABILITY.
+  @retval   EFI_SUCCESSTransportCapability is returned 
successfully.
+  @retval   EFI_INVALID_PARAMETER  TransportToken is not a valid token.
 **/
-VOID
+EFI_STATUS
 GetTransportCapability (
+  IN MANAGEABILITY_TRANSPORT_TOKEN*TransportToken,
   OUT MANAGEABILITY_TRANSPORT_CAPABILITY  *TransportCapability
   );
 
diff --git 
a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/ManageabilityTransportKcs.h
 
b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/ManageabilityTransportKcs.h
index f1758ffd8f..2cdf60ba7e 100644
--- 
a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/ManageabilityTransportKcs.h
+++ 
b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/ManageabilityTransportKcs.h
@@ -32,6 +32,8 @@ typedef struct {
 #define IPMI_KCS_GET_STATE(s)  (s >> 6)
 #define IPMI_KCS_SET_STATE(s)  (s << 6)
 
+#define MCTP_KCS_MTU_IN_POWER_OF_2  8
+
 /// 5 sec, according to IPMI spec
 #define IPMI_KCS_TIMEOUT_5_SEC  5000*1000
 #define IPMI_KCS_TIMEOUT_1MS1000
diff --git 
a/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiInternal.h 
b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiInternal.h
index bbe0c8c5cb..4b6bdc97a9 100644
--- 

[edk2-devel] [edk2-platforms][PATCH V3 01/14] ManageabilityPkg: Add more helper functions

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

1. Add a helper function to output payload binary
   to debug output device.
2. Add a helper function to split payload into
   packages according to maximum transfer unit
   of transport interface.
3. Add a helper function to generate CRC8.

Signed-off-by: Abner Chang 
Cc: Isaac Oram 
Cc: Abdul Lateef Attar 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
---
 .../BaseManageabilityTransportHelper.inf  |   1 +
 .../Library/ManageabilityTransportHelperLib.h |  97 
 .../BaseManageabilityTransportHelper.c| 225 +-
 3 files changed, 313 insertions(+), 10 deletions(-)

diff --git 
a/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.inf
 
b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.inf
index 5447954144..c9e5eaef60 100644
--- 
a/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.inf
+++ 
b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.inf
@@ -25,6 +25,7 @@
 [LibraryClasses]
   BaseMemoryLib
   DebugLib
+  MemoryAllocationLib
 
 [Packages]
   ManageabilityPkg/ManageabilityPkg.dec
diff --git 
a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportHelperLib.h 
b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportHelperLib.h
index 718ac34a1f..c2c98d6c2d 100644
--- 
a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportHelperLib.h
+++ 
b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportHelperLib.h
@@ -11,8 +11,24 @@
 
 #include 
 
+#define DEBUG_MANAGEABILITY_INFO  DEBUG_INFO
+
 typedef struct _MANAGEABILITY_PROTOCOL_NAME MANAGEABILITY_PROTOCOL_NAME;
 
+typedef struct {
+  UINT8 *PayloadPointer;
+  UINT32PayloadSize;
+} MANAGEABILITY_TRANSMISSION_PACKAGE_ATTR;
+
+//
+// The information of multi portions of payload it is
+// splitted according to transport interface Maximum
+// Transfer Unit.
+typedef struct {
+  UINT16 NumberOfPackages; ///< Number of 
packages in MultiPackages.
+  MANAGEABILITY_TRANSMISSION_PACKAGE_ATTRMultiPackages[];
+} MANAGEABILITY_TRANSMISSION_MULTI_PACKAGES;
+
 /**
   Helper function returns the human readable name of Manageability 
specification.
 
@@ -90,4 +106,85 @@ HelperInitManageabilityTransport (
   OUT MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS *TransportAdditionalStatus 
OPTIONAL
   );
 
+/**
+  This function splits payload into multiple packages according to
+  the given transport interface Maximum Transfer Unit (MTU).
+
+  @param[in]  PreambleSize The additional data size precedes
+   each package.
+  @param[in]  PostambleSizeThe additional data size succeeds
+   each package.
+  @param[in]  Payload  Pointer to payload.
+  @param[in]  PayloadSize  Payload size in byte.
+  @param[in]  MaximumTransferUnit  MTU of transport interface.
+  @param[out] MultiplePackages Pointer to receive
+   MANAGEABILITY_TRANSMISSION_MULTI_PACKAGES
+   structure. Caller has to free the memory
+   allocated for 
MANAGEABILITY_TRANSMISSION_MULTI_PACKAGES.
+
+  @retval   EFI_SUCCESS  MANAGEABILITY_TRANSMISSION_MULTI_PACKAGES 
structure
+ is returned successfully.
+  @retval   EFI_OUT_OF_RESOURCE  Not enough resource to create
+ MANAGEABILITY_TRANSMISSION_MULTI_PACKAGES 
structure.
+**/
+EFI_STATUS
+HelperManageabilitySplitPayload (
+  IN UINT16  PreambleSize,
+  IN UINT16  PostambleSize,
+  IN UINT8   *Payload,
+  IN UINT32  PayloadSize,
+  IN UINT32  MaximumTransferUnit,
+  OUT MANAGEABILITY_TRANSMISSION_MULTI_PACKAGES  **MultiplePackages
+  );
+
+/**
+  This function generates CRC8 with given polynomial.
+
+  @param[in]  Polynomial   Polynomial in 8-bit.
+  @param[in]  CrcInitialValue  CRC initial value.
+  @param[in]  BufferStart  Pointer to buffer starts the CRC calculation.
+  @param[in]  BufferSize   Size of buffer.
+
+  @retval  UINT8 CRC value.
+**/
+UINT8
+HelperManageabilityGenerateCrc8 (
+  IN UINT8   Polynomial,
+  IN UINT8   CrcInitialValue,
+  IN UINT8   *BufferStart,
+  IN UINT32  BufferSize
+  );
+
+/**
+  Print out manageability transmit payload to the debug output device.
+
+  @param[in]  Payload  Payload to print.
+  @param[in]  PayloadSize  Payload size.
+
+**/
+VOID
+EFIAPI
+HelperManageabilityPayLoadDebugPrint (
+  IN  VOID*Payload,
+  IN  UINT32  PayloadSize
+  );
+
+/**
+  Prints a debug message and manageability payload to the debug output device.
+
+  

[edk2-devel] [edk2-platforms][PATCH V3 00/14] ManageabilityPkg part II

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

In V3: Address comments given to V2.

In V2:
  - Address uncrustify issues.
  - Use DBBUG_MANAGEABILITY_INFO to output detailed
manageability information.
DEBUG_INFO is used for the function entry point,
while DEBUG_ERROR is used for the error situations.

In part II, we had implemented
- PLDM protocol
- MCTP protocol
- PLDM SMBIOS Transfer protocol
- MCTP manageability transport interface
- Support maximum transfer unit of transport interface
- Add more heler functions
- Add two new fields HeaderSize and TrailerSize in
  MANAGEABILITY_TRANSFER_TOKEN structure.
- Add PCDs to build the manageability modules.

Signed-off-by: Abner Chang 
Cc: Isaac Oram 
Cc: Abdul Lateef Attar 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Cc: Tinh Nguyen 

Abner Chang (14):
  ManageabilityPkg: Add more helper functions
  ManageabilityPkg: Support Maximum Transfer Unit
  ManageabilityPkg: Add HeaderSize and TrailerSize
  ManageabilityPkg: Add PldmProtocolLib
  ManageabilityPkg: Add PldmSmbiosTransferDxe driver
  ManageabilityPkg/KCS: KCS transport interface
  ManageabilityPkg: Add definitions of MCTP
  ManageabilityPkg: Add MCTP manageability header file
  ManageabilityPkg/MctpProtocol: Add MctpProtocol
  ManageabilityPkg: Add MCTP transport interface
  ManageabilityPkg/PldmProtocol: Add PLDM protocol
  ManageabilityPkg: Add Manageability PCDs
  ManageabilityPkg: Relocate Manageability.dsc
  ManageabilityPkg: Add Manageability FDFs

 .../ManageabilityPkg/ManageabilityPkg.dec |  28 +
 .../Include/{Dsc => }/Manageability.dsc   |  20 +
 .../ManageabilityPkg/ManageabilityPkg.dsc |  14 +-
 .../ManageabilityPkg/Include/PostMemory.fdf   |  28 +
 .../ManageabilityPkg/Include/PreMemory.fdf|  12 +
 .../BaseManageabilityTransportHelper.inf  |   1 +
 .../Dxe/DxeManageabilityTransportMctp.inf |  44 ++
 .../Dxe/PldmProtocolLib.inf   |  42 ++
 .../MctpProtocol/Dxe/MctpProtocolDxe.inf  |  53 ++
 .../PldmProtocol/Dxe/PldmProtocolDxe.inf  |  50 ++
 .../PldmSmbiosTransferDxe.inf |  47 ++
 .../Include/Library/BasePldmProtocolLib.h |  41 ++
 .../Library/ManageabilityTransportHelperLib.h |  97 
 .../Library/ManageabilityTransportLib.h   |  35 +-
 .../Library/ManageabilityTransportMctpLib.h   |  54 ++
 .../Include/Protocol/MctpProtocol.h   | 102 
 .../Include/Protocol/PldmProtocol.h   |  87 +++
 .../Protocol/PldmSmbiosTransferProtocol.h | 184 ++
 .../Common/ManageabilityTransportKcs.h|  22 +-
 .../Dxe/ManageabilityTransportMctp.h  |  26 +
 .../IpmiProtocol/Common/IpmiProtocolCommon.h  |  36 +-
 .../IpmiProtocol/Pei/IpmiPpiInternal.h|   8 +-
 .../MctpProtocol/Common/MctpProtocolCommon.h  | 139 +
 .../PldmProtocol/Common/PldmProtocolCommon.h  | 109 
 .../BaseManageabilityTransportHelper.c| 225 +++-
 .../BaseManageabilityTransportNull.c  |  18 +-
 .../Common/KcsCommon.c| 208 ---
 .../Dxe/ManageabilityTransportKcs.c   |  89 +--
 .../Dxe/ManageabilityTransportMctp.c  | 367 
 .../PldmProtocolLibrary/Dxe/PldmProtocolLib.c |  87 +++
 .../IpmiProtocol/Common/IpmiProtocolCommon.c  |  63 ++-
 .../Universal/IpmiProtocol/Dxe/IpmiProtocol.c |  24 +-
 .../Universal/IpmiProtocol/Pei/IpmiPpi.c  |  51 +-
 .../Universal/IpmiProtocol/Smm/IpmiProtocol.c |  24 +-
 .../MctpProtocol/Common/MctpProtocolCommon.c  | 472 
 .../Universal/MctpProtocol/Dxe/MctpProtocol.c | 218 
 .../PldmProtocol/Common/PldmProtocolCommon.c  | 437 +++
 .../Universal/PldmProtocol/Dxe/PldmProtocol.c | 181 ++
 .../PldmSmbiosTransferDxe.c   | 525 ++
 Features/ManageabilityPkg/Readme.md   |  10 +
 .../Dxe/ManageabilityTransportMctp.uni|  13 +
 .../Dxe/PldmProtocolLib.uni   |  18 +
 42 files changed, 4095 insertions(+), 214 deletions(-)
 rename Features/ManageabilityPkg/Include/{Dsc => }/Manageability.dsc (57%)
 create mode 100644 Features/ManageabilityPkg/Include/PostMemory.fdf
 create mode 100644 Features/ManageabilityPkg/Include/PreMemory.fdf
 create mode 100644 
Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/DxeManageabilityTransportMctp.inf
 create mode 100644 
Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtocolLib.inf
 create mode 100644 
Features/ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocolDxe.inf
 create mode 100644 
Features/ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProtocolDxe.inf
 create mode 100644 
Features/ManageabilityPkg/Universal/PldmSmbiosTransferDxe/PldmSmbiosTransferDxe.inf
 create mode 100644 
Features/ManageabilityPkg/Include/Library/BasePldmProtocolLib.h
 create mode 100644 
Features/ManageabilityPkg/Include/Library/ManageabilityTransportMctpLib.h
 create mode 100644 Features/ManageabilityPkg/Include/Protocol/MctpProtocol.h
 create mode 100644 

[edk2-devel] [PATCH v5 10/10] BaseTools: remove duplicate includes: IndustryStandard/*.h

2023-04-20 Thread Gerd Hoffmann
Use the MdePkg versions instead of maintaining a copy in BaseTools.

Signed-off-by: Gerd Hoffmann 
---
 BaseTools/Source/C/EfiRom/EfiRom.h|   4 +-
 .../C/Include/IndustryStandard/Bluetooth.h|  56 --
 .../C/Include/IndustryStandard/EfiPci.h   |  51 --
 ...emoryMappedConfigurationSpaceAccessTable.h |  39 --
 .../Source/C/Include/IndustryStandard/pci22.h | 536 --
 .../Source/C/Include/IndustryStandard/pci23.h |  18 -
 .../Source/C/Include/IndustryStandard/pci30.h |  38 --
 7 files changed, 2 insertions(+), 740 deletions(-)
 delete mode 100644 BaseTools/Source/C/Include/IndustryStandard/Bluetooth.h
 delete mode 100644 BaseTools/Source/C/Include/IndustryStandard/EfiPci.h
 delete mode 100644 
BaseTools/Source/C/Include/IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h
 delete mode 100644 BaseTools/Source/C/Include/IndustryStandard/pci22.h
 delete mode 100644 BaseTools/Source/C/Include/IndustryStandard/pci23.h
 delete mode 100644 BaseTools/Source/C/Include/IndustryStandard/pci30.h

diff --git a/BaseTools/Source/C/EfiRom/EfiRom.h 
b/BaseTools/Source/C/EfiRom/EfiRom.h
index 887a6a51e25b..dfb4c3207794 100644
--- a/BaseTools/Source/C/EfiRom/EfiRom.h
+++ b/BaseTools/Source/C/EfiRom/EfiRom.h
@@ -16,8 +16,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include  // for PE32 structure definitions
 
-#include   // for option ROM header structures
-#include 
+#include   // for option ROM header structures
+#include 
 
 #include "Compress.h"
 #include "CommonLib.h"
diff --git a/BaseTools/Source/C/Include/IndustryStandard/Bluetooth.h 
b/BaseTools/Source/C/Include/IndustryStandard/Bluetooth.h
deleted file mode 100644
index 82f5e6299e78..
--- a/BaseTools/Source/C/Include/IndustryStandard/Bluetooth.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/** @file
-  This file contains the Bluetooth definitions that are consumed by drivers.
-  These definitions are from Bluetooth Core Specification Version 4.0 June, 
2010
-
-  Copyright (c) 2017, Intel Corporation. All rights reserved.
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _BLUETOOTH_H_
-#define _BLUETOOTH_H_
-
-#pragma pack(1)
-
-///
-/// BLUETOOTH_ADDRESS
-///
-typedef struct {
-  ///
-  /// 48bit Bluetooth device address.
-  ///
-  UINT8  Address[6];
-} BLUETOOTH_ADDRESS;
-
-///
-/// BLUETOOTH_CLASS_OF_DEVICE. See Bluetooth specification for detail.
-///
-typedef struct {
-  UINT8  FormatType:2;
-  UINT8  MinorDeviceClass: 6;
-  UINT16 MajorDeviceClass: 5;
-  UINT16 MajorServiceClass:11;
-} BLUETOOTH_CLASS_OF_DEVICE;
-
-///
-/// BLUETOOTH_LE_ADDRESS
-///
-typedef struct {
-  ///
-  /// 48-bit Bluetooth device address
-  ///
-  UINT8  Address[6];
-  ///
-  /// 0x00 - Public Device Address
-  /// 0x01 - Random Device Address
-  ///
-  UINT8  Type;
-} BLUETOOTH_LE_ADDRESS;
-
-#pragma pack()
-
-#define BLUETOOTH_HCI_COMMAND_LOCAL_READABLE_NAME_MAX_SIZE248
-
-#define BLUETOOTH_HCI_LINK_KEY_SIZE   16
-
-#endif
diff --git a/BaseTools/Source/C/Include/IndustryStandard/EfiPci.h 
b/BaseTools/Source/C/Include/IndustryStandard/EfiPci.h
deleted file mode 100644
index aab27f9bf914..
--- a/BaseTools/Source/C/Include/IndustryStandard/EfiPci.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/** @file
-  Support for EFI PCI specification.
-
-  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _EFI_PCI_H_
-#define _EFI_PCI_H_
-
-//#include "pci22.h"
-//#include "pci23.h"
-//#include "pci30.h"
-
-#pragma pack(push, 1)
-
-typedef struct {
-  UINT8 Register;
-  UINT8 Function;
-  UINT8 Device;
-  UINT8 Bus;
-  UINT8 Reserved[4];
-} DEFIO_PCI_ADDR;
-
-#define EFI_ROOT_BRIDGE_LIST'eprb'
-#define EFI_PCI_EXPANSION_ROM_HEADER_EFISIGNATURE   0x0EF1
-
-typedef struct {
-  UINT16  Signature;// 0xaa55
-  UINT16  InitializationSize;
-  UINT32  EfiSignature; // 0x0EF1
-  UINT16  EfiSubsystem;
-  UINT16  EfiMachineType;
-  UINT16  CompressionType;
-  UINT8   Reserved[8];
-  UINT16  EfiImageHeaderOffset;
-  UINT16  PcirOffset;
-} EFI_PCI_EXPANSION_ROM_HEADER;
-
-typedef union {
-  UINT8   *Raw;
-  PCI_EXPANSION_ROM_HEADER*Generic;
-  EFI_PCI_EXPANSION_ROM_HEADER*Efi;
-  EFI_LEGACY_EXPANSION_ROM_HEADER *PcAt;
-} EFI_PCI_ROM_HEADER;
-
-#pragma pack(pop)
-
-#endif
diff --git 
a/BaseTools/Source/C/Include/IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h
 
b/BaseTools/Source/C/Include/IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h
deleted file mode 100644
index 3d435001fc4d..
--- 
a/BaseTools/Source/C/Include/IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/** @file
-  ACPI memory mapped configuration space access table definition, defined at
-  in the PCI Firmware Specification, version 3.0 draft version 0.5.
-  Specification is available at 

[edk2-devel] [PATCH v5 09/10] BaseTools: remove duplicate includes: IndustryStandard/PeImage.h

2023-04-20 Thread Gerd Hoffmann
Use the MdePkg version instead of maintaining a copy in BaseTools.

Signed-off-by: Gerd Hoffmann 
Reviewed-by: Chao Li 
---
 .../C/Include/IndustryStandard/PeImage.h  | 790 --
 1 file changed, 790 deletions(-)
 delete mode 100644 BaseTools/Source/C/Include/IndustryStandard/PeImage.h

diff --git a/BaseTools/Source/C/Include/IndustryStandard/PeImage.h 
b/BaseTools/Source/C/Include/IndustryStandard/PeImage.h
deleted file mode 100644
index fb867b5660a9..
--- a/BaseTools/Source/C/Include/IndustryStandard/PeImage.h
+++ /dev/null
@@ -1,790 +0,0 @@
-/** @file
-  EFI image format for PE32+. Please note some data structures are different
-  for IA-32 and Itanium-based images, look for UINTN and the #ifdef EFI_IA64
-
-  @bug Fix text - doc as defined in MSFT EFI specification.
-
-  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-  Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
-  Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights 
reserved.
-  Copyright (c) 2022, Loongson Technology Corporation Limited. All rights 
reserved.
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __PE_IMAGE_H__
-#define __PE_IMAGE_H__
-
-//
-// PE32+ Subsystem type for EFI images
-//
-#define EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION 10
-#define EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
-#define EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER  12
-#define EFI_IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER  13
-
-//
-// BugBug: Need to get a real answer for this problem. This is not in the
-// PE specification.
-//
-// A SAL runtime driver does not get fixed up when a transition to
-// virtual mode is made. In all other cases it should be treated
-// like a EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER image
-//
-#define EFI_IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER  13
-
-//
-// PE32+ Machine type for EFI images
-//
-#define IMAGE_FILE_MACHINE_I3860x014c
-#define IMAGE_FILE_MACHINE_EBC 0x0EBC
-#define IMAGE_FILE_MACHINE_X64 0x8664
-#define IMAGE_FILE_MACHINE_ARM 0x01c0  // Thumb only
-#define IMAGE_FILE_MACHINE_ARMT0x01c2  // 32bit Mixed ARM and 
Thumb/Thumb 2  Little Endian
-#define IMAGE_FILE_MACHINE_ARMTHUMB_MIXED IMAGE_FILE_MACHINE_ARMT
-#define IMAGE_FILE_MACHINE_ARM64   0xAA64  // 64bit ARM Architecture, 
Little Endian
-#define IMAGE_FILE_MACHINE_RISCV64 0x5064  // 64bit RISC-V ISA
-#define IMAGE_FILE_MACHINE_LOONGARCH64 0x6264  // 64bit LoongArch Architecture
-
-//
-// Support old names for backward compatible
-//
-#define EFI_IMAGE_MACHINE_IA32IMAGE_FILE_MACHINE_I386
-#define EFI_IMAGE_MACHINE_EBC IMAGE_FILE_MACHINE_EBC
-#define EFI_IMAGE_MACHINE_X64 IMAGE_FILE_MACHINE_X64
-#define EFI_IMAGE_MACHINE_ARMTIMAGE_FILE_MACHINE_ARMT
-#define EFI_IMAGE_MACHINE_AARCH64 IMAGE_FILE_MACHINE_ARM64
-#define EFI_IMAGE_MACHINE_RISCV64 IMAGE_FILE_MACHINE_RISCV64
-#define EFI_IMAGE_MACHINE_LOONGARCH64 IMAGE_FILE_MACHINE_LOONGARCH64
-
-#define EFI_IMAGE_DOS_SIGNATURE 0x5A4D  // MZ
-#define EFI_IMAGE_OS2_SIGNATURE 0x454E  // NE
-#define EFI_IMAGE_OS2_SIGNATURE_LE  0x454C  // LE
-#define EFI_IMAGE_NT_SIGNATURE  0x4550  // PE00
-#define EFI_IMAGE_EDOS_SIGNATURE0x44454550  // PEED
-
-///
-/// PE images can start with an optional DOS header, so if an image is run
-///  under DOS it can print an error message.
-///
-typedef struct {
-  UINT16  e_magic;// Magic number
-  UINT16  e_cblp; // Bytes on last page of file
-  UINT16  e_cp;   // Pages in file
-  UINT16  e_crlc; // Relocations
-  UINT16  e_cparhdr;  // Size of header in paragraphs
-  UINT16  e_minalloc; // Minimum extra paragraphs needed
-  UINT16  e_maxalloc; // Maximum extra paragraphs needed
-  UINT16  e_ss;   // Initial (relative) SS value
-  UINT16  e_sp;   // Initial SP value
-  UINT16  e_csum; // Checksum
-  UINT16  e_ip;   // Initial IP value
-  UINT16  e_cs;   // Initial (relative) CS value
-  UINT16  e_lfarlc;   // File address of relocation table
-  UINT16  e_ovno; // Overlay number
-  UINT16  e_res[4];   // Reserved words
-  UINT16  e_oemid;// OEM identifier (for e_oeminfo)
-  UINT16  e_oeminfo;  // OEM information; e_oemid specific
-  UINT16  e_res2[10]; // Reserved words
-  UINT32  e_lfanew;   // File address of new exe header
-} EFI_IMAGE_DOS_HEADER;
-
-///
-/// File header format.
-///
-typedef struct {
-  UINT16  Machine;
-  UINT16  NumberOfSections;
-  UINT32  TimeDateStamp;
-  UINT32  PointerToSymbolTable;
-  UINT32  NumberOfSymbols;
-  UINT16  SizeOfOptionalHeader;
-  UINT16  Characteristics;
-} EFI_IMAGE_FILE_HEADER;
-
-#define EFI_IMAGE_SIZEOF_FILE_HEADER20
-
-#define EFI_IMAGE_FILE_RELOCS_STRIPPED  0x0001  // Relocation info 
stripped from file.
-#define EFI_IMAGE_FILE_EXECUTABLE_IMAGE 0x0002  // File is executable  
(i.e. no unresolved externel references).
-#define 

[edk2-devel] [PATCH v5 05/10] BaseTools: remove duplicate includes: IndustryStandard/Acpi*.h

2023-04-20 Thread Gerd Hoffmann
Use the MdePkg version instead of maintaining a copy in BaseTools.

Signed-off-by: Gerd Hoffmann 
Acked-by: Sunil V L 
---
 .../Source/C/Include/IndustryStandard/Acpi.h  | 117 ---
 .../C/Include/IndustryStandard/Acpi1_0.h  | 285 
 .../C/Include/IndustryStandard/Acpi2_0.h  | 520 --
 .../C/Include/IndustryStandard/Acpi3_0.h  | 668 --
 .../Source/C/Include/Protocol/DevicePath.h|   2 +-
 BaseTools/Source/C/GenFw/GenFw.c  |   8 +-
 BaseTools/Source/C/Makefiles/header.makefile  |   1 +
 BaseTools/Source/C/Makefiles/ms.common|   1 +
 8 files changed, 7 insertions(+), 1595 deletions(-)
 delete mode 100644 BaseTools/Source/C/Include/IndustryStandard/Acpi.h
 delete mode 100644 BaseTools/Source/C/Include/IndustryStandard/Acpi1_0.h
 delete mode 100644 BaseTools/Source/C/Include/IndustryStandard/Acpi2_0.h
 delete mode 100644 BaseTools/Source/C/Include/IndustryStandard/Acpi3_0.h

diff --git a/BaseTools/Source/C/Include/IndustryStandard/Acpi.h 
b/BaseTools/Source/C/Include/IndustryStandard/Acpi.h
deleted file mode 100644
index 3516478ce400..
--- a/BaseTools/Source/C/Include/IndustryStandard/Acpi.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/** @file
-  This file contains some basic ACPI definitions that are consumed by drivers
-  that do not care about ACPI versions.
-
-  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _ACPI_H_
-#define _ACPI_H_
-
-//
-// Common table header, this prefaces all ACPI tables, including FACS, but
-// excluding the RSD PTR structure
-//
-typedef struct {
-  UINT32  Signature;
-  UINT32  Length;
-} EFI_ACPI_COMMON_HEADER;
-
-//
-// Common ACPI description table header.  This structure prefaces most ACPI 
tables.
-//
-#pragma pack(1)
-
-typedef struct {
-  UINT32  Signature;
-  UINT32  Length;
-  UINT8   Revision;
-  UINT8   Checksum;
-  UINT8   OemId[6];
-  UINT64  OemTableId;
-  UINT32  OemRevision;
-  UINT32  CreatorId;
-  UINT32  CreatorRevision;
-} EFI_ACPI_DESCRIPTION_HEADER;
-
-#pragma pack()
-//
-// Define for Pci Host Bridge Resource Allocation
-//
-#define ACPI_ADDRESS_SPACE_DESCRIPTOR 0x8A
-#define ACPI_END_TAG_DESCRIPTOR   0x79
-
-#define ACPI_ADDRESS_SPACE_TYPE_MEM   0x00
-#define ACPI_ADDRESS_SPACE_TYPE_IO0x01
-#define ACPI_ADDRESS_SPACE_TYPE_BUS   0x02
-
-//
-// Power Management Timer frequency is fixed at 3.579545MHz
-//
-#define ACPI_TIMER_FREQUENCY   3579545
-
-//
-// Make sure structures match spec
-//
-#pragma pack(1)
-
-typedef struct {
-  UINT8   Desc;
-  UINT16  Len;
-  UINT8   ResType;
-  UINT8   GenFlag;
-  UINT8   SpecificFlag;
-  UINT64  AddrSpaceGranularity;
-  UINT64  AddrRangeMin;
-  UINT64  AddrRangeMax;
-  UINT64  AddrTranslationOffset;
-  UINT64  AddrLen;
-} EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR;
-
-typedef struct {
-  UINT8 Desc;
-  UINT8 Checksum;
-} EFI_ACPI_END_TAG_DESCRIPTOR;
-
-//
-// General use definitions
-//
-#define EFI_ACPI_RESERVED_BYTE  0x00
-#define EFI_ACPI_RESERVED_WORD  0x
-#define EFI_ACPI_RESERVED_DWORD 0x
-#define EFI_ACPI_RESERVED_QWORD 0x
-
-//
-// Resource Type Specific Flags
-// Ref ACPI specification 6.4.3.5.5
-//
-// Bit [0]: Write Status, _RW
-//
-#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_READ_WRITE(1 << 
0)
-#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_READ_ONLY (0 << 
0)
-//
-// Bit [2:1]  : Memory Attributes, _MEM
-//
-#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_NON_CACHEABLE (0 << 
1)
-#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE (1 << 
1)
-#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_WRITE_COMBINING (2 << 
1)
-#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_PREFETCHABLE(3 << 
1)
-//
-// Bit [4:3]  : Memory Attributes, _MTP
-//
-#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_ADDRESS_RANGE_MEMORY  (0 << 
3)
-#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_ADDRESS_RANGE_RESERVED(1 << 
3)
-#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_ADDRESS_RANGE_ACPI(2 << 
3)
-#define EFI_APCI_MEMORY_RESOURCE_SPECIFIC_FLAG_ADDRESS_RANGE_NVS (3 << 
3)
-//
-// Bit [5]: Memory to I/O Translation, _TTP
-//
-#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_TYPE_TRANSLATION  (1 << 
5)
-#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_TYPE_STATIC   (0 << 
5)
-
-#pragma pack()
-
-#endif
diff --git a/BaseTools/Source/C/Include/IndustryStandard/Acpi1_0.h 
b/BaseTools/Source/C/Include/IndustryStandard/Acpi1_0.h
deleted file mode 100644
index 62bd9f477e0b..
--- a/BaseTools/Source/C/Include/IndustryStandard/Acpi1_0.h
+++ /dev/null
@@ -1,285 +0,0 @@
-/** @file
-  ACPI 1.0b definitions from the ACPI Specification, revision 1.0b
-
-  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _ACPI_1_0_H_
-#define _ACPI_1_0_H_
-

[edk2-devel] [PATCH v5 04/10] BaseTools: remove duplicate includes: /ProcessorBind.h

2023-04-20 Thread Gerd Hoffmann
Use the MdePkg version instead of maintaining a copy in BaseTools.

Signed-off-by: Gerd Hoffmann 
Reviewed-by: Chao Li 
---
 .../Source/C/Include/AArch64/ProcessorBind.h  | 148 --
 .../Source/C/Include/Arm/ProcessorBind.h  | 147 --
 .../Source/C/Include/Ia32/ProcessorBind.h | 155 ---
 .../C/Include/LoongArch64/ProcessorBind.h |  80 
 .../Source/C/Include/RiscV64/ProcessorBind.h  |  85 
 .../Source/C/Include/X64/ProcessorBind.h  | 183 --
 BaseTools/Source/C/Common/Decompress.c|   1 +
 BaseTools/Source/C/Makefiles/header.makefile  |  14 +-
 BaseTools/Source/C/Makefiles/ms.common|  12 +-
 9 files changed, 19 insertions(+), 806 deletions(-)
 delete mode 100644 BaseTools/Source/C/Include/AArch64/ProcessorBind.h
 delete mode 100644 BaseTools/Source/C/Include/Arm/ProcessorBind.h
 delete mode 100644 BaseTools/Source/C/Include/Ia32/ProcessorBind.h
 delete mode 100644 BaseTools/Source/C/Include/LoongArch64/ProcessorBind.h
 delete mode 100644 BaseTools/Source/C/Include/RiscV64/ProcessorBind.h
 delete mode 100644 BaseTools/Source/C/Include/X64/ProcessorBind.h

diff --git a/BaseTools/Source/C/Include/AArch64/ProcessorBind.h 
b/BaseTools/Source/C/Include/AArch64/ProcessorBind.h
deleted file mode 100644
index dfa725b2e363..
--- a/BaseTools/Source/C/Include/AArch64/ProcessorBind.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/** @file
-  Processor or Compiler specific defines and types for AArch64.
-
-  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-  Portions copyright (c) 2013, ARM Ltd. All rights reserved.
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __PROCESSOR_BIND_H__
-#define __PROCESSOR_BIND_H__
-
-///
-/// Define the processor type so other code can make processor based choices
-///
-#define MDE_CPU_AARCH64
-
-//
-// Make sure we are using the correct packing rules per EFI specification
-//
-#ifndef __GNUC__
-#pragma pack()
-#endif
-
-#if _MSC_EXTENSIONS
-  //
-  // use Microsoft* C compiler dependent integer width types
-  //
-  typedef unsigned __int64UINT64;
-  typedef __int64 INT64;
-  typedef unsigned __int32UINT32;
-  typedef __int32 INT32;
-  typedef unsigned short  UINT16;
-  typedef unsigned short  CHAR16;
-  typedef short   INT16;
-  typedef unsigned char   BOOLEAN;
-  typedef unsigned char   UINT8;
-  typedef charCHAR8;
-  typedef signed char INT8;
-#else
-  //
-  // Use ANSI C 2000 stdint.h integer width declarations
-  //
-  #include 
-  typedef uint8_t   BOOLEAN;
-  typedef int8_tINT8;
-  typedef uint8_t   UINT8;
-  typedef int16_t   INT16;
-  typedef uint16_t  UINT16;
-  typedef int32_t   INT32;
-  typedef uint32_t  UINT32;
-  typedef int64_t   INT64;
-  typedef uint64_t  UINT64;
-  typedef char  CHAR8;
-  typedef uint16_t  CHAR16;
-
-#endif
-
-///
-/// Unsigned value of native width.  (4 bytes on supported 32-bit processor 
instructions,
-/// 8 bytes on supported 64-bit processor instructions)
-///
-typedef UINT64  UINTN;
-
-///
-/// Signed value of native width.  (4 bytes on supported 32-bit processor 
instructions,
-/// 8 bytes on supported 64-bit processor instructions)
-///
-typedef INT64   INTN;
-
-//
-// Processor specific defines
-//
-
-///
-/// A value of native width with the highest bit set.
-///
-#define MAX_BIT  0x8000
-
-///
-/// A value of native width with the two highest bits set.
-///
-#define MAX_2_BITS   0xC000
-
-///
-/// The stack alignment required for AARCH64
-///
-#define CPU_STACK_ALIGNMENT  16
-
-//
-// Modifier to ensure that all protocol member functions and EFI intrinsics
-// use the correct C calling convention. All protocol member functions and
-// EFI intrinsics are required to modify their member functions with EFIAPI.
-//
-#define EFIAPI
-
-#if defined(__GNUC__)
-  ///
-  /// For GNU assembly code, .global or .globl can declare global symbols.
-  /// Define this macro to unify the usage.
-  ///
-  #define ASM_GLOBAL .globl
-
-  #if !defined(__APPLE__)
-///
-/// ARM EABI defines that the linker should not manipulate call relocations
-/// (do bl/blx conversion) unless the target symbol has function type.
-/// CodeSourcery 2010.09 started requiring the .type to function properly
-///
-#define INTERWORK_FUNC(func__)   .type ASM_PFX(func__), %function
-
-#define GCC_ASM_EXPORT(func__)  \
- .global  _CONCATENATE (__USER_LABEL_PREFIX__, func__);\
- .type ASM_PFX(func__), %function
-
-#define GCC_ASM_IMPORT(func__)  \
- .extern  _CONCATENATE (__USER_LABEL_PREFIX__, func__)
-
-  #else
-//
-// .type not supported by Apple Xcode tools
-//
-#define INTERWORK_FUNC(func__)
-
-#define GCC_ASM_EXPORT(func__)  \
- .globl  _CONCATENATE 

[edk2-devel] [PATCH v5 06/10] MdePkg/PeImage.h: add bits from BaseTools version

2023-04-20 Thread Gerd Hoffmann
The BaseTools and MdePkg versions of PeImage.h diverged over time,
add some missing bits to the MdePkg header file in preparation for
removing the BaseTools version.

Signed-off-by: Gerd Hoffmann 
---
 MdePkg/Include/IndustryStandard/PeImage.h | 31 +++
 1 file changed, 31 insertions(+)

diff --git a/MdePkg/Include/IndustryStandard/PeImage.h 
b/MdePkg/Include/IndustryStandard/PeImage.h
index 8646ff22b55f..47037049348c 100644
--- a/MdePkg/Include/IndustryStandard/PeImage.h
+++ b/MdePkg/Include/IndustryStandard/PeImage.h
@@ -101,6 +101,7 @@ typedef struct {
 #define EFI_IMAGE_FILE_EXECUTABLE_IMAGE BIT1 ///< 0x0002  File is 
executable  (i.e. no unresolved externel references).
 #define EFI_IMAGE_FILE_LINE_NUMS_STRIPPED   BIT2 ///< 0x0004  Line numbers 
stripped from file.
 #define EFI_IMAGE_FILE_LOCAL_SYMS_STRIPPED  BIT3 ///< 0x0008  Local 
symbols stripped from file.
+#define EFI_IMAGE_FILE_LARGE_ADDRESS_AWARE  BIT5 ///< 0x0020  Supports 
addresses > 2-GB
 #define EFI_IMAGE_FILE_BYTES_REVERSED_LOBIT7 ///< 0x0080  Bytes of 
machine word are reversed.
 #define EFI_IMAGE_FILE_32BIT_MACHINEBIT8 ///< 0x0100  32 bit word 
machine.
 #define EFI_IMAGE_FILE_DEBUG_STRIPPED   BIT9 ///< 0x0200  Debugging 
info stripped from file in .DBG file.
@@ -577,6 +578,13 @@ typedef struct {
   UINT32AddressOfNameOrdinals;
 } EFI_IMAGE_EXPORT_DIRECTORY;
 
+//
+// Based export types.
+//
+#define EFI_IMAGE_EXPORT_ORDINAL_BASE  1
+#define EFI_IMAGE_EXPORT_ADDR_SIZE 4
+#define EFI_IMAGE_EXPORT_ORDINAL_SIZE  2
+
 ///
 /// Hint/Name Table.
 ///
@@ -670,6 +678,29 @@ typedef struct {
   //
 } EFI_IMAGE_DEBUG_CODEVIEW_MTOC_ENTRY;
 
+// avoid conflict with windows header files
+#ifndef RUNTIME_FUNCTION_INDIRECT
+
+//
+// .pdata entries for X64
+//
+typedef struct {
+  UINT32FunctionStartAddress;
+  UINT32FunctionEndAddress;
+  UINT32UnwindInfoAddress;
+} RUNTIME_FUNCTION;
+
+#endif
+
+typedef struct {
+  UINT8Version : 3;
+  UINT8Flags   : 5;
+  UINT8SizeOfProlog;
+  UINT8CountOfUnwindCodes;
+  UINT8FrameRegister   : 4;
+  UINT8FrameRegisterOffset : 4;
+} UNWIND_INFO;
+
 ///
 /// Extended DLL Characteristics
 ///
-- 
2.40.0



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




[edk2-devel] [PATCH v5 08/10] BaseTools: switch from EFI_IMAGE_MACHINE_* to IMAGE_FILE_MACHINE_*

2023-04-20 Thread Gerd Hoffmann
Use the newer versions of the machine #defines.

Signed-off-by: Gerd Hoffmann 
Reviewed-by: Chao Li 
---
 BaseTools/Source/C/EfiRom/EfiRom.h| 10 ++---
 .../C/Include/IndustryStandard/PeImage.h  |  1 +
 BaseTools/Source/C/Common/BasePeCoff.c| 28 ++---
 BaseTools/Source/C/GenFv/GenFvInternalLib.c   | 42 +--
 BaseTools/Source/C/GenFw/Elf32Convert.c   |  6 +--
 BaseTools/Source/C/GenFw/Elf64Convert.c   | 10 ++---
 BaseTools/Source/C/GenFw/GenFw.c  |  8 +---
 7 files changed, 50 insertions(+), 55 deletions(-)

diff --git a/BaseTools/Source/C/EfiRom/EfiRom.h 
b/BaseTools/Source/C/EfiRom/EfiRom.h
index 0b39e2af2e0c..887a6a51e25b 100644
--- a/BaseTools/Source/C/EfiRom/EfiRom.h
+++ b/BaseTools/Source/C/EfiRom/EfiRom.h
@@ -108,11 +108,11 @@ typedef struct {
 // Machine Types
 //
 static STRING_LOOKUP  mMachineTypes[] = {
-  { EFI_IMAGE_MACHINE_IA32, "IA32" },
-  { EFI_IMAGE_MACHINE_X64, "X64" },
-  { EFI_IMAGE_MACHINE_EBC, "EBC" },
-  { EFI_IMAGE_MACHINE_ARMT, "ARM" },
-  { EFI_IMAGE_MACHINE_AARCH64, "AA64" },
+  { IMAGE_FILE_MACHINE_I386, "IA32" },
+  { IMAGE_FILE_MACHINE_X64, "X64" },
+  { IMAGE_FILE_MACHINE_EBC, "EBC" },
+  { IMAGE_FILE_MACHINE_ARMTHUMB_MIXED, "ARM" },
+  { IMAGE_FILE_MACHINE_ARM64, "AA64" },
   { 0, NULL }
 };
 
diff --git a/BaseTools/Source/C/Include/IndustryStandard/PeImage.h 
b/BaseTools/Source/C/Include/IndustryStandard/PeImage.h
index 22161edf443d..fb867b5660a9 100644
--- a/BaseTools/Source/C/Include/IndustryStandard/PeImage.h
+++ b/BaseTools/Source/C/Include/IndustryStandard/PeImage.h
@@ -42,6 +42,7 @@
 #define IMAGE_FILE_MACHINE_X64 0x8664
 #define IMAGE_FILE_MACHINE_ARM 0x01c0  // Thumb only
 #define IMAGE_FILE_MACHINE_ARMT0x01c2  // 32bit Mixed ARM and 
Thumb/Thumb 2  Little Endian
+#define IMAGE_FILE_MACHINE_ARMTHUMB_MIXED IMAGE_FILE_MACHINE_ARMT
 #define IMAGE_FILE_MACHINE_ARM64   0xAA64  // 64bit ARM Architecture, 
Little Endian
 #define IMAGE_FILE_MACHINE_RISCV64 0x5064  // 64bit RISC-V ISA
 #define IMAGE_FILE_MACHINE_LOONGARCH64 0x6264  // 64bit LoongArch Architecture
diff --git a/BaseTools/Source/C/Common/BasePeCoff.c 
b/BaseTools/Source/C/Common/BasePeCoff.c
index 0172370174b6..038bb054e57a 100644
--- a/BaseTools/Source/C/Common/BasePeCoff.c
+++ b/BaseTools/Source/C/Common/BasePeCoff.c
@@ -169,13 +169,13 @@ PeCoffLoaderCheckImageType (
 ImageContext->Machine = TeHdr->Machine;
   }
 
-  if (ImageContext->Machine != EFI_IMAGE_MACHINE_IA32 && \
-  ImageContext->Machine != EFI_IMAGE_MACHINE_X64  && \
-  ImageContext->Machine != EFI_IMAGE_MACHINE_ARMT && \
-  ImageContext->Machine != EFI_IMAGE_MACHINE_EBC  && \
-  ImageContext->Machine != EFI_IMAGE_MACHINE_AARCH64 && \
-  ImageContext->Machine != EFI_IMAGE_MACHINE_RISCV64 && \
-  ImageContext->Machine != EFI_IMAGE_MACHINE_LOONGARCH64) {
+  if (ImageContext->Machine != IMAGE_FILE_MACHINE_I386 && \
+  ImageContext->Machine != IMAGE_FILE_MACHINE_X64  && \
+  ImageContext->Machine != IMAGE_FILE_MACHINE_ARMTHUMB_MIXED && \
+  ImageContext->Machine != IMAGE_FILE_MACHINE_EBC  && \
+  ImageContext->Machine != IMAGE_FILE_MACHINE_ARM64 && \
+  ImageContext->Machine != IMAGE_FILE_MACHINE_RISCV64 && \
+  ImageContext->Machine != IMAGE_FILE_MACHINE_LOONGARCH64) {
 //
 // unsupported PeImage machine type
 //
@@ -759,16 +759,16 @@ PeCoffLoaderRelocateImage (
 
   default:
 switch (MachineType) {
-case EFI_IMAGE_MACHINE_IA32:
+case IMAGE_FILE_MACHINE_I386:
   Status = PeCoffLoaderRelocateIa32Image (Reloc, Fixup, , 
Adjust);
   break;
-case EFI_IMAGE_MACHINE_ARMT:
+case IMAGE_FILE_MACHINE_ARMTHUMB_MIXED:
   Status = PeCoffLoaderRelocateArmImage (, Fixup, , 
Adjust);
   break;
-case EFI_IMAGE_MACHINE_RISCV64:
+case IMAGE_FILE_MACHINE_RISCV64:
   Status = PeCoffLoaderRelocateRiscVImage (Reloc, Fixup, , 
Adjust);
   break;
-case EFI_IMAGE_MACHINE_LOONGARCH64:
+case IMAGE_FILE_MACHINE_LOONGARCH64:
   Status = PeCoffLoaderRelocateLoongArch64Image (Reloc, Fixup, 
, Adjust);
   break;
 default:
@@ -1255,14 +1255,14 @@ PeCoffLoaderGetPdbPointer (
 //   generate PE32+ image with PE32 Magic.
 //
 switch (Hdr.Pe32->FileHeader.Machine) {
-case EFI_IMAGE_MACHINE_IA32:
-case EFI_IMAGE_MACHINE_ARMT:
+case IMAGE_FILE_MACHINE_I386:
+case IMAGE_FILE_MACHINE_ARMTHUMB_MIXED:
   //
   // Assume PE32 image with IA32 Machine field.
   //
   Magic = EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC;
   break;
-case EFI_IMAGE_MACHINE_X64:
+case IMAGE_FILE_MACHINE_X64:
   //
   // Assume PE32+ image with X64 Machine field
   //
diff --git a/BaseTools/Source/C/GenFv/GenFvInternalLib.c 
b/BaseTools/Source/C/GenFv/GenFvInternalLib.c
index c8d5cac8e26e..f466324d6192 100644
--- 

[edk2-devel] [PATCH v5 03/10] BaseTools: remove WinNtInclude.h

2023-04-20 Thread Gerd Hoffmann
Appears to be a relic for ancient windows / compiler versions,
windows builds in CI work just fine without it.

Signed-off-by: Gerd Hoffmann 
---
 BaseTools/Source/C/Common/WinNtInclude.h| 66 -
 BaseTools/Source/C/GenFv/GenFvInternalLib.c |  1 -
 BaseTools/Source/C/GenFw/Elf32Convert.c |  2 -
 BaseTools/Source/C/GenFw/Elf64Convert.c |  2 -
 BaseTools/Source/C/GenFw/ElfConvert.c   |  2 -
 BaseTools/Source/C/GenFw/GenFw.c|  2 -
 6 files changed, 75 deletions(-)
 delete mode 100644 BaseTools/Source/C/Common/WinNtInclude.h

diff --git a/BaseTools/Source/C/Common/WinNtInclude.h 
b/BaseTools/Source/C/Common/WinNtInclude.h
deleted file mode 100644
index 181e6ac33370..
--- a/BaseTools/Source/C/Common/WinNtInclude.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/** @file
-Include file for the WinNt Library
-
-Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __WIN_NT_INCLUDE_H__
-#define __WIN_NT_INCLUDE_H__
-
-#define GUID  _WINNT_DUP_GUID_
-#define _LIST_ENTRY  _WINNT_DUP_LIST_ENTRY_FORWARD
-#define LIST_ENTRY   _WINNT_DUP_LIST_ENTRY
-
-#if (_MSC_VER < 1800)
-#define InterlockedIncrement _WINNT_DUP_InterlockedIncrement
-#define InterlockedDecrement _WINNT_DUP_InterlockedDecrement
-#define InterlockedCompareExchange64 _WINNT_DUP_InterlockedCompareExchange64
-#endif
-
-#undef UNALIGNED
-#undef CONST
-#undef VOID
-
-#ifndef __GNUC__
-#include "windows.h"
-
-//
-// Win32 include files do not compile clean with /W4, so we use the warning
-// pragma to suppress the warnings for Win32 only. This way our code can still
-// compile at /W4 (highest warning level) with /WX (warnings cause build
-// errors).
-//
-#pragma warning(disable : 4115)
-#pragma warning(disable : 4201)
-#pragma warning(disable : 4214)
-#pragma warning(disable : 4028)
-#pragma warning(disable : 4133)
-
-//
-// Set the warnings back on as the EFI code must be /W4.
-//
-#pragma warning(default : 4115)
-#pragma warning(default : 4201)
-#pragma warning(default : 4214)
-
-#endif
-
-#undef GUID
-#undef _LIST_ENTRY
-#undef LIST_ENTRY
-#undef InterlockedIncrement
-#undef InterlockedDecrement
-#undef InterlockedCompareExchange64
-#undef InterlockedCompareExchangePointer
-
-#define VOID void
-
-//
-// Prevent collisions with Windows API name macros that deal with Unicode/Not 
issues
-//
-#undef LoadImage
-#undef CreateEvent
-
-#endif
diff --git a/BaseTools/Source/C/GenFv/GenFvInternalLib.c 
b/BaseTools/Source/C/GenFv/GenFvInternalLib.c
index 2df7182f8b52..c8d5cac8e26e 100644
--- a/BaseTools/Source/C/GenFv/GenFvInternalLib.c
+++ b/BaseTools/Source/C/GenFv/GenFvInternalLib.c
@@ -25,7 +25,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 #include 
 
-#include "WinNtInclude.h"
 #include "GenFvInternalLib.h"
 #include "FvLib.h"
 #include "PeCoffLib.h"
diff --git a/BaseTools/Source/C/GenFw/Elf32Convert.c 
b/BaseTools/Source/C/GenFw/Elf32Convert.c
index 87d7f133f132..e9fb3593a91b 100644
--- a/BaseTools/Source/C/GenFw/Elf32Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf32Convert.c
@@ -9,8 +9,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
-#include "WinNtInclude.h"
-
 #ifndef __GNUC__
 #include 
 #include 
diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c 
b/BaseTools/Source/C/GenFw/Elf64Convert.c
index 9c17c90b1660..dfcb100a594f 100644
--- a/BaseTools/Source/C/GenFw/Elf64Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf64Convert.c
@@ -10,8 +10,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
-#include "WinNtInclude.h"
-
 #ifndef __GNUC__
 #include 
 #include 
diff --git a/BaseTools/Source/C/GenFw/ElfConvert.c 
b/BaseTools/Source/C/GenFw/ElfConvert.c
index be98544056ec..3205f61494b6 100644
--- a/BaseTools/Source/C/GenFw/ElfConvert.c
+++ b/BaseTools/Source/C/GenFw/ElfConvert.c
@@ -7,8 +7,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
-#include "WinNtInclude.h"
-
 #ifndef __GNUC__
 #include 
 #include 
diff --git a/BaseTools/Source/C/GenFw/GenFw.c b/BaseTools/Source/C/GenFw/GenFw.c
index d0e52ccc2643..80ee73a80399 100644
--- a/BaseTools/Source/C/GenFw/GenFw.c
+++ b/BaseTools/Source/C/GenFw/GenFw.c
@@ -6,8 +6,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
-#include "WinNtInclude.h"
-
 #ifndef __GNUC__
 #include 
 #include 
-- 
2.40.0



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




[edk2-devel] [PATCH v5 07/10] BaseTools: drop IMAGE_FILE_MACHINE_ARM hacks

2023-04-20 Thread Gerd Hoffmann
The #define for IMAGE_FILE_MACHINE_ARM is not present in MdePkg,
this looks like a relic not used any more.  Remove.

Signed-off-by: Gerd Hoffmann 
---
 BaseTools/Source/C/Common/BasePeCoff.c | 23 ---
 1 file changed, 4 insertions(+), 19 deletions(-)

diff --git a/BaseTools/Source/C/Common/BasePeCoff.c 
b/BaseTools/Source/C/Common/BasePeCoff.c
index b8bfb7b58b91..0172370174b6 100644
--- a/BaseTools/Source/C/Common/BasePeCoff.c
+++ b/BaseTools/Source/C/Common/BasePeCoff.c
@@ -176,25 +176,10 @@ PeCoffLoaderCheckImageType (
   ImageContext->Machine != EFI_IMAGE_MACHINE_AARCH64 && \
   ImageContext->Machine != EFI_IMAGE_MACHINE_RISCV64 && \
   ImageContext->Machine != EFI_IMAGE_MACHINE_LOONGARCH64) {
-if (ImageContext->Machine == IMAGE_FILE_MACHINE_ARM) {
-  //
-  // There are two types of ARM images. Pure ARM and ARM/Thumb.
-  // If we see the ARM say it is the ARM/Thumb so there is only
-  // a single machine type we need to check for ARM.
-  //
-  ImageContext->Machine = EFI_IMAGE_MACHINE_ARMT;
-  if (ImageContext->IsTeImage == FALSE) {
-PeHdr->Pe32.FileHeader.Machine = ImageContext->Machine;
-  } else {
-TeHdr->Machine = ImageContext->Machine;
-  }
-
-} else {
-  //
-  // unsupported PeImage machine type
-  //
-  return RETURN_UNSUPPORTED;
-}
+//
+// unsupported PeImage machine type
+//
+return RETURN_UNSUPPORTED;
   }
 
   //
-- 
2.40.0



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




[edk2-devel] [PATCH v5 01/10] BaseTools: make sure the got is empty

2023-04-20 Thread Gerd Hoffmann
Add ASSERT()s that .got and .got.plt sections are empty
to linker scripts for gcc and clang.

Suggested-by: Ard Biesheuvel 
Signed-off-by: Gerd Hoffmann 
---
 BaseTools/Scripts/ClangBase.lds | 10 ++
 BaseTools/Scripts/GccBase.lds   | 10 ++
 2 files changed, 20 insertions(+)

diff --git a/BaseTools/Scripts/ClangBase.lds b/BaseTools/Scripts/ClangBase.lds
index 61452ddd9506..c7dcd2024ac8 100644
--- a/BaseTools/Scripts/ClangBase.lds
+++ b/BaseTools/Scripts/ClangBase.lds
@@ -59,6 +59,16 @@ SECTIONS {
 KEEP (*(.hii))
   }
 
+  .got : {
+*(.got)
+  }
+  ASSERT(SIZEOF(.got) == 0, "Unexpected GOT entries detected!")
+
+  .got.plt (INFO) : {
+*(.got.plt)
+  }
+  ASSERT(SIZEOF(.got.plt) == 0 || SIZEOF(.got.plt) == 0xc || SIZEOF(.got.plt) 
== 0x18, "Unexpected GOT/PLT entries detected!")
+
   /*
* Retain the GNU build id but in a non-allocatable section so GenFw
* does not copy it into the PE/COFF image.
diff --git a/BaseTools/Scripts/GccBase.lds b/BaseTools/Scripts/GccBase.lds
index 83cebd29d599..9f27e83bb0fc 100644
--- a/BaseTools/Scripts/GccBase.lds
+++ b/BaseTools/Scripts/GccBase.lds
@@ -59,6 +59,16 @@ SECTIONS {
 KEEP (*(.hii))
   }
 
+  .got : {
+*(.got)
+  }
+  ASSERT(SIZEOF(.got) == 0, "Unexpected GOT entries detected!")
+
+  .got.plt (INFO) : {
+*(.got.plt)
+  }
+  ASSERT(SIZEOF(.got.plt) == 0 || SIZEOF(.got.plt) == 0xc || SIZEOF(.got.plt) 
== 0x18, "Unexpected GOT/PLT entries detected!")
+
   /*
* Retain the GNU build id but in a non-allocatable section so GenFw
* does not copy it into the PE/COFF image.
-- 
2.40.0



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




[edk2-devel] [PATCH v5 02/10] MdePkg: don't set visibility to hidden

2023-04-20 Thread Gerd Hoffmann
Not needed any more on modern toolchains, they are better
in not creating a GOT without this trick.

Signed-off-by: Gerd Hoffmann 
---
 MdePkg/Include/X64/ProcessorBind.h | 14 --
 1 file changed, 14 deletions(-)

diff --git a/MdePkg/Include/X64/ProcessorBind.h 
b/MdePkg/Include/X64/ProcessorBind.h
index f0a4d00142b9..afbb4b6273fb 100644
--- a/MdePkg/Include/X64/ProcessorBind.h
+++ b/MdePkg/Include/X64/ProcessorBind.h
@@ -21,20 +21,6 @@
   #pragma pack()
 #endif
 
-#if defined (__GNUC__) && defined (__pic__) && !defined (USING_LTO)  && 
!defined (__APPLE__)
-//
-// Mark all symbol declarations and references as hidden, meaning they will
-// not be subject to symbol preemption. This allows the compiler to refer to
-// symbols directly using relative references rather than via the GOT, which
-// contains absolute symbol addresses that are subject to runtime relocation.
-//
-// The LTO linker will not emit GOT based relocations when all symbol
-// references can be resolved locally, and so there is no need to set the
-// pragma in that case (and doing so will cause other issues).
-//
-  #pragma GCC visibility push (hidden)
-#endif
-
 #if defined (__INTEL_COMPILER)
 //
 // Disable ICC's remark #869: "Parameter" was never referenced warning.
-- 
2.40.0



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




[edk2-devel] [PATCH v5 00/10] BaseTools: remove duplicate includes.

2023-04-20 Thread Gerd Hoffmann
There is alot of code duplication between BaseTools and MdePkg (and also
MdeModulePkg).  This patch series starts reducing this by removing some
header files.  BaseTools are switched over to use the include files in
MdePkg instead.  It also cleans up some (apparently) obsolete code and
adapts BaseTools code in a few places to work with the MdePkg version of
the include files.

v5 changes:
 - remove visibility hidden on x64
 - add assert for GOT being empty.
v4 changes:
 - fix clang build failure
v3 changes:
 - fix build failure on ubuntu 22.04
v2 changes:
 - rebase to latest master, resolve conflicts.
 - pick up reviews and acks.

take care,
  Gerd

Gerd Hoffmann (10):
  BaseTools: make sure the got is empty
  MdePkg: don't set visibility to hidden
  BaseTools: remove WinNtInclude.h
  BaseTools: remove duplicate includes: /ProcessorBind.h
  BaseTools: remove duplicate includes: IndustryStandard/Acpi*.h
  MdePkg/PeImage.h: add bits from BaseTools version
  BaseTools: drop IMAGE_FILE_MACHINE_ARM hacks
  BaseTools: switch from EFI_IMAGE_MACHINE_* to IMAGE_FILE_MACHINE_*
  BaseTools: remove duplicate includes: IndustryStandard/PeImage.h
  BaseTools: remove duplicate includes: IndustryStandard/*.h

 BaseTools/Source/C/Common/WinNtInclude.h  |  66 --
 BaseTools/Source/C/EfiRom/EfiRom.h|  14 +-
 .../Source/C/Include/AArch64/ProcessorBind.h  | 148 
 .../Source/C/Include/Arm/ProcessorBind.h  | 147 
 .../Source/C/Include/Ia32/ProcessorBind.h | 155 
 .../Source/C/Include/IndustryStandard/Acpi.h  | 117 ---
 .../C/Include/IndustryStandard/Acpi1_0.h  | 285 ---
 .../C/Include/IndustryStandard/Acpi2_0.h  | 520 
 .../C/Include/IndustryStandard/Acpi3_0.h  | 668 ---
 .../C/Include/IndustryStandard/Bluetooth.h|  56 --
 .../C/Include/IndustryStandard/EfiPci.h   |  51 --
 ...emoryMappedConfigurationSpaceAccessTable.h |  39 -
 .../C/Include/IndustryStandard/PeImage.h  | 789 --
 .../Source/C/Include/IndustryStandard/pci22.h | 536 
 .../Source/C/Include/IndustryStandard/pci23.h |  18 -
 .../Source/C/Include/IndustryStandard/pci30.h |  38 -
 .../C/Include/LoongArch64/ProcessorBind.h |  80 --
 .../Source/C/Include/Protocol/DevicePath.h|   2 +-
 .../Source/C/Include/RiscV64/ProcessorBind.h  |  85 --
 .../Source/C/Include/X64/ProcessorBind.h  | 183 
 MdePkg/Include/IndustryStandard/PeImage.h |  31 +
 MdePkg/Include/X64/ProcessorBind.h|  14 -
 BaseTools/Source/C/Common/BasePeCoff.c|  51 +-
 BaseTools/Source/C/Common/Decompress.c|   1 +
 BaseTools/Source/C/GenFv/GenFvInternalLib.c   |  43 +-
 BaseTools/Source/C/GenFw/Elf32Convert.c   |   8 +-
 BaseTools/Source/C/GenFw/Elf64Convert.c   |  12 +-
 BaseTools/Source/C/GenFw/ElfConvert.c |   2 -
 BaseTools/Source/C/GenFw/GenFw.c  |  18 +-
 BaseTools/Scripts/ClangBase.lds   |  10 +
 BaseTools/Scripts/GccBase.lds |  10 +
 BaseTools/Source/C/Makefiles/header.makefile  |  15 +-
 BaseTools/Source/C/Makefiles/ms.common|  13 +-
 33 files changed, 132 insertions(+), 4093 deletions(-)
 delete mode 100644 BaseTools/Source/C/Common/WinNtInclude.h
 delete mode 100644 BaseTools/Source/C/Include/AArch64/ProcessorBind.h
 delete mode 100644 BaseTools/Source/C/Include/Arm/ProcessorBind.h
 delete mode 100644 BaseTools/Source/C/Include/Ia32/ProcessorBind.h
 delete mode 100644 BaseTools/Source/C/Include/IndustryStandard/Acpi.h
 delete mode 100644 BaseTools/Source/C/Include/IndustryStandard/Acpi1_0.h
 delete mode 100644 BaseTools/Source/C/Include/IndustryStandard/Acpi2_0.h
 delete mode 100644 BaseTools/Source/C/Include/IndustryStandard/Acpi3_0.h
 delete mode 100644 BaseTools/Source/C/Include/IndustryStandard/Bluetooth.h
 delete mode 100644 BaseTools/Source/C/Include/IndustryStandard/EfiPci.h
 delete mode 100644 
BaseTools/Source/C/Include/IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h
 delete mode 100644 BaseTools/Source/C/Include/IndustryStandard/PeImage.h
 delete mode 100644 BaseTools/Source/C/Include/IndustryStandard/pci22.h
 delete mode 100644 BaseTools/Source/C/Include/IndustryStandard/pci23.h
 delete mode 100644 BaseTools/Source/C/Include/IndustryStandard/pci30.h
 delete mode 100644 BaseTools/Source/C/Include/LoongArch64/ProcessorBind.h
 delete mode 100644 BaseTools/Source/C/Include/RiscV64/ProcessorBind.h
 delete mode 100644 BaseTools/Source/C/Include/X64/ProcessorBind.h

-- 
2.40.0



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




Re: [edk2-devel] [edk2-redfish-client][PATCH] Initial edk2 redfish client repository

2023-04-20 Thread Nickle Wang via groups.io
Hi @Michael D Kinney,



May I have your comment to my copyright year question?



The copyright year in LICENSE file that I use is 2021 because the earliest file 
in RedfishClientPkg from edk2-staging is created in 2021. But since this 
repository is created in 2023, do you know what copyright year that I should 
use?



> Copyright (c) 2021, TianoCore and contributors.  All rights reserved.



Thanks,

Nickle



> -Original Message-

> From: devel@edk2.groups.io  On Behalf Of Nickle

> Wang via groups.io

> Sent: Friday, April 21, 2023 11:26 AM

> To: devel@edk2.groups.io

> Cc: Abner Chang ; Igor Kulchytskyy ;

> Michael D Kinney 

> Subject: [edk2-devel] [edk2-redfish-client][PATCH] Initial edk2 redfish client

> repository

>

> External email: Use caution opening links or attachments

>

>

> Add required files to initial edk2 redfish client repository.

>

> Signed-off-by: Nickle Wang mailto:nick...@nvidia.com>>

> Cc: Abner Chang mailto:abner.ch...@amd.com>>

> Cc: Igor Kulchytskyy mailto:ig...@ami.com>>

> Cc: Michael D Kinney 
> mailto:michael.d.kin...@intel.com>>

> ---

>  .gitignore  |  6 +

>  CONTRIBUTING.md |  3 +++

>  LICENSE | 51 ++

>  Maintainers.txt | 48 +++

>  README.md   | 66

> +

>  5 files changed, 174 insertions(+)

>  create mode 100644 .gitignore

>  create mode 100644 CONTRIBUTING.md

>  create mode 100644 LICENSE

>  create mode 100644 Maintainers.txt

>  create mode 100644 README.md

>

> diff --git a/.gitignore b/.gitignore

> new file mode 100644

> index 000..df38443

> --- /dev/null

> +++ b/.gitignore

> @@ -0,0 +1,6 @@

> +.DS_Store

> +*_extdep/

> +*.pyc

> +__pycache__/

> +tags/

> +.vscode/

> diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644

> index 000..39a1732

> --- /dev/null

> +++ b/CONTRIBUTING.md

> @@ -0,0 +1,3 @@

> +# Contributing to EDK Redfish Client

> +

> +Contributor documentation is maintained on the wiki:

> +https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Developmen

> +t-Process

> diff --git a/LICENSE b/LICENSE

> new file mode 100644

> index 000..fd0e199

> --- /dev/null

> +++ b/LICENSE

> @@ -0,0 +1,51 @@

> +Copyright (c) 2021, TianoCore and contributors.  All rights reserved.

> +

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

> +

> +Redistribution and use in source and binary forms, with or without

> +modification, are permitted provided that the following conditions are met:

> +

> +1. Redistributions of source code must retain the above copyright notice,

> +   this list of conditions and the following disclaimer.

> +

> +2. Redistributions in binary form must reproduce the above copyright notice,

> +   this list of conditions and the following disclaimer in the documentation

> +   and/or other materials provided with the distribution.

> +

> +Subject to the terms and conditions of this license, each copyright

> +holder and contributor hereby grants to those receiving rights under

> +this license a perpetual, worldwide, non-exclusive, no-charge,

> +royalty-free, irrevocable (except for failure to satisfy the conditions

> +of this license) patent license to make, have made, use, offer to sell,

> +sell, import, and otherwise transfer this software, where such license

> +applies only to those patent claims, already acquired or hereafter

> +acquired, licensable by such copyright holder or contributor that are 
> necessarily

> infringed by:

> +

> +(a) their Contribution(s) (the licensed copyrights of copyright holders and

> +non-copyrightable additions of contributors, in source or binary form)

> +alone; or

> +

> +(b) combination of their Contribution(s) with the work of authorship to

> +which such Contribution(s) was added by such copyright holder or

> +contributor, if, at the time the Contribution is added, such addition

> +causes such combination to be necessarily infringed. The patent license

> +shall not apply to any other combinations which include the

> +Contribution.

> +

> +Except as expressly stated above, no rights or licenses from any

> +copyright holder or contributor is granted under this license, whether

> +expressly, by implication, estoppel or otherwise.

> +

> +DISCLAIMER

> +

> +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND

> CONTRIBUTORS "AS IS"

> +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED

> TO,

> +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A

> PARTICULAR

> +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR

> +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,

> +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED

> TO,

> +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR

> +PROFITS; OR BUSINESS

> +INTERRUPTION) 

[edk2-devel] [PATCH v1 2/3] MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm: Add USB Cdc ECM devices support

2023-04-20 Thread RichardHo [何明忠] via groups . io
This driver provides UEFI driver for USB CDC ECM device

Signed-off-by: Richard Ho 
Cc: Andrew Fish 
Cc: Leif Lindholm 
Cc: Michael D Kinney 
Cc: Michael Kubacki 
Cc: Zhiguang Liu 
Cc: Liming Gao 
Cc: Hao A Wu 
Cc: Ray Ni 
R: Rebecca Cran 
Tested-by: Tinh Nguyen 
Reviewed-by: Tony Lo 
---
 .../Usb/UsbNetwork/UsbCdcEcm/ComponentName.c  | 170 
 .../Bus/Usb/UsbNetwork/UsbCdcEcm/UsbCdcEcm.c  | 502 ++
 .../Bus/Usb/UsbNetwork/UsbCdcEcm/UsbCdcEcm.h  | 211 +
 .../Usb/UsbNetwork/UsbCdcEcm/UsbCdcEcm.inf|  42 +
 .../Usb/UsbNetwork/UsbCdcEcm/UsbEcmFunction.c | 880 ++
 5 files changed, 1805 insertions(+)
 create mode 100644 MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm/ComponentName.c
 create mode 100644 MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm/UsbCdcEcm.c
 create mode 100644 MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm/UsbCdcEcm.h
 create mode 100644 MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm/UsbCdcEcm.inf
 create mode 100644 MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm/UsbEcmFunction.c

diff --git a/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm/ComponentName.c 
b/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm/ComponentName.c
new file mode 100644
index 00..e37eecf229
--- /dev/null
+++ b/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm/ComponentName.c
@@ -0,0 +1,170 @@
+/** @file
+  This file contains code for USB Ecm Driver Component Name definitions
+
+  Copyright (c) 2023, American Megatrends International LLC. All rights 
reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+#include "UsbCdcEcm.h"
+
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE  
gUsbEcmDriverNameTable[] = {
+  {
+"eng;en",
+L"USB ECM Driver"
+  },
+  {
+NULL,
+NULL
+  }
+};
+
+EFI_STATUS
+EFIAPI
+UsbEcmComponentNameGetDriverName (
+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
+  IN  CHAR8*Language,
+  OUT CHAR16   **DriverName
+  );
+
+EFI_STATUS
+EFIAPI
+UsbEcmComponentNameGetControllerName (
+  IN EFI_COMPONENT_NAME_PROTOCOL  *This,
+  IN EFI_HANDLE   Controller,
+  IN EFI_HANDLE   ChildHandleOPTIONAL,
+  IN CHAR8*Language,
+  OUT CHAR16  **ControllerName
+  );
+
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL  
gUsbEcmComponentName = {
+  UsbEcmComponentNameGetDriverName,
+  UsbEcmComponentNameGetControllerName,
+  "eng"
+};
+
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL  
gUsbEcmComponentName2 = {
+  (EFI_COMPONENT_NAME2_GET_DRIVER_NAME)UsbEcmComponentNameGetDriverName,
+  
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)UsbEcmComponentNameGetControllerName,
+  "en"
+};
+
+/**
+  Retrieves a Unicode string that is the user readable name of the driver.
+
+  This function retrieves the user readable name of a driver in the form of a
+  Unicode string. If the driver specified by This has a user readable name in
+  the language specified by Language, then a pointer to the driver name is
+  returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
+  by This does not support the language specified by Language,
+  then EFI_UNSUPPORTED is returned.
+
+  @param[in]  This  A pointer to the EFI_COMPONENT_NAME2_PROTOCOL 
or
+EFI_COMPONENT_NAME_PROTOCOL instance.
+  @param[in]  Language  A pointer to a Null-terminated ASCII string
+array indicating the language. This is the
+language of the driver name that the caller is
+requesting, and it must match one of the
+languages specified in SupportedLanguages. The
+number of languages supported by a driver is up
+to the driver writer. Language is specified
+in RFC 4646 or ISO 639-2 language code format.
+  @param[out] DriverNameA pointer to the Unicode string to return.
+This Unicode string is the name of the
+driver specified by This in the language
+specified by Language.
+
+  @retval EFI_SUCCESS   The Unicode string for the Driver specified by
+This and the language specified by Language was
+returned in DriverName.
+  @retval EFI_INVALID_PARAMETER Language is NULL.
+  @retval EFI_INVALID_PARAMETER DriverName is NULL.
+  @retval EFI_UNSUPPORTED   The driver specified by This does not support
+the language specified by Language.
+
+**/
+EFI_STATUS
+EFIAPI
+UsbEcmComponentNameGetDriverName (
+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
+  IN  CHAR8*Language,
+  OUT CHAR16   **DriverName
+  )
+{
+  return LookupUnicodeString2 (
+   Language,
+   

[edk2-devel] [PATCH v1 3/3] MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm: Add USB Cdc NCM devices support

2023-04-20 Thread RichardHo [何明忠] via groups . io
This driver provides UEFI driver for USB CDC NCM device

Signed-off-by: Richard Ho 
Cc: Andrew Fish 
Cc: Leif Lindholm 
Cc: Michael D Kinney 
Cc: Michael Kubacki 
Cc: Zhiguang Liu 
Cc: Liming Gao 
Cc: Hao A Wu 
Cc: Ray Ni 
R: Rebecca Cran 
Tested-by: Tinh Nguyen 
Reviewed-by: Tony Lo 
---
 .../Usb/UsbNetwork/UsbCdcNcm/ComponentName.c  | 170 +++
 .../Bus/Usb/UsbNetwork/UsbCdcNcm/UsbCdcNcm.c  | 506 +
 .../Bus/Usb/UsbNetwork/UsbCdcNcm/UsbCdcNcm.h  | 245 +
 .../Usb/UsbNetwork/UsbCdcNcm/UsbCdcNcm.inf|  42 +
 .../Usb/UsbNetwork/UsbCdcNcm/UsbNcmFunction.c | 966 ++
 5 files changed, 1929 insertions(+)
 create mode 100644 MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm/ComponentName.c
 create mode 100644 MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm/UsbCdcNcm.c
 create mode 100644 MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm/UsbCdcNcm.h
 create mode 100644 MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm/UsbCdcNcm.inf
 create mode 100644 MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm/UsbNcmFunction.c

diff --git a/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm/ComponentName.c 
b/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm/ComponentName.c
new file mode 100644
index 00..3cf3dc222d
--- /dev/null
+++ b/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm/ComponentName.c
@@ -0,0 +1,170 @@
+/** @file
+  This file contains code for USB Ncm Driver Component Name definitions
+
+  Copyright (c) 2023, American Megatrends International LLC. All rights 
reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+#include "UsbCdcNcm.h"
+
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE  
gUsbNcmDriverNameTable[] = {
+  {
+"eng;en",
+L"USB NCM Driver"
+  },
+  {
+NULL,
+NULL
+  }
+};
+
+EFI_STATUS
+EFIAPI
+UsbNcmComponentNameGetDriverName (
+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
+  IN  CHAR8*Language,
+  OUT CHAR16   **DriverName
+  );
+
+EFI_STATUS
+EFIAPI
+UsbNcmComponentNameGetControllerName (
+  IN EFI_COMPONENT_NAME_PROTOCOL  *This,
+  IN EFI_HANDLE   Controller,
+  IN EFI_HANDLE   ChildHandleOPTIONAL,
+  IN CHAR8*Language,
+  OUT CHAR16  **ControllerName
+  );
+
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL  
gUsbNcmComponentName = {
+  UsbNcmComponentNameGetDriverName,
+  UsbNcmComponentNameGetControllerName,
+  "eng"
+};
+
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL  
gUsbNcmComponentName2 = {
+  (EFI_COMPONENT_NAME2_GET_DRIVER_NAME)UsbNcmComponentNameGetDriverName,
+  
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)UsbNcmComponentNameGetControllerName,
+  "en"
+};
+
+/**
+  Retrieves a Unicode string that is the user readable name of the driver.
+
+  This function retrieves the user readable name of a driver in the form of a
+  Unicode string. If the driver specified by This has a user readable name in
+  the language specified by Language, then a pointer to the driver name is
+  returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
+  by This does not support the language specified by Language,
+  then EFI_UNSUPPORTED is returned.
+
+  @param[in]  This  A pointer to the EFI_COMPONENT_NAME2_PROTOCOL 
or
+EFI_COMPONENT_NAME_PROTOCOL instance.
+  @param[in]  Language  A pointer to a Null-terminated ASCII string
+array indicating the language. This is the
+language of the driver name that the caller is
+requesting, and it must match one of the
+languages specified in SupportedLanguages. The
+number of languages supported by a driver is up
+to the driver writer. Language is specified
+in RFC 4646 or ISO 639-2 language code format.
+  @param[out] DriverNameA pointer to the Unicode string to return.
+This Unicode string is the name of the
+driver specified by This in the language
+specified by Language.
+
+  @retval EFI_SUCCESS   The Unicode string for the Driver specified by
+This and the language specified by Language was
+returned in DriverName.
+  @retval EFI_INVALID_PARAMETER Language is NULL.
+  @retval EFI_INVALID_PARAMETER DriverName is NULL.
+  @retval EFI_UNSUPPORTED   The driver specified by This does not support
+the language specified by Language.
+
+**/
+EFI_STATUS
+EFIAPI
+UsbNcmComponentNameGetDriverName (
+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
+  IN  CHAR8*Language,
+  OUT CHAR16   **DriverName
+  )
+{
+  return LookupUnicodeString2 (
+   Language,
+   

回复: [edk2-devel] [PATCH v4 01/10] BaseTools: add BASETOOLS define

2023-04-20 Thread gaoliming via groups.io
Gerd, Ard, Marvin:
  I think we all agree that this patch set is valuable to reduce the 
duplication header files. 

  The current concern is that BASETOOLS macro name. This name matches Edk2 
BaseTools directory. If no better name, I would suggest to keep it. 

  And, the second request is to remove #pragma GCC visibility push (hidden) in 
MdePkg\Include\X64\ProcessorBind.h. It may be not resolved in short time. I 
don't want this request blocks this patch set. I suggest to separate them, then 
we can first merge this patch set if no other functional issue. 

Thanks
Liming
> -邮件原件-
> 发件人: Ard Biesheuvel 
> 发送时间: 2023年4月18日 23:50
> 收件人: Gerd Hoffmann 
> 抄送: devel@edk2.groups.io; Marvin Häuser ; Pawel
> Polawski ; Dongyan Qian
> ; Sunil V L ; Baoqi
> Zhang ; Chao Li ; Rebecca
> Cran ; Ard Biesheuvel ;
> Zhiguang Liu ; Liming Gao
> ; Yuwei Chen ; Leif
> Lindholm ; Michael D Kinney
> ; Daniel Schaefer ;
> Bob Feng ; Oliver Steffen 
> 主题: Re: [edk2-devel] [PATCH v4 01/10] BaseTools: add BASETOOLS define
> 
> On Tue, 18 Apr 2023 at 15:20, Gerd Hoffmann  wrote:
> >
> > On Tue, Apr 18, 2023 at 01:59:43PM +0200, Ard Biesheuvel wrote:
> > > On Tue, 18 Apr 2023 at 13:52, Gerd Hoffmann 
> wrote:
> > > >
> > > > Seems to work fine on fedora 37, even without adding --relax, maybe
> this
> > > > is enabled by default (there is a --no-relax switch after all).  I'll go
> > > > try older distros / compilers / binutils too.
> > > >
> > > > What would be the failure mode?  Errors on ELF -> PE conversion
> because
> > > > a GOT is present?  Or will things break at runtime?
> > > >
> > >
> > > The problem here is that we rely on --emit-relocs to get at the
> > > relocations in the binary, in order to convert the absolute ones into
> > > PE/COFF relocations.
> > >
> > > However, --emit-relocs did not use to cover the GOT, as those are
> > > added at the end by the linker and not by the compiler. So if the GOT
> > > is non-empty, the resulting PE executable will be corrupt.
> >
> > So no build error.  And at runtime probably random effects, depending on
> > whenever the execution path happens to hit a bad relocation or not.  So
> > compile + boot testing doesn't cut it.  Lovely.
> >
> > So, what can I do instead?  Check **/DEBUG/*.debug and see whenever a
> > .got section is present?
> >
> 
> We should probably add an ASSERT() to the linker script, just like I
> did for Linux:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id
> =e544ea57ac0734bc
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id
> =262b5cae67a67240
> 
> > > Of course, the answer here is to dump GenFw altogether for ELF to PE
> > > conversion, and implement something that consumes the dynamic
> > > relocations generated when linking in PIE mode.
> >
> > Marvin's ImageTool is exactly that I think ...
> >
> > take care,
> >   Gerd
> >




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




[edk2-devel] [edk2-redfish-client][PATCH] Initial edk2 redfish client repository

2023-04-20 Thread Nickle Wang via groups.io
Add required files to initial edk2 redfish client repository.

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Michael D Kinney 
---
 .gitignore  |  6 +
 CONTRIBUTING.md |  3 +++
 LICENSE | 51 ++
 Maintainers.txt | 48 +++
 README.md   | 66 +
 5 files changed, 174 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 CONTRIBUTING.md
 create mode 100644 LICENSE
 create mode 100644 Maintainers.txt
 create mode 100644 README.md

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000..df38443
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,6 @@
+.DS_Store
+*_extdep/
+*.pyc
+__pycache__/
+tags/
+.vscode/
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 000..39a1732
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,3 @@
+# Contributing to EDK Redfish Client
+
+Contributor documentation is maintained on the wiki: 
https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Development-Process
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 000..fd0e199
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,51 @@
+Copyright (c) 2021, TianoCore and contributors.  All rights reserved.
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+Subject to the terms and conditions of this license, each copyright holder
+and contributor hereby grants to those receiving rights under this license
+a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+(except for failure to satisfy the conditions of this license) patent
+license to make, have made, use, offer to sell, sell, import, and otherwise
+transfer this software, where such license applies only to those patent
+claims, already acquired or hereafter acquired, licensable by such copyright
+holder or contributor that are necessarily infringed by:
+
+(a) their Contribution(s) (the licensed copyrights of copyright holders and
+non-copyrightable additions of contributors, in source or binary form)
+alone; or
+
+(b) combination of their Contribution(s) with the work of authorship to
+which such Contribution(s) was added by such copyright holder or
+contributor, if, at the time the Contribution is added, such addition
+causes such combination to be necessarily infringed. The patent license
+shall not apply to any other combinations which include the
+Contribution.
+
+Except as expressly stated above, no rights or licenses from any copyright
+holder or contributor is granted under this license, whether expressly, by
+implication, estoppel or otherwise.
+
+DISCLAIMER
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
diff --git a/Maintainers.txt b/Maintainers.txt
new file mode 100644
index 000..88fd03a
--- /dev/null
+++ b/Maintainers.txt
@@ -0,0 +1,48 @@
+EDK Redfish Client Maintainers
+==
+
+This file provides information about the primary maintainers for
+EDK Redfish Client.
+
+In general, you should not privately email the maintainer. You should
+email the edk2-devel list, and Cc the package maintainers and
+reviewers.
+
+If the package maintainer wants to hand over the role to other people,
+the package maintainer should send the patch to update Maintainers.txt
+with new maintainer, and the new maintainer should follow up with
+an Acked-by or a Reviewed-by.
+
+Descriptions of section entries:
+
+  L: Mailing list that is relevant to this area (default is edk2-devel)
+ Patches and questions should be sent to the email list.
+  M: Package Maintainer: Cc address for patches and questions. Responsible
+ for reviewing and pushing package changes to source control.
+  R: Package Reviewer: Cc address for patches 

Re: [edk2-devel] [PATCH 1/1] MdeModulePkg/RegularExpressionDxe: Fix Arm build error

2023-04-20 Thread Nickle Wang via groups.io
Hi Liming,

I noticed the build error from this CI test: Build and Test 
NetworkPkg,RedfishPkg IA32,X64,ARM,AARCH64,RISCV64,LOONGARCH64. And after 
applying my patch, CI reports build pass. Since this CI test also cover 
AARCH64, RISCV64 and LOONGARCH64, I think that the failure only happens to 
MDE_CPU_ARM.

Thanks,
Nickle

From: devel@edk2.groups.io  On Behalf Of gaoliming via 
groups.io
Sent: Friday, April 21, 2023 10:52 AM
To: devel@edk2.groups.io; Nickle Wang ; 'Jian J Wang' 

Cc: 'Michael D Kinney' ; Nick Ramirez 

Subject: 回复: [edk2-devel] [PATCH 1/1] MdeModulePkg/RegularExpressionDxe: Fix 
Arm build error

External email: Use caution opening links or attachments

Nickle:
 Is this only for MDE_CPU_ARM? I may propose to add the judgement of 
MDE_CPU_IA32 and MDE_CPU_X64 for memcpy & memset. memcpy & memset are for X86 
only.

Thanks
Liming
发件人: devel@edk2.groups.io 
mailto:devel@edk2.groups.io>> 代表 Nickle Wang via groups.io
发送时间: 2023年4月21日 8:26
收件人: devel@edk2.groups.io; Nickle Wang 
mailto:nick...@nvidia.com>>; Jian J Wang 
mailto:jian.j.w...@intel.com>>; Liming Gao 
mailto:gaolim...@byosoft.com.cn>>
抄送: Michael D Kinney 
mailto:michael.d.kin...@intel.com>>; Nick Ramirez 
mailto:nrami...@nvidia.com>>
主题: Re: [edk2-devel] [PATCH 1/1] MdeModulePkg/RegularExpressionDxe: Fix Arm 
build error


Hi @Jian J Wang, @Liming 
Gao,



Could you please help me to review this patch? There is CI build error, and it 
blocks my pull request here: https://github.com/tianocore/edk2/pull/4285



Thanks,

Nickle



> -Original Message-

> From: devel@edk2.groups.io 
> mailto:devel@edk2.groups.io>> On Behalf Of Nickle

> Wang via groups.io

> Sent: Wednesday, April 19, 2023 4:30 PM

> To: devel@edk2.groups.io

> Cc: Jian J Wang mailto:jian.j.w...@intel.com>>; Liming 
> Gao

> mailto:gaolim...@byosoft.com.cn>>; Michael D Kinney 
> mailto:michael.d.kin...@intel.com>>;

> Nick Ramirez mailto:nrami...@nvidia.com>>

> Subject: [edk2-devel] [PATCH 1/1] MdeModulePkg/RegularExpressionDxe: Fix

> Arm build error

>

> External email: Use caution opening links or attachments

>

>

> Fix Arm CI build error:

> - ArmPkg/Library/CompilerIntrinsicsLib/memset.c:39:1: warning: type of

> ‘memset’ does not match original declaration [-Wlto-type-mismatch]

> MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c:123:1:

> note: type ‘char’ should match type ‘int’

> - multiple definition of `memcpy'; OnigurumaUefiPort.obj (symbol from

> plugin):(.text+0x0): first defined here

>

> There is intrinsics library for Arm so we don't need memset and memcpy

> function in OnigurumaUefiPort.c.

>

> Signed-off-by: Nickle Wang mailto:nick...@nvidia.com>>

> Cc: Jian J Wang mailto:jian.j.w...@intel.com>>

> Cc: Liming Gao mailto:gaolim...@byosoft.com.cn>>

> Cc: Michael D Kinney 
> mailto:michael.d.kin...@intel.com>>

> Cc: Nick Ramirez mailto:nrami...@nvidia.com>>

> ---

>  .../Universal/RegularExpressionDxe/OnigurumaUefiPort.h   | 5 -

>  .../Universal/RegularExpressionDxe/OnigurumaUefiPort.c   | 4 

>  2 files changed, 8 insertions(+), 1 deletion(-)

>

> diff --git

> a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h

> b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h

> index 248109b0c96e..8f8581df6783 100644

> --- a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h

> +++ b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h

> @@ -4,7 +4,7 @@

>

>(C) Copyright 2014-2021 Hewlett Packard Enterprise Development LP

>Copyright (c) 2020, Intel Corporation. All rights reserved.

> -  Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.

> +  Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights

> reserved.

>

>SPDX-License-Identifier: BSD-2-Clause-Patent  **/ @@ -107,6 +107,7 @@

> realloc (

>size_t  size

>);

>

> +#if !defined (MDE_CPU_ARM)

>  void *

>  memcpy (

>void  *dest,

> @@ -121,6 +122,8 @@ memset (

>unsigned int  count

>);

>

> +#endif

> +

>  void

>  free (

>void  *ptr

> diff --git

> a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c

> b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c

> index 6661c67f976e..8af57f3a93c7 100644

> --- a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c

> +++ b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c

> @@ -4,6 +4,7 @@

>

>(C) Copyright 2014-2021 Hewlett Packard Enterprise Development LP

>Copyright (c) 2020, Intel Corporation. All rights reserved.

> +  Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.

>

>SPDX-License-Identifier: BSD-2-Clause-Patent  **/ @@ -109,6 +110,7 @@

> realloc (

>return NULL;

>  }

>

> +#if 

回复: [edk2-devel] [PATCH 1/1] MdeModulePkg/RegularExpressionDxe: Fix Arm build error

2023-04-20 Thread gaoliming via groups.io
Nickle:

 Is this only for MDE_CPU_ARM? I may propose to add the judgement of 
MDE_CPU_IA32 and MDE_CPU_X64 for memcpy & memset. memcpy & memset are for X86 
only.

 

Thanks

Liming

发件人: devel@edk2.groups.io  代表 Nickle Wang via groups.io
发送时间: 2023年4月21日 8:26
收件人: devel@edk2.groups.io; Nickle Wang ; Jian J Wang 
; Liming Gao 
抄送: Michael D Kinney ; Nick Ramirez 

主题: Re: [edk2-devel] [PATCH 1/1] MdeModulePkg/RegularExpressionDxe: Fix Arm 
build error

 

Hi   @Jian J Wang,  
 @Liming Gao,

 

Could you please help me to review this patch? There is CI build error, and it 
blocks my pull request here: https://github.com/tianocore/edk2/pull/4285  

 

Thanks,

Nickle

 

> -Original Message-

> From: devel@edk2.groups.io   
> mailto:devel@edk2.groups.io> > On Behalf Of Nickle

> Wang via groups.io

> Sent: Wednesday, April 19, 2023 4:30 PM

> To: devel@edk2.groups.io  

> Cc: Jian J Wang mailto:jian.j.w...@intel.com> >; 
> Liming Gao

> mailto:gaolim...@byosoft.com.cn> >; Michael D 
> Kinney mailto:michael.d.kin...@intel.com> >;

> Nick Ramirez mailto:nrami...@nvidia.com> >

> Subject: [edk2-devel] [PATCH 1/1] MdeModulePkg/RegularExpressionDxe: Fix

> Arm build error

> 

> External email: Use caution opening links or attachments

> 

> 

> Fix Arm CI build error:

> - ArmPkg/Library/CompilerIntrinsicsLib/memset.c:39:1: warning: type of

> ‘memset’ does not match original declaration [-Wlto-type-mismatch]

> MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c:123:1:

> note: type ‘char’ should match type ‘int’

> - multiple definition of `memcpy'; OnigurumaUefiPort.obj (symbol from

> plugin):(.text+0x0): first defined here

> 

> There is intrinsics library for Arm so we don't need memset and memcpy

> function in OnigurumaUefiPort.c.

> 

> Signed-off-by: Nickle Wang <  nick...@nvidia.com>

> Cc: Jian J Wang <  jian.j.w...@intel.com>

> Cc: Liming Gao <  gaolim...@byosoft.com.cn>

> Cc: Michael D Kinney <  
> michael.d.kin...@intel.com>

> Cc: Nick Ramirez <  nrami...@nvidia.com>

> ---

>  .../Universal/RegularExpressionDxe/OnigurumaUefiPort.h   | 5 -

>  .../Universal/RegularExpressionDxe/OnigurumaUefiPort.c   | 4 

>  2 files changed, 8 insertions(+), 1 deletion(-)

> 

> diff --git

> a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h

> b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h

> index 248109b0c96e..8f8581df6783 100644

> --- a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h

> +++ b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h

> @@ -4,7 +4,7 @@

> 

>(C) Copyright 2014-2021 Hewlett Packard Enterprise Development LP

>Copyright (c) 2020, Intel Corporation. All rights reserved.

> -  Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.

> +  Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights

> reserved.

> 

>SPDX-License-Identifier: BSD-2-Clause-Patent  **/ @@ -107,6 +107,7 @@

> realloc (

>size_t  size

>);

> 

> +#if !defined (MDE_CPU_ARM)

>  void *

>  memcpy (

>void  *dest,

> @@ -121,6 +122,8 @@ memset (

>unsigned int  count

>);

> 

> +#endif

> +

>  void

>  free (

>void  *ptr

> diff --git

> a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c

> b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c

> index 6661c67f976e..8af57f3a93c7 100644

> --- a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c

> +++ b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c

> @@ -4,6 +4,7 @@

> 

>(C) Copyright 2014-2021 Hewlett Packard Enterprise Development LP

>Copyright (c) 2020, Intel Corporation. All rights reserved.

> +  Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.

> 

>SPDX-License-Identifier: BSD-2-Clause-Patent  **/ @@ -109,6 +110,7 @@

> realloc (

>return NULL;

>  }

> 

> +#if !defined (MDE_CPU_ARM)

>  void *

>  memcpy (

>void  *dest,

> @@ -129,6 +131,8 @@ memset (

>return SetMem (dest, count, ch);

>  }

> 

> +#endif

> +

>  void

>  free (

>void  *ptr

> --

> 2.17.1

> 

> 

> 

> 

> 

 





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




[edk2-devel] 回复: [PATCH v4 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-20 Thread gaoliming via groups.io
Rebecca:
  For the whole patch set, I give the comments for 09/13. Others are good to 
me. Reviewed-by: Liming Gao 

Thanks
Liming
> -邮件原件-
> 发件人: Rebecca Cran 
> 发送时间: 2023年4月20日 3:58
> 收件人: devel@edk2.groups.io; Liming Gao ;
> Bob Feng ; Yuwei Chen ;
> Michael D Kinney ; Michael Kubacki
> ; Sean Brogan
> ; Chasel Chiu ; Nate
> DeSimone ; Star Zeng
> ; Andrew Fish 
> 抄送: Rebecca Cran ; Ray Ni ; Leif
> Lindholm ; Zhiguang Liu
> ; Jian J Wang ; Xiaoyu Lu
> ; Guomin Jiang ; Gua Guo
> ; Ard Biesheuvel ; Pedro Falcato
> ; Gerd Hoffmann ; Marvin
> Häuser 
> 主题: [PATCH v4 00/13] BaseTools,CryptoPkg,EmulatorPkg,MdePkg,others:
> Delete CLANG35,CLANG38,VS2008-2013,EBC, deprecate GCC48,GCC49,GCC5,
> add GCC and GCCNOLTO, update CLANGDWARF
> 
> 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.
> 
> - Mark GCC48, GCC49 and GCC5 as deprecated.
> 
> - Add GCC and GCCNOLTO toolchain definitions.
> 
> - Remove VS2008, VS2010, VS2012 and VS2013.
> 
> - Remove EBC compiler definitions. Full removal of EBC support from the
>   various packages etc. will be done in a follow-up patch series.
> 
> - Remove unused IPHONE_TOOLS and SOURCERY_CYGWIN_TOOLS
> definitions.
> 
> - Remove unused CYGWIN_ definitions.
> 
> Personal GitHub PR: https://github.com/tianocore/edk2/pull/4240
> GitHub branch: https://github.com/bcran/edk2/tree/clangdwarf
> 
> Note: CI is now passing.
> 
> Changes from v1 to v2
> =
> 
> - Added a commit to delete GCC48 and GCC49, rename GCC5 to GCC and
>   update the flags for other toolchains to work with the new GCC
>   definitions.
> 
> - Bumped VERSION from 2.00 to 3.00 to inform users that they should
>   update their Conf/tools_def.txt.
> 
> Changes from v2 to v3
> =
> 
> - Keep GCC48, GCC49 and GCC5 but mark them deprecated, including with
>   warnings at the start and end of running a build.
> 
> - Dropped the commit fixing the IA32 build of UefiPayloadPkg, because it
>   causes CI to fail due to building both IA32 and X64 at the same time:
> 
>   "Module built under multiple ARCHs [IA32, X64]. Not able to determine
> which output to put into flash for Module..."
> 
> - Added more information to the VERSION section in tools_def.template.
> 
> - Various fixes to the CLANGDWARF flags.
> 
> Changes from v3 to v4
> =
> 
> - Use lld for -a ARM -t CLANGDWARF.
> 
> Rebecca Cran (13):
>   BaseTools,CryptoPkg: Update CLANGDWARF, remove CLANG 35/38
> toolchains
>   BaseTools: Remove VS2008, 2010, 2012 and 2013 toolchain definitions
>   BaseTools: Remove VS2008-VS2013 remnants
>   MdePkg: Remove VS2008-VS2013 remnants
>   edksetup.bat: Remove VS2008-VS2013 remnants
>   BaseTools: Remove unused IPHONE_TOOLS and
> SOURCERY_CYGWIN_TOOLS defs
>   BaseTools: Remove EBC (EFI Byte Code) compiler definitions
>   BaseTools: Update VS toolchain descriptions in tools_def.txt.template
>   BaseTools/Conf/tools_def.template: Add GCC and GCCNOLTO toolchains
>   BaseTools: Only call LoadConfiguration once in build.py
>   BaseTools: Add a deprecation warning for GCC48,GCC49,GCC5 to build.py
>   BaseTools/Conf/tools_def.template: Add section for deprecated
> toolchains
>   BaseTools/Conf/tools_def.template: Bump VERSION to 3.00
> 
>  UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc   |2
> ++
>  IntelFsp2Pkg/Tools/Tests/QemuFspPkg.dsc |9
> -
>  CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf |3
> +--
>  CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf  |3 +--
>  CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf  |3 +--
>  CryptoPkg/Library/BaseCryptLib/SecCryptLib.inf  |3 +--
>  CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf  |3
> +--
>  CryptoPkg/Library/BaseCryptLib/UnitTestHostBaseCryptLib.inf |3 +--
>  CryptoPkg/Library/OpensslLib/OpensslLib.inf |3
> +--
>  CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf|3 +--
>  CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf   |3 +--
>  CryptoPkg/Library/OpensslLib/OpensslLibFull.inf |3 +--
>  CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf|3 +--
>  EmulatorPkg/Unix/Host/Host.inf  |
> 2 ++
>  MdePkg/Include/Ia32/ProcessorBind.h |
> 8 ++--
>  MdePkg/Include/X64/ProcessorBind.h  |
> 8 ++--
>  BaseTools/Conf/tools_def.template   | 1993
> ++
> ++
> ++
> ++
> ++
> 

Re: [edk2-devel] [PATCH 0/4] Trace Hub debug library support

2023-04-20 Thread Guo, Gua
+ Related folk

I want to let the PR for related stakeholder review it.

And have any open ?
https://github.com/tianocore/edk2/pull/3901


Thanks,
Gua

-Original Message-
From: devel@edk2.groups.io  On Behalf Of 
victorx@intel.com
Sent: Tuesday, April 18, 2023 7:05 PM
To: devel@edk2.groups.io
Cc: Hsu, VictorX 
Subject: [edk2-devel] [PATCH 0/4] Trace Hub debug library support

From: VictorX Hsu 

-   TraceHub UniversalPayload Spec: 
https://github.com/UniversalScalableFirmware/documentation/pull/52  (Industry 
Standard)
-   MipiSysTLib Wrapper: 
https://github.com/MIPI-Alliance/public-mipi-sys-t.git (Industry Standard)
-   TraceHubDebugLib: Intel(R) Trace Hub (TH) — The Linux Kernel 
documentation (Industry Standard)
Developers Guide: 
https://cdrdv2-public.intel.com/671536/intel-trace-hub-developers-manual-2-1-2.pdf
 (Public Document)

VictorX Hsu (4):
  MdePkg: Add MipiSysTLib library
  MdeModulePkg: Add TraceHubDebugSysTLib library
  MdePkg: Add NULL library of TraceHubDebugSysTLib
  Maintainers.txt: Update reviewers and maintainers for Trace Hub dbg
lib.

 .gitmodules   |   5 +-
 .pytool/CISettings.py |   2 +
 Maintainers.txt   |  18 +
 .../Include/Guid/TraceHubDebugInfoHob.h   |  25 +
 .../BaseTraceHubDebugSysTLib.c| 251 ++
 .../BaseTraceHubDebugSysTLib.inf  |  44 +
 .../DxeSmmTraceHubDebugSysTLib.c  | 247 ++
 .../DxeSmmTraceHubDebugSysTLib.inf|  50 ++
 .../InternalTraceHubApi.c |  82 ++
 .../InternalTraceHubApi.h |  46 +
 .../InternalTraceHubApiCommon.c   | 208 +
 .../InternalTraceHubApiCommon.h   | 119 +++
 .../PeiTraceHubDebugSysTLib.c | 290 +++
 .../PeiTraceHubDebugSysTLib.inf   |  50 ++
 .../Library/TraceHubDebugSysTLib/Readme.md|  30 +
 MdeModulePkg/MdeModulePkg.dec |  21 +
 MdeModulePkg/MdeModulePkg.dsc |   3 +
 MdeModulePkg/MdeModulePkg.uni |  18 +
 MdePkg/Include/Library/MipiSysTLib.h  |  66 ++
 MdePkg/Include/Library/TraceHubDebugSysTLib.h |  81 ++
 MdePkg/Library/MipiSysTLib/GenMipiSystH.py| 132 +++
 MdePkg/Library/MipiSysTLib/MipiSysTLib.c  | 123 +++
 MdePkg/Library/MipiSysTLib/MipiSysTLib.inf|  55 ++
 MdePkg/Library/MipiSysTLib/Platform.c | 164 
 MdePkg/Library/MipiSysTLib/Platform.h | 138 +++
 MdePkg/Library/MipiSysTLib/Readme.md  |  25 +
 MdePkg/Library/MipiSysTLib/mipi_syst.h| 789 ++
 MdePkg/Library/MipiSysTLib/mipisyst   |   1 +
 .../TraceHubDebugSysTLibNull.c|  76 ++
 .../TraceHubDebugSysTLibNull.inf  |  29 +
 MdePkg/MdePkg.ci.yaml |  15 +-
 MdePkg/MdePkg.dec |   9 +
 MdePkg/MdePkg.dsc |   2 +
 ReadMe.rst|   1 +
 34 files changed, 3212 insertions(+), 3 deletions(-)  create mode 100644 
MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.inf
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.inf
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.h
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon.h
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/PeiTraceHubDebugSysTLib.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/PeiTraceHubDebugSysTLib.inf
 create mode 100644 MdeModulePkg/Library/TraceHubDebugSysTLib/Readme.md
 create mode 100644 MdePkg/Include/Library/MipiSysTLib.h
 create mode 100644 MdePkg/Include/Library/TraceHubDebugSysTLib.h
 create mode 100644 MdePkg/Library/MipiSysTLib/GenMipiSystH.py
 create mode 100644 MdePkg/Library/MipiSysTLib/MipiSysTLib.c
 create mode 100644 MdePkg/Library/MipiSysTLib/MipiSysTLib.inf
 create mode 100644 MdePkg/Library/MipiSysTLib/Platform.c
 create mode 100644 MdePkg/Library/MipiSysTLib/Platform.h
 create mode 100644 MdePkg/Library/MipiSysTLib/Readme.md
 create mode 100644 MdePkg/Library/MipiSysTLib/mipi_syst.h
 create mode 16 MdePkg/Library/MipiSysTLib/mipisyst
 create mode 100644 
MdePkg/Library/TraceHubDebugSysTLibNull/TraceHubDebugSysTLibNull.c
 create mode 100644 
MdePkg/Library/TraceHubDebugSysTLibNull/TraceHubDebugSysTLibNull.inf

--
2.40.0.windows.1








-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all 

Re: [edk2-devel] [PATCH v3 2/3] MdePkg: Support FDT library.

2023-04-20 Thread Chiu, Chasel

Hi Mike,

Thanks for bringing this good point!
We would like to document that all FDT structure data are in *big endian* 
format and remove those SwapBytes MACROs from FdtLib.h
It makes sense to handle this from library consumer side (consumer can define 
their own MACROs) because we cannot assume consumer usage always requires 
SwapBytes.

We will send V4 patch to update this.

Thanks,
Chasel



> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Michael D
> Kinney
> Sent: Thursday, April 20, 2023 9:44 AM
> To: Lin, Benny ; devel@edk2.groups.io; Leif Lindholm
> 
> Cc: Gao, Liming ; Liu, Zhiguang
> ; Pedro Falcato ; Kinney,
> Michael D 
> Subject: Re: [edk2-devel] [PATCH v3 2/3] MdePkg: Support FDT library.
> 
> Hi Leif,
> 
> What is your opinion on FDT being big endian.
> 
> Do we want the lib to help with that aspect, or leave it up to the consumer of
> the lib to
> convert as needed?  Seems like an area that could be very error prone if we 
> are
> not
> careful.
> 
> Mike
> 
> > -Original Message-
> > From: Lin, Benny 
> > Sent: Wednesday, April 19, 2023 9:25 PM
> > To: Kinney, Michael D ; devel@edk2.groups.io
> > Cc: Gao, Liming ; Liu, Zhiguang
> ; Pedro Falcato 
> > Subject: RE: [PATCH v3 2/3] MdePkg: Support FDT library.
> >
> >
> >
> > >-Original Message-
> > >From: Kinney, Michael D 
> > >Sent: Thursday, April 20, 2023 5:04 AM
> > >To: Lin, Benny ; devel@edk2.groups.io
> > >Cc: Gao, Liming ; Liu, Zhiguang
> ; Pedro Falcato ; Kinney,
> > Michael D 
> > >Subject: RE: [PATCH v3 2/3] MdePkg: Support FDT library.
> > >
> > >Responses below
> > >
> > >Mike
> > >
> > >> -Original Message-
> > >> From: Lin, Benny 
> > >> Sent: Wednesday, April 19, 2023 10:12 AM
> > >> To: Kinney, Michael D ;
> > >> devel@edk2.groups.io
> > >> Cc: Gao, Liming ; Liu, Zhiguang
> > >> ; Pedro Falcato 
> > >> Subject: RE: [PATCH v3 2/3] MdePkg: Support FDT library.
> > >>
> > >> Please find my feedback below.
> > >> We can remove FDT_RESERVE_ENTRY but keep FDT_NODE_HEADER, what
> do you think?
> > >>
> > >> QQQ
> > >> Benny
> > >>
> > >> >-Original Message-
> > >> >From: Kinney, Michael D 
> > >> >Sent: Wednesday, April 19, 2023 11:54 PM
> > >> >To: Lin, Benny ; devel@edk2.groups.io
> > >> >Cc: Gao, Liming ; Liu, Zhiguang
> > >> >; Pedro Falcato ;
> > >> >Kinney,
> > >> Michael D 
> > >> >Subject: RE: [PATCH v3 2/3] MdePkg: Support FDT library.
> > >> >
> > >> >A few comments below.
> > >> >
> > >> >Mike
> > >> >
> > >> >> -Original Message-
> > >> >> From: Lin, Benny 
> > >> >> Sent: Sunday, April 16, 2023 10:35 PM
> > >> >> To: devel@edk2.groups.io
> > >> >> Cc: Lin, Benny ; Kinney, Michael D
> > >> >> ; Gao, Liming
> > >> >> ; Liu, Zhiguang ;
> > >> >> Pedro Falcato 
> > >> >> Subject: [PATCH v3 2/3] MdePkg: Support FDT library.
> > >> >>
> > >> >> From: Benny Lin 
> > >> >>
> > >> >> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4392
> > >> >> Add FDT support in EDK2 by submodule 3rd party libfdt
> > >> >> (https://github.com/devicetree-org/pylibfdt/tree/main/libfdt)
> > >> >> and refer to LibcLib implementation by Pedro.
> > >> >>
> > >> >> Cc: Michael D Kinney 
> > >> >> Cc: Liming Gao 
> > >> >> Cc: Zhiguang Liu 
> > >> >> Acked-by: Pedro Falcato 
> > >> >> Signed-off-by: Benny Lin 
> > >> >> ---
> > >> >>  MdePkg/Include/Library/FdtLib.h   | 314 
> > >> >>  MdePkg/Library/BaseFdtLib/BaseFdtLib.inf  |  62 
> > >> >> MdePkg/Library/BaseFdtLib/BaseFdtLib.uni  |  14 +
> > >> >>  MdePkg/Library/BaseFdtLib/FdtLib.c| 301 +++
> > >> >>  MdePkg/Library/BaseFdtLib/LibFdtSupport.h |  99 ++
> > >> >> MdePkg/Library/BaseFdtLib/LibFdtWrapper.c | 173 +++
> > >> >>  MdePkg/Library/BaseFdtLib/limits.h|  10 +
> > >> >>  MdePkg/Library/BaseFdtLib/stdbool.h   |  10 +
> > >> >>  MdePkg/Library/BaseFdtLib/stddef.h|  10 +
> > >> >>  MdePkg/Library/BaseFdtLib/stdint.h|  10 +
> > >> >>  MdePkg/Library/BaseFdtLib/stdlib.h|  10 +
> > >> >>  MdePkg/Library/BaseFdtLib/string.h|  10 +
> > >> >>  MdePkg/MdePkg.ci.yaml |  17 +-
> > >> >>  MdePkg/MdePkg.dec |   4 +
> > >> >>  MdePkg/MdePkg.dsc |   1 +
> > >> >>  15 files changed, 1043 insertions(+), 2 deletions(-)
> > >> >>
> > >> >> diff --git a/MdePkg/Include/Library/FdtLib.h
> > >> >> b/MdePkg/Include/Library/FdtLib.h new file mode 100644 index
> > >> >> 00..d59b749c25
> > >> >> --- /dev/null
> > >> >> +++ b/MdePkg/Include/Library/FdtLib.h
> > >> >> @@ -0,0 +1,314 @@
> > >> >> +/** @file
> > >> >>
> > >> >> +  Flattened Device Tree Library.
> > >> >>
> > >> >> +
> > >> >>
> > >> >> +  Copyright (c) 2023, Intel Corporation. All rights reserved.
> > >> >>
> > >> >> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> > >> >>
> > >> >> +
> > >> >>
> > >> >> +**/
> > >> >>
> > >> >> +
> > >> >>
> > >> >> +#ifndef FDT_LIB_H_
> > >> >>
> > >> >> +#define 

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

2023-04-20 Thread gaoliming via groups.io
Rebecca:
  I add my comments below. 

> -邮件原件-
> 发件人: Rebecca Cran 
> 发送时间: 2023年4月20日 3:58
> 收件人: devel@edk2.groups.io; Liming Gao ;
> Bob Feng ; Yuwei Chen ;
> Michael D Kinney ; Michael Kubacki
> ; Sean Brogan
> ; Chasel Chiu ; Nate
> DeSimone ; Star Zeng
> ; Andrew Fish 
> 抄送: Rebecca Cran ; Ray Ni ; Leif
> Lindholm ; Zhiguang Liu
> ; Jian J Wang ; Xiaoyu Lu
> ; Guomin Jiang ; Gua Guo
> ; Ard Biesheuvel ; Pedro Falcato
> ; Gerd Hoffmann ; Marvin
> Häuser 
> 主题: [PATCH v4 09/13] BaseTools/Conf/tools_def.template: Add GCC and
> GCCNOLTO toolchains
> 
> Add a 'GCC' toolchain that's a copy of the existing GCC5 definition.
> Add a 'GCCNOLTO' toolchain that's a copy of the existing GCC48
> toolchain.
> 

GCCNOLTO is the replacement of GCC49, not GCC48. 

And, CryptoPkg\Library\OpensslLib\OpensslLib.inf has GCC:*_GCC5_*_CC_FLAGS. New 
GCC:*_GCC_*_CC_FLAGS is required to be added. 

Thanks
Liming
> Signed-off-by: Rebecca Cran 
> ---
>  UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc |   2 ++
>  IntelFsp2Pkg/Tools/Tests/QemuFspPkg.dsc   |   9
> -
>  EmulatorPkg/Unix/Host/Host.inf|   2 ++
>  BaseTools/Conf/tools_def.template | 366
> ++
> ++
> ++
> ++
> ++
> 
>  4 files changed, 378 insertions(+), 1 deletion(-)
> 
> diff --git a/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc
> b/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc
> index 7866c36e6693..b24ecdbf8661 100644
> --- a/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc
> +++ b/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc
> @@ -31,6 +31,8 @@ [BuildOptions]
>  !endif
>GCC:*_GCC5_*_CC_FLAGS = --coverage
>GCC:*_GCC5_*_DLINK_FLAGS = --coverage
> +  GCC:*_GCC_*_CC_FLAGS = --coverage
> +  GCC:*_GCC_*_DLINK_FLAGS = --coverage
>  [BuildOptions.common.EDKII.HOST_APPLICATION]
>#
># MSFT
> diff --git a/IntelFsp2Pkg/Tools/Tests/QemuFspPkg.dsc
> b/IntelFsp2Pkg/Tools/Tests/QemuFspPkg.dsc
> index 31558121185d..2db3854274c8 100644
> --- a/IntelFsp2Pkg/Tools/Tests/QemuFspPkg.dsc
> +++ b/IntelFsp2Pkg/Tools/Tests/QemuFspPkg.dsc
> @@ -461,10 +461,17 @@ [Components.IA32]
> 
> ##
> #
>  [BuildOptions]
>  # Append build options for EDK and EDKII drivers (= is Append, == is Replace)
> -  # Enable link-time optimization when building with GCC49
> +  # Enable link-time optimization when building with GCC49 or GCCNOLTO
>*_GCC49_IA32_CC_FLAGS = -flto
>*_GCC49_IA32_DLINK_FLAGS = -flto
> +  *_GCCNOLTO_IA32_CC_FLAGS = -flto
> +  *_GCCNOLTO_IA32_DLINK_FLAGS = -flto
>*_GCC5_IA32_CC_FLAGS = -fno-pic
>*_GCC5_IA32_DLINK_FLAGS = -no-pie
>*_GCC5_IA32_ASLCC_FLAGS = -fno-pic
>*_GCC5_IA32_ASLDLINK_FLAGS = -no-pie
> +  *_GCC_IA32_CC_FLAGS = -fno-pic
> +  *_GCC_IA32_DLINK_FLAGS = -no-pie
> +  *_GCC_IA32_ASLCC_FLAGS = -fno-pic
> +  *_GCC_IA32_ASLDLINK_FLAGS = -no-pie
> +
> diff --git a/EmulatorPkg/Unix/Host/Host.inf
> b/EmulatorPkg/Unix/Host/Host.inf
> index f5ebbed68344..90e8c36b6186 100644
> --- a/EmulatorPkg/Unix/Host/Host.inf
> +++ b/EmulatorPkg/Unix/Host/Host.inf
> @@ -123,7 +123,9 @@ [BuildOptions]
> GCC:*_*_X64_CC_FLAGS == -m64 -g -fshort-wchar -fno-strict-aliasing
> -Wall -malign-double -idirafter/usr/include -c -include
> $(DEST_DIR_DEBUG)/AutoGen.h
> -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
> GCC:*_GCC48_X64_CC_FLAGS = "-DEFIAPI=__attribute__((ms_abi))"
> GCC:*_GCC49_X64_CC_FLAGS = "-DEFIAPI=__attribute__((ms_abi))"
> +   GCC:*_GCCNOLTO_X64_CC_FLAGS =
> "-DEFIAPI=__attribute__((ms_abi))"
> GCC:*_GCC5_X64_CC_FLAGS = "-DEFIAPI=__attribute__((ms_abi))" -flto
> -DUSING_LTO -Os
> +   GCC:*_GCC_X64_CC_FLAGS = "-DEFIAPI=__attribute__((ms_abi))" -flto
> -DUSING_LTO -Os
> GCC:*_*_X64_PP_FLAGS == -m64 -E -x assembler-with-cpp -include
> $(DEST_DIR_DEBUG)/AutoGen.h
> GCC:*_*_X64_ASM_FLAGS == -m64 -c -x assembler -imacros
> $(DEST_DIR_DEBUG)/AutoGen.h
> 
> diff --git a/BaseTools/Conf/tools_def.template
> b/BaseTools/Conf/tools_def.template
> index 6fd03ee77ac6..36772b9fe34f 100755
> --- a/BaseTools/Conf/tools_def.template
> +++ b/BaseTools/Conf/tools_def.template
> @@ -77,8 +77,13 @@ DEFINE GCC48_X64_PREFIX=
> ENV(GCC48_BIN)
>  DEFINE GCC49_IA32_PREFIX   = ENV(GCC49_BIN)
>  DEFINE GCC49_X64_PREFIX= ENV(GCC49_BIN)
> 
> +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)
> 

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

2023-04-20 Thread Michael D Kinney
Merged

Mike


> -Original Message-
> From: Chang, Abner 
> Sent: Wednesday, April 19, 2023 8:25 PM
> To: Kinney, Michael D ; devel@edk2.groups.io
> Cc: Gao, Liming ; Liu, Zhiguang 
> ; Nickle Wang ; Igor
> Kulchytskyy ; Oram, Isaac W ; Attar, 
> AbdulLateef (Abdul Lateef)
> 
> Subject: RE: [edk2-devel] [PATCH] MdePkg/Include: Add DMTF PLDM Base 
> definitions
> 
> [AMD Official Use Only - General]
> 
> Hi Mike and liming,
> Here are two PRs for PLDM related C header files, which are all passed CI. 
> Please help to push it to master branch.
> 
> https://github.com/tianocore/edk2/pull/4287
> https://github.com/tianocore/edk2/pull/4288
> 
> Thanks
> Abner
> 
> > -Original Message-
> > From: Kinney, Michael D 
> > Sent: Wednesday, April 19, 2023 11:05 PM
> > To: devel@edk2.groups.io; Chang, Abner 
> > Cc: Gao, Liming ; Liu, Zhiguang
> > ; Nickle Wang ; Igor
> > Kulchytskyy ; Oram, Isaac W ;
> > Attar, AbdulLateef (Abdul Lateef) ; Kinney,
> > Michael D 
> > Subject: RE: [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.
> >
> >
> > Reviewed-by: Michael D Kinney 
> >
> > > -Original Message-
> > > From: devel@edk2.groups.io  On Behalf Of Chang,
> > > Abner via groups.io
> > > Sent: Tuesday, April 18, 2023 7:14 PM
> > > To: devel@edk2.groups.io; Kinney, Michael D
> > > 
> > > Cc: Gao, Liming ; Liu, Zhiguang
> > > ; Nickle Wang ; Igor
> > > Kulchytskyy ; Oram, Isaac W ;
> > > Attar, AbdulLateef (Abdul Lateef) 
> > > Subject: Re: [edk2-devel] [PATCH] MdePkg/Include: Add DMTF PLDM Base
> > > definitions
> > >
> > > [AMD Official Use Only - General]
> > >
> > > There are couple subordinate specifications base on PLDM base spec.
> > > There is possible someone introduces another PLDM C header file that
> > includes PLDM base definitions. So PLDM base definitions should be
> > separated.
> > >
> > > Abner
> > >
> > > > -Original Message-
> > > > From: devel@edk2.groups.io  On Behalf Of
> > > > Michael D Kinney via groups.io
> > > > Sent: Wednesday, April 19, 2023 1:50 AM
> > > > To: devel@edk2.groups.io; Chang, Abner 
> > > > Cc: Gao, Liming ; Liu, Zhiguang
> > > > ; Nickle Wang ; Igor
> > > > Kulchytskyy ; Oram, Isaac W
> > ;
> > > > Attar, AbdulLateef (Abdul Lateef) ;
> > > > Kinney, Michael D 
> > > > Subject: Re: [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.
> > > >
> > > >
> > > > I see PldmSmbiosTransfer.h includes this file.  Are there any other
> > > > files that will include this file?
> > > >
> > > > Could this content be folded into PldmSmbiosTransfer.h to reduce
> > > > total number of include files?
> > > >
> > > > Mike
> > > >
> > > > > -Original Message-
> > > > > From: devel@edk2.groups.io  On Behalf Of
> > > > > Chang, Abner via groups.io
> > > > > Sent: Saturday, April 1, 2023 6:52 PM
> > > > > To: devel@edk2.groups.io
> > > > > Cc: Kinney, Michael D ; Gao, Liming
> > > > > ; Liu, Zhiguang
> > > > > ; Nickle Wang ; Igor
> > > > > Kulchytskyy ; Oram, Isaac W
> > > > > ; Abdul Lateef Attar
> > > > > 
> > > > > Subject: [edk2-devel] [PATCH] MdePkg/Include: Add DMTF PLDM Base
> > > > > definitions
> > > > >
> > > > > 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
> > > > > +
> > > >
> > 

Re: [edk2-devel] [edk2-platforms][PATCH V2 02/14] ManageabilityPkg: Support Maximum Transfer Unit

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



> -Original Message-
> From: Tinh Nguyen 
> Sent: Thursday, April 20, 2023 2:08 PM
> To: devel@edk2.groups.io; Chang, Abner 
> Cc: Isaac Oram ; Attar, AbdulLateef (Abdul Lateef)
> ; Nickle Wang ; Igor
> Kulchytskyy 
> Subject: Re: [edk2-devel] [edk2-platforms][PATCH V2 02/14]
> ManageabilityPkg: Support Maximum Transfer Unit
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> Hi Abner,
> 
> I have some inline comments below
> 
> On 18/04/2023 14:15, Chang, Abner via groups.io wrote:
> > From: Abner Chang 
> >
> > Update GetTransportCapability to support Maximum Transfer Unit (MTU)
> > of transport interface.
> >
> > Signed-off-by: Abner Chang 
> > Cc: Isaac Oram 
> > Cc: Abdul Lateef Attar 
> > Cc: Nickle Wang 
> > Cc: Igor Kulchytskyy 
> > ---
> >   .../Library/ManageabilityTransportLib.h   | 33 ---
> >   .../Common/ManageabilityTransportKcs.h|  2 +
> >   .../IpmiProtocol/Pei/IpmiPpiInternal.h|  8 ++-
> >   .../BaseManageabilityTransportNull.c  | 18 --
> >   .../Dxe/ManageabilityTransportKcs.c   | 57 +++
> >   .../Universal/IpmiProtocol/Dxe/IpmiProtocol.c | 24 ++--
> >   .../Universal/IpmiProtocol/Pei/IpmiPpi.c  | 51 ++---
> >   .../Universal/IpmiProtocol/Smm/IpmiProtocol.c | 24 ++--
> >   8 files changed, 145 insertions(+), 72 deletions(-)
> >
> > diff --git
> > a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.
> > h
> > b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.
> > h
> > index c022b4ac5c..d86d0d87d5 100644
> > ---
> > a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.
> > h
> > +++ b/Features/ManageabilityPkg/Include/Library/ManageabilityTransport
> > +++ Lib.h
> > @@ -14,6 +14,9 @@
> >   #define MANAGEABILITY_TRANSPORT_TOKEN_VERSION
> ((MANAGEABILITY_TRANSPORT_TOKEN_VERSION_MAJOR << 8) |\
> >
> > MANAGEABILITY_TRANSPORT_TOKEN_VERSION_MINOR)
> >
> > +#define
> MANAGEABILITY_TRANSPORT_PAYLOAD_SIZE_FROM_CAPABILITY(a)  (1 <<
> ((a &
> MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_MASK)
> >>\
> > +
> >
> +MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_BIT_PO
> SITION))
> > +
> >   typedef struct  _MANAGEABILITY_TRANSPORT_FUNCTION_V1_0
> MANAGEABILITY_TRANSPORT_FUNCTION_V1_0;
> >   typedef struct  _MANAGEABILITY_TRANSPORT
> MANAGEABILITY_TRANSPORT;
> >   typedef struct  _MANAGEABILITY_TRANSPORT_TOKEN
> MANAGEABILITY_TRANSPORT_TOKEN;
> > @@ -68,8 +71,17 @@ typedef UINT32
> MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS;
> >   /// Additional transport interface features.
> >   ///
> >   typedef UINT32 MANAGEABILITY_TRANSPORT_CAPABILITY;
> > +/// Bit 0
> >   #define
> MANAGEABILITY_TRANSPORT_CAPABILITY_MULTIPLE_TRANSFER_TOKENS
> 0x0001
> > -#define
> MANAGEABILITY_TRANSPORT_CAPABILITY_ASYNCHRONOUS_TRANSFER
> 0x0002
> > +/// Bit 1
> > +#define
> MANAGEABILITY_TRANSPORT_CAPABILITY_ASYNCHRONOUS_TRANSFER
> 0x0002
> > +/// Bit 2   - Reserved
> > +/// Bit 7:3 - Transport interface maximum payload size, which is (2 ^ 
> > bit[7:3]
> - 1)
> > +///   bit[7:3] means no maximum payload.
> 
> I am confused with your definition here.
> 
> Why does it have to be a power of 2?
Usually the maximum/minimum is in  power of 2 and use power of 2 has less bits 
occupied from MANAGEABILITY_TRANSPORT_CAPABILITY.

> 
> And we should separate request payload size and response payload size
> 
> Can you clarify more about that?
Do we really need the maximum size for response? Response is initiated by 
target endpoint and suppose the payload header should have some fields that 
indicate the return payload is only part of response. The size of payload 
returned is actually maximum transfer size that target endpoint can handle.
Do you know any case that receiver has no idea about if the payload sent back 
from target endpoint is a partial of response or not?  We should have MTU 
response if it is required for the transport interface.

> 
> Another question, only PEI_IPMI_PPI_INTERNAL contains MaxPayloadSize,
PPI has MaxPayloadSize in structure is because we can't define a global 
variable for PEI module as module is executed in place.

> how do IPMI/MCTP/PLDM protocol provide Maxpayloadsize
For DXE drivers, the Maxpayloadsize is defined as global variable.

> 
> to caller?
> 
> > +#define
> MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_MASK
> 0x00f8
> > +#define
> MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_BIT_POS
> ITION   3
> > +#define
> >
> +MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_NOT_A
> VAILABLE
> > +0x00 /// Bit 8:31 - Reserved
> >
> >   ///
> >   /// Definitions of Manageability transport interface functions.
> > @@ -187,15 +199,20 @@ AcquireTransportSession (
> > );
> >
> >   /**
> > -  This function returns the transport capabilities.
> > -
> > -  @param [out]  TransportFeature

Re: [edk2-devel] [Patch V2 0/8] Use CpuPageTableLib to create and update smm page table

2023-04-20 Thread duntan
Thanks a lot! I'll update my patch set later.

Thanks,
Dun

-Original Message-
From: Tom Lendacky  
Sent: Thursday, April 20, 2023 11:45 PM
To: devel@edk2.groups.io; Tan, Dun ; Ni, Ray 

Subject: Re: [edk2-devel] [Patch V2 0/8] Use CpuPageTableLib to create and 
update smm page table

On 4/20/23 04:07, duntan via groups.io wrote:
> Hi Tom,
> 
> Thanks for confirming. Is 1G page table supported in your test? If supported, 
> there is a reason can explain why this difference exists.
> In current upstream master branch:
> Smm code always create 2M page table for [0, 4G] range(in Gen4GPageTable ) to 
> reuse code. In QemuFlashBeforeProbe() of 
> OvmfPkg\QemuFlashFvbServicesRuntimeDxe\QemuFlashSmm.c, the range to clear 
> EncMask is 2M aligned. No page split happens and smm page table memory is all 
> RW before ReadyToLock. But in my opinion, the PF also may happen if the range 
> is not 2M aligned.
> 
> In my code branch:
> If 1G page table is supported, 1G page table is created to map [0, 4G]. Then 
> page split (1G-->2M) happens in QemuFlashBeforeProbe() and the new memory for 
> page table is marked as RO before ReadyToLock. That's why the PF happens in 
> InitPaging().
> 
> To solve this issue, I think the assumption that smm page table is always RW 
> before ReadyToLock should be dropped. I have added 2 new patches to clear WP 
> before modifying smm page table. Could you please help test again?
> https://github.com/td36/edk2/tree/SmmPageTable_V2

Hi Dun,

Yes, this branch successfully boots an SEV guest with SMM enabled.

Thanks!

Tom

> 
> Thanks,
> Dun
> 
> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of 
> Lendacky, Thomas via groups.io
> Sent: Wednesday, April 19, 2023 9:19 PM
> To: devel@edk2.groups.io; Tan, Dun ; Ni, Ray 
> 
> Subject: Re: [edk2-devel] [Patch V2 0/8] Use CpuPageTableLib to create 
> and update smm page table
> 
> On 4/19/23 00:39, duntan via groups.io wrote:
>> Hi Tom,
>>
>> This PF happened because that  CR0.WP is set and DxeMemEncryptSevLib sets a 
>> part of smm page table as RO before ReadyToLock while CpuSmm driver assumes 
>> the smm page table is not marked as RO before ReadyToLock.
>> The code flow to set smm page table to RO is 
>> QemuFlashBeforeProbe()-->MemEncryptSevClearMmioPageEncMask()-->SetMemoryEncDec()-->EnablePageTableProtection().
>>  New page table memory allocated by DxeMemEncryptSevLib is marked as RO in 
>> EnablePageTableProtection(). However, In PiSmmCpuDxeSmm InitPaging() 
>> function, the RO page table marked by  DxeMemEncryptSevLib may be modified 
>> again and InitPaging() function doesn't clear CR0.WP in advance since it has 
>> the assumption that smm page table memory is always RW before 
>> SetPageTableAttributes(), which causes this PF.
>> So Could you please help test the SEV enabled smm code without my patch set? 
>> I think this issue may also happen in current edk2 code.
> 
> Upstream master branch boots without issue.
> 
> SmmInstallProtocolInterface: 47B7FA8C-F4BD-4AF6-8200-333086F0D2C8 0 
> GetUefiMemoryMap Patch page table start ...
> Patch page table done!
> MemoryAttributesTable:
> Version   - 0x0001
> NumberOfEntries   - 0x0035
> DescriptorSize- 0x0030
> Entry (0x3FF01028)
> ...
> 
> 
> Thanks,
> Tom
> 
>>
>> Thanks,
>> Dun
>> -Original Message-
>> From: devel@edk2.groups.io  On Behalf Of 
>> Lendacky, Thomas via groups.io
>> Sent: Wednesday, April 19, 2023 5:06 AM
>> To: Tan, Dun ; devel@edk2.groups.io; Ni, Ray 
>> 
>> Subject: Re: [edk2-devel] [Patch V2 0/8] Use CpuPageTableLib to 
>> create and update smm page table
>>
>> On 4/18/23 04:57, Tan, Dun wrote:
>>> Hi Tom,
>>>
>>> I added a new patch in my code branch. This new patch removes the code that 
>>> may apply AddressEncMask to smm page table non-leaf entries when splitting 
>>> page table.
>>> Could you please help test if this code branch works?
>>> https://github.com/td36/edk2/tree/SmmPageTable_V2
>>
>> It got further, but it still crashed:
>>
>> SmmInstallProtocolInterface: 47B7FA8C-F4BD-4AF6-8200-333086F0D2C8 0 
>> GetUefiMemoryMap Patch page table start ...
>>  X64 Exception Type - 0E(#PF - Page-Fault)  CPU Apic ID -  
>> ExceptionData - 0003  I:0 R:0 U:0 W:1 P:1 PK:0 SS:0 SGX:0 RIP  - 
>> 3FFC7744, CS  - 0038, RFLAGS - 00010082 RAX  - 
>> FF83, RCX - 3FFB5C78, RDX -  RBX  - 
>> 3FC01000, RSP - 3FFB4790, RBP - 3FFB47B0 RSI  - 
>> 3FC01000, RDI - 
>> R8   - 3FFB4840, R9  - 0002, R10 - 
>> R11  - , R12 - 3FFB5C78, R13 -
>> 3FFB4840
>> R14  - 8000, R15 - 
>> DS   - 0020, ES  - 0020, FS  - 0020
>> GS   - 0020, SS  - 0020
>> CR0  - 80010033, CR2 - 3FC01000, CR3 -
>> 

Re: [edk2-devel] [PATCH 1/1] MdeModulePkg/RegularExpressionDxe: Fix Arm build error

2023-04-20 Thread Nickle Wang via groups.io
Hi @Jian J Wang, @Liming 
Gao,



Could you please help me to review this patch? There is CI build error, and it 
blocks my pull request here: https://github.com/tianocore/edk2/pull/4285



Thanks,

Nickle



> -Original Message-

> From: devel@edk2.groups.io  On Behalf Of Nickle

> Wang via groups.io

> Sent: Wednesday, April 19, 2023 4:30 PM

> To: devel@edk2.groups.io

> Cc: Jian J Wang ; Liming Gao

> ; Michael D Kinney ;

> Nick Ramirez 

> Subject: [edk2-devel] [PATCH 1/1] MdeModulePkg/RegularExpressionDxe: Fix

> Arm build error

>

> External email: Use caution opening links or attachments

>

>

> Fix Arm CI build error:

> - ArmPkg/Library/CompilerIntrinsicsLib/memset.c:39:1: warning: type of

> ‘memset’ does not match original declaration [-Wlto-type-mismatch]

> MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c:123:1:

> note: type ‘char’ should match type ‘int’

> - multiple definition of `memcpy'; OnigurumaUefiPort.obj (symbol from

> plugin):(.text+0x0): first defined here

>

> There is intrinsics library for Arm so we don't need memset and memcpy

> function in OnigurumaUefiPort.c.

>

> Signed-off-by: Nickle Wang mailto:nick...@nvidia.com>>

> Cc: Jian J Wang mailto:jian.j.w...@intel.com>>

> Cc: Liming Gao mailto:gaolim...@byosoft.com.cn>>

> Cc: Michael D Kinney 
> mailto:michael.d.kin...@intel.com>>

> Cc: Nick Ramirez mailto:nrami...@nvidia.com>>

> ---

>  .../Universal/RegularExpressionDxe/OnigurumaUefiPort.h   | 5 -

>  .../Universal/RegularExpressionDxe/OnigurumaUefiPort.c   | 4 

>  2 files changed, 8 insertions(+), 1 deletion(-)

>

> diff --git

> a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h

> b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h

> index 248109b0c96e..8f8581df6783 100644

> --- a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h

> +++ b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h

> @@ -4,7 +4,7 @@

>

>(C) Copyright 2014-2021 Hewlett Packard Enterprise Development LP

>Copyright (c) 2020, Intel Corporation. All rights reserved.

> -  Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.

> +  Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights

> reserved.

>

>SPDX-License-Identifier: BSD-2-Clause-Patent  **/ @@ -107,6 +107,7 @@

> realloc (

>size_t  size

>);

>

> +#if !defined (MDE_CPU_ARM)

>  void *

>  memcpy (

>void  *dest,

> @@ -121,6 +122,8 @@ memset (

>unsigned int  count

>);

>

> +#endif

> +

>  void

>  free (

>void  *ptr

> diff --git

> a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c

> b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c

> index 6661c67f976e..8af57f3a93c7 100644

> --- a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c

> +++ b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c

> @@ -4,6 +4,7 @@

>

>(C) Copyright 2014-2021 Hewlett Packard Enterprise Development LP

>Copyright (c) 2020, Intel Corporation. All rights reserved.

> +  Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.

>

>SPDX-License-Identifier: BSD-2-Clause-Patent  **/ @@ -109,6 +110,7 @@

> realloc (

>return NULL;

>  }

>

> +#if !defined (MDE_CPU_ARM)

>  void *

>  memcpy (

>void  *dest,

> @@ -129,6 +131,8 @@ memset (

>return SetMem (dest, count, ch);

>  }

>

> +#endif

> +

>  void

>  free (

>void  *ptr

> --

> 2.17.1

>

>

>

> 

>




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




Re: [edk2-devel] [PATCH] RedfishPkg: Remove the global variables related to Discover Token functionality

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

Thanks Igor,
You probably can ask community if any one has the similar issue on patch email 
format.

I already gave R-B to this change, please create a PR against to edk2 and let 
me know the PR#. I will push it once it passes CI.
Thanks
Abner

> -Original Message-
> From: Igor Kulchytskyy 
> Sent: Friday, April 21, 2023 2:46 AM
> To: Chang, Abner ; devel@edk2.groups.io
> Cc: Nickle Wang 
> Subject: RE: [EXTERNAL] RE: [PATCH] RedfishPkg: Remove the global
> variables related to Discover Token functionality
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> Hi Abner,
> I did what you asked to do - Patchcheck.py and UncrustiyCheck (got binary).
> Going to send PATCH V2.
> But I'm not sure what happened with white space. Going to check with MIS.
> Thank you,
> Igor
> 
> -Original Message-
> From: Chang, Abner 
> Sent: Wednesday, April 19, 2023 9:00 PM
> To: Igor Kulchytskyy ; devel@edk2.groups.io
> Cc: Nickle Wang 
> Subject: [EXTERNAL] RE: [PATCH] RedfishPkg: Remove the global variables
> related to Discover Token functionality
> 
> 
> **CAUTION: The e-mail below is from an external source. Please exercise
> caution before opening attachments, clicking links, or following guidance.**
> 
> [AMD Official Use Only - General]
> 
> Hi Igor,
> I have no problem with this change, however some upstream practices here,
> 
> - Please shorten the subject to <= 76
> - Each line in the commit message should be <=76 You can run Patchcheck.py
> (here: BaseTools\Scripts) before you sending out the patches.
> 
> Please run UncrustiyCheck for each source code you modified, .
> pytool/Plugin/UncrustifyCheck/ and used for beautifying the source code.
> You can get the binary from here:
> https://sourceforge.net/projects/uncrustify/files.
> 
> Please resend the patch with above issue fixed.
> 
> BTW, the patch you sent to group.io still has a problem. The white space of
> each blank line in the patch file were gone (you can take a look at your
> message sent to group.io). This leads to a failure of patch apply. I recover
> those white space in the blank lines and the patch can be applied. However, I
> can do this just for a short patch.  Please figure it out at your end.  
> That's
> fine if this problem still exist on your resent patch in case you need some
> time to figure out the email problem.
> 
> Thanks
> Abner
> 
> > -Original Message-
> > From: Igor Kulchytskyy 
> > Sent: Wednesday, April 19, 2023 11:04 PM
> > To: devel@edk2.groups.io
> > Cc: Chang, Abner ; Nickle Wang
> > 
> > Subject: [PATCH] RedfishPkg: Remove the global variables related to
> > Discover Token functionality
> >
> > Caution: This message originated from an External Source. Use proper
> > caution when opening attachments, clicking links, or responding.
> >
> >
> > gRedfishDiscoveredToken may be allocated several times, if multiple
> > NIC installed on the system.
> > To avoid this issue Discover Token related global variables replaced
> > with the local variables.
> >
> > Cc: Abner Chang 
> > Cc: Nickle Wang 
> > Signed-off-by: Igor Kulchytskyy 
> > ---
> >  RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c | 139
> > 
> >  RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c   |  87
> -
> > ---
> >  RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h  |  28 +++-
> >  3 files changed, 140 insertions(+), 114 deletions(-)
> >
> > diff --git
> > a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
> > b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
> > index 993ad33..8f85491 100644
> > --- a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
> > +++ b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
> > @@ -22,12 +22,6 @@ EFI_HANDLE
> > gEfiRedfishDiscoverControllerHandle = NULL;
> >  EFI_REDFISH_DISCOVER_PROTOCOL  *gEfiRedfishDiscoverProtocol=
> > NULL;
> >  BOOLEANgRedfishDiscoverActivated   = FALSE;
> >  BOOLEANgRedfishServiceDiscovered   = FALSE;
> > -//
> > -// Network interfaces discovered by EFI Redfish Discover Protocol.
> > -//
> > -UINTN   gNumberOfNetworkInterfaces;
> > -EFI_REDFISH_DISCOVER_NETWORK_INTERFACE
> > *gNetworkInterfaceInstances = NULL;
> > -EFI_REDFISH_DISCOVERED_TOKEN*gRedfishDiscoveredToken=
> > NULL;
> >
> >  ///
> >  /// Driver Binding Protocol instance
> > @@ -58,13 +52,6 @@ RedfishConfigStopRedfishDiscovery (
> >gBS->CloseEvent (gEfiRedfishDiscoverProtocolEvent);
> >  }
> >
> > -//
> > -// Stop Redfish service discovery.
> > -//
> > -gEfiRedfishDiscoverProtocol->AbortAcquireRedfishService (
> > -   gEfiRedfishDiscoverProtocol,
> > -   gNetworkInterfaceInstances
> > 

Re: [edk2-devel] [PATCH V2] RedfishPkg: Remove the Discover Token global variables

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

Reviewed-by: Abner Chang 

> -Original Message-
> From: Igor Kulchytskyy 
> Sent: Friday, April 21, 2023 6:48 AM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Nickle Wang
> 
> Subject: [PATCH V2] RedfishPkg: Remove the Discover Token global variables
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> gRedfishDiscoveredToken may be allocated several times, if multiple NIC
> installed on the system.
> To avoid this issue Discover Token related global variables replaced with the
> local variables.
> 
> Cc: Abner Chang 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> Signed-off-by: Igor Kulchytskyy 
> ---
>  RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c | 143
> 
>  RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c   |  88 -
> ---
>  RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h  |  28 +++-
>  3 files changed, 140 insertions(+), 119 deletions(-)
> 
> diff --git a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
> b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
> index 993ad338b6..161731b211 100644
> --- a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
> +++ b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
> @@ -22,12 +22,6 @@ EFI_HANDLE
> gEfiRedfishDiscoverControllerHandle = NULL;
>  EFI_REDFISH_DISCOVER_PROTOCOL  *gEfiRedfishDiscoverProtocol=
> NULL;
>  BOOLEANgRedfishDiscoverActivated   = FALSE;
>  BOOLEANgRedfishServiceDiscovered   = FALSE;
> -//
> -// Network interfaces discovered by EFI Redfish Discover Protocol.
> -//
> -UINTN   gNumberOfNetworkInterfaces;
> -EFI_REDFISH_DISCOVER_NETWORK_INTERFACE
> *gNetworkInterfaceInstances = NULL;
> -EFI_REDFISH_DISCOVERED_TOKEN*gRedfishDiscoveredToken=
> NULL;
> 
>  ///
>  /// Driver Binding Protocol instance
> @@ -58,13 +52,6 @@ RedfishConfigStopRedfishDiscovery (
>gBS->CloseEvent (gEfiRedfishDiscoverProtocolEvent);
>  }
> 
> -//
> -// Stop Redfish service discovery.
> -//
> -gEfiRedfishDiscoverProtocol->AbortAcquireRedfishService (
> -   gEfiRedfishDiscoverProtocol,
> -   gNetworkInterfaceInstances
> -   );
>  gEfiRedfishDiscoverControllerHandle = NULL;
>  gEfiRedfishDiscoverProtocol = NULL;
>  gRedfishDiscoverActivated   = FALSE;
> @@ -318,36 +305,38 @@ RedfishServiceDiscoveredCallback (
>EFI_REDFISH_DISCOVERED_TOKEN *RedfishDiscoveredToken;
>EFI_REDFISH_DISCOVERED_INSTANCE  *RedfishInstance;
> 
> -  if (gRedfishServiceDiscovered) {
> -//
> -// Only support one Redfish service on platform.
> -//
> -return;
> -  }
> -
>RedfishDiscoveredToken = (EFI_REDFISH_DISCOVERED_TOKEN *)Context;
> -  RedfishInstance= RedfishDiscoveredToken-
> >DiscoverList.RedfishInstances;
> +  gBS->CloseEvent (RedfishDiscoveredToken->Event);
> +
>//
> -  // Only pick up the first found Redfish service.
> +  // Only support one Redfish service on platform.
>//
> -  if (RedfishInstance->Status == EFI_SUCCESS) {
> -gRedfishConfigData.RedfishServiceInfo.RedfishServiceRestExHandle =
> RedfishInstance->Information.RedfishRestExHandle;
> -gRedfishConfigData.RedfishServiceInfo.RedfishServiceVersion  =
> RedfishInstance->Information.RedfishVersion;
> -gRedfishConfigData.RedfishServiceInfo.RedfishServiceLocation =
> RedfishInstance->Information.Location;
> -gRedfishConfigData.RedfishServiceInfo.RedfishServiceUuid =
> RedfishInstance->Information.Uuid;
> -gRedfishConfigData.RedfishServiceInfo.RedfishServiceOs   =
> RedfishInstance->Information.Os;
> -gRedfishConfigData.RedfishServiceInfo.RedfishServiceOsVersion=
> RedfishInstance->Information.OsVersion;
> -gRedfishConfigData.RedfishServiceInfo.RedfishServiceProduct  =
> RedfishInstance->Information.Product;
> -gRedfishConfigData.RedfishServiceInfo.RedfishServiceProductVer   =
> RedfishInstance->Information.ProductVer;
> -gRedfishConfigData.RedfishServiceInfo.RedfishServiceUseHttps =
> RedfishInstance->Information.UseHttps;
> -gRedfishServiceDiscovered= TRUE;
> +  if (!gRedfishServiceDiscovered) {
> +RedfishInstance = RedfishDiscoveredToken-
> >DiscoverList.RedfishInstances;
> +//
> +// Only pick up the first found Redfish service.
> +//
> +if (RedfishInstance->Status == EFI_SUCCESS) {
> +  gRedfishConfigData.RedfishServiceInfo.RedfishServiceRestExHandle =
> RedfishInstance->Information.RedfishRestExHandle;
> +  gRedfishConfigData.RedfishServiceInfo.RedfishServiceVersion  =
> RedfishInstance->Information.RedfishVersion;
> +  

[edk2-devel] [PATCH V2] RedfishPkg: Remove the Discover Token global variables

2023-04-20 Thread Igor Kulchytskyy via groups.io
gRedfishDiscoveredToken may be allocated several times,
if multiple NIC installed on the system.
To avoid this issue Discover Token related global variables
replaced with the local variables.

Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Igor Kulchytskyy 
---
 RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c | 143 

 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c   |  88 
 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h  |  28 +++-
 3 files changed, 140 insertions(+), 119 deletions(-)

diff --git a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c 
b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
index 993ad338b6..161731b211 100644
--- a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
+++ b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
@@ -22,12 +22,6 @@ EFI_HANDLE 
gEfiRedfishDiscoverControllerHandle = NULL;
 EFI_REDFISH_DISCOVER_PROTOCOL  *gEfiRedfishDiscoverProtocol= NULL;
 BOOLEANgRedfishDiscoverActivated   = FALSE;
 BOOLEANgRedfishServiceDiscovered   = FALSE;
-//
-// Network interfaces discovered by EFI Redfish Discover Protocol.
-//
-UINTN   gNumberOfNetworkInterfaces;
-EFI_REDFISH_DISCOVER_NETWORK_INTERFACE  *gNetworkInterfaceInstances = NULL;
-EFI_REDFISH_DISCOVERED_TOKEN*gRedfishDiscoveredToken= NULL;

 ///
 /// Driver Binding Protocol instance
@@ -58,13 +52,6 @@ RedfishConfigStopRedfishDiscovery (
   gBS->CloseEvent (gEfiRedfishDiscoverProtocolEvent);
 }

-//
-// Stop Redfish service discovery.
-//
-gEfiRedfishDiscoverProtocol->AbortAcquireRedfishService (
-   gEfiRedfishDiscoverProtocol,
-   gNetworkInterfaceInstances
-   );
 gEfiRedfishDiscoverControllerHandle = NULL;
 gEfiRedfishDiscoverProtocol = NULL;
 gRedfishDiscoverActivated   = FALSE;
@@ -318,36 +305,38 @@ RedfishServiceDiscoveredCallback (
   EFI_REDFISH_DISCOVERED_TOKEN *RedfishDiscoveredToken;
   EFI_REDFISH_DISCOVERED_INSTANCE  *RedfishInstance;

-  if (gRedfishServiceDiscovered) {
-//
-// Only support one Redfish service on platform.
-//
-return;
-  }
-
   RedfishDiscoveredToken = (EFI_REDFISH_DISCOVERED_TOKEN *)Context;
-  RedfishInstance= 
RedfishDiscoveredToken->DiscoverList.RedfishInstances;
+  gBS->CloseEvent (RedfishDiscoveredToken->Event);
+
   //
-  // Only pick up the first found Redfish service.
+  // Only support one Redfish service on platform.
   //
-  if (RedfishInstance->Status == EFI_SUCCESS) {
-gRedfishConfigData.RedfishServiceInfo.RedfishServiceRestExHandle = 
RedfishInstance->Information.RedfishRestExHandle;
-gRedfishConfigData.RedfishServiceInfo.RedfishServiceVersion  = 
RedfishInstance->Information.RedfishVersion;
-gRedfishConfigData.RedfishServiceInfo.RedfishServiceLocation = 
RedfishInstance->Information.Location;
-gRedfishConfigData.RedfishServiceInfo.RedfishServiceUuid = 
RedfishInstance->Information.Uuid;
-gRedfishConfigData.RedfishServiceInfo.RedfishServiceOs   = 
RedfishInstance->Information.Os;
-gRedfishConfigData.RedfishServiceInfo.RedfishServiceOsVersion= 
RedfishInstance->Information.OsVersion;
-gRedfishConfigData.RedfishServiceInfo.RedfishServiceProduct  = 
RedfishInstance->Information.Product;
-gRedfishConfigData.RedfishServiceInfo.RedfishServiceProductVer   = 
RedfishInstance->Information.ProductVer;
-gRedfishConfigData.RedfishServiceInfo.RedfishServiceUseHttps = 
RedfishInstance->Information.UseHttps;
-gRedfishServiceDiscovered= TRUE;
+  if (!gRedfishServiceDiscovered) {
+RedfishInstance = RedfishDiscoveredToken->DiscoverList.RedfishInstances;
+//
+// Only pick up the first found Redfish service.
+//
+if (RedfishInstance->Status == EFI_SUCCESS) {
+  gRedfishConfigData.RedfishServiceInfo.RedfishServiceRestExHandle = 
RedfishInstance->Information.RedfishRestExHandle;
+  gRedfishConfigData.RedfishServiceInfo.RedfishServiceVersion  = 
RedfishInstance->Information.RedfishVersion;
+  gRedfishConfigData.RedfishServiceInfo.RedfishServiceLocation = 
RedfishInstance->Information.Location;
+  gRedfishConfigData.RedfishServiceInfo.RedfishServiceUuid = 
RedfishInstance->Information.Uuid;
+  gRedfishConfigData.RedfishServiceInfo.RedfishServiceOs   = 
RedfishInstance->Information.Os;
+  gRedfishConfigData.RedfishServiceInfo.RedfishServiceOsVersion= 
RedfishInstance->Information.OsVersion;
+  gRedfishConfigData.RedfishServiceInfo.RedfishServiceProduct  = 
RedfishInstance->Information.Product;
+  gRedfishConfigData.RedfishServiceInfo.RedfishServiceProductVer   = 

Re: [edk2-devel] [PATCH] MdePkg: Add DEBUG_MANAGEABILITY print error level

2023-04-20 Thread Michael D Kinney
Hi Abner,

This seems like a reasonable additional to the debug levels.

Do you intend to mix this debug level with DEBUG_ERROR, DEBUG_WARN, DEBUG_INFO, 
DEBUG_VERBOSE.
DEBUG_INFO | DEBUG_LOAD example:


https://github.com/tianocore/edk2/blob/9bf79303ae5cb4d0e14ed7a219107b53e2ecdcd0/StandaloneMmPkg/Core/Dispatcher.c#L279

There may be challenges defining what is a manageability related component and 
what is not, but that can be handled through code reviews.

Reviewed-by: Michael D Kinney 

Mike

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Chang, Abner 
> via groups.io
> Sent: Tuesday, April 18, 2023 7:06 PM
> To: Kinney, Michael D ; devel@edk2.groups.io
> Cc: Gao, Liming ; Liu, Zhiguang 
> ; Nickle Wang ; Igor
> Kulchytskyy ; Oram, Isaac W ; Attar, 
> AbdulLateef (Abdul Lateef)
> ; Tinh Nguyen 
> Subject: Re: [edk2-devel] [PATCH] MdePkg: Add DEBUG_MANAGEABILITY print error 
> level
> 
> [AMD Official Use Only - General]
> 
> I was hesitated having a new debug level for just RedfishPkg, until I 
> realized not only RedfishPkg but also
> ManageabilityPKg and edk2-redfish-client need a specific debug level. The 
> scope look to me big enough to create a new
> individual debug level due to lot of debug information for those modules and 
> people don’t want to see VERBOSE is enabled
> on all modules just because PcdDebugPrintErrorLevel is overwritten in 
> platform DSC in most of platform development
> practices. There are many modules and multiple layers of driver stack in the 
> above packages, especially to the upcoming
> package under edk2-redfish-client repo. It seems to me it would be pesky to 
> developers for turning on VERBOSE on certain
> modules one by one.
> 
> Abner
> 
> > -Original Message-
> > From: Kinney, Michael D 
> > Sent: Wednesday, April 19, 2023 1:55 AM
> > To: Chang, Abner ; devel@edk2.groups.io
> > Cc: Gao, Liming ; Liu, Zhiguang
> > ; Nickle Wang ; Igor
> > Kulchytskyy ; Oram, Isaac W ;
> > Attar, AbdulLateef (Abdul Lateef) ; Tinh
> > Nguyen ; Kinney, Michael D
> > 
> > Subject: RE: [PATCH] MdePkg: Add DEBUG_MANAGEABILITY print error level
> >
> > Caution: This message originated from an External Source. Use proper
> > caution when opening attachments, clicking links, or responding.
> >
> >
> > Do we really need a new debug level?
> >
> > The DEBUG_INIT/WARN/INFO/VERBOSE levels can be enabled/disabled in
> > individual modules.
> >
> > I imagine even within the set of manageability components you will want to
> > use those different levels to adjust verbosity of the debug log.
> >
> > Mike
> >
> > > -Original Message-
> > > From: abner.ch...@amd.com 
> > > Sent: Tuesday, April 18, 2023 2:04 AM
> > > To: devel@edk2.groups.io
> > > Cc: Kinney, Michael D ; Gao, Liming
> > > ; Liu, Zhiguang ;
> > > Nickle Wang ; Igor Kulchytskyy ;
> > > Oram, Isaac W ; Abdul Lateef Attar
> > > ; Tinh Nguyen
> > > 
> > > Subject: [PATCH] MdePkg: Add DEBUG_MANAGEABILITY print error level
> > >
> > > From: Abner Chang 
> > >
> > > Bug #4414
> > >
> > > Add DEBUG_MANAGEABILITY print error lever to output debug message of
> > > detailed manageability related module information, such as
> > > - RedfishPkg:
> > >   - HTTP header/request/response
> > >   - JSON plain text
> > >   - Refish resource
> > >   - Redfish Host interface information
> > >   - Redfish credential information
> > >   - Platform configuration to Redfish mapping
> > >   - etc.
> > > - ManageabilityPKg
> > >   - Protocol payload of MCTP/PLDM/IPMI
> > >   - Payload of transport interface transfers
> > >   - IPMI BLOB transfer
> > >   - etc.
> > > - RedfishClinetPkg
> > >   - Redfish feature driver dispatcher
> > >   - Redfish BIOS attributes
> > >   - Platform configuration (HII) to
> > > Redfish property information
> > >   - Redfish C structure information
> > >   - etc.
> > >
> > > 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 
> > > Cc: Tinh Nguyen 
> > > ---
> > >  MdePkg/MdePkg.dec |  1 +
> > >  MdePkg/Include/Library/DebugLib.h | 42
> > > ---
> > >  2 files changed, 23 insertions(+), 20 deletions(-)
> > >
> > > diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index
> > > e70182bf7fb..a7566b688d3 100644
> > > --- a/MdePkg/MdePkg.dec
> > > +++ b/MdePkg/MdePkg.dec
> > > @@ -2282,6 +2282,7 @@
> > >#  BIT20 - Global Coherency Database changes message.
> > >#  BIT21 - Memory range cachability changes message.
> > >#  BIT22 - Detailed debug message.
> > > +  #  BIT23 - Manageability messages. BR>
> > >#  BIT31 - Error message.
> > ># @Prompt Debug Message Print Level.
> > ># @Expression  0x8002 |
> > > (gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel & 0x7F84AA00) ==
> > 0
> > > diff --git a/MdePkg/Include/Library/DebugLib.h
> > > 

Re: [edk2-devel] [PATCH 1/1] ArmPkg: older assemblers may lack ID_AA64ISAR2_EL1

2023-04-20 Thread Leif Lindholm
On Thu, Apr 20, 2023 at 21:45:32 +0200, Marcin Juszkiewicz wrote:
> ArmCpuInfo needs to be able to read ID_AA64ISAR2_EL1 system register.
> Older toolchains do not know it.
> 
> Same solution as one for QEMU:
> https://www.mail-archive.com/qemu-devel@nongnu.org/msg929586.html
> 
> Signed-off-by: Marcin Juszkiewicz 

Thanks!

Reviewed-by: Leif Lindholm 

I will never stop being surprised by ARM not declaring these as RAZ
and existing ahead of time. So we keep ending up with this race
condition (preventing CI on the arch feature app to pass).

/
Leif

> ---
>  ArmPkg/Include/Chipset/AArch64.h | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/ArmPkg/Include/Chipset/AArch64.h 
> b/ArmPkg/Include/Chipset/AArch64.h
> index bfd2859f5131..690433f68ec8 100644
> --- a/ArmPkg/Include/Chipset/AArch64.h
> +++ b/ArmPkg/Include/Chipset/AArch64.h
> @@ -112,6 +112,10 @@
>  #define ARM_VECTOR_LOW_A32_FIQ   0x700
>  #define ARM_VECTOR_LOW_A32_SERR  0x780
>  
> +// The ID_AA64ISAR2_EL1 register is not recognized by older
> +// assemblers, we need to define it here.
> +#define ID_AA64ISAR2_EL1  S3_0_C0_C6_2
> +
>  // The ID_AA64MMFR2_EL1 register was added in ARMv8.2. Since we
>  // build for ARMv8.0, we need to define the register here.
>  #define ID_AA64MMFR2_EL1  S3_0_C0_C7_2
> -- 
> 2.40.0
> 
> 
> 
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103322): https://edk2.groups.io/g/devel/message/103322
Mute This Topic: https://groups.io/mt/98396772/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 1/1] ArmPkg: older assemblers may lack ID_AA64ISAR2_EL1

2023-04-20 Thread Marcin Juszkiewicz
ArmCpuInfo needs to be able to read ID_AA64ISAR2_EL1 system register.
Older toolchains do not know it.

Same solution as one for QEMU:
https://www.mail-archive.com/qemu-devel@nongnu.org/msg929586.html

Signed-off-by: Marcin Juszkiewicz 
---
 ArmPkg/Include/Chipset/AArch64.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/ArmPkg/Include/Chipset/AArch64.h b/ArmPkg/Include/Chipset/AArch64.h
index bfd2859f5131..690433f68ec8 100644
--- a/ArmPkg/Include/Chipset/AArch64.h
+++ b/ArmPkg/Include/Chipset/AArch64.h
@@ -112,6 +112,10 @@
 #define ARM_VECTOR_LOW_A32_FIQ   0x700
 #define ARM_VECTOR_LOW_A32_SERR  0x780
 
+// The ID_AA64ISAR2_EL1 register is not recognized by older
+// assemblers, we need to define it here.
+#define ID_AA64ISAR2_EL1  S3_0_C0_C6_2
+
 // The ID_AA64MMFR2_EL1 register was added in ARMv8.2. Since we
 // build for ARMv8.0, we need to define the register here.
 #define ID_AA64MMFR2_EL1  S3_0_C0_C7_2
-- 
2.40.0



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




Re: [edk2-devel] [PATCH] RedfishPkg: Remove the global variables related to Discover Token functionality

2023-04-20 Thread Igor Kulchytskyy via groups.io
Hi Abner,
I did what you asked to do - Patchcheck.py and UncrustiyCheck (got binary).
Going to send PATCH V2.
But I'm not sure what happened with white space. Going to check with MIS.
Thank you,
Igor

-Original Message-
From: Chang, Abner 
Sent: Wednesday, April 19, 2023 9:00 PM
To: Igor Kulchytskyy ; devel@edk2.groups.io
Cc: Nickle Wang 
Subject: [EXTERNAL] RE: [PATCH] RedfishPkg: Remove the global variables related 
to Discover Token functionality


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

[AMD Official Use Only - General]

Hi Igor,
I have no problem with this change, however some upstream practices here,

- Please shorten the subject to <= 76
- Each line in the commit message should be <=76
You can run Patchcheck.py (here: BaseTools\Scripts) before you sending out the 
patches.

Please run UncrustiyCheck for each source code you modified, . 
pytool/Plugin/UncrustifyCheck/ and used for beautifying the source code.
You can get the binary from here: 
https://sourceforge.net/projects/uncrustify/files.

Please resend the patch with above issue fixed.

BTW, the patch you sent to group.io still has a problem. The white space of 
each blank line in the patch file were gone (you can take a look at your 
message sent to group.io). This leads to a failure of patch apply. I recover 
those white space in the blank lines and the patch can be applied. However, I 
can do this just for a short patch.  Please figure it out at your end.  That's 
fine if this problem still exist on your resent patch in case you need some 
time to figure out the email problem.

Thanks
Abner

> -Original Message-
> From: Igor Kulchytskyy 
> Sent: Wednesday, April 19, 2023 11:04 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Nickle Wang
> 
> Subject: [PATCH] RedfishPkg: Remove the global variables related to
> Discover Token functionality
>
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
>
>
> gRedfishDiscoveredToken may be allocated several times, if multiple NIC
> installed on the system.
> To avoid this issue Discover Token related global variables replaced with the
> local variables.
>
> Cc: Abner Chang 
> Cc: Nickle Wang 
> Signed-off-by: Igor Kulchytskyy 
> ---
>  RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c | 139
> 
>  RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c   |  87 -
> ---
>  RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h  |  28 +++-
>  3 files changed, 140 insertions(+), 114 deletions(-)
>
> diff --git a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
> b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
> index 993ad33..8f85491 100644
> --- a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
> +++ b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
> @@ -22,12 +22,6 @@ EFI_HANDLE
> gEfiRedfishDiscoverControllerHandle = NULL;
>  EFI_REDFISH_DISCOVER_PROTOCOL  *gEfiRedfishDiscoverProtocol=
> NULL;
>  BOOLEANgRedfishDiscoverActivated   = FALSE;
>  BOOLEANgRedfishServiceDiscovered   = FALSE;
> -//
> -// Network interfaces discovered by EFI Redfish Discover Protocol.
> -//
> -UINTN   gNumberOfNetworkInterfaces;
> -EFI_REDFISH_DISCOVER_NETWORK_INTERFACE
> *gNetworkInterfaceInstances = NULL;
> -EFI_REDFISH_DISCOVERED_TOKEN*gRedfishDiscoveredToken=
> NULL;
>
>  ///
>  /// Driver Binding Protocol instance
> @@ -58,13 +52,6 @@ RedfishConfigStopRedfishDiscovery (
>gBS->CloseEvent (gEfiRedfishDiscoverProtocolEvent);
>  }
>
> -//
> -// Stop Redfish service discovery.
> -//
> -gEfiRedfishDiscoverProtocol->AbortAcquireRedfishService (
> -   gEfiRedfishDiscoverProtocol,
> -   gNetworkInterfaceInstances
> -   );
>  gEfiRedfishDiscoverControllerHandle = NULL;
>  gEfiRedfishDiscoverProtocol = NULL;
>  gRedfishDiscoverActivated   = FALSE;
> @@ -318,36 +305,39 @@ RedfishServiceDiscoveredCallback (
>EFI_REDFISH_DISCOVERED_TOKEN *RedfishDiscoveredToken;
>EFI_REDFISH_DISCOVERED_INSTANCE  *RedfishInstance;
>
> -  if (gRedfishServiceDiscovered) {
> -//
> -// Only support one Redfish service on platform.
> -//
> -return;
> -  }
> -
>RedfishDiscoveredToken = (EFI_REDFISH_DISCOVERED_TOKEN *)Context;
> -  RedfishInstance= RedfishDiscoveredToken-
> >DiscoverList.RedfishInstances;
> +  gBS->CloseEvent (RedfishDiscoveredToken->Event);
> +
>//
> -  // Only pick up the first found Redfish service.
> +  // Only support one Redfish service on platform.
>//
> -  if (RedfishInstance->Status == EFI_SUCCESS) {
> -

Re: [edk2-devel] [PATCH v4 05/13] edksetup.bat: Remove VS2008-VS2013 remnants

2023-04-20 Thread Leif Lindholm
On Wed, Apr 19, 2023 at 13:57:38 -0600, Rebecca Cran wrote:
> Since Visual Studio versions older than VS2015 are no longer supported,
> remove mention of them from edksetup.bat.
> 
> Signed-off-by: Rebecca Cran 
> Reviewed-by: Oliver Smith-Denny 

Reviewed-by: Leif Lindholm 

> ---
>  edksetup.bat | 6 +-
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/edksetup.bat b/edksetup.bat
> index 7ad137bb3e9b..2fdf130e00e2 100755
> --- a/edksetup.bat
> +++ b/edksetup.bat
> @@ -148,19 +148,15 @@ if /I "%1"=="ForceRebuild" shift
>  if /I "%1"=="VS2019" shift
>  if /I "%1"=="VS2017" shift
>  if /I "%1"=="VS2015" shift
> -if /I "%1"=="VS2013" shift
> -if /I "%1"=="VS2012" shift
>  if "%1"=="" goto end
>  
>  :Usage
>@echo.
> -  @echo  Usage: "%0 [-h | -help | --help | /h | /help | /?] [Reconfig] 
> [Rebuild] [ForceRebuild] [VS2019] [VS2017] [VS2015] [VS2013] [VS2012]"
> +  @echo  Usage: "%0 [-h | -help | --help | /h | /help | /?] [Reconfig] 
> [Rebuild] [ForceRebuild] [VS2019] [VS2017] [VS2015]"
>@echo.
>@echo Reconfig   Reinstall target.txt, tools_def.txt and 
> build_rule.txt.
>@echo RebuildPerform incremental rebuild of BaseTools 
> binaries.
>@echo ForceRebuild   Force a full rebuild of BaseTools binaries.
> -  @echo VS2012 Set the env for VS2012 build.
> -  @echo VS2013 Set the env for VS2013 build.
>@echo VS2015 Set the env for VS2015 build.
>@echo VS2017 Set the env for VS2017 build.
>@echo VS2019 Set the env for VS2019 build.
> -- 
> 2.37.2
> 
> 
> 
> 
> 
> 


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

2023-04-20 Thread Leif Lindholm
On Thu, Apr 20, 2023 at 16:44:23 +0200, Marcin Juszkiewicz wrote:
> App goes through ID_AA64*_EL1 system registers and decode their values.
> 
> Signed-off-by: Marcin Juszkiewicz 

For the series:
Reviewed-by: Leif Lindholm 

After discussing with Marcin on side channel, I folded in a statement
at the head of ArmCpuInfo.c that the app was written against ARM DDI
0487I.a version (current) of the ARM Architecture Reference Manual (A
profile), and that this information should be updated when features
are added from a subsequent version of the document.

Submitted as github merge request #4292, currently going through CI.

Thanks!

/
Leif

> ---
>  ArmPkg/ArmPkg.dsc|1 +
>  ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.inf |   33 +
>  ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.c   | 2346 ++
>  3 files changed, 2380 insertions(+)
>  create mode 100644 ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.inf
>  create mode 100644 ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.c
> 
> diff --git a/ArmPkg/ArmPkg.dsc b/ArmPkg/ArmPkg.dsc
> index 3fb95d1951a9..6b938ce8b671 100644
> --- a/ArmPkg/ArmPkg.dsc
> +++ b/ArmPkg/ArmPkg.dsc
> @@ -166,6 +166,7 @@ [Components.AARCH64]
>ArmPkg/Drivers/ArmPsciMpServicesDxe/ArmPsciMpServicesDxe.inf
>ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf
>ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf
> +  ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.inf
>  
>  [Components.AARCH64, Components.ARM]
>ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.inf
> diff --git a/ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.inf 
> b/ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.inf
> new file mode 100644
> index ..d2235d3aa911
> --- /dev/null
> +++ b/ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.inf
> @@ -0,0 +1,33 @@
> +## @file
> +#
> +#  Attempt to have AArch64 cpu information.
> +#
> +#  Based on HelloWorld:
> +#  Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
> +#  Copyright (c) 2023 Marcin Juszkiewicz
> +#
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +#
> +##
> +
> +[Defines]
> +  INF_VERSION= 0x00010019
> +  BASE_NAME  = ArmCpuInfo
> +  FILE_GUID  = b3134491-6502-4faf-a9da-007184e32163
> +  MODULE_TYPE= UEFI_APPLICATION
> +  VERSION_STRING = 1.0
> +  ENTRY_POINT= UefiMain
> +
> +[Sources]
> +  ArmCpuInfo.c
> +
> +[Packages]
> +  ArmPkg/ArmPkg.dec
> +  MdePkg/MdePkg.dec
> +  MdeModulePkg/MdeModulePkg.dec
> +
> +[LibraryClasses]
> +  ArmLib
> +  UefiApplicationEntryPoint
> +  UefiLib
> diff --git a/ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.c 
> b/ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.c
> new file mode 100644
> index ..63914d9815c6
> --- /dev/null
> +++ b/ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.c
> @@ -0,0 +1,2346 @@
> +/** @file
> +
> +  Copyright  (c) 2023 Marcin Juszkiewicz
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> + **/
> +
> +#include 
> +#include 
> +
> +// We cannot assume GCC extensions to be present so let use
> +// binary numbers via enum.
> +// Arm ARM uses binary numbers so this way it is more readable.
> +enum {
> +   b,
> +   b0001,
> +   b0010,
> +   b0011,
> +   b0100,
> +   b0101,
> +   b0110,
> +   b0111,
> +   b1000,
> +   b1001,
> +   b1010,
> +   b1011,
> +   b1100,
> +   b1101,
> +   b1110,
> +   b
> +};
> +
> +VOID
> +PrintText (
> +  CONST CHAR8  *Field,
> +  CONST CHAR8  *Bits,
> +  CONST CHAR8  *Value,
> +  CONST CHAR8  *Description
> +  )
> +{
> +  AsciiPrint (" %-16a | %5a | %5a | %a\n", Field, Bits, Value, Description);
> +}
> +
> +VOID
> +PrintValues (
> +  CONST CHAR8  *Field,
> +  CONST CHAR8  *Bits,
> +  CONST UINT8  Value,
> +  CONST CHAR8  *Description
> +  )
> +{
> +  STATIC CONST CHAR8  Nibbles[][5] = {
> +"", "0001", "0010", "0011", "0100", "0101", "0110", "0111",
> +"1000", "1001", "1010", "1011", "1100", "1101", "1110", ""
> +  };
> +
> +  AsciiPrint (" %-16a | %5a | %5a | %a\n", Field, Bits, Nibbles[Value & 
> 0xf], Description);
> +}
> +
> +VOID
> +PrintSpacer (
> +  VOID
> +  )
> +{
> +  AsciiPrint 
> ("--|---|---|--\n");
> +}
> +
> +VOID
> +HandleAa64Mmfr0 (
> +  CONST UINT64  Aa64Mmfr0
> +  )
> +{
> +  UINT64  Value;
> +  STATIC CONST CHAR8  RegName[] = "ID_AA64MMFR0";
> +  CONST CHAR8 *Description;
> +  CONST CHAR8 *Bits;
> +
> +  Bits  = "3:0 ";
> +  Value = Aa64Mmfr0 & 0xf;
> +  switch (Value) {
> +case b:
> +  Description = "32 Bits  (4GB) of physical address range supported.";
> +  break;
> +case b0001:
> +  Description = "36 Bits  (64GB) of physical address range supported.";
> +  break;
> +case b0010:
> +  Description = "40 Bits  (1TB) of physical address range supported.";
> +  break;
> +case b0011:
> +  Description = "42 Bits  (4TB) of physical address range 

Re: [edk2-devel] [PATCH v3 2/3] MdePkg: Support FDT library.

2023-04-20 Thread Michael D Kinney
Hi Leif,

What is your opinion on FDT being big endian.

Do we want the lib to help with that aspect, or leave it up to the consumer of 
the lib to 
convert as needed?  Seems like an area that could be very error prone if we are 
not
careful.

Mike

> -Original Message-
> From: Lin, Benny 
> Sent: Wednesday, April 19, 2023 9:25 PM
> To: Kinney, Michael D ; devel@edk2.groups.io
> Cc: Gao, Liming ; Liu, Zhiguang 
> ; Pedro Falcato 
> Subject: RE: [PATCH v3 2/3] MdePkg: Support FDT library.
> 
> 
> 
> >-Original Message-
> >From: Kinney, Michael D 
> >Sent: Thursday, April 20, 2023 5:04 AM
> >To: Lin, Benny ; devel@edk2.groups.io
> >Cc: Gao, Liming ; Liu, Zhiguang 
> >; Pedro Falcato ; Kinney,
> Michael D 
> >Subject: RE: [PATCH v3 2/3] MdePkg: Support FDT library.
> >
> >Responses below
> >
> >Mike
> >
> >> -Original Message-
> >> From: Lin, Benny 
> >> Sent: Wednesday, April 19, 2023 10:12 AM
> >> To: Kinney, Michael D ;
> >> devel@edk2.groups.io
> >> Cc: Gao, Liming ; Liu, Zhiguang
> >> ; Pedro Falcato 
> >> Subject: RE: [PATCH v3 2/3] MdePkg: Support FDT library.
> >>
> >> Please find my feedback below.
> >> We can remove FDT_RESERVE_ENTRY but keep FDT_NODE_HEADER, what do you 
> >> think?
> >>
> >> QQQ
> >> Benny
> >>
> >> >-Original Message-
> >> >From: Kinney, Michael D 
> >> >Sent: Wednesday, April 19, 2023 11:54 PM
> >> >To: Lin, Benny ; devel@edk2.groups.io
> >> >Cc: Gao, Liming ; Liu, Zhiguang
> >> >; Pedro Falcato ;
> >> >Kinney,
> >> Michael D 
> >> >Subject: RE: [PATCH v3 2/3] MdePkg: Support FDT library.
> >> >
> >> >A few comments below.
> >> >
> >> >Mike
> >> >
> >> >> -Original Message-
> >> >> From: Lin, Benny 
> >> >> Sent: Sunday, April 16, 2023 10:35 PM
> >> >> To: devel@edk2.groups.io
> >> >> Cc: Lin, Benny ; Kinney, Michael D
> >> >> ; Gao, Liming
> >> >> ; Liu, Zhiguang ;
> >> >> Pedro Falcato 
> >> >> Subject: [PATCH v3 2/3] MdePkg: Support FDT library.
> >> >>
> >> >> From: Benny Lin 
> >> >>
> >> >> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4392
> >> >> Add FDT support in EDK2 by submodule 3rd party libfdt
> >> >> (https://github.com/devicetree-org/pylibfdt/tree/main/libfdt)
> >> >> and refer to LibcLib implementation by Pedro.
> >> >>
> >> >> Cc: Michael D Kinney 
> >> >> Cc: Liming Gao 
> >> >> Cc: Zhiguang Liu 
> >> >> Acked-by: Pedro Falcato 
> >> >> Signed-off-by: Benny Lin 
> >> >> ---
> >> >>  MdePkg/Include/Library/FdtLib.h   | 314 
> >> >>  MdePkg/Library/BaseFdtLib/BaseFdtLib.inf  |  62 
> >> >> MdePkg/Library/BaseFdtLib/BaseFdtLib.uni  |  14 +
> >> >>  MdePkg/Library/BaseFdtLib/FdtLib.c| 301 +++
> >> >>  MdePkg/Library/BaseFdtLib/LibFdtSupport.h |  99 ++
> >> >> MdePkg/Library/BaseFdtLib/LibFdtWrapper.c | 173 +++
> >> >>  MdePkg/Library/BaseFdtLib/limits.h|  10 +
> >> >>  MdePkg/Library/BaseFdtLib/stdbool.h   |  10 +
> >> >>  MdePkg/Library/BaseFdtLib/stddef.h|  10 +
> >> >>  MdePkg/Library/BaseFdtLib/stdint.h|  10 +
> >> >>  MdePkg/Library/BaseFdtLib/stdlib.h|  10 +
> >> >>  MdePkg/Library/BaseFdtLib/string.h|  10 +
> >> >>  MdePkg/MdePkg.ci.yaml |  17 +-
> >> >>  MdePkg/MdePkg.dec |   4 +
> >> >>  MdePkg/MdePkg.dsc |   1 +
> >> >>  15 files changed, 1043 insertions(+), 2 deletions(-)
> >> >>
> >> >> diff --git a/MdePkg/Include/Library/FdtLib.h
> >> >> b/MdePkg/Include/Library/FdtLib.h new file mode 100644 index
> >> >> 00..d59b749c25
> >> >> --- /dev/null
> >> >> +++ b/MdePkg/Include/Library/FdtLib.h
> >> >> @@ -0,0 +1,314 @@
> >> >> +/** @file
> >> >>
> >> >> +  Flattened Device Tree Library.
> >> >>
> >> >> +
> >> >>
> >> >> +  Copyright (c) 2023, Intel Corporation. All rights reserved.
> >> >>
> >> >> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> >> >>
> >> >> +
> >> >>
> >> >> +**/
> >> >>
> >> >> +
> >> >>
> >> >> +#ifndef FDT_LIB_H_
> >> >>
> >> >> +#define FDT_LIB_H_
> >> >>
> >> >> +
> >> >>
> >> >> +///
> >> >>
> >> >> +/// Flattened Device Tree definition
> >> >>
> >> >> +///
> >> >>
> >> >> +typedef struct {
> >> >>
> >> >> +  UINT32Magic;   /* magic word FDT_MAGIC */
> >> >>
> >> >> +  UINT32TotalSize;   /* total size of DT block */
> >> >>
> >> >> +  UINT32OffsetDtStruct;  /* offset to structure */
> >> >>
> >> >> +  UINT32OffsetDtStrings; /* offset to strings */
> >> >>
> >> >> +  UINT32OffsetMemRsvmap; /* offset to memory reserve map */
> >> >>
> >> >> +  UINT32Version; /* format version */
> >> >>
> >> >> +  UINT32LastCompVersion; /* last compatible version */
> >> >>
> >> >> +
> >> >>
> >> >> +  /* version 2 fields below */
> >> >>
> >> >> +  UINT32BootCpuidPhys;   /* Which physical CPU id we're
> >> >>
> >> >> +booting on */
> >> >>
> >> >> +  /* version 3 fields below */
> >> >>
> >> >> +  

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

2023-04-20 Thread Ard Biesheuvel
On Thu, 20 Apr 2023 at 17:24, 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.
> To make sure related issues are reliably caught in the future, align the
> end of the function before checking the total occupied size. This
> ensures crossing a 0x200 boundary will cause a compilation error.
>
> Reviewed-by: Leif Lindholm 
> Signed-off-by: Marvin Häuser 
> Cc: Leif Lindholm 
> Cc: Ard Biesheuvel 
> Cc: Sami Mujawar 
> Cc: Vitaly Cheptsov 

Thanks. I've queued these up as #4291


> ---
>  .../ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S  | 14 --
>  1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S 
> b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S
> index e936a5be4e11..887439bc042f 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
> @@ -101,5 +100,8 @@ ASM_GLOBAL ASM_PFX(ArmReplaceLiveTranslationEntrySize)
>  ASM_PFX(ArmReplaceLiveTranslationEntrySize):
>.long   . - ArmReplaceLiveTranslationEntry
>
> -  // Double check that we did not overrun the assumed maximum size
> +  // Double check that we did not overrun the assumed maximum size or cross a
> +  // 0x200 boundary (and thus implicitly not any larger power of two, 
> including
> +  // the page size).
> +  .balign 0x200
>.orgArmReplaceLiveTranslationEntry + 0x200
> --
> 2.40.0
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103316): https://edk2.groups.io/g/devel/message/103316
Mute This Topic: https://groups.io/mt/98391309/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 V2 01/14] ManageabilityPkg: Add more helper functions

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

Hi Nickle, I will fix them in the next version.

Thanks
Abner

> -Original Message-
> From: Nickle Wang 
> Sent: Thursday, April 20, 2023 2:42 PM
> To: Chang, Abner ; devel@edk2.groups.io
> Cc: Isaac Oram ; Attar, AbdulLateef (Abdul Lateef)
> ; Igor Kulchytskyy 
> Subject: RE: [edk2-platforms][PATCH V2 01/14] ManageabilityPkg: Add more
> helper functions
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> Hi Abner,
> 
> Please find my comments below.
> 
> Thanks,
> Nickle
> 
> > -Original Message-
> > From: abner.ch...@amd.com 
> > Sent: Tuesday, April 18, 2023 3:16 PM
> > To: devel@edk2.groups.io
> > Cc: Isaac Oram ; Abdul Lateef Attar
> > ; Nickle Wang ; Igor
> Kulchytskyy
> > 
> > Subject: [edk2-platforms][PATCH V2 01/14] ManageabilityPkg: Add more
> > helper functions
> >
> > External email: Use caution opening links or attachments
> >
> >
> > From: Abner Chang 
> >
> > 1. Add a helper function to output payload binary
> >to debug output device.
> > 2. Add a helper function to split payload into
> >packages according to maximum transfer unit
> >of transport interface.
> > 3. Add a helper function to generate CRC8.
> >
> > Signed-off-by: Abner Chang 
> > Cc: Isaac Oram 
> > Cc: Abdul Lateef Attar 
> > Cc: Nickle Wang 
> > Cc: Igor Kulchytskyy 
> > ---
> >  .../BaseManageabilityTransportHelper.inf  |   1 +
> >  .../Library/ManageabilityTransportHelperLib.h |  98 
> >  .../BaseManageabilityTransportHelper.c| 225 +-
> >  3 files changed, 314 insertions(+), 10 deletions(-)
> >
> > diff --git
> > a/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLi
> > b/Ba
> > seManageabilityTransportHelper.inf
> > b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLi
> > b/Ba
> > seManageabilityTransportHelper.inf
> > index 5447954144..c9e5eaef60 100644
> > ---
> > a/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLi
> > b/Ba
> > seManageabilityTransportHelper.inf
> > +++
> b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelp
> > +++ er Lib/BaseManageabilityTransportHelper.inf
> > @@ -25,6 +25,7 @@
> >  [LibraryClasses]
> >BaseMemoryLib
> >DebugLib
> > +  MemoryAllocationLib
> >
> >  [Packages]
> >ManageabilityPkg/ManageabilityPkg.dec
> > diff --git
> > a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportHelp
> > erLib
> > .h
> > b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportHelp
> > erLib
> > .h
> > index 718ac34a1f..0dbf5ccb3c 100644
> > ---
> > a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportHelp
> > erLib
> > .h
> > +++ b/Features/ManageabilityPkg/Include/Library/ManageabilityTransport
> > +++ He
> > +++ lperLib.h
> > @@ -11,8 +11,24 @@
> >
> >  #include 
> >
> > +#define DEBUG_MANAGEABILITY_INFO  DEBUG_INFO
> > +
> >  typedef struct _MANAGEABILITY_PROTOCOL_NAME
> > MANAGEABILITY_PROTOCOL_NAME;
> >
> > +typedef struct {
> > +  UINT8 *PayloadPointer;
> > +  UINT32PayloadSize;
> > +} MANAGEABILITY_TRANSMISSION_PACKAGE_ATTR;
> > +
> > +//
> > +// The information of multi portions of payload it is // splitted
> > +according to transport interface Maximum // Transfer Unit.
> > +typedef struct {
> > +  UINT16 NumberOfPackages; ///< Number 
> > of packages
> in
> > MultiPackages.
> > +  MANAGEABILITY_TRANSMISSION_PACKAGE_ATTRMultiPackages[];
> > +} MANAGEABILITY_TRANSMISSION_MULTI_PACKAGES;
> > +
> >  /**
> >Helper function returns the human readable name of Manageability
> > specification.
> >
> > @@ -90,4 +106,86 @@ HelperInitManageabilityTransport (
> >OUT MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS
> > *TransportAdditionalStatus OPTIONAL
> >);
> >
> > +/**
> > +  This function splits payload into multiple packages according to
> > +  the given transport interface Maximum Transfer Unit (MTU).
> > +
> > +  @param[in]  PreambleSize The additional data size precedes
> > +   each package.
> > +  @param[in]  PostambleSizeThe additional data size succeeds
> > +   each package.
> > +  @param[in]  Payload  Pointer to payload.
> > +  @param[in]  PayloadSize  Payload size in byte.
> > +  @param[in]  MaximumTransferUnit  MTU of transport interface.
> > +  @param[out] MultiplePackages Pointer to receive
> > +   
> > MANAGEABILITY_TRANSMISSION_MULTI_PACKAGES
> > +   structure. Caller has to free the memory
> > +   allocated for
> > MANAGEABILITY_TRANSMISSION_MULTI_PACKAGES.
> > +
> > +  @retval   EFI_SUCCESS
> > MANAGEABILITY_TRANSMISSION_MULTI_PACKAGES structure
> > + is returned successfully.
> > +  @retval   

Re: [edk2-devel] [Patch V2 0/8] Use CpuPageTableLib to create and update smm page table

2023-04-20 Thread Lendacky, Thomas via groups.io

On 4/20/23 04:07, duntan via groups.io wrote:

Hi Tom,

Thanks for confirming. Is 1G page table supported in your test? If supported, 
there is a reason can explain why this difference exists.
In current upstream master branch:
Smm code always create 2M page table for [0, 4G] range(in Gen4GPageTable ) to 
reuse code. In QemuFlashBeforeProbe() of 
OvmfPkg\QemuFlashFvbServicesRuntimeDxe\QemuFlashSmm.c, the range to clear 
EncMask is 2M aligned. No page split happens and smm page table memory is all 
RW before ReadyToLock. But in my opinion, the PF also may happen if the range 
is not 2M aligned.

In my code branch:
If 1G page table is supported, 1G page table is created to map [0, 4G]. Then page 
split (1G-->2M) happens in QemuFlashBeforeProbe() and the new memory for page 
table is marked as RO before ReadyToLock. That's why the PF happens in 
InitPaging().

To solve this issue, I think the assumption that smm page table is always RW 
before ReadyToLock should be dropped. I have added 2 new patches to clear WP 
before modifying smm page table. Could you please help test again?
https://github.com/td36/edk2/tree/SmmPageTable_V2


Hi Dun,

Yes, this branch successfully boots an SEV guest with SMM enabled.

Thanks!

Tom



Thanks,
Dun

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Lendacky, Thomas 
via groups.io
Sent: Wednesday, April 19, 2023 9:19 PM
To: devel@edk2.groups.io; Tan, Dun ; Ni, Ray 

Subject: Re: [edk2-devel] [Patch V2 0/8] Use CpuPageTableLib to create and 
update smm page table

On 4/19/23 00:39, duntan via groups.io wrote:

Hi Tom,

This PF happened because that  CR0.WP is set and DxeMemEncryptSevLib sets a 
part of smm page table as RO before ReadyToLock while CpuSmm driver assumes the 
smm page table is not marked as RO before ReadyToLock.
The code flow to set smm page table to RO is 
QemuFlashBeforeProbe()-->MemEncryptSevClearMmioPageEncMask()-->SetMemoryEncDec()-->EnablePageTableProtection().
 New page table memory allocated by DxeMemEncryptSevLib is marked as RO in 
EnablePageTableProtection(). However, In PiSmmCpuDxeSmm InitPaging() function, the RO 
page table marked by  DxeMemEncryptSevLib may be modified again and InitPaging() 
function doesn't clear CR0.WP in advance since it has the assumption that smm page table 
memory is always RW before SetPageTableAttributes(), which causes this PF.
So Could you please help test the SEV enabled smm code without my patch set? I 
think this issue may also happen in current edk2 code.


Upstream master branch boots without issue.

SmmInstallProtocolInterface: 47B7FA8C-F4BD-4AF6-8200-333086F0D2C8 0 
GetUefiMemoryMap Patch page table start ...
Patch page table done!
MemoryAttributesTable:
Version   - 0x0001
NumberOfEntries   - 0x0035
DescriptorSize- 0x0030
Entry (0x3FF01028)
...


Thanks,
Tom



Thanks,
Dun
-Original Message-
From: devel@edk2.groups.io  On Behalf Of
Lendacky, Thomas via groups.io
Sent: Wednesday, April 19, 2023 5:06 AM
To: Tan, Dun ; devel@edk2.groups.io; Ni, Ray

Subject: Re: [edk2-devel] [Patch V2 0/8] Use CpuPageTableLib to create
and update smm page table

On 4/18/23 04:57, Tan, Dun wrote:

Hi Tom,

I added a new patch in my code branch. This new patch removes the code that may 
apply AddressEncMask to smm page table non-leaf entries when splitting page 
table.
Could you please help test if this code branch works?
https://github.com/td36/edk2/tree/SmmPageTable_V2


It got further, but it still crashed:

SmmInstallProtocolInterface: 47B7FA8C-F4BD-4AF6-8200-333086F0D2C8 0 
GetUefiMemoryMap Patch page table start ...
 X64 Exception Type - 0E(#PF - Page-Fault)  CPU Apic ID -  
ExceptionData - 0003  I:0 R:0 U:0 W:1 P:1 PK:0 SS:0 SGX:0 RIP  - 
3FFC7744, CS  - 0038, RFLAGS - 00010082 RAX  - 
FF83, RCX - 3FFB5C78, RDX -  RBX  - 
3FC01000, RSP - 3FFB4790, RBP - 3FFB47B0 RSI  - 
3FC01000, RDI - 
R8   - 3FFB4840, R9  - 0002, R10 - 
R11  - , R12 - 3FFB5C78, R13 -
3FFB4840
R14  - 8000, R15 - 
DS   - 0020, ES  - 0020, FS  - 0020
GS   - 0020, SS  - 0020
CR0  - 80010033, CR2 - 3FC01000, CR3 -
3FF81000
CR4  - 0668, CR8 - 
DR0  - , DR1 - , DR2 -

DR3  - , DR6 - 0FF0, DR7 - 0400 GDTR - 
3FFAC000 004F, LDTR - 
IDTR - 3FFAF000 01FF,   TR - 0040
FXSAVE_STATE - 3FFB0C60
SMM exception at access (0x3FC01000)
It is invoked from the instruction before IP(0x3FFC7744) in module
(/root/kernels/ovmf-dun-build-Ia32X64/Build/Ovmf3264/DEBUG_GCC5/X64/Ue

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

2023-04-20 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 (#103311): https://edk2.groups.io/g/devel/message/103311
Mute This Topic: https://groups.io/mt/98391308/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




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

2023-04-20 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.
To make sure related issues are reliably caught in the future, align the
end of the function before checking the total occupied size. This
ensures crossing a 0x200 boundary will cause a compilation error.

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

diff --git a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S 
b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S
index e936a5be4e11..887439bc042f 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
@@ -101,5 +100,8 @@ ASM_GLOBAL ASM_PFX(ArmReplaceLiveTranslationEntrySize)
 ASM_PFX(ArmReplaceLiveTranslationEntrySize):
   .long   . - ArmReplaceLiveTranslationEntry
 
-  // Double check that we did not overrun the assumed maximum size
+  // Double check that we did not overrun the assumed maximum size or cross a
+  // 0x200 boundary (and thus implicitly not any larger power of two, including
+  // the page size).
+  .balign 0x200
   .orgArmReplaceLiveTranslationEntry + 0x200
-- 
2.40.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103312): https://edk2.groups.io/g/devel/message/103312
Mute This Topic: https://groups.io/mt/98391309/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 V2 01/14] ManageabilityPkg: Add more helper functions

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

Hi Abdul,
I don't use EFIAPI is because this is a library linked with the module, so 
there is no calling convention problem.
However, I should have a consistent coding style for this file. I will update 
this file and remove EFIAPI for other functions.

Thanks
Abner

> -Original Message-
> From: Attar, AbdulLateef (Abdul Lateef) 
> Sent: Wednesday, April 19, 2023 1:30 PM
> To: Chang, Abner ; devel@edk2.groups.io
> Cc: Isaac Oram ; Nickle Wang
> ; Igor Kulchytskyy 
> Subject: RE: [edk2-platforms][PATCH V2 01/14] ManageabilityPkg: Add more
> helper functions
> 
> [AMD Official Use Only - General]
> 
> Comments inline.
> 
> -Original Message-
> From: Chang, Abner 
> Sent: 18 April 2023 12:46
> To: devel@edk2.groups.io
> Cc: Isaac Oram ; Attar, AbdulLateef (Abdul Lateef)
> ; Nickle Wang ; Igor
> Kulchytskyy 
> Subject: [edk2-platforms][PATCH V2 01/14] ManageabilityPkg: Add more
> helper functions
> 
> From: Abner Chang 
> 
> 1. Add a helper function to output payload binary
>to debug output device.
> 2. Add a helper function to split payload into
>packages according to maximum transfer unit
>of transport interface.
> 3. Add a helper function to generate CRC8.
> 
> Signed-off-by: Abner Chang 
> Cc: Isaac Oram 
> Cc: Abdul Lateef Attar 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> ---
>  .../BaseManageabilityTransportHelper.inf  |   1 +
>  .../Library/ManageabilityTransportHelperLib.h |  98 
>  .../BaseManageabilityTransportHelper.c| 225 +-
>  3 files changed, 314 insertions(+), 10 deletions(-)
> 
> diff --git
> a/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib
> /BaseManageabilityTransportHelper.inf
> b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib
> /BaseManageabilityTransportHelper.inf
> index 5447954144..c9e5eaef60 100644
> ---
> a/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib
> /BaseManageabilityTransportHelper.inf
> +++
> b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelper
> +++ Lib/BaseManageabilityTransportHelper.inf
> @@ -25,6 +25,7 @@
>  [LibraryClasses]
>BaseMemoryLib
>DebugLib
> +  MemoryAllocationLib
> 
>  [Packages]
>ManageabilityPkg/ManageabilityPkg.dec
> diff --git
> a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportHelpe
> rLib.h
> b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportHelpe
> rLib.h
> index 718ac34a1f..0dbf5ccb3c 100644
> ---
> a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportHelpe
> rLib.h
> +++
> b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportHe
> +++ lperLib.h
> @@ -11,8 +11,24 @@
> 
>  #include 
> 
> +#define DEBUG_MANAGEABILITY_INFO  DEBUG_INFO
> +
>  typedef struct _MANAGEABILITY_PROTOCOL_NAME
> MANAGEABILITY_PROTOCOL_NAME;
> 
> +typedef struct {
> +  UINT8 *PayloadPointer;
> +  UINT32PayloadSize;
> +} MANAGEABILITY_TRANSMISSION_PACKAGE_ATTR;
> +
> +//
> +// The information of multi portions of payload it is // splitted
> +according to transport interface Maximum // Transfer Unit.
> +typedef struct {
> +  UINT16 NumberOfPackages; ///< Number 
> of packages in
> MultiPackages.
> +  MANAGEABILITY_TRANSMISSION_PACKAGE_ATTRMultiPackages[];
> +} MANAGEABILITY_TRANSMISSION_MULTI_PACKAGES;
> +
>  /**
>Helper function returns the human readable name of Manageability
> specification.
> 
> @@ -90,4 +106,86 @@ HelperInitManageabilityTransport (
>OUT MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS
> *TransportAdditionalStatus OPTIONAL
>);
> 
> +/**
> +  This function splits payload into multiple packages according to
> +  the given transport interface Maximum Transfer Unit (MTU).
> +
> +  @param[in]  PreambleSize The additional data size precedes
> +   each package.
> +  @param[in]  PostambleSizeThe additional data size succeeds
> +   each package.
> +  @param[in]  Payload  Pointer to payload.
> +  @param[in]  PayloadSize  Payload size in byte.
> +  @param[in]  MaximumTransferUnit  MTU of transport interface.
> +  @param[out] MultiplePackages Pointer to receive
> +   MANAGEABILITY_TRANSMISSION_MULTI_PACKAGES
> +   structure. Caller has to free the memory
> +   allocated for
> MANAGEABILITY_TRANSMISSION_MULTI_PACKAGES.
> +
> +  @retval   EFI_SUCCESS
> MANAGEABILITY_TRANSMISSION_MULTI_PACKAGES structure
> + is returned successfully.
> +  @retval   EFI_OUT_OF_RESOURCE  Not enough resource to create
> + MANAGEABILITY_TRANSMISSION_MULTI_PACKAGES
> structure.
> +**/
> +EFI_STATUS
> EFIAPI missing, is it intentional?
> +HelperManageabilitySplitPayload (
> +  IN UINT16  PreambleSize,
> 

Re: [edk2-devel] [PATCH V1 1/1] OvmfPkg/PlatformPei: Skip PlatformInitEmuVariableNvStore in SEV guest

2023-04-20 Thread Lendacky, Thomas via groups.io

On 4/14/23 05:20, Gerd Hoffmann wrote:

   Hi,


-drive 
if=pflash,format=raw,unit=0,file=/root/kernels/qemu-install/OVMF_CODE.fd,readonly=on
-drive if=pflash,format=raw,unit=1,file=./fedora.fd



  In this case, only OVMF_CODE.fd will be encrypted.
  The fedora.fd (OVMF_VARS.fd) will be unencrypted.



-drive 
if=pflash,format=raw,unit=0,file=/root/kernels/qemu-install/OVMF.fd,readonly=on



  In this case, OVMF.fd will be encrypted, which includes the now memory
  backed variable store.



Can AmdSevInitialize() setup the mappings?


Is there a way to tell when OVMF.fd vs OVMF_VARS.fd/OVMF_CODE.fd is used?


Hmm, good question.  Can the guest figure what memory ranges are part
of the launch measurement?

I have a patch here (attached below) which refines flash detection and
can detect whenever varstore flash is writable or not.  I suspect that
doesn't help much though as flash probing requires mappings already
being correct.


Sorry for the delay, but, yeah, doesn't help. SEV and SEV-ES assert and 
SEV-SNP terminates because of accessing a shared page (in the RMP) as a 
private page (we don't support the generated 0x404 error code in the #VC 
handler).


Thanks,
Tom



take care,
   Gerd

commit fdab276a9f8a25f505b083b5e15180d093f515e3
Author: Gerd Hoffmann 
Date:   Tue Apr 4 11:25:37 2023 +0200

 OvmfPkg/QemuFlashFvbServicesRuntimeDxe: refine flash detection

diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c 
b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c
index 82b2b70441bf..c088d560f829 100644
--- a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c
+++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c
@@ -118,8 +118,17 @@ QemuFlashDetected (
*Ptr = OriginalUint8;
  } else if (ProbeUint8 == CLEARED_ARRAY_STATUS) {
DEBUG ((DEBUG_INFO, "QemuFlashDetected => FD behaves as FLASH\n"));
-  FlashDetected = TRUE;
-  *Ptr  = READ_ARRAY_CMD;
+  *Ptr = WRITE_BYTE_CMD;
+  *Ptr = OriginalUint8;
+  *Ptr = READ_STATUS_CMD;
+  ProbeUint8 = *Ptr;
+  if (ProbeUint8 & 0x10 /* programming error */) {
+DEBUG ((DEBUG_INFO, "QemuFlashDetected => FLASH is readonly\n"));
+  } else {
+DEBUG ((DEBUG_INFO, "QemuFlashDetected => FLASH is writable\n"));
+FlashDetected = TRUE;
+  }
+  *Ptr = READ_ARRAY_CMD;
  }
}
  




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




[edk2-devel] [PATCH v6 2/2] add ArmCpuInfo EFI application

2023-04-20 Thread Marcin Juszkiewicz
App goes through ID_AA64*_EL1 system registers and decode their values.

Signed-off-by: Marcin Juszkiewicz 
---
 ArmPkg/ArmPkg.dsc|1 +
 ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.inf |   33 +
 ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.c   | 2346 ++
 3 files changed, 2380 insertions(+)
 create mode 100644 ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.inf
 create mode 100644 ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.c

diff --git a/ArmPkg/ArmPkg.dsc b/ArmPkg/ArmPkg.dsc
index 3fb95d1951a9..6b938ce8b671 100644
--- a/ArmPkg/ArmPkg.dsc
+++ b/ArmPkg/ArmPkg.dsc
@@ -166,6 +166,7 @@ [Components.AARCH64]
   ArmPkg/Drivers/ArmPsciMpServicesDxe/ArmPsciMpServicesDxe.inf
   ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf
   ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf
+  ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.inf
 
 [Components.AARCH64, Components.ARM]
   ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.inf
diff --git a/ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.inf 
b/ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.inf
new file mode 100644
index ..d2235d3aa911
--- /dev/null
+++ b/ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.inf
@@ -0,0 +1,33 @@
+## @file
+#
+#  Attempt to have AArch64 cpu information.
+#
+#  Based on HelloWorld:
+#  Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
+#  Copyright (c) 2023 Marcin Juszkiewicz
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#
+##
+
+[Defines]
+  INF_VERSION= 0x00010019
+  BASE_NAME  = ArmCpuInfo
+  FILE_GUID  = b3134491-6502-4faf-a9da-007184e32163
+  MODULE_TYPE= UEFI_APPLICATION
+  VERSION_STRING = 1.0
+  ENTRY_POINT= UefiMain
+
+[Sources]
+  ArmCpuInfo.c
+
+[Packages]
+  ArmPkg/ArmPkg.dec
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+
+[LibraryClasses]
+  ArmLib
+  UefiApplicationEntryPoint
+  UefiLib
diff --git a/ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.c 
b/ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.c
new file mode 100644
index ..63914d9815c6
--- /dev/null
+++ b/ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.c
@@ -0,0 +1,2346 @@
+/** @file
+
+  Copyright  (c) 2023 Marcin Juszkiewicz
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ **/
+
+#include 
+#include 
+
+// We cannot assume GCC extensions to be present so let use
+// binary numbers via enum.
+// Arm ARM uses binary numbers so this way it is more readable.
+enum {
+   b,
+   b0001,
+   b0010,
+   b0011,
+   b0100,
+   b0101,
+   b0110,
+   b0111,
+   b1000,
+   b1001,
+   b1010,
+   b1011,
+   b1100,
+   b1101,
+   b1110,
+   b
+};
+
+VOID
+PrintText (
+  CONST CHAR8  *Field,
+  CONST CHAR8  *Bits,
+  CONST CHAR8  *Value,
+  CONST CHAR8  *Description
+  )
+{
+  AsciiPrint (" %-16a | %5a | %5a | %a\n", Field, Bits, Value, Description);
+}
+
+VOID
+PrintValues (
+  CONST CHAR8  *Field,
+  CONST CHAR8  *Bits,
+  CONST UINT8  Value,
+  CONST CHAR8  *Description
+  )
+{
+  STATIC CONST CHAR8  Nibbles[][5] = {
+"", "0001", "0010", "0011", "0100", "0101", "0110", "0111",
+"1000", "1001", "1010", "1011", "1100", "1101", "1110", ""
+  };
+
+  AsciiPrint (" %-16a | %5a | %5a | %a\n", Field, Bits, Nibbles[Value & 0xf], 
Description);
+}
+
+VOID
+PrintSpacer (
+  VOID
+  )
+{
+  AsciiPrint 
("--|---|---|--\n");
+}
+
+VOID
+HandleAa64Mmfr0 (
+  CONST UINT64  Aa64Mmfr0
+  )
+{
+  UINT64  Value;
+  STATIC CONST CHAR8  RegName[] = "ID_AA64MMFR0";
+  CONST CHAR8 *Description;
+  CONST CHAR8 *Bits;
+
+  Bits  = "3:0 ";
+  Value = Aa64Mmfr0 & 0xf;
+  switch (Value) {
+case b:
+  Description = "32 Bits  (4GB) of physical address range supported.";
+  break;
+case b0001:
+  Description = "36 Bits  (64GB) of physical address range supported.";
+  break;
+case b0010:
+  Description = "40 Bits  (1TB) of physical address range supported.";
+  break;
+case b0011:
+  Description = "42 Bits  (4TB) of physical address range supported.";
+  break;
+case b0100:
+  Description = "44 Bits  (16TB) of physical address range supported.";
+  break;
+case b0101:
+  Description = "48 Bits  (256TB) of physical address range supported.";
+  break;
+case b0110:
+  Description = "52 Bits  (4PB) of physical address range supported.";
+  break;
+default:
+  Description = "unknown";
+  break;
+  }
+
+  PrintValues (RegName, Bits, Value, Description);
+  if (Value == b0110) {
+PrintText ("", "", "", "FEAT_LPA implemented.");
+  }
+
+  Bits  = "7:4 ";
+  Value = (Aa64Mmfr0 >>  4) & 0xf;
+  switch (Value) {
+case b:
+  Description = "ASID: 8 Bits";
+  break;
+case b0010:
+  Description = "ASID: 16 Bits";
+  break;
+default:
+  Description = "unknown";
+  break;
+  }
+
+  PrintValues (RegName, Bits, 

[edk2-devel] [PATCH v6 1/2] ArmLib: add functions to read system registers

2023-04-20 Thread Marcin Juszkiewicz
ArmCpuInfo uses those to read system registers and other parts of EDK2
may find them useful.

Signed-off-by: Marcin Juszkiewicz 
---
 ArmPkg/Library/ArmLib/AArch64/AArch64Lib.h| 50 +++-
 .../Library/ArmLib/AArch64/AArch64Support.S   | 58 ---
 2 files changed, 99 insertions(+), 9 deletions(-)

diff --git a/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.h 
b/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.h
index 330481fc50db..6380a019ddc5 100644
--- a/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.h
+++ b/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.h
@@ -40,7 +40,43 @@ ArmCleanInvalidateDataCacheEntryBySetWay (
 
 UINTN
 EFIAPI
-ArmReadIdAA64Pfr0 (
+ArmReadIdAA64Dfr0 (
+  VOID
+  );
+
+UINTN
+EFIAPI
+ArmReadIdAA64Dfr1 (
+  VOID
+  );
+
+UINTN
+EFIAPI
+ArmReadIdAA64Isar0 (
+  VOID
+  );
+
+UINTN
+EFIAPI
+ArmReadIdAA64Isar1 (
+  VOID
+  );
+
+UINTN
+EFIAPI
+ArmReadIdAA64Isar2 (
+  VOID
+  );
+
+UINTN
+EFIAPI
+ArmReadIdAA64Mmfr0 (
+  VOID
+  );
+
+UINTN
+EFIAPI
+ArmReadIdAA64Mmfr1 (
   VOID
   );
 
@@ -54,4 +90,16 @@ ArmReadIdAA64Mmfr2 (
   VOID
   );
 
+UINTN
+EFIAPI
+ArmReadIdAA64Pfr0 (
+  VOID
+  );
+
+UINTN
+EFIAPI
+ArmReadIdAA64Pfr1 (
+  VOID
+  );
+
 #endif // AARCH64_LIB_H_
diff --git a/ArmPkg/Library/ArmLib/AArch64/AArch64Support.S 
b/ArmPkg/Library/ArmLib/AArch64/AArch64Support.S
index d3cc1e86716b..a7111e51882c 100644
--- a/ArmPkg/Library/ArmLib/AArch64/AArch64Support.S
+++ b/ArmPkg/Library/ArmLib/AArch64/AArch64Support.S
@@ -425,10 +425,6 @@ ASM_FUNC(ArmCallWFI)
   wfi
   ret
 
-ASM_FUNC(ArmReadIdAA64Mmfr2)
-  mrs   x0, ID_AA64MMFR2_EL1   // read EL1 MMFR2
-  ret
-
 ASM_FUNC(ArmReadMpidr)
   mrs   x0, mpidr_el1   // read EL1 MPIDR
   ret
@@ -452,10 +448,6 @@ ASM_FUNC(ArmIsArchTimerImplemented)
   ret
 
 
-ASM_FUNC(ArmReadIdAA64Pfr0)
-  mrs   x0, id_aa64pfr0_el1   // Read ID_AA64PFR0 Register
-  ret
-
 
 // VOID ArmWriteHcr(UINTN Hcr)
 ASM_FUNC(ArmWriteHcr)
@@ -482,4 +474,54 @@ ASM_FUNC(ArmWriteCntHctl)
   msr   cnthctl_el2, x0
   ret
 
+
+ASM_FUNC(ArmReadIdAA64Dfr0)
+  mrs   x0, ID_AA64DFR0_EL1
+  ret
+
+
+ASM_FUNC(ArmReadIdAA64Dfr1)
+  mrs   x0, ID_AA64DFR1_EL1
+  ret
+
+
+ASM_FUNC(ArmReadIdAA64Isar0)
+  mrs   x0, ID_AA64ISAR0_EL1
+  ret
+
+
+ASM_FUNC(ArmReadIdAA64Isar1)
+  mrs   x0, ID_AA64ISAR1_EL1
+  ret
+
+
+ASM_FUNC(ArmReadIdAA64Isar2)
+  mrs   x0, ID_AA64ISAR2_EL1
+  ret
+
+
+ASM_FUNC(ArmReadIdAA64Mmfr0)
+  mrs   x0, ID_AA64MMFR0_EL1
+  ret
+
+
+ASM_FUNC(ArmReadIdAA64Mmfr1)
+  mrs   x0, ID_AA64MMFR1_EL1
+  ret
+
+
+ASM_FUNC(ArmReadIdAA64Mmfr2)
+  mrs   x0, ID_AA64MMFR2_EL1
+  ret
+
+
+ASM_FUNC(ArmReadIdAA64Pfr0)
+  mrs   x0, ID_AA64PFR0_EL1
+  ret
+
+
+ASM_FUNC(ArmReadIdAA64Pfr1)
+  mrs   x0, ID_AA64PFR1_EL1
+  ret
+
 ASM_FUNCTION_REMOVE_IF_UNREFERENCED
-- 
2.40.0



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




Re: [edk2-devel] [PATCH v5 2/2] add ArmCpuInfo EFI application

2023-04-20 Thread Marcin Juszkiewicz

W dniu 20.04.2023 o 14:43, Leif Lindholm pisze:

On Fri, Apr 07, 2023 at 17:29:57 +0200, Marcin Juszkiewicz wrote:



+#
+#  This flag specifies whether HII resource section is generated into PE image.
+#
+  UEFI_HII_RESOURCE_SECTION  = TRUE


The above stanza, and its comment, can be dropped.
This relates to native language support, which there isn't any in this app.


done



+VOID
+PrintText (
+  CONST CHAR8  *field,


For coding style, name should be "*Field".


done, in all places


+  CONST CHAR8  *Bits,
+  CONST UINT8  Value,
+  CONST CHAR8  *Description
+  )
+{
+  STATIC CONST CHAR8  binaries[][5] = {


Could I propose renaming "binaries" to "Nibbles", since this is an
array holding string values for all possible nibbles?


done


+"", "0001", "0010", "0011", "0100", "0101", "0110", "0111",
+"1000", "1001", "1010", "1011", "1100", "1101", "1110", ""
+  };



+  switch (Value) {
+case 0b:


I agree with Pedro's concern w.r.t. binary literals being a GCC
extension. But I also think this is the most appropriate
representation since this is how it's documented in the ARM ARM.

A bit hacky, but could we do

enum {
   b,
   b0001,
   ...
   b
};

and then use those instead?

(you can build with -pedantic to verify you catch them all)


done, passed with -pedantic


+  // only valid for BigEnd != 0b


Could we possibly reword as
   // If mixed-endian support is present, check whether supported at EL0


done



+case 0b0001: // add FEAT_LPA2 check


That's sounds like a TODO. And we don't want TODOs in code.
Can we either drop the comment, add the check, or skip the test?
(That is my order of preference - we shouldn't need to be verifying
architectural compliance.)


dropped


+case 0b0010: // add FEAT_LPA2 check


Same comment as for 4k.


dropped as well


+  Bits  = "59:56";
+  Value = (Aa64Pfr0 >> 56) & 0xf;
+  switch (Value) {
+case 0b:
+  Description = "no info is FEAT_CSV2 implemented.";


Consider rewording.
Is the text from the ARM ARM too long?
"The implementation does not disclose whether FEAT_CSV2 is
implemented."
if so, maybe
"Not disclosed whether FEAT_CSV2 is implemented."?


thx, done


+  PrintValues (RegName, Bits, Value, Description);
+
+  // 35:32 is CSV2_frac


That's a TODO.


Is it more info why those bits are not handled here. Same with 15:12 for 
RAS_frac and 19:16 for MPAM_frac. They are not reserved like 63:40 are.


And CSV2_frac bits are used earlier, in PRF0 handling. If we have CSV2 
implemented then CSV2_frac says do we have CSV2_1p1 or CSV2_1p2 implemented.


MPAM_frac and RAS_frac are used in PRF0 handling as well.


+EFI_STATUS
+EFIAPI
+UefiMain  (


Stray space before '(' here too. Is it an editor setting?


fixed


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

2023-04-20 Thread Gupta, Pankaj via groups.io




libvirt snippet (add to ):

  

  

Was thinking about the motivation to add the virtio serial device.

AFAIU this can provide a console in bios/early boot based on "virtio".
Currently we can only get it with emulated PTY device which is slow
because of frequent VMEXITS because of ioport write?


Yes, it has better performance because it wouldn't vmexit for every
single character.

Dawback is that it wouldn't work for early logging, the driver loads
relatively late because it depends on pci and virtio.  So if the
firmware panics in SEC or PEI you wouldn't see that.

So for debug logging it isn't the best choice, for efi shell and grub it
works fine.


Sure.




Or is there any other reason (e.g across the ARCH support) to add this
support in UEFI ?


Should work on all architectures, although it needs some platform setup
code to have the firmware actually bind the firmware console to it (see
patch #4). >
Another nice property of a virtio console is that systemd will spawn a
getty there even if it is not explicitly configured as console device.


Nice.

Thanks,
Pankaj



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




Re: [edk2-devel] [edk2-platforms][PATCH V2 02/14] ManageabilityPkg: Support Maximum Transfer Unit

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

Reviewed-by: Abdul Lateef Attar 

-Original Message-
From: Chang, Abner 
Sent: 18 April 2023 12:46
To: devel@edk2.groups.io
Cc: Isaac Oram ; Attar, AbdulLateef (Abdul Lateef) 
; Nickle Wang ; Igor Kulchytskyy 

Subject: [edk2-platforms][PATCH V2 02/14] ManageabilityPkg: Support Maximum 
Transfer Unit

From: Abner Chang 

Update GetTransportCapability to support Maximum Transfer Unit (MTU) of 
transport interface.

Signed-off-by: Abner Chang 
Cc: Isaac Oram 
Cc: Abdul Lateef Attar 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
---
 .../Library/ManageabilityTransportLib.h   | 33 ---
 .../Common/ManageabilityTransportKcs.h|  2 +
 .../IpmiProtocol/Pei/IpmiPpiInternal.h|  8 ++-
 .../BaseManageabilityTransportNull.c  | 18 --
 .../Dxe/ManageabilityTransportKcs.c   | 57 +++
 .../Universal/IpmiProtocol/Dxe/IpmiProtocol.c | 24 ++--
 .../Universal/IpmiProtocol/Pei/IpmiPpi.c  | 51 ++---
 .../Universal/IpmiProtocol/Smm/IpmiProtocol.c | 24 ++--
 8 files changed, 145 insertions(+), 72 deletions(-)

diff --git 
a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h 
b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h
index c022b4ac5c..d86d0d87d5 100644
--- a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h
+++ b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLi
+++ b.h
@@ -14,6 +14,9 @@
 #define MANAGEABILITY_TRANSPORT_TOKEN_VERSION
((MANAGEABILITY_TRANSPORT_TOKEN_VERSION_MAJOR << 8) |\
 
MANAGEABILITY_TRANSPORT_TOKEN_VERSION_MINOR)

+#define MANAGEABILITY_TRANSPORT_PAYLOAD_SIZE_FROM_CAPABILITY(a)  (1 << ((a & 
MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_MASK) >>\
+
+MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_BIT_POSITION))
+
 typedef struct  _MANAGEABILITY_TRANSPORT_FUNCTION_V1_0  
MANAGEABILITY_TRANSPORT_FUNCTION_V1_0;
 typedef struct  _MANAGEABILITY_TRANSPORT
MANAGEABILITY_TRANSPORT;
 typedef struct  _MANAGEABILITY_TRANSPORT_TOKEN  
MANAGEABILITY_TRANSPORT_TOKEN;
@@ -68,8 +71,17 @@ typedef UINT32 MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS;
 /// Additional transport interface features.
 ///
 typedef UINT32 MANAGEABILITY_TRANSPORT_CAPABILITY;
+/// Bit 0
 #define MANAGEABILITY_TRANSPORT_CAPABILITY_MULTIPLE_TRANSFER_TOKENS  0x0001
-#define MANAGEABILITY_TRANSPORT_CAPABILITY_ASYNCHRONOUS_TRANSFER 0x0002
+/// Bit 1
+#define MANAGEABILITY_TRANSPORT_CAPABILITY_ASYNCHRONOUS_TRANSFER  0x0002
+/// Bit 2   - Reserved
+/// Bit 7:3 - Transport interface maximum payload size, which is (2 ^ bit[7:3] 
- 1)
+///   bit[7:3] means no maximum payload.
+#define MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_MASK   
0x00f8
+#define MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_BIT_POSITION   3
+#define
+MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_NOT_AVAILABLE  0x00
+/// Bit 8:31 - Reserved

 ///
 /// Definitions of Manageability transport interface functions.
@@ -187,15 +199,20 @@ AcquireTransportSession (
   );

 /**
-  This function returns the transport capabilities.
-
-  @param [out]  TransportFeaturePointer to receive transport 
capabilities.
-See the definitions of
-MANAGEABILITY_TRANSPORT_CAPABILITY.
-
+  This function returns the transport capabilities according to  the
+ manageability protocol.
+
+  @param [in]   TransportToken Transport token acquired from 
manageability
+   transport library.
+  @param [out]  TransportFeature   Pointer to receive transport 
capabilities.
+   See the definitions of
+   MANAGEABILITY_TRANSPORT_CAPABILITY.
+  @retval   EFI_SUCCESSTransportCapability is returned 
successfully.
+  @retval   EFI_INVALID_PARAMETER  TransportToken is not a valid token.
 **/
-VOID
+EFI_STATUS
 GetTransportCapability (
+  IN MANAGEABILITY_TRANSPORT_TOKEN*TransportToken,
   OUT MANAGEABILITY_TRANSPORT_CAPABILITY  *TransportCapability
   );

diff --git 
a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/ManageabilityTransportKcs.h
 
b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/ManageabilityTransportKcs.h
index f1758ffd8f..2cdf60ba7e 100644
--- 
a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/ManageabilityTransportKcs.h
+++ b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Com
+++ mon/ManageabilityTransportKcs.h
@@ -32,6 +32,8 @@ typedef struct {
 #define IPMI_KCS_GET_STATE(s)  (s >> 6)  #define IPMI_KCS_SET_STATE(s)  (s << 
6)

+#define MCTP_KCS_MTU_IN_POWER_OF_2  8
+
 /// 5 sec, according to IPMI spec
 #define IPMI_KCS_TIMEOUT_5_SEC  

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

2023-04-20 Thread Minh Nguyen OS via groups.io
Hi Chang,

  It seems like my email has the problem, please expect the delay for my v2 
patches while my email's fixing. Thanks for your patience.

Thanks,
Minh Nguyen

From: Chang, Abner 
Sent: Sunday, April 16, 2023 11:36 AM
To: Minh Nguyen OS ; devel@edk2.groups.io 

Cc: Open Source Submission ; nick...@nvidia.com 
; ig...@ami.com ; Nhi Pham OS 
; Tinh Nguyen OS 
; Vu Nguyen OS 

Subject: RE: [PATCH 3/5] RedfishPkg: Create RestEx child on selected interface

[AMD Official Use Only - General]

Hi Minh,
That is weird I can't find this patch set on group.io, and I can't apply this 
patch from email neither. Could you please check it?

Thanks
Abner

> -Original Message-
> From: Minh Nguyen 
> Sent: Friday, April 14, 2023 4:19 PM
> To: devel@edk2.groups.io
> Cc: patc...@amperecomputing.com; Chang, Abner
> ; nick...@nvidia.com; ig...@ami.com;
> n...@os.amperecomputing.com; tinhngu...@os.amperecomputing.com; Vu
> Nguyen ; Minh Nguyen
> 
> Subject: [PATCH 3/5] RedfishPkg: Create RestEx child on selected interface
>
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
>
>
> 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.
> -  //
> - 

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

2023-04-20 Thread Minh Nguyen OS via groups.io
Hi Chang,

 Yes, this is the first time and the issue comes from my internal mail and 
waiting for fixing. Thanks for that information and will check with 
miki.deme...@intel.com as well.

Thanks,
Minh Nguyen.

From: Chang, Abner 
Sent: Thursday, April 20, 2023 8:28 AM
To: Minh Nguyen OS ; devel@edk2.groups.io 

Cc: Open Source Submission ; nick...@nvidia.com 
; ig...@ami.com ; Nhi Pham OS 
; Tinh Nguyen OS 
; Vu Nguyen OS 

Subject: Re: [PATCH 3/5] RedfishPkg: Create RestEx child on selected interface


[AMD Official Use Only - General]

Hi Minh,
Is this the first time you send email to groups.io, if yes please also check it 
with Miki
miki.deme...@intel.com to confirm is your mail passed through groups.io or not.

Thanks
Abner


Get Outlook for Android


From: Minh Nguyen OS 
Sent: Thursday, April 20, 2023, 9:23 AM
To: Chang, Abner ; devel@edk2.groups.io 

Cc: Open Source Submission ; nick...@nvidia.com 
; ig...@ami.com ; Nhi Pham OS 
; Tinh Nguyen OS 
; Vu Nguyen OS 

Subject: Re: [PATCH 3/5] RedfishPkg: Create RestEx child on selected interface

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

Hi Chang,

  It seems like my email has the problem, please expect the delay for my v2 
patches while my email's fixing. Thanks for your patience.

Thanks,
Minh Nguyen

From: Chang, Abner 
Sent: Sunday, April 16, 2023 11:36 AM
To: Minh Nguyen OS ; devel@edk2.groups.io 

Cc: Open Source Submission ; nick...@nvidia.com 
; ig...@ami.com ; Nhi Pham OS 
; Tinh Nguyen OS 
; Vu Nguyen OS 

Subject: RE: [PATCH 3/5] RedfishPkg: Create RestEx child on selected interface

[AMD Official Use Only - General]

Hi Minh,
That is weird I can't find this patch set on group.io, and I can't apply this 
patch from email neither. Could you please check it?

Thanks
Abner

> -Original Message-
> From: Minh Nguyen 
> Sent: Friday, April 14, 2023 4:19 PM
> To: devel@edk2.groups.io
> Cc: patc...@amperecomputing.com; Chang, Abner
> ; nick...@nvidia.com; ig...@ami.com;
> n...@os.amperecomputing.com; tinhngu...@os.amperecomputing.com; Vu
> Nguyen ; Minh Nguyen
> 
> Subject: [PATCH 3/5] RedfishPkg: Create RestEx child on selected interface
>
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
>
>
> 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: 

[edk2-devel] [PATCH] UefiPayloadPkg: Move Network modules from Dxe FV to Network FV in elf

2023-04-20 Thread linusx . wu
From: Linus Wu 

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

Since UefiPayload had supported multiple FV,
move Network.fdf.inc to new firmware volume and
add this network FV into elf file.

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

Signed-off-by: Linus Wu 
---
 UefiPayloadPkg/UefiPayloadPkg.fdf   | 32 +++--
 UefiPayloadPkg/UniversalPayloadBuild.py | 12 ++
 2 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf 
b/UefiPayloadPkg/UefiPayloadPkg.fdf
index ee7d718b3f..f8c2aa8c4a 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.fdf
+++ b/UefiPayloadPkg/UefiPayloadPkg.fdf
@@ -60,6 +60,35 @@ FILE FV_IMAGE = 4E35FD93-9C72-4c15-8C4B-E77F1DB2D793 {
 SECTION FV_IMAGE = DXEFV
 }
 
+!if $(NETWORK_DRIVER_ENABLE) == TRUE
+
+[FV.NETWORKFV]
+FvNameGuid = 3CF5CB69-C439-4B84-AF11-8167B22D7221
+BlockSize  = $(FD_BLOCK_SIZE)
+FvForceRebase  = FALSE
+FvAlignment= 16
+ERASE_POLARITY = 1
+MEMORY_MAPPED  = TRUE
+STICKY_WRITE   = TRUE
+LOCK_CAP   = TRUE
+LOCK_STATUS= TRUE
+WRITE_DISABLED_CAP = TRUE
+WRITE_ENABLED_CAP  = TRUE
+WRITE_STATUS   = TRUE
+WRITE_LOCK_CAP = TRUE
+WRITE_LOCK_STATUS  = TRUE
+READ_DISABLED_CAP  = TRUE
+READ_ENABLED_CAP   = TRUE
+READ_STATUS= TRUE
+READ_LOCK_CAP  = TRUE
+READ_LOCK_STATUS   = TRUE
+
+#
+# UEFI network modules
+#
+!include NetworkPkg/Network.fdf.inc
+!endif
+
 

 [FV.BDSFV]
 FvNameGuid = CA5590AF-9558-4822-B5EA-BE2E876CD3EC
@@ -276,14 +305,13 @@ INF  
MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResour
 
 !if $(UNIVERSAL_PAYLOAD) == FALSE
 INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
-!endif
-
 #
 # UEFI network modules
 #
 !if $(NETWORK_DRIVER_ENABLE) == TRUE
   !include NetworkPkg/Network.fdf.inc
 !endif
+!endif
 
 #
 # Shell
diff --git a/UefiPayloadPkg/UniversalPayloadBuild.py 
b/UefiPayloadPkg/UniversalPayloadBuild.py
index db7ce0500b..83e0de95d8 100644
--- a/UefiPayloadPkg/UniversalPayloadBuild.py
+++ b/UefiPayloadPkg/UniversalPayloadBuild.py
@@ -108,6 +108,7 @@ def BuildUniversalPayload(Args, MacroList):
 DscPath = os.path.normpath("UefiPayloadPkg/UefiPayloadPkg.dsc")
 DxeFvOutputDir = os.path.join(BuildDir, "{}_{}".format (BuildTarget, 
ToolChain), os.path.normpath("FV/DXEFV.Fv"))
 BdsFvOutputDir = os.path.join(BuildDir, "{}_{}".format (BuildTarget, 
ToolChain), os.path.normpath("FV/BDSFV.Fv"))
+NetworkFvOutputDir = os.path.join(BuildDir, "{}_{}".format (BuildTarget, 
ToolChain), os.path.normpath("FV/NETWORKFV.Fv"))
 PayloadReportPath = os.path.join(BuildDir, "UefiUniversalPayload.txt")
 ModuleReportPath = os.path.join(BuildDir, "UefiUniversalPayloadEntry.txt")
 UpldInfoFile = os.path.join(BuildDir, "UniversalPayloadInfo.bin")
@@ -185,6 +186,17 @@ def BuildUniversalPayload(Args, MacroList):
ObjCopyFlag,
EntryOutputDir
)
+#
+# Append network fv to sections if exists
+#
+if os.path.isfile(NetworkFvOutputDir):
+index = remove_section.find(EntryOutputDir)
+remove_section = remove_section[:index] + '--remove-section 
.upld.network_fv ' + remove_section[index:]
+index = add_section.find(EntryOutputDir)
+add_section = add_section[:index] + '--add-section 
.upld.network_fv=' + NetworkFvOutputDir + ' ' + add_section[index:]
+index = set_section.find(EntryOutputDir)
+set_section = set_section[:index] + '--set-section-alignment 
.upld.network_fv=16 ' + set_section[index:]
+
 RunCommand(remove_section)
 RunCommand(add_section)
 RunCommand(set_section)
-- 
2.39.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103304): https://edk2.groups.io/g/devel/message/103304
Mute This Topic: https://groups.io/mt/98384854/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 V2 01/14] ManageabilityPkg: Add more helper functions

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

Comments inline.

-Original Message-
From: Chang, Abner 
Sent: 18 April 2023 12:46
To: devel@edk2.groups.io
Cc: Isaac Oram ; Attar, AbdulLateef (Abdul Lateef) 
; Nickle Wang ; Igor Kulchytskyy 

Subject: [edk2-platforms][PATCH V2 01/14] ManageabilityPkg: Add more helper 
functions

From: Abner Chang 

1. Add a helper function to output payload binary
   to debug output device.
2. Add a helper function to split payload into
   packages according to maximum transfer unit
   of transport interface.
3. Add a helper function to generate CRC8.

Signed-off-by: Abner Chang 
Cc: Isaac Oram 
Cc: Abdul Lateef Attar 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
---
 .../BaseManageabilityTransportHelper.inf  |   1 +
 .../Library/ManageabilityTransportHelperLib.h |  98 
 .../BaseManageabilityTransportHelper.c| 225 +-
 3 files changed, 314 insertions(+), 10 deletions(-)

diff --git 
a/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.inf
 
b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.inf
index 5447954144..c9e5eaef60 100644
--- 
a/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.inf
+++ b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelper
+++ Lib/BaseManageabilityTransportHelper.inf
@@ -25,6 +25,7 @@
 [LibraryClasses]
   BaseMemoryLib
   DebugLib
+  MemoryAllocationLib

 [Packages]
   ManageabilityPkg/ManageabilityPkg.dec
diff --git 
a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportHelperLib.h 
b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportHelperLib.h
index 718ac34a1f..0dbf5ccb3c 100644
--- 
a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportHelperLib.h
+++ b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportHe
+++ lperLib.h
@@ -11,8 +11,24 @@

 #include 

+#define DEBUG_MANAGEABILITY_INFO  DEBUG_INFO
+
 typedef struct _MANAGEABILITY_PROTOCOL_NAME MANAGEABILITY_PROTOCOL_NAME;

+typedef struct {
+  UINT8 *PayloadPointer;
+  UINT32PayloadSize;
+} MANAGEABILITY_TRANSMISSION_PACKAGE_ATTR;
+
+//
+// The information of multi portions of payload it is // splitted
+according to transport interface Maximum // Transfer Unit.
+typedef struct {
+  UINT16 NumberOfPackages; ///< Number of 
packages in MultiPackages.
+  MANAGEABILITY_TRANSMISSION_PACKAGE_ATTRMultiPackages[];
+} MANAGEABILITY_TRANSMISSION_MULTI_PACKAGES;
+
 /**
   Helper function returns the human readable name of Manageability 
specification.

@@ -90,4 +106,86 @@ HelperInitManageabilityTransport (
   OUT MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS *TransportAdditionalStatus 
OPTIONAL
   );

+/**
+  This function splits payload into multiple packages according to
+  the given transport interface Maximum Transfer Unit (MTU).
+
+  @param[in]  PreambleSize The additional data size precedes
+   each package.
+  @param[in]  PostambleSizeThe additional data size succeeds
+   each package.
+  @param[in]  Payload  Pointer to payload.
+  @param[in]  PayloadSize  Payload size in byte.
+  @param[in]  MaximumTransferUnit  MTU of transport interface.
+  @param[out] MultiplePackages Pointer to receive
+   MANAGEABILITY_TRANSMISSION_MULTI_PACKAGES
+   structure. Caller has to free the memory
+   allocated for 
MANAGEABILITY_TRANSMISSION_MULTI_PACKAGES.
+
+  @retval   EFI_SUCCESS  MANAGEABILITY_TRANSMISSION_MULTI_PACKAGES 
structure
+ is returned successfully.
+  @retval   EFI_OUT_OF_RESOURCE  Not enough resource to create
+ MANAGEABILITY_TRANSMISSION_MULTI_PACKAGES 
structure.
+**/
+EFI_STATUS
EFIAPI missing, is it intentional?
+HelperManageabilitySplitPayload (
+  IN UINT16  PreambleSize,
+  IN UINT16  PostambleSize,
+  IN UINT8   *Payload,
+  IN UINT32  PayloadSize,
+  IN UINT32  MaximumTransferUnit,
+  OUT MANAGEABILITY_TRANSMISSION_MULTI_PACKAGES  **MultiplePackages
+  );
+
+/**
+  This function generates CRC8 with given polynomial.
+
+  @param[in]  Polynomial   Polynomial in 8-bit.
+  @param[in]  CrcInitialValue  CRC initial value.
+  @param[in]  BufferStart  Pointer to buffer starts the CRC calculation.
+  @param[in]  BufferSize   Size of buffer.
+
+  @retval  UINT8 CRC value.
+**/
+UINT8
EFIAPI is missing, its common header file.
+HelperManageabilityGenerateCrc8 (
+  IN UINT8   Polynomial,
+  IN UINT8   CrcInitialValue,
+  IN UINT8   *BufferStart,
+  IN 

Re: [edk2-devel] [PATCH v5 2/2] add ArmCpuInfo EFI application

2023-04-20 Thread Leif Lindholm
On Fri, Apr 07, 2023 at 17:29:57 +0200, Marcin Juszkiewicz wrote:
> App goes through ID_AA64*_EL1 system registers and decode their values.
> 
> Signed-off-by: Marcin Juszkiewicz 
> ---
>  ArmPkg/ArmPkg.dsc|1 +
>  ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.inf |   38 +
>  ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.c   | 2319 ++
>  3 files changed, 2358 insertions(+)
>  create mode 100644 ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.inf
>  create mode 100644 ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.c
> 
> diff --git a/ArmPkg/ArmPkg.dsc b/ArmPkg/ArmPkg.dsc
> index 3fb95d1951a9..6b938ce8b671 100644
> --- a/ArmPkg/ArmPkg.dsc
> +++ b/ArmPkg/ArmPkg.dsc
> @@ -166,6 +166,7 @@ [Components.AARCH64]
>ArmPkg/Drivers/ArmPsciMpServicesDxe/ArmPsciMpServicesDxe.inf
>ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf
>ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf
> +  ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.inf
>  
>  [Components.AARCH64, Components.ARM]
>ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.inf
> diff --git a/ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.inf 
> b/ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.inf
> new file mode 100644
> index ..c6f634cd01b7
> --- /dev/null
> +++ b/ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.inf
> @@ -0,0 +1,38 @@
> +## @file
> +#
> +#  Attempt to have AArch64 cpu information.
> +#
> +#  Based on HelloWorld:
> +#  Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
> +#  Copyright (c) 2023 Marcin Juszkiewicz
> +#
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +#
> +##
> +
> +[Defines]
> +  INF_VERSION= 0x00010019
> +  BASE_NAME  = ArmCpuInfo
> +  FILE_GUID  = b3134491-6502-4faf-a9da-007184e32163
> +  MODULE_TYPE= UEFI_APPLICATION
> +  VERSION_STRING = 1.0
> +  ENTRY_POINT= UefiMain
> +
> +#
> +#  This flag specifies whether HII resource section is generated into PE 
> image.
> +#
> +  UEFI_HII_RESOURCE_SECTION  = TRUE

The above stanza, and its comment, can be dropped.
This relates to native language support, which there isn't any in this app.

> +
> +[Sources]
> +  ArmCpuInfo.c
> +
> +[Packages]
> +  ArmPkg/ArmPkg.dec
> +  MdePkg/MdePkg.dec
> +  MdeModulePkg/MdeModulePkg.dec
> +
> +[LibraryClasses]
> +  ArmLib
> +  UefiApplicationEntryPoint
> +  UefiLib
> diff --git a/ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.c 
> b/ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.c
> new file mode 100644
> index ..2fc12059f727
> --- /dev/null
> +++ b/ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.c
> @@ -0,0 +1,2319 @@
> +/** @file
> +
> +  Copyright  (c) 2023 Marcin Juszkiewicz
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> + **/
> +
> +#include 
> +#include 
> +
> +VOID
> +PrintText (
> +  CONST CHAR8  *field,

For coding style, name should be "*Field".

> +  CONST CHAR8  *Bits,
> +  CONST CHAR8  *Value,
> +  CONST CHAR8  *Description
> +  )
> +{
> +  AsciiPrint (" %-16a | %5a | %5a | %a\n", field, Bits, Value, Description);
> +}
> +
> +VOID
> +PrintValues (
> +  CONST CHAR8  *field,

"*Field"

> +  CONST CHAR8  *Bits,
> +  CONST UINT8  Value,
> +  CONST CHAR8  *Description
> +  )
> +{
> +  STATIC CONST CHAR8  binaries[][5] = {

Could I propose renaming "binaries" to "Nibbles", since this is an
array holding string values for all possible nibbles?

> +"", "0001", "0010", "0011", "0100", "0101", "0110", "0111",
> +"1000", "1001", "1010", "1011", "1100", "1101", "1110", ""
> +  };
> +
> +  AsciiPrint (" %-16a | %5a | %5a | %a\n", field, Bits, binaries[Value & 
> 0xf], Description);
> +}
> +
> +VOID
> +PrintSpacer (
> +  VOID
> +  )
> +{
> +  AsciiPrint 
> ("--|---|---|--\n");
> +}
> +
> +VOID
> +HandleAa64Mmfr0 (
> +  CONST UINT64  Aa64Mmfr0
> +  )
> +{
> +  UINT64  Value;
> +  STATIC CONST CHAR8  RegName[] = "ID_AA64MMFR0";
> +  CONST CHAR8 *Description;
> +  CONST CHAR8 *Bits;
> +
> +  Bits  = "3:0 ";
> +  Value = Aa64Mmfr0 & 0xf;
> +  switch (Value) {
> +case 0b:

I agree with Pedro's concern w.r.t. binary literals being a GCC
extension. But I also think this is the most appropriate
representation since this is how it's documented in the ARM ARM.

A bit hacky, but could we do

enum {
  b,
  b0001,
  ...
  b
};

and then use those instead?

(you can build with -pedantic to verify you catch them all)

> +  Description = "32 Bits  (4GB) of physical address range supported.";
> +  break;
> +case 0b0001:
> +  Description = "36 Bits  (64GB) of physical address range supported.";
> +  break;
> +case 0b0010:
> +  Description = "40 Bits  (1TB) of physical address range supported.";
> +  break;
> +case 0b0011:
> +  Description = "42 Bits  (4TB) of physical address range supported.";
> +  break;
> +case 0b0100:
> +   

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

2023-04-20 Thread Gerd Hoffmann
  Hi,

> > libvirt snippet (add to ):
> > 
> >  
> >
> >  
> Was thinking about the motivation to add the virtio serial device.
> 
> AFAIU this can provide a console in bios/early boot based on "virtio".
> Currently we can only get it with emulated PTY device which is slow
> because of frequent VMEXITS because of ioport write?

Yes, it has better performance because it wouldn't vmexit for every
single character.

Dawback is that it wouldn't work for early logging, the driver loads
relatively late because it depends on pci and virtio.  So if the
firmware panics in SEC or PEI you wouldn't see that.

So for debug logging it isn't the best choice, for efi shell and grub it
works fine.

> Or is there any other reason (e.g across the ARCH support) to add this
> support in UEFI ?

Should work on all architectures, although it needs some platform setup
code to have the firmware actually bind the firmware console to it (see
patch #4).

Another nice property of a virtio console is that systemd will spawn a
getty there even if it is not explicitly configured as console device.

take care,
  Gerd



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




Re: [edk2-devel] [PATCH v5 1/2] ArmLib: add functions to read system registers

2023-04-20 Thread Leif Lindholm
On Fri, Apr 07, 2023 at 17:29:56 +0200, Marcin Juszkiewicz wrote:
> ArmCpuInfo uses those to read system registers and other parts of EDK2
> may find them useful.

This is excellent, thanks!
Sorry for nitpicking, but could you please sort the function
declarations and definitions alphabetically?

/
Leif

> Signed-off-by: Marcin Juszkiewicz 
> ---
>  ArmPkg/Library/ArmLib/AArch64/AArch64Lib.h| 48 +++
>  .../Library/ArmLib/AArch64/AArch64Support.S   | 32 +
>  2 files changed, 80 insertions(+)
> 
> diff --git a/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.h 
> b/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.h
> index 330481fc50db..d9744a66cdcf 100644
> --- a/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.h
> +++ b/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.h
> @@ -44,6 +44,54 @@ ArmReadIdAA64Pfr0 (
>VOID
>);
>  
> +UINTN
> +EFIAPI
> +ArmReadIdAA64Pfr1 (
> +  VOID
> +  );
> +
> +UINTN
> +EFIAPI
> +ArmReadIdAA64Dfr0 (
> +  VOID
> +  );
> +
> +UINTN
> +EFIAPI
> +ArmReadIdAA64Dfr1 (
> +  VOID
> +  );
> +
> +UINTN
> +EFIAPI
> +ArmReadIdAA64Isar0 (
> +  VOID
> +  );
> +
> +UINTN
> +EFIAPI
> +ArmReadIdAA64Isar1 (
> +  VOID
> +  );
> +
> +UINTN
> +EFIAPI
> +ArmReadIdAA64Isar2 (
> +  VOID
> +  );
> +
> +UINTN
> +EFIAPI
> +ArmReadIdAA64Mmfr0 (
> +  VOID
> +  );
> +
> +UINTN
> +EFIAPI
> +ArmReadIdAA64Mmfr1 (
> +  VOID
> +  );
> +
>  /** Reads the ID_AA64MMFR2_EL1 register.
>  
> @return The contents of the ID_AA64MMFR2_EL1 register.
> diff --git a/ArmPkg/Library/ArmLib/AArch64/AArch64Support.S 
> b/ArmPkg/Library/ArmLib/AArch64/AArch64Support.S
> index d3cc1e86716b..3e8d461bc819 100644
> --- a/ArmPkg/Library/ArmLib/AArch64/AArch64Support.S
> +++ b/ArmPkg/Library/ArmLib/AArch64/AArch64Support.S
> @@ -482,4 +482,36 @@ ASM_FUNC(ArmWriteCntHctl)
>msr   cnthctl_el2, x0
>ret
>  
> +ASM_FUNC(ArmReadIdAA64Pfr1)
> +  mrs   x0, ID_AA64PFR1_EL1
> +  ret
> +
> +ASM_FUNC(ArmReadIdAA64Dfr0)
> +  mrs   x0, ID_AA64DFR0_EL1
> +  ret
> +
> +ASM_FUNC(ArmReadIdAA64Dfr1)
> +  mrs   x0, ID_AA64DFR1_EL1
> +  ret
> +
> +ASM_FUNC(ArmReadIdAA64Isar0)
> +  mrs   x0, ID_AA64ISAR0_EL1
> +  ret
> +
> +ASM_FUNC(ArmReadIdAA64Isar1)
> +  mrs   x0, ID_AA64ISAR1_EL1
> +  ret
> +
> +ASM_FUNC(ArmReadIdAA64Isar2)
> +  mrs   x0, ID_AA64ISAR2_EL1
> +  ret
> +
> +ASM_FUNC(ArmReadIdAA64Mmfr0)
> +  mrs   x0, ID_AA64MMFR0_EL1
> +  ret
> +
> +ASM_FUNC(ArmReadIdAA64Mmfr1)
> +  mrs   x0, ID_AA64MMFR1_EL1
> +  ret
> +
>  ASM_FUNCTION_REMOVE_IF_UNREFERENCED
> -- 
> 2.40.0
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103297): https://edk2.groups.io/g/devel/message/103297
Mute This Topic: https://groups.io/mt/98126603/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] UefiPayloadPkg: Move Network modules from Dxe FV to Network FV in elf

2023-04-20 Thread Lu, James
Reviewed-by: James Lu 


Thanks,
James

-Original Message-
From: Wu, LinusX  
Sent: Thursday, April 20, 2023 3:31 PM
To: devel@edk2.groups.io
Cc: Wu, LinusX ; Dong, Guo ; Ni, Ray 
; Rhodes, Sean ; Lu, James 
; Guo, Gua 
Subject: [PATCH] UefiPayloadPkg: Move Network modules from Dxe FV to Network FV 
in elf

From: Linus Wu 

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

Since UefiPayload had supported multiple FV, move Network.fdf.inc to new 
firmware volume and add this network FV into elf file.

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

Signed-off-by: Linus Wu 
---
 UefiPayloadPkg/UefiPayloadPkg.fdf   | 32 +++--
 UefiPayloadPkg/UniversalPayloadBuild.py | 12 ++
 2 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf 
b/UefiPayloadPkg/UefiPayloadPkg.fdf
index ee7d718b3f..f8c2aa8c4a 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.fdf
+++ b/UefiPayloadPkg/UefiPayloadPkg.fdf
@@ -60,6 +60,35 @@ FILE FV_IMAGE = 4E35FD93-9C72-4c15-8C4B-E77F1DB2D793 {
 SECTION FV_IMAGE = DXEFV } +!if $(NETWORK_DRIVER_ENABLE) == 
TRUE++[FV.NETWORKFV]+FvNameGuid
 = 3CF5CB69-C439-4B84-AF11-8167B22D7221+BlockSize  = 
$(FD_BLOCK_SIZE)+FvForceRebase  = FALSE+FvAlignment= 
16+ERASE_POLARITY = 1+MEMORY_MAPPED  = TRUE+STICKY_WRITE   = 
TRUE+LOCK_CAP   = TRUE+LOCK_STATUS= TRUE+WRITE_DISABLED_CAP = 
TRUE+WRITE_ENABLED_CAP  = TRUE+WRITE_STATUS   = TRUE+WRITE_LOCK_CAP = 
TRUE+WRITE_LOCK_STATUS  = TRUE+READ_DISABLED_CAP  = TRUE+READ_ENABLED_CAP   = 
TRUE+READ_STATUS= TRUE+READ_LOCK_CAP  = TRUE+READ_LOCK_STATUS   = 
TRUE++#+# UEFI network modules+#+!include NetworkPkg/Network.fdf.inc+!endif+ 

 [FV.BDSFV] FvNameGuid = CA5590AF-9558-4822-B5EA-BE2E876CD3EC@@ -276,14 
+305,13 @@ INF  
MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResour
  !if $(UNIVERSAL_PAYLOAD) == FALSE INF 
MdeModulePkg/Universal/BdsDxe/BdsDxe.inf-!endif- # # UEFI network modules # !if 
$(NETWORK_DRIVER_ENABLE) == TRUE   !include NetworkPkg/Network.fdf.inc 
!endif+!endif  # # Shelldiff --git a/UefiPayloadPkg/UniversalPayloadBuild.py 
b/UefiPayloadPkg/UniversalPayloadBuild.py
index db7ce0500b..83e0de95d8 100644
--- a/UefiPayloadPkg/UniversalPayloadBuild.py
+++ b/UefiPayloadPkg/UniversalPayloadBuild.py
@@ -108,6 +108,7 @@ def BuildUniversalPayload(Args, MacroList):
 DscPath = os.path.normpath("UefiPayloadPkg/UefiPayloadPkg.dsc") 
DxeFvOutputDir = os.path.join(BuildDir, "{}_{}".format (BuildTarget, 
ToolChain), os.path.normpath("FV/DXEFV.Fv")) BdsFvOutputDir = 
os.path.join(BuildDir, "{}_{}".format (BuildTarget, ToolChain), 
os.path.normpath("FV/BDSFV.Fv"))+NetworkFvOutputDir = 
os.path.join(BuildDir, "{}_{}".format (BuildTarget, ToolChain), 
os.path.normpath("FV/NETWORKFV.Fv")) PayloadReportPath = 
os.path.join(BuildDir, "UefiUniversalPayload.txt") ModuleReportPath = 
os.path.join(BuildDir, "UefiUniversalPayloadEntry.txt") UpldInfoFile = 
os.path.join(BuildDir, "UniversalPayloadInfo.bin")@@ -185,6 +186,17 @@ def 
BuildUniversalPayload(Args, MacroList):
ObjCopyFlag,
EntryOutputDir)+#+# Append network 
fv to sections if exists+#+if 
os.path.isfile(NetworkFvOutputDir):+index = 
remove_section.find(EntryOutputDir)+remove_section = 
remove_section[:index] + '--remove-section .upld.network_fv ' + 
remove_section[index:]+index = add_section.find(EntryOutputDir)+
add_section = add_section[:index] + '--add-section .upld.network_fv=' + 
NetworkFvOutputDir + ' ' + add_section[index:]+index = 
set_section.find(EntryOutputDir)+set_section = set_section[:index] 
+ '--set-section-alignment .upld.network_fv=16 ' + set_section[index:]+ 
RunCommand(remove_section) RunCommand(add_section) 
RunCommand(set_section)-- 
2.39.1.windows.1



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




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

2023-04-20 Thread Sami Mujawar
Merged as ab9805e0020b..310d31231d69

Regards,

Sami Mujawar


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103295): https://edk2.groups.io/g/devel/message/103295
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] [PATCH 0/4] OvmfPkg: add virtio serial driver

2023-04-20 Thread Gupta, Pankaj via groups.io

Hi Gerd,


This seems useful - how do I use it?


bare qemu (with guest console on stdin/stdout):

qemu-system-x86_64 \
-enable-kvm -nodefaults -display none \
-bios Build/OvmfX64/DEBUG_GCC5/FV/OVMF.fd \
-chardev stdio,id=hvc0 \
-device virtio-serial-pci \
-device virtconsole,chardev=hvc0

libvirt snippet (add to ):

 
   
 

Was thinking about the motivation to add the virtio serial device.

AFAIU this can provide a console in bios/early boot based on "virtio".
Currently we can only get it with emulated PTY device which is slow
because of frequent VMEXITS because of ioport write?

Or is there any other reason (e.g across the ARCH support) to add this 
support in UEFI ?


Thanks,
Pankaj




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




Re: [edk2-devel] [Patch V2 0/8] Use CpuPageTableLib to create and update smm page table

2023-04-20 Thread duntan
Hi Tom,

Thanks for confirming. Is 1G page table supported in your test? If supported, 
there is a reason can explain why this difference exists.
In current upstream master branch:
Smm code always create 2M page table for [0, 4G] range(in Gen4GPageTable ) to 
reuse code. In QemuFlashBeforeProbe() of 
OvmfPkg\QemuFlashFvbServicesRuntimeDxe\QemuFlashSmm.c, the range to clear 
EncMask is 2M aligned. No page split happens and smm page table memory is all 
RW before ReadyToLock. But in my opinion, the PF also may happen if the range 
is not 2M aligned.

In my code branch:
If 1G page table is supported, 1G page table is created to map [0, 4G]. Then 
page split (1G-->2M) happens in QemuFlashBeforeProbe() and the new memory for 
page table is marked as RO before ReadyToLock. That's why the PF happens in 
InitPaging().

To solve this issue, I think the assumption that smm page table is always RW 
before ReadyToLock should be dropped. I have added 2 new patches to clear WP 
before modifying smm page table. Could you please help test again?
https://github.com/td36/edk2/tree/SmmPageTable_V2

Thanks,
Dun

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Lendacky, Thomas 
via groups.io
Sent: Wednesday, April 19, 2023 9:19 PM
To: devel@edk2.groups.io; Tan, Dun ; Ni, Ray 

Subject: Re: [edk2-devel] [Patch V2 0/8] Use CpuPageTableLib to create and 
update smm page table

On 4/19/23 00:39, duntan via groups.io wrote:
> Hi Tom,
> 
> This PF happened because that  CR0.WP is set and DxeMemEncryptSevLib sets a 
> part of smm page table as RO before ReadyToLock while CpuSmm driver assumes 
> the smm page table is not marked as RO before ReadyToLock.
> The code flow to set smm page table to RO is 
> QemuFlashBeforeProbe()-->MemEncryptSevClearMmioPageEncMask()-->SetMemoryEncDec()-->EnablePageTableProtection().
>  New page table memory allocated by DxeMemEncryptSevLib is marked as RO in 
> EnablePageTableProtection(). However, In PiSmmCpuDxeSmm InitPaging() 
> function, the RO page table marked by  DxeMemEncryptSevLib may be modified 
> again and InitPaging() function doesn't clear CR0.WP in advance since it has 
> the assumption that smm page table memory is always RW before 
> SetPageTableAttributes(), which causes this PF.
> So Could you please help test the SEV enabled smm code without my patch set? 
> I think this issue may also happen in current edk2 code.

Upstream master branch boots without issue.

SmmInstallProtocolInterface: 47B7FA8C-F4BD-4AF6-8200-333086F0D2C8 0 
GetUefiMemoryMap Patch page table start ...
Patch page table done!
MemoryAttributesTable:
   Version   - 0x0001
   NumberOfEntries   - 0x0035
   DescriptorSize- 0x0030
Entry (0x3FF01028)
...


Thanks,
Tom

> 
> Thanks,
> Dun
> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of 
> Lendacky, Thomas via groups.io
> Sent: Wednesday, April 19, 2023 5:06 AM
> To: Tan, Dun ; devel@edk2.groups.io; Ni, Ray 
> 
> Subject: Re: [edk2-devel] [Patch V2 0/8] Use CpuPageTableLib to create 
> and update smm page table
> 
> On 4/18/23 04:57, Tan, Dun wrote:
>> Hi Tom,
>>
>> I added a new patch in my code branch. This new patch removes the code that 
>> may apply AddressEncMask to smm page table non-leaf entries when splitting 
>> page table.
>> Could you please help test if this code branch works?
>> https://github.com/td36/edk2/tree/SmmPageTable_V2
> 
> It got further, but it still crashed:
> 
> SmmInstallProtocolInterface: 47B7FA8C-F4BD-4AF6-8200-333086F0D2C8 0 
> GetUefiMemoryMap Patch page table start ...
>  X64 Exception Type - 0E(#PF - Page-Fault)  CPU Apic ID -  
> ExceptionData - 0003  I:0 R:0 U:0 W:1 P:1 PK:0 SS:0 SGX:0 RIP  - 
> 3FFC7744, CS  - 0038, RFLAGS - 00010082 RAX  - 
> FF83, RCX - 3FFB5C78, RDX -  RBX  - 
> 3FC01000, RSP - 3FFB4790, RBP - 3FFB47B0 RSI  - 
> 3FC01000, RDI - 
> R8   - 3FFB4840, R9  - 0002, R10 - 
> R11  - , R12 - 3FFB5C78, R13 - 
> 3FFB4840
> R14  - 8000, R15 - 
> DS   - 0020, ES  - 0020, FS  - 0020
> GS   - 0020, SS  - 0020
> CR0  - 80010033, CR2 - 3FC01000, CR3 - 
> 3FF81000
> CR4  - 0668, CR8 - 
> DR0  - , DR1 - , DR2 - 
> 
> DR3  - , DR6 - 0FF0, DR7 - 0400 GDTR 
> - 3FFAC000 004F, LDTR - 
> IDTR - 3FFAF000 01FF,   TR - 0040
> FXSAVE_STATE - 3FFB0C60
> SMM exception at access (0x3FC01000)
> It is invoked from the instruction before IP(0x3FFC7744) in module 
> (/root/kernels/ovmf-dun-build-Ia32X64/Build/Ovmf3264/DEBUG_GCC5/X64/Ue
> 

Re: [edk2-devel] [PATCH] UefiPayloadPkg: Move Network modules from Dxe FV to Network FV in elf

2023-04-20 Thread Guo, Gua
Reviewed-by: gua@intel.com

-Original Message-
From: Wu, LinusX  
Sent: Thursday, April 20, 2023 3:31 PM
To: devel@edk2.groups.io
Cc: Wu, LinusX ; Dong, Guo ; Ni, Ray 
; Rhodes, Sean ; Lu, James 
; Guo, Gua 
Subject: [PATCH] UefiPayloadPkg: Move Network modules from Dxe FV to Network FV 
in elf

From: Linus Wu 

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

Since UefiPayload had supported multiple FV, move Network.fdf.inc to new 
firmware volume and add this network FV into elf file.

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

Signed-off-by: Linus Wu 
---
 UefiPayloadPkg/UefiPayloadPkg.fdf   | 32 +++--
 UefiPayloadPkg/UniversalPayloadBuild.py | 12 ++
 2 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf 
b/UefiPayloadPkg/UefiPayloadPkg.fdf
index ee7d718b3f..f8c2aa8c4a 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.fdf
+++ b/UefiPayloadPkg/UefiPayloadPkg.fdf
@@ -60,6 +60,35 @@ FILE FV_IMAGE = 4E35FD93-9C72-4c15-8C4B-E77F1DB2D793 {
 SECTION FV_IMAGE = DXEFV } +!if $(NETWORK_DRIVER_ENABLE) == 
TRUE++[FV.NETWORKFV]+FvNameGuid
 = 3CF5CB69-C439-4B84-AF11-8167B22D7221+BlockSize  = 
$(FD_BLOCK_SIZE)+FvForceRebase  = FALSE+FvAlignment= 
16+ERASE_POLARITY = 1+MEMORY_MAPPED  = TRUE+STICKY_WRITE   = 
TRUE+LOCK_CAP   = TRUE+LOCK_STATUS= TRUE+WRITE_DISABLED_CAP = 
TRUE+WRITE_ENABLED_CAP  = TRUE+WRITE_STATUS   = TRUE+WRITE_LOCK_CAP = 
TRUE+WRITE_LOCK_STATUS  = TRUE+READ_DISABLED_CAP  = TRUE+READ_ENABLED_CAP   = 
TRUE+READ_STATUS= TRUE+READ_LOCK_CAP  = TRUE+READ_LOCK_STATUS   = 
TRUE++#+# UEFI network modules+#+!include NetworkPkg/Network.fdf.inc+!endif+ 

 [FV.BDSFV] FvNameGuid = CA5590AF-9558-4822-B5EA-BE2E876CD3EC@@ -276,14 
+305,13 @@ INF  
MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResour
  !if $(UNIVERSAL_PAYLOAD) == FALSE INF 
MdeModulePkg/Universal/BdsDxe/BdsDxe.inf-!endif- # # UEFI network modules # !if 
$(NETWORK_DRIVER_ENABLE) == TRUE   !include NetworkPkg/Network.fdf.inc 
!endif+!endif  # # Shelldiff --git a/UefiPayloadPkg/UniversalPayloadBuild.py 
b/UefiPayloadPkg/UniversalPayloadBuild.py
index db7ce0500b..83e0de95d8 100644
--- a/UefiPayloadPkg/UniversalPayloadBuild.py
+++ b/UefiPayloadPkg/UniversalPayloadBuild.py
@@ -108,6 +108,7 @@ def BuildUniversalPayload(Args, MacroList):
 DscPath = os.path.normpath("UefiPayloadPkg/UefiPayloadPkg.dsc") 
DxeFvOutputDir = os.path.join(BuildDir, "{}_{}".format (BuildTarget, 
ToolChain), os.path.normpath("FV/DXEFV.Fv")) BdsFvOutputDir = 
os.path.join(BuildDir, "{}_{}".format (BuildTarget, ToolChain), 
os.path.normpath("FV/BDSFV.Fv"))+NetworkFvOutputDir = 
os.path.join(BuildDir, "{}_{}".format (BuildTarget, ToolChain), 
os.path.normpath("FV/NETWORKFV.Fv")) PayloadReportPath = 
os.path.join(BuildDir, "UefiUniversalPayload.txt") ModuleReportPath = 
os.path.join(BuildDir, "UefiUniversalPayloadEntry.txt") UpldInfoFile = 
os.path.join(BuildDir, "UniversalPayloadInfo.bin")@@ -185,6 +186,17 @@ def 
BuildUniversalPayload(Args, MacroList):
ObjCopyFlag,
EntryOutputDir)+#+# Append network 
fv to sections if exists+#+if 
os.path.isfile(NetworkFvOutputDir):+index = 
remove_section.find(EntryOutputDir)+remove_section = 
remove_section[:index] + '--remove-section .upld.network_fv ' + 
remove_section[index:]+index = add_section.find(EntryOutputDir)+
add_section = add_section[:index] + '--add-section .upld.network_fv=' + 
NetworkFvOutputDir + ' ' + add_section[index:]+index = 
set_section.find(EntryOutputDir)+set_section = set_section[:index] 
+ '--set-section-alignment .upld.network_fv=16 ' + set_section[index:]+ 
RunCommand(remove_section) RunCommand(add_section) 
RunCommand(set_section)-- 
2.39.1.windows.1



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




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

2023-04-20 Thread Sami Mujawar

Hi Leif,

Thank you for reviewing the patch and for the feedback.

Please find my response inline marked [SAMI].

Regards,

Sami Mujawar

On 18/04/2023 02:30 pm, Leif Lindholm wrote:

Hi Sami,

On Mon, Apr 17, 2023 at 14:22:49 +0100, Sami Mujawar wrote:

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.

This is clearly needed in order to not break things, so
Reviewed-by: Leif Lindholm 
*but*
this is really just extending the life of a horrible hack.

Ideally, the ARM ltd. platforms should lead the way in providing
reference implementations - since inevitably people will look to those
for creating new platform ports. Things like this should be runtime
discoverable.


[SAMI] TF-A has this information in the platform DT, which we should be 
able to consume and setup the system memory size dynamically. However, 
it will be good to get this information from TF-A using the firmware 
handoff protocol (https://developer.arm.com/documentation/den0135/a). I 
will check with the TF-A team to understand when they plan to implement 
this feature.
I will merge this patch for now. Once we have the firmware handoff 
protocol implemented in TF-A, we can add corresponding support in edk2.


[/SAMI]



/
 Leif


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 (#103291): https://edk2.groups.io/g/devel/message/103291
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 V2 14/14] ManageabilityPkg: Add Manageability FDFs

2023-04-20 Thread Nickle Wang via groups.io
Reviewed-by: Nickle Wang 

Regards,
Nickle

> -Original Message-
> From: abner.ch...@amd.com 
> Sent: Tuesday, April 18, 2023 3:16 PM
> To: devel@edk2.groups.io
> Cc: Isaac Oram ; Abdul Lateef Attar
> ; Nickle Wang ; Igor Kulchytskyy
> ; Tinh Nguyen 
> Subject: [edk2-platforms][PATCH V2 14/14] ManageabilityPkg: Add
> Manageability FDFs
> 
> External email: Use caution opening links or attachments
> 
> 
> From: Abner Chang 
> 
> Add FDF include files for build in ManageabilityPkg modules to firmware 
> device.
> 
> Signed-off-by: Abner Chang 
> Cc: Isaac Oram 
> Cc: Abdul Lateef Attar 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> Cc: Tinh Nguyen 
> ---
>  .../ManageabilityPkg/Include/PostMemory.fdf   | 28 +++
>  .../ManageabilityPkg/Include/PreMemory.fdf| 12 
>  2 files changed, 40 insertions(+)
>  create mode 100644 Features/ManageabilityPkg/Include/PostMemory.fdf
>  create mode 100644 Features/ManageabilityPkg/Include/PreMemory.fdf
> 
> diff --git a/Features/ManageabilityPkg/Include/PostMemory.fdf
> b/Features/ManageabilityPkg/Include/PostMemory.fdf
> new file mode 100644
> index 00..9100cb2646
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Include/PostMemory.fdf
> @@ -0,0 +1,28 @@
> +## @file
> +# Manageabilty Package post memory initialization firmware # volume
> +description.
> +#
> +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
> +reserved. # SPDX-License-Identifier: BSD-2-Clause-Patent # ##
> +
> +!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiEnable ==
> +TRUE
> +  INF ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocolDxe.inf
> +!endif
> +
> +!if gManageabilityPkgTokenSpaceGuid.PcdManageabilitySmmIpmiEnable ==
> +TRUE
> +  INF ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocolSmm.inf
> +!endif
> +
> +!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmEnable ==
> +TRUE
> +  INF ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProtocolDxe.inf
> +!endif
> +
> +!if
> +gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmSmbiosTransfer
> En
> +able == TRUE
> +  INF
> +ManageabilityPkg/Universal/PldmSmbiosTransferDxe/PldmSmbiosTransferDxe.
> +inf
> +!endif
> +
> +!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable ==
> +TRUE
> +  INF ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocolDxe.inf
> +!endif
> diff --git a/Features/ManageabilityPkg/Include/PreMemory.fdf
> b/Features/ManageabilityPkg/Include/PreMemory.fdf
> new file mode 100644
> index 00..16e079f494
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Include/PreMemory.fdf
> @@ -0,0 +1,12 @@
> +## @file
> +# Manageabilty Package pre-memory initialization firmware # volume
> +description.
> +#
> +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
> +reserved. # SPDX-License-Identifier: BSD-2-Clause-Patent # ##
> +
> +!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityPeiIpmiEnable ==
> +TRUE
> +  INF  ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf
> +!endif
> --
> 2.37.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103290): https://edk2.groups.io/g/devel/message/103290
Mute This Topic: https://groups.io/mt/98339128/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 V2 13/14] ManageabilityPkg: Relocate Manageability.dsc

2023-04-20 Thread Nickle Wang via groups.io
Reviewed-by: Nickle Wang 

Regards,
Nickle

> -Original Message-
> From: abner.ch...@amd.com 
> Sent: Tuesday, April 18, 2023 3:16 PM
> To: devel@edk2.groups.io
> Cc: Isaac Oram ; Abdul Lateef Attar
> ; Nickle Wang ; Igor Kulchytskyy
> ; Tinh Nguyen 
> Subject: [edk2-platforms][PATCH V2 13/14] ManageabilityPkg: Relocate
> Manageability.dsc
> 
> External email: Use caution opening links or attachments
> 
> 
> From: Abner Chang 
> 
> Relocate Manageability.dsc to just under \Include folder.
> 
> Signed-off-by: Abner Chang 
> Cc: Isaac Oram 
> Cc: Abdul Lateef Attar 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> Cc: Tinh Nguyen 
> ---
>  Features/ManageabilityPkg/Include/{Dsc => }/Manageability.dsc | 0
>  Features/ManageabilityPkg/ManageabilityPkg.dsc| 2 +-
>  2 files changed, 1 insertion(+), 1 deletion(-)  rename
> Features/ManageabilityPkg/Include/{Dsc => }/Manageability.dsc (100%)
> 
> diff --git a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
> b/Features/ManageabilityPkg/Include/Manageability.dsc
> similarity index 100%
> rename from Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
> rename to Features/ManageabilityPkg/Include/Manageability.dsc
> diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dsc
> b/Features/ManageabilityPkg/ManageabilityPkg.dsc
> index 41a8957954..a0712d1c0a 100644
> --- a/Features/ManageabilityPkg/ManageabilityPkg.dsc
> +++ b/Features/ManageabilityPkg/ManageabilityPkg.dsc
> @@ -53,4 +53,4 @@
>  [LibraryClasses]
> 
> ManageabilityTransportLib|ManageabilityPkg/Library/BaseManageabilityTransp
> ortNullLib/BaseManageabilityTransportNull.inf
> 
> -!include Include/Dsc/Manageability.dsc
> +!include Include/Manageability.dsc
> --
> 2.37.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103289): https://edk2.groups.io/g/devel/message/103289
Mute This Topic: https://groups.io/mt/98339127/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 V2 12/14] ManageabilityPkg: Add Manageability PCDs

2023-04-20 Thread Nickle Wang via groups.io
Reviewed-by: Nickle Wang 

Regards,
Nickle

> -Original Message-
> From: abner.ch...@amd.com 
> Sent: Tuesday, April 18, 2023 3:16 PM
> To: devel@edk2.groups.io
> Cc: Isaac Oram ; Abdul Lateef Attar
> ; Nickle Wang ; Igor Kulchytskyy
> ; Tinh Nguyen 
> Subject: [edk2-platforms][PATCH V2 12/14] ManageabilityPkg: Add
> Manageability PCDs
> 
> External email: Use caution opening links or attachments
> 
> 
> From: Abner Chang 
> 
> Add PCDs to control ManageabilityPkg
> modules.
> 
> Signed-off-by: Abner Chang 
> Cc: Isaac Oram 
> Cc: Abdul Lateef Attar 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> Cc: Tinh Nguyen 
> ---
>  Features/ManageabilityPkg/ManageabilityPkg.dec   |  8 
>  .../Include/Dsc/Manageability.dsc| 16 +++-
>  Features/ManageabilityPkg/ManageabilityPkg.dsc   | 10 ++
>  3 files changed, 33 insertions(+), 1 deletion(-)
> 
> diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dec
> b/Features/ManageabilityPkg/ManageabilityPkg.dec
> index 6b198e6a3c..6f58ab4f45 100644
> --- a/Features/ManageabilityPkg/ManageabilityPkg.dec
> +++ b/Features/ManageabilityPkg/ManageabilityPkg.dec
> @@ -68,3 +68,11 @@
># @Prompt MCTP KCS (Memory mapped) I/O base address
> 
> gManageabilityPkgTokenSpaceGuid.PcdMctpKcsBaseAddress|0xca2|UINT32|0x
> 0004
> 
> +[PcdsFeatureFlag]
> +
> gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiEnable|FALSE|BO
> OLEAN|0x1001
> +
> gManageabilityPkgTokenSpaceGuid.PcdManageabilitySmmIpmiEnable|FALSE|B
> OOLEAN|0x1002
> +
> gManageabilityPkgTokenSpaceGuid.PcdManageabilityPeiIpmiEnable|FALSE|BO
> OLEAN|0x1003
> +
> gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmEnable|FALSE|B
> OOLEAN|0x1004
> +
> gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable|FALSE|B
> OOLEAN|0x1005
> +
> gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmSmbiosTransferE
> nable|FALSE|BOOLEAN|0x1006
> +
> diff --git a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
> b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
> index 0fab562844..5e7cdb885f 100644
> --- a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
> +++ b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
> @@ -25,14 +25,28 @@
> 
> PeiServicesTablePointerLib|ArmPkg/Library/PeiServicesTablePointerLib/PeiServi
> cesTablePointerLib.inf
> 
>  [Components.IA32, Components.AARCH64]
> +!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityPeiIpmiEnable ==
> TRUE
>ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf
> +!endif
> 
>  [Components.X64, Components.AARCH64]
> +!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiEnable ==
> TRUE
>ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocolDxe.inf
> +!endif
> 
>  [Components.X64]
> +!if gManageabilityPkgTokenSpaceGuid.PcdManageabilitySmmIpmiEnable ==
> TRUE
>ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocolSmm.inf
> +!endif
> +
> +!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmEnable ==
> TRUE
>ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProtocolDxe.inf
> +!endif
> +
> +!if
> gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmSmbiosTransferE
> nable == TRUE
> 
> ManageabilityPkg/Universal/PldmSmbiosTransferDxe/PldmSmbiosTransferDxe.i
> nf
> -  ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocolDxe.inf
> +!endif
> 
> +!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable ==
> TRUE
> +  ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocolDxe.inf
> +!endif
> diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dsc
> b/Features/ManageabilityPkg/ManageabilityPkg.dsc
> index 959b3eabd2..41a8957954 100644
> --- a/Features/ManageabilityPkg/ManageabilityPkg.dsc
> +++ b/Features/ManageabilityPkg/ManageabilityPkg.dsc
> @@ -28,6 +28,16 @@
>gMinPlatformPkgTokenSpaceGuid.PcdUefiSecureBootEnable   
> |FALSE
>gMinPlatformPkgTokenSpaceGuid.PcdPerformanceEnable  
> |FALSE
> 
> +  #
> +  # Manageability modules
> +  #
> +  gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiEnable
> |TRUE
> +  gManageabilityPkgTokenSpaceGuid.PcdManageabilitySmmIpmiEnable
> |TRUE
> +  gManageabilityPkgTokenSpaceGuid.PcdManageabilityPeiIpmiEnable
> |TRUE
> +  gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmEnable
> |TRUE
> +  gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable
> |TRUE
> +
> gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmSmbiosTransferE
> nable|TRUE
> +
>  #
>  # Include common libraries
>  #
> --
> 2.37.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103288): https://edk2.groups.io/g/devel/message/103288
Mute This Topic: https://groups.io/mt/98339125/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 V2 11/14] ManageabilityPkg/PldmProtocol: Add PLDM protocol

2023-04-20 Thread Nickle Wang via groups.io
Reviewed-by: Nickle Wang 

Regards,
Nickle

> -Original Message-
> From: abner.ch...@amd.com 
> Sent: Tuesday, April 18, 2023 3:16 PM
> To: devel@edk2.groups.io
> Cc: Isaac Oram ; Abdul Lateef Attar
> ; Nickle Wang ; Igor Kulchytskyy
> 
> Subject: [edk2-platforms][PATCH V2 11/14] ManageabilityPkg/PldmProtocol:
> Add PLDM protocol
> 
> External email: Use caution opening links or attachments
> 
> 
> From: Abner Chang 
> 
> PldmProtocol that transmits PLDM message over manageability transport
> interface library.
> 
> Signed-off-by: Abner Chang 
> Cc: Isaac Oram 
> Cc: Abdul Lateef Attar 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> ---
>  .../Include/Dsc/Manageability.dsc |   1 +
>  .../PldmProtocol/Dxe/PldmProtocolDxe.inf  |  50 ++
>  .../PldmProtocol/Common/PldmProtocolCommon.h  | 109
> +  .../PldmProtocol/Common/PldmProtocolCommon.c  | 437
> ++  .../Universal/PldmProtocol/Dxe/PldmProtocol.c | 181
> 
>  5 files changed, 778 insertions(+)
>  create mode 100644
> Features/ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProtocolDxe.inf
>  create mode 100644
> Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolCo
> mmon.h
>  create mode 100644
> Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolCo
> mmon.c
>  create mode 100644
> Features/ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProtocol.c
> 
> diff --git a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
> b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
> index 17f067c6d0..0fab562844 100644
> --- a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
> +++ b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
> @@ -32,6 +32,7 @@
> 
>  [Components.X64]
>ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocolSmm.inf
> +  ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProtocolDxe.inf
> 
> ManageabilityPkg/Universal/PldmSmbiosTransferDxe/PldmSmbiosTransferDxe.i
> nf
>ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocolDxe.inf
> 
> diff --git
> a/Features/ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProtocolDxe.in
> f
> b/Features/ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProtocolDxe.in
> f
> new file mode 100644
> index 00..006f77b09a
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProtocolD
> +++ xe.inf
> @@ -0,0 +1,50 @@
> +## @file
> +# EDKII PLDM Pootocol module INF file.
> +#
> +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
> +reserved. # SPDX-License-Identifier: BSD-2-Clause-Patent ##
> +
> +[Defines]
> +  INF_VERSION= 0x0001001d
> +  BASE_NAME  = PldmProtocolDxe
> +  FILE_GUID  = DA83FBDC-ECFE-4094-9ED3-EAFD1342333F
> +  MODULE_TYPE= DXE_DRIVER
> +  VERSION_STRING = 1.0
> +  ENTRY_POINT= DxePldmProtocolEntry
> +  UNLOAD_IMAGE   = PldmProtocolUnloadImage
> +
> +#
> +#  VALID_ARCHITECTURES   = IA32 X64 ARM AARCH64
> +#
> +
> +[Sources]
> +  PldmProtocol.c
> +  ../Common/PldmProtocolCommon.c
> +  ../Common/PldmProtocolCommon.h
> +
> +[Packages]
> +  MdePkg/MdePkg.dec
> +  MdeModulePkg/MdeModulePkg.dec
> +  ManageabilityPkg/ManageabilityPkg.dec
> +
> +[LibraryClasses]
> +  BaseMemoryLib
> +  DebugLib
> +  ManageabilityTransportHelperLib
> +  ManageabilityTransportLib
> +  UefiDriverEntryPoint
> +  UefiBootServicesTableLib
> +
> +[Guids]
> +  gManageabilityTransportMctpGuid
> +
> +[Protocols]
> +  gEdkiiPldmProtocolGuid
> +
> +[FixedPcd]
> +  gManageabilityPkgTokenSpaceGuid.PcdMctpSourceEndpointId
> +  gManageabilityPkgTokenSpaceGuid.PcdMctpDestinationEndpointId
> +
> +[Depex]
> +  TRUE
> diff --git
> a/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolC
> ommon.h
> b/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolC
> ommon.h
> new file mode 100644
> index 00..231d6e802e
> --- /dev/null
> +++
> b/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtoc
> +++ olCommon.h
> @@ -0,0 +1,109 @@
> +/** @file
> +
> +  EDKII PLDM Protocol common header file.
> +
> +  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
> +reserved.
> +  SPDX-License-Identifier: BSD-2-Clause-Patent **/
> +
> +#ifndef MANAGEABILITY_EDKII_PLDM_COMMON_H_
> +#define MANAGEABILITY_EDKII_PLDM_COMMON_H_
> +
> +#include 
> +#include 
> +
> +typedef struct {
> +  UINT8 PldmType;
> +  UINT8 PldmCommand;
> +  UINT32ResponseSize;
> +} PLDM_MESSAGE_PACKET_MAPPING;
> +
> +/**
> +  This functions setup the PLDM transport hardware information
> +according
> +  to the specification of transport token acquired from transport library.
> +
> +  @param[in] TransportToken   The transport interface.
> +  @param[out]HardwareInformation  Pointer to receive the hardware
> information.
> +
> +  @retval EFI_SUCCESSHardware information is returned in
> HardwareInformation.
> +   

Re: [edk2-devel] [edk2-platforms][PATCH V2 10/14] ManageabilityPkg: Add MCTP transport interface

2023-04-20 Thread Nickle Wang via groups.io
Please find my comments below.

Regards,
Nickle

> -Original Message-
> From: abner.ch...@amd.com 
> Sent: Tuesday, April 18, 2023 3:16 PM
> To: devel@edk2.groups.io
> Cc: Isaac Oram ; Abdul Lateef Attar
> ; Nickle Wang ; Igor Kulchytskyy
> 
> Subject: [edk2-platforms][PATCH V2 10/14] ManageabilityPkg: Add MCTP
> transport interface
> 
> External email: Use caution opening links or attachments
> 
> 
> From: Abner Chang 
> 
> Add MCTP manageability transport interface library.
> 
> The functionality is verified by checking the binary debug output of payload.
> 
> Signed-off-by: Abner Chang 
> Cc: Isaac Oram 
> Cc: Abdul Lateef Attar 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> ---
>  .../ManageabilityPkg/ManageabilityPkg.dsc |   1 +
>  .../Dxe/DxeManageabilityTransportMctp.inf |  44 +++
>  .../Dxe/ManageabilityTransportMctp.h  |  26 ++
>  .../Dxe/ManageabilityTransportMctp.c  | 367 ++
>  .../Dxe/ManageabilityTransportMctp.uni|  13 +
>  5 files changed, 451 insertions(+)
>  create mode 100644
> Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/DxeM
> anageabilityTransportMctp.inf
>  create mode 100644
> Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/Mana
> geabilityTransportMctp.h
>  create mode 100644
> Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/Mana
> geabilityTransportMctp.c
>  create mode 100644
> Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/Mana
> geabilityTransportMctp.uni
> 
> diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dsc
> b/Features/ManageabilityPkg/ManageabilityPkg.dsc
> index 412029ef6c..959b3eabd2 100644
> --- a/Features/ManageabilityPkg/ManageabilityPkg.dsc
> +++ b/Features/ManageabilityPkg/ManageabilityPkg.dsc
> @@ -37,6 +37,7 @@
> 
>  [Components]
> 
> ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/DxeManageability
> TransportKcs.inf
> +
> +
> ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/DxeManageab
> + ilityTransportMctp.inf
>ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtocolLib.inf
> 
>  [LibraryClasses]
> diff --git
> a/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/Dxe
> ManageabilityTransportMctp.inf
> b/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/Dxe
> ManageabilityTransportMctp.inf
> new file mode 100644
> index 00..22ea37c516
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dx
> +++ e/DxeManageabilityTransportMctp.inf
> @@ -0,0 +1,44 @@
> +## @file
> +# MCTP instance of Manageability Transport Library # # Copyright (C)
> +2023 Advanced Micro Devices, Inc. All rights reserved. #
> +SPDX-License-Identifier: BSD-2-Clause-Patent # ##
> +
> +[Defines]
> +  INF_VERSION= 0x0001001B
> +  BASE_NAME  = DxeManageabilityTransportMctp
> +  MODULE_UNI_FILE= ManageabilityTransportMctp.uni
> +  FILE_GUID  = 7770FA0F-4808-47BD-89F4-717185332486
> +  MODULE_TYPE= DXE_DRIVER
> +  VERSION_STRING = 1.0
> +  LIBRARY_CLASS  = ManageabilityTransportLib
> +
> +#
> +#  VALID_ARCHITECTURES   = IA32 X64 ARM AARCH64
> +#
> +
> +[Sources]
> +  ManageabilityTransportMctp.c
> +  ManageabilityTransportMctp.h
> +
> +[Packages]
> +  ManageabilityPkg/ManageabilityPkg.dec
> +  MdePkg/MdePkg.dec
> +
> +[LibraryClasses]
> +  DebugLib
> +  MemoryAllocationLib
> +  UefiBootServicesTableLib
> +
> +[Protocols]
> +  gEdkiiMctpProtocolGuid
> +
> +[Guids]
> +  gManageabilityProtocolPldmGuid
> +  gManageabilityTransportMctpGuid
> +
> +[Depex]
> +  gEdkiiMctpProtocolGuid  ## ALWAYS_CONSUMES
> +
> diff --git
> a/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/Ma
> nageabilityTransportMctp.h
> b/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/Ma
> nageabilityTransportMctp.h
> new file mode 100644
> index 00..1ce0d3a8bc
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dx
> +++ e/ManageabilityTransportMctp.h
> @@ -0,0 +1,26 @@
> +/** @file
> +
> +  Manageability transport MCTP internal used definitions.
> +
> +  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
> +reserved.
> +  SPDX-License-Identifier: BSD-2-Clause-Patent **/
> +
> +#ifndef MANAGEABILITY_TRANSPORT_MCTP_LIB_INTERNAL_H_
> +#define MANAGEABILITY_TRANSPORT_MCTP_LIB_INTERNAL_H_
> +
> +#include 
> +
> +#define MANAGEABILITY_TRANSPORT_MCTP_SIGNATURE  SIGNATURE_32
> ('M', 'T',
> +'M', 'C')
> +
> +///
> +/// Manageability transport KCS internal data structure.
> +///
> +typedef struct {
> +  UINTNSignature;
> +  MANAGEABILITY_TRANSPORT_TOKENToken;
> +} MANAGEABILITY_TRANSPORT_MCTP;
> +
> +#define MANAGEABILITY_TRANSPORT_MCTP_FROM_LINK(a)  CR (a,
> +MANAGEABILITY_TRANSPORT_MCTP, Token,
> +MANAGEABILITY_TRANSPORT_MCTP_SIGNATURE)
> +
> 

Re: [edk2-devel] [edk2-platforms][PATCH V2 09/14] ManageabilityPkg/MctpProtocol: Add MctpProtocol

2023-04-20 Thread Nickle Wang via groups.io
Please find my comment below.

Thanks,
Nickle

> -Original Message-
> From: abner.ch...@amd.com 
> Sent: Tuesday, April 18, 2023 3:16 PM
> To: devel@edk2.groups.io
> Cc: Isaac Oram ; Abdul Lateef Attar
> ; Nickle Wang ; Igor Kulchytskyy
> 
> Subject: [edk2-platforms][PATCH V2 09/14] ManageabilityPkg/MctpProtocol:
> Add MctpProtocol
> 
> External email: Use caution opening links or attachments
> 
> 
> From: Abner Chang 
> 
> MctpProtocol that transmits MCTP message over manageability transport
> interface library.
> 
> Signed-off-by: Abner Chang 
> Cc: Isaac Oram 
> Cc: Abdul Lateef Attar 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> ---
>  .../Include/Dsc/Manageability.dsc |   1 +
>  .../MctpProtocol/Dxe/MctpProtocolDxe.inf  |  53 ++
>  .../Include/Protocol/MctpProtocol.h   | 102 
>  .../MctpProtocol/Common/MctpProtocolCommon.h  | 139
> ++  .../MctpProtocol/Common/MctpProtocolCommon.c  | 472
> ++  .../Universal/MctpProtocol/Dxe/MctpProtocol.c | 218
> 
>  6 files changed, 985 insertions(+)
>  create mode 100644
> Features/ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocolDxe.inf
>  create mode 100644
> Features/ManageabilityPkg/Include/Protocol/MctpProtocol.h
>  create mode 100644
> Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpProtocolCo
> mmon.h
>  create mode 100644
> Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpProtocolCo
> mmon.c
>  create mode 100644
> Features/ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocol.c
> 
> diff --git a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
> b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
> index 2a354ad898..17f067c6d0 100644
> --- a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
> +++ b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
> @@ -33,4 +33,5 @@
>  [Components.X64]
>ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocolSmm.inf
> 
> ManageabilityPkg/Universal/PldmSmbiosTransferDxe/PldmSmbiosTransferDxe.i
> nf
> +  ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocolDxe.inf
> 
> diff --git
> a/Features/ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocolDxe.in
> f
> b/Features/ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocolDxe.in
> f
> new file mode 100644
> index 00..483fbcc04b
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocolD
> +++ xe.inf
> @@ -0,0 +1,53 @@
> +## @file
> +# MCTP Protocol DXE Driver.
> +#
> +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
> +reserved. # SPDX-License-Identifier: BSD-2-Clause-Patent ##
> +
> +[Defines]
> +  INF_VERSION= 0x0001001d
> +  BASE_NAME  = MctpDxe
> +  FILE_GUID  = 58AF169A-AA3F-462B-B0F1-25FBE6C97978
> +  MODULE_TYPE= DXE_DRIVER
> +  VERSION_STRING = 1.0
> +  ENTRY_POINT= DxeMctpEntry
> +  UNLOAD_IMAGE   = MctpUnloadImage
> +
> +#
> +#  VALID_ARCHITECTURES   = IA32 X64 ARM AARCH64
> +#
> +
> +[Sources]
> +  MctpProtocol.c
> +  ../Common/MctpProtocolCommon.c
> +  ../Common/MctpProtocolCommon.h
> +
> +[Packages]
> +  MdePkg/MdePkg.dec
> +  MdeModulePkg/MdeModulePkg.dec
> +  ManageabilityPkg/ManageabilityPkg.dec
> +
> +[LibraryClasses]
> +  BaseMemoryLib
> +  DebugLib
> +  MemoryAllocationLib
> +  ManageabilityTransportHelperLib
> +  ManageabilityTransportLib
> +  UefiDriverEntryPoint
> +  UefiBootServicesTableLib
> +
> +[Guids]
> +  gManageabilityProtocolMctpGuid
> +
> +[Protocols]
> +  gEdkiiMctpProtocolGuid
> +
> +[FixedPcd]
> +  gManageabilityPkgTokenSpaceGuid.PcdMctpKcsMemoryMappedIo
> +  gManageabilityPkgTokenSpaceGuid.PcdMctpKcsBaseAddress
> +  gManageabilityPkgTokenSpaceGuid.PcdMctpSourceEndpointId
> +  gManageabilityPkgTokenSpaceGuid.PcdMctpDestinationEndpointId
> +
> +[Depex]
> +  TRUE
> diff --git a/Features/ManageabilityPkg/Include/Protocol/MctpProtocol.h
> b/Features/ManageabilityPkg/Include/Protocol/MctpProtocol.h
> new file mode 100644
> index 00..85e42f157d
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Include/Protocol/MctpProtocol.h
> @@ -0,0 +1,102 @@
> +/** @file
> +  Protocol of EDKII MCTP Protocol.
> +
> +  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
> + reserved.
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef EDKII_MCTP_PROTOCOL_H_
> +#define EDKII_MCTP_PROTOCOL_H_
> +
> +#include 
> +
> +typedef struct  _EDKII_MCTP_PROTOCOL EDKII_MCTP_PROTOCOL;
> +
> +#define EDKII_MCTP_PROTOCOL_GUID \
> +  { \
> +0xE93465C1, 0x9A31, 0x4C96, 0x92, 0x56, 0x22, 0x0A, 0xE1, 0x80,
> +0xB4, 0x1B \
> +  }
> +
> +#define EDKII_MCTP_PROTOCOL_VERSION_MAJOR  1 #define
> +EDKII_MCTP_PROTOCOL_VERSION_MINOR  0
> +#define EDKII_MCTP_PROTOCOL_VERSION
> ((EDKII_MCTP_PROTOCOL_VERSION_MAJOR << 8) |\
> +
> +EDKII_MCTP_PROTOCOL_VERSION_MINOR)
> +
> +/**
> +  This service enables submitting message via EDKII MCTP 

Re: [edk2-devel] [edk2-platforms][PATCH V2 08/14] ManageabilityPkg: Add MCTP manageability header file

2023-04-20 Thread Nickle Wang via groups.io
Reviewed-by: Nickle Wang 

Regards,
Nickle

> -Original Message-
> From: abner.ch...@amd.com 
> Sent: Tuesday, April 18, 2023 3:16 PM
> To: devel@edk2.groups.io
> Cc: Isaac Oram ; Abdul Lateef Attar
> ; Nickle Wang ; Igor Kulchytskyy
> 
> Subject: [edk2-platforms][PATCH V2 08/14] ManageabilityPkg: Add MCTP
> manageability header file
> 
> External email: Use caution opening links or attachments
> 
> 
> From: Abner Chang 
> 
> Add C header file of MCTP manageability transport interface library.
> 
> Signed-off-by: Abner Chang 
> Cc: Isaac Oram 
> Cc: Abdul Lateef Attar 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> ---
>  .../Library/ManageabilityTransportMctpLib.h   | 54 +++
>  1 file changed, 54 insertions(+)
>  create mode 100644
> Features/ManageabilityPkg/Include/Library/ManageabilityTransportMctpLib.h
> 
> diff --git
> a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportMctpLib.h
> b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportMctpLib.h
> new file mode 100644
> index 00..43bd142f4c
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportMc
> +++ tpLib.h
> @@ -0,0 +1,54 @@
> +/** @file
> +
> +  This file defines the manageability MCTP protocol specific transport data.
> +
> +  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
> +reserved.
> +  SPDX-License-Identifier: BSD-2-Clause-Patent **/
> +
> +#ifndef MANAGEABILITY_TRANSPORT_MCTP_LIB_H_
> +#define MANAGEABILITY_TRANSPORT_MCTP_LIB_H_
> +
> +#include 
> +
> +#define MCTP_KCS_HEADER_VERSION  0x01
> +
> +// According to SMBUS spec, the polynomial is:
> +// C(x) = X^8 + X^2 + X^1 + 1, which is 0x107, // just ignore bit8 in
> +definition.
> +#define MCTP_KCS_PACKET_ERROR_CODE_POLY  0x07
> +
> +///
> +/// The MCTP Message header which is apart from /// the payload.
> +///
> +
> +typedef struct {
> +  UINT8IntegrityCheck : 1; ///< Message integrity check.
> +  UINT8MessageType: 7; ///< Message type.
> +} MANAGEABILITY_MCTP_MESSAGE_HEADER;
> +
> +typedef struct {
> +  UINT8SourceEndpointId;
> +  UINT8DestinationEndpointId;
> +  MANAGEABILITY_MCTP_MESSAGE_HEADERMessageHeader;
> +} MANAGEABILITY_MCTP_TRANSPORT_HEADER;
> +
> +typedef struct {
> +  UINT8NetFunc;  ///< Message integrity check.
> +  UINT8DefiningBody; ///< Message type.
> +  UINT8ByteCount;///< Byte count of payload.
> +} MANAGEABILITY_MCTP_KCS_HEADER;
> +#define MCTP_KCS_NETFN_LUN   0xb0
> +#define DEFINING_BODY_DMTF_PRE_OS_WORKING_GROUP  0x01
> +
> +// This is used to track the response message. This value // is not
> +defined by the specification.
> +#define MCTP_MESSAGE_TAG  0x1
> +
> +#define MCTP_MESSAGE_TAG_OWNER_REQUEST   0x01
> +#define MCTP_MESSAGE_TAG_OWNER_RESPONSE  0x01
> +
> +#define MCTP_PACKET_SEQUENCE_MASK  0x3
> +
> +#endif // MANAGEABILITY_TRANSPORT_MCTP_LIB_H_
> --
> 2.37.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103284): https://edk2.groups.io/g/devel/message/103284
Mute This Topic: https://groups.io/mt/98339120/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 V2 07/14] ManageabilityPkg: Add definitions of MCTP

2023-04-20 Thread Nickle Wang via groups.io
Reviewed-by: Nickle Wang 

Regards,
Nickle

> -Original Message-
> From: abner.ch...@amd.com 
> Sent: Tuesday, April 18, 2023 3:16 PM
> To: devel@edk2.groups.io
> Cc: Isaac Oram ; Abdul Lateef Attar
> ; Nickle Wang ; Igor Kulchytskyy
> 
> Subject: [edk2-platforms][PATCH V2 07/14] ManageabilityPkg: Add definitions
> of MCTP
> 
> External email: Use caution opening links or attachments
> 
> 
> From: Abner Chang 
> 
> Add definitions of MCTP manageability transport interface library.
> 
> Signed-off-by: Abner Chang 
> Cc: Isaac Oram 
> Cc: Abdul Lateef Attar 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> ---
>  Features/ManageabilityPkg/ManageabilityPkg.dec | 16 
>  1 file changed, 16 insertions(+)
> 
> diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dec
> b/Features/ManageabilityPkg/ManageabilityPkg.dec
> index 9c9f0d8232..6b198e6a3c 100644
> --- a/Features/ManageabilityPkg/ManageabilityPkg.dec
> +++ b/Features/ManageabilityPkg/ManageabilityPkg.dec
> @@ -45,6 +45,7 @@
># Manageability Protocol IPMI
>gManageabilityProtocolIpmiGuid= { 0x36ACA47C, 0xCC80, 0x473B, { 0xAB,
> 0xEC, 0xF3, 0x98, 0xFF, 0x87, 0x74, 0x5B } }
># Manageability Protocol MCTP
> +  #  MCTP is a transport interface but also a protocol that can be trasmitted
> over other transport interfaces.
>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 } }
> @@ -52,3 +53,18 @@
>  [Protocols]
>gEdkiiPldmProtocolGuid= { 0x60997616, 0xDB70, 0x4B5F, { 
> 0x86,
> 0xA4, 0x09, 0x58, 0xA3, 0x71, 0x47, 0xB4 } }
>gEdkiiPldmSmbiosTransferProtocolGuid  = { 0xFA431C3C, 0x816B, 0x4B32,
> { 0xA3, 0xE0, 0xAD, 0x9B, 0x7F, 0x64, 0x27, 0x2E } }
> +  gEdkiiMctpProtocolGuid= { 0xE93465C1, 0x9A31, 0x4C96, { 
> 0x92,
> 0x56, 0x22, 0x0A, 0xE1, 0x80, 0xB4, 0x1B } }
> +
> +[PcdsFixedAtBuild]
> +  ## This value is the MCTP Interface source and destination endpoint ID for
> transmiting MCTP message.
> +  # @Prompt MCTP source endpoint ID
> +
> +gManageabilityPkgTokenSpaceGuid.PcdMctpSourceEndpointId|0|UINT8|0x00
> 000
> +001
> +  # @Prompt MCTP destination endpoint ID
> +
> +gManageabilityPkgTokenSpaceGuid.PcdMctpDestinationEndpointId|0|UINT8|
> 0x
> +0002
> +  ## This is the value of MCTP KCS I/O base address mode
> +  # @Prompt MCTP KCS I/O base address mode
> +
> +gManageabilityPkgTokenSpaceGuid.PcdMctpKcsMemoryMappedIo|0|BOOLEA
> N|0x00
> +03
> +  ## This is the value of MCTP KCS I/O base address
> +  # @Prompt MCTP KCS (Memory mapped) I/O base address
> +
> +gManageabilityPkgTokenSpaceGuid.PcdMctpKcsBaseAddress|0xca2|UINT32|0
> x00
> +04
> +
> --
> 2.37.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103283): https://edk2.groups.io/g/devel/message/103283
Mute This Topic: https://groups.io/mt/98339117/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 V2 06/14] ManageabilityPkg/KCS: KCS transport interface

2023-04-20 Thread Nickle Wang via groups.io
Reviewed-by: Nickle Wang 

Regards,
Nickle

> -Original Message-
> From: abner.ch...@amd.com 
> Sent: Tuesday, April 18, 2023 3:16 PM
> To: devel@edk2.groups.io
> Cc: Isaac Oram ; Abdul Lateef Attar
> ; Nickle Wang ; Igor Kulchytskyy
> 
> Subject: [edk2-platforms][PATCH V2 06/14] ManageabilityPkg/KCS: KCS
> transport interface
> 
> External email: Use caution opening links or attachments
> 
> 
> From: Abner Chang 
> 
> - Return Maximum Transfer Unit for MCTP over KCS
> - Check the parameters
> 
> Signed-off-by: Abner Chang 
> Cc: Isaac Oram 
> Cc: Abdul Lateef Attar 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> ---
>  .../Common/ManageabilityTransportKcs.h|   2 +-
>  .../Common/KcsCommon.c| 112 ++
>  .../Dxe/ManageabilityTransportKcs.c   |  24 ++--
>  3 files changed, 78 insertions(+), 60 deletions(-)
> 
> diff --git
> a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/
> ManageabilityTransportKcs.h
> b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/
> ManageabilityTransportKcs.h
> index d6685c165e..8c6a64416a 100644
> ---
> a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/
> ManageabilityTransportKcs.h
> +++ b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Com
> +++ mon/ManageabilityTransportKcs.h
> @@ -71,7 +71,7 @@ typedef struct {
>  EFI_STATUS
>  EFIAPI
>  KcsTransportSendCommand (
> -  IN  MANAGEABILITY_TRANSPORT_HEADER   TransmitHeader,
> +  IN  MANAGEABILITY_TRANSPORT_HEADER   TransmitHeader OPTIONAL,
>IN  UINT16   TransmitHeaderSize,
>IN  MANAGEABILITY_TRANSPORT_TRAILER  TransmitTrailer OPTIONAL,
>IN  UINT16   TransmitTrailerSize,
> diff --git
> a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/
> KcsCommon.c
> b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/
> KcsCommon.c
> index 14a7047447..a8c6a674c9 100644
> ---
> a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/
> KcsCommon.c
> +++ b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Com
> +++ mon/KcsCommon.c
> @@ -99,14 +99,14 @@ ClearOBF (
>Algorithm is based on flow chart provided in IPMI spec 2.0
>Figure 9-6, KCS Interface BMC to SMS Write Transfer Flow Chart
> 
> -  @param[in]  TransmitHeaderKCS packet header.
> -  @param[in]  TransmitHeaderSizeKCS packet header size in byte.
> -  @param[in]  TransmitTrailer   KCS packet trailer.
> -  @param[in]  TransmitTrailerSize   KCS packet trailer size in byte.
> -  @param[in]  RequestData   Command Request Data, could be NULL.
> -RequestDataSize must be zero, if 
> RequestData
> -is NULL.
> -  @param[in]  RequestDataSize   Size of Command Request Data.
> +  @param[in]  TransmitHeaderKCS packet header.
> +  @param[in]  TransmitHeaderSizeKCS packet header size in byte.
> +  @param[in]  TransmitTrailer   KCS packet trailer.
> +  @param[in]  TransmitTrailerSize   KCS packet trailer size in byte.
> +  @param[in]  RequestData   Command Request Data, could be NULL.
> +RequestDataSize must be zero, if 
> RequestData
> +is NULL.
> +  @param[in]  RequestDataSize   Size of Command Request Data.
> 
>@retval EFI_SUCCESS   The command byte stream was successfully
>  submit to the device and a response was 
> @@ -414,7 +414,7
> @@ KcsTransportRead (  EFI_STATUS  EFIAPI  KcsTransportSendCommand (
> -  IN  MANAGEABILITY_TRANSPORT_HEADER   TransmitHeader,
> +  IN  MANAGEABILITY_TRANSPORT_HEADER   TransmitHeader OPTIONAL,
>IN  UINT16   TransmitHeaderSize,
>IN  MANAGEABILITY_TRANSPORT_TRAILER  TransmitTrailer OPTIONAL,
>IN  UINT16   TransmitTrailerSize,
> @@ -427,6 +427,7 @@ KcsTransportSendCommand (
>EFI_STATUSStatus;
>UINT32RspHeaderSize;
>IPMI_KCS_RESPONSE_HEADER  RspHeader;
> +  UINT32ExpectedResponseDataSize;
> 
>if ((RequestData != NULL) && (RequestDataSize == 0)) {
>  DEBUG ((DEBUG_ERROR, "%a: Mismatched values of RequestData and
> RequestDataSize\n", __FUNCTION__)); @@ -438,65 +439,72 @@
> KcsTransportSendCommand (
>  return EFI_INVALID_PARAMETER;
>}
> 
> -  if (TransmitHeader == NULL) {
> -DEBUG ((DEBUG_ERROR, "%a: TransmitHeader is NULL\n", __FUNCTION__));
> -return EFI_INVALID_PARAMETER;
> +  // Print out the request payloads.
> +  if ((TransmitHeader != NULL) && (TransmitHeaderSize != 0)) {
> +HelperManageabilityDebugPrint ((VOID *)TransmitHeader,
> + (UINT32)TransmitHeaderSize, "KCS Transmit Header:\n");
>}
> 
> -  //
> -  // Print out the request payloads.
> -  

Re: [edk2-devel] [edk2-platforms][PATCH V2 05/14] ManageabilityPkg: Add PldmSmbiosTransferDxe driver

2023-04-20 Thread Nickle Wang via groups.io
Reviewed-by: Nickle Wang 

Regards,
Nickle

> -Original Message-
> From: abner.ch...@amd.com 
> Sent: Tuesday, April 18, 2023 3:16 PM
> To: devel@edk2.groups.io
> Cc: Isaac Oram ; Abdul Lateef Attar
> ; Nickle Wang ; Igor Kulchytskyy
> 
> Subject: [edk2-platforms][PATCH V2 05/14] ManageabilityPkg: Add
> PldmSmbiosTransferDxe driver
>
> External email: Use caution opening links or attachments
>
>
> From: Abner Chang 
>
> Add edk2 driver that supports PLDM SMBIOS Transfer Specification.
> https://www.d/
> mtf.org%2Fsites%2Fdefault%2Ffiles%2Fstandards%2Fdocuments%2FDSP0246_1
> .0.1.pdf=05%7C01%7Cnicklew%40nvidia.com%7Cd7cd94d4a15b448c37d4
> 08db3fdccdc6%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C638173
> 989961845778%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIj
> oiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C=a
> Ospd%2BAVnKMgIDCoyW5H6N1vNdxz%2FtOkUvnPyuPGgzs%3D=0
>
> We currently only support "Push" mode of PLDM SMBIOS transfer. That says
> only BIOS to BMC direction is supported.
> The functionality is verified by checking the binary debug output of payload.
>
> Signed-off-by: Abner Chang 
> Cc: Isaac Oram 
> Cc: Abdul Lateef Attar 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> ---
>  .../ManageabilityPkg/ManageabilityPkg.dec |   1 +
>  .../Include/Dsc/Manageability.dsc |   1 +
>  .../PldmSmbiosTransferDxe.inf |  47 ++
>  .../Protocol/PldmSmbiosTransferProtocol.h | 184 ++
>  .../PldmSmbiosTransferDxe.c   | 525 ++
>  5 files changed, 758 insertions(+)
>  create mode 100644
> Features/ManageabilityPkg/Universal/PldmSmbiosTransferDxe/PldmSmbiosTran
> sferDxe.inf
>  create mode 100644
> Features/ManageabilityPkg/Include/Protocol/PldmSmbiosTransferProtocol.h
>  create mode 100644
> Features/ManageabilityPkg/Universal/PldmSmbiosTransferDxe/PldmSmbiosTran
> sferDxe.c
>
> diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dec
> b/Features/ManageabilityPkg/ManageabilityPkg.dec
> index e4d147fede..9c9f0d8232 100644
> --- a/Features/ManageabilityPkg/ManageabilityPkg.dec
> +++ b/Features/ManageabilityPkg/ManageabilityPkg.dec
> @@ -51,3 +51,4 @@
>
>  [Protocols]
>gEdkiiPldmProtocolGuid= { 0x60997616, 0xDB70, 0x4B5F, { 
> 0x86,
> 0xA4, 0x09, 0x58, 0xA3, 0x71, 0x47, 0xB4 } }
> +  gEdkiiPldmSmbiosTransferProtocolGuid  = { 0xFA431C3C, 0x816B, 0x4B32,
> + { 0xA3, 0xE0, 0xAD, 0x9B, 0x7F, 0x64, 0x27, 0x2E } }
> diff --git a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
> b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
> index eda1a36bb9..2a354ad898 100644
> --- a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
> +++ b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
> @@ -32,4 +32,5 @@
>
>  [Components.X64]
>ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocolSmm.inf
> +
> + ManageabilityPkg/Universal/PldmSmbiosTransferDxe/PldmSmbiosTransferDxe
> + .inf
>
> diff --git
> a/Features/ManageabilityPkg/Universal/PldmSmbiosTransferDxe/PldmSmbiosTr
> ansferDxe.inf
> b/Features/ManageabilityPkg/Universal/PldmSmbiosTransferDxe/PldmSmbiosTr
> ansferDxe.inf
> new file mode 100644
> index 00..da49057982
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Universal/PldmSmbiosTransferDxe/PldmSmbi
> +++ osTransferDxe.inf
> @@ -0,0 +1,47 @@
> +## @file
> +# PLDM SMBIOS Transfer DXE Driver.
> +#
> +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
> +reserved. # SPDX-License-Identifier: BSD-2-Clause-Patent ##
> +
> +[Defines]
> +  INF_VERSION= 0x0001001d
> +  BASE_NAME  = PldmSmbiosTransferDxe
> +  FILE_GUID  = 71BF5CF0-CE09-4C7C-912B-944BF4E4CBC0
> +  MODULE_TYPE= DXE_DRIVER
> +  VERSION_STRING = 1.0
> +  ENTRY_POINT= DxePldmSmbiosTransferEntry
> +  UNLOAD_IMAGE   = PldmSmbiosTransferUnloadImage
> +
> +#
> +#  VALID_ARCHITECTURES   = IA32 X64 ARM AARCH64
> +#
> +
> +[Sources]
> +  PldmSmbiosTransferDxe.c
> +
> +[Packages]
> +  MdePkg/MdePkg.dec
> +  MdeModulePkg/MdeModulePkg.dec
> +  ManageabilityPkg/ManageabilityPkg.dec
> +
> +[LibraryClasses]
> +  BaseMemoryLib
> +  DebugLib
> +  ManageabilityTransportLib
> +  ManageabilityTransportHelperLib
> +  PldmProtocolLib
> +  UefiLib
> +  UefiDriverEntryPoint
> +  UefiBootServicesTableLib
> +
> +[Guids]
> +  gEfiSmbios3TableGuid
> +
> +[Protocols]
> +  gEfiSmbiosProtocolGuid
> +  gEdkiiPldmSmbiosTransferProtocolGuid
> +
> +[Depex]
> +  gEdkiiPldmProtocolGuid  ## ALWAYS_CONSUMES
> diff --git
> a/Features/ManageabilityPkg/Include/Protocol/PldmSmbiosTransferProtocol.h
> b/Features/ManageabilityPkg/Include/Protocol/PldmSmbiosTransferProtocol.h
> new file mode 100644
> index 00..7903e12726
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Include/Protocol/PldmSmbiosTransferProto
> +++ col.h
> @@ -0,0 +1,184 @@
> +/** @file
> +  Protocol of EDKII PLDM SMBIOS Transfer Protocol.
> +

Re: [edk2-devel] [edk2-platforms][PATCH V2 04/14] ManageabilityPkg: Add PldmProtocolLib

2023-04-20 Thread Nickle Wang via groups.io
Please find my comment inline below.

Regards,
Nickle

> -Original Message-
> From: abner.ch...@amd.com 
> Sent: Tuesday, April 18, 2023 3:16 PM
> To: devel@edk2.groups.io
> Cc: Isaac Oram ; Abdul Lateef Attar
> ; Nickle Wang ; Igor Kulchytskyy
> 
> Subject: [edk2-platforms][PATCH V2 04/14] ManageabilityPkg: Add
> PldmProtocolLib
> 
> External email: Use caution opening links or attachments
> 
> 
> From: Abner Chang 
> 
> PldmProtocolLib provides the library
> function to PLDM protocol.
> 
> Signed-off-by: Abner Chang 
> Cc: Isaac Oram 
> Cc: Abdul Lateef Attar 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> ---
>  .../ManageabilityPkg/ManageabilityPkg.dec |  3 +
>  .../Include/Dsc/Manageability.dsc |  3 +
>  .../ManageabilityPkg/ManageabilityPkg.dsc |  1 +
>  .../Dxe/PldmProtocolLib.inf   | 42 +
>  .../Include/Library/BasePldmProtocolLib.h | 41 +
>  .../Include/Protocol/PldmProtocol.h   | 87 +++
>  .../PldmProtocolLibrary/Dxe/PldmProtocolLib.c | 87 +++
>  .../Dxe/PldmProtocolLib.uni   | 18 
>  8 files changed, 282 insertions(+)
>  create mode 100644
> Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtocolLib.i
> nf
>  create mode 100644
> Features/ManageabilityPkg/Include/Library/BasePldmProtocolLib.h
>  create mode 100644
> Features/ManageabilityPkg/Include/Protocol/PldmProtocol.h
>  create mode 100644
> Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtocolLib.c
>  create mode 100644
> Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtocolLib.
> uni
> 
> diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dec
> b/Features/ManageabilityPkg/ManageabilityPkg.dec
> index 3d279ef033..e4d147fede 100644
> --- a/Features/ManageabilityPkg/ManageabilityPkg.dec
> +++ b/Features/ManageabilityPkg/ManageabilityPkg.dec
> @@ -48,3 +48,6 @@
>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]
> +  gEdkiiPldmProtocolGuid= { 0x60997616, 0xDB70, 0x4B5F, { 
> 0x86,
> 0xA4, 0x09, 0x58, 0xA3, 0x71, 0x47, 0xB4 } }
> diff --git a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
> b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
> index 7f8d8df3f0..eda1a36bb9 100644
> --- a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
> +++ b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
> @@ -8,6 +8,9 @@
>  [LibraryClasses]
> 
> ManageabilityTransportHelperLib|ManageabilityPkg/Library/BaseManageability
> TransportHelperLib/BaseManageabilityTransportHelper.inf
> 
> +[LibraryClasses.common.DXE_DRIVER]
> +
> +PldmProtocolLib|ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmPr
> +otocolLib.inf
> +
>  [LibraryClasses.ARM, LibraryClasses.AARCH64]
>#
># This library provides the instrinsic functions generated by a given 
> compiler.
> diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dsc
> b/Features/ManageabilityPkg/ManageabilityPkg.dsc
> index 6a083385fd..412029ef6c 100644
> --- a/Features/ManageabilityPkg/ManageabilityPkg.dsc
> +++ b/Features/ManageabilityPkg/ManageabilityPkg.dsc
> @@ -37,6 +37,7 @@
> 
>  [Components]
> 
> ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/DxeManageability
> TransportKcs.inf
> +  ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtocolLib.inf
> 
>  [LibraryClasses]
> 
> ManageabilityTransportLib|ManageabilityPkg/Library/BaseManageabilityTransp
> ortNullLib/BaseManageabilityTransportNull.inf
> diff --git
> a/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtocolLi
> b.inf
> b/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtocolLi
> b.inf
> new file mode 100644
> index 00..1233d76726
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProt
> +++ ocolLib.inf
> @@ -0,0 +1,42 @@
> +## @file
> +#  Instance of PLDM Protocol Library in DXE phase.
> +#
> +#  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
> +reserved. # #  SPDX-License-Identifier: BSD-2-Clause-Patent # # ##
> +
> +[Defines]
> +  INF_VERSION= 0x00010005
> +  BASE_NAME  = PldmProtocolLib
> +  MODULE_UNI_FILE= PldmProtocolLib.uni
> +  FILE_GUID  = 5B1173E8-6A5A-468B-BDA4-02303530C55C
> +  MODULE_TYPE= DXE_DRIVER
> +  VERSION_STRING = 1.0
> +  LIBRARY_CLASS  = PldmProtocolLib|DXE_RUNTIME_DRIVER
> DXE_DRIVER DXE_CORE UEFI_DRIVER UEFI_APPLICATION
> +
> +#
> +#  VALID_ARCHITECTURES  = IA32 X64
> +#
> +
> +[Sources]
> +  PldmProtocolLib.c
> +
> +[Packages]
> +  ManageabilityPkg/ManageabilityPkg.dec
> +  MdePkg/MdePkg.dec
> +  

Re: [edk2-devel] [edk2-platforms][PATCH V2 03/14] ManageabilityPkg: Add HeaderSize and TrailerSize

2023-04-20 Thread Nickle Wang via groups.io
Reviewed-by: Nickle Wang 

Regards,
Nickle

> -Original Message-
> From: abner.ch...@amd.com 
> Sent: Tuesday, April 18, 2023 3:16 PM
> To: devel@edk2.groups.io
> Cc: Isaac Oram ; Abdul Lateef Attar
> ; Nickle Wang ; Igor Kulchytskyy
> 
> Subject: [edk2-platforms][PATCH V2 03/14] ManageabilityPkg: Add HeaderSize
> and TrailerSize
> 
> External email: Use caution opening links or attachments
> 
> 
> From: Abner Chang 
> 
> Add HeaderSize and TrailerSize in
> MANAGEABILITY_TRANSFER_TOKEN structure.
> Manageability transport interface may used by multiple protocols which have
> different header and trailer of payload. (e.g. MCTP over KCS and IPMI over 
> KCS).
> 
> Signed-off-by: Abner Chang 
> Cc: Isaac Oram 
> Cc: Abdul Lateef Attar 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> ---
>  .../Library/ManageabilityTransportLib.h   |   2 +
>  .../Common/ManageabilityTransportKcs.h|  20 ++-
>  .../IpmiProtocol/Common/IpmiProtocolCommon.h  |  36 +++--
>  .../Common/KcsCommon.c| 152 --
>  .../Dxe/ManageabilityTransportKcs.c   |  14 +-
>  .../IpmiProtocol/Common/IpmiProtocolCommon.c  |  63 +---
>  Features/ManageabilityPkg/Readme.md   |  10 ++
>  7 files changed, 194 insertions(+), 103 deletions(-)
> 
> diff --git
> a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h
> b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h
> index d86d0d87d5..04072aee89 100644
> --- a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h
> +++ b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLi
> +++ b.h
> @@ -168,10 +168,12 @@ struct _MANAGEABILITY_TRANSFER_TOKEN {
>
> ///< which is sent discretely of payload.
>
> ///< This field can be NULL if the
> transport
>
> ///< doesn't require this.
> +  UINT16   TransmitHeaderSize;
> ///< Transmit header
> size in byte.
>MANAGEABILITY_TRANSPORT_TRAILER  TransmitTrailer;   
> ///< This
> is the transport-specific trailer
>
> ///< which is sent discretely of payload.
>
> ///< This field can be NULL if the
> transport
>
> ///< doesn't require this.
> +  UINT16   TransmitTrailerSize;   
> ///< Transmit trailer size
> in byte.
>MANAGEABILITY_TRANSMIT_PACKAGE   TransmitPackage;   
> ///<
> The payload sent to transport interface.
>MANAGEABILITY_RECEIVE_PACKAGEReceivePackage;
> ///< The
> buffer to receive the response.
>EFI_STATUS   TransferStatus;
> ///< The EFI Status of the
> transfer.
> diff --git
> a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/
> ManageabilityTransportKcs.h
> b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/
> ManageabilityTransportKcs.h
> index 2cdf60ba7e..d6685c165e 100644
> ---
> a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/
> ManageabilityTransportKcs.h
> +++ b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Com
> +++ mon/ManageabilityTransportKcs.h
> @@ -41,8 +41,10 @@ typedef struct {
>  /**
>This service communicates with BMC using KCS protocol.
> 
> -  @param[in]  NetFunction   Net function of the command.
> -  @param[in]  Command   IPMI Command.
> +  @param[in]  TransmitHeaderKCS packet header.
> +  @param[in]  TransmitHeaderSizeKCS packet header size in byte.
> +  @param[in]  TransmitTrailer   KCS packet trailer.
> +  @param[in]  TransmitTrailerSize   KCS packet trailer size in byte.
>@param[in]  RequestData   Command Request Data.
>@param[in]  RequestDataSize   Size of Command Request Data.
>@param[out] ResponseData  Command Response Data. The completion
> @@ -69,12 +71,14 @@ typedef struct {
>  EFI_STATUS
>  EFIAPI
>  KcsTransportSendCommand (
> -  IN  UINT8  NetFunction,
> -  IN  UINT8  Command,
> -  IN  UINT8  *RequestData OPTIONAL,
> -  IN  UINT32 RequestDataSize,
> -  OUT UINT8  *ResponseData OPTIONAL,
> -  IN OUT UINT32  *ResponseDataSize OPTIONAL
> +  IN  MANAGEABILITY_TRANSPORT_HEADER   TransmitHeader,
> +  IN  UINT16   TransmitHeaderSize,
> +  IN  MANAGEABILITY_TRANSPORT_TRAILER  TransmitTrailer OPTIONAL,
> +  IN  UINT16   TransmitTrailerSize,
> +  IN  UINT8

Re: [edk2-devel] [edk2-platforms][PATCH V2 02/14] ManageabilityPkg: Support Maximum Transfer Unit

2023-04-20 Thread Nickle Wang via groups.io
Reviewed-by: Nickle Wang 

Regards,
Nickle

> -Original Message-
> From: abner.ch...@amd.com 
> Sent: Tuesday, April 18, 2023 3:16 PM
> To: devel@edk2.groups.io
> Cc: Isaac Oram ; Abdul Lateef Attar
> ; Nickle Wang ; Igor Kulchytskyy
> 
> Subject: [edk2-platforms][PATCH V2 02/14] ManageabilityPkg: Support
> Maximum Transfer Unit
> 
> External email: Use caution opening links or attachments
> 
> 
> From: Abner Chang 
> 
> Update GetTransportCapability to support Maximum Transfer Unit (MTU) of
> transport interface.
> 
> Signed-off-by: Abner Chang 
> Cc: Isaac Oram 
> Cc: Abdul Lateef Attar 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> ---
>  .../Library/ManageabilityTransportLib.h   | 33 ---
>  .../Common/ManageabilityTransportKcs.h|  2 +
>  .../IpmiProtocol/Pei/IpmiPpiInternal.h|  8 ++-
>  .../BaseManageabilityTransportNull.c  | 18 --
>  .../Dxe/ManageabilityTransportKcs.c   | 57 +++
>  .../Universal/IpmiProtocol/Dxe/IpmiProtocol.c | 24 ++--
>  .../Universal/IpmiProtocol/Pei/IpmiPpi.c  | 51 ++---
>  .../Universal/IpmiProtocol/Smm/IpmiProtocol.c | 24 ++--
>  8 files changed, 145 insertions(+), 72 deletions(-)
> 
> diff --git
> a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h
> b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h
> index c022b4ac5c..d86d0d87d5 100644
> --- a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h
> +++ b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLi
> +++ b.h
> @@ -14,6 +14,9 @@
>  #define MANAGEABILITY_TRANSPORT_TOKEN_VERSION
> ((MANAGEABILITY_TRANSPORT_TOKEN_VERSION_MAJOR << 8) |\
> 
> MANAGEABILITY_TRANSPORT_TOKEN_VERSION_MINOR)
> 
> +#define MANAGEABILITY_TRANSPORT_PAYLOAD_SIZE_FROM_CAPABILITY(a)
> (1 << ((a &
> MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_MASK) >>\
> +
> +MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_BIT_POSITI
> ON))
> +
>  typedef struct  _MANAGEABILITY_TRANSPORT_FUNCTION_V1_0
> MANAGEABILITY_TRANSPORT_FUNCTION_V1_0;
>  typedef struct  _MANAGEABILITY_TRANSPORT
> MANAGEABILITY_TRANSPORT;
>  typedef struct  _MANAGEABILITY_TRANSPORT_TOKEN
> MANAGEABILITY_TRANSPORT_TOKEN;
> @@ -68,8 +71,17 @@ typedef UINT32
> MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS;
>  /// Additional transport interface features.
>  ///
>  typedef UINT32 MANAGEABILITY_TRANSPORT_CAPABILITY;
> +/// Bit 0
>  #define
> MANAGEABILITY_TRANSPORT_CAPABILITY_MULTIPLE_TRANSFER_TOKENS
> 0x0001
> -#define
> MANAGEABILITY_TRANSPORT_CAPABILITY_ASYNCHRONOUS_TRANSFER
> 0x0002
> +/// Bit 1
> +#define
> MANAGEABILITY_TRANSPORT_CAPABILITY_ASYNCHRONOUS_TRANSFER
> 0x0002
> +/// Bit 2   - Reserved
> +/// Bit 7:3 - Transport interface maximum payload size, which is (2 ^ 
> bit[7:3] - 1)
> +///   bit[7:3] means no maximum payload.
> +#define
> MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_MASK
> 0x00f8
> +#define
> MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_BIT_POSITIO
> N   3
> +#define
> +MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_NOT_AVAIL
> ABLE  0x00
> +/// Bit 8:31 - Reserved
> 
>  ///
>  /// Definitions of Manageability transport interface functions.
> @@ -187,15 +199,20 @@ AcquireTransportSession (
>);
> 
>  /**
> -  This function returns the transport capabilities.
> -
> -  @param [out]  TransportFeaturePointer to receive transport 
> capabilities.
> -See the definitions of
> -MANAGEABILITY_TRANSPORT_CAPABILITY.
> -
> +  This function returns the transport capabilities according to  the
> + manageability protocol.
> +
> +  @param [in]   TransportToken Transport token acquired from
> manageability
> +   transport library.
> +  @param [out]  TransportFeature   Pointer to receive transport 
> capabilities.
> +   See the definitions of
> +   
> MANAGEABILITY_TRANSPORT_CAPABILITY.
> +  @retval   EFI_SUCCESSTransportCapability is returned 
> successfully.
> +  @retval   EFI_INVALID_PARAMETER  TransportToken is not a valid 
> token.
>  **/
> -VOID
> +EFI_STATUS
>  GetTransportCapability (
> +  IN MANAGEABILITY_TRANSPORT_TOKEN*TransportToken,
>OUT MANAGEABILITY_TRANSPORT_CAPABILITY  *TransportCapability
>);
> 
> diff --git
> a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/
> ManageabilityTransportKcs.h
> b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/
> ManageabilityTransportKcs.h
> index f1758ffd8f..2cdf60ba7e 100644
> ---
> a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/
> ManageabilityTransportKcs.h
> +++ b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Com
> +++ mon/ManageabilityTransportKcs.h
> @@ -32,6 +32,8 @@ typedef 

Re: [edk2-devel] [edk2-platforms][PATCH V2 01/14] ManageabilityPkg: Add more helper functions

2023-04-20 Thread Nickle Wang via groups.io
Hi Abner,

Please find my comments below.

Thanks,
Nickle

> -Original Message-
> From: abner.ch...@amd.com 
> Sent: Tuesday, April 18, 2023 3:16 PM
> To: devel@edk2.groups.io
> Cc: Isaac Oram ; Abdul Lateef Attar
> ; Nickle Wang ; Igor Kulchytskyy
> 
> Subject: [edk2-platforms][PATCH V2 01/14] ManageabilityPkg: Add more helper
> functions
> 
> External email: Use caution opening links or attachments
> 
> 
> From: Abner Chang 
> 
> 1. Add a helper function to output payload binary
>to debug output device.
> 2. Add a helper function to split payload into
>packages according to maximum transfer unit
>of transport interface.
> 3. Add a helper function to generate CRC8.
> 
> Signed-off-by: Abner Chang 
> Cc: Isaac Oram 
> Cc: Abdul Lateef Attar 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> ---
>  .../BaseManageabilityTransportHelper.inf  |   1 +
>  .../Library/ManageabilityTransportHelperLib.h |  98 
>  .../BaseManageabilityTransportHelper.c| 225 +-
>  3 files changed, 314 insertions(+), 10 deletions(-)
> 
> diff --git
> a/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/Ba
> seManageabilityTransportHelper.inf
> b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/Ba
> seManageabilityTransportHelper.inf
> index 5447954144..c9e5eaef60 100644
> ---
> a/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/Ba
> seManageabilityTransportHelper.inf
> +++ b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelper
> +++ Lib/BaseManageabilityTransportHelper.inf
> @@ -25,6 +25,7 @@
>  [LibraryClasses]
>BaseMemoryLib
>DebugLib
> +  MemoryAllocationLib
> 
>  [Packages]
>ManageabilityPkg/ManageabilityPkg.dec
> diff --git
> a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportHelperLib
> .h
> b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportHelperLib
> .h
> index 718ac34a1f..0dbf5ccb3c 100644
> ---
> a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportHelperLib
> .h
> +++ b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportHe
> +++ lperLib.h
> @@ -11,8 +11,24 @@
> 
>  #include 
> 
> +#define DEBUG_MANAGEABILITY_INFO  DEBUG_INFO
> +
>  typedef struct _MANAGEABILITY_PROTOCOL_NAME
> MANAGEABILITY_PROTOCOL_NAME;
> 
> +typedef struct {
> +  UINT8 *PayloadPointer;
> +  UINT32PayloadSize;
> +} MANAGEABILITY_TRANSMISSION_PACKAGE_ATTR;
> +
> +//
> +// The information of multi portions of payload it is // splitted
> +according to transport interface Maximum // Transfer Unit.
> +typedef struct {
> +  UINT16 NumberOfPackages; ///< Number 
> of packages in
> MultiPackages.
> +  MANAGEABILITY_TRANSMISSION_PACKAGE_ATTRMultiPackages[];
> +} MANAGEABILITY_TRANSMISSION_MULTI_PACKAGES;
> +
>  /**
>Helper function returns the human readable name of Manageability
> specification.
> 
> @@ -90,4 +106,86 @@ HelperInitManageabilityTransport (
>OUT MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS
> *TransportAdditionalStatus OPTIONAL
>);
> 
> +/**
> +  This function splits payload into multiple packages according to
> +  the given transport interface Maximum Transfer Unit (MTU).
> +
> +  @param[in]  PreambleSize The additional data size precedes
> +   each package.
> +  @param[in]  PostambleSizeThe additional data size succeeds
> +   each package.
> +  @param[in]  Payload  Pointer to payload.
> +  @param[in]  PayloadSize  Payload size in byte.
> +  @param[in]  MaximumTransferUnit  MTU of transport interface.
> +  @param[out] MultiplePackages Pointer to receive
> +   MANAGEABILITY_TRANSMISSION_MULTI_PACKAGES
> +   structure. Caller has to free the memory
> +   allocated for
> MANAGEABILITY_TRANSMISSION_MULTI_PACKAGES.
> +
> +  @retval   EFI_SUCCESS
> MANAGEABILITY_TRANSMISSION_MULTI_PACKAGES structure
> + is returned successfully.
> +  @retval   EFI_OUT_OF_RESOURCE  Not enough resource to create
> + MANAGEABILITY_TRANSMISSION_MULTI_PACKAGES
> structure.
> +**/
> +EFI_STATUS
> +HelperManageabilitySplitPayload (
> +  IN UINT16  PreambleSize,
> +  IN UINT16  PostambleSize,
> +  IN UINT8   *Payload,
> +  IN UINT32  PayloadSize,
> +  IN UINT32  MaximumTransferUnit,
> +  OUT MANAGEABILITY_TRANSMISSION_MULTI_PACKAGES
> **MultiplePackages
> +  );
> +
> +/**
> +  This function generates CRC8 with given polynomial.
> +
> +  @param[in]  Polynomial   Polynomial in 8-bit.
> +  @param[in]  CrcInitialValue  CRC initial value.
> +  @param[in]  BufferStart  Pointer to buffer starts 

Re: [edk2-devel] [edk2-platforms][PATCH V2 02/14] ManageabilityPkg: Support Maximum Transfer Unit

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

Hi Abner,

I have some inline comments below

On 18/04/2023 14:15, Chang, Abner via groups.io wrote:

From: Abner Chang 

Update GetTransportCapability to support
Maximum Transfer Unit (MTU) of transport interface.

Signed-off-by: Abner Chang 
Cc: Isaac Oram 
Cc: Abdul Lateef Attar 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
---
  .../Library/ManageabilityTransportLib.h   | 33 ---
  .../Common/ManageabilityTransportKcs.h|  2 +
  .../IpmiProtocol/Pei/IpmiPpiInternal.h|  8 ++-
  .../BaseManageabilityTransportNull.c  | 18 --
  .../Dxe/ManageabilityTransportKcs.c   | 57 +++
  .../Universal/IpmiProtocol/Dxe/IpmiProtocol.c | 24 ++--
  .../Universal/IpmiProtocol/Pei/IpmiPpi.c  | 51 ++---
  .../Universal/IpmiProtocol/Smm/IpmiProtocol.c | 24 ++--
  8 files changed, 145 insertions(+), 72 deletions(-)

diff --git 
a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h 
b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h
index c022b4ac5c..d86d0d87d5 100644
--- a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h
+++ b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h
@@ -14,6 +14,9 @@
  #define MANAGEABILITY_TRANSPORT_TOKEN_VERSION
((MANAGEABILITY_TRANSPORT_TOKEN_VERSION_MAJOR << 8) |\
  
MANAGEABILITY_TRANSPORT_TOKEN_VERSION_MINOR)
  
+#define MANAGEABILITY_TRANSPORT_PAYLOAD_SIZE_FROM_CAPABILITY(a)  (1 << ((a & MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_MASK) >>\

+   MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_BIT_POSITION))
+
  typedef struct  _MANAGEABILITY_TRANSPORT_FUNCTION_V1_0  
MANAGEABILITY_TRANSPORT_FUNCTION_V1_0;
  typedef struct  _MANAGEABILITY_TRANSPORT
MANAGEABILITY_TRANSPORT;
  typedef struct  _MANAGEABILITY_TRANSPORT_TOKEN  
MANAGEABILITY_TRANSPORT_TOKEN;
@@ -68,8 +71,17 @@ typedef UINT32 MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS;
  /// Additional transport interface features.
  ///
  typedef UINT32 MANAGEABILITY_TRANSPORT_CAPABILITY;
+/// Bit 0
  #define MANAGEABILITY_TRANSPORT_CAPABILITY_MULTIPLE_TRANSFER_TOKENS  
0x0001
-#define MANAGEABILITY_TRANSPORT_CAPABILITY_ASYNCHRONOUS_TRANSFER 0x0002
+/// Bit 1
+#define MANAGEABILITY_TRANSPORT_CAPABILITY_ASYNCHRONOUS_TRANSFER  0x0002
+/// Bit 2   - Reserved
+/// Bit 7:3 - Transport interface maximum payload size, which is (2 ^ bit[7:3] 
- 1)
+///   bit[7:3] means no maximum payload.


I am confused with your definition here.

Why does it have to be a power of 2?

And we should separate request payload size and response payload size

Can you clarify more about that?

Another question, only PEI_IPMI_PPI_INTERNAL contains MaxPayloadSize, 
how do IPMI/MCTP/PLDM protocol provide Maxpayloadsize


to caller?


+#define MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_MASK   
0x00f8
+#define MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_BIT_POSITION   3
+#define MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_NOT_AVAILABLE  0x00
+/// Bit 8:31 - Reserved
  
  ///

  /// Definitions of Manageability transport interface functions.
@@ -187,15 +199,20 @@ AcquireTransportSession (
);
  
  /**

-  This function returns the transport capabilities.
-
-  @param [out]  TransportFeaturePointer to receive transport 
capabilities.
-See the definitions of
-MANAGEABILITY_TRANSPORT_CAPABILITY.
-
+  This function returns the transport capabilities according to
+  the manageability protocol.
+
+  @param [in]   TransportToken Transport token acquired from 
manageability
+   transport library.
+  @param [out]  TransportFeature   Pointer to receive transport 
capabilities.
+   See the definitions of
+   MANAGEABILITY_TRANSPORT_CAPABILITY.
+  @retval   EFI_SUCCESSTransportCapability is returned 
successfully.
+  @retval   EFI_INVALID_PARAMETER  TransportToken is not a valid token.
  **/
-VOID
+EFI_STATUS
  GetTransportCapability (
+  IN MANAGEABILITY_TRANSPORT_TOKEN*TransportToken,
OUT MANAGEABILITY_TRANSPORT_CAPABILITY  *TransportCapability
);
  
diff --git a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/ManageabilityTransportKcs.h b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/ManageabilityTransportKcs.h

index f1758ffd8f..2cdf60ba7e 100644
--- 
a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/ManageabilityTransportKcs.h
+++ 
b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/ManageabilityTransportKcs.h
@@ -32,6 +32,8 @@ typedef struct {
  #define IPMI_KCS_GET_STATE(s)  (s >> 6)
  #define IPMI_KCS_SET_STATE(s)  (s <<