Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ManageabilityPkg/IpmiSmbiosTransferDxe: add support of sending SMBIOS table to BMC #187

Merged
merged 5 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Features/ManageabilityPkg/Include/Manageability.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
ManageabilityPkg/Universal/IpmiBlobTransferDxe/IpmiBlobTransferDxe.inf
!endif

!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiSmbiosTransferEnable == TRUE
ManageabilityPkg/Universal/IpmiSmbiosTransferDxe/IpmiSmbiosTransferDxe.inf
!endif

[Components.X64]
!if gManageabilityPkgTokenSpaceGuid.PcdManageabilitySmmIpmiEnable == TRUE
ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocolSmm.inf
Expand Down
5 changes: 5 additions & 0 deletions Features/ManageabilityPkg/Include/PostMemory.fdf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# volume description.
#
# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
# Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
Expand All @@ -19,6 +20,10 @@
INF ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProtocolDxe.inf
!endif

!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiSmbiosTransferEnable == TRUE
INF ManageabilityPkg/Universal/IpmiSmbiosTransferDxe/IpmiSmbiosTransferDxe.inf
!endif

!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmSmbiosTransferEnable == TRUE
INF ManageabilityPkg/Universal/PldmSmbiosTransferDxe/PldmSmbiosTransferDxe.inf
!endif
Expand Down
9 changes: 9 additions & 0 deletions Features/ManageabilityPkg/ManageabilityPkg.dec
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@
# Manageability Protocol PLDM
gManageabilityProtocolPldmGuid = { 0x3958090D, 0x69DD, 0x4868, { 0x9C, 0x41, 0xC9, 0xAC, 0x31, 0xB5, 0x25, 0xC5 } }

# Manageability variable Guid
gManageabilityVariableGuid = { 0xac4cf43f, 0x3f64, 0x416a, { 0x96, 0x1d, 0x03, 0x1b, 0x53, 0x5b, 0x91, 0x5f } }

[Protocols]
gEdkiiPldmProtocolGuid = { 0x60997616, 0xDB70, 0x4B5F, { 0x86, 0xA4, 0x09, 0x58, 0xA3, 0x71, 0x47, 0xB4 } }
gEdkiiPldmSmbiosTransferProtocolGuid = { 0xFA431C3C, 0x816B, 0x4B32, { 0xA3, 0xE0, 0xAD, 0x9B, 0x7F, 0x64, 0x27, 0x2E } }
Expand Down Expand Up @@ -104,9 +107,15 @@
gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiFrb|FALSE|BOOLEAN|0x1000000B
gManageabilityPkgTokenSpaceGuid.PcdManageabilityPeiIpmiFrb|FALSE|BOOLEAN|0x1000000C
gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiBmcAcpi|FALSE|BOOLEAN|0x1000000D
gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiSmbiosTransferEnable|FALSE|BOOLEAN|0x1000000E

[PcdsDynamic, PcdsDynamicEx]
gManageabilityPkgTokenSpaceGuid.PcdFRB2EnabledFlag|TRUE|BOOLEAN|0x20000001
## This is the timeout value in milliseconds, default set to 360 milliseconds
# @Prompt IPMI Fault Resilient Booting timeout value in milliseconds.
gManageabilityPkgTokenSpaceGuid.PcdFRBTimeoutValue|360|UINT16|0x20000002
## The BlobId of SMBIOS Blob in OpenBMC Phosphor Blob Transfer architecture
gManageabilityPkgTokenSpaceGuid.PcdBmcSmbiosBlobTransferId|"/smbios"|VOID*|0x20000003
## When this PCD is set to TRUE, IpmiSmbiosTransferDxe only sends SMBIOS table to
# BMC when SMBIOS table is changed.
gManageabilityPkgTokenSpaceGuid.PcdSendSmbiosOnChanged|TRUE|BOOLEAN|0x20000004
7 changes: 7 additions & 0 deletions Features/ManageabilityPkg/ManageabilityPkg.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#
# Copyright (C) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.<BR>
# Copyright (c) 2024, Ampere Computing LLC. All rights reserved.<BR>
# Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
Expand Down Expand Up @@ -37,6 +38,7 @@
gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiFrb |TRUE
gManageabilityPkgTokenSpaceGuid.PcdManageabilityPeiIpmiFrb |TRUE
gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiBmcAcpi |TRUE
gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiSmbiosTransferEnable|TRUE

[Components]
ManageabilityPkg/Library/PlatformBmcReadyLibNull/PlatformBmcReadyLibNull.inf
Expand Down Expand Up @@ -88,6 +90,11 @@
ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
RngLib|MdePkg/Library/BaseRngLib/BaseRngLib.inf

