From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (NAM10-BN7-obe.outbound.protection.outlook.com [40.107.92.109]) by mx.groups.io with SMTP id smtpd.web11.6128.1682061250151187058 for ; Fri, 21 Apr 2023 00:14:10 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="no key for verify" header.i=@amperemail.onmicrosoft.com header.s=selector1-amperemail-onmicrosoft-com header.b=TSfO0A8c; spf=pass (domain: os.amperecomputing.com, ip: 40.107.92.109, mailfrom: tinhnguyen@os.amperecomputing.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CE5Fwj2DAXK5HraTT8UE/GH+WCq963e1fJfYJV2iWNAtkU+mnfPp6x8NWD9hSaYTaZXMZwGoxoMkAGOwpFnsdFbF9vMFTEoSiL2zyJVvaIed1hrQnbBlWPMPrTrK54L6f8lSIp1igvX+vMVySyVUc9DyOHhKeMu8vhjv6xUOIup3qsLly4qlAUXnq8mPW6k6JRnQnaFiVmoD+TjYBo4eIWNumq8kTDLHPFXuB6ulCNqPiujIKBssEDFE0lU6Ns24qissLeY4xq1jA00iBweVjHtAWeo4+MebSb9Me1Y5getms5d9Aus08Xncdi++ySwg4gxlWycYnxTbrhBJH2h5kQ== 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=E3AVaYfXDiT/Rocc0MksRPu7sBybNeUFmZr5ugNyg/U=; b=DpEIA03g8Q5jp/LA+Jh2tB4OPHLplUbOfkRqSjPW+w4i96zBdr4AwjTEzMvuvD/5e1mnDG7kJdelUnYAW9u0DJmzjzCsJGs0f21Gdw1o8JwnfdEY7ijuvCuhk4pYOhHLC3LjQgLLCp7jEyZdsG+b21NBkan4fGtvxFSi7CodLgGxRFfEH2EOoqIGBL/GDQgFWN+Pa1R2JsD4vfunwJq6pKelGwpIEwIaqgY7gl56c2qB+e591WEPlgGQsmdIRGy8LQ7sR6dVHA8+YShQv5bmpMlgLrbXdxgOidotU/mIdL9hWUQ05Z/C7tRfSsb7y3HtFZ0MgtvFa4e1G0Q0GqlmxA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=amperemail.onmicrosoft.com; dkim=pass header.d=amperemail.onmicrosoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amperemail.onmicrosoft.com; s=selector1-amperemail-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=E3AVaYfXDiT/Rocc0MksRPu7sBybNeUFmZr5ugNyg/U=; b=TSfO0A8cMvbkNQNwN9B8cvv6Sc7ib4qQYXEN2E/RF1GIZBhEcTwWQcEovtfLk5m2/J0DvBlA8eT63kOVAiv2gAlpZiu5hrBZ/91etsRfszsEuymWpcEt9byXliNm6XJnh92rqbfMa/YnJGLpMTSgynjEc+JiI2fvBzQ3obeipBc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amperemail.onmicrosoft.com; Received: from DM5PR0102MB3336.prod.exchangelabs.com (2603:10b6:4:9f::11) by BL0PR01MB4065.prod.exchangelabs.com (2603:10b6:208:40::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6340.11; Fri, 21 Apr 2023 07:14:04 +0000 Received: from DM5PR0102MB3336.prod.exchangelabs.com ([fe80::bb9e:46d1:ae4b:caf2]) by DM5PR0102MB3336.prod.exchangelabs.com ([fe80::bb9e:46d1:ae4b:caf2%7]) with mapi id 15.20.6340.011; Fri, 21 Apr 2023 07:14:04 +0000 Message-ID: Date: Fri, 21 Apr 2023 14:13:54 +0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [edk2-devel] [edk2-platforms][PATCH V3 02/14] ManageabilityPkg: Support Maximum Transfer Unit To: devel@edk2.groups.io, abner.chang@amd.com Cc: Isaac Oram , Abdul Lateef Attar , Nickle Wang , Igor Kulchytskyy References: <20230421052247.1520-1-abner.chang@amd.com> <20230421052247.1520-3-abner.chang@amd.com> From: "Tinh Nguyen" In-Reply-To: <20230421052247.1520-3-abner.chang@amd.com> X-ClientProxiedBy: SI1PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:1f5::18) To DM5PR0102MB3336.prod.exchangelabs.com (2603:10b6:4:9f::11) Return-Path: tinhnguyen@os.amperecomputing.com MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR0102MB3336:EE_|BL0PR01MB4065:EE_ X-MS-Office365-Filtering-Correlation-Id: 2dadec64-8255-4121-d2f7-08db4237fd21 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: f9/0OwTflKYK1d7NM5FDOcnt8BcP0Wm3o9t91kW0iW8CjE53VNiyWI721h0FsN3dSh58AEIMfUdKzegPQ2zLL1gGR6VAQRA1f7GoaxF1Udzgee0WthGlPOBa73FvC1386XXs2bp/ZEdzxpjPvjugHa5Fprde8vTIh6a45NRCodoEfPMJt4bhRedhWKezUV/pVcmHmLMGnMigvkqr0nZEPlLF6R15Lh0TQWxohDgAZACxmCAwYahHLCLA6V1YULJtqEWFFf/blG2Hn5pfwbq5q3Fezi0tXe2xBeYjxQwpDA6EStYntuLSrQvxkZYIx/qgcqt07NnA0EbdYP5aVfSxn1ZJJLzQCbPnMwYt+sPWY5t0m27xsriqQhZjZ4U4C4B6nU4QGaE8wsIR5bWFblJkMt4kZU0QE8zu1utuW4vizD5Nm3zF53cr/mGAOABHxuT3c7WtEmo9nInoy+HDWubgSROYG1bEMdulUyZ3GMjmKIp0l5pVlnW9k00kJUkE+dU7DjV2bka1I0T+WV22jCCtFbUZFwCXW+jbouVy1BoEzizfb+2j1Eeu2/THJcMl76cJPoXS8Rb0oQPd4aVWBLRQkc2a04cHnQUdrFVtrTfrV64xzT/trqUojWLvG+rP3lak2OlD3vBxCTP12rdSp1P/sw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR0102MB3336.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(136003)(376002)(366004)(346002)(39850400004)(451199021)(316002)(66476007)(66946007)(66556008)(4326008)(478600001)(19627235002)(31696002)(6666004)(6486002)(83170400001)(5660300002)(2616005)(8936002)(8676002)(42882007)(2906002)(30864003)(83380400001)(38100700002)(54906003)(31686004)(53546011)(26005)(41300700001)(186003)(6512007)(6506007)(43740500002)(44824005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ZngxTmlFK2pEemVzZkw0TkNvNitvb0FMUDVRYUl5R1Vocmo4MTlubCtyaXdK?= =?utf-8?B?WVlVMUpsbzI3VUt0dVRmR2FNVHVwT1NEclg5bVhHODkyRnlxRTluVkR3V3Q1?= =?utf-8?B?YkhlR2NBWklENWV6alZURTJVWlRRWXlNTmJyMzFuN1orVllmQ05ZL2ZGSFNR?= =?utf-8?B?WHM1blAxalNkWGdoNyttd1BJRVZMTzlBVlVXNEltMmJzVGF0bWUybVpnWUJw?= =?utf-8?B?ZG0vNDZ5dVBFVXJDUzVTVmNFYXg0QzE4eWkvT2xnSS9va0RMajlvODlYNjZF?= =?utf-8?B?by96UnRtb2M4L05FQXgvV1lwdWhjSGpZcit4UmcwVTA2VGF2LzU0MFg5a1B6?= =?utf-8?B?bmNtb3dxZmRTSU5vUGlpbWUxbmtI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= =?utf-8?Q?1DgWNxnuiQxXY8aqUqRigTk=3D?= X-OriginatorOrg: amperemail.onmicrosoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2dadec64-8255-4121-d2f7-08db4237fd21 X-MS-Exchange-CrossTenant-AuthSource: DM5PR0102MB3336.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Apr 2023 07:14:04.3603 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: AGGwe6/iLsyt2arCwtJ1B7Ya4GohS5FwU2dkuMAlcUMGK+TfNr5gGblhpA6FNPBH4IMy+IBSC+hUC++cQj9VHgnQjjinyk/BS6455VavhbVoELRg0g6Y7iTvSm+Y9ipO X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR01MB4065 Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Reviewed-by: Tinh Nguyen On 4/21/2023 12:22 PM, Chang, Abner via groups.io wrote: > 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/ManageabilityTransportLib.h b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.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_TRANSPORT_TOKEN_VERSION_MAJOR << 8) |\ > MANAGEABILITY_TRANSPORT_TOKEN_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_TRANSPORT_FUNCTION_V1_0; > typedef struct _MANAGEABILITY_TRANSPORT MANAGEABILITY_TRANSPORT; > typedef struct _MANAGEABILITY_TRANSPORT_TOKEN MANAGEABILITY_TRANSPORT_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 0x00000001 > -#define MANAGEABILITY_TRANSPORT_CAPABILITY_ASYNCHRONOUS_TRANSFER 0x00000002 > +/// Bit 1 > +#define MANAGEABILITY_TRANSPORT_CAPABILITY_ASYNCHRONOUS_TRANSFER 0x00000002 > +/// 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 capabilities. > - 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 manageability > + transport library. > + @param [out] TransportFeature Pointer to receive transport capabilities. > + See the definitions of > + MANAGEABILITY_TRANSPORT_CAPABILITY. > + @retval EFI_SUCCESS TransportCapability is returned successfully. > + @retval EFI_INVALID_PARAMETER TransportToken is not a valid token. > **/ > -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/ManageabilityTransportKcsLib/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) > > +#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/IpmiPpiInternal.h b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiInternal.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) > > 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/BaseManageabilityTransportNullLib/BaseManageabilityTransportNull.c b/Features/ManageabilityPkg/Library/BaseManageabilityTransportNullLib/BaseManageabilityTransportNull.c > index 49fc8c0f71..3aa68578a6 100644 > --- a/Features/ManageabilityPkg/Library/BaseManageabilityTransportNullLib/BaseManageabilityTransportNull.c > +++ b/Features/ManageabilityPkg/Library/BaseManageabilityTransportNullLib/BaseManageabilityTransportNull.c > @@ -31,19 +31,25 @@ AcquireTransportSession ( > } > > /** > - This function returns the transport capabilities. > - > - @param [out] TransportFeature Pointer to receive transport capabilities. > - 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 manageability > + transport library. > + @param [out] TransportFeature Pointer to receive transport capabilities. > + See the definitions of > + MANAGEABILITY_TRANSPORT_CAPABILITY. > + @retval EFI_SUCCESS TransportCapability is returned successfully. > + @retval EFI_INVALID_PARAMETER TransportToken is not a valid token. > **/ > -VOID > +EFI_STATUS > GetTransportCapability ( > + IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken, > OUT MANAGEABILITY_TRANSPORT_CAPABILITY *TransportCapability > ) > { > *TransportCapability = 0; > + return EFI_SUCCESS; > } > > /** > diff --git a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/ManageabilityTransportKcs.c b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/ManageabilityTransportKcs.c > index ab416e5449..7d85378fc1 100644 > --- a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/ManageabilityTransportKcs.c > +++ b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/ManageabilityTransportKcs.c > @@ -62,7 +62,7 @@ KcsTransportInit ( > } > > if (HardwareInfo.Kcs == NULL) { > - DEBUG ((DEBUG_INFO, "%a: Hardware information is not provided, use dfault settings.\n", __FUNCTION__)); > + DEBUG ((DEBUG_MANAGEABILITY_INFO, "%a: Hardware information is not provided, use dfault settings.\n", __FUNCTION__)); > mKcsHardwareInfo.MemoryMap = MANAGEABILITY_TRANSPORT_KCS_IO_MAP_IO; > mKcsHardwareInfo.IoBaseAddress.IoAddress16 = PcdGet16 (PcdIpmiKcsIoBaseAddress); > mKcsHardwareInfo.IoDataInAddress.IoAddress16 = mKcsHardwareInfo.IoBaseAddress.IoAddress16 + IPMI_KCS_DATA_IN_REGISTER_OFFSET; > @@ -81,21 +81,21 @@ KcsTransportInit ( > // Get protocol specification name. > ManageabilityProtocolName = HelperManageabilitySpecName (TransportToken->ManageabilityProtocolSpecification); > > - DEBUG ((DEBUG_INFO, "%a: KCS transport hardware for %s is:\n", __FUNCTION__, 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", mKcsHardwareInfo.IoBaseAddress.IoAddress32)); > + DEBUG ((DEBUG_MANAGEABILITY_INFO, "Data in Address : 0x%08x\n", mKcsHardwareInfo.IoDataInAddress.IoAddress32)); > + DEBUG ((DEBUG_MANAGEABILITY_INFO, "Data out Address : 0x%08x\n", mKcsHardwareInfo.IoDataOutAddress.IoAddress32)); > + DEBUG ((DEBUG_MANAGEABILITY_INFO, "Command Address : 0x%08x\n", mKcsHardwareInfo.IoCommandAddress.IoAddress32)); > + DEBUG ((DEBUG_MANAGEABILITY_INFO, "Status Address : 0x%08x\n", mKcsHardwareInfo.IoStatusAddress.IoAddress32)); > } else { > - DEBUG ((DEBUG_INFO, "I/O Map I/O\n")); > - DEBUG ((DEBUG_INFO, "Base I/O port : 0x%04x\n", mKcsHardwareInfo.IoBaseAddress.IoAddress16)); > - DEBUG ((DEBUG_INFO, "Data in I/O port : 0x%04x\n", mKcsHardwareInfo.IoDataInAddress.IoAddress16)); > - DEBUG ((DEBUG_INFO, "Data out I/O port: 0x%04x\n", mKcsHardwareInfo.IoDataOutAddress.IoAddress16)); > - DEBUG ((DEBUG_INFO, "Command I/O port : 0x%04x\n", mKcsHardwareInfo.IoCommandAddress.IoAddress16)); > - DEBUG ((DEBUG_INFO, "Status I/O port : 0x%04x\n", mKcsHardwareInfo.IoStatusAddress.IoAddress16)); > + DEBUG ((DEBUG_MANAGEABILITY_INFO, "I/O Map I/O\n")); > + DEBUG ((DEBUG_MANAGEABILITY_INFO, "Base I/O port : 0x%04x\n", mKcsHardwareInfo.IoBaseAddress.IoAddress16)); > + DEBUG ((DEBUG_MANAGEABILITY_INFO, "Data in I/O port : 0x%04x\n", mKcsHardwareInfo.IoDataInAddress.IoAddress16)); > + DEBUG ((DEBUG_MANAGEABILITY_INFO, "Data out I/O port: 0x%04x\n", mKcsHardwareInfo.IoDataOutAddress.IoAddress16)); > + DEBUG ((DEBUG_MANAGEABILITY_INFO, "Command I/O port : 0x%04x\n", mKcsHardwareInfo.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 == NULL || TransferToken == NULL) { > + if ((TransportToken == NULL) || (TransferToken == 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_TRANSPORT_KCS\n", __FUNCTION__)); > return EFI_OUT_OF_RESOURCES; > } > + > KcsTransportToken->Token.Transport = AllocateZeroPool (sizeof (MANAGEABILITY_TRANSPORT)); > if (KcsTransportToken->Token.Transport == NULL) { > FreePool (KcsTransportToken); > @@ -329,21 +330,29 @@ AcquireTransportSession ( > } > > /** > - This function returns the transport capabilities. > - > - @param [out] TransportFeature Pointer to receive transport capabilities. > - 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 manageability > + transport library. > + @param [out] TransportFeature Pointer to receive transport capabilities. > + See the definitions of > + MANAGEABILITY_TRANSPORT_CAPABILITY. > + @retval EFI_SUCCESS TransportCapability is returned successfully. > + @retval EFI_INVALID_PARAMETER TransportToken is not a valid token. > **/ > -VOID > +EFI_STATUS > GetTransportCapability ( > + IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken, > OUT MANAGEABILITY_TRANSPORT_CAPABILITY *TransportCapability > ) > { > - if (TransportCapability != NULL) { > - *TransportCapability = 0; > + if ((TransportToken == NULL) || (TransportCapability == NULL)) { > + return EFI_INVALID_PARAMETER; > } > + > + *TransportCapability = 0; > + return EFI_SUCCESS; > } > > /** > diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocol.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 = NULL; > -CHAR16 *mTransportName; > - > +MANAGEABILITY_TRANSPORT_TOKEN *mTransportToken = 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 = HelperAcquireManageabilityTransport ( > &gManageabilityProtocolIpmiGuid, > &mTransportToken > @@ -103,8 +101,22 @@ DxeIpmiEntry ( > return Status; > } > > + Status = GetTransportCapability (mTransportToken, &TransportCapability); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: Failed to GetTransportCapability().\n", __FUNCTION__)); > + return Status; > + } > + > + TransportMaximumPayload = MANAGEABILITY_TRANSPORT_PAYLOAD_SIZE_FROM_CAPABILITY (TransportCapability); > + if (TransportMaximumPayload == (1 << MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_NOT_AVAILABLE)) { > + DEBUG ((DEBUG_MANAGEABILITY_INFO, "%a: Transport interface maximum payload is undefined.\n", __FUNCTION__)); > + } else { > + TransportMaximumPayload -= 1; > + DEBUG ((DEBUG_MANAGEABILITY_INFO, "%a: Transport interface for IPMI protocol has maximum payload %x.\n", __FUNCTION__, TransportMaximumPayload)); > + } > + > mTransportName = HelperManageabilitySpecName (mTransportToken->Transport->ManageabilityTransportSpecification); > - DEBUG ((DEBUG_INFO, "%a: IPMI protocol over %s.\n", __FUNCTION__, mTransportName)); > + 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 = MANAGEABILITY_IPMI_PPI_INTERNAL_FROM_LINK(This); > - Status = CommonIpmiSubmitCommand ( > - PeiIpmiPpiinternal->TransportToken, > - NetFunction, > - Command, > - RequestData, > - RequestDataSize, > - ResponseData, > - ResponseDataSize > - ); > + EFI_STATUS Status; > + PEI_IPMI_PPI_INTERNAL *PeiIpmiPpiinternal; > + > + PeiIpmiPpiinternal = MANAGEABILITY_IPMI_PPI_INTERNAL_FROM_LINK (This); > + Status = 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 = (PEI_IPMI_PPI_INTERNAL *)AllocateZeroPool (sizeof(PEI_IPMI_PPI_INTERNAL)); > + PeiIpmiPpiinternal = (PEI_IPMI_PPI_INTERNAL *)AllocateZeroPool (sizeof (PEI_IPMI_PPI_INTERNAL)); > if (PeiIpmiPpiinternal == NULL) { > DEBUG ((DEBUG_ERROR, "%a: Not enough memory for PEI_IPMI_PPI_INTERNAL.\n", __FUNCTION__)); > return EFI_OUT_OF_RESOURCES; > } > - PpiDescriptor = (EFI_PEI_PPI_DESCRIPTOR *)AllocateZeroPool (sizeof(EFI_PEI_PPI_DESCRIPTOR)); > + > + PpiDescriptor = (EFI_PEI_PPI_DESCRIPTOR *)AllocateZeroPool (sizeof (EFI_PEI_PPI_DESCRIPTOR)); > if (PpiDescriptor == NULL) { > DEBUG ((DEBUG_ERROR, "%a: Not enough memory for EFI_PEI_PPI_DESCRIPTOR.\n", __FUNCTION__)); > return EFI_OUT_OF_RESOURCES; > } > > - PeiIpmiPpiinternal->Signature = MANAGEABILITY_IPMI_PPI_INTERNAL_SIGNATURE; > + PeiIpmiPpiinternal->Signature = MANAGEABILITY_IPMI_PPI_INTERNAL_SIGNATURE; > PeiIpmiPpiinternal->PeiIpmiPpi.IpmiSubmitCommand = PeiIpmiSubmitCommand; > > PpiDescriptor->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST; > PpiDescriptor->Guid = &gPeiIpmiPpiGuid; > PpiDescriptor->Ppi = &PeiIpmiPpiinternal->PeiIpmiPpi; > > - GetTransportCapability (&TransportCapability); > Status = HelperAcquireManageabilityTransport ( > &gManageabilityProtocolIpmiGuid, > &PeiIpmiPpiinternal->TransportToken > @@ -119,8 +118,22 @@ PeiIpmiEntry ( > return Status; > } > > + Status = GetTransportCapability (PeiIpmiPpiinternal->TransportToken, &PeiIpmiPpiinternal->TransportCapability); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: Failed to GetTransportCapability().\n", __FUNCTION__)); > + return Status; > + } > + > + PeiIpmiPpiinternal->TransportMaximumPayload = MANAGEABILITY_TRANSPORT_PAYLOAD_SIZE_FROM_CAPABILITY (PeiIpmiPpiinternal->TransportCapability); > + if (PeiIpmiPpiinternal->TransportMaximumPayload == (1 << MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_NOT_AVAILABLE)) { > + DEBUG ((DEBUG_MANAGEABILITY_INFO, "%a: Transport interface maximum payload is undefined.\n", __FUNCTION__)); > + } else { > + PeiIpmiPpiinternal->TransportMaximumPayload -= 1; > + DEBUG ((DEBUG_MANAGEABILITY_INFO, "%a: Transport interface for IPMI protocol has maximum payload 0x%x.\n", __FUNCTION__, PeiIpmiPpiinternal->TransportMaximumPayload)); > + } > + > TransportName = HelperManageabilitySpecName (PeiIpmiPpiinternal->TransportToken->Transport->ManageabilityTransportSpecification); > - DEBUG ((DEBUG_INFO, "%a: IPMI protocol over %s.\n", __FUNCTION__, TransportName)); > + 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/IpmiProtocol.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 = NULL; > -CHAR16 *mTransportName; > - > +MANAGEABILITY_TRANSPORT_TOKEN *mTransportToken = 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 = HelperAcquireManageabilityTransport ( > &gManageabilityProtocolIpmiGuid, > &mTransportToken > @@ -104,8 +102,22 @@ SmmIpmiEntry ( > return Status; > } > > + Status = GetTransportCapability (mTransportToken, &TransportCapability); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: Failed to GetTransportCapability().\n", __FUNCTION__)); > + return Status; > + } > + > + TransportMaximumPayload = MANAGEABILITY_TRANSPORT_PAYLOAD_SIZE_FROM_CAPABILITY (TransportCapability); > + if (TransportMaximumPayload == (1 << MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_NOT_AVAILABLE)) { > + DEBUG ((DEBUG_MANAGEABILITY_INFO, "%a: Transport interface maximum payload is undefined.\n", __FUNCTION__)); > + } else { > + TransportMaximumPayload -= 1; > + DEBUG ((DEBUG_MANAGEABILITY_INFO, "%a: Transport interface for IPMI protocol has maximum payload 0x%x.\n", __FUNCTION__, TransportMaximumPayload)); > + } > + > mTransportName = HelperManageabilitySpecName (mTransportToken->Transport->ManageabilityTransportSpecification); > - DEBUG ((DEBUG_INFO, "%a: IPMI protocol over %s.\n", __FUNCTION__, mTransportName)); > + DEBUG ((DEBUG_MANAGEABILITY_INFO, "%a: IPMI protocol over %s.\n", __FUNCTION__, mTransportName)); > > // > // Setup hardware information according to the transport interface.