From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.80]) by mx.groups.io with SMTP id smtpd.web11.5088.1682054602123185274 for ; Thu, 20 Apr 2023 22:23:22 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amd.com header.s=selector1 header.b=TWnP+my4; 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.244.80, mailfrom: abner.chang@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dhqXx/1eO2V1uabHuobqvzh/cE1CVP6v3jo9jyVXnBgkNa3SVZAgmzS3DGz7mk4/ex8quZ/ULAYFS4P3bqmXyXfDCAHeH/su2rgy1vykv9im2pstN1xYIrmkWWWfXLnNYi3ioRyaEiFtiYUT5OoaKDbf9Lh7PQgD7t9z2BQ9J9QXuUAz5T76t63wLZARc+zP9JBf0p+R1RhPjOek/iI95rNBrD2FK86gpVrY55E5EXz9NVvxVWyB6dWMwkJzsN55qj1407S/TBa60SWIGNWP4BkBSBxomaJjVzkYIPJ2uy5yHpzl80CEAPp5J2Uyj5qnVZGsndhE/DW33LpUS3OV8Q== 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=lliK6M9g0NEOwZ3h6I6OU7w5fl9Ep5Pj80zGzuhsaow=; b=oS/tVW9eCqcJdVuWrrFNhhbIkqRf3F75z3Ja3dgrYbS5qPHg0195GnwMJYWtKAHt0F3aQaduwLlhzN/yjR7nGm1ZaZ5Y0waUq3QtmsjQ6It3oAP2GBn0X+krcNA2EwXJKA1p6UnoIVLaNIO0JN8P1HBdlwQ9ir/c6nzwR/7DI+6J3SHtnUTxN7ndKRPg1UF/Wt9wJuNX+B4I5wN18/4Yq2zGjan6egvvHDB1xGzCKnPs+zstAvwUOgmaItbeGMraHXntiM57Fw1hSjWy5pA/80oOEZylwXBJisWGJ22kHOTkpdrJvSgC35znByRjxQwcinUU3ie3e/QS3xmw3ZfWTw== 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=lliK6M9g0NEOwZ3h6I6OU7w5fl9Ep5Pj80zGzuhsaow=; b=TWnP+my4cpJ3QJw+u6ANwqSY7HnRceepk+aPz+VNxl//Vameti+g2MdjDOTxpLELtMVZIM3DAT5qeeM9MYflkFheIxcgvXOLUsAkj+a4Ek28TbwSpDivSyu3YPFve+HEwWioPi1fp7XSWG0fTSqtCAVbzQM2VQf3sIb/X3+X/w4= Received: from DM5PR07CA0101.namprd07.prod.outlook.com (2603:10b6:4:ae::30) by DS0PR12MB8343.namprd12.prod.outlook.com (2603:10b6:8:fd::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.45; Fri, 21 Apr 2023 05:23:19 +0000 Received: from DS1PEPF0000B078.namprd05.prod.outlook.com (2603:10b6:4:ae:cafe::8a) by DM5PR07CA0101.outlook.office365.com (2603:10b6:4:ae::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.25 via Frontend Transport; Fri, 21 Apr 2023 05:23:19 +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 DS1PEPF0000B078.mail.protection.outlook.com (10.167.17.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6319.16 via Frontend Transport; Fri, 21 Apr 2023 05:23:19 +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; Fri, 21 Apr 2023 00:23:16 -0500 From: "Chang, Abner" To: CC: Isaac Oram , Abdul Lateef Attar , Nickle Wang , Igor Kulchytskyy Subject: [edk2-platforms][PATCH V3 02/14] ManageabilityPkg: Support Maximum Transfer Unit Date: Fri, 21 Apr 2023 13:22:35 +0800 Message-ID: <20230421052247.1520-3-abner.chang@amd.com> X-Mailer: git-send-email 2.37.1.windows.1 In-Reply-To: <20230421052247.1520-1-abner.chang@amd.com> References: <20230421052247.1520-1-abner.chang@amd.com> MIME-Version: 1.0 Return-Path: Abner.Chang@amd.com X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000B078:EE_|DS0PR12MB8343:EE_ X-MS-Office365-Filtering-Correlation-Id: e9b70098-e7c2-484e-65a7-08db4228849a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eJtCB5R6F4i1cUDpemtf9ja/VR5MgRIpkvupXxxUoLPHnm5f0FPul8oDT/3nxWPKMBfe+fyAERBdOS1hUKry539eIoZfhL0/pxjXhN4du8inw1Eb+O0qKa8JBf+fb5AenJD0b5PRj7G1fIEdvfNmJIDtl1On47SxCl7bzpUU2VQdYnbA61UL5VFwjNbQnOXn3BYUBezLgbH0/LpMcm3H5l+TkYVEM2sdS3kAF71S63Nza9UajZ54QX/0VaDTuPoW/isAR9ZJeJRG9SW0khkd/P5iyKp6u+TdcF0USfk84afxS1EUfXSq3aOzpCpAKAh/VNT4oXU9+gzxjTyDsCaWFoYs8OWq5xocMQFaIZV0HRcNlSrHpwm/okT45YFddqJOf1gw2vSNTutM780pUmQ3X7JssHC0nF6xI2uGsv4BrACViwPZSMhFPCacWuDQRXtvuYxB3fpMTzC+ZDedgo3LCdbSLSjoAeXD/+dehyFtRJe297q0YmutwnwzakGJRM7HxS6Ke8aN8SPor3e8FhH8KsnbMrgT/lECFRIvs7z54VrxZByYTR5g9xsu7EjeehbmI2QgaCrISEULX+pb5yFoua36kMILZdBUYFeiKgUT2IzX7JX4oZsfHsdqj0V3S9dCYDQOoG5S5t+kn2JTgLDF0dPvDO63KAK3sBkbPNctxZg5pquIC8C/E20G5Kiv8Mgt1bMi4e0bVMwZ+ikjIu1bt+HA1sDh8bcvl8pGxVBXTSSQLo9POJeFbSbAxbPwx6pD 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)(39860400002)(346002)(396003)(451199021)(46966006)(40470700004)(36840700001)(8936002)(6916009)(4326008)(316002)(19627235002)(54906003)(70586007)(70206006)(7696005)(478600001)(41300700001)(2876002)(6666004)(40480700001)(5660300002)(82310400005)(8676002)(356005)(30864003)(82740400003)(86362001)(2906002)(36756003)(47076005)(336012)(2616005)(426003)(26005)(1076003)(40460700003)(186003)(36860700001)(16526019)(83380400001)(81166007)(36900700001)(44824005);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Apr 2023 05:23:19.3111 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e9b70098-e7c2-484e-65a7-08db4228849a 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: DS1PEPF0000B078.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8343 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 Reviewed-by: Abdul Lateef Attar Reviewed-by: Nickle Wang --- .../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