* [PATCH v3 4/8] ManageabilityPkg: Add ManageabilityTransportHelperLib
2023-03-21 3:21 [PATCH v3 3/8] ManageabilityPkg: Add NULL ManageabilityTransportLib Chang, Abner
@ 2023-03-21 3:21 ` Chang, Abner
2023-03-21 3:21 ` [PATCH v3 5/8] ManageabilityPkg/ManageabilityTransportKcsLib Chang, Abner
` (4 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Chang, Abner @ 2023-03-21 3:21 UTC (permalink / raw)
To: devel
Cc: Liming Gao, Isaac Oram, Nate DeSimone, Nickle Wang,
Igor Kulchytskyy, Abdul Lateef Attar
From: Abner Chang <abner.chang@amd.com>
The helper functions library facilitates reducing
duplicated code in the manageability transport
library instances.
Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Isaac Oram <isaac.w.oram@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Abdul Lateef Attar <abdattar@amd.com>
---
.../ManageabilityPkg/ManageabilityPkg.dec | 23 +-
.../Include/Dsc/Manageability.dsc | 2 +
.../BaseManageabilityTransportHelper.inf | 41 +++
.../Library/ManageabilityTransportHelperLib.h | 93 +++++++
.../BaseManageabilityTransportHelper.c | 261 ++++++++++++++++++
.../BaseManageabilityTransportHelper.uni | 13 +
6 files changed, 432 insertions(+), 1 deletion(-)
create mode 100644 Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.inf
create mode 100644 Features/ManageabilityPkg/Include/Library/ManageabilityTransportHelperLib.h
create mode 100644 Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.c
create mode 100644 Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.uni
diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dec b/Features/ManageabilityPkg/ManageabilityPkg.dec
index ebf6e6315e..ebbb04dc0e 100644
--- a/Features/ManageabilityPkg/ManageabilityPkg.dec
+++ b/Features/ManageabilityPkg/ManageabilityPkg.dec
@@ -22,6 +22,27 @@
# Manageability Transport Library definitions
ManageabilityTransportLib|Include/Library/ManageabilityTransportLib.h
+ ## @libraryclass Manageability Transport Helper Library
+ # Provide the help functions to use ManageabilityTransportLib
+ ManageabilityTransportHelperLib|Include/Library/ManageabilityTransportHelperLib.h
+
[Guids]
- gManageabilityPkgTokenSpaceGuid = { 0xBDEFFF48, 0x1C31, 0x49CD, { 0xA7, 0x6D, 0x92, 0x9E, 0x60, 0xDB, 0xB9, 0xF8 } }
+ gManageabilityPkgTokenSpaceGuid = { 0xBDEFFF48, 0x1C31, 0x49CD, { 0xA7, 0x6D, 0x92, 0x9E, 0x60, 0xDB, 0xB9, 0xF8 } }
+
+ # Manageability Transport Interface type
+ #
+ # Manageability Transport KCS
+ gManageabilityTransportKcsGuid = { 0x5A6E64E9, 0xFD47, 0x4086, { 0xAA, 0xB0, 0x7A, 0x5F, 0xD7, 0x6B, 0x02, 0x2E } }
+ # Manageability Transport I2C
+ gManageabilityTransportI2CGuid = { 0x5B174658, 0x8263, 0x4CB8, { 0xA0, 0x0F, 0xD6, 0x82, 0xE6, 0xBC, 0x74, 0x93 } }
+ # Manageability Transport PCI VDM
+ gManageabilityTransportPciVdmGuid = { 0x388021A7, 0xFB59, 0x4811, { 0x9D, 0xA7, 0xD5, 0x63, 0x7D, 0x04, 0xA7, 0x2F } }
+ # Manageability Protocol Specification
+ #
+ # Manageability Protocol IPMI
+ gManageabilityProtocolIpmiGuid = { 0x36ACA47C, 0xCC80, 0x473B, { 0xAB, 0xEC, 0xF3, 0x98, 0xFF, 0x87, 0x74, 0x5B } }
+ # Manageability Protocol MCTP
+ 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 } }
diff --git a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
index 2cb63c1ca6..994c93f17c 100644
--- a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
+++ b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
@@ -5,6 +5,8 @@
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
+[LibraryClasses]
+ ManageabilityTransportHelperLib|ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.inf
[LibraryClasses.ARM, LibraryClasses.AARCH64]
#
diff --git a/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.inf b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.inf
new file mode 100644
index 0000000000..95c3362ddb
--- /dev/null
+++ b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.inf
@@ -0,0 +1,41 @@
+## @file
+# Null instance of Manageability Transport Helper Library
+#
+# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x0001001B
+ BASE_NAME = BaseManageabilityTransportHelper
+ MODULE_UNI_FILE = BaseManageabilityTransportHelper.uni
+ FILE_GUID = 52F2DE11-A8FC-4A06-B8C6-10DCF4A7397C
+ MODULE_TYPE = BASE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = ManageabilityTransportHelperLib
+
+#
+# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64
+#
+
+[Sources]
+ BaseManageabilityTransportHelper.c
+
+[LibraryClasses]
+ BaseMemoryLib
+ DebugLib
+
+[Packages]
+ ManageabilityPkg/ManageabilityPkg.dec
+ MdePkg/MdePkg.dec
+
+[Guids]
+ gManageabilityTransportKcsGuid
+ gManageabilityTransportI2CGuid
+ gManageabilityTransportPciVdmGuid
+ gManageabilityTransportMctpGuid
+ gManageabilityProtocolIpmiGuid
+ gManageabilityProtocolMctpGuid
+ gManageabilityProtocolPldmGuid
+
diff --git a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportHelperLib.h b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportHelperLib.h
new file mode 100644
index 0000000000..718ac34a1f
--- /dev/null
+++ b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportHelperLib.h
@@ -0,0 +1,93 @@
+/** @file
+
+ This file defines the manageability transport interface library and functions.
+
+ Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef MANAGEABILITY_TRANSPORT_HELPER_LIB_H_
+#define MANAGEABILITY_TRANSPORT_HELPER_LIB_H_
+
+#include <Library/ManageabilityTransportLib.h>
+
+typedef struct _MANAGEABILITY_PROTOCOL_NAME MANAGEABILITY_PROTOCOL_NAME;
+
+/**
+ Helper function returns the human readable name of Manageability specification.
+
+ @param[out] SpecificationGuid The Manageability specification GUID
+
+ @retval !NULL Human readable name is returned;
+ @retval NULL No string found, the given Manageability specification is
+ not supported.
+**/
+CHAR16 *
+HelperManageabilitySpecName (
+ IN EFI_GUID *SpecificationGuid
+ );
+
+/**
+ Helper function to check if the Manageability specification is supported
+ by transport interface or not.
+
+ @param[in] TransportGuid GUID of the transport interface.
+ @param[in] SupportedManageabilityProtocolArray The Manageability protocols supported
+ by the transport interface.
+ @param[in] NumberOfSupportedProtocolInArray Number of protocols in the array.
+ @param[in] ManageabilityProtocolToCheck The Manageability specification to check.
+
+ @retval EFI_SUCCESS Token is created successfully.
+ @retval EFI_INVALID_PARAMETER Either NumberOfSupportedProtocolInArray = 0 or
+ SupportedManageabilityProtocolArray = NULL.
+ @retval EFI_UNSUPPORTED Out of resource to create a new transport session.
+ Otherwise Other errors.
+**/
+EFI_STATUS
+HelperManageabilityCheckSupportedSpec (
+ IN EFI_GUID *TransportGuid,
+ IN EFI_GUID **SupportedManageabilityProtocolArray,
+ IN UINT8 NumberOfSupportedProtocolInArray,
+ IN EFI_GUID *ManageabilityProtocolToCheck
+ );
+
+/**
+ Helper function to acquire the Manageability transport token.
+
+ @param[in] ManageabilityProtocolSpec The Manageability protocol specification.
+ @param[out] TransportToken Pointer to receive Manageability transport
+ token.
+
+ @retval EFI_SUCCESS Token is created successfully.
+ @retval EFI_OUT_OF_RESOURCES Out of resource to create a new transport session.
+ @retval EFI_UNSUPPORTED Token is created successfully.
+ @retval EFI_DEVICE_ERROR The transport interface has problems
+ @retval EFI_INVALID_PARAMETER INput parameter is not valid.
+ Otherwise Other errors.
+**/
+EFI_STATUS
+HelperAcquireManageabilityTransport (
+ IN EFI_GUID *ManageabilityProtocolSpec,
+ OUT MANAGEABILITY_TRANSPORT_TOKEN **TransportToken
+ );
+
+/**
+ Helper function to initial the transport interface.
+
+ @param[in] TransportToken Transport token.
+ @param[in] HardwareInfo Optional hardware information of transport interface.
+ @param[out] TransportAdditionalStatus Transport additional status.
+
+ @retval EFI_SUCCESS Transport interface is initiated successfully.
+ @retval EFI_DEVICE_ERROR The transport interface has problems
+ @retval EFI_INVALID_PARAMETER INput parameter is not valid.
+ Otherwise Other errors.
+**/
+EFI_STATUS
+HelperInitManageabilityTransport (
+ IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken,
+ IN MANAGEABILITY_TRANSPORT_HARDWARE_INFORMATION HardwareInfo OPTIONAL,
+ OUT MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS *TransportAdditionalStatus OPTIONAL
+ );
+
+#endif
diff --git a/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.c b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.c
new file mode 100644
index 0000000000..81da209764
--- /dev/null
+++ b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.c
@@ -0,0 +1,261 @@
+/** @file
+ Null instance of Manageability Transport Helper Library
+
+ Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include <Uefi.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/ManageabilityTransportHelperLib.h>
+
+//
+// BaseManageabilityTransportHelper is used by PEI, DXE and SMM.
+// Make sure the global variables added here should be unchangable.
+//
+MANAGEABILITY_SPECIFICATION_NAME ManageabilitySpecNameTable[] = {
+ { &gManageabilityTransportKcsGuid, L"KCS" },
+ { &gManageabilityTransportI2CGuid, L"I2C" },
+ { &gManageabilityTransportPciVdmGuid, L"PCI VDM" },
+ { &gManageabilityTransportMctpGuid, L"MCTP" },
+ { &gManageabilityProtocolIpmiGuid, L"IPMI" },
+ { &gManageabilityProtocolMctpGuid, L"MCTP" },
+ { &gManageabilityProtocolPldmGuid, L"PLDM" }
+};
+
+UINT16 mManageabilitySpecNum = sizeof (ManageabilitySpecNameTable)/ sizeof (MANAGEABILITY_SPECIFICATION_NAME);
+
+/**
+ Helper function returns the human readable name of Manageability specification.
+
+ @param[in] SpecificationGuid The Manageability specification GUID
+
+ @retval !NULL Human readable name is returned;
+ @retval NULL No string found, the given Manageability specification is
+ not supported.
+**/
+CHAR16 *
+HelperManageabilitySpecName (
+ IN EFI_GUID *SpecificationGuid
+ )
+{
+ UINT16 Index;
+ MANAGEABILITY_SPECIFICATION_NAME *ThisSpec;
+
+ if (mManageabilitySpecNum == 0) {
+ return NULL;
+ }
+
+ if (SpecificationGuid == NULL || IsZeroGuid (SpecificationGuid)) {
+ DEBUG((DEBUG_ERROR, "%a: Improper input GUIDs, could be NULL or zero GUID.\n", __FUNCTION__));
+ return NULL;
+ }
+
+ ThisSpec = ManageabilitySpecNameTable;
+ for (Index = 0; Index < mManageabilitySpecNum; Index++) {
+ if (CompareGuid (
+ SpecificationGuid,
+ ThisSpec->SpecificationGuid
+ ))
+ {
+ return ThisSpec->SpecificationName;
+ }
+
+ ThisSpec++;
+ }
+
+ return NULL;
+}
+
+/**
+ Helper function to check if the Manageability specification is supported
+ by transport interface or not.
+
+ @param[in] TransportGuid GUID of the transport interface.
+ @param[in] SupportedManageabilityProtocolArray The Manageability protocols supported
+ by the transport interface.
+ @param[in] NumberOfSupportedProtocolInArray Number of protocols in the array.
+ @param[in] ManageabilityProtocolToCheck The Manageability specification to check.
+
+ @retval EFI_SUCCESS Token is created successfully.
+ @retval EFI_INVALID_PARAMETER Either NumberOfSupportedProtocolInArray = 0 or
+ SupportedManageabilityProtocolArray = NULL.
+ @retval EFI_UNSUPPORTED Out of resource to create a new transport session.
+ Otherwise Other errors.
+**/
+EFI_STATUS
+HelperManageabilityCheckSupportedSpec (
+ IN EFI_GUID *TransportGuid,
+ IN EFI_GUID **SupportedManageabilityProtocolArray,
+ IN UINT8 NumberOfSupportedProtocolInArray,
+ IN EFI_GUID *ManageabilityProtocolToCheck
+ )
+{
+ UINT16 Index;
+ EFI_GUID **ThisSpecGuid;
+
+ if ((NumberOfSupportedProtocolInArray == 0) || (SupportedManageabilityProtocolArray == NULL)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (TransportGuid == NULL ||
+ IsZeroGuid (TransportGuid) ||
+ ManageabilityProtocolToCheck == NULL ||
+ IsZeroGuid (ManageabilityProtocolToCheck)
+ ) {
+ DEBUG((DEBUG_ERROR, "%a: Improper input GUIDs, could be NULL or zero GUID.\n", __FUNCTION__));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ ThisSpecGuid = SupportedManageabilityProtocolArray;
+ for (Index = 0; Index < NumberOfSupportedProtocolInArray; Index++) {
+ if (CompareGuid (
+ *ThisSpecGuid,
+ ManageabilityProtocolToCheck
+ ))
+ {
+ DEBUG ((
+ DEBUG_VERBOSE,
+ "%a: Transport interface %s supports %s manageability specification.\n",
+ __FUNCTION__,
+ HelperManageabilitySpecName (TransportGuid),
+ HelperManageabilitySpecName (ManageabilityProtocolToCheck)
+ ));
+ return EFI_SUCCESS;
+ }
+
+ ThisSpecGuid++;
+ }
+
+ DEBUG ((
+ DEBUG_ERROR,
+ "%a: Transport interface %s doesn't support %s manageability specification.\n",
+ __FUNCTION__,
+ HelperManageabilitySpecName (TransportGuid),
+ HelperManageabilitySpecName (ManageabilityProtocolToCheck)
+ ));
+ return EFI_UNSUPPORTED;
+}
+
+/**
+ Helper function to acquire the Manageability transport token.
+
+ @param[in] ManageabilityProtocolSpec The Manageability protocol specification.
+ @param[out] TransportToken Pointer to receive Manageability transport
+ token.
+
+ @retval EFI_SUCCESS Token is created successfully.
+ @retval EFI_OUT_OF_RESOURCES Out of resource to create a new transport session.
+ @retval EFI_UNSUPPORTED Token is created successfully.
+ @retval EFI_INVALID_PARAMETER Input parameter is not valid.
+ Otherwise Other errors.
+**/
+EFI_STATUS
+HelperAcquireManageabilityTransport (
+ IN EFI_GUID *ManageabilityProtocolSpec,
+ OUT MANAGEABILITY_TRANSPORT_TOKEN **TransportToken
+ )
+{
+ EFI_STATUS Status;
+ CHAR16 *ManageabilityProtocolName;
+ CHAR16 *ManageabilityTransportName;
+
+ DEBUG ((DEBUG_INFO, "%a: Entry\n", __FUNCTION__));
+ if ((TransportToken == NULL) || (ManageabilityProtocolSpec == NULL)) {
+ DEBUG ((DEBUG_ERROR, "%a: One of the required input parameters is NULL.\n", __FUNCTION__));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ *TransportToken = NULL;
+ ManageabilityProtocolName = HelperManageabilitySpecName (ManageabilityProtocolSpec);
+ if (ManageabilityProtocolName == NULL) {
+ DEBUG ((DEBUG_ERROR, "%a: Unsupported Manageability Protocol Specification.\n", __FUNCTION__));
+ return EFI_UNSUPPORTED;
+ }
+
+ DEBUG ((DEBUG_INFO, " Manageability protocol %s is going to acquire transport interface token...\n", ManageabilityProtocolName));
+
+ Status = AcquireTransportSession (ManageabilityProtocolSpec, TransportToken);
+ if (Status == EFI_UNSUPPORTED) {
+ DEBUG ((DEBUG_ERROR, "%a: No supported transport interface for %s packet.\n", __FUNCTION__, ManageabilityProtocolName));
+ return Status;
+ }
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "%a: Fail to acquire Manageability transport token for %s (%r).\n",
+ __FUNCTION__,
+ ManageabilityProtocolName,
+ Status
+ ));
+ return Status;
+ }
+
+ ManageabilityTransportName = HelperManageabilitySpecName ((*TransportToken)->Transport->ManageabilityTransportSpecification);
+ if (ManageabilityTransportName == NULL) {
+ DEBUG ((DEBUG_ERROR, "%a: Unsupported Manageability Transport Interface Specification\n", __FUNCTION__));
+ return EFI_UNSUPPORTED;
+ }
+
+ DEBUG ((DEBUG_INFO, "%a: This is the transfer session for %s over %s\n", __FUNCTION__, ManageabilityProtocolName, ManageabilityTransportName));
+ return Status;
+}
+
+/**
+ Helper function to initial the transport interface.
+
+ @param[in] TransportToken Transport token.
+ @param[in] HardwareInfo Optional hardware information of transport interface.
+ @param[out] TransportAdditionalStatus Transport additional status.
+
+ @retval EFI_SUCCESS Transport interface is initiated successfully.
+ @retval EFI_DEVICE_ERROR The transport interface has problems
+ @retval EFI_INVALID_PARAMETER INput parameter is not valid.
+ Otherwise Other errors.
+**/
+EFI_STATUS
+HelperInitManageabilityTransport (
+ IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken,
+ IN MANAGEABILITY_TRANSPORT_HARDWARE_INFORMATION HardwareInfo OPTIONAL,
+ OUT MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS *TransportAdditionalStatus OPTIONAL
+ )
+{
+ EFI_STATUS Status;
+
+ if (TransportToken == NULL) {
+ DEBUG ((DEBUG_ERROR, "%a: TransportToken is invalid.\n", __FUNCTION__));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ // Initial transport interface.
+ Status = TransportToken->Transport->Function.Version1_0->TransportInit (TransportToken, HardwareInfo);
+ if ((Status != EFI_SUCCESS) && (Status != EFI_ALREADY_STARTED)) {
+ if (Status == EFI_DEVICE_ERROR) {
+ // Try to reset the transport and initialize it again.
+ Status = TransportToken->Transport->Function.Version1_0->TransportReset (
+ TransportToken,
+ TransportAdditionalStatus
+ );
+ if (EFI_ERROR (Status)) {
+ if (Status == EFI_UNSUPPORTED) {
+ DEBUG ((DEBUG_ERROR, "%a: Transport interface doesn't have reset capability.\n", __FUNCTION__));
+ } else {
+ DEBUG ((DEBUG_ERROR, "%a: Fail to reset transport interface (%r).\n", __FUNCTION__, Status));
+ }
+
+ Status = EFI_DEVICE_ERROR;
+ } else {
+ Status = TransportToken->Transport->Function.Version1_0->TransportInit (TransportToken, HardwareInfo);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: Transport interface is not able to use after the reset (%r).\n", __FUNCTION__, Status));
+ }
+ }
+ } else {
+ DEBUG ((DEBUG_ERROR, "%a: Transport interface is not able to use (%r).\n", __FUNCTION__, Status));
+ }
+ }
+
+ return Status;
+}
diff --git a/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.uni b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.uni
new file mode 100644
index 0000000000..dfb6051aeb
--- /dev/null
+++ b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/BaseManageabilityTransportHelper.uni
@@ -0,0 +1,13 @@
+// /** @file
+// Null instance of Manageability Transport Helper Library
+//
+// Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// **/
+
+#string STR_MODULE_ABSTRACT #language en-US "Manageability Transport Helper Library"
+
+#string STR_MODULE_DESCRIPTION #language en-US "Manageability Transport Helper Functions."
+
--
2.37.1.windows.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v3 5/8] ManageabilityPkg/ManageabilityTransportKcsLib
2023-03-21 3:21 [PATCH v3 3/8] ManageabilityPkg: Add NULL ManageabilityTransportLib Chang, Abner
2023-03-21 3:21 ` [PATCH v3 4/8] ManageabilityPkg: Add ManageabilityTransportHelperLib Chang, Abner
@ 2023-03-21 3:21 ` Chang, Abner
2023-03-21 3:21 ` [PATCH v3 6/8] ManageabilityPkg: Implement Ipmi Protocol/Ppi Chang, Abner
` (3 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Chang, Abner @ 2023-03-21 3:21 UTC (permalink / raw)
To: devel
Cc: Liming Gao, Isaac Oram, Nate DeSimone, Abdul Lateef Attar,
Nickle Wang, Igor Kulchytskyy
From: Abner Chang <abner.chang@amd.com>
This is the KCS manageability transport library
instance follows the design guidance described
in Readme file under ManageabilityPkg.
Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Isaac Oram <isaac.w.oram@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Abdul Lateef Attar <abdattar@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
---
.../ManageabilityPkg/ManageabilityPkg.dsc | 3 +
.../Dxe/DxeManageabilityTransportKcs.inf | 44 ++
.../Common/ManageabilityTransportKcs.h | 105 ++++
.../Common/KcsCommon.c | 502 ++++++++++++++++++
.../Dxe/ManageabilityTransportKcs.c | 389 ++++++++++++++
.../Dxe/ManageabilityTransportKcs.uni | 13 +
6 files changed, 1056 insertions(+)
create mode 100644 Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/DxeManageabilityTransportKcs.inf
create mode 100644 Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/ManageabilityTransportKcs.h
create mode 100644 Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/KcsCommon.c
create mode 100644 Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/ManageabilityTransportKcs.c
create mode 100644 Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/ManageabilityTransportKcs.uni
diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dsc b/Features/ManageabilityPkg/ManageabilityPkg.dsc
index 0dd0ab41fc..45e07ac34f 100644
--- a/Features/ManageabilityPkg/ManageabilityPkg.dsc
+++ b/Features/ManageabilityPkg/ManageabilityPkg.dsc
@@ -36,6 +36,9 @@
!include MinPlatformPkg/Include/Dsc/CorePeiLib.dsc
!include MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc
+[Components]
+ ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/DxeManageabilityTransportKcs.inf
+
[LibraryClasses]
ManageabilityTransportLib|ManageabilityPkg/Library/BaseManageabilityTransportNullLib/BaseManageabilityTransportNull.inf
diff --git a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/DxeManageabilityTransportKcs.inf b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/DxeManageabilityTransportKcs.inf
new file mode 100644
index 0000000000..f0a6afa074
--- /dev/null
+++ b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/DxeManageabilityTransportKcs.inf
@@ -0,0 +1,44 @@
+## @file
+# KCS instance of Manageability Transport Library
+#
+# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x0001001B
+ BASE_NAME = DxeManageabilityTransportKcs
+ MODULE_UNI_FILE = ManageabilityTransportKcs.uni
+ FILE_GUID = FCCC8B34-145A-4927-9F08-553ADC579AF7
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = ManageabilityTransportLib
+
+#
+# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64
+#
+
+[Sources]
+ ManageabilityTransportKcs.c
+ ../Common/KcsCommon.c
+ ../Common/ManageabilityTransportKcs.h
+
+[Packages]
+ ManageabilityPkg/ManageabilityPkg.dec
+ MdePkg/MdePkg.dec
+
+[LibraryClasses]
+ DebugLib
+ IoLib
+ TimerLib
+ MemoryAllocationLib
+
+[Guids]
+ gManageabilityTransportKcsGuid
+ gManageabilityProtocolMctpGuid
+ gManageabilityProtocolIpmiGuid
+
+[FixedPcd]
+ gEfiMdePkgTokenSpaceGuid.PcdIpmiKcsBaseAddress # Used as default KCS I/O base adddress
+
diff --git a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/ManageabilityTransportKcs.h b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/ManageabilityTransportKcs.h
new file mode 100644
index 0000000000..f1758ffd8f
--- /dev/null
+++ b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/ManageabilityTransportKcs.h
@@ -0,0 +1,105 @@
+/** @file
+
+ Manageability transport KCS internal used definitions.
+
+ Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef MANAGEABILITY_TRANSPORT_KCS_LIB_H_
+#define MANAGEABILITY_TRANSPORT_KCS_LIB_H_
+
+#include <Library/ManageabilityTransportLib.h>
+
+#define MANAGEABILITY_TRANSPORT_KCS_SIGNATURE SIGNATURE_32 ('M', 'T', 'K', 'C')
+
+#define KCS_BASE_ADDRESS mKcsHardwareInfo.IoBaseAddress
+#define KCS_REG_DATA_IN mKcsHardwareInfo.IoDataInAddress
+#define KCS_REG_DATA_OUT mKcsHardwareInfo.IoDataOutAddress
+#define KCS_REG_COMMAND mKcsHardwareInfo.IoCommandAddress
+#define KCS_REG_STATUS mKcsHardwareInfo.IoStatusAddress
+
+///
+/// Manageability transport KCS internal data structure.
+///
+typedef struct {
+ UINTN Signature;
+ MANAGEABILITY_TRANSPORT_TOKEN Token;
+} MANAGEABILITY_TRANSPORT_KCS;
+
+#define MANAGEABILITY_TRANSPORT_KCS_FROM_LINK(a) CR (a, MANAGEABILITY_TRANSPORT_KCS, Token, MANAGEABILITY_TRANSPORT_KCS_SIGNATURE)
+
+#define IPMI_KCS_GET_STATE(s) (s >> 6)
+#define IPMI_KCS_SET_STATE(s) (s << 6)
+
+/// 5 sec, according to IPMI spec
+#define IPMI_KCS_TIMEOUT_5_SEC 5000*1000
+#define IPMI_KCS_TIMEOUT_1MS 1000
+
+/**
+ This service communicates with BMC using KCS protocol.
+
+ @param[in] NetFunction Net function of the command.
+ @param[in] Command IPMI Command.
+ @param[in] RequestData Command Request Data.
+ @param[in] RequestDataSize Size of Command Request Data.
+ @param[out] ResponseData Command Response Data. The completion
+ code is the first byte of response
+ data.
+ @param[in, out] ResponseDataSize Size of Command Response Data.
+
+ @retval EFI_SUCCESS The command byte stream was
+ successfully submit to the device and a
+ response was successfully received.
+ @retval EFI_NOT_FOUND The command was not successfully sent
+ to the device or a response was not
+ successfully received from the device.
+ @retval EFI_NOT_READY Ipmi Device is not ready for Ipmi
+ command access.
+ @retval EFI_DEVICE_ERROR Ipmi Device hardware error.
+ @retval EFI_TIMEOUT The command time out.
+ @retval EFI_UNSUPPORTED The command was not successfully sent to
+ the device.
+ @retval EFI_OUT_OF_RESOURCES The resource allocation is out of
+ resource or data size error.
+**/
+
+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
+ );
+
+/**
+ This function reads 8-bit value from register address.
+
+ @param[in] Address This represents either 16-bit IO address
+ or 32-bit memory mapped address.
+
+ @retval UINT8 8-bit value.
+**/
+UINT8
+KcsRegisterRead8 (
+ MANAGEABILITY_TRANSPORT_HARDWARE_IO Address
+ );
+
+/**
+ This function writes 8-bit value to register address.
+
+ @param[in] Address This represents either 16-bit IO address
+ or 32-bit memory mapped address.
+ @param[in] Value 8-bit value write to register address
+
+**/
+VOID
+KcsRegisterWrite8 (
+ MANAGEABILITY_TRANSPORT_HARDWARE_IO Address,
+ UINT8 Value
+ );
+
+#endif
diff --git a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/KcsCommon.c b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/KcsCommon.c
new file mode 100644
index 0000000000..b141c65381
--- /dev/null
+++ b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/KcsCommon.c
@@ -0,0 +1,502 @@
+/** @file
+
+ KCS instance of Manageability Transport Library
+
+ Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+#include <Uefi.h>
+#include <IndustryStandard/IpmiKcs.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/IoLib.h>
+#include <Library/DebugLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/TimerLib.h>
+
+#include "ManageabilityTransportKcs.h"
+
+extern MANAGEABILITY_TRANSPORT_KCS_HARDWARE_INFO mKcsHardwareInfo;
+
+/**
+ This function waits for parameter Flag to set.
+ Checks status flag in every 1ms internal till 5 seconds elapses.
+
+ @param[in] Flag KCS Flag to test.
+ @retval EFI_SUCCESS The KCS flag under test is set.
+ @retval EFI_TIMEOUT The KCS flag didn't set in 5 second windows.
+**/
+EFI_STATUS
+WaitStatusSet (
+ IN UINT8 Flag
+ )
+{
+ UINT64 Timeout = 0;
+
+ while (!(KcsRegisterRead8 (KCS_REG_STATUS) & Flag)) {
+ MicroSecondDelay (IPMI_KCS_TIMEOUT_1MS);
+ Timeout = Timeout + IPMI_KCS_TIMEOUT_1MS;
+ if (Timeout >= IPMI_KCS_TIMEOUT_5_SEC) {
+ return EFI_TIMEOUT;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function waits for parameter Flag to get cleared.
+ Checks status flag in every 1ms internal till 5 seconds elapses.
+
+ @param[in] Flag KCS Flag to test.
+
+ @retval EFI_SUCCESS The KCS flag under test is clear.
+ @retval EFI_TIMEOUT The KCS flag didn't cleared in 5 second windows.
+**/
+EFI_STATUS
+WaitStatusClear (
+ IN UINT8 Flag
+ )
+{
+ UINT64 Timeout = 0;
+
+ while (KcsRegisterRead8 (KCS_REG_STATUS) & Flag) {
+ MicroSecondDelay (IPMI_KCS_TIMEOUT_1MS);
+ Timeout = Timeout + IPMI_KCS_TIMEOUT_1MS;
+ if (Timeout >= IPMI_KCS_TIMEOUT_5_SEC) {
+ return EFI_TIMEOUT;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function validates KCS OBF bit.
+ Checks whether OBF bit is set or not.
+
+ @retval EFI_SUCCESS OBF bit is set.
+ @retval EFI_NOT_READY OBF bit is not set.
+**/
+EFI_STATUS
+ClearOBF (
+ VOID
+ )
+{
+ if (KcsRegisterRead8 (KCS_REG_STATUS) & IPMI_KCS_OBF) {
+ KcsRegisterRead8 (KCS_REG_DATA_IN); // read the data to clear the OBF
+ if (KcsRegisterRead8 (KCS_REG_STATUS) & IPMI_KCS_OBF) {
+ return EFI_NOT_READY;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function writes/sends data to the KCS port.
+ 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] NetFunction Net function of the command.
+ @param[in] Command IPMI Command.
+ @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
+ successfully received.
+ @retval EFI_NOT_FOUND The command was not successfully sent to the
+ device or a response was not successfully
+ received from the device.
+ @retval EFI_NOT_READY Ipmi Device is not ready for Ipmi command
+ access.
+ @retval EFI_DEVICE_ERROR Ipmi Device hardware error.
+ @retval EFI_TIMEOUT The command time out.
+ @retval EFI_UNSUPPORTED The command was not successfully sent to
+ the device.
+ @retval EFI_OUT_OF_RESOURCES The resource allocation is out of resource or
+ data size error.
+**/
+EFI_STATUS
+KcsTransportWrite (
+ IN UINT8 NetFunction,
+ IN UINT8 Command,
+ IN UINT8 *RequestData OPTIONAL,
+ IN UINT32 RequestDataSize
+ )
+{
+ EFI_STATUS Status;
+ UINT32 Length;
+ UINT8 *Buffer;
+ UINT8 *BufferPtr;
+
+ // Validation on RequestData and RequestDataSize.
+ if ((RequestData == NULL && RequestDataSize != 0) ||
+ (RequestData != NULL && RequestDataSize == 0)
+ ) {
+ DEBUG ((DEBUG_ERROR, "%a: Mismatched values of RequestData or RequestDataSize.\n", __FUNCTION__));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Length = sizeof (NetFunction) + sizeof (Command);
+ if (RequestData != NULL) {
+ Length = Length + RequestDataSize;
+ }
+
+ Buffer = AllocateZeroPool (Length);
+ if (Buffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ //
+ // Buffer[0] = NetFunction
+ // Buffer[1] = Command
+ // Buffer [2..RequestDataSize] = RequestData
+ //
+ BufferPtr = Buffer;
+ CopyMem (BufferPtr, &NetFunction, sizeof (NetFunction));
+ BufferPtr += sizeof (NetFunction);
+ CopyMem (BufferPtr, &Command, sizeof (Command));
+ BufferPtr += sizeof (Command);
+ if (Length > (sizeof (NetFunction) + sizeof (Command))) {
+ CopyMem (BufferPtr, RequestData, RequestDataSize);
+ }
+
+ BufferPtr = Buffer;
+
+ // Step 1. wait for IBF to get clear
+ Status = WaitStatusClear (IPMI_KCS_IBF);
+ if (EFI_ERROR (Status)) {
+ FreePool (Buffer);
+ return Status;
+ }
+
+ // Step 2. clear OBF
+ if (EFI_ERROR (ClearOBF ())) {
+ FreePool (Buffer);
+ return EFI_NOT_READY;
+ }
+
+ // Step 3. WR_START to CMD, phase=wr_start
+ KcsRegisterWrite8 (KCS_REG_COMMAND, IPMI_KCS_CONTROL_CODE_WRITE_START);
+
+ // Step 4. wait for IBF to get clear
+ Status = WaitStatusClear (IPMI_KCS_IBF);
+ if (EFI_ERROR (Status)) {
+ FreePool (Buffer);
+ return Status;
+ }
+
+ // Step 5. check state it should be WRITE_STATE, else exit with error
+ if (IPMI_KCS_GET_STATE (KcsRegisterRead8 (KCS_REG_STATUS)) != IPMI_KCS_WRITE_STATE) {
+ FreePool (Buffer);
+ return EFI_NOT_READY;
+ }
+
+ // Step 6, Clear OBF
+ if (EFI_ERROR (ClearOBF ())) {
+ FreePool (Buffer);
+ return EFI_NOT_READY;
+ }
+
+ while (Length > 1) {
+ // Step 7, phase wr_data, write one byte of Data
+ KcsRegisterWrite8 (KCS_REG_DATA_OUT, *BufferPtr);
+ Length--;
+ BufferPtr++;
+
+ // Step 8. wait for IBF clear
+ Status = WaitStatusClear (IPMI_KCS_IBF);
+ if (EFI_ERROR (Status)) {
+ FreePool (Buffer);
+ return Status;
+ }
+
+ // Step 9. check state it should be WRITE_STATE, else exit with error
+ if (IPMI_KCS_GET_STATE (KcsRegisterRead8 (KCS_REG_STATUS)) != IPMI_KCS_WRITE_STATE) {
+ FreePool (Buffer);
+ return EFI_NOT_READY;
+ }
+
+ // Step 10
+ if (EFI_ERROR (ClearOBF ())) {
+ FreePool (Buffer);
+ return EFI_NOT_READY;
+ }
+
+ //
+ // Step 11, check for DATA completion if more than one byte;
+ // if still need to be transferred then go to step 7 and repeat
+ //
+ }
+
+ // Step 12, WR_END to CMD
+ KcsRegisterWrite8 (KCS_REG_COMMAND, IPMI_KCS_CONTROL_CODE_WRITE_END);
+
+ // Step 13. wait for IBF to get clear
+ Status = WaitStatusClear (IPMI_KCS_IBF);
+ if (EFI_ERROR (Status)) {
+ FreePool (Buffer);
+ return Status;
+ }
+
+ // Step 14. check state it should be WRITE_STATE, else exit with error
+ if (IPMI_KCS_GET_STATE (KcsRegisterRead8 (KCS_REG_STATUS)) != IPMI_KCS_WRITE_STATE) {
+ FreePool (Buffer);
+ return EFI_NOT_READY;
+ }
+
+ // Step 15
+ if (EFI_ERROR (ClearOBF ())) {
+ FreePool (Buffer);
+ return EFI_NOT_READY;
+ }
+
+ // Step 16, write the last byte
+ KcsRegisterWrite8 (KCS_REG_DATA_OUT, *BufferPtr);
+ FreePool (Buffer);
+ return EFI_SUCCESS;
+}
+
+/**
+ This function sends/receives data from KCS port.
+ Algorithm is based on flow chart provided in IPMI spec 2.0
+ Figure 9-7, KCS Interface BMC to SMS Read Transfer Flow Chart
+
+ @param [in] DataBytes Buffer to hold the read Data.
+ @param [in, out] Length Number of Bytes read from KCS port.
+ @retval EFI_SUCCESS The command byte stream was
+ successfully submit to the device and
+ a response was successfully received.
+ @retval EFI_NOT_FOUND The command was not successfully sent
+ to the device or a response was not
+ successfully received from the
+ device.
+ @retval EFI_NOT_READY Ipmi Device is not ready for Ipmi
+ command access.
+ @retval EFI_DEVICE_ERROR Ipmi Device hardware error.
+ @retval EFI_TIMEOUT The command time out.
+ @retval EFI_UNSUPPORTED The command was not successfully set
+ to the device.
+ @retval EFI_OUT_OF_RESOURCES The resource allocation is out of
+ resource or data size error.
+**/
+EFI_STATUS
+KcsTransportRead (
+ OUT UINT8 *DataByte,
+ IN OUT UINT32 *Length
+ )
+{
+ EFI_STATUS Status;
+ UINT32 ReadLength;
+
+ if (DataByte == NULL || *Length == 0) {
+ DEBUG ((DEBUG_ERROR, "%a: Either DataByte is NULL or Length is 0.\n", __FUNCTION__));
+ return EFI_INVALID_PARAMETER;
+ }
+ ReadLength = 0;
+ while (ReadLength < *Length) {
+ // Step 1. wait for IBF to get clear
+ Status = WaitStatusClear (IPMI_KCS_IBF);
+ if (EFI_ERROR (Status)) {
+ *Length = ReadLength;
+ return Status;
+ }
+
+ // Step 2. check state it should be READ_STATE, else exit with error
+ if (IPMI_KCS_GET_STATE (KcsRegisterRead8 (KCS_REG_STATUS)) == IPMI_KCS_READ_STATE) {
+ // Step 2.1.1 check of OBF to get clear
+ Status = WaitStatusSet (IPMI_KCS_OBF);
+ if (EFI_ERROR (Status)) {
+ *Length = ReadLength;
+ return Status;
+ }
+
+ // Step 2.1.2 read data from data out
+ DataByte[ReadLength++] = KcsRegisterRead8 (KCS_REG_DATA_IN);
+ Status = WaitStatusClear (IPMI_KCS_IBF);
+ if (EFI_ERROR (Status)) {
+ *Length = ReadLength;
+ return Status;
+ }
+
+ // Step 2.1.3 Write READ byte to data in register.
+ KcsRegisterWrite8 (KCS_REG_DATA_OUT, IPMI_KCS_CONTROL_CODE_READ);
+ } else if (IPMI_KCS_GET_STATE (KcsRegisterRead8 (KCS_REG_STATUS)) == IPMI_KCS_IDLE_STATE) {
+ // Step 2.2.1
+ Status = WaitStatusSet (IPMI_KCS_OBF);
+ if (EFI_ERROR (Status)) {
+ *Length = ReadLength;
+ return Status;
+ }
+
+ // Step 2.2.2 read dummy data
+ KcsRegisterRead8 (KCS_REG_DATA_IN); // Dummy read as per IPMI spec
+ *Length = ReadLength;
+ return EFI_SUCCESS;
+ } else {
+ *Length = ReadLength;
+ return EFI_DEVICE_ERROR;
+ }
+ }
+
+ *Length = ReadLength;
+ return EFI_SUCCESS;
+}
+
+/**
+ This service communicates with BMC using KCS protocol.
+
+ @param[in] NetFunction Net function of the command.
+ @param[in] Command IPMI Command.
+ @param[in] RequestData Command Request Data.
+ @param[in] RequestDataSize Size of Command Request Data.
+ @param[out] ResponseData Command Response Data. The completion
+ code is the first byte of response
+ data.
+ @param[in, out] ResponseDataSize Size of Command Response Data.
+ When IN, it is the expected data size
+ of response data.
+ When OUT, it is the data size of response
+ exactly returned.
+ @retval EFI_SUCCESS The command byte stream was
+ successfully submit to the device and a
+ response was successfully received.
+ @retval EFI_NOT_FOUND The command was not successfully sent
+ to the device or a response was not
+ successfully received from the device.
+ @retval EFI_NOT_READY Ipmi Device is not ready for Ipmi
+ command access.
+ @retval EFI_DEVICE_ERROR Ipmi Device hardware error.
+ @retval EFI_TIMEOUT The command time out.
+ @retval EFI_UNSUPPORTED The command was not successfully sent to
+ the device.
+ @retval EFI_OUT_OF_RESOURCES The resource allocation is out of
+ resource or data size error.
+**/
+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
+ )
+{
+ EFI_STATUS Status;
+ UINT32 RspHeaderSize;
+ IPMI_KCS_RESPONSE_HEADER RspHeader;
+
+ if ((RequestData != NULL) && (RequestDataSize == 0)) {
+ DEBUG((DEBUG_ERROR, "%a: Mismatched values of RequestData and RequestDataSize\n", __FUNCTION__));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if ((ResponseData != NULL) && ((ResponseDataSize != NULL) && (*ResponseDataSize == 0))) {
+ DEBUG((DEBUG_ERROR, "%a: Mismatched values of ResponseData and ResponseDataSize\n", __FUNCTION__));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Status = KcsTransportWrite (
+ (NetFunction << 2),
+ Command,
+ RequestData,
+ RequestDataSize
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "IPMI KCS Write Failed with Status(%r) for NetFunction(0x%x)," \
+ " Command(0x%x).\n",
+ Status,
+ NetFunction,
+ Command
+ ));
+ return Status;
+ }
+
+ //
+ // Read the response header
+ RspHeaderSize = sizeof (IPMI_KCS_RESPONSE_HEADER);
+ Status = KcsTransportRead ((UINT8 *)&RspHeader, &RspHeaderSize);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "IPMI KCS read response header failed Status(%r), " \
+ "RspNetFunctionLun = 0x%x, " \
+ "Comamnd = 0x%x \n",
+ Status,
+ RspHeader.NetFunc,
+ RspHeader.Command
+ ));
+ return (Status);
+ }
+
+ Status = KcsTransportRead ((UINT8 *)ResponseData, ResponseDataSize);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "IPMI KCS response read Failed with Status(%r) for NetFunction(0x%x)," \
+ " Command(0x%x).\n",
+ Status,
+ NetFunction,
+ Command
+ ));
+ }
+
+ return Status;
+}
+
+/**
+ This function reads 8-bit value from register address.
+
+ @param[in] Address This represents either 16-bit IO address
+ or 32-bit memory mapped address.
+
+ @retval UINT8 8-bit value.
+**/
+UINT8
+KcsRegisterRead8 (
+ MANAGEABILITY_TRANSPORT_HARDWARE_IO Address
+ )
+{
+ UINT8 Value;
+
+ if (mKcsHardwareInfo.MemoryMap == MANAGEABILITY_TRANSPORT_KCS_MEMORY_MAP_IO) {
+ // Read 8-bit value from 32-bit Memory mapped address.
+ Value = MmioRead8 ((UINTN)Address.IoAddress32);
+ } else {
+ // Read 8-bit value from 16-bit I/O address
+ Value = IoRead8 ((UINTN)Address.IoAddress16);
+ }
+
+ return Value;
+}
+
+/**
+ This function writes 8-bit value to register address.
+
+ @param[in] Address This represents either 16-bit IO address
+ or 32-bit memory mapped address.
+ @param[in] Value 8-bit value write to register address
+
+**/
+VOID
+KcsRegisterWrite8 (
+ MANAGEABILITY_TRANSPORT_HARDWARE_IO Address,
+ UINT8 Value
+ )
+{
+ if (mKcsHardwareInfo.MemoryMap == MANAGEABILITY_TRANSPORT_KCS_MEMORY_MAP_IO) {
+ // Write 8-bit value to 32-bit Memory mapped address.
+ MmioWrite8 ((UINTN)Address.IoAddress32, Value);
+ } else {
+ // Write 8-bit value to 16-bit I/O address
+ IoWrite8 ((UINTN)Address.IoAddress16, Value);
+ }
+}
diff --git a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/ManageabilityTransportKcs.c b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/ManageabilityTransportKcs.c
new file mode 100644
index 0000000000..8101e63c22
--- /dev/null
+++ b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/ManageabilityTransportKcs.c
@@ -0,0 +1,389 @@
+/** @file
+
+ KCS instance of Manageability Transport Library
+
+ Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+*/
+
+#include <Uefi.h>
+#include <IndustryStandard/IpmiKcs.h>
+#include <Library/IoLib.h>
+#include <Library/DebugLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/ManageabilityTransportLib.h>
+#include <Library/ManageabilityTransportIpmiLib.h>
+#include <Library/ManageabilityTransportHelperLib.h>
+
+#include "ManageabilityTransportKcs.h"
+
+MANAGEABILITY_TRANSPORT_KCS *mSingleSessionToken = NULL;
+
+EFI_GUID *SupportedManageabilityProtocol[] = {
+ &gManageabilityProtocolIpmiGuid,
+ &gManageabilityProtocolMctpGuid
+};
+
+UINT8 NumberOfSupportedProtocol = (sizeof (SupportedManageabilityProtocol)/sizeof (EFI_GUID *));
+
+MANAGEABILITY_TRANSPORT_KCS_HARDWARE_INFO mKcsHardwareInfo;
+
+/**
+ This function initializes the transport interface.
+
+ @param [in] TransportToken The transport token acquired through
+ AcquireTransportSession function.
+ @param [in] HardwareInfo The hardware information
+ assigned to KCS transport interface.
+
+ @retval EFI_SUCCESS Transport interface is initialized
+ successfully.
+ @retval EFI_INVALID_PARAMETER The invalid transport token.
+ @retval EFI_NOT_READY The transport interface works fine but
+ @retval is not ready.
+ @retval EFI_DEVICE_ERROR The transport interface has problems.
+ @retval EFI_ALREADY_STARTED Teh protocol interface has already initialized.
+ @retval Otherwise Other errors.
+
+**/
+EFI_STATUS
+EFIAPI
+KcsTransportInit (
+ IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken,
+ IN MANAGEABILITY_TRANSPORT_HARDWARE_INFORMATION HardwareInfo OPTIONAL
+ )
+{
+ CHAR16 *ManageabilityProtocolName;
+
+ if (TransportToken == NULL) {
+ DEBUG ((DEBUG_ERROR, "%a: Invalid transport token.\n", __FUNCTION__));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (HardwareInfo.Kcs == NULL) {
+ DEBUG ((DEBUG_INFO, "%a: Hardware information is not provided, use dfault settings.\n", __FUNCTION__));
+ mKcsHardwareInfo.MemoryMap = MANAGEABILITY_TRANSPORT_KCS_IO_MAP_IO;
+ mKcsHardwareInfo.IoBaseAddress.IoAddress16 = PcdGet16 (PcdIpmiKcsBaseAddress);
+ mKcsHardwareInfo.IoDataInAddress.IoAddress16 = mKcsHardwareInfo.IoBaseAddress.IoAddress16 + IPMI_KCS_DATA_IN_REGISTER_OFFSET;
+ mKcsHardwareInfo.IoDataOutAddress.IoAddress16 = mKcsHardwareInfo.IoBaseAddress.IoAddress16 + IPMI_KCS_DATA_OUT_REGISTER_OFFSET;
+ mKcsHardwareInfo.IoCommandAddress.IoAddress16 = mKcsHardwareInfo.IoBaseAddress.IoAddress16 + IPMI_KCS_COMMAND_REGISTER_OFFSET;
+ mKcsHardwareInfo.IoStatusAddress.IoAddress16 = mKcsHardwareInfo.IoBaseAddress.IoAddress16 + IPMI_KCS_STATUS_REGISTER_OFFSET;
+ } else {
+ mKcsHardwareInfo.MemoryMap = ((MANAGEABILITY_TRANSPORT_KCS_HARDWARE_INFO *)HardwareInfo.Kcs)->MemoryMap;
+ mKcsHardwareInfo.IoBaseAddress = ((MANAGEABILITY_TRANSPORT_KCS_HARDWARE_INFO *)HardwareInfo.Kcs)->IoBaseAddress;
+ mKcsHardwareInfo.IoDataInAddress = ((MANAGEABILITY_TRANSPORT_KCS_HARDWARE_INFO *)HardwareInfo.Kcs)->IoDataInAddress;
+ mKcsHardwareInfo.IoDataOutAddress = ((MANAGEABILITY_TRANSPORT_KCS_HARDWARE_INFO *)HardwareInfo.Kcs)->IoDataOutAddress;
+ mKcsHardwareInfo.IoCommandAddress = ((MANAGEABILITY_TRANSPORT_KCS_HARDWARE_INFO *)HardwareInfo.Kcs)->IoCommandAddress;
+ mKcsHardwareInfo.IoStatusAddress = ((MANAGEABILITY_TRANSPORT_KCS_HARDWARE_INFO *)HardwareInfo.Kcs)->IoStatusAddress;
+ }
+
+ // Get protocol specification name.
+ ManageabilityProtocolName = HelperManageabilitySpecName (TransportToken->ManageabilityProtocolSpecification);
+
+ DEBUG ((DEBUG_INFO, "%a: KCS transport hardware for %s is:\n", __FUNCTION__, ManageabilityProtocolName));
+ if (mKcsHardwareInfo.MemoryMap) {
+ DEBUG ((DEBUG_INFO, "Memory Map I/O\n", __FUNCTION__));
+ DEBUG ((DEBUG_INFO, "Base Memory Address : 0x%08x\n", mKcsHardwareInfo.IoBaseAddress.IoAddress32));
+ DEBUG ((DEBUG_INFO, "Data in Address : 0x%08x\n", mKcsHardwareInfo.IoDataInAddress.IoAddress32));
+ DEBUG ((DEBUG_INFO, "Data out Address : 0x%08x\n", mKcsHardwareInfo.IoDataOutAddress.IoAddress32));
+ DEBUG ((DEBUG_INFO, "Command Address : 0x%08x\n", mKcsHardwareInfo.IoCommandAddress.IoAddress32));
+ DEBUG ((DEBUG_INFO, "Status Address : 0x%08x\n", mKcsHardwareInfo.IoStatusAddress.IoAddress32));
+ } else {
+ DEBUG ((DEBUG_INFO, "I/O Map I/O\n"));
+ DEBUG ((DEBUG_INFO, "Base I/O port : 0x%04x\n", mKcsHardwareInfo.IoBaseAddress.IoAddress16));
+ DEBUG ((DEBUG_INFO, "Data in I/O port : 0x%04x\n", mKcsHardwareInfo.IoDataInAddress.IoAddress16));
+ DEBUG ((DEBUG_INFO, "Data out I/O port: 0x%04x\n", mKcsHardwareInfo.IoDataOutAddress.IoAddress16));
+ DEBUG ((DEBUG_INFO, "Command I/O port : 0x%04x\n", mKcsHardwareInfo.IoCommandAddress.IoAddress16));
+ DEBUG ((DEBUG_INFO, "Status I/O port : 0x%04x\n", mKcsHardwareInfo.IoStatusAddress.IoAddress16));
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function returns the transport interface status.
+ The generic EFI_STATUS is returned to caller directly, The additional
+ information of transport interface could be optionally returned in
+ TransportAdditionalStatus to describes the status that can't be
+ described obviously through EFI_STATUS.
+ See the definition of MANAGEABILITY_TRANSPORT_STATUS.
+
+ @param [in] TransportToken The transport token acquired through
+ AcquireTransportSession function.
+ @param [out] TransportAdditionalStatus The additional status of transport
+ interface.
+ NULL means no additional status of this
+ transport interface.
+
+ @retval EFI_SUCCESS Transport interface status is returned.
+ @retval EFI_INVALID_PARAMETER The invalid transport token.
+ @retval EFI_DEVICE_ERROR The transport interface has problems to return
+ @retval EFI_UNSUPPORTED The transport interface doesn't have status report.
+ Otherwise Other errors.
+
+**/
+EFI_STATUS
+EFIAPI
+KcsTransportStatus (
+ IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken,
+ OUT MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS *TransportAdditionalStatus OPTIONAL
+ )
+{
+ UINT8 TransportStatus;
+
+ if (TransportToken == NULL) {
+ DEBUG ((DEBUG_ERROR, "%a: Invalid transport token.\n", __FUNCTION__));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (TransportAdditionalStatus == NULL) {
+ return EFI_SUCCESS;
+ }
+
+ TransportStatus = IPMI_KCS_GET_STATE (KcsRegisterRead8 (KCS_REG_STATUS));
+ *TransportAdditionalStatus = MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS_NO_ERRORS;
+ if (TransportStatus != IPMI_KCS_IDLE_STATE) {
+ if (TransportStatus == IPMI_KCS_READ_STATE) {
+ //
+ // Transport is in read state.
+ *TransportAdditionalStatus |= MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS_BUSY_IN_READ;
+ return EFI_NOT_READY;
+ } else if (TransportStatus == IPMI_KCS_WRITE_STATE) {
+ //
+ // Transport is in read state.
+ *TransportAdditionalStatus |= MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS_BUSY_IN_WRITE;
+ return EFI_NOT_READY;
+ } else {
+ return EFI_DEVICE_ERROR;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function resets the transport interface.
+ The generic EFI_STATUS is returned to caller directly after reseting transport
+ interface. The additional information of transport interface could be optionally
+ returned in TransportAdditionalStatus to describes the status that can't be
+ described obviously through EFI_STATUS.
+ See the definition of MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS.
+
+ @param [in] TransportToken The transport token acquired through
+ AcquireTransportSession function.
+ @param [out] TransportAdditionalStatus The additional status of specific transport
+ interface after the reset.
+ NULL means no additional status of this
+ transport interface.
+
+ @retval EFI_SUCCESS Transport interface status is returned.
+ @retval EFI_INVALID_PARAMETER The invalid transport token.
+ @retval EFI_TIMEOUT The reset process is time out.
+ @retval EFI_DEVICE_ERROR The transport interface has problems to return
+ status.
+ Otherwise Other errors.
+
+**/
+EFI_STATUS
+EFIAPI
+KcsTransportReset (
+ IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken,
+ OUT MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS *TransportAdditionalStatus OPTIONAL
+ )
+{
+ return EFI_UNSUPPORTED;
+}
+
+/**
+ This function transmit the request over target transport interface.
+ The generic EFI_STATUS is returned to caller directly after reseting transport
+ interface. The additional information of transport interface could be optionally
+ returned in TransportAdditionalStatus to describes the status that can't be
+ described obviously through EFI_STATUS.
+ See the definition of MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS.
+
+ @param [in] TransportToken The transport token acquired through
+ AcquireTransportSession function.
+ @param [in] TransferToken The transfer token, see the definition of
+ MANAGEABILITY_TRANSFER_TOKEN.
+
+ @retval The EFI status is returned in MANAGEABILITY_TRANSFER_TOKEN.
+
+**/
+VOID
+EFIAPI
+KcsTransportTransmitReceive (
+ IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken,
+ IN MANAGEABILITY_TRANSFER_TOKEN *TransferToken
+ )
+{
+ EFI_STATUS Status;
+ MANAGEABILITY_IPMI_TRANSPORT_HEADER *TransmitHeader;
+
+ if (TransportToken == NULL || TransferToken == NULL) {
+ DEBUG ((DEBUG_ERROR, "%a: Invalid transport token or transfer token.\n", __FUNCTION__));
+ return;
+ }
+
+ TransmitHeader = (MANAGEABILITY_IPMI_TRANSPORT_HEADER *)TransferToken->TransmitHeader;
+ if (TransmitHeader == NULL) {
+ TransferToken->TransferStatus = EFI_INVALID_PARAMETER;
+ return;
+ }
+
+ Status = KcsTransportSendCommand (
+ TransmitHeader->NetFn,
+ TransmitHeader->Command,
+ TransferToken->TransmitPackage.TransmitPayload,
+ TransferToken->TransmitPackage.TransmitSizeInByte,
+ TransferToken->ReceivePackage.ReceiveBuffer,
+ &TransferToken->ReceivePackage.ReceiveSizeInByte
+ );
+
+ TransferToken->TransferStatus = Status;
+ KcsTransportStatus (TransportToken, &TransferToken->TransportAdditionalStatus);
+}
+
+/**
+ This function acquires to create a transport session to transmit manageability
+ packet. A transport token is returned to caller for the follow up operations.
+
+ @param [in] ManageabilityProtocolSpec The protocol spec the transport interface is acquired.
+ @param [out] TransportToken The pointer to receive the transport token created by
+ the target transport interface library.
+ @retval EFI_SUCCESS Token is created successfully.
+ @retval EFI_OUT_OF_RESOURCES Out of resource to create a new transport session.
+ @retval EFI_UNSUPPORTED Protocol is not supported on this transport interface.
+ @retval Otherwise Other errors.
+
+**/
+EFI_STATUS
+AcquireTransportSession (
+ IN EFI_GUID *ManageabilityProtocolSpec,
+ OUT MANAGEABILITY_TRANSPORT_TOKEN **TransportToken
+ )
+{
+ EFI_STATUS Status;
+ MANAGEABILITY_TRANSPORT_KCS *KcsTransportToken;
+
+ if (ManageabilityProtocolSpec == NULL) {
+ DEBUG ((DEBUG_ERROR, "%a: No Manageability protocol specification specified.\n", __FUNCTION__));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (TransportToken == NULL) {
+ DEBUG ((DEBUG_ERROR, "%a: TransportToken is NULL.\n", __FUNCTION__));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Status = HelperManageabilityCheckSupportedSpec (
+ &gManageabilityTransportKcsGuid,
+ SupportedManageabilityProtocol,
+ NumberOfSupportedProtocol,
+ ManageabilityProtocolSpec
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: Protocol is not supported on this transport interface.\n", __FUNCTION__));
+ return EFI_UNSUPPORTED;
+ }
+
+ if (mSingleSessionToken != NULL) {
+ DEBUG ((DEBUG_ERROR, "%a: This manageability transport library only supports one session transport token.\n", __FUNCTION__));
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ KcsTransportToken = AllocateZeroPool (sizeof (MANAGEABILITY_TRANSPORT_KCS));
+ if (KcsTransportToken == NULL) {
+ DEBUG ((DEBUG_ERROR, "%a: Fail to allocate memory for MANAGEABILITY_TRANSPORT_KCS\n", __FUNCTION__));
+ return EFI_OUT_OF_RESOURCES;
+ }
+ KcsTransportToken->Token.Transport = AllocateZeroPool (sizeof (MANAGEABILITY_TRANSPORT));
+ if (KcsTransportToken->Token.Transport == NULL) {
+ FreePool (KcsTransportToken);
+ DEBUG ((DEBUG_ERROR, "%a: Fail to allocate memory for MANAGEABILITY_TRANSPORT\n", __FUNCTION__));
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ KcsTransportToken->Signature = MANAGEABILITY_TRANSPORT_KCS_SIGNATURE;
+ KcsTransportToken->Token.ManageabilityProtocolSpecification = ManageabilityProtocolSpec;
+ KcsTransportToken->Token.Transport->TransportVersion = MANAGEABILITY_TRANSPORT_TOKEN_VERSION;
+ KcsTransportToken->Token.Transport->ManageabilityTransportSpecification = &gManageabilityTransportKcsGuid;
+ KcsTransportToken->Token.Transport->TransportName = L"KCS";
+ KcsTransportToken->Token.Transport->Function.Version1_0 = AllocateZeroPool (sizeof (MANAGEABILITY_TRANSPORT_FUNCTION_V1_0));
+ if (KcsTransportToken->Token.Transport->Function.Version1_0 == NULL) {
+ DEBUG ((DEBUG_ERROR, "%a: Fail to allocate memory for MANAGEABILITY_TRANSPORT_FUNCTION_V1_0\n", __FUNCTION__));
+ FreePool (KcsTransportToken);
+ FreePool (KcsTransportToken->Token.Transport);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ KcsTransportToken->Token.Transport->Function.Version1_0->TransportInit = KcsTransportInit;
+ KcsTransportToken->Token.Transport->Function.Version1_0->TransportReset = KcsTransportReset;
+ KcsTransportToken->Token.Transport->Function.Version1_0->TransportStatus = KcsTransportStatus;
+ KcsTransportToken->Token.Transport->Function.Version1_0->TransportTransmitReceive = KcsTransportTransmitReceive;
+
+ mSingleSessionToken = KcsTransportToken;
+ *TransportToken = &KcsTransportToken->Token;
+ return EFI_SUCCESS;
+}
+
+/**
+ This function returns the transport capabilities.
+
+ @param [out] TransportFeature Pointer to receive transport capabilities.
+ See the definitions of
+ MANAGEABILITY_TRANSPORT_CAPABILITY.
+
+**/
+VOID
+GetTransportCapability (
+ OUT MANAGEABILITY_TRANSPORT_CAPABILITY *TransportCapability
+ )
+{
+ if (TransportCapability != NULL) {
+ *TransportCapability = 0;
+ }
+}
+
+/**
+ This function releases the manageability session.
+
+ @param [in] TransportToken The transport token acquired through
+ AcquireTransportSession.
+ @retval EFI_SUCCESS Token is released successfully.
+ @retval EFI_INVALID_PARAMETER Invalid TransportToken.
+ @retval Otherwise Other errors.
+
+**/
+EFI_STATUS
+ReleaseTransportSession (
+ IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken
+ )
+{
+ EFI_STATUS Status;
+ MANAGEABILITY_TRANSPORT_KCS *KcsTransportToken;
+
+ if (TransportToken == NULL) {
+ Status = EFI_INVALID_PARAMETER;
+ }
+
+ KcsTransportToken = MANAGEABILITY_TRANSPORT_KCS_FROM_LINK (TransportToken);
+ if (mSingleSessionToken != KcsTransportToken) {
+ Status = EFI_INVALID_PARAMETER;
+ }
+
+ if (KcsTransportToken != NULL) {
+ FreePool (KcsTransportToken->Token.Transport->Function.Version1_0);
+ FreePool (KcsTransportToken->Token.Transport);
+ FreePool (KcsTransportToken);
+ mSingleSessionToken = NULL;
+ Status = EFI_SUCCESS;
+ }
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: Fail to release KCS transport token (%r).\n", __FUNCTION__, Status));
+ }
+
+ return Status;
+}
diff --git a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/ManageabilityTransportKcs.uni b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/ManageabilityTransportKcs.uni
new file mode 100644
index 0000000000..61a3e8b588
--- /dev/null
+++ b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/ManageabilityTransportKcs.uni
@@ -0,0 +1,13 @@
+// /** @file
+// KCS instance of Manageability Transport Library
+//
+// Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// **/
+
+#string STR_MODULE_ABSTRACT #language en-US "KCS instance of Manageability Transport Library"
+
+#string STR_MODULE_DESCRIPTION #language en-US "KCS Manageability Transport library implementation."
+
--
2.37.1.windows.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v3 6/8] ManageabilityPkg: Implement Ipmi Protocol/Ppi
2023-03-21 3:21 [PATCH v3 3/8] ManageabilityPkg: Add NULL ManageabilityTransportLib Chang, Abner
2023-03-21 3:21 ` [PATCH v3 4/8] ManageabilityPkg: Add ManageabilityTransportHelperLib Chang, Abner
2023-03-21 3:21 ` [PATCH v3 5/8] ManageabilityPkg/ManageabilityTransportKcsLib Chang, Abner
@ 2023-03-21 3:21 ` Chang, Abner
2023-03-21 12:23 ` [edk2-devel] " Leif Lindholm
2023-03-21 3:21 ` [PATCH v3 7/8] ManageabilityPkg: Add IpmiProtocol to Manageability Package Chang, Abner
` (2 subsequent siblings)
5 siblings, 1 reply; 11+ messages in thread
From: Chang, Abner @ 2023-03-21 3:21 UTC (permalink / raw)
To: devel
Cc: Liming Gao, Isaac Oram, Nate DeSimone, Abdul Lateef Attar,
Nickle Wang, Igor Kulchytskyy
From: Abner Chang <abner.chang@amd.com>
Add Ipmi Protocol/Ppi/SMM implementations.
The underlying implementation of transport
interface depends on the binded
ManageabilityTransportLib.
Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Isaac Oram <isaac.w.oram@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Abdul Lateef Attar <abdattar@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
---
.../IpmiProtocol/Dxe/IpmiProtocolDxe.inf | 50 ++++
.../Universal/IpmiProtocol/Pei/IpmiPpiPei.inf | 53 ++++
.../IpmiProtocol/Smm/IpmiProtocolSmm.inf | 52 ++++
.../IpmiProtocol/Common/IpmiProtocolCommon.h | 108 ++++++++
.../IpmiProtocol/Pei/IpmiPpiInternal.h | 25 ++
.../IpmiProtocol/Common/IpmiProtocolCommon.c | 252 ++++++++++++++++++
.../Universal/IpmiProtocol/Dxe/IpmiProtocol.c | 177 ++++++++++++
.../Universal/IpmiProtocol/Pei/IpmiPpi.c | 159 +++++++++++
.../Universal/IpmiProtocol/Smm/IpmiProtocol.c | 147 ++++++++++
9 files changed, 1023 insertions(+)
create mode 100644 Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocolDxe.inf
create mode 100644 Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf
create mode 100644 Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocolSmm.inf
create mode 100644 Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolCommon.h
create mode 100644 Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiInternal.h
create mode 100644 Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolCommon.c
create mode 100644 Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocol.c
create mode 100644 Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpi.c
create mode 100644 Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocol.c
diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocolDxe.inf b/Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocolDxe.inf
new file mode 100644
index 0000000000..ff5ec56c73
--- /dev/null
+++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocolDxe.inf
@@ -0,0 +1,50 @@
+## @file
+# IPMI Protocol DXE Driver.
+#
+# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+ INF_VERSION = 0x0001001d
+ BASE_NAME = IpmiDxe
+ FILE_GUID = BC41B0C2-9D8A-42B5-A28F-02CE0D4A6C28
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ ENTRY_POINT = DxeIpmiEntry
+ UNLOAD_IMAGE = IpmiUnloadImage
+
+#
+# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64
+#
+
+[Sources]
+ IpmiProtocol.c
+ ../Common/IpmiProtocolCommon.c
+ ../Common/IpmiProtocolCommon.h
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ ManageabilityPkg/ManageabilityPkg.dec
+
+[LibraryClasses]
+ BaseMemoryLib
+ DebugLib
+ ManageabilityTransportHelperLib
+ ManageabilityTransportLib
+ UefiDriverEntryPoint
+ UefiBootServicesTableLib
+
+[Protocols]
+ gIpmiProtocolGuid # PROTOCOL ALWAYS_PRODUCED
+
+[Guids]
+ gManageabilityProtocolIpmiGuid
+ gManageabilityTransportKcsGuid
+
+[FixedPcd]
+ gEfiMdePkgTokenSpaceGuid.PcdIpmiKcsBaseAddress
+
+[Depex]
+ TRUE
diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf
new file mode 100644
index 0000000000..4e00693f64
--- /dev/null
+++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf
@@ -0,0 +1,53 @@
+## @file
+# IPMI Protocol PEI Driver.
+#
+# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+ INF_VERSION = 0x0001001d
+ BASE_NAME = IpmiPei
+ FILE_GUID = 7832F989-CB72-4715-ADCA-35C0B031856C
+ MODULE_TYPE = PEIM
+ VERSION_STRING = 1.0
+ ENTRY_POINT = PeiIpmiEntry
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64
+#
+
+[Sources]
+ IpmiPpi.c
+ IpmiPpiInternal.h
+ ../Common/IpmiProtocolCommon.c
+ ../Common/IpmiProtocolCommon.h
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ ManageabilityPkg/ManageabilityPkg.dec
+
+[LibraryClasses]
+ BaseMemoryLib
+ DebugLib
+ MemoryAllocationLib
+ ManageabilityTransportHelperLib
+ ManageabilityTransportLib
+ PeimEntryPoint
+ ManageabilityTransportLib
+
+[Ppis]
+ gPeiIpmiPpiGuid # PPI ALWAYS PRODUCED
+
+[Guids]
+ gManageabilityProtocolIpmiGuid
+ gManageabilityTransportKcsGuid
+
+[FixedPcd]
+ gEfiMdePkgTokenSpaceGuid.PcdIpmiKcsBaseAddress
+
+[Depex]
+ TRUE
diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocolSmm.inf b/Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocolSmm.inf
new file mode 100644
index 0000000000..cae1462f4f
--- /dev/null
+++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocolSmm.inf
@@ -0,0 +1,52 @@
+## @file
+# IPMI Protocol SMM Driver.
+#
+# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64
+#
+[Defines]
+ INF_VERSION = 0x0001001d
+ BASE_NAME = IpmiSmm
+ FILE_GUID = CDD5D1DE-E3D3-4B1F-8689-DCC661561BB4
+ MODULE_TYPE = DXE_SMM_DRIVER
+ PI_SPECIFICATION_VERSION = 0x0001000A
+ VERSION_STRING = 1.0
+ ENTRY_POINT = SmmIpmiEntry
+
+[Sources]
+ IpmiProtocol.c
+ ../Common/IpmiProtocolCommon.c
+ ../Common/IpmiProtocolCommon.h
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ ManageabilityPkg/ManageabilityPkg.dec
+
+[LibraryClasses]
+ BaseMemoryLib
+ DebugLib
+ ManageabilityTransportHelperLib
+ ManageabilityTransportLib
+ SmmServicesTableLib
+ UefiDriverEntryPoint
+ UefiBootServicesTableLib
+
+[Protocols]
+ gSmmIpmiProtocolGuid # PROTOCOL ALWAYS_PRODUCED
+
+[Guids]
+ gManageabilityProtocolIpmiGuid
+ gManageabilityTransportKcsGuid
+
+[FixedPcd]
+ gEfiMdePkgTokenSpaceGuid.PcdIpmiKcsBaseAddress
+
+[Depex]
+ TRUE
diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolCommon.h b/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolCommon.h
new file mode 100644
index 0000000000..57b92cf2be
--- /dev/null
+++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolCommon.h
@@ -0,0 +1,108 @@
+/** @file
+
+ IPMI Manageability Protocol common header file.
+
+ Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef MANAGEABILITY_IPMI_COMMON_H_
+#define MANAGEABILITY_IPMI_COMMON_H_
+
+#include <IndustryStandard/IpmiKcs.h>
+#include <Library/ManageabilityTransportLib.h>
+
+///
+/// IPMI KCS hardware information.
+///
+#define IPMI_KCS_BASE_ADDRESS PcdGet16 (PcdIpmiKcsBaseAddress)
+#define IPMI_KCS_REG_DATA_IN IPMI_KCS_BASE_ADDRESS + IPMI_KCS_DATA_IN_REGISTER_OFFSET
+#define IPMI_KCS_REG_DATA_OUT IPMI_KCS_BASE_ADDRESS + IPMI_KCS_DATA_OUT_REGISTER_OFFSET
+#define IPMI_KCS_REG_COMMAND IPMI_KCS_BASE_ADDRESS + IPMI_KCS_COMMAND_REGISTER_OFFSET
+#define IPMI_KCS_REG_STATUS IPMI_KCS_BASE_ADDRESS + IPMI_KCS_STATUS_REGISTER_OFFSET
+
+/**
+ This functions setup the IPMI 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_SUCCESS Hardware information is returned in HardwareInformation.
+ Caller must free the memory allocated for HardwareInformation
+ once it doesn't need it.
+ @retval EFI_UNSUPPORTED No hardware information for the specification specified
+ in the transport token.
+**/
+EFI_STATUS
+SetupIpmiTransportHardwareInformation (
+ 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 interface.
+ @param[in] NetFunction IPMI function.
+ @param[in] Command IPMI command.
+ @param[out] PacketHeader The pointer to receive header of request.
+ @param[in, out] PacketBody The request body.
+ When IN, it is the caller's request body.
+ When OUT and NULL, the request body is not
+ changed.
+ Whee out and non-NULL, the request body is
+ changed to comfort the transport interface.
+ @param[in, out] PacketBodySize The request body size.
+ When IN and non-zero, it is the new data
+ length of request body.
+ When IN and zero, the request body is unchanged.
+ @param[out] PacketTrailer The pointer to receive trailer of request.
+
+ @retval EFI_SUCCESS Request packet is returned.
+ @retval EFI_UNSUPPORTED Request packet is not returned because
+ the unsupported transport interface.
+**/
+EFI_STATUS
+SetupIpmiRequestTransportPacket (
+ IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken,
+ IN UINT8 NetFunction,
+ IN UINT8 Command,
+ OUT MANAGEABILITY_TRANSPORT_HEADER *PacketHeader OPTIONAL,
+ IN OUT UINT8 **PacketBody OPTIONAL,
+ IN OUT UINT32 *PacketBodySize OPTIONAL,
+ OUT MANAGEABILITY_TRANSPORT_TRAILER *PacketTrailer OPTIONAL
+ );
+
+/**
+ Common code to submit IPMI commands
+
+ @param[in] TransportToken TRansport token.
+ @param[in] NetFunction Net function of the command.
+ @param[in] Command IPMI Command.
+ @param[in] RequestData Command Request Data.
+ @param[in] RequestDataSize Size of Command Request Data.
+ @param[out] ResponseData Command Response Data. The completion code is the first byte of response data.
+ @param[in, out] ResponseDataSize Size of Command Response Data.
+
+ @retval EFI_SUCCESS The command byte stream was successfully submit to the device and a response was successfully received.
+ @retval EFI_NOT_FOUND The command was not successfully sent to the device or a response was not successfully received from the device.
+ @retval EFI_NOT_READY Ipmi Device is not ready for Ipmi command access.
+ @retval EFI_DEVICE_ERROR Ipmi Device hardware error.
+ @retval EFI_TIMEOUT The command time out.
+ @retval EFI_UNSUPPORTED The command was not successfully sent to the device.
+ @retval EFI_OUT_OF_RESOURCES The resource allocation is out of resource or data size error.
+**/
+EFI_STATUS
+CommonIpmiSubmitCommand (
+ IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken,
+ IN UINT8 NetFunction,
+ IN UINT8 Command,
+ IN UINT8 *RequestData OPTIONAL,
+ IN UINT32 RequestDataSize,
+ OUT UINT8 *ResponseData OPTIONAL,
+ IN OUT UINT32 *ResponseDataSize OPTIONAL
+ );
+
+#endif
diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiInternal.h b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiInternal.h
new file mode 100644
index 0000000000..bbe0c8c5cb
--- /dev/null
+++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiInternal.h
@@ -0,0 +1,25 @@
+/** @file
+
+ IPMI Manageability PPI internal header file.
+
+ Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef MANAGEABILITY_IPMI_PPI_INTERNAL_H_
+#define MANAGEABILITY_IPMI_PPI_INTERNAL_H_
+
+#include <Library/ManageabilityTransportLib.h>
+#include <Ppi/IpmiPpi.h>
+
+#define MANAGEABILITY_IPMI_PPI_INTERNAL_SIGNATURE SIGNATURE_32 ('I', 'P', 'P', 'I')
+
+#define MANAGEABILITY_IPMI_PPI_INTERNAL_FROM_LINK(a) CR (a, PEI_IPMI_PPI_INTERNAL, PeiIpmiPpi, MANAGEABILITY_IPMI_PPI_INTERNAL_SIGNATURE)
+
+typedef struct {
+ UINT32 Signature;
+ MANAGEABILITY_TRANSPORT_TOKEN *TransportToken;
+ PEI_IPMI_PPI PeiIpmiPpi;
+} PEI_IPMI_PPI_INTERNAL;
+
+#endif // MANAGEABILITY_IPMI_PPI_INTERNAL_H_
diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolCommon.c b/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolCommon.c
new file mode 100644
index 0000000000..d1294d2f7c
--- /dev/null
+++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolCommon.c
@@ -0,0 +1,252 @@
+/** @file
+
+ IPMI Manageability Protocol common file.
+
+ Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+#include <Uefi.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/ManageabilityTransportIpmiLib.h>
+#include <Library/ManageabilityTransportLib.h>
+
+#include "IpmiProtocolCommon.h"
+
+/**
+ This functions setup the IPMI 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_SUCCESS Hardware information is returned in HardwareInformation.
+ Caller must free the memory allocated for HardwareInformation
+ once it doesn't need it.
+ @retval EFI_UNSUPPORTED No hardware information for the specification specified
+ in the transport token.
+ #retval EFI_OUT_OF_RESOURCES Not enough memory for MANAGEABILITY_TRANSPORT_KCS_HARDWARE_INFO.
+**/
+EFI_STATUS
+SetupIpmiTransportHardwareInformation (
+ IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken,
+ OUT MANAGEABILITY_TRANSPORT_HARDWARE_INFORMATION *HardwareInformation
+ )
+{
+ MANAGEABILITY_TRANSPORT_KCS_HARDWARE_INFO *KcsHardwareInfo;
+
+ KcsHardwareInfo = AllocatePool (sizeof (MANAGEABILITY_TRANSPORT_KCS_HARDWARE_INFO));
+ if (KcsHardwareInfo == NULL) {
+ DEBUG ((DEBUG_ERROR, "%a: Not enough memory for MANAGEABILITY_TRANSPORT_KCS_HARDWARE_INFO.\n", __FUNCTION__));
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ if (CompareGuid (&gManageabilityTransportKcsGuid, TransportToken->Transport->ManageabilityTransportSpecification)) {
+ // This is KCS transport interface.
+ KcsHardwareInfo->MemoryMap = MANAGEABILITY_TRANSPORT_KCS_IO_MAP_IO;
+ KcsHardwareInfo->IoBaseAddress.IoAddress16 = IPMI_KCS_BASE_ADDRESS;
+ KcsHardwareInfo->IoDataInAddress.IoAddress16 = IPMI_KCS_REG_DATA_IN;
+ KcsHardwareInfo->IoDataOutAddress.IoAddress16 = IPMI_KCS_REG_DATA_OUT;
+ KcsHardwareInfo->IoCommandAddress.IoAddress16 = IPMI_KCS_REG_COMMAND;
+ KcsHardwareInfo->IoStatusAddress.IoAddress16 = IPMI_KCS_REG_STATUS;
+ *HardwareInformation =
+ (MANAGEABILITY_TRANSPORT_HARDWARE_INFORMATION)KcsHardwareInfo;
+ return EFI_SUCCESS;
+ } else {
+ DEBUG ((DEBUG_ERROR, "%a: No implementation of setting hardware information.", __FUNCTION__));
+ ASSERT (FALSE);
+ }
+
+ return EFI_UNSUPPORTED;
+}
+
+/**
+ This functions setup the final header/body/trailer packets for
+ the acquired transport interface.
+
+ @param[in] TransportToken The transport interface.
+ @param[in] NetFunction IPMI function.
+ @param[in] Command IPMI command.
+ @param[out] PacketHeader The pointer to receive header of request.
+ @param[in, out] PacketBody The request body.
+ When IN, it is the caller's request body.
+ When OUT and NULL, the request body is not
+ changed.
+ When OUT and non-NULL, the request body is
+ changed to conform the transport interface.
+ @param[in, out] PacketBodySize The request body size.
+ When OUT and non-zero, it is the new data
+ length of request body.
+ When OUT and zero, the request body is unchanged.
+ @param[out] PacketTrailer The pointer to receive trailer of request.
+
+ @retval EFI_SUCCESS Request packet is returned.
+ @retval EFI_UNSUPPORTED Request packet is not returned because
+ the unsupported transport interface.
+**/
+EFI_STATUS
+SetupIpmiRequestTransportPacket (
+ IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken,
+ IN UINT8 NetFunction,
+ IN UINT8 Command,
+ OUT MANAGEABILITY_TRANSPORT_HEADER *PacketHeader OPTIONAL,
+ IN OUT UINT8 **PacketBody OPTIONAL,
+ IN OUT UINT32 *PacketBodySize OPTIONAL,
+ OUT MANAGEABILITY_TRANSPORT_TRAILER *PacketTrailer OPTIONAL
+ )
+{
+ MANAGEABILITY_IPMI_TRANSPORT_HEADER *IpmiHeader;
+
+ if (CompareGuid (&gManageabilityTransportKcsGuid, TransportToken->Transport->ManageabilityTransportSpecification)) {
+ // This is KCS transport interface.
+ IpmiHeader = AllocateZeroPool (sizeof (MANAGEABILITY_IPMI_TRANSPORT_HEADER));
+ if (IpmiHeader == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ IpmiHeader->Command = Command;
+ IpmiHeader->Lun = 0;
+ IpmiHeader->NetFn = NetFunction;
+ if (PacketHeader != NULL) {
+ *PacketHeader = (MANAGEABILITY_TRANSPORT_HEADER *)IpmiHeader;
+ }
+ if (PacketTrailer != NULL) {
+ *PacketTrailer = NULL;
+ }
+ if (PacketBody != NULL) {
+ *PacketBody = NULL;
+ }
+ if (PacketBodySize != NULL) {
+ *PacketBodySize = 0;
+ }
+ } else {
+ DEBUG ((DEBUG_ERROR, "%a: No implementation of building up packet.", __FUNCTION__));
+ ASSERT (FALSE);
+ }
+ return EFI_SUCCESS;
+}
+
+/**
+ Common code to submit IPMI commands
+
+ @param[in] TransportToken TRansport token.
+ @param[in] NetFunction Net function of the command.
+ @param[in] Command IPMI Command.
+ @param[in] RequestData Command Request Data.
+ @param[in] RequestDataSize Size of Command Request Data.
+ @param[out] ResponseData Command Response Data. The completion code is the first byte of response data.
+ @param[in, out] ResponseDataSize Size of Command Response Data.
+
+ @retval EFI_SUCCESS The command byte stream was successfully submit to the device and a response was successfully received.
+ @retval EFI_NOT_FOUND The command was not successfully sent to the device or a response was not successfully received from the device.
+ @retval EFI_NOT_READY Ipmi Device is not ready for Ipmi command access.
+ @retval EFI_DEVICE_ERROR Ipmi Device hardware error.
+ @retval EFI_TIMEOUT The command time out.
+ @retval EFI_UNSUPPORTED The command was not successfully sent to the device.
+ @retval EFI_OUT_OF_RESOURCES The resource allocation is out of resource or data size error.
+**/
+EFI_STATUS
+CommonIpmiSubmitCommand (
+ IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken,
+ IN UINT8 NetFunction,
+ IN UINT8 Command,
+ IN UINT8 *RequestData OPTIONAL,
+ IN UINT32 RequestDataSize,
+ OUT UINT8 *ResponseData OPTIONAL,
+ IN OUT UINT32 *ResponseDataSize OPTIONAL
+ )
+{
+ EFI_STATUS Status;
+ UINT8 *ThisRequestData;
+ UINT32 ThisRequestDataSize;
+ MANAGEABILITY_TRANSFER_TOKEN TransferToken;
+ MANAGEABILITY_TRANSPORT_HEADER IpmiTransportHeader;
+ MANAGEABILITY_TRANSPORT_TRAILER IpmiTransportTrailer;
+ MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS TransportAdditionalStatus;
+
+ if (TransportToken == NULL) {
+ DEBUG ((DEBUG_ERROR, "%a: No transport toke for IPMI\n", __FUNCTION__));
+ return EFI_UNSUPPORTED;
+ }
+
+ Status = TransportToken->Transport->Function.Version1_0->TransportStatus (
+ TransportToken,
+ &TransportAdditionalStatus
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: Transport for IPMI has problem - (%r)\n", __FUNCTION__, Status));
+ return Status;
+ }
+
+ ThisRequestData = RequestData;
+ ThisRequestDataSize = RequestDataSize;
+ IpmiTransportHeader = NULL;
+ IpmiTransportTrailer = NULL;
+ Status = SetupIpmiRequestTransportPacket (
+ TransportToken,
+ NetFunction,
+ Command,
+ &IpmiTransportHeader,
+ &ThisRequestData,
+ &ThisRequestDataSize,
+ &IpmiTransportTrailer
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: Fail to build packets - (%r)\n", __FUNCTION__, Status));
+ return Status;
+ }
+
+ ZeroMem (&TransferToken, sizeof (MANAGEABILITY_TRANSFER_TOKEN));
+ TransferToken.TransmitHeader = IpmiTransportHeader;
+ TransferToken.TransmitTrailer = IpmiTransportTrailer;
+
+ // Transmit packet.
+ if ((ThisRequestData == NULL) || (ThisRequestDataSize == 0)) {
+
+ // Transmit parameter were not changed by SetupIpmiRequestTransportPacket().
+ TransferToken.TransmitPackage.TransmitPayload = RequestData;
+ TransferToken.TransmitPackage.TransmitSizeInByte = RequestDataSize;
+ } else {
+ TransferToken.TransmitPackage.TransmitPayload = ThisRequestData;
+ TransferToken.TransmitPackage.TransmitSizeInByte = ThisRequestDataSize;
+ }
+
+ TransferToken.TransmitPackage.TransmitTimeoutInMillisecond = MANAGEABILITY_TRANSPORT_NO_TIMEOUT;
+
+ // Receive packet.
+ TransferToken.ReceivePackage.ReceiveBuffer = ResponseData;
+ TransferToken.ReceivePackage.ReceiveSizeInByte = *ResponseDataSize;
+ TransferToken.ReceivePackage.TransmitTimeoutInMillisecond = MANAGEABILITY_TRANSPORT_NO_TIMEOUT;
+ TransportToken->Transport->Function.Version1_0->TransportTransmitReceive (
+ TransportToken,
+ &TransferToken
+ );
+
+ if (IpmiTransportHeader != NULL) {
+ FreePool ((VOID *)IpmiTransportHeader);
+ }
+
+ if (IpmiTransportTrailer != NULL) {
+ FreePool ((VOID *)IpmiTransportTrailer);
+ }
+
+ if (ThisRequestData != NULL) {
+ FreePool ((VOID *)ThisRequestData);
+ }
+
+ // Return transfer status.
+ //
+ Status = TransferToken.TransferStatus;
+ TransportAdditionalStatus = TransferToken.TransportAdditionalStatus;
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: Failed to send IPMI command.\n", __FUNCTION__));
+ return Status;
+ }
+
+ if (ResponseDataSize != NULL) {
+ *ResponseDataSize = TransferToken.ReceivePackage.ReceiveSizeInByte;
+ }
+ return Status;
+}
diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocol.c b/Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocol.c
new file mode 100644
index 0000000000..05175ee448
--- /dev/null
+++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocol.c
@@ -0,0 +1,177 @@
+/** @file
+ This file provides IPMI Protocol implementation.
+
+ Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include <PiDxe.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/ManageabilityTransportLib.h>
+#include <Library/ManageabilityTransportIpmiLib.h>
+#include <Library/ManageabilityTransportHelperLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Protocol/IpmiProtocol.h>
+
+#include "IpmiProtocolCommon.h"
+
+MANAGEABILITY_TRANSPORT_TOKEN *mTransportToken = NULL;
+CHAR16 *mTransportName;
+
+MANAGEABILITY_TRANSPORT_HARDWARE_INFORMATION mHardwareInformation;
+
+/**
+ This service enables submitting commands via Ipmi.
+
+ @param[in] This This point for IPMI_PROTOCOL structure.
+ @param[in] NetFunction Net function of the command.
+ @param[in] Command IPMI Command.
+ @param[in] RequestData Command Request Data.
+ @param[in] RequestDataSize Size of Command Request Data.
+ @param[out] ResponseData Command Response Data. The completion code is the first byte of response data.
+ @param[in, out] ResponseDataSize Size of Command Response Data.
+
+ @retval EFI_SUCCESS The command byte stream was successfully submit to the device and a response was successfully received.
+ @retval EFI_NOT_FOUND The command was not successfully sent to the device or a response was not successfully received from the device.
+ @retval EFI_NOT_READY Ipmi Device is not ready for Ipmi command access.
+ @retval EFI_DEVICE_ERROR Ipmi Device hardware error.
+ @retval EFI_TIMEOUT The command time out.
+ @retval EFI_UNSUPPORTED The command was not successfully sent to the device.
+ @retval EFI_OUT_OF_RESOURCES The resource allocation is out of resource or data size error.
+**/
+EFI_STATUS
+EFIAPI
+DxeIpmiSubmitCommand (
+ IN IPMI_PROTOCOL *This,
+ IN UINT8 NetFunction,
+ IN UINT8 Command,
+ IN UINT8 *RequestData,
+ IN UINT32 RequestDataSize,
+ OUT UINT8 *ResponseData,
+ IN OUT UINT32 *ResponseDataSize
+ )
+{
+ EFI_STATUS Status;
+
+ Status = CommonIpmiSubmitCommand (
+ mTransportToken,
+ NetFunction,
+ Command,
+ RequestData,
+ RequestDataSize,
+ ResponseData,
+ ResponseDataSize
+ );
+ return Status;
+}
+
+static IPMI_PROTOCOL mIpmiProtocol = {
+ DxeIpmiSubmitCommand
+};
+
+/**
+ The entry point of the Ipmi DXE driver.
+
+ @param[in] ImageHandle - Handle of this driver image
+ @param[in] SystemTable - Table containing standard EFI services
+
+ @retval EFI_SUCCESS - IPMI Protocol is installed successfully.
+ @retval Otherwise - Other errors.
+**/
+EFI_STATUS
+EFIAPI
+DxeIpmiEntry (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_HANDLE Handle;
+ MANAGEABILITY_TRANSPORT_CAPABILITY TransportCapability;
+ MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS TransportAdditionalStatus;
+
+ GetTransportCapability (&TransportCapability);
+
+ Status = HelperAcquireManageabilityTransport (
+ &gManageabilityProtocolIpmiGuid,
+ &mTransportToken
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: Failed to acquire transport interface for IPMI protocol - %r\n", __FUNCTION__, Status));
+ return Status;
+ }
+
+ mTransportName = HelperManageabilitySpecName (mTransportToken->Transport->ManageabilityTransportSpecification);
+ DEBUG ((DEBUG_INFO, "%a: IPMI protocol over %s.\n", __FUNCTION__, mTransportName));
+
+ //
+ // Setup hardware information according to the transport interface.
+ Status = SetupIpmiTransportHardwareInformation (
+ mTransportToken,
+ &mHardwareInformation
+ );
+ if (EFI_ERROR (Status)) {
+ if (Status == EFI_UNSUPPORTED) {
+ DEBUG ((DEBUG_ERROR, "%a: No hardware information of %s transport interface.\n", __FUNCTION__, mTransportName));
+ }
+
+ return Status;
+ }
+
+ //
+ // Initial transport interface with the hardware information assigned.
+ Status = HelperInitManageabilityTransport (
+ mTransportToken,
+ mHardwareInformation,
+ &TransportAdditionalStatus
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Handle = NULL;
+ Status = gBS->InstallProtocolInterface (
+ &Handle,
+ &gIpmiProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ (VOID **)&mIpmiProtocol
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: Failed to install IPMI protocol - %r\n", __FUNCTION__, Status));
+ }
+
+ return Status;
+}
+
+/**
+ This is the unload handler for IPMI protocol module.
+
+ Release the MANAGEABILITY_TRANSPORT_TOKEN acquired at entry point.
+
+ @param[in] ImageHandle The drivers' driver image.
+
+ @retval EFI_SUCCESS The image is unloaded.
+ @retval Others Failed to unload the image.
+
+**/
+EFI_STATUS
+EFIAPI
+IpmiUnloadImage (
+ IN EFI_HANDLE ImageHandle
+ )
+{
+ EFI_STATUS Status;
+
+ Status = EFI_SUCCESS;
+ if (mTransportToken != NULL) {
+ Status = ReleaseTransportSession (mTransportToken);
+ }
+
+ if (mHardwareInformation.Pointer != NULL) {
+ FreePool (mHardwareInformation.Pointer);
+ }
+
+ return Status;
+}
diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpi.c b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpi.c
new file mode 100644
index 0000000000..f839cd7387
--- /dev/null
+++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpi.c
@@ -0,0 +1,159 @@
+/** @file
+ This file provides IPMI PPI implementation.
+
+ Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <PiPei.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/ManageabilityTransportLib.h>
+#include <Library/ManageabilityTransportIpmiLib.h>
+#include <Library/ManageabilityTransportHelperLib.h>
+#include <Library/PeiServicesLib.h>
+
+#include <Ppi/IpmiPpi.h>
+
+#include "IpmiProtocolCommon.h"
+#include "IpmiPpiInternal.h"
+
+/**
+ This service enables submitting commands via Ipmi.
+
+ @param[in] This This point for PEI_IPMI_PPI structure.
+ @param[in] NetFunction Net function of the command.
+ @param[in] Command IPMI Command.
+ @param[in] RequestData Command Request Data.
+ @param[in] RequestDataSize Size of Command Request Data.
+ @param[out] ResponseData Command Response Data. The completion code is the first byte of response data.
+ @param[in, out] ResponseDataSize Size of Command Response Data.
+
+ @retval EFI_SUCCESS The command byte stream was successfully submit to the device and a response was successfully received.
+ @retval EFI_NOT_FOUND The command was not successfully sent to the device or a response was not successfully received from the device.
+ @retval EFI_NOT_READY Ipmi Device is not ready for Ipmi command access.
+ @retval EFI_DEVICE_ERROR Ipmi Device hardware error.
+ @retval EFI_TIMEOUT The command time out.
+ @retval EFI_UNSUPPORTED The command was not successfully sent to the device.
+ @retval EFI_OUT_OF_RESOURCES The resource allocation is out of resource or data size error.
+**/
+EFI_STATUS
+EFIAPI
+PeiIpmiSubmitCommand (
+ IN PEI_IPMI_PPI *This,
+ IN UINT8 NetFunction,
+ IN UINT8 Command,
+ IN UINT8 *RequestData,
+ IN UINT32 RequestDataSize,
+ OUT UINT8 *ResponseData,
+ IN OUT UINT32 *ResponseDataSize
+ )
+{
+ EFI_STATUS Status;
+ PEI_IPMI_PPI_INTERNAL *PeiIpmiPpiinternal;
+
+ PeiIpmiPpiinternal = MANAGEABILITY_IPMI_PPI_INTERNAL_FROM_LINK(This);
+ Status = CommonIpmiSubmitCommand (
+ PeiIpmiPpiinternal->TransportToken,
+ NetFunction,
+ Command,
+ RequestData,
+ RequestDataSize,
+ ResponseData,
+ ResponseDataSize
+ );
+ return Status;
+}
+
+/**
+ The entry point of the Ipmi PPI PEIM.
+
+ @param FileHandle Handle of the file being invoked.
+ @param PeiServices Describes the list of possible PEI Services.
+
+ @retval EFI_SUCCESS Indicates that Ipmi initialization completed successfully.
+ @retval Others Indicates that Ipmi initialization could not complete successfully.
+**/
+EFI_STATUS
+EFIAPI
+PeiIpmiEntry (
+ IN EFI_PEI_FILE_HANDLE FileHandle,
+ IN CONST EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ CHAR16 *TransportName;
+ PEI_IPMI_PPI_INTERNAL *PeiIpmiPpiinternal;
+ EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;
+ MANAGEABILITY_TRANSPORT_CAPABILITY TransportCapability;
+ MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS TransportAdditionalStatus;
+ MANAGEABILITY_TRANSPORT_HARDWARE_INFORMATION HardwareInformation;
+
+ PeiIpmiPpiinternal = (PEI_IPMI_PPI_INTERNAL *)AllocateZeroPool (sizeof(PEI_IPMI_PPI_INTERNAL));
+ if (PeiIpmiPpiinternal == NULL) {
+ DEBUG ((DEBUG_ERROR, "%a: Not enough memory for PEI_IPMI_PPI_INTERNAL.\n", __FUNCTION__));
+ return EFI_OUT_OF_RESOURCES;
+ }
+ PpiDescriptor = (EFI_PEI_PPI_DESCRIPTOR *)AllocateZeroPool (sizeof(EFI_PEI_PPI_DESCRIPTOR));
+ if (PpiDescriptor == NULL) {
+ DEBUG ((DEBUG_ERROR, "%a: Not enough memory for EFI_PEI_PPI_DESCRIPTOR.\n", __FUNCTION__));
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ PeiIpmiPpiinternal->Signature = MANAGEABILITY_IPMI_PPI_INTERNAL_SIGNATURE;
+ PeiIpmiPpiinternal->PeiIpmiPpi.IpmiSubmitCommand = PeiIpmiSubmitCommand;
+
+ PpiDescriptor->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
+ PpiDescriptor->Guid = &gPeiIpmiPpiGuid;
+ PpiDescriptor->Ppi = &PeiIpmiPpiinternal->PeiIpmiPpi;
+
+ GetTransportCapability (&TransportCapability);
+ Status = HelperAcquireManageabilityTransport (
+ &gManageabilityProtocolIpmiGuid,
+ &PeiIpmiPpiinternal->TransportToken
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: Failed to acquire transport interface for IPMI protocol - %r\n", __FUNCTION__, Status));
+ return Status;
+ }
+
+ TransportName = HelperManageabilitySpecName (PeiIpmiPpiinternal->TransportToken->Transport->ManageabilityTransportSpecification);
+ DEBUG ((DEBUG_INFO, "%a: IPMI protocol over %s.\n", __FUNCTION__, TransportName));
+
+ //
+ // Setup hardware information according to the transport interface.
+ Status = SetupIpmiTransportHardwareInformation (
+ PeiIpmiPpiinternal->TransportToken,
+ &HardwareInformation
+ );
+ if (EFI_ERROR (Status)) {
+ if (Status == EFI_UNSUPPORTED) {
+ DEBUG ((DEBUG_ERROR, "%a: No hardware information of %s transport interface.\n", __FUNCTION__, TransportName));
+ }
+
+ return Status;
+ }
+
+ //
+ // Initial transport interface with the hardware information assigned.
+ Status = HelperInitManageabilityTransport (
+ PeiIpmiPpiinternal->TransportToken,
+ HardwareInformation,
+ &TransportAdditionalStatus
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Install IPMI PPI.
+ //
+ Status = PeiServicesInstallPpi (PpiDescriptor);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: Failed to install IPMI PPI - %r\n", __FUNCTION__, Status));
+ }
+
+ return Status;
+}
diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocol.c b/Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocol.c
new file mode 100644
index 0000000000..87a5436bdf
--- /dev/null
+++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocol.c
@@ -0,0 +1,147 @@
+/** @file
+ This file provides IPMI SMM Protocol implementation.
+
+ Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include <PiDxe.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/ManageabilityTransportLib.h>
+#include <Library/ManageabilityTransportIpmiLib.h>
+#include <Library/ManageabilityTransportHelperLib.h>
+#include <Library/SmmServicesTableLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+
+#include <Protocol/IpmiProtocol.h>
+
+#include "IpmiProtocolCommon.h"
+
+MANAGEABILITY_TRANSPORT_TOKEN *mTransportToken = NULL;
+CHAR16 *mTransportName;
+
+MANAGEABILITY_TRANSPORT_HARDWARE_INFORMATION mHardwareInformation;
+
+/**
+ This service enables submitting commands via Ipmi.
+
+ @param[in] This This point for IPMI_PROTOCOL structure.
+ @param[in] NetFunction Net function of the command.
+ @param[in] Command IPMI Command.
+ @param[in] RequestData Command Request Data.
+ @param[in] RequestDataSize Size of Command Request Data.
+ @param[out] ResponseData Command Response Data. The completion code is the first byte of response data.
+ @param[in, out] ResponseDataSize Size of Command Response Data.
+
+ @retval EFI_SUCCESS The command byte stream was successfully submit to the device and a response was successfully received.
+ @retval EFI_NOT_FOUND The command was not successfully sent to the device or a response was not successfully received from the device.
+ @retval EFI_NOT_READY Ipmi Device is not ready for Ipmi command access.
+ @retval EFI_DEVICE_ERROR Ipmi Device hardware error.
+ @retval EFI_TIMEOUT The command time out.
+ @retval EFI_UNSUPPORTED The command was not successfully sent to the device.
+ @retval EFI_OUT_OF_RESOURCES The resource allocation is out of resource or data size error.
+**/
+EFI_STATUS
+EFIAPI
+SmmIpmiSubmitCommand (
+ IN IPMI_PROTOCOL *This,
+ IN UINT8 NetFunction,
+ IN UINT8 Command,
+ IN UINT8 *RequestData,
+ IN UINT32 RequestDataSize,
+ OUT UINT8 *ResponseData,
+ IN OUT UINT32 *ResponseDataSize
+ )
+{
+ EFI_STATUS Status;
+
+ Status = CommonIpmiSubmitCommand (
+ mTransportToken,
+ NetFunction,
+ Command,
+ RequestData,
+ RequestDataSize,
+ ResponseData,
+ ResponseDataSize
+ );
+ return Status;
+}
+
+static IPMI_PROTOCOL mIpmiProtocol = {
+ SmmIpmiSubmitCommand
+};
+
+/**
+ The entry point of the Ipmi DXE driver.
+
+ @param[in] ImageHandle - Handle of this driver image
+ @param[in] SystemTable - Table containing standard EFI services
+
+ @retval EFI_SUCCESS - IPMI Protocol is installed successfully.
+ @retval Otherwise - Other errors.
+**/
+EFI_STATUS
+EFIAPI
+SmmIpmiEntry (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_HANDLE Handle;
+ MANAGEABILITY_TRANSPORT_CAPABILITY TransportCapability;
+ MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS TransportAdditionalStatus;
+
+ GetTransportCapability (&TransportCapability);
+
+ Status = HelperAcquireManageabilityTransport (
+ &gManageabilityProtocolIpmiGuid,
+ &mTransportToken
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: Failed to acquire transport interface for IPMI protocol - %r\n", __FUNCTION__, Status));
+ return Status;
+ }
+
+ mTransportName = HelperManageabilitySpecName (mTransportToken->Transport->ManageabilityTransportSpecification);
+ DEBUG ((DEBUG_INFO, "%a: IPMI protocol over %s.\n", __FUNCTION__, mTransportName));
+
+ //
+ // Setup hardware information according to the transport interface.
+ Status = SetupIpmiTransportHardwareInformation (
+ mTransportToken,
+ &mHardwareInformation
+ );
+ if (EFI_ERROR (Status)) {
+ if (Status == EFI_UNSUPPORTED) {
+ DEBUG ((DEBUG_ERROR, "%a: No hardware information of %s transport interface.\n", __FUNCTION__, mTransportName));
+ }
+
+ return Status;
+ }
+
+ //
+ // Initial transport interface with the hardware information assigned.
+ Status = HelperInitManageabilityTransport (
+ mTransportToken,
+ mHardwareInformation,
+ &TransportAdditionalStatus
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Handle = NULL;
+ Status = gSmst->SmmInstallProtocolInterface (
+ &Handle,
+ &gSmmIpmiProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ (VOID **)&mIpmiProtocol
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: Failed to install IPMI SMM protocol - %r\n", __FUNCTION__, Status));
+ }
+
+ return Status;
+}
--
2.37.1.windows.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [edk2-devel] [PATCH v3 6/8] ManageabilityPkg: Implement Ipmi Protocol/Ppi
2023-03-21 3:21 ` [PATCH v3 6/8] ManageabilityPkg: Implement Ipmi Protocol/Ppi Chang, Abner
@ 2023-03-21 12:23 ` Leif Lindholm
0 siblings, 0 replies; 11+ messages in thread
From: Leif Lindholm @ 2023-03-21 12:23 UTC (permalink / raw)
To: devel, abner.chang
Cc: Liming Gao, Isaac Oram, Nate DeSimone, Abdul Lateef Attar,
Nickle Wang, Igor Kulchytskyy
On Tue, Mar 21, 2023 at 11:21:45 +0800, Chang, Abner via groups.io wrote:
> From: Abner Chang <abner.chang@amd.com>
>
> Add Ipmi Protocol/Ppi/SMM implementations.
> The underlying implementation of transport
> interface depends on the binded
> ManageabilityTransportLib.
>
> Signed-off-by: Abner Chang <abner.chang@amd.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Isaac Oram <isaac.w.oram@intel.com>
> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> Cc: Abdul Lateef Attar <abdattar@amd.com>
> Cc: Nickle Wang <nicklew@nvidia.com>
> Cc: Igor Kulchytskyy <igork@ami.com>
> ---
> .../IpmiProtocol/Dxe/IpmiProtocolDxe.inf | 50 ++++
> .../Universal/IpmiProtocol/Pei/IpmiPpiPei.inf | 53 ++++
> .../IpmiProtocol/Smm/IpmiProtocolSmm.inf | 52 ++++
> .../IpmiProtocol/Common/IpmiProtocolCommon.h | 108 ++++++++
> .../IpmiProtocol/Pei/IpmiPpiInternal.h | 25 ++
> .../IpmiProtocol/Common/IpmiProtocolCommon.c | 252 ++++++++++++++++++
> .../Universal/IpmiProtocol/Dxe/IpmiProtocol.c | 177 ++++++++++++
> .../Universal/IpmiProtocol/Pei/IpmiPpi.c | 159 +++++++++++
> .../Universal/IpmiProtocol/Smm/IpmiProtocol.c | 147 ++++++++++
> 9 files changed, 1023 insertions(+)
> create mode 100644 Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocolDxe.inf
> create mode 100644 Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf
> create mode 100644 Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocolSmm.inf
> create mode 100644 Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolCommon.h
> create mode 100644 Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiInternal.h
> create mode 100644 Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolCommon.c
> create mode 100644 Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocol.c
> create mode 100644 Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpi.c
> create mode 100644 Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocol.c
>
> diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocolDxe.inf b/Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocolDxe.inf
> new file mode 100644
> index 0000000000..ff5ec56c73
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocolDxe.inf
> @@ -0,0 +1,50 @@
> +## @file
> +# IPMI Protocol DXE Driver.
> +#
> +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> +##
> +
> +[Defines]
> + INF_VERSION = 0x0001001d
> + BASE_NAME = IpmiDxe
> + FILE_GUID = BC41B0C2-9D8A-42B5-A28F-02CE0D4A6C28
> + MODULE_TYPE = DXE_DRIVER
> + VERSION_STRING = 1.0
> + ENTRY_POINT = DxeIpmiEntry
> + UNLOAD_IMAGE = IpmiUnloadImage
> +
> +#
> +# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64
> +#
> +
> +[Sources]
> + IpmiProtocol.c
> + ../Common/IpmiProtocolCommon.c
> + ../Common/IpmiProtocolCommon.h
Hmm. I see this pattern has appeared in in a few places in
edk2-platforms (primarily around Ipmi): a .inf referencing relative
paths above it in hierarchy.
I much prefer the more common pattern of having the .inf a level up,
because I feel it makes it more explicit which modules actually share
the "common" bit.
This is me stating my preference, I don't know that we have any hard
rules about it.
/
Leif
> +
> +[Packages]
> + MdePkg/MdePkg.dec
> + MdeModulePkg/MdeModulePkg.dec
> + ManageabilityPkg/ManageabilityPkg.dec
> +
> +[LibraryClasses]
> + BaseMemoryLib
> + DebugLib
> + ManageabilityTransportHelperLib
> + ManageabilityTransportLib
> + UefiDriverEntryPoint
> + UefiBootServicesTableLib
> +
> +[Protocols]
> + gIpmiProtocolGuid # PROTOCOL ALWAYS_PRODUCED
> +
> +[Guids]
> + gManageabilityProtocolIpmiGuid
> + gManageabilityTransportKcsGuid
> +
> +[FixedPcd]
> + gEfiMdePkgTokenSpaceGuid.PcdIpmiKcsBaseAddress
> +
> +[Depex]
> + TRUE
> diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf
> new file mode 100644
> index 0000000000..4e00693f64
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf
> @@ -0,0 +1,53 @@
> +## @file
> +# IPMI Protocol PEI Driver.
> +#
> +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> +##
> +
> +[Defines]
> + INF_VERSION = 0x0001001d
> + BASE_NAME = IpmiPei
> + FILE_GUID = 7832F989-CB72-4715-ADCA-35C0B031856C
> + MODULE_TYPE = PEIM
> + VERSION_STRING = 1.0
> + ENTRY_POINT = PeiIpmiEntry
> +
> +#
> +# The following information is for reference only and not required by the build tools.
> +#
> +# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64
> +#
> +
> +[Sources]
> + IpmiPpi.c
> + IpmiPpiInternal.h
> + ../Common/IpmiProtocolCommon.c
> + ../Common/IpmiProtocolCommon.h
> +
> +[Packages]
> + MdePkg/MdePkg.dec
> + MdeModulePkg/MdeModulePkg.dec
> + ManageabilityPkg/ManageabilityPkg.dec
> +
> +[LibraryClasses]
> + BaseMemoryLib
> + DebugLib
> + MemoryAllocationLib
> + ManageabilityTransportHelperLib
> + ManageabilityTransportLib
> + PeimEntryPoint
> + ManageabilityTransportLib
> +
> +[Ppis]
> + gPeiIpmiPpiGuid # PPI ALWAYS PRODUCED
> +
> +[Guids]
> + gManageabilityProtocolIpmiGuid
> + gManageabilityTransportKcsGuid
> +
> +[FixedPcd]
> + gEfiMdePkgTokenSpaceGuid.PcdIpmiKcsBaseAddress
> +
> +[Depex]
> + TRUE
> diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocolSmm.inf b/Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocolSmm.inf
> new file mode 100644
> index 0000000000..cae1462f4f
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocolSmm.inf
> @@ -0,0 +1,52 @@
> +## @file
> +# IPMI Protocol SMM Driver.
> +#
> +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> +##
> +
> +#
> +# The following information is for reference only and not required by the build tools.
> +#
> +# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64
> +#
> +[Defines]
> + INF_VERSION = 0x0001001d
> + BASE_NAME = IpmiSmm
> + FILE_GUID = CDD5D1DE-E3D3-4B1F-8689-DCC661561BB4
> + MODULE_TYPE = DXE_SMM_DRIVER
> + PI_SPECIFICATION_VERSION = 0x0001000A
> + VERSION_STRING = 1.0
> + ENTRY_POINT = SmmIpmiEntry
> +
> +[Sources]
> + IpmiProtocol.c
> + ../Common/IpmiProtocolCommon.c
> + ../Common/IpmiProtocolCommon.h
> +
> +[Packages]
> + MdePkg/MdePkg.dec
> + MdeModulePkg/MdeModulePkg.dec
> + ManageabilityPkg/ManageabilityPkg.dec
> +
> +[LibraryClasses]
> + BaseMemoryLib
> + DebugLib
> + ManageabilityTransportHelperLib
> + ManageabilityTransportLib
> + SmmServicesTableLib
> + UefiDriverEntryPoint
> + UefiBootServicesTableLib
> +
> +[Protocols]
> + gSmmIpmiProtocolGuid # PROTOCOL ALWAYS_PRODUCED
> +
> +[Guids]
> + gManageabilityProtocolIpmiGuid
> + gManageabilityTransportKcsGuid
> +
> +[FixedPcd]
> + gEfiMdePkgTokenSpaceGuid.PcdIpmiKcsBaseAddress
> +
> +[Depex]
> + TRUE
> diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolCommon.h b/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolCommon.h
> new file mode 100644
> index 0000000000..57b92cf2be
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolCommon.h
> @@ -0,0 +1,108 @@
> +/** @file
> +
> + IPMI Manageability Protocol common header file.
> +
> + Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +**/
> +
> +#ifndef MANAGEABILITY_IPMI_COMMON_H_
> +#define MANAGEABILITY_IPMI_COMMON_H_
> +
> +#include <IndustryStandard/IpmiKcs.h>
> +#include <Library/ManageabilityTransportLib.h>
> +
> +///
> +/// IPMI KCS hardware information.
> +///
> +#define IPMI_KCS_BASE_ADDRESS PcdGet16 (PcdIpmiKcsBaseAddress)
> +#define IPMI_KCS_REG_DATA_IN IPMI_KCS_BASE_ADDRESS + IPMI_KCS_DATA_IN_REGISTER_OFFSET
> +#define IPMI_KCS_REG_DATA_OUT IPMI_KCS_BASE_ADDRESS + IPMI_KCS_DATA_OUT_REGISTER_OFFSET
> +#define IPMI_KCS_REG_COMMAND IPMI_KCS_BASE_ADDRESS + IPMI_KCS_COMMAND_REGISTER_OFFSET
> +#define IPMI_KCS_REG_STATUS IPMI_KCS_BASE_ADDRESS + IPMI_KCS_STATUS_REGISTER_OFFSET
> +
> +/**
> + This functions setup the IPMI 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_SUCCESS Hardware information is returned in HardwareInformation.
> + Caller must free the memory allocated for HardwareInformation
> + once it doesn't need it.
> + @retval EFI_UNSUPPORTED No hardware information for the specification specified
> + in the transport token.
> +**/
> +EFI_STATUS
> +SetupIpmiTransportHardwareInformation (
> + 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 interface.
> + @param[in] NetFunction IPMI function.
> + @param[in] Command IPMI command.
> + @param[out] PacketHeader The pointer to receive header of request.
> + @param[in, out] PacketBody The request body.
> + When IN, it is the caller's request body.
> + When OUT and NULL, the request body is not
> + changed.
> + Whee out and non-NULL, the request body is
> + changed to comfort the transport interface.
> + @param[in, out] PacketBodySize The request body size.
> + When IN and non-zero, it is the new data
> + length of request body.
> + When IN and zero, the request body is unchanged.
> + @param[out] PacketTrailer The pointer to receive trailer of request.
> +
> + @retval EFI_SUCCESS Request packet is returned.
> + @retval EFI_UNSUPPORTED Request packet is not returned because
> + the unsupported transport interface.
> +**/
> +EFI_STATUS
> +SetupIpmiRequestTransportPacket (
> + IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken,
> + IN UINT8 NetFunction,
> + IN UINT8 Command,
> + OUT MANAGEABILITY_TRANSPORT_HEADER *PacketHeader OPTIONAL,
> + IN OUT UINT8 **PacketBody OPTIONAL,
> + IN OUT UINT32 *PacketBodySize OPTIONAL,
> + OUT MANAGEABILITY_TRANSPORT_TRAILER *PacketTrailer OPTIONAL
> + );
> +
> +/**
> + Common code to submit IPMI commands
> +
> + @param[in] TransportToken TRansport token.
> + @param[in] NetFunction Net function of the command.
> + @param[in] Command IPMI Command.
> + @param[in] RequestData Command Request Data.
> + @param[in] RequestDataSize Size of Command Request Data.
> + @param[out] ResponseData Command Response Data. The completion code is the first byte of response data.
> + @param[in, out] ResponseDataSize Size of Command Response Data.
> +
> + @retval EFI_SUCCESS The command byte stream was successfully submit to the device and a response was successfully received.
> + @retval EFI_NOT_FOUND The command was not successfully sent to the device or a response was not successfully received from the device.
> + @retval EFI_NOT_READY Ipmi Device is not ready for Ipmi command access.
> + @retval EFI_DEVICE_ERROR Ipmi Device hardware error.
> + @retval EFI_TIMEOUT The command time out.
> + @retval EFI_UNSUPPORTED The command was not successfully sent to the device.
> + @retval EFI_OUT_OF_RESOURCES The resource allocation is out of resource or data size error.
> +**/
> +EFI_STATUS
> +CommonIpmiSubmitCommand (
> + IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken,
> + IN UINT8 NetFunction,
> + IN UINT8 Command,
> + IN UINT8 *RequestData OPTIONAL,
> + IN UINT32 RequestDataSize,
> + OUT UINT8 *ResponseData OPTIONAL,
> + IN OUT UINT32 *ResponseDataSize OPTIONAL
> + );
> +
> +#endif
> diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiInternal.h b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiInternal.h
> new file mode 100644
> index 0000000000..bbe0c8c5cb
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiInternal.h
> @@ -0,0 +1,25 @@
> +/** @file
> +
> + IPMI Manageability PPI internal header file.
> +
> + Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +**/
> +
> +#ifndef MANAGEABILITY_IPMI_PPI_INTERNAL_H_
> +#define MANAGEABILITY_IPMI_PPI_INTERNAL_H_
> +
> +#include <Library/ManageabilityTransportLib.h>
> +#include <Ppi/IpmiPpi.h>
> +
> +#define MANAGEABILITY_IPMI_PPI_INTERNAL_SIGNATURE SIGNATURE_32 ('I', 'P', 'P', 'I')
> +
> +#define MANAGEABILITY_IPMI_PPI_INTERNAL_FROM_LINK(a) CR (a, PEI_IPMI_PPI_INTERNAL, PeiIpmiPpi, MANAGEABILITY_IPMI_PPI_INTERNAL_SIGNATURE)
> +
> +typedef struct {
> + UINT32 Signature;
> + MANAGEABILITY_TRANSPORT_TOKEN *TransportToken;
> + PEI_IPMI_PPI PeiIpmiPpi;
> +} PEI_IPMI_PPI_INTERNAL;
> +
> +#endif // MANAGEABILITY_IPMI_PPI_INTERNAL_H_
> diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolCommon.c b/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolCommon.c
> new file mode 100644
> index 0000000000..d1294d2f7c
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolCommon.c
> @@ -0,0 +1,252 @@
> +/** @file
> +
> + IPMI Manageability Protocol common file.
> +
> + Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +#include <Uefi.h>
> +#include <Library/BaseMemoryLib.h>
> +#include <Library/DebugLib.h>
> +#include <Library/MemoryAllocationLib.h>
> +#include <Library/ManageabilityTransportIpmiLib.h>
> +#include <Library/ManageabilityTransportLib.h>
> +
> +#include "IpmiProtocolCommon.h"
> +
> +/**
> + This functions setup the IPMI 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_SUCCESS Hardware information is returned in HardwareInformation.
> + Caller must free the memory allocated for HardwareInformation
> + once it doesn't need it.
> + @retval EFI_UNSUPPORTED No hardware information for the specification specified
> + in the transport token.
> + #retval EFI_OUT_OF_RESOURCES Not enough memory for MANAGEABILITY_TRANSPORT_KCS_HARDWARE_INFO.
> +**/
> +EFI_STATUS
> +SetupIpmiTransportHardwareInformation (
> + IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken,
> + OUT MANAGEABILITY_TRANSPORT_HARDWARE_INFORMATION *HardwareInformation
> + )
> +{
> + MANAGEABILITY_TRANSPORT_KCS_HARDWARE_INFO *KcsHardwareInfo;
> +
> + KcsHardwareInfo = AllocatePool (sizeof (MANAGEABILITY_TRANSPORT_KCS_HARDWARE_INFO));
> + if (KcsHardwareInfo == NULL) {
> + DEBUG ((DEBUG_ERROR, "%a: Not enough memory for MANAGEABILITY_TRANSPORT_KCS_HARDWARE_INFO.\n", __FUNCTION__));
> + return EFI_OUT_OF_RESOURCES;
> + }
> +
> + if (CompareGuid (&gManageabilityTransportKcsGuid, TransportToken->Transport->ManageabilityTransportSpecification)) {
> + // This is KCS transport interface.
> + KcsHardwareInfo->MemoryMap = MANAGEABILITY_TRANSPORT_KCS_IO_MAP_IO;
> + KcsHardwareInfo->IoBaseAddress.IoAddress16 = IPMI_KCS_BASE_ADDRESS;
> + KcsHardwareInfo->IoDataInAddress.IoAddress16 = IPMI_KCS_REG_DATA_IN;
> + KcsHardwareInfo->IoDataOutAddress.IoAddress16 = IPMI_KCS_REG_DATA_OUT;
> + KcsHardwareInfo->IoCommandAddress.IoAddress16 = IPMI_KCS_REG_COMMAND;
> + KcsHardwareInfo->IoStatusAddress.IoAddress16 = IPMI_KCS_REG_STATUS;
> + *HardwareInformation =
> + (MANAGEABILITY_TRANSPORT_HARDWARE_INFORMATION)KcsHardwareInfo;
> + return EFI_SUCCESS;
> + } else {
> + DEBUG ((DEBUG_ERROR, "%a: No implementation of setting hardware information.", __FUNCTION__));
> + ASSERT (FALSE);
> + }
> +
> + return EFI_UNSUPPORTED;
> +}
> +
> +/**
> + This functions setup the final header/body/trailer packets for
> + the acquired transport interface.
> +
> + @param[in] TransportToken The transport interface.
> + @param[in] NetFunction IPMI function.
> + @param[in] Command IPMI command.
> + @param[out] PacketHeader The pointer to receive header of request.
> + @param[in, out] PacketBody The request body.
> + When IN, it is the caller's request body.
> + When OUT and NULL, the request body is not
> + changed.
> + When OUT and non-NULL, the request body is
> + changed to conform the transport interface.
> + @param[in, out] PacketBodySize The request body size.
> + When OUT and non-zero, it is the new data
> + length of request body.
> + When OUT and zero, the request body is unchanged.
> + @param[out] PacketTrailer The pointer to receive trailer of request.
> +
> + @retval EFI_SUCCESS Request packet is returned.
> + @retval EFI_UNSUPPORTED Request packet is not returned because
> + the unsupported transport interface.
> +**/
> +EFI_STATUS
> +SetupIpmiRequestTransportPacket (
> + IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken,
> + IN UINT8 NetFunction,
> + IN UINT8 Command,
> + OUT MANAGEABILITY_TRANSPORT_HEADER *PacketHeader OPTIONAL,
> + IN OUT UINT8 **PacketBody OPTIONAL,
> + IN OUT UINT32 *PacketBodySize OPTIONAL,
> + OUT MANAGEABILITY_TRANSPORT_TRAILER *PacketTrailer OPTIONAL
> + )
> +{
> + MANAGEABILITY_IPMI_TRANSPORT_HEADER *IpmiHeader;
> +
> + if (CompareGuid (&gManageabilityTransportKcsGuid, TransportToken->Transport->ManageabilityTransportSpecification)) {
> + // This is KCS transport interface.
> + IpmiHeader = AllocateZeroPool (sizeof (MANAGEABILITY_IPMI_TRANSPORT_HEADER));
> + if (IpmiHeader == NULL) {
> + return EFI_OUT_OF_RESOURCES;
> + }
> +
> + IpmiHeader->Command = Command;
> + IpmiHeader->Lun = 0;
> + IpmiHeader->NetFn = NetFunction;
> + if (PacketHeader != NULL) {
> + *PacketHeader = (MANAGEABILITY_TRANSPORT_HEADER *)IpmiHeader;
> + }
> + if (PacketTrailer != NULL) {
> + *PacketTrailer = NULL;
> + }
> + if (PacketBody != NULL) {
> + *PacketBody = NULL;
> + }
> + if (PacketBodySize != NULL) {
> + *PacketBodySize = 0;
> + }
> + } else {
> + DEBUG ((DEBUG_ERROR, "%a: No implementation of building up packet.", __FUNCTION__));
> + ASSERT (FALSE);
> + }
> + return EFI_SUCCESS;
> +}
> +
> +/**
> + Common code to submit IPMI commands
> +
> + @param[in] TransportToken TRansport token.
> + @param[in] NetFunction Net function of the command.
> + @param[in] Command IPMI Command.
> + @param[in] RequestData Command Request Data.
> + @param[in] RequestDataSize Size of Command Request Data.
> + @param[out] ResponseData Command Response Data. The completion code is the first byte of response data.
> + @param[in, out] ResponseDataSize Size of Command Response Data.
> +
> + @retval EFI_SUCCESS The command byte stream was successfully submit to the device and a response was successfully received.
> + @retval EFI_NOT_FOUND The command was not successfully sent to the device or a response was not successfully received from the device.
> + @retval EFI_NOT_READY Ipmi Device is not ready for Ipmi command access.
> + @retval EFI_DEVICE_ERROR Ipmi Device hardware error.
> + @retval EFI_TIMEOUT The command time out.
> + @retval EFI_UNSUPPORTED The command was not successfully sent to the device.
> + @retval EFI_OUT_OF_RESOURCES The resource allocation is out of resource or data size error.
> +**/
> +EFI_STATUS
> +CommonIpmiSubmitCommand (
> + IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken,
> + IN UINT8 NetFunction,
> + IN UINT8 Command,
> + IN UINT8 *RequestData OPTIONAL,
> + IN UINT32 RequestDataSize,
> + OUT UINT8 *ResponseData OPTIONAL,
> + IN OUT UINT32 *ResponseDataSize OPTIONAL
> + )
> +{
> + EFI_STATUS Status;
> + UINT8 *ThisRequestData;
> + UINT32 ThisRequestDataSize;
> + MANAGEABILITY_TRANSFER_TOKEN TransferToken;
> + MANAGEABILITY_TRANSPORT_HEADER IpmiTransportHeader;
> + MANAGEABILITY_TRANSPORT_TRAILER IpmiTransportTrailer;
> + MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS TransportAdditionalStatus;
> +
> + if (TransportToken == NULL) {
> + DEBUG ((DEBUG_ERROR, "%a: No transport toke for IPMI\n", __FUNCTION__));
> + return EFI_UNSUPPORTED;
> + }
> +
> + Status = TransportToken->Transport->Function.Version1_0->TransportStatus (
> + TransportToken,
> + &TransportAdditionalStatus
> + );
> + if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a: Transport for IPMI has problem - (%r)\n", __FUNCTION__, Status));
> + return Status;
> + }
> +
> + ThisRequestData = RequestData;
> + ThisRequestDataSize = RequestDataSize;
> + IpmiTransportHeader = NULL;
> + IpmiTransportTrailer = NULL;
> + Status = SetupIpmiRequestTransportPacket (
> + TransportToken,
> + NetFunction,
> + Command,
> + &IpmiTransportHeader,
> + &ThisRequestData,
> + &ThisRequestDataSize,
> + &IpmiTransportTrailer
> + );
> + if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a: Fail to build packets - (%r)\n", __FUNCTION__, Status));
> + return Status;
> + }
> +
> + ZeroMem (&TransferToken, sizeof (MANAGEABILITY_TRANSFER_TOKEN));
> + TransferToken.TransmitHeader = IpmiTransportHeader;
> + TransferToken.TransmitTrailer = IpmiTransportTrailer;
> +
> + // Transmit packet.
> + if ((ThisRequestData == NULL) || (ThisRequestDataSize == 0)) {
> +
> + // Transmit parameter were not changed by SetupIpmiRequestTransportPacket().
> + TransferToken.TransmitPackage.TransmitPayload = RequestData;
> + TransferToken.TransmitPackage.TransmitSizeInByte = RequestDataSize;
> + } else {
> + TransferToken.TransmitPackage.TransmitPayload = ThisRequestData;
> + TransferToken.TransmitPackage.TransmitSizeInByte = ThisRequestDataSize;
> + }
> +
> + TransferToken.TransmitPackage.TransmitTimeoutInMillisecond = MANAGEABILITY_TRANSPORT_NO_TIMEOUT;
> +
> + // Receive packet.
> + TransferToken.ReceivePackage.ReceiveBuffer = ResponseData;
> + TransferToken.ReceivePackage.ReceiveSizeInByte = *ResponseDataSize;
> + TransferToken.ReceivePackage.TransmitTimeoutInMillisecond = MANAGEABILITY_TRANSPORT_NO_TIMEOUT;
> + TransportToken->Transport->Function.Version1_0->TransportTransmitReceive (
> + TransportToken,
> + &TransferToken
> + );
> +
> + if (IpmiTransportHeader != NULL) {
> + FreePool ((VOID *)IpmiTransportHeader);
> + }
> +
> + if (IpmiTransportTrailer != NULL) {
> + FreePool ((VOID *)IpmiTransportTrailer);
> + }
> +
> + if (ThisRequestData != NULL) {
> + FreePool ((VOID *)ThisRequestData);
> + }
> +
> + // Return transfer status.
> + //
> + Status = TransferToken.TransferStatus;
> + TransportAdditionalStatus = TransferToken.TransportAdditionalStatus;
> + if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a: Failed to send IPMI command.\n", __FUNCTION__));
> + return Status;
> + }
> +
> + if (ResponseDataSize != NULL) {
> + *ResponseDataSize = TransferToken.ReceivePackage.ReceiveSizeInByte;
> + }
> + return Status;
> +}
> diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocol.c b/Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocol.c
> new file mode 100644
> index 0000000000..05175ee448
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocol.c
> @@ -0,0 +1,177 @@
> +/** @file
> + This file provides IPMI Protocol implementation.
> +
> + Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +**/
> +
> +#include <PiDxe.h>
> +#include <Library/DebugLib.h>
> +#include <Library/BaseMemoryLib.h>
> +#include <Library/MemoryAllocationLib.h>
> +#include <Library/ManageabilityTransportLib.h>
> +#include <Library/ManageabilityTransportIpmiLib.h>
> +#include <Library/ManageabilityTransportHelperLib.h>
> +#include <Library/UefiBootServicesTableLib.h>
> +#include <Protocol/IpmiProtocol.h>
> +
> +#include "IpmiProtocolCommon.h"
> +
> +MANAGEABILITY_TRANSPORT_TOKEN *mTransportToken = NULL;
> +CHAR16 *mTransportName;
> +
> +MANAGEABILITY_TRANSPORT_HARDWARE_INFORMATION mHardwareInformation;
> +
> +/**
> + This service enables submitting commands via Ipmi.
> +
> + @param[in] This This point for IPMI_PROTOCOL structure.
> + @param[in] NetFunction Net function of the command.
> + @param[in] Command IPMI Command.
> + @param[in] RequestData Command Request Data.
> + @param[in] RequestDataSize Size of Command Request Data.
> + @param[out] ResponseData Command Response Data. The completion code is the first byte of response data.
> + @param[in, out] ResponseDataSize Size of Command Response Data.
> +
> + @retval EFI_SUCCESS The command byte stream was successfully submit to the device and a response was successfully received.
> + @retval EFI_NOT_FOUND The command was not successfully sent to the device or a response was not successfully received from the device.
> + @retval EFI_NOT_READY Ipmi Device is not ready for Ipmi command access.
> + @retval EFI_DEVICE_ERROR Ipmi Device hardware error.
> + @retval EFI_TIMEOUT The command time out.
> + @retval EFI_UNSUPPORTED The command was not successfully sent to the device.
> + @retval EFI_OUT_OF_RESOURCES The resource allocation is out of resource or data size error.
> +**/
> +EFI_STATUS
> +EFIAPI
> +DxeIpmiSubmitCommand (
> + IN IPMI_PROTOCOL *This,
> + IN UINT8 NetFunction,
> + IN UINT8 Command,
> + IN UINT8 *RequestData,
> + IN UINT32 RequestDataSize,
> + OUT UINT8 *ResponseData,
> + IN OUT UINT32 *ResponseDataSize
> + )
> +{
> + EFI_STATUS Status;
> +
> + Status = CommonIpmiSubmitCommand (
> + mTransportToken,
> + NetFunction,
> + Command,
> + RequestData,
> + RequestDataSize,
> + ResponseData,
> + ResponseDataSize
> + );
> + return Status;
> +}
> +
> +static IPMI_PROTOCOL mIpmiProtocol = {
> + DxeIpmiSubmitCommand
> +};
> +
> +/**
> + The entry point of the Ipmi DXE driver.
> +
> + @param[in] ImageHandle - Handle of this driver image
> + @param[in] SystemTable - Table containing standard EFI services
> +
> + @retval EFI_SUCCESS - IPMI Protocol is installed successfully.
> + @retval Otherwise - Other errors.
> +**/
> +EFI_STATUS
> +EFIAPI
> +DxeIpmiEntry (
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE *SystemTable
> + )
> +{
> + EFI_STATUS Status;
> + EFI_HANDLE Handle;
> + MANAGEABILITY_TRANSPORT_CAPABILITY TransportCapability;
> + MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS TransportAdditionalStatus;
> +
> + GetTransportCapability (&TransportCapability);
> +
> + Status = HelperAcquireManageabilityTransport (
> + &gManageabilityProtocolIpmiGuid,
> + &mTransportToken
> + );
> + if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a: Failed to acquire transport interface for IPMI protocol - %r\n", __FUNCTION__, Status));
> + return Status;
> + }
> +
> + mTransportName = HelperManageabilitySpecName (mTransportToken->Transport->ManageabilityTransportSpecification);
> + DEBUG ((DEBUG_INFO, "%a: IPMI protocol over %s.\n", __FUNCTION__, mTransportName));
> +
> + //
> + // Setup hardware information according to the transport interface.
> + Status = SetupIpmiTransportHardwareInformation (
> + mTransportToken,
> + &mHardwareInformation
> + );
> + if (EFI_ERROR (Status)) {
> + if (Status == EFI_UNSUPPORTED) {
> + DEBUG ((DEBUG_ERROR, "%a: No hardware information of %s transport interface.\n", __FUNCTION__, mTransportName));
> + }
> +
> + return Status;
> + }
> +
> + //
> + // Initial transport interface with the hardware information assigned.
> + Status = HelperInitManageabilityTransport (
> + mTransportToken,
> + mHardwareInformation,
> + &TransportAdditionalStatus
> + );
> + if (EFI_ERROR (Status)) {
> + return Status;
> + }
> +
> + Handle = NULL;
> + Status = gBS->InstallProtocolInterface (
> + &Handle,
> + &gIpmiProtocolGuid,
> + EFI_NATIVE_INTERFACE,
> + (VOID **)&mIpmiProtocol
> + );
> + if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a: Failed to install IPMI protocol - %r\n", __FUNCTION__, Status));
> + }
> +
> + return Status;
> +}
> +
> +/**
> + This is the unload handler for IPMI protocol module.
> +
> + Release the MANAGEABILITY_TRANSPORT_TOKEN acquired at entry point.
> +
> + @param[in] ImageHandle The drivers' driver image.
> +
> + @retval EFI_SUCCESS The image is unloaded.
> + @retval Others Failed to unload the image.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +IpmiUnloadImage (
> + IN EFI_HANDLE ImageHandle
> + )
> +{
> + EFI_STATUS Status;
> +
> + Status = EFI_SUCCESS;
> + if (mTransportToken != NULL) {
> + Status = ReleaseTransportSession (mTransportToken);
> + }
> +
> + if (mHardwareInformation.Pointer != NULL) {
> + FreePool (mHardwareInformation.Pointer);
> + }
> +
> + return Status;
> +}
> diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpi.c b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpi.c
> new file mode 100644
> index 0000000000..f839cd7387
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpi.c
> @@ -0,0 +1,159 @@
> +/** @file
> + This file provides IPMI PPI implementation.
> +
> + Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include <PiPei.h>
> +#include <Library/DebugLib.h>
> +#include <Library/BaseMemoryLib.h>
> +#include <Library/MemoryAllocationLib.h>
> +#include <Library/ManageabilityTransportLib.h>
> +#include <Library/ManageabilityTransportIpmiLib.h>
> +#include <Library/ManageabilityTransportHelperLib.h>
> +#include <Library/PeiServicesLib.h>
> +
> +#include <Ppi/IpmiPpi.h>
> +
> +#include "IpmiProtocolCommon.h"
> +#include "IpmiPpiInternal.h"
> +
> +/**
> + This service enables submitting commands via Ipmi.
> +
> + @param[in] This This point for PEI_IPMI_PPI structure.
> + @param[in] NetFunction Net function of the command.
> + @param[in] Command IPMI Command.
> + @param[in] RequestData Command Request Data.
> + @param[in] RequestDataSize Size of Command Request Data.
> + @param[out] ResponseData Command Response Data. The completion code is the first byte of response data.
> + @param[in, out] ResponseDataSize Size of Command Response Data.
> +
> + @retval EFI_SUCCESS The command byte stream was successfully submit to the device and a response was successfully received.
> + @retval EFI_NOT_FOUND The command was not successfully sent to the device or a response was not successfully received from the device.
> + @retval EFI_NOT_READY Ipmi Device is not ready for Ipmi command access.
> + @retval EFI_DEVICE_ERROR Ipmi Device hardware error.
> + @retval EFI_TIMEOUT The command time out.
> + @retval EFI_UNSUPPORTED The command was not successfully sent to the device.
> + @retval EFI_OUT_OF_RESOURCES The resource allocation is out of resource or data size error.
> +**/
> +EFI_STATUS
> +EFIAPI
> +PeiIpmiSubmitCommand (
> + IN PEI_IPMI_PPI *This,
> + IN UINT8 NetFunction,
> + IN UINT8 Command,
> + IN UINT8 *RequestData,
> + IN UINT32 RequestDataSize,
> + OUT UINT8 *ResponseData,
> + IN OUT UINT32 *ResponseDataSize
> + )
> +{
> + EFI_STATUS Status;
> + PEI_IPMI_PPI_INTERNAL *PeiIpmiPpiinternal;
> +
> + PeiIpmiPpiinternal = MANAGEABILITY_IPMI_PPI_INTERNAL_FROM_LINK(This);
> + Status = CommonIpmiSubmitCommand (
> + PeiIpmiPpiinternal->TransportToken,
> + NetFunction,
> + Command,
> + RequestData,
> + RequestDataSize,
> + ResponseData,
> + ResponseDataSize
> + );
> + return Status;
> +}
> +
> +/**
> + The entry point of the Ipmi PPI PEIM.
> +
> + @param FileHandle Handle of the file being invoked.
> + @param PeiServices Describes the list of possible PEI Services.
> +
> + @retval EFI_SUCCESS Indicates that Ipmi initialization completed successfully.
> + @retval Others Indicates that Ipmi initialization could not complete successfully.
> +**/
> +EFI_STATUS
> +EFIAPI
> +PeiIpmiEntry (
> + IN EFI_PEI_FILE_HANDLE FileHandle,
> + IN CONST EFI_PEI_SERVICES **PeiServices
> + )
> +{
> + EFI_STATUS Status;
> + CHAR16 *TransportName;
> + PEI_IPMI_PPI_INTERNAL *PeiIpmiPpiinternal;
> + EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;
> + MANAGEABILITY_TRANSPORT_CAPABILITY TransportCapability;
> + MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS TransportAdditionalStatus;
> + MANAGEABILITY_TRANSPORT_HARDWARE_INFORMATION HardwareInformation;
> +
> + PeiIpmiPpiinternal = (PEI_IPMI_PPI_INTERNAL *)AllocateZeroPool (sizeof(PEI_IPMI_PPI_INTERNAL));
> + if (PeiIpmiPpiinternal == NULL) {
> + DEBUG ((DEBUG_ERROR, "%a: Not enough memory for PEI_IPMI_PPI_INTERNAL.\n", __FUNCTION__));
> + return EFI_OUT_OF_RESOURCES;
> + }
> + PpiDescriptor = (EFI_PEI_PPI_DESCRIPTOR *)AllocateZeroPool (sizeof(EFI_PEI_PPI_DESCRIPTOR));
> + if (PpiDescriptor == NULL) {
> + DEBUG ((DEBUG_ERROR, "%a: Not enough memory for EFI_PEI_PPI_DESCRIPTOR.\n", __FUNCTION__));
> + return EFI_OUT_OF_RESOURCES;
> + }
> +
> + PeiIpmiPpiinternal->Signature = MANAGEABILITY_IPMI_PPI_INTERNAL_SIGNATURE;
> + PeiIpmiPpiinternal->PeiIpmiPpi.IpmiSubmitCommand = PeiIpmiSubmitCommand;
> +
> + PpiDescriptor->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
> + PpiDescriptor->Guid = &gPeiIpmiPpiGuid;
> + PpiDescriptor->Ppi = &PeiIpmiPpiinternal->PeiIpmiPpi;
> +
> + GetTransportCapability (&TransportCapability);
> + Status = HelperAcquireManageabilityTransport (
> + &gManageabilityProtocolIpmiGuid,
> + &PeiIpmiPpiinternal->TransportToken
> + );
> + if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a: Failed to acquire transport interface for IPMI protocol - %r\n", __FUNCTION__, Status));
> + return Status;
> + }
> +
> + TransportName = HelperManageabilitySpecName (PeiIpmiPpiinternal->TransportToken->Transport->ManageabilityTransportSpecification);
> + DEBUG ((DEBUG_INFO, "%a: IPMI protocol over %s.\n", __FUNCTION__, TransportName));
> +
> + //
> + // Setup hardware information according to the transport interface.
> + Status = SetupIpmiTransportHardwareInformation (
> + PeiIpmiPpiinternal->TransportToken,
> + &HardwareInformation
> + );
> + if (EFI_ERROR (Status)) {
> + if (Status == EFI_UNSUPPORTED) {
> + DEBUG ((DEBUG_ERROR, "%a: No hardware information of %s transport interface.\n", __FUNCTION__, TransportName));
> + }
> +
> + return Status;
> + }
> +
> + //
> + // Initial transport interface with the hardware information assigned.
> + Status = HelperInitManageabilityTransport (
> + PeiIpmiPpiinternal->TransportToken,
> + HardwareInformation,
> + &TransportAdditionalStatus
> + );
> + if (EFI_ERROR (Status)) {
> + return Status;
> + }
> +
> + //
> + // Install IPMI PPI.
> + //
> + Status = PeiServicesInstallPpi (PpiDescriptor);
> + if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a: Failed to install IPMI PPI - %r\n", __FUNCTION__, Status));
> + }
> +
> + return Status;
> +}
> diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocol.c b/Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocol.c
> new file mode 100644
> index 0000000000..87a5436bdf
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocol.c
> @@ -0,0 +1,147 @@
> +/** @file
> + This file provides IPMI SMM Protocol implementation.
> +
> + Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +**/
> +
> +#include <PiDxe.h>
> +#include <Library/DebugLib.h>
> +#include <Library/BaseMemoryLib.h>
> +#include <Library/ManageabilityTransportLib.h>
> +#include <Library/ManageabilityTransportIpmiLib.h>
> +#include <Library/ManageabilityTransportHelperLib.h>
> +#include <Library/SmmServicesTableLib.h>
> +#include <Library/UefiBootServicesTableLib.h>
> +
> +#include <Protocol/IpmiProtocol.h>
> +
> +#include "IpmiProtocolCommon.h"
> +
> +MANAGEABILITY_TRANSPORT_TOKEN *mTransportToken = NULL;
> +CHAR16 *mTransportName;
> +
> +MANAGEABILITY_TRANSPORT_HARDWARE_INFORMATION mHardwareInformation;
> +
> +/**
> + This service enables submitting commands via Ipmi.
> +
> + @param[in] This This point for IPMI_PROTOCOL structure.
> + @param[in] NetFunction Net function of the command.
> + @param[in] Command IPMI Command.
> + @param[in] RequestData Command Request Data.
> + @param[in] RequestDataSize Size of Command Request Data.
> + @param[out] ResponseData Command Response Data. The completion code is the first byte of response data.
> + @param[in, out] ResponseDataSize Size of Command Response Data.
> +
> + @retval EFI_SUCCESS The command byte stream was successfully submit to the device and a response was successfully received.
> + @retval EFI_NOT_FOUND The command was not successfully sent to the device or a response was not successfully received from the device.
> + @retval EFI_NOT_READY Ipmi Device is not ready for Ipmi command access.
> + @retval EFI_DEVICE_ERROR Ipmi Device hardware error.
> + @retval EFI_TIMEOUT The command time out.
> + @retval EFI_UNSUPPORTED The command was not successfully sent to the device.
> + @retval EFI_OUT_OF_RESOURCES The resource allocation is out of resource or data size error.
> +**/
> +EFI_STATUS
> +EFIAPI
> +SmmIpmiSubmitCommand (
> + IN IPMI_PROTOCOL *This,
> + IN UINT8 NetFunction,
> + IN UINT8 Command,
> + IN UINT8 *RequestData,
> + IN UINT32 RequestDataSize,
> + OUT UINT8 *ResponseData,
> + IN OUT UINT32 *ResponseDataSize
> + )
> +{
> + EFI_STATUS Status;
> +
> + Status = CommonIpmiSubmitCommand (
> + mTransportToken,
> + NetFunction,
> + Command,
> + RequestData,
> + RequestDataSize,
> + ResponseData,
> + ResponseDataSize
> + );
> + return Status;
> +}
> +
> +static IPMI_PROTOCOL mIpmiProtocol = {
> + SmmIpmiSubmitCommand
> +};
> +
> +/**
> + The entry point of the Ipmi DXE driver.
> +
> + @param[in] ImageHandle - Handle of this driver image
> + @param[in] SystemTable - Table containing standard EFI services
> +
> + @retval EFI_SUCCESS - IPMI Protocol is installed successfully.
> + @retval Otherwise - Other errors.
> +**/
> +EFI_STATUS
> +EFIAPI
> +SmmIpmiEntry (
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE *SystemTable
> + )
> +{
> + EFI_STATUS Status;
> + EFI_HANDLE Handle;
> + MANAGEABILITY_TRANSPORT_CAPABILITY TransportCapability;
> + MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS TransportAdditionalStatus;
> +
> + GetTransportCapability (&TransportCapability);
> +
> + Status = HelperAcquireManageabilityTransport (
> + &gManageabilityProtocolIpmiGuid,
> + &mTransportToken
> + );
> + if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a: Failed to acquire transport interface for IPMI protocol - %r\n", __FUNCTION__, Status));
> + return Status;
> + }
> +
> + mTransportName = HelperManageabilitySpecName (mTransportToken->Transport->ManageabilityTransportSpecification);
> + DEBUG ((DEBUG_INFO, "%a: IPMI protocol over %s.\n", __FUNCTION__, mTransportName));
> +
> + //
> + // Setup hardware information according to the transport interface.
> + Status = SetupIpmiTransportHardwareInformation (
> + mTransportToken,
> + &mHardwareInformation
> + );
> + if (EFI_ERROR (Status)) {
> + if (Status == EFI_UNSUPPORTED) {
> + DEBUG ((DEBUG_ERROR, "%a: No hardware information of %s transport interface.\n", __FUNCTION__, mTransportName));
> + }
> +
> + return Status;
> + }
> +
> + //
> + // Initial transport interface with the hardware information assigned.
> + Status = HelperInitManageabilityTransport (
> + mTransportToken,
> + mHardwareInformation,
> + &TransportAdditionalStatus
> + );
> + if (EFI_ERROR (Status)) {
> + return Status;
> + }
> +
> + Handle = NULL;
> + Status = gSmst->SmmInstallProtocolInterface (
> + &Handle,
> + &gSmmIpmiProtocolGuid,
> + EFI_NATIVE_INTERFACE,
> + (VOID **)&mIpmiProtocol
> + );
> + if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a: Failed to install IPMI SMM protocol - %r\n", __FUNCTION__, Status));
> + }
> +
> + return Status;
> +}
> --
> 2.37.1.windows.1
>
>
>
>
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v3 7/8] ManageabilityPkg: Add IpmiProtocol to Manageability Package
2023-03-21 3:21 [PATCH v3 3/8] ManageabilityPkg: Add NULL ManageabilityTransportLib Chang, Abner
` (2 preceding siblings ...)
2023-03-21 3:21 ` [PATCH v3 6/8] ManageabilityPkg: Implement Ipmi Protocol/Ppi Chang, Abner
@ 2023-03-21 3:21 ` Chang, Abner
2023-03-21 3:21 ` [PATCH v3 8/8] edk2-platforms: Maintainers.txt Chang, Abner
2023-03-21 12:06 ` [edk2-devel] [PATCH v3 3/8] ManageabilityPkg: Add NULL ManageabilityTransportLib Leif Lindholm
5 siblings, 0 replies; 11+ messages in thread
From: Chang, Abner @ 2023-03-21 3:21 UTC (permalink / raw)
To: devel
Cc: Liming Gao, Isaac Oram, Nate DeSimone, Abdul Lateef Attar,
Nickle Wang, Igor Kulchytskyy
From: Abner Chang <abner.chang@amd.com>
Add Ipmi Protocol/Ppi/SMM modules to ManageabilityPkg.
Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Isaac Oram <isaac.w.oram@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Abdul Lateef Attar <abdattar@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Reviewed-by: Nickle Wang <nicklew@nvidia.com>
---
Features/ManageabilityPkg/Include/Dsc/Manageability.dsc | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
index 994c93f17c..0d868fdf4a 100644
--- a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
+++ b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc
@@ -16,3 +16,10 @@
NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
ArmSoftFloatLib|ArmPkg/Library/ArmSoftFloatLib/ArmSoftFloatLib.inf
+[Components.IA32]
+ ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf
+
+[Components.X64]
+ ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocolDxe.inf
+ ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocolSmm.inf
+
--
2.37.1.windows.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v3 8/8] edk2-platforms: Maintainers.txt
2023-03-21 3:21 [PATCH v3 3/8] ManageabilityPkg: Add NULL ManageabilityTransportLib Chang, Abner
` (3 preceding siblings ...)
2023-03-21 3:21 ` [PATCH v3 7/8] ManageabilityPkg: Add IpmiProtocol to Manageability Package Chang, Abner
@ 2023-03-21 3:21 ` Chang, Abner
2023-03-21 11:50 ` Leif Lindholm
2023-03-21 12:06 ` [edk2-devel] [PATCH v3 3/8] ManageabilityPkg: Add NULL ManageabilityTransportLib Leif Lindholm
5 siblings, 1 reply; 11+ messages in thread
From: Chang, Abner @ 2023-03-21 3:21 UTC (permalink / raw)
To: devel
Cc: Abdul Lateef Attar, Leif Lindholm, Michael D Kinney, Liming Gao,
Isaac Oram, Nickle Wang
From: Abner Chang <abner.chang@amd.com>
Add maintainer and reviewer of ManageabilityPkg.
Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Abdul Lateef Attar <abdattar@amd.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Isaac Oram <isaac.w.oram@intel.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Nickle Wang <nicklew@nvidia.com>
---
Maintainers.txt | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/Maintainers.txt b/Maintainers.txt
index 7471913660..8279a8ac5d 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -164,6 +164,13 @@ F: Features/Intel/UserInterface/
M: Dandan Bi <dandan.bi@intel.com>
R: Liming Gao <gaoliming@byosoft.com.cn>
+Features/ManageabilityPkg
+F: Features/ManageabilityPkg/
+M: Abner Chang <abner.chang@amd.com>
+M: Isaac Oram <isaac.w.oram@intel.com>
+R: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
+R: Nickle Wang <nicklew@nvidia.com>
+
Platform/Intel
F: Platform/Intel/
M: Sai Chaganty <rangasai.v.chaganty@intel.com>
@@ -326,10 +333,10 @@ R: Yuwei Chen <yuwei.chen@intel.com>
Loongson platforms
F: Platform/Loongson/
-M: Bibo Mao <maobibo@loongson.cn>
+M: Bibo Mao <maobibo@loongson.cn>
M: Xianglai li <lixianglai@loongson.cn>
M: Chao Li <lichao@loongson.cn>
-
+
Marvell platforms and silicon
F: Platform/Marvell/
F: Platform/SolidRun/Armada80x0McBin/
--
2.37.1.windows.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v3 8/8] edk2-platforms: Maintainers.txt
2023-03-21 3:21 ` [PATCH v3 8/8] edk2-platforms: Maintainers.txt Chang, Abner
@ 2023-03-21 11:50 ` Leif Lindholm
2023-03-21 15:45 ` Chang, Abner
0 siblings, 1 reply; 11+ messages in thread
From: Leif Lindholm @ 2023-03-21 11:50 UTC (permalink / raw)
To: abner.chang
Cc: devel, Abdul Lateef Attar, Michael D Kinney, Liming Gao,
Isaac Oram, Nickle Wang
On Tue, Mar 21, 2023 at 11:21:47 +0800, abner.chang@amd.com wrote:
> From: Abner Chang <abner.chang@amd.com>
>
> Add maintainer and reviewer of ManageabilityPkg.
>
> Signed-off-by: Abner Chang <abner.chang@amd.com>
> Cc: Abdul Lateef Attar <abdattar@amd.com>
> Cc: Leif Lindholm <quic_llindhol@quicinc.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Isaac Oram <isaac.w.oram@intel.com>
> Cc: Nickle Wang <nicklew@nvidia.com>
> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
> Reviewed-by: Nickle Wang <nicklew@nvidia.com>
> ---
> Maintainers.txt | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/Maintainers.txt b/Maintainers.txt
> index 7471913660..8279a8ac5d 100644
> --- a/Maintainers.txt
> +++ b/Maintainers.txt
> @@ -164,6 +164,13 @@ F: Features/Intel/UserInterface/
> M: Dandan Bi <dandan.bi@intel.com>
> R: Liming Gao <gaoliming@byosoft.com.cn>
>
> +Features/ManageabilityPkg
> +F: Features/ManageabilityPkg/
> +M: Abner Chang <abner.chang@amd.com>
> +M: Isaac Oram <isaac.w.oram@intel.com>
> +R: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
> +R: Nickle Wang <nicklew@nvidia.com>
> +
> Platform/Intel
> F: Platform/Intel/
> M: Sai Chaganty <rangasai.v.chaganty@intel.com>
> @@ -326,10 +333,10 @@ R: Yuwei Chen <yuwei.chen@intel.com>
>
> Loongson platforms
> F: Platform/Loongson/
> -M: Bibo Mao <maobibo@loongson.cn>
> +M: Bibo Mao <maobibo@loongson.cn>
> M: Xianglai li <lixianglai@loongson.cn>
> M: Chao Li <lichao@loongson.cn>
> -
> +
Why is the Loongson platform entry being modified?
/
Leif
> Marvell platforms and silicon
> F: Platform/Marvell/
> F: Platform/SolidRun/Armada80x0McBin/
> --
> 2.37.1.windows.1
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3 8/8] edk2-platforms: Maintainers.txt
2023-03-21 11:50 ` Leif Lindholm
@ 2023-03-21 15:45 ` Chang, Abner
0 siblings, 0 replies; 11+ messages in thread
From: Chang, Abner @ 2023-03-21 15:45 UTC (permalink / raw)
To: Leif Lindholm
Cc: devel@edk2.groups.io, Attar, AbdulLateef (Abdul Lateef),
Michael D Kinney, Liming Gao, Isaac Oram, Nickle Wang
[AMD Official Use Only - General]
> -----Original Message-----
> From: Leif Lindholm <quic_llindhol@quicinc.com>
> Sent: Tuesday, March 21, 2023 7:50 PM
> To: Chang, Abner <Abner.Chang@amd.com>
> Cc: devel@edk2.groups.io; Attar, AbdulLateef (Abdul Lateef)
> <AbdulLateef.Attar@amd.com>; Michael D Kinney
> <michael.d.kinney@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>;
> Isaac Oram <isaac.w.oram@intel.com>; Nickle Wang <nicklew@nvidia.com>
> Subject: Re: [PATCH v3 8/8] edk2-platforms: Maintainers.txt
>
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
>
>
> On Tue, Mar 21, 2023 at 11:21:47 +0800, abner.chang@amd.com wrote:
> > From: Abner Chang <abner.chang@amd.com>
> >
> > Add maintainer and reviewer of ManageabilityPkg.
> >
> > Signed-off-by: Abner Chang <abner.chang@amd.com>
> > Cc: Abdul Lateef Attar <abdattar@amd.com>
> > Cc: Leif Lindholm <quic_llindhol@quicinc.com>
> > Cc: Michael D Kinney <michael.d.kinney@intel.com>
> > Cc: Liming Gao <gaoliming@byosoft.com.cn>
> > Cc: Isaac Oram <isaac.w.oram@intel.com>
> > Cc: Nickle Wang <nicklew@nvidia.com>
> > Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
> > Reviewed-by: Nickle Wang <nicklew@nvidia.com>
> > ---
> > Maintainers.txt | 11 +++++++++--
> > 1 file changed, 9 insertions(+), 2 deletions(-)
> >
> > diff --git a/Maintainers.txt b/Maintainers.txt index
> > 7471913660..8279a8ac5d 100644
> > --- a/Maintainers.txt
> > +++ b/Maintainers.txt
> > @@ -164,6 +164,13 @@ F: Features/Intel/UserInterface/
> > M: Dandan Bi <dandan.bi@intel.com>
> > R: Liming Gao <gaoliming@byosoft.com.cn>
> >
> > +Features/ManageabilityPkg
> > +F: Features/ManageabilityPkg/
> > +M: Abner Chang <abner.chang@amd.com>
> > +M: Isaac Oram <isaac.w.oram@intel.com>
> > +R: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
> > +R: Nickle Wang <nicklew@nvidia.com>
> > +
> > Platform/Intel
> > F: Platform/Intel/
> > M: Sai Chaganty <rangasai.v.chaganty@intel.com> @@ -326,10 +333,10
> @@
> > R: Yuwei Chen <yuwei.chen@intel.com>
> >
> > Loongson platforms
> > F: Platform/Loongson/
> > -M: Bibo Mao <maobibo@loongson.cn>
> > +M: Bibo Mao <maobibo@loongson.cn>
> > M: Xianglai li <lixianglai@loongson.cn>
> > M: Chao Li <lichao@loongson.cn>
> > -
> > +
>
> Why is the Loongson platform entry being modified?
Hi Leif,
There are white spaces and were removed by editor, and I didn’t aware of it 😊. I will revert it and leave it there.
Thanks
Abner
>
> /
> Leif
>
> > Marvell platforms and silicon
> > F: Platform/Marvell/
> > F: Platform/SolidRun/Armada80x0McBin/
> > --
> > 2.37.1.windows.1
> >
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [edk2-devel] [PATCH v3 3/8] ManageabilityPkg: Add NULL ManageabilityTransportLib
2023-03-21 3:21 [PATCH v3 3/8] ManageabilityPkg: Add NULL ManageabilityTransportLib Chang, Abner
` (4 preceding siblings ...)
2023-03-21 3:21 ` [PATCH v3 8/8] edk2-platforms: Maintainers.txt Chang, Abner
@ 2023-03-21 12:06 ` Leif Lindholm
2023-03-21 15:53 ` Chang, Abner
5 siblings, 1 reply; 11+ messages in thread
From: Leif Lindholm @ 2023-03-21 12:06 UTC (permalink / raw)
To: devel, abner.chang
Cc: Liming Gao, Isaac Oram, Nate DeSimone, Nickle Wang,
Igor Kulchytskyy, Abdul Lateef Attar
On Tue, Mar 21, 2023 at 11:21:42 +0800, Chang, Abner via groups.io wrote:
> From: Abner Chang <abner.chang@amd.com>
>
> The NULL instance of ManageabilityTransportLib
> library.
>
> Signed-off-by: Abner Chang <abner.chang@amd.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Isaac Oram <isaac.w.oram@intel.com>
> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> Cc: Nickle Wang <nicklew@nvidia.com>
> Cc: Igor Kulchytskyy <igork@ami.com>
> Cc: Abdul Lateef Attar <abdattar@amd.com>
> Reviewed-by: Nickle Wang <nicklew@nvidia.com>
> ---
> .../ManageabilityPkg/ManageabilityPkg.dec | 9 +
> .../ManageabilityPkg/ManageabilityPkg.dsc | 4 +-
> .../BaseManageabilityTransportNull.inf | 28 ++
> .../Library/ManageabilityTransportIpmiLib.h | 24 ++
> .../Library/ManageabilityTransportLib.h | 336 ++++++++++++++++++
> .../BaseManageabilityTransportNull.c | 64 ++++
> .../BaseManageabilityTransportNull.uni | 13 +
> 7 files changed, 477 insertions(+), 1 deletion(-)
> create mode 100644 Features/ManageabilityPkg/Library/BaseManageabilityTransportNullLib/BaseManageabilityTransportNull.inf
> create mode 100644 Features/ManageabilityPkg/Include/Library/ManageabilityTransportIpmiLib.h
> create mode 100644 Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h
> create mode 100644 Features/ManageabilityPkg/Library/BaseManageabilityTransportNullLib/BaseManageabilityTransportNull.c
> create mode 100644 Features/ManageabilityPkg/Library/BaseManageabilityTransportNullLib/BaseManageabilityTransportNull.uni
>
> diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dec b/Features/ManageabilityPkg/ManageabilityPkg.dec
> index 8a0e28f50b..ebf6e6315e 100644
> --- a/Features/ManageabilityPkg/ManageabilityPkg.dec
> +++ b/Features/ManageabilityPkg/ManageabilityPkg.dec
> @@ -16,3 +16,12 @@
>
> [Includes]
> Include
> +
> +[LibraryClasses]
> + ## @libraryclass Manageability Transport Library
> + # Manageability Transport Library definitions
> + ManageabilityTransportLib|Include/Library/ManageabilityTransportLib.h
> +
> +[Guids]
> + gManageabilityPkgTokenSpaceGuid = { 0xBDEFFF48, 0x1C31, 0x49CD, { 0xA7, 0x6D, 0x92, 0x9E, 0x60, 0xDB, 0xB9, 0xF8 } }
> +
> diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dsc b/Features/ManageabilityPkg/ManageabilityPkg.dsc
> index 46cc215a0f..0dd0ab41fc 100644
> --- a/Features/ManageabilityPkg/ManageabilityPkg.dsc
> +++ b/Features/ManageabilityPkg/ManageabilityPkg.dsc
> @@ -36,5 +36,7 @@
> !include MinPlatformPkg/Include/Dsc/CorePeiLib.dsc
> !include MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc
>
> -!include Include/Dsc/Manageability.dsc
> +[LibraryClasses]
> + ManageabilityTransportLib|ManageabilityPkg/Library/BaseManageabilityTransportNullLib/BaseManageabilityTransportNull.inf
>
> +!include Include/Dsc/Manageability.dsc
If we want the include only after the [LibraryClasses] section header,
we should add the header in the preceding patch to avoid making this
hunk confusing.
If not, we shouldn't move it there as part of this patch.
/
Leif
> diff --git a/Features/ManageabilityPkg/Library/BaseManageabilityTransportNullLib/BaseManageabilityTransportNull.inf b/Features/ManageabilityPkg/Library/BaseManageabilityTransportNullLib/BaseManageabilityTransportNull.inf
> new file mode 100644
> index 0000000000..3cb97afb8b
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Library/BaseManageabilityTransportNullLib/BaseManageabilityTransportNull.inf
> @@ -0,0 +1,28 @@
> +## @file
> +# Null instance of Manageability Transport Library
> +#
> +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +##
> +
> +[Defines]
> + INF_VERSION = 0x0001001B
> + BASE_NAME = BaseManageabilityTransportNull
> + MODULE_UNI_FILE = BaseManageabilityTransportNull.uni
> + FILE_GUID = B63DC070-FB44-44F3-8E9A-DA6CC712EF4F
> + MODULE_TYPE = BASE
> + VERSION_STRING = 1.0
> + LIBRARY_CLASS = ManageabilityTransportLib
> +
> +#
> +# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64
> +#
> +
> +[Sources]
> + BaseManageabilityTransportNull.c
> +
> +[Packages]
> + ManageabilityPkg/ManageabilityPkg.dec
> + MdePkg/MdePkg.dec
> +
> diff --git a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportIpmiLib.h b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportIpmiLib.h
> new file mode 100644
> index 0000000000..7ca6acf6ef
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportIpmiLib.h
> @@ -0,0 +1,24 @@
> +/** @file
> +
> + This file defines the manageability IPMI protocol specific transport data.
> +
> + Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +**/
> +
> +#ifndef MANAGEABILITY_TRANSPORT_IPMI_LIB_H_
> +#define MANAGEABILITY_TRANSPORT_IPMI_LIB_H_
> +
> +#include <Library/ManageabilityTransportLib.h>
> +
> +///
> +/// The IPMI command header which is apart from
> +/// the payload.
> +///
> +typedef struct {
> + UINT8 NetFn;
> + UINT8 Lun;
> + UINT8 Command;
> +} MANAGEABILITY_IPMI_TRANSPORT_HEADER;
> +
> +#endif
> diff --git a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h
> new file mode 100644
> index 0000000000..c022b4ac5c
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h
> @@ -0,0 +1,336 @@
> +/** @file
> +
> + This file defines the manageability transport interface library and functions.
> +
> + Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +**/
> +
> +#ifndef MANAGEABILITY_TRANSPORT_LIB_H_
> +#define MANAGEABILITY_TRANSPORT_LIB_H_
> +
> +#define MANAGEABILITY_TRANSPORT_TOKEN_VERSION_MAJOR 1
> +#define MANAGEABILITY_TRANSPORT_TOKEN_VERSION_MINOR 0
> +#define MANAGEABILITY_TRANSPORT_TOKEN_VERSION ((MANAGEABILITY_TRANSPORT_TOKEN_VERSION_MAJOR << 8) |\
> + MANAGEABILITY_TRANSPORT_TOKEN_VERSION_MINOR)
> +
> +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;
> +typedef struct _MANAGEABILITY_TRANSFER_TOKEN MANAGEABILITY_TRANSFER_TOKEN;
> +
> +///
> +/// Optional transport header and trailer required
> +/// for the transport interface.
> +///
> +typedef VOID *MANAGEABILITY_TRANSPORT_HEADER;
> +typedef VOID *MANAGEABILITY_TRANSPORT_TRAILER;
> +
> +///
> +/// The transport interface specific hardware information.
> +///
> +
> +typedef union {
> + UINT16 IoAddress16;
> + UINT32 IoAddress32;
> +} MANAGEABILITY_TRANSPORT_HARDWARE_IO;
> +
> +///
> +/// Manageability KCS protocol interface hardware information.
> +///
> +typedef struct {
> + BOOLEAN MemoryMap;
> + MANAGEABILITY_TRANSPORT_HARDWARE_IO IoBaseAddress;
> + MANAGEABILITY_TRANSPORT_HARDWARE_IO IoDataInAddress;
> + MANAGEABILITY_TRANSPORT_HARDWARE_IO IoDataOutAddress;
> + MANAGEABILITY_TRANSPORT_HARDWARE_IO IoCommandAddress;
> + MANAGEABILITY_TRANSPORT_HARDWARE_IO IoStatusAddress;
> +} MANAGEABILITY_TRANSPORT_KCS_HARDWARE_INFO;
> +#define MANAGEABILITY_TRANSPORT_KCS_IO_MAP_IO FALSE
> +#define MANAGEABILITY_TRANSPORT_KCS_MEMORY_MAP_IO TRUE
> +
> +typedef union {
> + VOID *Pointer;
> + MANAGEABILITY_TRANSPORT_KCS_HARDWARE_INFO *Kcs;
> +} MANAGEABILITY_TRANSPORT_HARDWARE_INFORMATION;
> +
> +///
> +/// Additional transport interface status.
> +///
> +typedef UINT32 MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS;
> +#define MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS_NO_ERRORS 0x00000000
> +#define MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS_ERROR 0x00000001
> +#define MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS_BUSY_IN_READ 0x00000002
> +#define MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS_BUSY_IN_WRITE 0x00000004
> +#define MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS_NOT_AVAILABLE 0xffffffff
> +
> +///
> +/// Additional transport interface features.
> +///
> +typedef UINT32 MANAGEABILITY_TRANSPORT_CAPABILITY;
> +#define MANAGEABILITY_TRANSPORT_CAPABILITY_MULTIPLE_TRANSFER_TOKENS 0x00000001
> +#define MANAGEABILITY_TRANSPORT_CAPABILITY_ASYNCHRONOUS_TRANSFER 0x00000002
> +
> +///
> +/// Definitions of Manageability transport interface functions.
> +/// This is a union that can accommodate the new functions
> +/// introduced to the Manageability transport library in the future.
> +/// The new added function must has its own MANAGEABILITY_TRANSPORT_FUNCTION
> +/// structure with the incremental version number.
> +/// e.g., MANAGEABILITY_TRANSPORT_FUNCTION_V1_1.
> +///
> +/// The new function must be added base on the last version of
> +/// MANAGEABILITY_TRANSPORT_FUNCTION to keep the backward compatability.
> +///
> +typedef union {
> + MANAGEABILITY_TRANSPORT_FUNCTION_V1_0 *Version1_0;
> +} MANAGEABILITY_TRANSPORT_FUNCTION;
> +
> +///
> +/// Manageability specification GUID/Name table structure
> +///
> +typedef struct {
> + EFI_GUID *SpecificationGuid;
> + CHAR16 *SpecificationName;
> +} MANAGEABILITY_SPECIFICATION_NAME;
> +
> +///
> +/// Definitions of Transmit/Receive package
> +///
> +typedef struct {
> + UINT8 *TransmitPayload;
> + UINT32 TransmitSizeInByte;
> + UINT32 TransmitTimeoutInMillisecond;
> +} MANAGEABILITY_TRANSMIT_PACKAGE;
> +
> +typedef struct {
> + UINT8 *ReceiveBuffer;
> + UINT32 ReceiveSizeInByte;
> + UINT32 TransmitTimeoutInMillisecond;
> +} MANAGEABILITY_RECEIVE_PACKAGE;
> +
> +///
> +/// Definitions of Manageability transport interface.
> +///
> +struct _MANAGEABILITY_TRANSPORT {
> + EFI_GUID *ManageabilityTransportSpecification; ///< The Manageability Transport Interface spec.
> + UINT16 TransportVersion; ///< The version of transport interface
> + ///< function that indicates which version
> + ///< of MANAGEABILITY_TRANSPORT_FUNCTION
> + ///< is unsupported by this library.
> + CHAR16 *TransportName; ///< Human readable string of
> + ///< this transport interface.
> + MANAGEABILITY_TRANSPORT_FUNCTION Function; ///< Transport functions
> +};
> +
> +///
> +/// Definitions of Manageability transport token.
> +///
> +struct _MANAGEABILITY_TRANSPORT_TOKEN {
> + EFI_GUID *ManageabilityProtocolSpecification; ///< The Manageability Protocol spec.
> + MANAGEABILITY_TRANSPORT *Transport;
> +};
> +
> +#define MANAGEABILITY_TRANSPORT_NO_TIMEOUT 0
> +
> +///
> +/// The Manageability transport receive token used to receive
> +/// the response from transport interface after transmitting the
> +/// request.
> +///
> +struct _MANAGEABILITY_TRANSFER_TOKEN {
> + EFI_EVENT ReceiveEvent; ///< The EFI event is created to
> + ///< wait the signal for the readiness
> + ///< of response data.
> + ///< If NULL, transport library should
> + ///< just return the response data in
> + ///< ReceiveBuffer then the process returns
> + ///< to caller. Otherwise the transport
> + ///< library can signal event when the
> + ///< response is ready for caller. That
> + ///< means the transport library can
> + ///< optionally implement the asynchronous
> + ///< transfer mechanism or when the multiple
> + ///< transport sessions are acquired.
> + MANAGEABILITY_TRANSPORT_HEADER TransmitHeader; ///< This is the transport-specific header
> + ///< which is sent discretely of payload.
> + ///< This field can be NULL if the transport
> + ///< doesn't require this.
> + 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.
> + MANAGEABILITY_TRANSMIT_PACKAGE TransmitPackage; ///< The payload sent to transport interface.
> + MANAGEABILITY_RECEIVE_PACKAGE ReceivePackage; ///< The buffer to receive the response.
> + EFI_STATUS TransferStatus; ///< The EFI Status of the transfer.
> + MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS TransportAdditionalStatus; ///< The additional status of transport
> + ///< interface.
> +};
> +
> +/**
> + This function acquires to create a transport session to transmit manageability
> + packet. A transport token is returned to caller for the follow up operations.
> +
> + @param [in] ManageabilityProtocolSpec The protocol spec the transport interface is acquired for.
> + @param [out] TransportToken The pointer to receive the transport token created by
> + the target transport interface library.
> + @retval EFI_SUCCESS Token is created successfully.
> + @retval EFI_OUT_OF_RESOURCES Out of resource to create a new transport session.
> + @retval EFI_UNSUPPORTED Protocol is not supported on this transport interface.
> + @retval Otherwise Other errors.
> +
> +**/
> +EFI_STATUS
> +AcquireTransportSession (
> + IN EFI_GUID *ManageabilityProtocolSpec,
> + OUT MANAGEABILITY_TRANSPORT_TOKEN **TransportToken
> + );
> +
> +/**
> + This function returns the transport capabilities.
> +
> + @param [out] TransportFeature Pointer to receive transport capabilities.
> + See the definitions of
> + MANAGEABILITY_TRANSPORT_CAPABILITY.
> +
> +**/
> +VOID
> +GetTransportCapability (
> + OUT MANAGEABILITY_TRANSPORT_CAPABILITY *TransportCapability
> + );
> +
> +/**
> + This function releases the manageability transport session.
> +
> + @param [in] TransportToken The transport token acquired through
> + AcquireTransportSession.
> + @retval EFI_SUCCESS Token is released successfully.
> + @retval EFI_INVALID_PARAMETER Invalid TransportToken.
> + @retval Otherwise Other errors.
> +
> +**/
> +EFI_STATUS
> +ReleaseTransportSession (
> + IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken
> + );
> +
> +/**
> + This function initializes the transport interface.
> +
> + @param [in] TransportToken The transport token acquired through
> + AcquireTransportSession function.
> + @param [in] HardwareInfo This is the optional hardware information
> + assigned to this transport interface.
> +
> + @retval EFI_SUCCESS Transport interface is initialized
> + successfully.
> + @retval EFI_INVALID_PARAMETER The invalid transport token.
> + @retval EFI_NOT_READY The transport interface works fine but
> + @retval is not ready.
> + @retval EFI_DEVICE_ERROR The transport interface has problems.
> + @retval EFI_ALREADY_STARTED Teh protocol interface has already initialized.
> + @retval Otherwise Other errors.
> +
> +**/
> +typedef
> +EFI_STATUS
> +(EFIAPI *MANAGEABILITY_TRANSPORT_INIT)(
> + IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken,
> + IN MANAGEABILITY_TRANSPORT_HARDWARE_INFORMATION HardwareInfo OPTIONAL
> + );
> +
> +/**
> + This function returns the transport interface status.
> + The generic EFI_STATUS is returned to caller directly, The additional
> + information of transport interface could be optionally returned in
> + TransportAdditionalStatus to describes the status that can't be
> + described obviously through EFI_STATUS.
> + See the definition of MANAGEABILITY_TRANSPORT_STATUS.
> +
> + @param [in] TransportToken The transport token acquired through
> + AcquireTransportSession function.
> + @param [out] TransportAdditionalStatus The additional status of transport
> + interface.
> + NULL means no additional status of this
> + transport interface.
> +
> + @retval EFI_SUCCESS Transport interface status is returned.
> + @retval EFI_INVALID_PARAMETER The invalid transport token.
> + @retval EFI_DEVICE_ERROR The transport interface has problems to return
> + @retval status.
> + Otherwise Other errors.
> +
> +**/
> +typedef
> +EFI_STATUS
> +(EFIAPI *MANAGEABILITY_TRANSPORT_STATUS)(
> + IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken,
> + OUT MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS *TransportAdditionalStatus OPTIONAL
> + );
> +
> +/**
> + This function resets the transport interface.
> + The generic EFI_STATUS is returned to caller directly after reseting transport
> + interface. The additional information of transport interface could be optionally
> + returned in TransportAdditionalStatus to describes the status that can't be
> + described obviously through EFI_STATUS.
> + See the definition of MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS.
> +
> + @param [in] TransportToken The transport token acquired through
> + AcquireTransportSession function.
> + @param [out] TransportAdditionalStatus The additional status of specific transport
> + interface after the reset.
> + NULL means no additional status of this
> + transport interface.
> +
> + @retval EFI_SUCCESS Transport interface status is returned.
> + @retval EFI_INVALID_PARAMETER The invalid transport token.
> + @retval EFI_TIMEOUT The reset process is time out.
> + @retval EFI_DEVICE_ERROR The transport interface has problems to return
> + status.
> + Otherwise Other errors.
> +
> +**/
> +typedef
> +EFI_STATUS
> +(EFIAPI *MANAGEABILITY_TRANSPORT_RESET)(
> + IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken,
> + OUT MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS *TransportAdditionalStatus OPTIONAL
> + );
> +
> +/**
> + This function transmit the request over target transport interface.
> + The generic EFI_STATUS is returned to caller directly after reseting transport
> + interface. The additional information of transport interface could be optionally
> + returned in TransportAdditionalStatus to describes the status that can't be
> + described obviously through EFI_STATUS.
> + See the definition of MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS.
> +
> + @param [in] TransportToken The transport token acquired through
> + AcquireTransportSession function.
> + @param [in] TransferToken The transfer token, see the definition of
> + MANAGEABILITY_TRANSFER_TOKEN.
> +
> + @retval The EFI status is returned in MANAGEABILITY_TRANSFER_TOKEN.
> +
> +**/
> +typedef
> +VOID
> +(EFIAPI *MANAGEABILITY_TRANSPORT_TRANSMIT_RECEIVE)(
> + IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken,
> + IN MANAGEABILITY_TRANSFER_TOKEN *TransferToken
> + );
> +
> +///
> +/// The first version of Manageability transport interface function.
> +///
> +struct _MANAGEABILITY_TRANSPORT_FUNCTION_V1_0 {
> + MANAGEABILITY_TRANSPORT_INIT TransportInit; ///< Initial the transport.
> + MANAGEABILITY_TRANSPORT_STATUS TransportStatus; ///< Get the transport status.
> + MANAGEABILITY_TRANSPORT_RESET TransportReset; ///< Reset the transport.
> + MANAGEABILITY_TRANSPORT_TRANSMIT_RECEIVE TransportTransmitReceive; ///< Transmit the packet over
> + ///< transport and get the
> + ///< response back.
> +};
> +
> +#endif
> diff --git a/Features/ManageabilityPkg/Library/BaseManageabilityTransportNullLib/BaseManageabilityTransportNull.c b/Features/ManageabilityPkg/Library/BaseManageabilityTransportNullLib/BaseManageabilityTransportNull.c
> new file mode 100644
> index 0000000000..49fc8c0f71
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Library/BaseManageabilityTransportNullLib/BaseManageabilityTransportNull.c
> @@ -0,0 +1,64 @@
> +/** @file
> + Null instance of Manageability Transport Library
> +
> + Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +**/
> +
> +#include <Uefi.h>
> +#include <Library/ManageabilityTransportLib.h>
> +
> +/**
> + This function acquires to create a transport session to transmit manageability
> + packet. A transport token is returned to caller for the follow up operations.
> +
> + @param [in] ManageabilityProtocolSpec The protocol spec the transport interface is acquired.
> + @param [out] TransportToken The pointer to receive the transport token created by
> + the target transport interface library.
> + @retval EFI_SUCCESS Token is created successfully.
> + @retval EFI_OUT_OF_RESOURCES Out of resource to create a new transport session.
> + @retval EFI_UNSUPPORTED Protocol is not supported on this transport interface.
> + @retval Otherwise Other errors.
> +
> +**/
> +EFI_STATUS
> +AcquireTransportSession (
> + IN EFI_GUID *ManageabilityProtocolSpec,
> + OUT MANAGEABILITY_TRANSPORT_TOKEN **TransportToken
> + )
> +{
> + return EFI_UNSUPPORTED;
> +}
> +
> +/**
> + This function returns the transport capabilities.
> +
> + @param [out] TransportFeature Pointer to receive transport capabilities.
> + See the definitions of
> + MANAGEABILITY_TRANSPORT_CAPABILITY.
> +
> +**/
> +VOID
> +GetTransportCapability (
> + OUT MANAGEABILITY_TRANSPORT_CAPABILITY *TransportCapability
> + )
> +{
> + *TransportCapability = 0;
> +}
> +
> +/**
> + This function releases the manageability session.
> +
> + @param [in] TransportToken The transport token acquired through
> + AcquireTransportSession.
> + @retval EFI_SUCCESS Token is released successfully.
> + Otherwise Other errors.
> +
> +**/
> +EFI_STATUS
> +ReleaseTransportSession (
> + IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken
> + )
> +{
> + return EFI_SUCCESS;
> +}
> diff --git a/Features/ManageabilityPkg/Library/BaseManageabilityTransportNullLib/BaseManageabilityTransportNull.uni b/Features/ManageabilityPkg/Library/BaseManageabilityTransportNullLib/BaseManageabilityTransportNull.uni
> new file mode 100644
> index 0000000000..2211037072
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Library/BaseManageabilityTransportNullLib/BaseManageabilityTransportNull.uni
> @@ -0,0 +1,13 @@
> +// /** @file
> +// Null instance of Manageability Transport Library
> +//
> +// Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
> +//
> +// SPDX-License-Identifier: BSD-2-Clause-Patent
> +//
> +// **/
> +
> +#string STR_MODULE_ABSTRACT #language en-US "Null instance of Manageability Transport Library"
> +
> +#string STR_MODULE_DESCRIPTION #language en-US "Manageability Transport library implementation for build ManageabilityPkg only."
> +
> --
> 2.37.1.windows.1
>
>
>
>
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [edk2-devel] [PATCH v3 3/8] ManageabilityPkg: Add NULL ManageabilityTransportLib
2023-03-21 12:06 ` [edk2-devel] [PATCH v3 3/8] ManageabilityPkg: Add NULL ManageabilityTransportLib Leif Lindholm
@ 2023-03-21 15:53 ` Chang, Abner
0 siblings, 0 replies; 11+ messages in thread
From: Chang, Abner @ 2023-03-21 15:53 UTC (permalink / raw)
To: Leif Lindholm, devel@edk2.groups.io
Cc: Liming Gao, Isaac Oram, Nate DeSimone, Nickle Wang,
Igor Kulchytskyy, Attar, AbdulLateef (Abdul Lateef)
[AMD Official Use Only - General]
> -----Original Message-----
> From: Leif Lindholm <quic_llindhol@quicinc.com>
> Sent: Tuesday, March 21, 2023 8:07 PM
> To: devel@edk2.groups.io; Chang, Abner <Abner.Chang@amd.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>; Isaac Oram
> <isaac.w.oram@intel.com>; Nate DeSimone
> <nathaniel.l.desimone@intel.com>; Nickle Wang <nicklew@nvidia.com>;
> Igor Kulchytskyy <igork@ami.com>; Attar, AbdulLateef (Abdul Lateef)
> <AbdulLateef.Attar@amd.com>
> Subject: Re: [edk2-devel] [PATCH v3 3/8] ManageabilityPkg: Add NULL
> ManageabilityTransportLib
>
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
>
>
> On Tue, Mar 21, 2023 at 11:21:42 +0800, Chang, Abner via groups.io wrote:
> > From: Abner Chang <abner.chang@amd.com>
> >
> > The NULL instance of ManageabilityTransportLib library.
> >
> > Signed-off-by: Abner Chang <abner.chang@amd.com>
> > Cc: Liming Gao <gaoliming@byosoft.com.cn>
> > Cc: Isaac Oram <isaac.w.oram@intel.com>
> > Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> > Cc: Nickle Wang <nicklew@nvidia.com>
> > Cc: Igor Kulchytskyy <igork@ami.com>
> > Cc: Abdul Lateef Attar <abdattar@amd.com>
> > Reviewed-by: Nickle Wang <nicklew@nvidia.com>
> > ---
> > .../ManageabilityPkg/ManageabilityPkg.dec | 9 +
> > .../ManageabilityPkg/ManageabilityPkg.dsc | 4 +-
> > .../BaseManageabilityTransportNull.inf | 28 ++
> > .../Library/ManageabilityTransportIpmiLib.h | 24 ++
> > .../Library/ManageabilityTransportLib.h | 336 ++++++++++++++++++
> > .../BaseManageabilityTransportNull.c | 64 ++++
> > .../BaseManageabilityTransportNull.uni | 13 +
> > 7 files changed, 477 insertions(+), 1 deletion(-) create mode 100644
> > Features/ManageabilityPkg/Library/BaseManageabilityTransportNullLib/Ba
> > seManageabilityTransportNull.inf create mode 100644
> > Features/ManageabilityPkg/Include/Library/ManageabilityTransportIpmiLi
> > b.h create mode 100644
> > Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h
> > create mode 100644
> > Features/ManageabilityPkg/Library/BaseManageabilityTransportNullLib/Ba
> > seManageabilityTransportNull.c create mode 100644
> > Features/ManageabilityPkg/Library/BaseManageabilityTransportNullLib/Ba
> > seManageabilityTransportNull.uni
> >
> > diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dec
> > b/Features/ManageabilityPkg/ManageabilityPkg.dec
> > index 8a0e28f50b..ebf6e6315e 100644
> > --- a/Features/ManageabilityPkg/ManageabilityPkg.dec
> > +++ b/Features/ManageabilityPkg/ManageabilityPkg.dec
> > @@ -16,3 +16,12 @@
> >
> > [Includes]
> > Include
> > +
> > +[LibraryClasses]
> > + ## @libraryclass Manageability Transport Library
> > + # Manageability Transport Library definitions
> > +
> > +ManageabilityTransportLib|Include/Library/ManageabilityTransportLib.h
> > +
> > +[Guids]
> > + gManageabilityPkgTokenSpaceGuid = { 0xBDEFFF48, 0x1C31, 0x49CD, {
> > +0xA7, 0x6D, 0x92, 0x9E, 0x60, 0xDB, 0xB9, 0xF8 } }
> > +
> > diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dsc
> > b/Features/ManageabilityPkg/ManageabilityPkg.dsc
> > index 46cc215a0f..0dd0ab41fc 100644
> > --- a/Features/ManageabilityPkg/ManageabilityPkg.dsc
> > +++ b/Features/ManageabilityPkg/ManageabilityPkg.dsc
> > @@ -36,5 +36,7 @@
> > !include MinPlatformPkg/Include/Dsc/CorePeiLib.dsc
> > !include MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc
> >
> > -!include Include/Dsc/Manageability.dsc
> > +[LibraryClasses]
> > +
> >
> +ManageabilityTransportLib|ManageabilityPkg/Library/BaseManageabilityT
> > +ransportNullLib/BaseManageabilityTransportNull.inf
> >
> > +!include Include/Dsc/Manageability.dsc
>
> If we want the include only after the [LibraryClasses] section header, we
> should add the header in the preceding patch to avoid making this hunk
> confusing.
>
> If not, we shouldn't move it there as part of this patch.
Sure, I can move those two header files and dec file to a new preceding patch.
Thanks
Abner
>
> /
> Leif
>
> > diff --git
> > a/Features/ManageabilityPkg/Library/BaseManageabilityTransportNullLib/
> > BaseManageabilityTransportNull.inf
> > b/Features/ManageabilityPkg/Library/BaseManageabilityTransportNullLib/
> > BaseManageabilityTransportNull.inf
> > new file mode 100644
> > index 0000000000..3cb97afb8b
> > --- /dev/null
> > +++
> b/Features/ManageabilityPkg/Library/BaseManageabilityTransportNull
> > +++ Lib/BaseManageabilityTransportNull.inf
> > @@ -0,0 +1,28 @@
> > +## @file
> > +# Null instance of Manageability Transport Library # # Copyright (C)
> > +2023 Advanced Micro Devices, Inc. All rights reserved.<BR> #
> > +SPDX-License-Identifier: BSD-2-Clause-Patent # ##
> > +
> > +[Defines]
> > + INF_VERSION = 0x0001001B
> > + BASE_NAME = BaseManageabilityTransportNull
> > + MODULE_UNI_FILE = BaseManageabilityTransportNull.uni
> > + FILE_GUID = B63DC070-FB44-44F3-8E9A-DA6CC712EF4F
> > + MODULE_TYPE = BASE
> > + VERSION_STRING = 1.0
> > + LIBRARY_CLASS = ManageabilityTransportLib
> > +
> > +#
> > +# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64
> > +#
> > +
> > +[Sources]
> > + BaseManageabilityTransportNull.c
> > +
> > +[Packages]
> > + ManageabilityPkg/ManageabilityPkg.dec
> > + MdePkg/MdePkg.dec
> > +
> > diff --git
> > a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportIpmi
> > Lib.h
> > b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportIpmi
> > Lib.h
> > new file mode 100644
> > index 0000000000..7ca6acf6ef
> > --- /dev/null
> > +++ b/Features/ManageabilityPkg/Include/Library/ManageabilityTransport
> > +++ IpmiLib.h
> > @@ -0,0 +1,24 @@
> > +/** @file
> > +
> > + This file defines the manageability IPMI protocol specific transport data.
> > +
> > + Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
> > +reserved.<BR>
> > + SPDX-License-Identifier: BSD-2-Clause-Patent **/
> > +
> > +#ifndef MANAGEABILITY_TRANSPORT_IPMI_LIB_H_
> > +#define MANAGEABILITY_TRANSPORT_IPMI_LIB_H_
> > +
> > +#include <Library/ManageabilityTransportLib.h>
> > +
> > +///
> > +/// The IPMI command header which is apart from /// the payload.
> > +///
> > +typedef struct {
> > + UINT8 NetFn;
> > + UINT8 Lun;
> > + UINT8 Command;
> > +} MANAGEABILITY_IPMI_TRANSPORT_HEADER;
> > +
> > +#endif
> > diff --git
> > a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.
> > h
> > b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.
> > h
> > new file mode 100644
> > index 0000000000..c022b4ac5c
> > --- /dev/null
> > +++ b/Features/ManageabilityPkg/Include/Library/ManageabilityTransport
> > +++ Lib.h
> > @@ -0,0 +1,336 @@
> > +/** @file
> > +
> > + This file defines the manageability transport interface library and
> functions.
> > +
> > + Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
> > +reserved.<BR>
> > + SPDX-License-Identifier: BSD-2-Clause-Patent **/
> > +
> > +#ifndef MANAGEABILITY_TRANSPORT_LIB_H_ #define
> > +MANAGEABILITY_TRANSPORT_LIB_H_
> > +
> > +#define MANAGEABILITY_TRANSPORT_TOKEN_VERSION_MAJOR 1
> #define
> > +MANAGEABILITY_TRANSPORT_TOKEN_VERSION_MINOR 0
> > +#define MANAGEABILITY_TRANSPORT_TOKEN_VERSION
> ((MANAGEABILITY_TRANSPORT_TOKEN_VERSION_MAJOR << 8) |\
> > +
> > +MANAGEABILITY_TRANSPORT_TOKEN_VERSION_MINOR)
> > +
> > +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;
> > +typedef struct _MANAGEABILITY_TRANSFER_TOKEN
> MANAGEABILITY_TRANSFER_TOKEN;
> > +
> > +///
> > +/// Optional transport header and trailer required /// for the
> > +transport interface.
> > +///
> > +typedef VOID *MANAGEABILITY_TRANSPORT_HEADER; typedef VOID
> > +*MANAGEABILITY_TRANSPORT_TRAILER;
> > +
> > +///
> > +/// The transport interface specific hardware information.
> > +///
> > +
> > +typedef union {
> > + UINT16 IoAddress16;
> > + UINT32 IoAddress32;
> > +} MANAGEABILITY_TRANSPORT_HARDWARE_IO;
> > +
> > +///
> > +/// Manageability KCS protocol interface hardware information.
> > +///
> > +typedef struct {
> > + BOOLEAN MemoryMap;
> > + MANAGEABILITY_TRANSPORT_HARDWARE_IO IoBaseAddress;
> > + MANAGEABILITY_TRANSPORT_HARDWARE_IO IoDataInAddress;
> > + MANAGEABILITY_TRANSPORT_HARDWARE_IO IoDataOutAddress;
> > + MANAGEABILITY_TRANSPORT_HARDWARE_IO IoCommandAddress;
> > + MANAGEABILITY_TRANSPORT_HARDWARE_IO IoStatusAddress;
> > +} MANAGEABILITY_TRANSPORT_KCS_HARDWARE_INFO;
> > +#define MANAGEABILITY_TRANSPORT_KCS_IO_MAP_IO FALSE
> > +#define MANAGEABILITY_TRANSPORT_KCS_MEMORY_MAP_IO TRUE
> > +
> > +typedef union {
> > + VOID *Pointer;
> > + MANAGEABILITY_TRANSPORT_KCS_HARDWARE_INFO *Kcs;
> > +} MANAGEABILITY_TRANSPORT_HARDWARE_INFORMATION;
> > +
> > +///
> > +/// Additional transport interface status.
> > +///
> > +typedef UINT32 MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS;
> > +#define
> MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS_NO_ERRORS
> 0x00000000
> > +#define MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS_ERROR
> 0x00000001
> > +#define
> MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS_BUSY_IN_READ
> 0x00000002
> > +#define
> MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS_BUSY_IN_WRITE
> > +0x00000004 #define
> > +MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS_NOT_AVAILABLE
> 0xffffffff
> > +
> > +///
> > +/// Additional transport interface features.
> > +///
> > +typedef UINT32 MANAGEABILITY_TRANSPORT_CAPABILITY;
> > +#define
> MANAGEABILITY_TRANSPORT_CAPABILITY_MULTIPLE_TRANSFER_TOKENS
> 0x00000001
> > +#define
> MANAGEABILITY_TRANSPORT_CAPABILITY_ASYNCHRONOUS_TRANSFER
> 0x00000002
> > +
> > +///
> > +/// Definitions of Manageability transport interface functions.
> > +/// This is a union that can accommodate the new functions ///
> > +introduced to the Manageability transport library in the future.
> > +/// The new added function must has its own
> > +MANAGEABILITY_TRANSPORT_FUNCTION /// structure with the
> incremental version number.
> > +/// e.g., MANAGEABILITY_TRANSPORT_FUNCTION_V1_1.
> > +///
> > +/// The new function must be added base on the last version of ///
> > +MANAGEABILITY_TRANSPORT_FUNCTION to keep the backward
> compatability.
> > +///
> > +typedef union {
> > + MANAGEABILITY_TRANSPORT_FUNCTION_V1_0 *Version1_0;
> > +} MANAGEABILITY_TRANSPORT_FUNCTION;
> > +
> > +///
> > +/// Manageability specification GUID/Name table structure /// typedef
> > +struct {
> > + EFI_GUID *SpecificationGuid;
> > + CHAR16 *SpecificationName;
> > +} MANAGEABILITY_SPECIFICATION_NAME;
> > +
> > +///
> > +/// Definitions of Transmit/Receive package /// typedef struct {
> > + UINT8 *TransmitPayload;
> > + UINT32 TransmitSizeInByte;
> > + UINT32 TransmitTimeoutInMillisecond;
> > +} MANAGEABILITY_TRANSMIT_PACKAGE;
> > +
> > +typedef struct {
> > + UINT8 *ReceiveBuffer;
> > + UINT32 ReceiveSizeInByte;
> > + UINT32 TransmitTimeoutInMillisecond;
> > +} MANAGEABILITY_RECEIVE_PACKAGE;
> > +
> > +///
> > +/// Definitions of Manageability transport interface.
> > +///
> > +struct _MANAGEABILITY_TRANSPORT {
> > + EFI_GUID *ManageabilityTransportSpecification; ///< The
> Manageability Transport Interface spec.
> > + UINT16 TransportVersion; ///< The version of
> transport interface
> > + ///< function that indicates which
> version
> > + ///< of
> MANAGEABILITY_TRANSPORT_FUNCTION
> > + ///< is unsupported by this library.
> > + CHAR16 *TransportName; ///< Human readable
> string of
> > + ///< this transport interface.
> > + MANAGEABILITY_TRANSPORT_FUNCTION Function; ///<
> Transport functions
> > +};
> > +
> > +///
> > +/// Definitions of Manageability transport token.
> > +///
> > +struct _MANAGEABILITY_TRANSPORT_TOKEN {
> > + EFI_GUID *ManageabilityProtocolSpecification; ///< The
> Manageability Protocol spec.
> > + MANAGEABILITY_TRANSPORT *Transport;
> > +};
> > +
> > +#define MANAGEABILITY_TRANSPORT_NO_TIMEOUT 0
> > +
> > +///
> > +/// The Manageability transport receive token used to receive /// the
> > +response from transport interface after transmitting the /// request.
> > +///
> > +struct _MANAGEABILITY_TRANSFER_TOKEN {
> > + EFI_EVENT ReceiveEvent; ///< The EFI event is
> created to
> > + ///< wait the signal for the readiness
> > + ///< of response data.
> > + ///< If NULL, transport library should
> > + ///< just return the response data in
> > + ///< ReceiveBuffer then the process
> returns
> > + ///< to caller. Otherwise the
> transport
> > + ///< library can signal event when the
> > + ///< response is ready for caller. That
> > + ///< means the transport library can
> > + ///< optionally implement the
> asynchronous
> > + ///< transfer mechanism or when the
> multiple
> > + ///< transport sessions are acquired.
> > + MANAGEABILITY_TRANSPORT_HEADER TransmitHeader;
> ///< This is the transport-specific header
> > + ///< which is sent discretely of
> payload.
> > + ///< This field can be NULL if the
> transport
> > + ///< doesn't require this.
> > + 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.
> > + MANAGEABILITY_TRANSMIT_PACKAGE TransmitPackage;
> ///< The payload sent to transport interface.
> > + MANAGEABILITY_RECEIVE_PACKAGE ReceivePackage; ///<
> The buffer to receive the response.
> > + EFI_STATUS TransferStatus; ///< The EFI Status of
> the transfer.
> > + MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS
> TransportAdditionalStatus; ///< The additional status of transport
> > + ///< interface.
> > +};
> > +
> > +/**
> > + This function acquires to create a transport session to transmit
> > +manageability
> > + packet. A transport token is returned to caller for the follow up
> operations.
> > +
> > + @param [in] ManageabilityProtocolSpec The protocol spec the
> transport interface is acquired for.
> > + @param [out] TransportToken The pointer to receive the
> transport token created by
> > + the target transport interface library.
> > + @retval EFI_SUCCESS Token is created successfully.
> > + @retval EFI_OUT_OF_RESOURCES Out of resource to create a new
> transport session.
> > + @retval EFI_UNSUPPORTED Protocol is not supported on this
> transport interface.
> > + @retval Otherwise Other errors.
> > +
> > +**/
> > +EFI_STATUS
> > +AcquireTransportSession (
> > + IN EFI_GUID *ManageabilityProtocolSpec,
> > + OUT MANAGEABILITY_TRANSPORT_TOKEN **TransportToken
> > + );
> > +
> > +/**
> > + This function returns the transport capabilities.
> > +
> > + @param [out] TransportFeature Pointer to receive transport
> capabilities.
> > + See the definitions of
> > + MANAGEABILITY_TRANSPORT_CAPABILITY.
> > +
> > +**/
> > +VOID
> > +GetTransportCapability (
> > + OUT MANAGEABILITY_TRANSPORT_CAPABILITY *TransportCapability
> > + );
> > +
> > +/**
> > + This function releases the manageability transport session.
> > +
> > + @param [in] TransportToken The transport token acquired through
> > + AcquireTransportSession.
> > + @retval EFI_SUCCESS Token is released successfully.
> > + @retval EFI_INVALID_PARAMETER Invalid TransportToken.
> > + @retval Otherwise Other errors.
> > +
> > +**/
> > +EFI_STATUS
> > +ReleaseTransportSession (
> > + IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken
> > + );
> > +
> > +/**
> > + This function initializes the transport interface.
> > +
> > + @param [in] TransportToken The transport token acquired through
> > + AcquireTransportSession function.
> > + @param [in] HardwareInfo This is the optional hardware
> information
> > + assigned to this transport interface.
> > +
> > + @retval EFI_SUCCESS Transport interface is initialized
> > + successfully.
> > + @retval EFI_INVALID_PARAMETER The invalid transport token.
> > + @retval EFI_NOT_READY The transport interface works fine but
> > + @retval is not ready.
> > + @retval EFI_DEVICE_ERROR The transport interface has problems.
> > + @retval EFI_ALREADY_STARTED Teh protocol interface has already
> initialized.
> > + @retval Otherwise Other errors.
> > +
> > +**/
> > +typedef
> > +EFI_STATUS
> > +(EFIAPI *MANAGEABILITY_TRANSPORT_INIT)(
> > + IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken,
> > + IN MANAGEABILITY_TRANSPORT_HARDWARE_INFORMATION
> HardwareInfo
> > +OPTIONAL
> > + );
> > +
> > +/**
> > + This function returns the transport interface status.
> > + The generic EFI_STATUS is returned to caller directly, The
> > +additional
> > + information of transport interface could be optionally returned in
> > + TransportAdditionalStatus to describes the status that can't be
> > + described obviously through EFI_STATUS.
> > + See the definition of MANAGEABILITY_TRANSPORT_STATUS.
> > +
> > + @param [in] TransportToken The transport token acquired
> through
> > + AcquireTransportSession function.
> > + @param [out] TransportAdditionalStatus The additional status of
> transport
> > + interface.
> > + NULL means no additional status of this
> > + transport interface.
> > +
> > + @retval EFI_SUCCESS Transport interface status is returned.
> > + @retval EFI_INVALID_PARAMETER The invalid transport token.
> > + @retval EFI_DEVICE_ERROR The transport interface has problems
> to return
> > + @retval status.
> > + Otherwise Other errors.
> > +
> > +**/
> > +typedef
> > +EFI_STATUS
> > +(EFIAPI *MANAGEABILITY_TRANSPORT_STATUS)(
> > + IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken,
> > + OUT MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS
> *TransportAdditionalStatus OPTIONAL
> > + );
> > +
> > +/**
> > + This function resets the transport interface.
> > + The generic EFI_STATUS is returned to caller directly after
> > +reseting transport
> > + interface. The additional information of transport interface could
> > +be optionally
> > + returned in TransportAdditionalStatus to describes the status that
> > +can't be
> > + described obviously through EFI_STATUS.
> > + See the definition of
> MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS.
> > +
> > + @param [in] TransportToken The transport token acquired
> through
> > + AcquireTransportSession function.
> > + @param [out] TransportAdditionalStatus The additional status of
> specific transport
> > + interface after the reset.
> > + NULL means no additional status of this
> > + transport interface.
> > +
> > + @retval EFI_SUCCESS Transport interface status is returned.
> > + @retval EFI_INVALID_PARAMETER The invalid transport token.
> > + @retval EFI_TIMEOUT The reset process is time out.
> > + @retval EFI_DEVICE_ERROR The transport interface has problems
> to return
> > + status.
> > + Otherwise Other errors.
> > +
> > +**/
> > +typedef
> > +EFI_STATUS
> > +(EFIAPI *MANAGEABILITY_TRANSPORT_RESET)(
> > + IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken,
> > + OUT MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS
> > +*TransportAdditionalStatus OPTIONAL
> > + );
> > +
> > +/**
> > + This function transmit the request over target transport interface.
> > + The generic EFI_STATUS is returned to caller directly after
> > +reseting transport
> > + interface. The additional information of transport interface could
> > +be optionally
> > + returned in TransportAdditionalStatus to describes the status that
> > +can't be
> > + described obviously through EFI_STATUS.
> > + See the definition of
> MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS.
> > +
> > + @param [in] TransportToken The transport token acquired through
> > + AcquireTransportSession function.
> > + @param [in] TransferToken The transfer token, see the definition
> of
> > + MANAGEABILITY_TRANSFER_TOKEN.
> > +
> > + @retval The EFI status is returned in
> MANAGEABILITY_TRANSFER_TOKEN.
> > +
> > +**/
> > +typedef
> > +VOID
> > +(EFIAPI *MANAGEABILITY_TRANSPORT_TRANSMIT_RECEIVE)(
> > + IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken,
> > + IN MANAGEABILITY_TRANSFER_TOKEN *TransferToken
> > + );
> > +
> > +///
> > +/// The first version of Manageability transport interface function.
> > +///
> > +struct _MANAGEABILITY_TRANSPORT_FUNCTION_V1_0 {
> > + MANAGEABILITY_TRANSPORT_INIT TransportInit; ///<
> Initial the transport.
> > + MANAGEABILITY_TRANSPORT_STATUS TransportStatus; ///<
> Get the transport status.
> > + MANAGEABILITY_TRANSPORT_RESET TransportReset; ///<
> Reset the transport.
> > + MANAGEABILITY_TRANSPORT_TRANSMIT_RECEIVE
> TransportTransmitReceive; ///< Transmit the packet over
> > + ///< transport and get the
> > + ///< response back.
> > +};
> > +
> > +#endif
> > diff --git
> > a/Features/ManageabilityPkg/Library/BaseManageabilityTransportNullLib/
> > BaseManageabilityTransportNull.c
> > b/Features/ManageabilityPkg/Library/BaseManageabilityTransportNullLib/
> > BaseManageabilityTransportNull.c
> > new file mode 100644
> > index 0000000000..49fc8c0f71
> > --- /dev/null
> > +++
> b/Features/ManageabilityPkg/Library/BaseManageabilityTransportNull
> > +++ Lib/BaseManageabilityTransportNull.c
> > @@ -0,0 +1,64 @@
> > +/** @file
> > + Null instance of Manageability Transport Library
> > +
> > + Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
> > +reserved.<BR>
> > + SPDX-License-Identifier: BSD-2-Clause-Patent **/
> > +
> > +#include <Uefi.h>
> > +#include <Library/ManageabilityTransportLib.h>
> > +
> > +/**
> > + This function acquires to create a transport session to transmit
> > +manageability
> > + packet. A transport token is returned to caller for the follow up
> operations.
> > +
> > + @param [in] ManageabilityProtocolSpec The protocol spec the
> transport interface is acquired.
> > + @param [out] TransportToken The pointer to receive the
> transport token created by
> > + the target transport interface library.
> > + @retval EFI_SUCCESS Token is created successfully.
> > + @retval EFI_OUT_OF_RESOURCES Out of resource to create a new
> transport session.
> > + @retval EFI_UNSUPPORTED Protocol is not supported on this
> transport interface.
> > + @retval Otherwise Other errors.
> > +
> > +**/
> > +EFI_STATUS
> > +AcquireTransportSession (
> > + IN EFI_GUID *ManageabilityProtocolSpec,
> > + OUT MANAGEABILITY_TRANSPORT_TOKEN **TransportToken
> > + )
> > +{
> > + return EFI_UNSUPPORTED;
> > +}
> > +
> > +/**
> > + This function returns the transport capabilities.
> > +
> > + @param [out] TransportFeature Pointer to receive transport
> capabilities.
> > + See the definitions of
> > + MANAGEABILITY_TRANSPORT_CAPABILITY.
> > +
> > +**/
> > +VOID
> > +GetTransportCapability (
> > + OUT MANAGEABILITY_TRANSPORT_CAPABILITY *TransportCapability
> > + )
> > +{
> > + *TransportCapability = 0;
> > +}
> > +
> > +/**
> > + This function releases the manageability session.
> > +
> > + @param [in] TransportToken The transport token acquired through
> > + AcquireTransportSession.
> > + @retval EFI_SUCCESS Token is released successfully.
> > + Otherwise Other errors.
> > +
> > +**/
> > +EFI_STATUS
> > +ReleaseTransportSession (
> > + IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken
> > + )
> > +{
> > + return EFI_SUCCESS;
> > +}
> > diff --git
> > a/Features/ManageabilityPkg/Library/BaseManageabilityTransportNullLib/
> > BaseManageabilityTransportNull.uni
> > b/Features/ManageabilityPkg/Library/BaseManageabilityTransportNullLib/
> > BaseManageabilityTransportNull.uni
> > new file mode 100644
> > index 0000000000..2211037072
> > --- /dev/null
> > +++
> b/Features/ManageabilityPkg/Library/BaseManageabilityTransportNull
> > +++ Lib/BaseManageabilityTransportNull.uni
> > @@ -0,0 +1,13 @@
> > +// /** @file
> > +// Null instance of Manageability Transport Library // // Copyright
> > +(C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR> // //
> > +SPDX-License-Identifier: BSD-2-Clause-Patent // // **/
> > +
> > +#string STR_MODULE_ABSTRACT #language en-US "Null instance of
> Manageability Transport Library"
> > +
> > +#string STR_MODULE_DESCRIPTION #language en-US "Manageability
> Transport library implementation for build ManageabilityPkg only."
> > +
> > --
> > 2.37.1.windows.1
> >
> >
> >
> >
> >
> >
^ permalink raw reply [flat|nested] 11+ messages in thread