From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com [40.107.220.82]) by mx.groups.io with SMTP id smtpd.web10.72948.1680534326933247417 for ; Mon, 03 Apr 2023 08:05:27 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amd.com header.s=selector1 header.b=thUg8dz6; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.220.82, mailfrom: abner.chang@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BB9SLFQ8rZNXSw74A6NRVyQsBsShm1u95dGVOohL9IaZSU/qnP3cTykn6Nq9mxPLNv0r6mBOxANdJTUBXYN/x7p6XQoHK47SrDqaLLMDvqBO2nU4MXeGvm+wD3eueZfnhxRTKKwaXyuJqWg4qtJLB0503hPZDKx7YuPO5BOXMta9rEN5jWfz9ej0YVDA8gEVqnHdevN6G5a6VxqH6OjTGuN4UZfRm4N9h2YIWnCrphDd65GL6zv63HxWD99ji/NpPu4it7NA8Dzaa4EQQMUce7lKrv+mf1SIyOP7SnDm8wly/rUwCMISwjtT8bnbt0hXdaOkibQS7Edu40zZRo7xFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=eRs09yIRqYaZ4gipTNeU1wIUdgjl6uarba9C3tHH/w0=; b=jds6nvOaYrhrOhFL+Dw13Y0gXWZOCMDtszqIA0jcpRVdq9NN1Zk7Ek2y4/w4vDttDHr4BG7FJVC3Hyw1YTdVPTOuRO87B3tEVlS6FLZ6y04IQEYFabyFQ54xLYMlfJghowv+JxVcCwBNxZye2HEzxH7Rgs+/pzA2v32M0JxtL76DdocWJpCCgE7fwDltJ6so3/U77dS6ybxb0b25kQrLn77EK62HsUzbUjjkfx9xGT/GD8B0bCCVHVqwfsZQNOECBKH9goKNq1btgK4a4Sfoe76IUSuYhpRMc9rAX9ttZ3YxXPlqwjYJcnXLpHJZ6uzGC3yzTm4YcFeecGG3xVhRiA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eRs09yIRqYaZ4gipTNeU1wIUdgjl6uarba9C3tHH/w0=; b=thUg8dz6kS4TOgGlmjMjztDE6qjaSNEMSQssJ4fZJwz3ey3OZoahlsU9ecrw5smokYt5QOwl7AfyxGdRgazvaYZp6Tn65qzvPxWSOAYu4Qflz77nSQHpz56hSQjjr4NwDAWp6/UrfWgOgZeozggw2sQPxVBEg3OIWPzRD3OPD8o= Received: from DS7PR07CA0024.namprd07.prod.outlook.com (2603:10b6:5:3af::6) by PH8PR12MB7374.namprd12.prod.outlook.com (2603:10b6:510:216::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.24; Mon, 3 Apr 2023 15:05:23 +0000 Received: from DM6NAM11FT052.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3af:cafe::16) by DS7PR07CA0024.outlook.office365.com (2603:10b6:5:3af::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.45 via Frontend Transport; Mon, 3 Apr 2023 15:05:23 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT052.mail.protection.outlook.com (10.13.172.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6277.26 via Frontend Transport; Mon, 3 Apr 2023 15:05:23 +0000 Received: from TPE-L1-ABNCHANG.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 3 Apr 2023 10:05:20 -0500 From: "Chang, Abner" To: CC: Isaac Oram , Abdul Lateef Attar , Nickle Wang , Igor Kulchytskyy Subject: [edk2-platforms][PATCH 02/14] ManageabilityPkg: Support Maximum Transfer Unit Date: Mon, 3 Apr 2023 23:04:47 +0800 Message-ID: <20230403150459.925-3-abner.chang@amd.com> X-Mailer: git-send-email 2.37.1.windows.1 In-Reply-To: <20230403150459.925-1-abner.chang@amd.com> References: <20230403150459.925-1-abner.chang@amd.com> MIME-Version: 1.0 Return-Path: Abner.Chang@amd.com X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT052:EE_|PH8PR12MB7374:EE_ X-MS-Office365-Filtering-Correlation-Id: fd16305e-bce4-422d-81eb-08db3454d954 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ooA6uK/g33FuMqwbvkaRD9tdB8TZXCdMRqoV9WpY0dF8O89MQ68WjQ3iD0NgSMn/ah4O9yf9Tiafuf9h8SYX8h1gBMzqSC3pWskDC7cmmvhthWX0aLiNxgvBbVBwU9zCxUf7cvyNGlBmv/8fkCyfgSul3swfXZgcJhTPzG4ueNnUGzhvczdTezofiEPyn3eZiyyfEXivMgpa4k7T4F2q6WaD1+H4lT4xvqzcfP/MtK9W7IPHjpyKtpvlPRnw4/LCbf6I6zPeia2tO/CLtBddFpnxTAElCMrpOsATyr+Vw6eORLhRK+ucSrJ08ujr5gu2bCvrRjxWbDnXqvveYsMvZhFd/4S3npFS+1giOYZ+a7LutzU6JwYDwqYQQUKSuU0hS8eEj3BR132yqHTdPPL+3a5I4jUBm/UNOoy1cd2DCiqtc53bUWDDikIkrtT/iHN3+U+wjWGgh7d0zVyCFs182IaWHP/LiunMSHpJmVzXqZziTsSXXA6z4s9F+SwEHRe4jkrP8GwZ2JinoHNm5DQjGhNd6n/WMV+UhIpiucvz4SngGIHlaZlJxnCkPBoAQVSzrXSmVMo2xASUQonYOpK/lpjDNpCyB7Mn12aSoksSMTyaH/TiReqUDvkmDd9amRovg1qi2QJYWRgMJcqErG0PAtCxjhp0UYPzLXHmEk84tsFrc5cf7V8Jn0T5N9zCsFNDshp60qUHtWZhcv86G+r8szYsprga+EZcEqKn1Hjg1GoTq90nHvWhSw9NdrtWYh5Y X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(346002)(376002)(136003)(39860400002)(396003)(451199021)(40470700004)(46966006)(36840700001)(8676002)(70586007)(6916009)(70206006)(54906003)(4326008)(316002)(40480700001)(36756003)(6666004)(426003)(26005)(336012)(81166007)(16526019)(186003)(2616005)(83380400001)(1076003)(47076005)(356005)(40460700003)(5660300002)(86362001)(82310400005)(8936002)(7696005)(478600001)(36860700001)(30864003)(82740400003)(41300700001)(2906002)(2876002)(36900700001)(44824005);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2023 15:05:23.0523 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fd16305e-bce4-422d-81eb-08db3454d954 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT052.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7374 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain From: Abner Chang Update GetTransportCapability to support Maximum Transfer Unit (MTU) of transport interface. Signed-off-by: Abner Chang Cc: Isaac Oram Cc: Abdul Lateef Attar Cc: Nickle Wang Cc: Igor Kulchytskyy --- .../Library/ManageabilityTransportLib.h | 31 ++++++++++++++----- .../Common/ManageabilityTransportKcs.h | 2 ++ .../IpmiProtocol/Pei/IpmiPpiInternal.h | 8 +++-- .../BaseManageabilityTransportNull.c | 18 +++++++---- .../Dxe/ManageabilityTransportKcs.c | 25 +++++++++------ .../Universal/IpmiProtocol/Dxe/IpmiProtocol.c | 20 +++++++++--- .../Universal/IpmiProtocol/Pei/IpmiPpi.c | 15 +++++++-- .../Universal/IpmiProtocol/Smm/IpmiProtocol.c | 21 ++++++++++--- 8 files changed, 103 insertions(+), 37 deletions(-) diff --git a/Features/ManageabilityPkg/Include/Library/ManageabilityTranspo= rtLib.h b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportL= ib.h index c022b4ac5c..ad6cd1a464 100644 --- a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h +++ b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h @@ -14,6 +14,9 @@ #define MANAGEABILITY_TRANSPORT_TOKEN_VERSION ((MANAGEABILITY_TRANS= PORT_TOKEN_VERSION_MAJOR << 8) |\ MANAGEABILITY_TRANSPORT_TO= KEN_VERSION_MINOR) =20 +#define MANAGEABILITY_TRANSPORT_PAYLOAD_SIZE_FROM_CAPABILITY(a) (1 << ((a= & MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_MASK) >>\ + MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_BIT_POSITION= )) + typedef struct _MANAGEABILITY_TRANSPORT_FUNCTION_V1_0 MANAGEABILITY_TRAN= SPORT_FUNCTION_V1_0; typedef struct _MANAGEABILITY_TRANSPORT MANAGEABILITY_TRAN= SPORT; typedef struct _MANAGEABILITY_TRANSPORT_TOKEN MANAGEABILITY_TRAN= SPORT_TOKEN; @@ -68,8 +71,17 @@ typedef UINT32 MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS= ; /// Additional transport interface features. /// typedef UINT32 MANAGEABILITY_TRANSPORT_CAPABILITY; +/// Bit 0 #define MANAGEABILITY_TRANSPORT_CAPABILITY_MULTIPLE_TRANSFER_TOKENS 0x000= 00001 +/// Bit 1 #define MANAGEABILITY_TRANSPORT_CAPABILITY_ASYNCHRONOUS_TRANSFER 0x000= 00002 +/// Bit 2 - Reserved +/// Bit 7:3 - Transport interface maximum payload size, which is (2 ^ bit[= 7:3] - 1) +/// bit[7:3] means no maximum payload. +#define MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_MASK 0= x000000f8 +#define MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_BIT_POSITION 3 + #define MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_NOT_AVAILABLE= 0x00 +/// Bit 8:31 - Reserved =20 /// /// Definitions of Manageability transport interface functions. @@ -187,15 +199,20 @@ AcquireTransportSession ( ); =20 /** - This function returns the transport capabilities. - - @param [out] TransportFeature Pointer to receive transport capab= ilities. - See the definitions of - MANAGEABILITY_TRANSPORT_CAPABILITY= . - + This function returns the transport capabilities according to + the manageability protocol. + + @param [in] TransportToken Transport token acquired from m= anageability + transport library. + @param [out] TransportFeature Pointer to receive transport ca= pabilities. + See the definitions of + MANAGEABILITY_TRANSPORT_CAPABIL= ITY. + @retval EFI_SUCCESS TransportCapability is returned= successfully. + @retval EFI_INVALID_PARAMETER TransportToken is not a valid t= oken. **/ -VOID +EFI_STATUS GetTransportCapability ( + IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken, OUT MANAGEABILITY_TRANSPORT_CAPABILITY *TransportCapability ); =20 diff --git a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib= /Common/ManageabilityTransportKcs.h b/Features/ManageabilityPkg/Library/Man= ageabilityTransportKcsLib/Common/ManageabilityTransportKcs.h index f1758ffd8f..2cdf60ba7e 100644 --- a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common= /ManageabilityTransportKcs.h +++ b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common= /ManageabilityTransportKcs.h @@ -32,6 +32,8 @@ typedef struct { #define IPMI_KCS_GET_STATE(s) (s >> 6) #define IPMI_KCS_SET_STATE(s) (s << 6) =20 +#define MCTP_KCS_MTU_IN_POWER_OF_2 8 + /// 5 sec, according to IPMI spec #define IPMI_KCS_TIMEOUT_5_SEC 5000*1000 #define IPMI_KCS_TIMEOUT_1MS 1000 diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiIn= ternal.h b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiInte= rnal.h index bbe0c8c5cb..7b6ab0f529 100644 --- a/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiInternal.= h +++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiInternal.= h @@ -17,9 +17,11 @@ #define MANAGEABILITY_IPMI_PPI_INTERNAL_FROM_LINK(a) CR (a, PEI_IPMI_PPI_= INTERNAL, PeiIpmiPpi, MANAGEABILITY_IPMI_PPI_INTERNAL_SIGNATURE) =20 typedef struct { - UINT32 Signature; - MANAGEABILITY_TRANSPORT_TOKEN *TransportToken; - PEI_IPMI_PPI PeiIpmiPpi; + UINT32 Signature; + MANAGEABILITY_TRANSPORT_TOKEN *TransportToken; + MANAGEABILITY_TRANSPORT_CAPABILITY TransportCapability; + UINT32 TransportMaximumPayload; + PEI_IPMI_PPI PeiIpmiPpi; } PEI_IPMI_PPI_INTERNAL; =20 #endif // MANAGEABILITY_IPMI_PPI_INTERNAL_H_ diff --git a/Features/ManageabilityPkg/Library/BaseManageabilityTransportNu= llLib/BaseManageabilityTransportNull.c b/Features/ManageabilityPkg/Library/= BaseManageabilityTransportNullLib/BaseManageabilityTransportNull.c index 49fc8c0f71..3aa68578a6 100644 --- a/Features/ManageabilityPkg/Library/BaseManageabilityTransportNullLib/B= aseManageabilityTransportNull.c +++ b/Features/ManageabilityPkg/Library/BaseManageabilityTransportNullLib/B= aseManageabilityTransportNull.c @@ -31,19 +31,25 @@ AcquireTransportSession ( } =20 /** - This function returns the transport capabilities. - - @param [out] TransportFeature Pointer to receive transport capab= ilities. - See the definitions of - MANAGEABILITY_TRANSPORT_CAPABILITY= . + This function returns the transport capabilities according to + the manageability protocol. =20 + @param [in] TransportToken Transport token acquired from m= anageability + transport library. + @param [out] TransportFeature Pointer to receive transport ca= pabilities. + See the definitions of + MANAGEABILITY_TRANSPORT_CAPABIL= ITY. + @retval EFI_SUCCESS TransportCapability is returned= successfully. + @retval EFI_INVALID_PARAMETER TransportToken is not a valid t= oken. **/ -VOID +EFI_STATUS GetTransportCapability ( + IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken, OUT MANAGEABILITY_TRANSPORT_CAPABILITY *TransportCapability ) { *TransportCapability =3D 0; + return EFI_SUCCESS; } =20 /** diff --git a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib= /Dxe/ManageabilityTransportKcs.c b/Features/ManageabilityPkg/Library/Manage= abilityTransportKcsLib/Dxe/ManageabilityTransportKcs.c index ab416e5449..25d6e49886 100644 --- a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/Ma= nageabilityTransportKcs.c +++ b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/Ma= nageabilityTransportKcs.c @@ -329,21 +329,28 @@ AcquireTransportSession ( } =20 /** - This function returns the transport capabilities. - - @param [out] TransportFeature Pointer to receive transport capab= ilities. - See the definitions of - MANAGEABILITY_TRANSPORT_CAPABILITY= . - + This function returns the transport capabilities according to + the manageability protocol. + + @param [in] TransportToken Transport token acquired from m= anageability + transport library. + @param [out] TransportFeature Pointer to receive transport ca= pabilities. + See the definitions of + MANAGEABILITY_TRANSPORT_CAPABIL= ITY. + @retval EFI_SUCCESS TransportCapability is returned= successfully. + @retval EFI_INVALID_PARAMETER TransportToken is not a valid t= oken. **/ -VOID +EFI_STATUS GetTransportCapability ( + IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken, OUT MANAGEABILITY_TRANSPORT_CAPABILITY *TransportCapability ) { - if (TransportCapability !=3D NULL) { - *TransportCapability =3D 0; + if (TransportToken =3D=3D NULL || TransportCapability =3D=3D NULL) { + return EFI_INVALID_PARAMETER; } + *TransportCapability =3D 0; + return EFI_SUCCESS; } =20 /** diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProto= col.c b/Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocol.c index 05175ee448..c30132419d 100644 --- a/Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocol.c +++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocol.c @@ -17,9 +17,9 @@ =20 #include "IpmiProtocolCommon.h" =20 -MANAGEABILITY_TRANSPORT_TOKEN *mTransportToken =3D NULL; -CHAR16 *mTransportName; - +MANAGEABILITY_TRANSPORT_TOKEN *mTransportToken =3D NULL; +CHAR16 *mTransportName; +UINT32 TransportMaximumPayload; MANAGEABILITY_TRANSPORT_HARDWARE_INFORMATION mHardwareInformation; =20 /** @@ -92,8 +92,6 @@ DxeIpmiEntry ( MANAGEABILITY_TRANSPORT_CAPABILITY TransportCapability; MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS TransportAdditionalStatus; =20 - GetTransportCapability (&TransportCapability); - Status =3D HelperAcquireManageabilityTransport ( &gManageabilityProtocolIpmiGuid, &mTransportToken @@ -102,6 +100,18 @@ DxeIpmiEntry ( DEBUG ((DEBUG_ERROR, "%a: Failed to acquire transport interface for IP= MI protocol - %r\n", __FUNCTION__, Status)); return Status; } + Status =3D GetTransportCapability (mTransportToken, &TransportCapability= ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Failed to GetTransportCapability().\n", __FU= NCTION__)); + return Status; + } + TransportMaximumPayload =3D MANAGEABILITY_TRANSPORT_PAYLOAD_SIZE_FROM_CA= PABILITY(TransportCapability); + if (TransportMaximumPayload =3D=3D (1 << MANAGEABILITY_TRANSPORT_CAPABIL= ITY_MAXIMUM_PAYLOAD_NOT_AVAILABLE)) { + DEBUG ((DEBUG_INFO, "%a: Transport interface maximum payload is undefi= ned.\n", __FUNCTION__)); + } else { + TransportMaximumPayload -=3D 1; + DEBUG ((DEBUG_INFO, "%a: Transport interface for IPMI protocol has max= imum payload %x.\n", __FUNCTION__, TransportMaximumPayload)); + } =20 mTransportName =3D HelperManageabilitySpecName (mTransportToken->Transpo= rt->ManageabilityTransportSpecification); DEBUG ((DEBUG_INFO, "%a: IPMI protocol over %s.\n", __FUNCTION__, mTrans= portName)); diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpi.c= b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpi.c index f839cd7387..0dda6d2d47 100644 --- a/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpi.c +++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpi.c @@ -87,7 +87,6 @@ PeiIpmiEntry ( 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; =20 @@ -109,7 +108,6 @@ PeiIpmiEntry ( PpiDescriptor->Guid =3D &gPeiIpmiPpiGuid; PpiDescriptor->Ppi =3D &PeiIpmiPpiinternal->PeiIpmiPpi; =20 - GetTransportCapability (&TransportCapability); Status =3D HelperAcquireManageabilityTransport ( &gManageabilityProtocolIpmiGuid, &PeiIpmiPpiinternal->TransportToken @@ -118,6 +116,19 @@ PeiIpmiEntry ( DEBUG ((DEBUG_ERROR, "%a: Failed to acquire transport interface for IP= MI protocol - %r\n", __FUNCTION__, Status)); return Status; } + Status =3D GetTransportCapability (PeiIpmiPpiinternal->TransportToken, &= PeiIpmiPpiinternal->TransportCapability); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Failed to GetTransportCapability().\n", __FU= NCTION__)); + return Status; + } + + PeiIpmiPpiinternal->TransportMaximumPayload =3D MANAGEABILITY_TRANSPORT_= PAYLOAD_SIZE_FROM_CAPABILITY(PeiIpmiPpiinternal->TransportCapability); + if (PeiIpmiPpiinternal->TransportMaximumPayload =3D=3D (1 << MANAGEABIL= ITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_NOT_AVAILABLE)) { + DEBUG((DEBUG_INFO, "%a: Transport interface maximum payload is undefin= ed.\n", __FUNCTION__)); + } else { + PeiIpmiPpiinternal->TransportMaximumPayload -=3D 1; + DEBUG((DEBUG_INFO, "%a: Transport interface for IPMI protocol has maxi= mum payload 0x%x.\n", __FUNCTION__, PeiIpmiPpiinternal->TransportMaximumPay= load)); + } =20 TransportName =3D HelperManageabilitySpecName (PeiIpmiPpiinternal->Trans= portToken->Transport->ManageabilityTransportSpecification); DEBUG ((DEBUG_INFO, "%a: IPMI protocol over %s.\n", __FUNCTION__, Transp= ortName)); diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProto= col.c b/Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocol.c index 87a5436bdf..86dee2fa24 100644 --- a/Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocol.c +++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocol.c @@ -18,9 +18,9 @@ =20 #include "IpmiProtocolCommon.h" =20 -MANAGEABILITY_TRANSPORT_TOKEN *mTransportToken =3D NULL; -CHAR16 *mTransportName; - +MANAGEABILITY_TRANSPORT_TOKEN *mTransportToken =3D NULL; +CHAR16 *mTransportName; +UINT32 TransportMaximumPayload; MANAGEABILITY_TRANSPORT_HARDWARE_INFORMATION mHardwareInformation; =20 /** @@ -93,8 +93,6 @@ SmmIpmiEntry ( MANAGEABILITY_TRANSPORT_CAPABILITY TransportCapability; MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS TransportAdditionalStatus; =20 - GetTransportCapability (&TransportCapability); - Status =3D HelperAcquireManageabilityTransport ( &gManageabilityProtocolIpmiGuid, &mTransportToken @@ -104,6 +102,19 @@ SmmIpmiEntry ( return Status; } =20 + Status =3D GetTransportCapability (mTransportToken, &TransportCapability= ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Failed to GetTransportCapability().\n", __FU= NCTION__)); + return Status; + } + TransportMaximumPayload =3D MANAGEABILITY_TRANSPORT_PAYLOAD_SIZE_FROM_CA= PABILITY(TransportCapability); + if (TransportMaximumPayload =3D=3D (1 << MANAGEABILITY_TRANSPORT_CAPABIL= ITY_MAXIMUM_PAYLOAD_NOT_AVAILABLE)) { + DEBUG((DEBUG_INFO, "%a: Transport interface maximum payload is undefin= ed.\n", __FUNCTION__)); + } else { + TransportMaximumPayload -=3D 1; + DEBUG((DEBUG_INFO, "%a: Transport interface for IPMI protocol has maxi= mum payload 0x%x.\n", __FUNCTION__, TransportMaximumPayload)); + } + mTransportName =3D HelperManageabilitySpecName (mTransportToken->Transpo= rt->ManageabilityTransportSpecification); DEBUG ((DEBUG_INFO, "%a: IPMI protocol over %s.\n", __FUNCTION__, mTrans= portName)); =20 --=20 2.37.1.windows.1