From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web11.12460.1684465949007505253 for ; Thu, 18 May 2023 20:12:29 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=BBjeSLXW; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: isaac.w.oram@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684465948; x=1716001948; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=8bzJ8JKgkNcpMw3oCPxe4IchzIEkmQKfvjQAtyNCU1A=; b=BBjeSLXWDJW0n1H1ZOXEHYA9GRLXyWmPiFpVL6w5aSF6w7trJkrLWOww pmPRvGeUuiDvUwBnf2bw41QjPkos9nTL1G9d6EG6O+YGG/lsYiMkfeLkg H45ygwy2bEFOrnn0aZaf35eB/5EuQXgcAvuGcw9+UTtpCOJ41riByz5Nz 3fk0kTV18/wpBcIUhrCs6zIFEr4tXPribvr7sgMvKQgazg3BXFj9Hj/Ak CxgYlW7ye4xjWJwHbzR2YFghBJPxjRrWlrLfdiSuG6hPiHcLtpWJJyOls V3ofwsXS6ZDkjrZG7uEqY9jMuH8HDRYQnNLGB5wRpB+qA8n9/wLtH0kzO Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10714"; a="380477329" X-IronPort-AV: E=Sophos;i="6.00,175,1681196400"; d="scan'208";a="380477329" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2023 20:12:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10714"; a="846734122" X-IronPort-AV: E=Sophos;i="6.00,175,1681196400"; d="scan'208";a="846734122" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmsmga001.fm.intel.com with ESMTP; 18 May 2023 20:12:28 -0700 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 18 May 2023 20:12:27 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Thu, 18 May 2023 20:12:27 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.104) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.23; Thu, 18 May 2023 20:12:26 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nGLDF0rdqJzWVcsHaqjWF81Ar4y7xtSljEjk5Igj7qd1T0/8DYHQbLae0DRo7Fj6UIShi7Cq5eJOJ5XQqDhCDRGSyx5tV81RoZcWTn2iIZqzMC9BJE9jxr1TROBbrYw6JFGqbEmGrsGlpquBwoABpNGUfDBt760oerZNZKv4bUbisw9z624pXODieFClNcF1DB3oBcGaq0bE4R/R0qbXCaicKmGjU8Yj9bvC5AfmhwpepAXyAvD+HOcHu1tu74+TMF1rmP9uQomI6LxwgvxC0M0HQAAbohYrSSmzH3/crUPNMvnsRhpIvJ3RowqIEz6ovB7JYqJbRbdvqccEDBNWeA== 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=0Sf2yTUMBieCu4zyH9stBvI7WwtJQf8YdMnepI3lBPI=; b=VinSYz7fHET8xqWFsvsFbnX/ZEjMwb7fFLRPOblFEGYqZS2WJqpcsKvJEpKgI6tNV/WC+gz+CxD8/knqF9KIoK5Ok2qROM6Bvg9YcCvBz98lyWrbD2TuSCpno+Ti+BVZJpZjoVvLrtbxlzGNdGRy88t8XURUL7Fp2nkuRPs8Ig6SmlQnBDeR2vBjL+WKQOuMeKUeu2P6OwgRbEJpeKJ3DfiieWpk8BkussLIA+BqAumn1EnSeo6LX4sE5qtIAgUn9MgLYEXg5aRnVhye3r4XGKVWVHuOZ74KHPbASAyRVGtsgek5dI357jZvANNoFfuqoPzXKa09pBu/L23lrw6reg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from SA1PR11MB5801.namprd11.prod.outlook.com (2603:10b6:806:23d::13) by DM4PR11MB5357.namprd11.prod.outlook.com (2603:10b6:5:394::11) 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 03:12:11 +0000 Received: from SA1PR11MB5801.namprd11.prod.outlook.com ([fe80::6979:a90f:e224:41c5]) by SA1PR11MB5801.namprd11.prod.outlook.com ([fe80::6979:a90f:e224:41c5%4]) with mapi id 15.20.6387.030; Fri, 19 May 2023 03:12:11 +0000 From: "Isaac Oram" To: "devel@edk2.groups.io" , "abner.chang@amd.com" CC: Abdul Lateef Attar , Nickle Wang , Tinh Nguyen Subject: Re: [edk2-devel] [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiOsWdt: IPMI OS Watchdog timer Driver Thread-Topic: [edk2-devel] [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiOsWdt: IPMI OS Watchdog timer Driver Thread-Index: AQHZhIdSUP8Gt5686EqbA802QoFRmK9g9lRg Date: Fri, 19 May 2023 03:12:11 +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=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SA1PR11MB5801:EE_|DM4PR11MB5357:EE_ x-ms-office365-filtering-correlation-id: 0bf0e85a-1ff3-4c4a-8880-08db5816d684 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: WTE6QZKnO3IMLbn1GeFMWWYIxFaiL25gkZkKhK8EC9HPfBc+4AIrK+1ZSOunJtq6A7pPpfjduQcy7w5q/oL5TnZc+syCUNVMtFyWUs2WLQcEWAwERwopjLQT+Ufyn+cyezbiZQCGGxvttEL6jbqwnnSfUr1KjOvDyQbBZP6BrCXWn4N6NUc00fMDpdRVEv2wfY039CUUvp2oHFViS6/cPTGFbfsI1SD7NHwChL92xzzet9mEuwz1VxDrsMPLMrbhyFuIJOjG9x4IzrlDOKQN77w4ojBeS4dGXx27odu4OZsAqqHnUcMHbGdB94K7brG0eqyxCtnvScQLku+7UPd5eRt+5XptK2X+P95yHFynPXlA/i6qpYLi8YdODFkNMg9t4GzApCtvMD9uzqDpYaXhTT6lZonibdqpXr1MmAPK6Ha11To1r+eTcUBWvjCqm0dT9X7PYWiMSoJAIukKvvGu2gYKf7jBn2zNH5RFbAlmPayzgnC1wGAhO1p23rDUtqEPLjaqN6XwA7cjvJaAJNoDy/EA+CY6fi3ekvLOfHdZPP7Vx565cQR0QAw3QWyacwcy5iT0UUPhKdgcXp4EIKC8vePJMcFKgy2R85IT536Gjp0lELupVPbYhQnTv6RvLBM6cRkljZMzCssBYCI/p4Pf+w== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA1PR11MB5801.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(6029001)(136003)(39860400002)(396003)(366004)(376002)(346002)(451199021)(2906002)(316002)(478600001)(52536014)(41300700001)(4326008)(8676002)(8936002)(19627235002)(54906003)(110136005)(5660300002)(66899021)(71200400001)(66556008)(66946007)(76116006)(64756008)(66476007)(66446008)(7696005)(53546011)(966005)(9686003)(6506007)(26005)(82960400001)(38100700002)(186003)(55016003)(122000001)(83380400001)(38070700005)(86362001)(33656002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?ZlBRn5f0jnnAXIh4IOEXo2PuW6VQXjhqEgPhWgxkzSoC93GqGvl614V+eilh?= =?us-ascii?Q?J2nyMBNV8eDfgGf5wpgQCs0PSBzGIJvyQt8DJx3FK76/TMvaOxNHcv/tJzJf?= =?us-ascii?Q?lYk4HTYFnCenSNZdAGPHFbQM3eiru6EoPmHTpfD94xJyOmCBx4idDrgQ6J0k?= =?us-ascii?Q?6FjYkbbIFtrAwvGk+70Ovf1lB3rwY/M9WCiby01T0g+CA9sgDQpk35m7w1of?= =?us-ascii?Q?mf4W7lwKYep1k807WBi+vIjKpApSuyfcefFMhiLdHjsvWXlOOWJQH8PJpjd2?= =?us-ascii?Q?fuEZ7vXhe+hqvFGHO1ztFsEo9zSuaDKVZ9/sQx27qiOBm/e+vq3i5K65jVv0?= =?us-ascii?Q?WXTc8mCLrW/zLqpTLoizTFyPs+jX9AKhtQ8hHpAjGASiw8DuHBOVbz8sOC4D?= =?us-ascii?Q?SUkn7/VuQPKXwYtmZvi8GCGfddmogBbkpEPn5DXa8rpn4KfXrLjqYTxOVwR/?= =?us-ascii?Q?+A0SnzFhLur2kEA1utiR/ioivu+/oNlvPEGnuQ24gvnVuMELIqp3403W3ymu?= =?us-ascii?Q?376I/UEDcMbCrQ9I/Z4Skz+oIuuSbUMjCcnRr3D1lwbamlEgB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2BUWGg4hKsdbMgWjnmMxBTRXT/PDh1KOMOf6k15TTohLLAvy?= =?us-ascii?Q?17JwZveeAb473uj5b/6T8caoP/r9Fryvj35ZA3CPAeGPpCQr7FtO+tMWWdQa?= =?us-ascii?Q?xr8Iei3NimBlv/raYZMNKDs+HsKBdnzA9J+jNwQe?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SA1PR11MB5801.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0bf0e85a-1ff3-4c4a-8880-08db5816d684 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 May 2023 03:12:11.4426 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: mDvd2eg27K01OV0hEpWYYBdTKvgQcyCYE0gbr2EgTURY5Ee31DXWHCxmmjvlpuQEd4Vq5xtE6rJVbrzGzSmrFQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB5357 Return-Path: isaac.w.oram@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Isaac Oram -----Original Message----- From: devel@edk2.groups.io On Behalf Of Chang, Abner= via groups.io Sent: Thursday, May 11, 2023 9:07 PM To: devel@edk2.groups.io Cc: Oram, Isaac W ; Abdul Lateef Attar ; Nickle Wang ; Tinh Nguyen Subject: [edk2-devel] [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiOsWd= t: IPMI OS Watchdog timer Driver From: Abner Chang 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 this = patch. We will still keep the one under IpmiFeaturePkg/OsWdt 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 --- .../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 diff --git a/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.inf b/Feat= ures/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=20 +reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # ### + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D OsWdt + FILE_GUID =3D BA4FD21F-8443-4017-8D13-70EC92F4BD4C + 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/Featur= es/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=20 + OsWdtFlag=3D=3DTRUE; // if (OsWdtEventHandled || !mOsWdtFlag) { + return; + } + + OsWdtEventHandled =3D TRUE; + + Status =3D IpmiGetWatchdogTimer (&GetWatchdogTimer); if (EFI_ERROR=20 + (Status)) { + return; + } + + ZeroMem (&SetWatchdogTimer, sizeof (SetWatchdogTimer)); // // Just=20 + flip the Timer Use bit. This should release the timer. + // + SetWatchdogTimer.TimerUse.Bits.TimerRunning =3D 1; + SetWatchdogTimer.TimerUse.Bits.TimerUse =3D IPMI_WATCHDOG_TIMER_O= S_LOADER; + SetWatchdogTimer.TimerActions.Uint8 =3D IPMI_WATCHDOG_TIMER_A= CTION_HARD_RESET; + SetWatchdogTimer.TimerUseExpirationFlagsClear &=3D ~BIT4; =20 + SetWatchdogTimer.TimerUseExpirationFlagsClear |=3D BIT1 | BIT2; + SetWatchdogTimer.InitialCountdownValue =3D 600; // 100ms / count + + 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 installe= d. + @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