From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.107.223.43]) by mx.groups.io with SMTP id smtpd.web11.18481.1683876649150182875 for ; Fri, 12 May 2023 00:30:49 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=selector2 header.b=Diketw/L; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: nvidia.com, ip: 40.107.223.43, mailfrom: nicklew@nvidia.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JhcJ8+bnZcdngLMFb5fGsoxYJ+03Qg59drj35qJUkAaRvJBTwgrLS29P2fXvTh2BFqai0qx0DjUJNjYnwA/vJxPq0u75uchVk2Cn33+8cvGHeUmWbdEdjdyxIhSJwwR5xJIretgMdf2RjhFuQlopSTaB1dP4LZcnNdnkqxyYJ6ppP72kk5iLywB8X5zHUK5k3P7FXDUVZqgkHCsyigO7XcpmrPa1lZyeYrHn4EOknJg6YOcyJlT8uttj49V4AykaZgzU11AfbY53DTMbf4l2Mo6zcTqroIgq5F5KvjPQxbLOE7UeLpWUKSnCt4suGLsVcFjvEcnhC7zpY4PvjWpLLw== 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=17yjXff3Iy0EMInZfWdrbYroC1az1JpR+SLfB5nQfaM=; b=ZSBuzuwoF4HonPwiJhlWPiwYY3umiW8mUGnccwVgfP/mCw089l044QLIDhmmnrgG/jmE29+4fjyNvDqmYDLnh4xr3c9M90+t4AAgeRSN0sgzv8MkH6CUlA/5MYPr7GiPcKGbwb0KEU5nGKp4aszf/uyeDHiSxWFV/8JRshgOjc1HusBGJa9MpRBoc8UU1OD2eK8+PbqWY8+0v3cJCseUwyE6+prsXBx6lXUJtVKbwnINOaksyvPMvpuRL9j4TIPkTi9emD3cW4cbUnoAi3s1ZKg8e3j+kPTTROJgSHbkjw/qgtF8b/PBcGk8pdCHiY1RZAo995z9rFqPJWmGp9LifA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=17yjXff3Iy0EMInZfWdrbYroC1az1JpR+SLfB5nQfaM=; b=Diketw/LfowQQiYhaAz+FNmqiLX0MBzGR7PNqRr/JZ9x/pAP/MuiPg9lHPe5IkSDtfB3aVr/WAu8Vwe8OT5rD5iLnn3T1qtGu3OUZ1Sjm+essKKUdB6YDCsvRcA56fwHly88g9a3CKZe/D4RGI1Uc9Zew4IGdauOusMSk1YA8JVUujX2rG4vubRrQ6KdxZOPPxo2ZJ8gEje/LEHT/vZGZ4vvBF6aE3lM45ynM0VJ/OVbj66r9wJji8SpO/YwBwcnybMJTP15utKChioThrUoR3q8IFgphrqZcpErduGQi+31lNDFPpbJ8onhqHqdnKanFOJvUTu5b2FzF2zxXHTaKg== Received: from MW3PR12MB4409.namprd12.prod.outlook.com (2603:10b6:303:2d::23) by IA0PR12MB7601.namprd12.prod.outlook.com (2603:10b6:208:43b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.38; Fri, 12 May 2023 07:30:47 +0000 Received: from MW4PR12MB7031.namprd12.prod.outlook.com (2603:10b6:303:1ef::6) by MW3PR12MB4409.namprd12.prod.outlook.com (2603:10b6:303:2d::23) 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:30:44 +0000 Received: from MW4PR12MB7031.namprd12.prod.outlook.com ([fe80::d9df:b45b:2cc1:f017]) by MW4PR12MB7031.namprd12.prod.outlook.com ([fe80::d9df:b45b:2cc1:f017%5]) with mapi id 15.20.6387.023; Fri, 12 May 2023 07:30:44 +0000 From: "Nickle Wang" To: "abner.chang@amd.com" , "devel@edk2.groups.io" CC: Isaac Oram , Abdul Lateef Attar , Tinh Nguyen Subject: Re: [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiOsWdt: IPMI OS Watchdog timer Driver Thread-Topic: [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiOsWdt: IPMI OS Watchdog timer Driver Thread-Index: AQHZhIdKD4TRGJPNB0O7UhExClhDuK9WPilA Date: Fri, 12 May 2023 07:30:44 +0000 Message-ID: References: <20230512040649.384-1-abner.chang@amd.com> In-Reply-To: <20230512040649.384-1-abner.chang@amd.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MW4PR12MB7031:EE_|MW3PR12MB4409:EE_|IA0PR12MB7601:EE_ x-ms-office365-filtering-correlation-id: 82e2f72b-6c86-49dc-8fb9-08db52bacc4c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: q5zMW5PV/lyLC7N+ZdOM9UywpNSkL6UmS5FGtT+tjzwS/QQ2QR/+unfTPwh8R+G3SMPPehUBMxvS9NrZq5VKyAf3M3QRjrHtgD9AaXk04Dlf6WkVjq2aFE3X2stX/4c41QAEFgmEDYYoxCyxzUhaT3TIYfu0iJ7gI43yQj1tBoYykTzChHxuel5W/CU6aFrxnVqc9tqY1E92FonVl9nE5Z9MyFuL2QKIAZEzH27LF/ZKukI+Cg7g2dcqSnU1RahNe1aTAnDeoi3aMoSyGg4Xoq2Yrlc+Zu/zNm/7AQCUmZ6L8PewwKBnCnJWs8UyrgWHAwqPAxvYGGaqsFonqoqWiPdFp+OifT7CRpltoiu0DQ5XiuOtmz7MYeXeFrLr300o0NhU9fot0Pq+zCgvcXaKJ+CbH1exaMb50I48UYizwySw8voEWsr+IxD/hdO6d7unI67OwBPiYOQWfuNaHFbIucCHaCf2zJi4OoDvZ8PeXebYTX9dehfdVzpY/oJ2lHq9fMgq8bVWMWiv69Y3NEa8hMRkgR/MxU3khbWLkOr6wCHrISpErWn/VF0lf6kREQj45fubDSZMivY1whMlQCggmNlfX7nfJahR6fZONP80KXmRLVIqcKrT6rT6Pfr87fP1 x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW3PR12MB4409.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(6029001)(4636009)(346002)(376002)(136003)(39860400002)(396003)(366004)(451199021)(38100700002)(122000001)(53546011)(9686003)(83380400001)(26005)(6506007)(55016003)(186003)(33656002)(2906002)(52536014)(5660300002)(8676002)(8936002)(478600001)(54906003)(110136005)(19627235002)(38070700005)(7696005)(71200400001)(41300700001)(316002)(86362001)(64756008)(66446008)(66476007)(66556008)(66946007)(76116006)(4326008);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?0kIB/R72DR4uI/wFlSJiLp9L6ltjz3SdjgvB48SExRaJQCvM8Gh+fenz2gd/?= =?us-ascii?Q?tQO5uEUEc5YI8c1Prv9JjkUqBrsjku3+CqHYKK7hY8n3bgN9fT6mNWsvw2PM?= =?us-ascii?Q?zGhG6/rVyt0Z6r0o/pX6TLney7WEclw1Vn9NS/EulgVc9EyB+ovezlj3P8/4?= =?us-ascii?Q?snZf1LJ4R7+/LZUPlbcEynwI5nTA5eqBcEPOxFuy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+MzziMGCZ/1eAytRr6pnWs9GdEP9P6LEyBHnKFThLYROzRk15JqlRT?= =?us-ascii?Q?JclP1+OqnvNtzgA1Yc8/WnLEdtzpdEly7l93wKGofJKMVgmvLQU44kGo5BFZ?= =?us-ascii?Q?2G39DDmwsDl3WMIo7y9TUBdOvi1a4OCBCE28f/wGWWe1RwQTdHDlfim3TIJP?= =?us-ascii?Q?OEyEio8iZfJWRTu8/BVYeXxrGZbN3ynwBzbQYZeB5W+GhliI6VOnR/TV/nY3?= =?us-ascii?Q?Szad3YmGO978Id+OB35a6lwnn/mYPtwucv8UXtwGnSOTZe28RYDLsPJaP7Wc?= =?us-ascii?Q?JTZOAilCrUIZpPZNodbp7Dueal1/3vAoajbBO3zdEKIlSLnttxQlqbU+qfld?= =?us-ascii?Q?VRhhCAfMNP1u0kIg6Ac9whUQYgP9VbZfXNzDJoGbIhfaksicOwaU/jkj9FuQ?= =?us-ascii?Q?/6MIPAGSvoZMo0jVUtM/BSrJrFrA7saQGxdN5h2Tpv93hpKa1a2DfPb7vfxM?= =?us-ascii?Q?F/no3Dmyvrd6z3e2eXw=3D?= MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW4PR12MB7031.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 82e2f72b-6c86-49dc-8fb9-08db52bacc4c X-MS-Exchange-CrossTenant-originalarrivaltime: 12 May 2023 07:30:44.7761 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 123+bsEiGOt9i6/u8RgUyd1ah7rbji90pMfAmlWcaim42WQUXTz+PYkz5wkJJQXv80ngDfvGrS/bkM4cWmEjBw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB7601 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Nickle Wang Regards, Nickle > -----Original Message----- > From: abner.chang@amd.com > Sent: Friday, May 12, 2023 12:07 PM > To: devel@edk2.groups.io > Cc: Isaac Oram ; Abdul Lateef Attar > ; Nickle Wang ; Tinh Nguyen > > Subject: [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiOsWdt: IPMI OS > Watchdog timer Driver >=20 > External email: Use caution opening links or attachments >=20 >=20 > From: Abner Chang >=20 > IpmiOsWdt is cloned from > edk2-platforms/Features/Intel/OutOfBandManagement/ > IpmiFeaturePkg/OsWdt 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. >=20 > We will still keep the one under IpmiFeaturePkg/OsWdt until the reference= to this > instance are removed from platforms. >=20 > Signed-off-by: Abner Chang > Cc: Isaac Oram > Cc: Abdul Lateef Attar > Cc: Nickle Wang > Cc: Tinh Nguyen > --- > .../Universal/IpmiOsWdt/OsWdt.inf | 33 ++++++ > .../Universal/IpmiOsWdt/OsWdt.c | 112 ++++++++++++++++++ > 2 files changed, 145 insertions(+) > create mode 100644 > Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.inf > create mode 100644 Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.c >=20 > diff --git a/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.inf > b/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.inf > new file mode 100644 > index 0000000000..b5af3b25e1 > --- /dev/null > +++ b/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.inf > @@ -0,0 +1,33 @@ > +### @file > +# Component description file for IPMI OS watch dog timer 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 OsWdt > + FILE_GUID =3D BA4FD21F-8443-4017-8D13-70EC92F4BD4= C > + MODULE_TYPE =3D DXE_DRIVER > + VERSION_STRING =3D 1.0 > + ENTRY_POINT =3D DriverInit > + > +[Sources] > + OsWdt.c > + > +[Packages] > + ManageabilityPkg/ManageabilityPkg.dec > + MdePkg/MdePkg.dec > + > +[LibraryClasses] > + DebugLib > + IpmiCommandLib > + UefiBootServicesTableLib > + UefiDriverEntryPoint > + UefiLib > + > +[Depex] > + TRUE > diff --git a/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.c > b/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.c > new file mode 100644 > index 0000000000..e2bbd95b83 > --- /dev/null > +++ b/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.c > @@ -0,0 +1,112 @@ > +/** @file > + IPMI Os watchdog timer Driver. > + > +Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
> +SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +BOOLEAN mOsWdtFlag =3D FALSE; > + > +EFI_EVENT mExitBootServicesEvent; > + > +/*++ > + > +Routine Description: > + Enable the OS Boot Watchdog Timer. > + Is called only on legacy or EFI OS boot. > + > +Arguments: > + Event - Event type > + *Context - Context for the event > + > +Returns: > + None > + > +--*/ > +VOID > +EFIAPI > +EnableEfiOsBootWdtHandler ( > + IN EFI_EVENT Event, > + IN VOID *Context > + ) > +{ > + EFI_STATUS Status; > + IPMI_SET_WATCHDOG_TIMER_REQUEST SetWatchdogTimer; > + UINT8 CompletionCode; > + IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer; > + static BOOLEAN OsWdtEventHandled =3D FALSE; > + > + DEBUG ((DEBUG_ERROR, "!!! EnableEfiOsBootWdtHandler()!!!\n")); > + > + // > + // Make sure it processes once only. And proceess it only if > + OsWdtFlag=3D=3DTRUE; // if (OsWdtEventHandled || !mOsWdtFlag) { > + return; > + } > + > + OsWdtEventHandled =3D TRUE; > + > + Status =3D IpmiGetWatchdogTimer (&GetWatchdogTimer); if (EFI_ERROR > + (Status)) { > + return; > + } > + > + ZeroMem (&SetWatchdogTimer, sizeof (SetWatchdogTimer)); // // Just > + flip the Timer Use bit. This should release the timer. > + // > + SetWatchdogTimer.TimerUse.Bits.TimerRunning =3D 1; > + SetWatchdogTimer.TimerUse.Bits.TimerUse =3D > IPMI_WATCHDOG_TIMER_OS_LOADER; > + SetWatchdogTimer.TimerActions.Uint8 =3D > IPMI_WATCHDOG_TIMER_ACTION_HARD_RESET; > + SetWatchdogTimer.TimerUseExpirationFlagsClear &=3D ~BIT4; > + SetWatchdogTimer.TimerUseExpirationFlagsClear |=3D BIT1 | BIT2; > + SetWatchdogTimer.InitialCountdownValue =3D 600; // 100ms / cou= nt > + > + Status =3D IpmiSetWatchdogTimer (&SetWatchdogTimer, &CompletionCode); > + return; > +} > + > +/*++ > + > +Routine Description: > + This is the standard EFI driver point. This function intitializes > + the private data required for creating ASRR Driver. > + > +Arguments: > + As required for DXE driver enrty routine. > + ImageHandle - ImageHandle of the loaded driver > + SystemTable - Pointer to the System Table > + > +Returns: > + @retval EFI_SUCCESS Protocol successfully started and instal= led. > + @retval EFI_OUT_OF_RESOURCES The event could not be allocated. > + > +--*/ > +EFI_STATUS > +EFIAPI > +DriverInit ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + EFI_STATUS Status; > + > + Status =3D gBS->CreateEvent ( > + EVT_SIGNAL_EXIT_BOOT_SERVICES, > + TPL_NOTIFY, > + EnableEfiOsBootWdtHandler, > + NULL, > + &mExitBootServicesEvent > + ); > + > + return Status; > +} > -- > 2.37.1.windows.1