From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (NAM10-DM6-obe.outbound.protection.outlook.com [40.107.93.75]) by mx.groups.io with SMTP id smtpd.web10.930.1681964903148164500 for ; Wed, 19 Apr 2023 21:28:23 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=MzirbveW; 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.93.75, mailfrom: abdullateef.attar@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YBLGUf1pQxBhJUVQ+fKlu19kbAOIqNG/iSUYlLga0v07Z6kEd7NVTaj/GqjRS0rIV6lTrntmG3sT+wukFSHw4iL+WWA1FJ8ZagTy5Lp+Hn5ImrQc1+/NkpZ0FMJ7cArFzXUE3H57hmU/CypGpb0pJymy3g4g1Rx69YpOT93bIzFyQ8WjyUw68NRg7V/4zA6aETDgk3L/PIy2WNH51wZ/c9olH5fvXYBQbWRDaHnZYD9hrKr2aG+rtCoxgR8WgAYoOhfjTQO+HbMxECDFFLN4QHEdJCEEgMg8Sz8gaNO1fCajHf487ptakZX53PgwPz4qla71sJgPmBA+Er9d02rm6g== 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=uIz4Yyy9WDCLMZTmYu1DFcOROBhfvm1Am4/+NwbK04Q=; b=YzxOl8tVJQ7Qq4A0pBtKQgN2BAChovGQr+wjYOYLRx6VqjAAJNnsmu3c1W6DQs61EcNXspbXQL8qCQLG05nHrJ9M/UrVPWH3OH5Ml1iGztBlMuBBHeThsGAc2XtC8ICyJe9ziLfilTx4xsaftjhlze53e28ghTI9UJxR9XEf0r1/qkhelV2oOlOL6qa4SU/Bqq252+UePWB5RjGkKMJuJFTSLSb8H/xN7EoldDhCKpZdOsn858oCU13nJQSAqVMuRxJecc+iCHUKKOeSC+FEIsQppaHAAEBnbmRIt9UOIuUS9MnXSPu6whv/5O7BsnAT8Z0xOajebAke7fR4B2qUVA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; 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=uIz4Yyy9WDCLMZTmYu1DFcOROBhfvm1Am4/+NwbK04Q=; b=MzirbveWzgOr3IWUAKI3bInaO56nmc8C56EkGUXtKPDL7a2oqvOg8fWhikIOrKSr5oWNe8bcjXcPUZiFjgPcpcAUNDopblidQSH0Nc4WchoAjv0g7oR0wBliTsb7D22KhA/dwn8urgMgY9XfpukFWdA2via4sUCfoqnJV7V59Rw= Received: from PH7PR12MB6466.namprd12.prod.outlook.com (2603:10b6:510:1f6::22) by MN0PR12MB6031.namprd12.prod.outlook.com (2603:10b6:208:3cd::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.30; Thu, 20 Apr 2023 04:28:20 +0000 Received: from PH7PR12MB6466.namprd12.prod.outlook.com ([fe80::9837:e9ae:f203:bb7f]) by PH7PR12MB6466.namprd12.prod.outlook.com ([fe80::9837:e9ae:f203:bb7f%7]) with mapi id 15.20.6319.022; Thu, 20 Apr 2023 04:28:20 +0000 From: "Attar, AbdulLateef (Abdul Lateef)" To: "Chang, Abner" , "devel@edk2.groups.io" CC: Isaac Oram , Nickle Wang , Igor Kulchytskyy Subject: Re: [edk2-platforms][PATCH V2 02/14] ManageabilityPkg: Support Maximum Transfer Unit Thread-Topic: [edk2-platforms][PATCH V2 02/14] ManageabilityPkg: Support Maximum Transfer Unit Thread-Index: AQHZccWnKtwY0lud10iAQA1mhWTJFq8y5h7w Date: Thu, 20 Apr 2023 04:28:19 +0000 Message-ID: References: <20230418071543.1951-1-abner.chang@amd.com> <20230418071543.1951-3-abner.chang@amd.com> In-Reply-To: <20230418071543.1951-3-abner.chang@amd.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=6eda39fc-ecd1-4f6a-bfed-73e7dfbb71cc;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=0;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2023-04-19T17:31:53Z;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH7PR12MB6466:EE_|MN0PR12MB6031:EE_ x-ms-office365-filtering-correlation-id: b06eaa69-2ad4-458b-aadf-08db4157ab78 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: DKIOub7Os7KO8BfoTASp6ZV1Mea+UFloGehIyLlkhW3Zmak9e5Uj3uHBLeK65TFLqkcCqBi/dWOQpkLrDtXXOiL1LIv66xveo3jEbD8CejBKwHt7Wc4yjJcdVEPJadZpGZiVlI0hQ+Rluqm91wY+FlW9u/SAJkD39K+xP5dFZcKdK6r7eyOCvgIIyCa7GM4g9euuomq/SBSbTPexP479I4wYPsbh2cmgxuPfjZxHZbSocye2pyDGTxgx3p1GWf7hsT0RHeGkXW7KN2iq8KRpPKHUivoppYRJUAxMyv2bbT2227aX27zgjQvsC2T9UbaXfDWcIR84YvfWeEQ5lg2SHc5IEjmE2oMZ/lbno7AN85uZGVTqDnmXPG3Yma0rw1JFzr1L9jfAebxZXgFDrT0uZGoQeN+lh83DambA7ZgnPrayAS4xiDUrDkGSvlRp0565QvmgMc8UayGSApwJG4IprEkQxKSo1KPOd0tJCcqCSVH7K8jpBl3jeDEg9Eg6nWdqOd5l02o67aI5PwRBcVXVAgg/y9zrSbNMXQhlVBXBFgkbdb8Jo8RqWf/FqpuY9dXaADYtdZ5sOYUkGTL2ZrrD97mriPFXxhpzC8k+WYQYga4BK9ybTde8DJoiMfUARipQCjtn1W91r5aX544MwTZ5Jg== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH7PR12MB6466.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(376002)(366004)(346002)(396003)(39860400002)(136003)(451199021)(110136005)(9686003)(53546011)(26005)(6506007)(54906003)(55016003)(186003)(83380400001)(71200400001)(7696005)(5660300002)(38100700002)(8676002)(52536014)(316002)(38070700005)(8936002)(86362001)(41300700001)(122000001)(478600001)(66946007)(64756008)(66446008)(30864003)(66556008)(66476007)(4326008)(76116006)(2906002)(19627235002)(33656002)(579004)(44824005);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?QUwYP1X2aWwSDNW8O7kPK8p5xw6wdzLGE5XjMxAArRwYYZtDcGiLhuqltMrV?= =?us-ascii?Q?vIKW5Tj2MqRKNul/JLooxbhsCRg+/HIzgw2of9w6UJs8Ki16Wzhm3FId9GvN?= =?us-ascii?Q?s9Lj+Db89KVaDIjDQ2vnGN6d/tv4CoSlMs3LN0aYtuQxQ8s1wbHxqE6hpYTW?= =?us-ascii?Q?kamE1pA9SJ9DnaoiKMaNgeQPBfTm8hJbQ8Ef2aJ6fIK3qUvMn3Y8OletUbLn?= =?us-ascii?Q?ESi1SAMIO506MwjwyT1pzEOIKfT3WS7dfiqLh59Wky0TWC1EIm3rXhJlciba?= =?us-ascii?Q?wbrJRaUDZFfKV3H9Kl6lzcPhPbn/yo3oMf9ISg+U73vFd8h7jpe8PCVgFSSX?= =?us-ascii?Q?dqWqL/3eam/cyyxqvv9X1Z3x7m9RjPIpTl/sLUikcIjGZjXGybfh4rCm2+Tl?= =?us-ascii?Q?RXqaUG9rIotRbMhg0eHfIpdfx4bYp3Le5/pbCgt9gYi3Mh1kNrdygwzL6akI?= =?us-ascii?Q?vUt61bfcJSB2woSWMLGYILnPxC5mQLoGGpv/+BIoaW+C5a4VJY36DfkvZDGW?= =?us-ascii?Q?GfWSmYLCBWiJfh4tDzklQWp+xL9elxi4praKmYcmJSjdaHGocESsZUOHN6m0?= =?us-ascii?Q?G05/hq1Us7eU7WtbYVzdN4It3mWsNWroJZjAwA4v3ygu/6bcF6w6LI+HyxvM?= =?us-ascii?Q?MbB86zCtYcTmzZRzoTimJlkH/KVFYaFjvaXS9ml1S6cXOoUyUufE82ZlySEe?= =?us-ascii?Q?5f17HmutGAyVv3pXqoDk1xlLe36zAHuxOd4q2RHsLTVd2B0PP1JYHbdBy7Yx?= =?us-ascii?Q?2xqayTgceHc3+yziv8lR9l1KNHtQ1eNBcXJ0jx3GYV/mcQydO4DNMJgqau7+?= =?us-ascii?Q?oTZ9oJc3DPmSTBoy3JZjxWWx4xHEOv0mldkNvp5vKaxsyBOAiEbwsPGNNBRl?= =?us-ascii?Q?mmbCLQ7AKBFRg92xgFF85s5IaTmu2tL0zbe1FEUmN4Hp+s2W1CexNiTkMPjI?= =?us-ascii?Q?pSq4P09fTQvR0+oJH4nW6vED31e8TQnaK9Aiy1Kibbab81D5ZqBHkxWrvNkJ?= =?us-ascii?Q?b+w8sn/I/jgDtuerXhH1IjVFKOR6y8phnk9ynXErVEftnpMtfdmsqu1t2n37?= =?us-ascii?Q?8z4JHEsfia5xNZJKpxCKUvSUGouA2K/ZTTOQTiFTsBgzXYiMWW/0BfPoGUvA?= =?us-ascii?Q?KFwtxKOEZuT12XzVTlQUoVNzwqBPdaxRwcGJAEgT1jqgt/ebHHxuI/+3o4eF?= =?us-ascii?Q?OuU5biCcZuaDuqZCEHC09Dh9nxt/4DFRir1T/mDpERzlWmc530WQN5NC4/N/?= =?us-ascii?Q?zD7yUuRAwC92Ep5QVaVjKiqW2gNGyUAjdFuwNmRrQrRmQz5z//wPgq5QQmpn?= =?us-ascii?Q?d2Pac/TFiozsOiTgbcGo1OruhaoghgF2VYFdz7q52rwQrELV9IgoB4S9+ClB?= =?us-ascii?Q?U3CQa4v6IWBhdiczQTejWMSI9NDNKo918HwWeBA/dQdjkznFQOnIrgjJQqDK?= =?us-ascii?Q?Sjpxd4rDrOUw0t4rOJhOTDUohUSgdAub18vTJJvzCMdsOPW/a5lrq+5CG5X3?= =?us-ascii?Q?E78pqud1hzGVj8XbnQBbxzI0G/d1Acr3l8qgIs6zSl6R/1BdqQGdjknPRLxn?= =?us-ascii?Q?BQ6tMx7cgRyU7i8Btg4=3D?= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH7PR12MB6466.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b06eaa69-2ad4-458b-aadf-08db4157ab78 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Apr 2023 04:28:19.7218 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: HyV1zSjwIc2pazBPs/d6kyWcGI9qg01MzlZoCuQsux9AxrUoPc+VMTROOQCfUR7HoaZP/3ZS0WzqRmLEEr1Akw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6031 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable [AMD Official Use Only - General] Reviewed-by: Abdul Lateef Attar -----Original Message----- From: Chang, Abner Sent: 18 April 2023 12:46 To: devel@edk2.groups.io Cc: Isaac Oram ; Attar, AbdulLateef (Abdul Lateef) = ; Nickle Wang ; Igor Kulchyt= skyy Subject: [edk2-platforms][PATCH V2 02/14] ManageabilityPkg: Support Maximum= Transfer Unit From: Abner Chang Update GetTransportCapability to support Maximum Transfer Unit (MTU) of tra= nsport 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/ManageabilityTransportLi +++ b.h @@ -14,6 +14,9 @@ #define MANAGEABILITY_TRANSPORT_TOKEN_VERSION ((MANAGEABILITY_TRANS= PORT_TOKEN_VERSION_MAJOR << 8) |\ MANAGEABILITY_TRANSPORT_TO= KEN_VERSION_MINOR) +#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 /// /// Definitions of Manageability transport interface functions. @@ -187,15 +199,20 @@ AcquireTransportSession ( ); /** - 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 ); 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/Com +++ mon/ManageabilityTransportKcs.h @@ -32,6 +32,8 @@ typedef struct { #define IPMI_KCS_GET_STATE(s) (s >> 6) #define IPMI_KCS_SET_STATE(s) (s= << 6) +#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/IpmiPpiIntern +++ al.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) 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; #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/BaseManageabilityTransportNullLi +++ b/BaseManageabilityTransportNull.c @@ -31,19 +31,25 @@ AcquireTransportSession ( } /** - 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 ) { *TransportCapability =3D 0; + return EFI_SUCCESS; } /** 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 +++ /ManageabilityTransportKcs.c @@ -62,7 +62,7 @@ KcsTransportInit ( } 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 + provided, 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); - 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", + mKcsHardwareInfo.IoStatusAddress.IoAddress16)); } return EFI_SUCCESS; @@ -221,7 +221,7 @@ KcsTransportTransmitReceive ( EFI_STATUS Status; MANAGEABILITY_IPMI_TRANSPORT_HEADER *TransmitHeader; - 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 ( } /** - 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; } /** 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 @@ #include "IpmiProtocolCommon.h" -MANAGEABILITY_TRANSPORT_TOKEN *mTransportToken =3D NULL; -CHAR16 *mTransportName; - +MANAGEABILITY_TRANSPORT_TOKEN *mTransportToken =3D NULL; +CHAR16 *mTransportName; +UINT32 TransportMaximumPayload; MANAGEABILITY_TRANSPORT_HARDWARE_INFORMATION mHardwareInformation; /** @@ -92,8 +92,6 @@ DxeIpmiEntry ( MANAGEABILITY_TRANSPORT_CAPABILITY TransportCapability; MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS TransportAdditionalStatus; - GetTransportCapability (&TransportCapability); - Status =3D HelperAcquireManageabilityTransport ( &gManageabilityProtocolIpmiGuid, &mTransportToken @@ -103,8 +101,22 @@ DxeIpmiEntry ( 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_CAPABILITY (TransportCapability= ); if (TransportMaximumPayload =3D=3D (1 << MANAGEABILITY_TRANSPORT_CAPABI= LITY_MAXIMUM_PAYLOAD_NOT_AVAILABLE)) { + DEBUG ((DEBUG_MANAGEABILITY_INFO, "%a: Transport interface maximum + payload is undefined.\n", __FUNCTION__)); } else { + TransportMaximumPayload -=3D 1; + DEBUG ((DEBUG_MANAGEABILITY_INFO, "%a: Transport interface for IPMI + protocol 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", + __FUNCTION__, mTransportName)); // // 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; } @@ -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; - 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 + (EFI_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; } - PeiIpmiPpiinternal->Signature =3D MANAGEABILITY_IPMI_PPI_INTERNAL_SIGNAT= URE; + PeiIpmiPpiinternal->Signature =3D MANAGEABILITY_IPMI_= PPI_INTERNAL_SIGNATURE; PeiIpmiPpiinternal->PeiIpmiPpi.IpmiSubmitCommand =3D PeiIpmiSubmitComman= d; PpiDescriptor->Flags =3D EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRI= PTOR_TERMINATE_LIST; PpiDescriptor->Guid =3D &gPeiIpmiPpiGuid; PpiDescriptor->Ppi =3D &PeiIpmiPpiinternal->PeiIpmiPpi; - GetTransportCapability (&TransportCapability); Status =3D HelperAcquireManageabilityTransport ( &gManageabilityProtocolIpmiGuid, &PeiIpmiPpiinternal->TransportToken @@ -119,8 +118,22 @@ PeiIpmiEntry ( 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_MANAGEABILITY_INFO, "%a: Transport interface maximum + payload is undefined.\n", __FUNCTION__)); } else { + PeiIpmiPpiinternal->TransportMaximumPayload -=3D 1; + DEBUG ((DEBUG_MANAGEABILITY_INFO, "%a: Transport interface for IPMI + protocol has maximum payload 0x%x.\n", __FUNCTION__, + PeiIpmiPpiinternal->TransportMaximumPayload)); + } + 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", + __FUNCTION__, TransportName)); // // 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 @@ #include "IpmiProtocolCommon.h" -MANAGEABILITY_TRANSPORT_TOKEN *mTransportToken =3D NULL; -CHAR16 *mTransportName; - +MANAGEABILITY_TRANSPORT_TOKEN *mTransportToken =3D NULL; +CHAR16 *mTransportName; +UINT32 TransportMaximumPayload; MANAGEABILITY_TRANSPORT_HARDWARE_INFORMATION mHardwareInformation; /** @@ -93,8 +93,6 @@ SmmIpmiEntry ( MANAGEABILITY_TRANSPORT_CAPABILITY TransportCapability; MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS TransportAdditionalStatus; - GetTransportCapability (&TransportCapability); - Status =3D HelperAcquireManageabilityTransport ( &gManageabilityProtocolIpmiGuid, &mTransportToken @@ -104,8 +102,22 @@ SmmIpmiEntry ( 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_CAPABILITY (TransportCapability= ); if (TransportMaximumPayload =3D=3D (1 << MANAGEABILITY_TRANSPORT_CAPABI= LITY_MAXIMUM_PAYLOAD_NOT_AVAILABLE)) { + DEBUG ((DEBUG_MANAGEABILITY_INFO, "%a: Transport interface maximum + payload is undefined.\n", __FUNCTION__)); } else { + TransportMaximumPayload -=3D 1; + DEBUG ((DEBUG_MANAGEABILITY_INFO, "%a: Transport interface for IPMI + protocol 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", + __FUNCTION__, mTransportName)); // // Setup hardware information according to the transport interface. -- 2.37.1.windows.1