From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (NAM04-MW2-obe.outbound.protection.outlook.com [40.107.101.50]) by mx.groups.io with SMTP id smtpd.web10.18575.1683876561907204052 for ; Fri, 12 May 2023 00:29:22 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amd.com header.s=selector1 header.b=OAUFCzAB; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.101.50, mailfrom: abner.chang@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NXNzz3gIwgT3sGjKjZMYM1hlpDi9CFKTC2e5Eut2e/4QiAX/bgaiOC68w8Uxdn5LeZo+8rtZ9n9O82UZ3kmuVKCraJHu/W7j5qYHVdRN5AhtDMzZhKnjoAcKrpfr6XX87xWOcKlPEu6p4DB5Mo5UsNBar2hDxLZ2NaI5IJ5RtOkQQ7NhEPzv4OhcChlljPhbX6fvaC9ga+fBmE0kuagrVwcjpnDCASs+cXOvOn9JOD0WwbTASDnSdLod2fX3l1FxG59eYtakFFp6L43QuB2rvNU5zZhNssygzuqD/kSethfNCAb+hb8KO3O6ZZM6hTLEww80NF1CyH3sSRJEcMoGfA== 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=XBChwZ0OoNm0TxuV7uJEoWip3EkrVT7NJzlLBCAnywU=; b=h0MauGlVRJpbyVQk8ofsiu1SnCiAdI4laWHHSiqtpMuO+PdeUSmBTmMljFJyOr/i4g+ymH8F6bNs4eCpXUzRbzDZTMmh8sZz22SSlUQiXKFrew4f2THc/LMiKRl+FPljLy0YRhWKfLm/Yhjv5MQSXnR9A8Rz8yQtGo3SlHUdCVNUs2c5s2wHAYGw17oxns4WPP4yXO9M4CqE0f95oJ+/D/gT8eCPJBDKWeP/BgQN1ElU7CgzZ6Iize7HtRTYv/zF4NCL+NlJp961TzQ1yPye+qPN2wihUdSzZHM72kuN0518Ajqxg6O6mKAsIAyYwep7/yoiXnIVbUZbCfmJgUef5A== 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=XBChwZ0OoNm0TxuV7uJEoWip3EkrVT7NJzlLBCAnywU=; b=OAUFCzABoI+JmTqdbRmW1sQJvjMwUoh8wlQ+AbL/jgnwqYvK5KFx3Rz7HYElZw65YsrsRJx9tQQA1dFWE5Vwz9fmjANcd5sTXk6WvcwpdM51RqHNRVhhsD+Cb5v6tH9TWfnVg5kcTCMkZHX4UPRETpoh7BT799DmucZhuqWchpQ= Received: from BN9PR03CA0194.namprd03.prod.outlook.com (2603:10b6:408:f9::19) by PH7PR12MB7355.namprd12.prod.outlook.com (2603:10b6:510:20e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.21; Fri, 12 May 2023 07:29:19 +0000 Received: from BN8NAM11FT102.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f9:cafe::ac) by BN9PR03CA0194.outlook.office365.com (2603:10b6:408:f9::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.22 via Frontend Transport; Fri, 12 May 2023 07:29: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 BN8NAM11FT102.mail.protection.outlook.com (10.13.177.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6387.23 via Frontend Transport; Fri, 12 May 2023 07:29: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, 12 May 2023 02:29:17 -0500 From: "Chang, Abner" To: CC: Isaac Oram , Abdul Lateef Attar , Nickle Wang , Tinh Nguyen Subject: [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiSolStatus: IPMI Serail over Lan Driver Date: Fri, 12 May 2023 15:29:05 +0800 Message-ID: <20230512072907.1459-1-abner.chang@amd.com> X-Mailer: git-send-email 2.37.1.windows.1 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: BN8NAM11FT102:EE_|PH7PR12MB7355:EE_ X-MS-Office365-Filtering-Correlation-Id: d1280522-5a58-4a8f-f52e-08db52ba9938 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4h3nntzUP/vpGLovpsjDTyNI/whkwK+63Vtvkwk4fGOBaqR3vOSXA9EPEk5hOI/tg0PsZyHW9H2VOemiJkG8wpsM++SssTMsqdn3eW9KfqAe2Y8Wm36BZi+2xmeoB4Ak7ASkWmJuzLBdMQ8+oWmJB9qoTebvKEWW/APB0FLLrvl+z9uMzdNVEQfDoAlDqPzrm6OJXxV7GFBjz6WRNBW59qVWTAqt43fmFPlvScpqDTKmZBzTGcfMLyIDnuAP/89vQBux5ep1MQ2vUccKypzdI99uEfcGoCs6XguUsj5NBlz+tyNdUSxix9f5GyDBXBwVMoWIxfrmSdbdhTH4jioyR/+KN0nC5nWV3zxiRjlIshlMTuPC5oYrxuQaqFhq3x3wrd8DOuH5lgdX8P8Ez8wL7vntUJYQnwq9FVMSSIVg2pxEcdiyirfvQT8HmBgt+F+iZj7iElBXMXDh/9t8m+q2aPcZIME+whdwwmcoE6j/Xr0gE30k1qD2Yb83FkdPpfoWeX2ExJDmoFDhN35pmMd+Gw1RYRIIsVffX/leHJv6VkyspBNwN6fvHLrfWIDMtGZ1WMm1AoiBRs6L4SaPwHedAC2uGKH2hXXEOPo3Qip4jIl1KigGOL2ap33NgWKT9WXLDSvJls6F2yrLClsZItjows8YiuAzVDQVwSCcc47iGAU2zRwnzXetj+C+cFa15AJzSE7AfR7s31rwxmNmqGYRpSyWRcJrFlFt5Wm/g0tohN3S9DgGWGkjI3tqMkjviRVQ/mD7LLg6xGNtws3DFGJwtg== 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)(396003)(39860400002)(136003)(346002)(451199021)(40470700004)(46966006)(36840700001)(70206006)(70586007)(81166007)(316002)(4326008)(82740400003)(6916009)(40460700003)(356005)(54906003)(19627235002)(7696005)(82310400005)(6666004)(86362001)(186003)(36756003)(40480700001)(16526019)(478600001)(26005)(36860700001)(1076003)(336012)(2906002)(426003)(2876002)(8676002)(8936002)(83380400001)(47076005)(5660300002)(41300700001)(2616005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2023 07:29:19.0629 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d1280522-5a58-4a8f-f52e-08db52ba9938 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: BN8NAM11FT102.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7355 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain From: Abner Chang IpmiSolStatus is cloned from edk2-platforms/Features/Intel/OutOfBandManagement/ IpmiFeaturePkg/SolStatus in order to consolidate edk2 system manageability support in one place. Uncustify is applied to C files and no functionalities are changed in this patch. We will still keep the one under IpmiFeaturePkg/SolStatus until the reference to this instance are removed from platforms. Signed-off-by: Abner Chang Cc: Isaac Oram Cc: Abdul Lateef Attar Cc: Nickle Wang Cc: Tinh Nguyen --- .../ManageabilityPkg/ManageabilityPkg.dec | 4 + .../Universal/IpmiSolStatus/SolStatus.inf | 37 ++++ .../Universal/IpmiSolStatus/SolStatus.c | 164 ++++++++++++++++++ 3 files changed, 205 insertions(+) create mode 100644 Features/ManageabilityPkg/Universal/IpmiSolStatus/SolSt= atus.inf create mode 100644 Features/ManageabilityPkg/Universal/IpmiSolStatus/SolSt= atus.c diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dec b/Features/Mana= geabilityPkg/ManageabilityPkg.dec index 38813c5f48..c11bf5d0df 100644 --- a/Features/ManageabilityPkg/ManageabilityPkg.dec +++ b/Features/ManageabilityPkg/ManageabilityPkg.dec @@ -72,6 +72,10 @@ # @Prompt MCTP KCS (Memory mapped) I/O base address gManageabilityPkgTokenSpaceGuid.PcdMctpKcsBaseAddress|0xca2|UINT32|0x000= 00004 =20 + ## This is the value of SOL channels supported on platform. + # @Prompt SOL channel number + gManageabilityPkgTokenSpaceGuid.PcdMaxSolChannels|3|UINT8|0x00000100 + [PcdsFeatureFlag] gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiEnable|FALSE|BOOL= EAN|0x10000001 gManageabilityPkgTokenSpaceGuid.PcdManageabilitySmmIpmiEnable|FALSE|BOOL= EAN|0x10000002 diff --git a/Features/ManageabilityPkg/Universal/IpmiSolStatus/SolStatus.in= f b/Features/ManageabilityPkg/Universal/IpmiSolStatus/SolStatus.inf new file mode 100644 index 0000000000..1d7cbf1a08 --- /dev/null +++ b/Features/ManageabilityPkg/Universal/IpmiSolStatus/SolStatus.inf @@ -0,0 +1,37 @@ +### @file +# Component description file for IPMI Serial Over LAN (SOL) driver. +# +# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +### + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D SolStatus + FILE_GUID =3D 1AF7E6C4-7678-4A6D-9240-E8BA17C3B772 + MODULE_TYPE =3D DXE_DRIVER + PI_SPECIFICATION_VERSION =3D 0x0001000A + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D SolStatusEntryPoint + +[Sources] + SolStatus.c + +[Packages] + ManageabilityPkg/ManageabilityPkg.dec + MdePkg/MdePkg.dec + +[Pcd] + gManageabilityPkgTokenSpaceGuid.PcdMaxSolChannels + +[LibraryClasses] + DebugLib + IpmiCommandLib + PcdLib + UefiBootServicesTableLib + UefiDriverEntryPoint + +[Depex] + TRUE diff --git a/Features/ManageabilityPkg/Universal/IpmiSolStatus/SolStatus.c = b/Features/ManageabilityPkg/Universal/IpmiSolStatus/SolStatus.c new file mode 100644 index 0000000000..996386372e --- /dev/null +++ b/Features/ManageabilityPkg/Universal/IpmiSolStatus/SolStatus.c @@ -0,0 +1,164 @@ +/** @file + IPMI Serial Over Lan Driver. + +Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define SOL_CMD_RETRY_COUNT 10 + +/*++ + +Routine Description: + + This routine gets the SOL payload status or settings for a specific ch= annel. + +Arguments: + Channel - LAN channel naumber. + ParamSel - Configuration parameter selection. + Data - Information returned from BMC. +Returns: + EFI_SUCCESS - SOL configuration parameters are successfully read f= rom BMC. + Others - SOL configuration parameters could not be read from = BMC. + +--*/ +EFI_STATUS +GetSolStatus ( + IN UINT8 Channel, + IN UINT8 ParamSel, + IN OUT UINT8 *Data + ) +{ + EFI_STATUS Status =3D EFI_SUCCESS; + IPMI_GET_SOL_CONFIGURATION_PARAMETERS_REQUEST GetConfigurationParamete= rsRequest; + IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE GetConfigurationParamete= rsResponse; + UINT32 DataSize; + UINT8 RetryCount; + + for (RetryCount =3D 0; RetryCount < SOL_CMD_RETRY_COUNT; RetryCount++) { + ZeroMem (&GetConfigurationParametersRequest, sizeof (GetConfigurationP= arametersRequest)); + GetConfigurationParametersRequest.ChannelNumber.Bits.ChannelNumber =3D= Channel; + GetConfigurationParametersRequest.ParameterSelector =3D= ParamSel; + + ZeroMem (&GetConfigurationParametersResponse, sizeof (GetConfiguration= ParametersResponse)); + + DataSize =3D sizeof (GetConfigurationParametersResponse); + Status =3D IpmiGetSolConfigurationParameters ( + &GetConfigurationParametersRequest, + &GetConfigurationParametersResponse, + &DataSize + ); + + if (Status =3D=3D EFI_SUCCESS) { + break; + } else { + gBS->Stall (100000); + } + } + + if (Status =3D=3D EFI_SUCCESS) { + *Data =3D GetConfigurationParametersResponse.ParameterData[0]; + } + + return Status; +} + +/*++ + +Routine Description: + + This routine sets the SOL payload configuration parameters for a speci= fic channel. + +Arguments: + Channel - LAN channel naumber. + ParamSel - Configuration parameter selection. + Data - Configuration parameter values. +Returns: + EFI_SUCCESS - SOL configuration parameters are sent to BMC. + Others - SOL configuration parameters could not be sent to BM= C. + +--*/ +EFI_STATUS +SetSolParams ( + IN UINT8 Channel, + IN UINT8 ParamSel, + IN UINT8 Data + ) +{ + EFI_STATUS Status =3D EFI_SUCCESS; + IPMI_SET_SOL_CONFIGURATION_PARAMETERS_REQUEST SetConfigurationParameter= sRequest; + UINT8 CompletionCode; + UINT8 RetryCount; + + for (RetryCount =3D 0; RetryCount < SOL_CMD_RETRY_COUNT; RetryCount++) { + ZeroMem (&SetConfigurationParametersRequest, sizeof (SetConfigurationP= arametersRequest)); + SetConfigurationParametersRequest.ChannelNumber.Bits.ChannelNumber =3D= Channel; + SetConfigurationParametersRequest.ParameterSelector =3D= ParamSel; + SetConfigurationParametersRequest.ParameterData[0] =3D= Data; + + CompletionCode =3D 0; + + Status =3D IpmiSetSolConfigurationParameters ( + &SetConfigurationParametersRequest, + sizeof (SetConfigurationParametersRequest), + &CompletionCode + ); + + if (Status =3D=3D EFI_SUCCESS) { + break; + } else { + gBS->Stall (100000); + } + } + + return Status; +} + +/*++ + + Routine Description: + This is the standard EFI driver point. This function initializes + the private data required for creating SOL Status Driver. + + Arguments: + ImageHandle - Handle for the image of this driver + SystemTable - Pointer to the EFI System Table + + Returns: + EFI_SUCCESS - Protocol successfully installed + EFI_UNSUPPORTED - Protocol can't be installed. + +--*/ +EFI_STATUS +EFIAPI +SolStatusEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status =3D EFI_SUCCESS; + UINT8 Channel; + BOOLEAN SolEnabled =3D FALSE; + + for (Channel =3D 1; Channel <=3D PcdGet8 (PcdMaxSolChannels); Channel++)= { + Status =3D GetSolStatus (Channel, IPMI_SOL_CONFIGURATION_PARAMETER_SOL= _ENABLE, &SolEnabled); + if (Status =3D=3D EFI_SUCCESS) { + DEBUG ((DEBUG_ERROR, "SOL enabling status for channel %x is %x\n", C= hannel, SolEnabled)); + } else { + DEBUG ((DEBUG_ERROR, "Failed to get channel %x SOL status from BMC!,= status is %x\n", Channel, Status)); + } + } + + return Status; +} --=20 2.37.1.windows.1