From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (NAM04-MW2-obe.outbound.protection.outlook.com [40.107.101.87]) by mx.groups.io with SMTP id smtpd.web11.2663.1681802178325374317 for ; Tue, 18 Apr 2023 00:16:18 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amd.com header.s=selector1 header.b=3rt6hjPz; 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.101.87, mailfrom: abner.chang@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=asT3IZX1qr3Jg5K2uWyOWx6EtYXO2zE5mKCs5Yyo4F/hQrAf7C/timRKYo0e5Zz67kMrEq95YWm3B85+1TwK7nOV7KnogEl+EfiuJx/znnKOnf/SfaTkN/jwdjFtvIV92ryr8Zbkm2nJes3iWtyiXGfMNeSE9jwKH6Mk4z2aj3cgm0OT41p4Pz2DcIl3gGMYzfOao5JtF7hK5hy+XlBNKKDd3DIcHKccknSvoh/MWm0wyMGrpOnrFHKaBhOb5LI7If1KgbOfBsvjIyehBjiWlHIUlYUXpELcAJkxbi50gThTk9ujKGYvCaHAl7fEWB+Z5mi+5r+HkGSTh8E5HkPKTg== 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=dplKE7zlIi7TgReZRjRgT1/Asls3VIGeCqxDb0wSHFA=; b=UJWv1pf2hfrE/b/yJV7vFu49FcUHy1vJrEqyR8rL01UfcjulDFJBjomQ8LyH7mWLegcdieutTA0uxYGI9FJDlc6LfvBrUXzf6K3d0Rq7kggHMIPLlFE6b/yq2LYlRvSEOgz1jsSIH65wA/7OuaIXSRgZkMa4jGjY1LpWm91owxnwNYB94Qsxp43bL1BhMXZ1rH8lEubpclYHg6wJgTNBd56AosDW/KwDMsvXrQSEkBhIW0y9/MtuuhjsZFgtQLerSOF5o64pTC5iPXzsTUjHojjebbXIDXnGJN2vAzkmIDsGW0Y9L63zd9C5gnKeje61nGuwFh0PcQ1lc82KBL8Tgw== 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=dplKE7zlIi7TgReZRjRgT1/Asls3VIGeCqxDb0wSHFA=; b=3rt6hjPzRrUeZq+y3j4iq7v2KY4g9zt65I7Ug5VzetosVVcTRPcHocTg2Wi0AXFdjraiPAk1sHZxnhkps0VtlKEVBgxAP/1q+Cjg+pmkv2+Kix4B4hO5frAOytDU+fFQHja6BPSk5MoyROV4eykl6EksVjbyxteIFqsNGOVm0rs= Received: from DM6PR01CA0023.prod.exchangelabs.com (2603:10b6:5:296::28) by MW6PR12MB8834.namprd12.prod.outlook.com (2603:10b6:303:23c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.20; Tue, 18 Apr 2023 07:16:12 +0000 Received: from DM6NAM11FT029.eop-nam11.prod.protection.outlook.com (2603:10b6:5:296:cafe::a6) by DM6PR01CA0023.outlook.office365.com (2603:10b6:5:296::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.47 via Frontend Transport; Tue, 18 Apr 2023 07:16:12 +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 DM6NAM11FT029.mail.protection.outlook.com (10.13.173.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6319.20 via Frontend Transport; Tue, 18 Apr 2023 07:16:12 +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; Tue, 18 Apr 2023 02:16:05 -0500 From: "Chang, Abner" To: CC: Isaac Oram , Abdul Lateef Attar , Nickle Wang , Igor Kulchytskyy Subject: [edk2-platforms][PATCH V2 02/14] ManageabilityPkg: Support Maximum Transfer Unit Date: Tue, 18 Apr 2023 15:15:31 +0800 Message-ID: <20230418071543.1951-3-abner.chang@amd.com> X-Mailer: git-send-email 2.37.1.windows.1 In-Reply-To: <20230418071543.1951-1-abner.chang@amd.com> References: <20230418071543.1951-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: DM6NAM11FT029:EE_|MW6PR12MB8834:EE_ X-MS-Office365-Filtering-Correlation-Id: ade83867-e176-40b0-600b-08db3fdcca58 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wp2R9/PaamIT90meH9dy5NpcN1l5ri1+NIxfrHnlgjSidHGHX6/1eqxUwzlxTW2BIQDLiAUu24kEVOZGNAGgBry2nM0jxDVmBGi+/9H5/A7dKnq7Wx6QX2WqQSpvgL4Hg3UwfRR0QZ0JOxoPVonwGEBU/DSnwcyBrB7VEPhkZaAqR+ekAEZwuy3MSKib+ek0VuP4HEMOkXjKc2C/hiTWdzxDdFWZJLRjbghby9jTddjNBVPP8r4HZPzsIP+hqpX9CGh3NpD9J8gzKQzDTycRtqH6kJW/iQ69FfjzFwMhGxAcTatOJTJAOUNVptdSutrjnrYe0F4YS5zy1oXTgKEwdCII4fz3UnsYRwUThJq2JX3kJ9eEY+CnRq+J//MWIciSudjgxI6tAT5Wx1zDkz/XFBcUrKraBJaq1BX0lGGxr1NH3Tjg/4jWAjQTvLJHyN0cSIRmfqO/Wp5vAk0XXvJePw+dlrADcAZkLksgK0NymyzhKCE3wLkOqyDb9K7C0uckPOb+gWUCuz8Z5tDerJWYTMmDG7rF1W74di7+ewkg6pbi0kSmeSVAfG7RbaALLIPFH88sBZrrNM4FdP68azjJSQ8DNqke9w0LYJIRuubdPnLTT4B/M3p3RCAjh/n5ZHSaRu12qR+SYNWwj+8+7sk+MVnqf2JVdKg2cWwYMq9L6nx/bd2Q6MiIsN29Xo++N/oVGwJrlYk0/FBkTMFyP8Ii7v8rd0W8aiVYqvMOhJCXmn7aZSVLNGQe6UdaVs281o0k 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)(376002)(136003)(396003)(346002)(39860400002)(451199021)(40470700004)(36840700001)(46966006)(2906002)(30864003)(2616005)(36860700001)(40460700003)(478600001)(6666004)(86362001)(82310400005)(26005)(1076003)(7696005)(186003)(16526019)(36756003)(40480700001)(2876002)(426003)(336012)(41300700001)(82740400003)(81166007)(356005)(54906003)(8936002)(8676002)(47076005)(19627235002)(316002)(70586007)(70206006)(83380400001)(6916009)(4326008)(5660300002)(36900700001)(44824005);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Apr 2023 07:16:12.2420 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ade83867-e176-40b0-600b-08db3fdcca58 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: DM6NAM11FT029.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB8834 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 | 33 ++++++++--- .../Common/ManageabilityTransportKcs.h | 2 + .../IpmiProtocol/Pei/IpmiPpiInternal.h | 8 ++- .../BaseManageabilityTransportNull.c | 18 ++++-- .../Dxe/ManageabilityTransportKcs.c | 57 +++++++++++-------- .../Universal/IpmiProtocol/Dxe/IpmiProtocol.c | 24 ++++++-- .../Universal/IpmiProtocol/Pei/IpmiPpi.c | 51 ++++++++++------- .../Universal/IpmiProtocol/Smm/IpmiProtocol.c | 24 ++++++-- 8 files changed, 145 insertions(+), 72 deletions(-) diff --git a/Features/ManageabilityPkg/Include/Library/ManageabilityTranspo= rtLib.h b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportL= ib.h index c022b4ac5c..d86d0d87d5 100644 --- a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h +++ b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h @@ -14,6 +14,9 @@ #define MANAGEABILITY_TRANSPORT_TOKEN_VERSION ((MANAGEABILITY_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 -#define MANAGEABILITY_TRANSPORT_CAPABILITY_ASYNCHRONOUS_TRANSFER 0x000= 00002 +/// Bit 1 +#define MANAGEABILITY_TRANSPORT_CAPABILITY_ASYNCHRONOUS_TRANSFER 0x000000= 02 +/// 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 = 0x000000f8 +#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..4b6bdc97a9 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..7d85378fc1 100644 --- a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/Ma= nageabilityTransportKcs.c +++ b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/Ma= nageabilityTransportKcs.c @@ -62,7 +62,7 @@ KcsTransportInit ( } =20 if (HardwareInfo.Kcs =3D=3D NULL) { - DEBUG ((DEBUG_INFO, "%a: Hardware information is not provided, use dfa= ult settings.\n", __FUNCTION__)); + DEBUG ((DEBUG_MANAGEABILITY_INFO, "%a: Hardware information is not pro= vided, use dfault settings.\n", __FUNCTION__)); mKcsHardwareInfo.MemoryMap =3D MANAGEABILITY_TRANSP= ORT_KCS_IO_MAP_IO; mKcsHardwareInfo.IoBaseAddress.IoAddress16 =3D PcdGet16 (PcdIpmiKcs= IoBaseAddress); mKcsHardwareInfo.IoDataInAddress.IoAddress16 =3D mKcsHardwareInfo.IoB= aseAddress.IoAddress16 + IPMI_KCS_DATA_IN_REGISTER_OFFSET; @@ -81,21 +81,21 @@ KcsTransportInit ( // Get protocol specification name. ManageabilityProtocolName =3D HelperManageabilitySpecName (TransportToke= n->ManageabilityProtocolSpecification); =20 - DEBUG ((DEBUG_INFO, "%a: KCS transport hardware for %s is:\n", __FUNCTIO= N__, ManageabilityProtocolName)); + DEBUG ((DEBUG_MANAGEABILITY_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)); + DEBUG ((DEBUG_MANAGEABILITY_INFO, "Memory Map I/O\n", __FUNCTION__)); + DEBUG ((DEBUG_MANAGEABILITY_INFO, "Base Memory Address : 0x%08x\n", mK= csHardwareInfo.IoBaseAddress.IoAddress32)); + DEBUG ((DEBUG_MANAGEABILITY_INFO, "Data in Address : 0x%08x\n", mK= csHardwareInfo.IoDataInAddress.IoAddress32)); + DEBUG ((DEBUG_MANAGEABILITY_INFO, "Data out Address : 0x%08x\n", mK= csHardwareInfo.IoDataOutAddress.IoAddress32)); + DEBUG ((DEBUG_MANAGEABILITY_INFO, "Command Address : 0x%08x\n", mK= csHardwareInfo.IoCommandAddress.IoAddress32)); + DEBUG ((DEBUG_MANAGEABILITY_INFO, "Status Address : 0x%08x\n", mK= csHardwareInfo.IoStatusAddress.IoAddress32)); } else { - DEBUG ((DEBUG_INFO, "I/O Map I/O\n")); - DEBUG ((DEBUG_INFO, "Base I/O port : 0x%04x\n", mKcsHardwareInfo.Io= BaseAddress.IoAddress16)); - DEBUG ((DEBUG_INFO, "Data in I/O port : 0x%04x\n", mKcsHardwareInfo.Io= DataInAddress.IoAddress16)); - DEBUG ((DEBUG_INFO, "Data out I/O port: 0x%04x\n", mKcsHardwareInfo.Io= DataOutAddress.IoAddress16)); - DEBUG ((DEBUG_INFO, "Command I/O port : 0x%04x\n", mKcsHardwareInfo.Io= CommandAddress.IoAddress16)); - DEBUG ((DEBUG_INFO, "Status I/O port : 0x%04x\n", mKcsHardwareInfo.Io= StatusAddress.IoAddress16)); + DEBUG ((DEBUG_MANAGEABILITY_INFO, "I/O Map I/O\n")); + DEBUG ((DEBUG_MANAGEABILITY_INFO, "Base I/O port : 0x%04x\n", mKcsH= ardwareInfo.IoBaseAddress.IoAddress16)); + DEBUG ((DEBUG_MANAGEABILITY_INFO, "Data in I/O port : 0x%04x\n", mKcsH= ardwareInfo.IoDataInAddress.IoAddress16)); + DEBUG ((DEBUG_MANAGEABILITY_INFO, "Data out I/O port: 0x%04x\n", mKcsH= ardwareInfo.IoDataOutAddress.IoAddress16)); + DEBUG ((DEBUG_MANAGEABILITY_INFO, "Command I/O port : 0x%04x\n", mKcsH= ardwareInfo.IoCommandAddress.IoAddress16)); + DEBUG ((DEBUG_MANAGEABILITY_INFO, "Status I/O port : 0x%04x\n", mKcsH= ardwareInfo.IoStatusAddress.IoAddress16)); } =20 return EFI_SUCCESS; @@ -221,7 +221,7 @@ KcsTransportTransmitReceive ( EFI_STATUS Status; MANAGEABILITY_IPMI_TRANSPORT_HEADER *TransmitHeader; =20 - if (TransportToken =3D=3D NULL || TransferToken =3D=3D NULL) { + if ((TransportToken =3D=3D NULL) || (TransferToken =3D=3D NULL)) { DEBUG ((DEBUG_ERROR, "%a: Invalid transport token or transfer token.\n= ", __FUNCTION__)); return; } @@ -298,6 +298,7 @@ AcquireTransportSession ( DEBUG ((DEBUG_ERROR, "%a: Fail to allocate memory for MANAGEABILITY_TR= ANSPORT_KCS\n", __FUNCTION__)); return EFI_OUT_OF_RESOURCES; } + KcsTransportToken->Token.Transport =3D AllocateZeroPool (sizeof (MANAGEA= BILITY_TRANSPORT)); if (KcsTransportToken->Token.Transport =3D=3D NULL) { FreePool (KcsTransportToken); @@ -329,21 +330,29 @@ 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..51d5c7f0ba 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 @@ -103,8 +101,22 @@ DxeIpmiEntry ( 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_MANAGEABILITY_INFO, "%a: Transport interface maximum pay= load is undefined.\n", __FUNCTION__)); + } else { + TransportMaximumPayload -=3D 1; + DEBUG ((DEBUG_MANAGEABILITY_INFO, "%a: Transport interface for IPMI pr= otocol has maximum payload %x.\n", __FUNCTION__, TransportMaximumPayload)); + } + mTransportName =3D HelperManageabilitySpecName (mTransportToken->Transpo= rt->ManageabilityTransportSpecification); - DEBUG ((DEBUG_INFO, "%a: IPMI protocol over %s.\n", __FUNCTION__, mTrans= portName)); + DEBUG ((DEBUG_MANAGEABILITY_INFO, "%a: IPMI protocol over %s.\n", __FUNC= TION__, mTransportName)); =20 // // Setup hardware information according to the transport interface. diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpi.c= b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpi.c index f839cd7387..8bf1e794f0 100644 --- a/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpi.c +++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpi.c @@ -51,19 +51,19 @@ PeiIpmiSubmitCommand ( IN OUT UINT32 *ResponseDataSize ) { - EFI_STATUS Status; - PEI_IPMI_PPI_INTERNAL *PeiIpmiPpiinternal; - - PeiIpmiPpiinternal =3D MANAGEABILITY_IPMI_PPI_INTERNAL_FROM_LINK(This); - Status =3D CommonIpmiSubmitCommand ( - PeiIpmiPpiinternal->TransportToken, - NetFunction, - Command, - RequestData, - RequestDataSize, - ResponseData, - ResponseDataSize - ); + EFI_STATUS Status; + PEI_IPMI_PPI_INTERNAL *PeiIpmiPpiinternal; + + PeiIpmiPpiinternal =3D MANAGEABILITY_IPMI_PPI_INTERNAL_FROM_LINK (This); + Status =3D CommonIpmiSubmitCommand ( + PeiIpmiPpiinternal->TransportToken, + NetFunction, + Command, + RequestData, + RequestDataSize, + ResponseData, + ResponseDataSize + ); return Status; } =20 @@ -87,29 +87,28 @@ 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 - PeiIpmiPpiinternal =3D (PEI_IPMI_PPI_INTERNAL *)AllocateZeroPool (sizeof= (PEI_IPMI_PPI_INTERNAL)); + PeiIpmiPpiinternal =3D (PEI_IPMI_PPI_INTERNAL *)AllocateZeroPool (sizeof= (PEI_IPMI_PPI_INTERNAL)); if (PeiIpmiPpiinternal =3D=3D NULL) { DEBUG ((DEBUG_ERROR, "%a: Not enough memory for PEI_IPMI_PPI_INTERNAL.= \n", __FUNCTION__)); return EFI_OUT_OF_RESOURCES; } - PpiDescriptor =3D (EFI_PEI_PPI_DESCRIPTOR *)AllocateZeroPool (sizeof(EFI= _PEI_PPI_DESCRIPTOR)); + + PpiDescriptor =3D (EFI_PEI_PPI_DESCRIPTOR *)AllocateZeroPool (sizeof (EF= I_PEI_PPI_DESCRIPTOR)); if (PpiDescriptor =3D=3D NULL) { DEBUG ((DEBUG_ERROR, "%a: Not enough memory for EFI_PEI_PPI_DESCRIPTOR= .\n", __FUNCTION__)); return EFI_OUT_OF_RESOURCES; } =20 - PeiIpmiPpiinternal->Signature =3D MANAGEABILITY_IPMI_PPI_INTERNAL_SIGNAT= URE; + PeiIpmiPpiinternal->Signature =3D MANAGEABILITY_IPMI_= PPI_INTERNAL_SIGNATURE; PeiIpmiPpiinternal->PeiIpmiPpi.IpmiSubmitCommand =3D PeiIpmiSubmitComman= d; =20 PpiDescriptor->Flags =3D EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRI= PTOR_TERMINATE_LIST; PpiDescriptor->Guid =3D &gPeiIpmiPpiGuid; PpiDescriptor->Ppi =3D &PeiIpmiPpiinternal->PeiIpmiPpi; =20 - GetTransportCapability (&TransportCapability); Status =3D HelperAcquireManageabilityTransport ( &gManageabilityProtocolIpmiGuid, &PeiIpmiPpiinternal->TransportToken @@ -119,8 +118,22 @@ PeiIpmiEntry ( return Status; } =20 + 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_MANAGEABILITY_INFO, "%a: Transport interface maximum pay= load is undefined.\n", __FUNCTION__)); + } else { + PeiIpmiPpiinternal->TransportMaximumPayload -=3D 1; + DEBUG ((DEBUG_MANAGEABILITY_INFO, "%a: Transport interface for IPMI pr= otocol has maximum payload 0x%x.\n", __FUNCTION__, PeiIpmiPpiinternal->Tran= sportMaximumPayload)); + } + TransportName =3D HelperManageabilitySpecName (PeiIpmiPpiinternal->Trans= portToken->Transport->ManageabilityTransportSpecification); - DEBUG ((DEBUG_INFO, "%a: IPMI protocol over %s.\n", __FUNCTION__, Transp= ortName)); + DEBUG ((DEBUG_MANAGEABILITY_INFO, "%a: IPMI protocol over %s.\n", __FUNC= TION__, TransportName)); =20 // // Setup hardware information according to the transport interface. diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProto= col.c b/Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocol.c index 87a5436bdf..e4cd166b7a 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,8 +102,22 @@ 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_MANAGEABILITY_INFO, "%a: Transport interface maximum pay= load is undefined.\n", __FUNCTION__)); + } else { + TransportMaximumPayload -=3D 1; + DEBUG ((DEBUG_MANAGEABILITY_INFO, "%a: Transport interface for IPMI pr= otocol has maximum 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)); + DEBUG ((DEBUG_MANAGEABILITY_INFO, "%a: IPMI protocol over %s.\n", __FUNC= TION__, mTransportName)); =20 // // Setup hardware information according to the transport interface. --=20 2.37.1.windows.1