From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.80]) by mx.groups.io with SMTP id smtpd.web11.18608.1684471063886620516 for ; Thu, 18 May 2023 21:37:44 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=CZ6V5meF; 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.94.80, mailfrom: abner.chang@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kYBXTD5X9WpKeVA3Nj7rJGsZiRla+M/+gUovGvXkTEwziBiBM91m0ckjk+fzexWl/UGcY4oq3lSWgS83TLeDk4gSBmeMobb7o3+B4Ken+lhirNNXxkrm1E9w0IokI0bH04KGfJ1/VQ7tu6hSmtWAdXQjNjKdO/A60OVoLMGOXfhNlG9VaJj3VoecSIrrmBc9RlUCuVjZkS3hrkkJ1q/pKIKj3ALi6yQ5cE2mY59QZQoU/OKnZmqBHYlCZ5+3bHbJSJzB1LWhFB0uHv1wnxzk2cK+k1Cjbhkiln1Yp4udkB8GyMdAL5XWPM7MMKyfOZGOsTUMaNP55sOmj0XtqsFvmg== 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=UU/0dWjshl7vDX+UH8dfZYLQ6mV09ane5pKvjg+l4C0=; b=Rhd73FIORttyfSpvtqDv/le1vD5Y4y/cXF7+G6GNCuw5vpz4CvzrAXKNxrYvELzAzYv3W2eUIFktIsbiNg5IHWJR4UFJAN0M3RKniiC9zQUJ4pEF3n/vo019nje3uOruFRizQZMwOAf1XiAltaV9xZQnQSiCwOKFMfyXRzI2vKutU5pLU61XYop9UWWPHjoIARlx4CmNQ//iYpPMpETsgnS5LCKA4TK5sIZHY2+gSMfFM+gS2gozv1Ok2zATl1juHA0uNR80zDkzGO7Mpi1bNB5SomRjPFVUU6TcTT1FdsLUBLazRsLDp/hg6OqqGpCJGXeV9EaotN2Jid3PJbnuig== 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=UU/0dWjshl7vDX+UH8dfZYLQ6mV09ane5pKvjg+l4C0=; b=CZ6V5meFpBnckfxrwvo2MoUuhh1/JCraY59fvb48wwR8Gt9MNWHQ6BLczJcUVLzgJJxtQFT6WjJeiZGu9O59uc3UJtdK1qSJdJ4l0qGC3EGElBxeDTWQyYck/n+bDVW7StGglP874axF8UhfvDpftfNAERJzgWXuW3GBq8WIvmI= Received: from MN2PR12MB3966.namprd12.prod.outlook.com (2603:10b6:208:165::18) by MW4PR12MB6975.namprd12.prod.outlook.com (2603:10b6:303:20a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.19; Fri, 19 May 2023 04:37:41 +0000 Received: from MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::edb0:bed8:c650:5040]) by MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::edb0:bed8:c650:5040%6]) with mapi id 15.20.6411.021; Fri, 19 May 2023 04:37:41 +0000 From: "Chang, Abner" To: "Oram, Isaac W" , "devel@edk2.groups.io" CC: "Attar, AbdulLateef (Abdul Lateef)" , Nickle Wang , Tinh Nguyen Subject: Re: [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiFrb: IPMI FRB Driver Thread-Topic: [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiFrb: IPMI FRB Driver Thread-Index: AQHZigLKl2lpOFtG4Ue2aY42cygMcq9hAy8g Date: Fri, 19 May 2023 04:37:40 +0000 Message-ID: References: <20230513123327.1496-1-abner.chang@amd.com> In-Reply-To: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=fcd0bc44-b76f-415f-894c-32aad6e8ae60;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-05-19T04:37:22Z;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: MN2PR12MB3966:EE_|MW4PR12MB6975:EE_ x-ms-office365-filtering-correlation-id: 089fffdf-14b3-4879-7394-08db5822c7f5 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: bMOqvKlyrMJuAJixD2eJ99kMI0XuopOSaPxYy26ngTTkx+K33XYPM2k8nSg7iO4m5l0Z1Om7Y7MgupQHTDvkbjcc9IISKNk+j0rU9RjDAn91wAGb0BWiaKoq0Obsl8kDnyqWmN2XBGfycyw035jArugCqsySpjz86rfUi47azZTN7GU6ScmL8NXlitQshGjEvGszcfqlRYzgjG03aUwi+CX8faWPdxKp0aUnUJgW/HAwsCDUVE1qGV3ELU9pPcmZkp1bzB2WToSRIYA08wWLy5inHAXp1cY3csX+degH5CVcRmG2qCbRWw2JeyN6uaUyA9pP9DlE8xdE3j3ZkVPqNkFpg2IOt1pEFNtoyOciw7GyxCW7NbewfilwZ0Nt5xuLo4WJrugM9BITnMCeAoGZRCJj5tQBQtPgL6Fg8awT3dG7lCJu2w4EkturLyUaR9Yywb/apA1D66eEv2DY1W2jTqUBFGSRYfxWDT1twsMe0x+bIs4jB7BHOGwxpQP3ITsE6cRpJCc3Hs8Lrbb8bhzrl2rADs/c7oGqJkFC9bRM+XiBD8qyUhv8ceWtHbkCBxyxAvzWdF9ddbe8ySR0bQSLHn9b7RIm86Z78LyXHckHq6Rs3k91GlxA2VK5R0D0FO7H x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB3966.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(346002)(376002)(366004)(396003)(39860400002)(136003)(451199021)(6506007)(9686003)(53546011)(7696005)(83380400001)(122000001)(33656002)(86362001)(38070700005)(186003)(38100700002)(55016003)(110136005)(19627235002)(54906003)(478600001)(2906002)(316002)(30864003)(4326008)(8936002)(8676002)(41300700001)(52536014)(5660300002)(66476007)(66446008)(64756008)(76116006)(66946007)(66556008)(71200400001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Ag7PUulO7M4Plp0te2m0Ys6Cn1fXr8DzpfHzAvw9Yk1Mflc5vtr92WY2136C?= =?us-ascii?Q?jaHyk1rpHyEwGDCdLJHdYYDm4w4XTAAwUBIBLgcrs+MrW3ns6XwLIreT8G7c?= =?us-ascii?Q?OCQmuJ/gLNT+va9ckzhfwOTAJ6OtZdxvULOB8/QFhKT5hvAerLRnK32ymBaM?= =?us-ascii?Q?U+67aQlPxAKXlApMD20ZRH4v7OFJ8ZkSZBhMu96Bhtms0uBBbfIzBctHc0Ax?= =?us-ascii?Q?XODq1zEsKDzvFxcJ4inQG1aA4f+ZefsTKm/6B2HuZOyti01/rp5yhW9+qaWQ?= =?us-ascii?Q?CyT64VjZ5cQoXIUEppKgVIWUAN3cCSUeJsfZ4/+im6CWcsv8o0qHKFVIZtF1?= =?us-ascii?Q?x4I0slCA3Jn6tlz5SmGjaPWVlMWtQu8p0Ljvv3aib87a3qUH6YscuMlYqSUu?= =?us-ascii?Q?Xal1Eq0AtLFWhjmnXsLWzlH2ofREwVeI+Vkn34WUFYoxuxcuugXziT9Wdlzx?= =?us-ascii?Q?Gm9A1OCuYn4L/Mn+g8M/fscb48i34Y2NJ+7onW7mtNAGloAtCf3SdsDddlIk?= =?us-ascii?Q?3Xyp2vDn2zfDeIhbGtBoA0wdhsyHckVhg9RvUiteqBOu878tOT2o+tJyHEQj?= =?us-ascii?Q?xVE/50Y5f+BRGr0Mqm6lR6CeppySJBQFH8RRqldaA5NoZJEILk8n02slNjOn?= =?us-ascii?Q?Hf1+tz2sjbv93WfJXSefTpUuTt0euNaKkui63E8rpD0RWv2cjIIZIdrHiuH9?= =?us-ascii?Q?zKERyo7EzCRmKxdTdlDKtXWIfWuNki7pLY5CTo8Cj86rL8AIkSm1BG/gcmwA?= =?us-ascii?Q?MtnFc4DjcTKtmvbBWBhVmgl1Jd5Dk8h1UkWPC3yQ8myq0r055B6rT70MBL4n?= =?us-ascii?Q?dm6U0VHJvtYk6eLyo3OjijscqooShZwLKJf1BAo3j3gmCC9RKxA/Z9fFORR2?= =?us-ascii?Q?xrVET9g/kEFe/vXGfMrdaV60DR6DDgAGp1ge/f4r/OflI0GWeMvu8tXyIw8C?= =?us-ascii?Q?985NZGn9xejW/ypxe558+ilWBOgRRK3WimhfCaPc2TTqCC9F/faY1sKxQpdZ?= =?us-ascii?Q?YcgrBwyuRi5IbTIr9Scqm5f+4lRL1Xho6NGveM+WS2Z/Si00m0oUCiVdFzYS?= =?us-ascii?Q?rQX5TlUNo5KxGMqMv+oiz8w3WBm7exdP1q92VTuNt0qz9MlDOUmaOQSbtrmx?= =?us-ascii?Q?i/r3UJ3jZp8cZxWnwLATw4oQnq/r6O+G3o12uLj+rhPYOvbxfWJ4oVQFbfd8?= =?us-ascii?Q?t7zBna2kPfqUGMufA0SSj/LyNRogwot1kHakuWvHmLUmztHcv1orLHNao36J?= =?us-ascii?Q?IwZMdunHOBNZ80DSnsIJ0Vo1vWITH+BM+AB08ffd0nrCjGSnVD0B2CV3AFHX?= =?us-ascii?Q?oDDlc8as54O/Q3Iayax4pjy7Ve22cytfrb+cglbXndSk9Miw10ESIhphCEAi?= =?us-ascii?Q?y67KL+9ttdO4lGYqyDIfM8TKbLglIg6Gku6sd5mljipZFmc7Bnhqg39dnNB+?= =?us-ascii?Q?O4BEno/Fe6cAVCktWcXsa3/9sudV8Ar9lQpQF1zSMjfMrCSFH4aQukd0a1bE?= =?us-ascii?Q?D0D+0dLliyovDwIbjHbboSn2shVDgWkuhfeT9WVNTbVi9xsE33h8mQON4w?= =?us-ascii?Q?=3D=3D?= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB3966.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 089fffdf-14b3-4879-7394-08db5822c7f5 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 May 2023 04:37:40.9402 (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: 6pWhQ9Tl5VUYHnKRONgUCH1HDxlV7oMWC5m5meiBnEx8RY49NsLLquIcfmxK5WLRVo33yBKOHnYvUINsvX6Z2A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6975 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable [AMD Official Use Only - General] Thanks, typos are fixed. Abner > -----Original Message----- > From: Oram, Isaac W > Sent: Friday, May 19, 2023 11:34 AM > To: Chang, Abner ; devel@edk2.groups.io > Cc: Attar, AbdulLateef (Abdul Lateef) ; Nickle > Wang ; Tinh Nguyen > > Subject: RE: [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiFrb: IPMI > FRB Driver > > Caution: This message originated from an External Source. Use proper caut= ion > when opening attachments, clicking links, or responding. > > > Reviewed-by: Isaac Oram > > Typo in "wtchdog" and "Failt". Can be fixed prior to commit. > > -----Original Message----- > From: abner.chang@amd.com > Sent: Saturday, May 13, 2023 5:33 AM > To: devel@edk2.groups.io > Cc: Oram, Isaac W ; Abdul Lateef Attar > ; Nickle Wang ; Tinh Nguyen > > Subject: [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiFrb: IPMI FRB > Driver > > 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 thi= s patch. > > We will still keep the one under IpmiFeaturePkg/Frb until the reference t= o 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/ManageabilityPkg/ManageabilityPkg.dec > index 38813c5f48..b0ca01094a 100644 > --- a/Features/ManageabilityPkg/ManageabilityPkg.dec > +++ b/Features/ManageabilityPkg/ManageabilityPkg.dec > @@ -80,3 +80,8 @@ > > gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable|FALSE| > BOOLEAN|0x10000005 > > gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmSmbiosTransfer > Enable|FALSE|BOOLEAN|0x10000006 > > +[PcdsDynamic, PcdsDynamicEx] > + > +gManageabilityPkgTokenSpaceGuid.PcdFRB2EnabledFlag|TRUE|BOOLEAN|0 > x20000 > +001 > + ## This is the timeout value in milliseconds, default set to 360 > +milliseconds > + # @Prompt IPMI Fault Resilient Booting timeout value in milliseconds. > + > +gManageabilityPkgTokenSpaceGuid.PcdFRBTimeoutValue|360|UINT16|0x2 > 000000 > +2 > diff --git a/Features/ManageabilityPkg/Universal/IpmiFrb/FrbDxe.inf > b/Features/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/Features/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/Features/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 sup= ported. > + > +**/ > +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_BIOS_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 cle= ar > + 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 expirati= on > occurred. > + // > + Status =3D IpmiGetWatchdogTimer (&GetWatchdogTimer); if (EFI_ERROR > + (Status)) { > + return Status; > + } > + > + // > + // If FRB2 Failure occurred, report it to the error manager and log a = SEL. > + // > + 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.Ti= merUse; > + SetWatchdogTimer.TimerActions =3D > GetWatchdogTimer.TimerActions; > + SetWatchdogTimer.PretimeoutInterval =3D > GetWatchdogTimer.PretimeoutInterval; > + SetWatchdogTimer.TimerUseExpirationFlagsClear =3D > GetWatchdogTimer.TimerUseExpirationFlagsClear; > + SetWatchdogTimer.InitialCountdownValue =3D > GetWatchdogTimer.InitialCountdownValue; > + 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 retrie= val > + > +**/ > +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 expirati= on > 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/Features/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, NoTimeOutInterr= upt. > i.e no action when BMC watchdog timeout > + // Byte 3 > + FrbTimer.PretimeoutInterval =3D 0; > + // Byte 4 > + FrbTimer.TimerUseExpirationFlagsClear |=3D BIT1; // set > + Frb2ExpirationFlag > + > + // 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 > successfully. > + @retval Others Indicates that Ipmi initialization could not com= plete > 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; > +} > -- > 2.37.1.windows.1