From 3e28a2eed033176b1d64ca19c3caba50c5732fd3 Mon Sep 17 00:00:00 2001 From: John Chung Date: Wed, 20 Nov 2024 18:56:03 -0600 Subject: [PATCH] ManageabilityPkg: Add serial protocol in IPMI driver This introduces serial protocol in IPMI driver. Signed-off-by: John Chung --- .../IpmiProtocol/Common/IpmiProtocolCommon.c | 22 ++++++++++++++++--- .../IpmiProtocol/Common/IpmiProtocolCommon.h | 8 +++++++ .../IpmiProtocol/Dxe/IpmiProtocolDxe.inf | 5 +++++ 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolCommon.c b/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolCommon.c index 1d56b89a276..bf605ea0239 100644 --- a/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolCommon.c +++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolCommon.c @@ -37,8 +37,9 @@ SetupIpmiTransportHardwareInformation ( OUT MANAGEABILITY_TRANSPORT_HARDWARE_INFORMATION *HardwareInformation ) { - MANAGEABILITY_TRANSPORT_KCS_HARDWARE_INFO *KcsHardwareInfo; - MANAGEABILITY_TRANSPORT_SSIF_HARDWARE_INFO *SsifHardwareInfo; + MANAGEABILITY_TRANSPORT_KCS_HARDWARE_INFO *KcsHardwareInfo; + MANAGEABILITY_TRANSPORT_SSIF_HARDWARE_INFO *SsifHardwareInfo; + MANAGEABILITY_TRANSPORT_SERIAL_HARDWARE_INFO *SerialHardwareInfo; if (CompareGuid (&gManageabilityTransportKcsGuid, TransportToken->Transport->ManageabilityTransportSpecification)) { // This is KCS transport interface. @@ -67,6 +68,20 @@ SetupIpmiTransportHardwareInformation ( SsifHardwareInfo->BmcSlaveAddress = IPMI_SSIF_BMC_SLAVE_ADDRESS; HardwareInformation->Ssif = SsifHardwareInfo; return EFI_SUCCESS; + } else if (CompareGuid (&gManageabilityTransportSerialGuid, TransportToken->Transport->ManageabilityTransportSpecification)) { + // This is Serial transport interface. + SerialHardwareInfo = AllocatePool (sizeof (MANAGEABILITY_TRANSPORT_SERIAL_HARDWARE_INFO)); + if (SerialHardwareInfo == NULL) { + DEBUG ((DEBUG_ERROR, "%a: Not enough memory for MANAGEABILITY_TRANSPORT_SERIAL_HARDWARE_INFO.\n", __func__)); + return EFI_OUT_OF_RESOURCES; + } + + SerialHardwareInfo->IpmiRequesterAddress = IPMI_SERIAL_REQUESTER_ADDRESS; + SerialHardwareInfo->IpmiResponderAddress = IPMI_SERIAL_RESPONDER_ADDRESS; + SerialHardwareInfo->IpmiRequesterLUN = IPMI_SERIAL_REQUESTER_LUN; + SerialHardwareInfo->IpmiResponderLUN = IPMI_SERIAL_RESPONDER_LUN; + HardwareInformation->Serial = SerialHardwareInfo; + return EFI_SUCCESS; } else { DEBUG ((DEBUG_ERROR, "%a: No implementation of setting hardware information.", __func__)); ASSERT (FALSE); @@ -117,7 +132,8 @@ SetupIpmiRequestTransportPacket ( MANAGEABILITY_IPMI_TRANSPORT_HEADER *IpmiHeader; if ( CompareGuid (&gManageabilityTransportKcsGuid, TransportToken->Transport->ManageabilityTransportSpecification) - || CompareGuid (&gManageabilityTransportSmbusI2cGuid, TransportToken->Transport->ManageabilityTransportSpecification)) + || CompareGuid (&gManageabilityTransportSmbusI2cGuid, TransportToken->Transport->ManageabilityTransportSpecification) + || CompareGuid (&gManageabilityTransportSerialGuid, TransportToken->Transport->ManageabilityTransportSpecification)) { IpmiHeader = AllocateZeroPool (sizeof (MANAGEABILITY_IPMI_TRANSPORT_HEADER)); if (IpmiHeader == NULL) { diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolCommon.h b/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolCommon.h index e1903b09175..438580e3d52 100644 --- a/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolCommon.h +++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolCommon.h @@ -27,6 +27,14 @@ /// #define IPMI_SSIF_BMC_SLAVE_ADDRESS FixedPcdGet8 (PcdIpmiSsifSmbusSlaveAddr) +/// +/// IPMI Serial hardware information. +/// +#define IPMI_SERIAL_REQUESTER_ADDRESS FixedPcdGet8 (PcdIpmiSerialRequesterAddress) +#define IPMI_SERIAL_RESPONDER_ADDRESS FixedPcdGet8 (PcdIpmiSerialResponderAddress) +#define IPMI_SERIAL_REQUESTER_LUN FixedPcdGet8 (PcdIpmiSerialRequesterLun) +#define IPMI_SERIAL_RESPONDER_LUN FixedPcdGet8 (PcdIpmiSerialResponderLun) + /** This functions setup the IPMI transport hardware information according to the specification of transport token acquired from transport library. diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocolDxe.inf b/Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocolDxe.inf index d370e2607af..34b6a306f56 100644 --- a/Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocolDxe.inf +++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocolDxe.inf @@ -44,10 +44,15 @@ gManageabilityProtocolIpmiGuid gManageabilityTransportKcsGuid gManageabilityTransportSmbusI2cGuid + gManageabilityTransportSerialGuid [FixedPcd] gEfiMdePkgTokenSpaceGuid.PcdIpmiKcsIoBaseAddress # Used as default KCS I/O base adddress gEfiMdePkgTokenSpaceGuid.PcdIpmiSsifSmbusSlaveAddr + gEfiMdePkgTokenSpaceGuid.PcdIpmiSerialRequesterAddress + gEfiMdePkgTokenSpaceGuid.PcdIpmiSerialResponderAddress + gEfiMdePkgTokenSpaceGuid.PcdIpmiSerialRequesterLun + gEfiMdePkgTokenSpaceGuid.PcdIpmiSerialResponderLun [Depex] TRUE