From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (NAM02-BN1-obe.outbound.protection.outlook.com [40.107.212.77]) by mx.groups.io with SMTP id smtpd.web11.46141.1683981228543665609 for ; Sat, 13 May 2023 05:33:48 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amd.com header.s=selector1 header.b=fZirH2uB; 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.212.77, mailfrom: abner.chang@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YjkLqGrosL2ie8rl26sR/CwDIAxOSZT8o3mF4Uq1KhMhusQsBeW1ngvh4q4TwEIuLTHp9SZB2AZtj+A59GyPnOKbs/hemXuJbL+s/364agNS5eq/a8oOBPlRGc+BQt1MoozBqyjxu3knI0iWMCffPxmzfEtFwzCC7tMqV7hb32bamA+tKdstZCOMM3bu2vy3dHuNyFNcr4JZ557juB2k3fdmuxnRvrhJl6kSduw9YK0+AUThtpFAoN0RtWTbU/3vovijSGbzdk0vtOmr1KYUZcjFzzgUQESuA+RyE2rlZlAXIWodc11n0DTt1ZikMtKQSSt1cUaTmTd/0unD/l91vQ== 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=uPe2zv8aZ+UrOY20ePjMWdNl7HgHxO7Z2JbWwWRlDyI=; b=GkUQ0UPMgzmT55QEwNN8aWaSR7riTzrKTQ50W4ehaUZcGbX2Y4Oby+XHzA7++vZVHqThqkICDNjA0r3mEvqijWW/dbnX1srJusMHP8ho5oYYarXiFSPkDBTswaUvo8AwdeD0iymsdgamTy+xjjgmafdd7Mt2Km8glLSqXD+8jSU/n2ApCPb/XOhq9G1cO/RCxxIRk0MEfDkyrwkeHz0yFnXg7+C7MU/wmKcnjUpzxlJReLoS34qt64S6xrtDSyH4KL9SGxkePyVbrLQoy1ajxNxi0yByLTfrozolblOU+9RyI8tx46HT1UG2RQa6OT8sVRnbXleAPss7RFaR/dc8fw== 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=uPe2zv8aZ+UrOY20ePjMWdNl7HgHxO7Z2JbWwWRlDyI=; b=fZirH2uBV1FlAp8mzH4FNDBs3VG0nJCuk2fUsilCnJV5JuFblGTInXhq2rLuXJLB8Ogwf7hH3iTd7VZQUeyaLBJBMXrBb6DNRGQ9nnr6Pr+JlfUb/nM99Mdy+mRaRRwi8beszWK+ONkTjhtVI0m2j410efuV/cjKIptysMvYK04= Received: from MW2PR16CA0001.namprd16.prod.outlook.com (2603:10b6:907::14) by SA1PR12MB8886.namprd12.prod.outlook.com (2603:10b6:806:375::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.27; Sat, 13 May 2023 12:33:45 +0000 Received: from CO1NAM11FT045.eop-nam11.prod.protection.outlook.com (2603:10b6:907:0:cafe::ba) by MW2PR16CA0001.outlook.office365.com (2603:10b6:907::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.29 via Frontend Transport; Sat, 13 May 2023 12:33:45 +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 CO1NAM11FT045.mail.protection.outlook.com (10.13.175.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6411.11 via Frontend Transport; Sat, 13 May 2023 12:33:44 +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; Sat, 13 May 2023 07:33:42 -0500 From: "Chang, Abner" To: CC: Isaac Oram , Abdul Lateef Attar , Nickle Wang , Tinh Nguyen Subject: [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiFrb: IPMI FRB Driver Date: Sat, 13 May 2023 20:33:26 +0800 Message-ID: <20230513123327.1496-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: CO1NAM11FT045:EE_|SA1PR12MB8886:EE_ X-MS-Office365-Filtering-Correlation-Id: ca16e80d-d162-4a69-7502-08db53ae4b03 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Z0t6RUR8gjW/3iCGC/dvYUPceQrNh8f8inWcHtToHvGKYeGRUabLYNFnbUtw1jYDm9lSDILeiESukDsKMuzjmaIbR1DCvqH3CU8zlyhSxzg4sTF0xzOOAcK4BqaEa9CjMYnf0Q3Ntf4TEFi4wd1lpUHWsR/LTHpYIVZiLgrr4oo5rXJYobkCX93G82CqFrd+JYGyUi4ZJ3PBfDhcdp2WHay6nbw5RES9FxOz1k0ZMnlsqQoj+bFSU1a8S/WnROfKN/aOrYHKFKYJKY63rGvnyGovmexXLLwK1c3Nr7e3N8kZjnSObgbibEqtn5qWF10c3ljFXIjs2Qi7ZK+GT7X/Xa9jYfjbLF93PuU2108xWc2ifvfA8LDQtZeVJQrqh2vjFFcc/qp/Udvg2B/8WNMjCQOBXx7+Go3EMhtx4ZpUQUgk0hK43I8vUowKlVdgxbDIukB4vhbmhqSM/JA1WQGuzzlbxpXHpegY5j5Om03jz+qwmD+6YXdvujHZPCsp3MFFjnsjJyuD++crL1oaWBfXDoAh88jEmtCoaRdtjvJtSg0wGp/wP/Z35ep9hrdP0GeIKCdJzwfWxseR5GUFlVR4hDIpkPibPjJI0gjMoCxfCuWIoQ23jyfhHMdOx6kFOqhGx0T0wf7UMOrn2ECN8PzyiU7/WqutP06Y0Xoa3lcYpTt77qou01Tw0m+gekJwzFl6i5fBALt6BosrYwU7GSmOULGTvBu+GzpDwZ/2L34nS7Ko69Lfd+KKSfNZhVJvsBpHH5b7uNlN9jwP0OOKTs0bHg== 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)(346002)(39860400002)(376002)(136003)(451199021)(46966006)(40470700004)(36840700001)(54906003)(19627235002)(1076003)(478600001)(186003)(26005)(16526019)(36756003)(7696005)(6666004)(5660300002)(8936002)(41300700001)(2876002)(8676002)(2906002)(30864003)(40480700001)(70206006)(70586007)(6916009)(40460700003)(316002)(4326008)(86362001)(356005)(81166007)(82740400003)(82310400005)(2616005)(426003)(47076005)(336012)(83380400001)(36860700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 May 2023 12:33:44.9427 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ca16e80d-d162-4a69-7502-08db53ae4b03 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: CO1NAM11FT045.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8886 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain From: Abner Chang IpmiFrb is cloned from edk2-platforms/Features/Intel/OutOfBandManagement/ IpmiFeaturePkg/Frb 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/Frb 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 | 5 + .../Universal/IpmiFrb/FrbDxe.inf | 37 +++ .../Universal/IpmiFrb/FrbPei.inf | 37 +++ .../Universal/IpmiFrb/FrbDxe.c | 212 ++++++++++++++++++ .../Universal/IpmiFrb/FrbPei.c | 87 +++++++ 5 files changed, 378 insertions(+) create mode 100644 Features/ManageabilityPkg/Universal/IpmiFrb/FrbDxe.inf create mode 100644 Features/ManageabilityPkg/Universal/IpmiFrb/FrbPei.inf create mode 100644 Features/ManageabilityPkg/Universal/IpmiFrb/FrbDxe.c create mode 100644 Features/ManageabilityPkg/Universal/IpmiFrb/FrbPei.c diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dec b/Features/Mana= geabilityPkg/ManageabilityPkg.dec index 38813c5f48..b0ca01094a 100644 --- a/Features/ManageabilityPkg/ManageabilityPkg.dec +++ b/Features/ManageabilityPkg/ManageabilityPkg.dec @@ -80,3 +80,8 @@ gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable|FALSE|BOOL= EAN|0x10000005 gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmSmbiosTransferEna= ble|FALSE|BOOLEAN|0x10000006 =20 +[PcdsDynamic, PcdsDynamicEx] + gManageabilityPkgTokenSpaceGuid.PcdFRB2EnabledFlag|TRUE|BOOLEAN|0x200000= 01 + ## This is the timeout value in milliseconds, default set to 360 millise= conds + # @Prompt IPMI Fault Resilient Booting timeout value in milliseconds. + gManageabilityPkgTokenSpaceGuid.PcdFRBTimeoutValue|360|UINT16|0x20000002 diff --git a/Features/ManageabilityPkg/Universal/IpmiFrb/FrbDxe.inf b/Featu= res/ManageabilityPkg/Universal/IpmiFrb/FrbDxe.inf new file mode 100644 index 0000000000..ae57fe7697 --- /dev/null +++ b/Features/ManageabilityPkg/Universal/IpmiFrb/FrbDxe.inf @@ -0,0 +1,37 @@ +### @file +# Component description file for IPMI FRB. +# +# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +### + +[defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D FrbDxe + FILE_GUID =3D A142CEE5-99D5-4ECF-943E-D8F0DE3052AA + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D FrbDxeEntryPoint + +[Sources] + FrbDxe.c + +[Packages] + ManageabilityPkg/ManageabilityPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + +[LibraryClasses] + UefiLib + BaseMemoryLib + DebugLib + IpmiCommandLib + MemoryAllocationLib + PcdLib + UefiBootServicesTableLib + UefiDriverEntryPoint + +[Depex] + TRUE diff --git a/Features/ManageabilityPkg/Universal/IpmiFrb/FrbPei.inf b/Featu= res/ManageabilityPkg/Universal/IpmiFrb/FrbPei.inf new file mode 100644 index 0000000000..89d633f32e --- /dev/null +++ b/Features/ManageabilityPkg/Universal/IpmiFrb/FrbPei.inf @@ -0,0 +1,37 @@ +### @file +# Component description file for IPMI FRB PEIM. +# +# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +### + +[defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D FrbPei + FILE_GUID =3D 7CAAE1A7-0B37-4EEA-A432-2F203DA6F288 + MODULE_TYPE =3D PEIM + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D InitializeFrbPei + +[Sources] + FrbPei.c + +[Packages] + ManageabilityPkg/ManageabilityPkg.dec + MdePkg/MdePkg.dec + +[LibraryClasses] + BaseMemoryLib + DebugLib + IpmiCommandLib + PcdLib + PeimEntryPoint + +[Pcd] + gManageabilityPkgTokenSpaceGuid.PcdFRB2EnabledFlag + gManageabilityPkgTokenSpaceGuid.PcdFRBTimeoutValue + +[Depex] + TRUE diff --git a/Features/ManageabilityPkg/Universal/IpmiFrb/FrbDxe.c b/Feature= s/ManageabilityPkg/Universal/IpmiFrb/FrbDxe.c new file mode 100644 index 0000000000..46f741eed1 --- /dev/null +++ b/Features/ManageabilityPkg/Universal/IpmiFrb/FrbDxe.c @@ -0,0 +1,212 @@ +/** @file + IPMI Fault Resilient Booting 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 + +/** + This routine disables the specified FRB timer. + + @retval EFI_STATUS EFI_SUCCESS FRB timer was disabled + EFI_ABORTED Timer was already stopped + EFI_UNSUPPORTED This type of FRB timer is not suppo= rted. + +**/ +EFI_STATUS +EfiDisableFrb ( + VOID + ) +{ + EFI_STATUS Status; + IPMI_SET_WATCHDOG_TIMER_REQUEST SetWatchdogTimer; + UINT8 CompletionCode; + IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer; + + Status =3D IpmiGetWatchdogTimer (&GetWatchdogTimer); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // Check if timer is still running, if not abort disable routine. + // + if (GetWatchdogTimer.TimerUse.Bits.TimerRunning =3D=3D 0) { + return EFI_ABORTED; + } + + ZeroMem (&SetWatchdogTimer, sizeof (SetWatchdogTimer)); + // + // Just flip the Timer Use bit. This should release the timer. + // + SetWatchdogTimer.TimerUse.Bits.TimerRunning =3D 0; + SetWatchdogTimer.TimerUse.Bits.TimerUse =3D IPMI_WATCHDOG_TIMER_B= IOS_FRB2; + SetWatchdogTimer.TimerUseExpirationFlagsClear &=3D ~BIT2; + SetWatchdogTimer.TimerUseExpirationFlagsClear |=3D BIT1 | BIT4; + + Status =3D IpmiSetWatchdogTimer (&SetWatchdogTimer, &CompletionCode); + return Status; +} + +/** + This function disables FRB2. This function gets called each time the + EFI_EVENT_SIGNAL_READY_TO_BOOT gets signaled + + @param[in] Event The handle of callback event. + @param[in] Context This should be NULL means no context associated + with this event. + +**/ +VOID +EFIAPI +DisableFRB2Handler ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + DEBUG ((DEBUG_ERROR, "!!! enter DisableFRB2Handler()!!!\n")); + + EfiDisableFrb (); +} + +/** + This function checks the Watchdog timer expiration flags and + report the kind of watchdog timeout occurred to the Error + Manager. + + @retval EFI_STATUS EFI_SUCCESS Timeout status is checked and cleared. + EFI_ERROR There was an error when check and clear + timeout status. + +**/ +EFI_STATUS +CheckForAndReportErrors ( + VOID + ) +{ + EFI_STATUS Status; + IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer; + IPMI_SET_WATCHDOG_TIMER_REQUEST SetWatchdogTimer; + UINT8 CompletionCode; + + // + // Get the Watchdog timer info to find out what kind of timer expiration= occurred. + // + Status =3D IpmiGetWatchdogTimer (&GetWatchdogTimer); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // If FRB2 Failure occurred, report it to the error manager and log a SE= L. + // + if ((GetWatchdogTimer.TimerUseExpirationFlagsClear & BIT1) !=3D 0) { + // + // Report the FRB2 time-out error + // + } else if ((GetWatchdogTimer.TimerUseExpirationFlagsClear & BIT3) !=3D 0= ) { + // + // Report the OS Watchdog timer failure + // + } + + // + // Need to clear Timer expiration flags after checking. + // + ZeroMem (&SetWatchdogTimer, sizeof (SetWatchdogTimer)); + SetWatchdogTimer.TimerUse =3D GetWatchdogTimer.Time= rUse; + SetWatchdogTimer.TimerActions =3D GetWatchdogTimer.Time= rActions; + SetWatchdogTimer.PretimeoutInterval =3D GetWatchdogTimer.Pret= imeoutInterval; + SetWatchdogTimer.TimerUseExpirationFlagsClear =3D GetWatchdogTimer.Time= rUseExpirationFlagsClear; + SetWatchdogTimer.InitialCountdownValue =3D GetWatchdogTimer.Init= ialCountdownValue; + SetWatchdogTimer.TimerUse.Bits.TimerRunning =3D 1; + SetWatchdogTimer.TimerUseExpirationFlagsClear |=3D BIT1 | BIT2 | BIT3; + + Status =3D IpmiSetWatchdogTimer (&SetWatchdogTimer, &CompletionCode); + + return Status; +} + +/** + This routine is built only when DEBUG_MODE is enabled. It is used + to report the status of FRB2 when the FRB2 driver is installed. + + @retval EFI_STATUS EFI_SUCCESS All info was retrieved and reported + EFI_ERROR There was an error during info retrieva= l + +**/ +EFI_STATUS +ReportFrb2Status ( + VOID + ) +{ + EFI_STATUS Status; + IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer; + + // + // Get the Watchdog timer info to find out what kind of timer expiration= occurred. + // + Status =3D IpmiGetWatchdogTimer (&GetWatchdogTimer); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "Failed to get Watchdog Timer info from BMC.\n")); + return Status; + } + + // + // Check if timer is running, report status to DEBUG_MODE output. + // + if (GetWatchdogTimer.TimerUse.Bits.TimerRunning =3D=3D 1) { + DEBUG ((DEBUG_INFO, "FRB2 Timer is running.\n")); + } else { + DEBUG ((DEBUG_INFO, "FRB2 Timer is not running.\n")); + } + + return EFI_SUCCESS; +} + +/** + The entry point of the Ipmi Fault Resilient Booting DXE driver. + + @param[in] ImageHandle - Handle of this driver image + @param[in] SystemTable - Table containing standard EFI services + + @retval EFI_SUCCESS - IPMI Protocol is installed successfully. + @retval Otherwise - Other errors. + +**/ +EFI_STATUS +EFIAPI +FrbDxeEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_EVENT ReadyToBootEvent; + EFI_STATUS Status; + + CheckForAndReportErrors (); + ReportFrb2Status (); + + // + // Register the event to Disable FRB2 before Boot. + // + Status =3D EfiCreateEventReadyToBootEx ( + TPL_NOTIFY, + DisableFRB2Handler, + NULL, + &ReadyToBootEvent + ); + + return Status; +} diff --git a/Features/ManageabilityPkg/Universal/IpmiFrb/FrbPei.c b/Feature= s/ManageabilityPkg/Universal/IpmiFrb/FrbPei.c new file mode 100644 index 0000000000..431cac17bc --- /dev/null +++ b/Features/ManageabilityPkg/Universal/IpmiFrb/FrbPei.c @@ -0,0 +1,87 @@ +/** @file + IPMI Fault Resilient Booting (FRB) PEIM. + +Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include + +#include + +/** + This function sets wtchdog timer for Failt Resilient Booting + according to Frb2Enabled. + + @param [in] Frb2Enabled Whether to enable FRB2 timeout + +**/ +VOID +SetWatchDogTimer ( + IN BOOLEAN Frb2Enabled + ) +{ + EFI_STATUS Status; + IPMI_SET_WATCHDOG_TIMER_REQUEST FrbTimer; + IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer; + UINT8 CompletionCode; + + Status =3D IpmiGetWatchdogTimer (&GetWatchdogTimer); + if (EFI_ERROR (Status)) { + return; + } + + if (Frb2Enabled) { + ZeroMem (&FrbTimer, sizeof (FrbTimer)); + // Byte 1 + FrbTimer.TimerUse.Bits.TimerUse =3D IPMI_WATCHDOG_TIMER_BIOS_FRB2; + // Byte 2 + FrbTimer.TimerActions.Uint8 =3D 0; // NormalBoot, NoTimeOutInterrup= t. i.e no action when BMC watchdog timeout + // Byte 3 + FrbTimer.PretimeoutInterval =3D 0; + // Byte 4 + FrbTimer.TimerUseExpirationFlagsClear |=3D BIT1; // set Frb2Expiratio= nFlag + + // Data Byte 5/6 + FrbTimer.InitialCountdownValue =3D PcdGet16 (PcdFRBTimeoutValue) * 10; + + // Set BMC watchdog timer + Status =3D IpmiSetWatchdogTimer (&FrbTimer, &CompletionCode); + Status =3D IpmiResetWatchdogTimer (&CompletionCode); + } +} + +/** + The entry point of the Ipmi Fault Resilient Booting PEIM. + + @param [in] FileHandle Handle of the file being invoked. + @param [in] PeiServices Describes the list of possible PEI Services. + + @retval EFI_SUCCESS Indicates that Ipmi initialization completed succe= ssfully. + @retval Others Indicates that Ipmi initialization could not compl= ete successfully. + +**/ +EFI_STATUS +EFIAPI +InitializeFrbPei ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ) +{ + BOOLEAN Frb2Enabled; + + // + // If we are booting with defaults, then make sure FRB2 is enabled. + // + Frb2Enabled =3D PcdGetBool (PcdFRB2EnabledFlag); + + SetWatchDogTimer (Frb2Enabled); + + return EFI_SUCCESS; +} --=20 2.37.1.windows.1