[LibraryClasses.common.DXE_SMM_DRIVER]
SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,15 @@ CalculateCrc16Ccitt (
/**
This function does blob transfer over IPMI command.

@param[in] SubCommand The specific sub-command to be executed as part of
the blob transfer operation.
@param[in] SendData A pointer to the data buffer that contains the data to be sent.
When SendDataSize is zero, SendData is not used.
@param[in] SendDataSize The size of the data to be sent, in bytes. This is optional.
@param[out] ResponseData A pointer to the buffer where the response data will be stored.
@param[out] ResponseDataSize A pointer to a variable that will hold the size of the response
data received.
@param[in] SubCommand The specific sub-command to be executed as part of
the blob transfer operation.
@param[in] SendData A pointer to the data buffer that contains the data to be sent.
When SendDataSize is zero, SendData is not used.
@param[in] SendDataSize The size of the data to be sent, in bytes. This is optional.
@param[out] ResponseData A pointer to the buffer where the response data will be stored.
@param[in,out] ResponseDataSize A pointer to a variable that will hold the size of the response
data received. When ResponseDataSize is zero, ResponseData is
not used.

@retval EFI_SUCCESS Successfully sends blob data.
@retval EFI_OUT_OF_RESOURCES Memory allocation fails.
Expand All @@ -92,11 +93,11 @@ CalculateCrc16Ccitt (
**/
EFI_STATUS
IpmiBlobTransferSendIpmi (
IN UINT8 SubCommand,
IN UINT8 *SendData OPTIONAL,
IN UINT32 SendDataSize OPTIONAL,
OUT UINT8 *ResponseData,
OUT UINT32 *ResponseDataSize
IN UINT8 SubCommand,
IN UINT8 *SendData OPTIONAL,
IN UINT32 SendDataSize OPTIONAL,
OUT UINT8 *ResponseData OPTIONAL,
IN OUT UINT32 *ResponseDataSize
)
{
EFI_STATUS Status;
Expand All @@ -110,7 +111,7 @@ IpmiBlobTransferSendIpmi (
UINT32 IpmiResponseDataSize;
IPMI_BLOB_TRANSFER_HEADER Header;

if (((SendDataSize > 0) && (SendData == NULL)) || (ResponseData == NULL) || (ResponseDataSize == NULL)) {
if (((SendDataSize > 0) && (SendData == NULL)) || ((ResponseData == NULL) && (((ResponseDataSize != NULL) && (*ResponseDataSize > 0))))) {
return EFI_INVALID_PARAMETER;
}

Expand Down Expand Up @@ -161,12 +162,12 @@ IpmiBlobTransferSendIpmi (
DEBUG ((BLOB_TRANSFER_DEBUG, "\n"));
DEBUG_CODE_END ();

IpmiResponseDataSize = (*ResponseDataSize + PROTOCOL_RESPONSE_OVERHEAD);
IpmiResponseDataSize = PROTOCOL_RESPONSE_OVERHEAD;
//
// If expecting data to be returned, we have to also account for the 16 bit CRC
//
if (*ResponseDataSize) {
IpmiResponseDataSize += sizeof (Crc);
if ((ResponseDataSize != NULL) && (*ResponseDataSize > 0)) {
IpmiResponseDataSize += (*ResponseDataSize + sizeof (Crc));
}

IpmiResponseData = AllocateZeroPool (IpmiResponseDataSize);
Expand Down Expand Up @@ -225,7 +226,10 @@ IpmiBlobTransferSendIpmi (
// In this case, there was no response data sent. This is not an error.
// Some messages do not require a response.
//
*ResponseDataSize = 0;
if (ResponseDataSize != NULL) {
*ResponseDataSize = 0;
}

FreePool (IpmiResponseData);
return Status;
// Now we need to validate the CRC then send the Response body back
Expand All @@ -239,8 +243,11 @@ IpmiBlobTransferSendIpmi (
IpmiResponseDataSize -= sizeof (Crc);

if (Crc == CalculateCrc16Ccitt (ModifiedResponseData, IpmiResponseDataSize)) {
CopyMem (ResponseData, ModifiedResponseData, IpmiResponseDataSize);
CopyMem (ResponseDataSize, &IpmiResponseDataSize, sizeof (IpmiResponseDataSize));
if ((ResponseData != NULL) && (ResponseDataSize != NULL)) {
CopyMem (ResponseData, ModifiedResponseData, IpmiResponseDataSize);
CopyMem (ResponseDataSize, &IpmiResponseDataSize, sizeof (IpmiResponseDataSize));
}

FreePool (IpmiResponseData);
return EFI_SUCCESS;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# IPMI Protocol SMM Driver.
#
# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
# Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent
##

Expand Down Expand Up @@ -47,6 +48,7 @@

[FixedPcd]
gEfiMdePkgTokenSpaceGuid.PcdIpmiKcsIoBaseAddress # Used as default KCS I/O base adddress
gEfiMdePkgTokenSpaceGuid.PcdIpmiSsifSmbusSlaveAddr

[Depex]
TRUE
Loading
Loading