From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (NAM11-BN8-obe.outbound.protection.outlook.com [40.107.236.41]) by mx.groups.io with SMTP id smtpd.web10.26451.1683619013663067821 for ; Tue, 09 May 2023 00:56:54 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amd.com header.s=selector1 header.b=VnzDfikS; 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.236.41, mailfrom: abner.chang@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UlfgEZp30/2r9F4yIebFcDR/pFuqf1qDC0SQ/GScesdydb6RwWtPi51g7QmIHr3ZMeXMNor2WA3WA2sCrg+WsEf0hbQzi6agPCDClaoiwKNWnRUrSsys+RyDaK16ntLLy1oE6NgcF6KxtCf4g5sigxTbLqpdifn8NZrViXNWzJbCzkJCGF2aVsu/TBg8ojfRnDXnJMTzTPWezil8srqGNl2fHOPM6r8W+MPmF+s93EXGZWvhZp0KLW8aze/cUFZTMGYFRS6CbaGcveyHBt98ejsG5FEhqyXAWj/yqFkJWgSsbPH5PSHGsYAnkUBr7EQFL2yPdLgub4Oi3m2EYszaHA== 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=YatvN65BV8LlW2ZkG/Mmn01Wedk3huVKiGUTJXGzu8Q=; b=kJDpM+8X2ECNNLzNSupQt+rZ5Iym0GpZ7wswYHxBb/HrxaFG89IbAgOvA3WFXTn21Mn5E4qvPT2+kzUVpV1SWrtlPnRr2wuWggzyWS1R1/hdOrEn49zaj4TyUiccQnCj8+5zCXCRY6m3CKw/A8TsjR71SFR2hnYDuiaYxfQvqu/GNMVPceQFPqFsUYrLdSlQxFx2sxLRY0S45Og0SAzsUOuokqnFqm6Xw9mdqtDOzSKt2eGpmI+vmtx0JBHlz3y8igTSB/3Mg6UvCltSoQGSVqVq+Hd+gNtaviNSevITJjDsXWXbTKaUxAM4CKM3CjZhY/Y2q/CkPcIHrqqK+/3RlQ== 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=YatvN65BV8LlW2ZkG/Mmn01Wedk3huVKiGUTJXGzu8Q=; b=VnzDfikSeD/3cuVY5aE22qghjcMSzUhufJOsH9cRlzwd6CT3bqhi48XsGsraV+3GcaMEw3IpyQjrYNarucNuUV6OPJgAzRobOGQ/aDvcfBYcIcqMAVvTqfaQ75UOtTNCdPrOCWNU5Lt2nG30kaFX9l87MkfBb5bZlmppaFj5iWM= Received: from BN1PR14CA0016.namprd14.prod.outlook.com (2603:10b6:408:e3::21) by CH3PR12MB8994.namprd12.prod.outlook.com (2603:10b6:610:171::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.33; Tue, 9 May 2023 07:56:50 +0000 Received: from BN8NAM11FT039.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e3:cafe::a6) by BN1PR14CA0016.outlook.office365.com (2603:10b6:408:e3::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.33 via Frontend Transport; Tue, 9 May 2023 07:56:49 +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 BN8NAM11FT039.mail.protection.outlook.com (10.13.177.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6363.33 via Frontend Transport; Tue, 9 May 2023 07:56:49 +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, 9 May 2023 02:56:46 -0500 From: "Chang, Abner" To: CC: Isaac Oram , Abdul Lateef Attar , Nickle Wang , Tinh Nguyen Subject: [edk2-platforms][PATCH 2/2] ManageabilityPkg/ManageabilityTransportKcsLib: Add debug message of IPMI KCS Completion Code Date: Tue, 9 May 2023 15:56:02 +0800 Message-ID: <20230509075602.342-2-abner.chang@amd.com> X-Mailer: git-send-email 2.37.1.windows.1 In-Reply-To: <20230509075602.342-1-abner.chang@amd.com> References: <20230509075602.342-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: BN8NAM11FT039:EE_|CH3PR12MB8994:EE_ X-MS-Office365-Filtering-Correlation-Id: f5b7aee2-7f9d-4ee5-5404-08db5062f195 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mT9ju9g/d3KkRKxXo5XpjmTz5TQJ2FI6T/vZzW43S0Sq6ubj+XO+tivi5VG29hWRWZnv6C81EpDwnUo/pM8l17y8C4MtU1D/9BrlNqbURaEJYooCD6fKjX1IKNW88wPUz7YwM8txDOIOPE3tYngUlwUthgHXJSYf8VEBQRbbRZOIcxZD5+8J1upVM+zsEmAcMcdgUxqVCXR8pV8dg+7kX6NIYE/IrUaxkoJm7XFLLt/nZlHTLdDk7pRkI5y2lMar3eYgWGdEwovXNIpkmmP4K7PYgkoOVEnukwhH80bfV65eBCJQJiZKsRV+9zFAfRmK56i22UxmKUNqPPOaaz/dy0zbWPosN+rHp6P3Ha2d5voP8a+NnVo+DjiPpsuonVE6AyNHsYWZxkrioUcIWUqGVBrwlOoelJB74DoBlf6tbpBPWui4C1h7WTUq5oMBqkY3/dOsd2wly3F5C9psULLa9nQEfhymOAhHQIbqE7MMJG495aF7h6icpNiFiheH2m5/RUE7Eu7MRK3UqaLmyeuoV3Syu+qs1Q68DoLwNhvhQ3QOnZW4sDH5YOoUNc9Em7KVBxNzybE75e5acTIGXgcGflE6U+tAtnV5InAk1Suh11jjjxcIUY/w3xj+v0Ts7d23rKIl78fQCftPKkzA0eRHMzPGCD8bo4XK0rUOPNuDm9DldeNcAyC5tWOV1w2CzQE+HQRCjQLA0myQ+uv5Td3z9HvoS3aVGCPuZDEaqeigDeQ= 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)(396003)(376002)(39860400002)(136003)(346002)(451199021)(46966006)(36840700001)(40470700004)(5660300002)(8676002)(81166007)(2876002)(2906002)(70206006)(70586007)(8936002)(6916009)(478600001)(40480700001)(86362001)(54906003)(6666004)(4326008)(82310400005)(40460700003)(316002)(41300700001)(7696005)(356005)(1076003)(26005)(36756003)(82740400003)(186003)(16526019)(2616005)(47076005)(336012)(36860700001)(426003)(83380400001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2023 07:56:49.0826 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f5b7aee2-7f9d-4ee5-5404-08db5062f195 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: BN8NAM11FT039.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8994 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain From: abnchang Print out IPMI Completion Code and return additional transport interface status. Signed-off-by: Abner Chang Cc: Isaac Oram Cc: Abdul Lateef Attar Cc: Nickle Wang Cc: Tinh Nguyen --- .../Common/ManageabilityTransportKcs.h | 18 +++++---- .../Common/KcsCommon.c | 39 +++++++++++++------ .../Dxe/ManageabilityTransportKcs.c | 7 +++- 3 files changed, 42 insertions(+), 22 deletions(-) diff --git a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib= /Common/ManageabilityTransportKcs.h b/Features/ManageabilityPkg/Library/Man= ageabilityTransportKcsLib/Common/ManageabilityTransportKcs.h index 8c6a64416a..166aa8dcde 100644 --- a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common= /ManageabilityTransportKcs.h +++ b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common= /ManageabilityTransportKcs.h @@ -51,6 +51,7 @@ typedef struct { code is the first byte of response data. @param[in, out] ResponseDataSize Size of Command Response Data. + @param[out] AdditioalStatus Additional status of this transact= ion. =20 @retval EFI_SUCCESS The command byte stream was successfully submit to the device = and a @@ -71,14 +72,15 @@ typedef struct { EFI_STATUS EFIAPI KcsTransportSendCommand ( - IN MANAGEABILITY_TRANSPORT_HEADER TransmitHeader OPTIONAL, - IN UINT16 TransmitHeaderSize, - IN MANAGEABILITY_TRANSPORT_TRAILER TransmitTrailer OPTIONAL, - IN UINT16 TransmitTrailerSize, - IN UINT8 *RequestData OPTIONAL, - IN UINT32 RequestDataSize, - OUT UINT8 *ResponseData OPTIONAL, - IN OUT UINT32 *ResponseDataSize OPTIONAL + IN MANAGEABILITY_TRANSPORT_HEADER TransmitHeader OPTIONAL, + IN UINT16 TransmitHeaderSize, + IN MANAGEABILITY_TRANSPORT_TRAILER TransmitTrailer OPTIONAL= , + IN UINT16 TransmitTrailerSize, + IN UINT8 *RequestData OPTIONAL, + IN UINT32 RequestDataSize, + OUT UINT8 *ResponseData OPTIONAL, + IN OUT UINT32 *ResponseDataSize OPTION= AL, + OUT MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS *AdditioalStatus ); =20 /** diff --git a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib= /Common/KcsCommon.c b/Features/ManageabilityPkg/Library/ManageabilityTransp= ortKcsLib/Common/KcsCommon.c index a8c6a674c9..84792311be 100644 --- a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common= /KcsCommon.c +++ b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common= /KcsCommon.c @@ -392,10 +392,8 @@ KcsTransportRead ( code is the first byte of response data. @param[in, out] ResponseDataSize Size of Command Response Data. - When IN, it is the expected data s= ize - of response data. - When OUT, it is the data size of r= esponse - exactly returned. + @param[out] AdditioalStatus Additional status of this transact= ion. + @retval EFI_SUCCESS The command byte stream was successfully submit to the device = and a response was successfully received= . @@ -414,20 +412,22 @@ KcsTransportRead ( EFI_STATUS EFIAPI KcsTransportSendCommand ( - IN MANAGEABILITY_TRANSPORT_HEADER TransmitHeader OPTIONAL, - IN UINT16 TransmitHeaderSize, - IN MANAGEABILITY_TRANSPORT_TRAILER TransmitTrailer OPTIONAL, - IN UINT16 TransmitTrailerSize, - IN UINT8 *RequestData OPTIONAL, - IN UINT32 RequestDataSize, - OUT UINT8 *ResponseData OPTIONAL, - IN OUT UINT32 *ResponseDataSize OPTIONAL + IN MANAGEABILITY_TRANSPORT_HEADER TransmitHeader OPTIONAL, + IN UINT16 TransmitHeaderSize, + IN MANAGEABILITY_TRANSPORT_TRAILER TransmitTrailer OPTIONAL= , + IN UINT16 TransmitTrailerSize, + IN UINT8 *RequestData OPTIONAL, + IN UINT32 RequestDataSize, + OUT UINT8 *ResponseData OPTIONAL, + IN OUT UINT32 *ResponseDataSize OPTION= AL, + OUT MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS *AdditioalStatus ) { EFI_STATUS Status; UINT32 RspHeaderSize; IPMI_KCS_RESPONSE_HEADER RspHeader; UINT32 ExpectedResponseDataSize; + CHAR16 *CompletionCodeStr; =20 if ((RequestData !=3D NULL) && (RequestDataSize =3D=3D 0)) { DEBUG ((DEBUG_ERROR, "%a: Mismatched values of RequestData and Request= DataSize\n", __FUNCTION__)); @@ -439,6 +439,11 @@ KcsTransportSendCommand ( return EFI_INVALID_PARAMETER; } =20 + if (AdditioalStatus =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "%a: AdditioalStatus is NULL.\n", __func__)); + return EFI_INVALID_PARAMETER; + } + // Print out the request payloads. if ((TransmitHeader !=3D NULL) && (TransmitHeaderSize !=3D 0)) { HelperManageabilityDebugPrint ((VOID *)TransmitHeader, (UINT32)Transmi= tHeaderSize, "KCS Transmit Header:\n"); @@ -504,6 +509,16 @@ KcsTransportSendCommand ( } =20 HelperManageabilityDebugPrint ((VOID *)ResponseData, (UINT32)*Respon= seDataSize, "KCS Response Data:\n"); + + // Print Completion Code + Status =3D IpmiHelperCheckCompletionCode (*((UINT8 *)ResponseData), = &CompletionCodeStr, AdditioalStatus); + if (!EFI_ERROR (Status)) { + DEBUG ((DEBUG_MANAGEABILITY_INFO, "Cc: %02x %s.\n", *((UINT8 *)Res= ponseData), CompletionCodeStr)); + } else if (Status =3D=3D EFI_NOT_FOUND) { + DEBUG ((DEBUG_MANAGEABILITY_INFO, "Cc: %02x not defined in IpmiCom= pletionCodeMapping or invalid.\n", *((UINT8 *)ResponseData))); + } + } else { + DEBUG ((DEBUG_ERROR, "No response, can't determine Completion Code.\= n")); } } else { *ResponseDataSize =3D 0; diff --git a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib= /Dxe/ManageabilityTransportKcs.c b/Features/ManageabilityPkg/Library/Manage= abilityTransportKcsLib/Dxe/ManageabilityTransportKcs.c index 9175556a26..c2d1ac6b62 100644 --- a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/Ma= nageabilityTransportKcs.c +++ b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/Ma= nageabilityTransportKcs.c @@ -219,7 +219,8 @@ KcsTransportTransmitReceive ( IN MANAGEABILITY_TRANSFER_TOKEN *TransferToken ) { - EFI_STATUS Status; + EFI_STATUS Status; + MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS AdditioalStatus; =20 if ((TransportToken =3D=3D NULL) || (TransferToken =3D=3D NULL)) { DEBUG ((DEBUG_ERROR, "%a: Invalid transport token or transfer token.\n= ", __FUNCTION__)); @@ -234,11 +235,13 @@ KcsTransportTransmitReceive ( TransferToken->TransmitPackage.TransmitPayload, TransferToken->TransmitPackage.TransmitSizeInByte, TransferToken->ReceivePackage.ReceiveBuffer, - &TransferToken->ReceivePackage.ReceiveSizeInByte + &TransferToken->ReceivePackage.ReceiveSizeInByte, + &AdditioalStatus ); =20 TransferToken->TransferStatus =3D Status; KcsTransportStatus (TransportToken, &TransferToken->TransportAdditionalS= tatus); + TransferToken->TransportAdditionalStatus |=3D AdditioalStatus; } =20 /** --=20 2.37.1.windows.1