From nobody Mon Dec 2 14:14:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+114088+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114088+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1705679182684230.99605483540847; Fri, 19 Jan 2024 07:46:22 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=MQzDTtiOpQUe8E3tz25TMYzk/gIrn/uV42YDctRHRuA=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1705679182; v=1; b=f3Y5a9kpOONShIOAzpaV9JPRk59BAtsOX1H936i1CSPpGPKwPT+3WkHxq1fhsGUOKNc1VL3/ V3D5wdxOQkId1akCNdxtLgvA38aF+lgAqygjZPyUHmkSIWptdVOzIlkAgDhuzbueC3Vr7N9+hy5 AsYcSV4ccdbSpizghYHnT4rU= X-Received: by 127.0.0.2 with SMTP id gv8VYY1788612xdL42gYU4GA; Fri, 19 Jan 2024 07:46:22 -0800 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.106]) by mx.groups.io with SMTP id smtpd.web10.25619.1705679180683156874 for ; Fri, 19 Jan 2024 07:46:21 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e+zufJitAyiDjUxrA6Ef+FBVQQOMSqBfP1MfABGrt/paH+GeSai2doD7NpHHY1Twbj6vdr1kCYHwF6gcJkolv3RQRxgvKIbnyyeJzCSu9ZZkz0g6j+zBsewVpg69s0fRnvNwQrYan0V7vBHQeeIWe5+Wk2Pv7iDDnUSqTTUrbRjTv7Ubww+KwQQygaNtjJWkMiUeavbJPtgPAUnuXaHVFLx0rF51NaElcDyqQkbmRxW3PWpwcB7IuQjObPD9mZpQjDT1TPENP3JF8+G6O6pbffiFzzxKTVzQAFjf2JtEluKwEm3EUHPmjnQsfStM4EkdRzxYCsQtpPSeEYK5bdk54A== 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=1rfyZOkyDElgvMbDc5gUttHaHCLUr+mVoatRsKtXA4U=; b=JLnztLqsoSusWiQ+BFDh4kEZj2S1BqjBNKIG80oUfBj5gP8+Q1JZyXYBLUenjwgK7ueYbMuyYdQ3Q46dt0HMLwX2yf1qwWqBhZ0JNj2rfqdC/5mN9vDJgeHxbEhoWe4dTc/TrVeW3W+0iKWEbAWqTloZjmZPTcx4CJPZgoEe6LqmH0fPt5zB0JxjCjwcWPVO/9P4HiPTQV5m30+LLL18xrowq/pwqi60d5BMuBlcGqLksLnCzq9dJEAjh+wpRrYwnWG1DXRoJusEqiz9rsdZp+WgT5S+qiB1lFYfP2xTmxQngLcFfsSxA5PA3CepskPc3ai1JolkdbIXnrYKVuQMWw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from LV3PR01MB8464.prod.exchangelabs.com (2603:10b6:408:1a3::7) by MW4PR01MB6482.prod.exchangelabs.com (2603:10b6:303:65::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.26; Fri, 19 Jan 2024 15:46:17 +0000 X-Received: from LV3PR01MB8464.prod.exchangelabs.com ([fe80::7748:d4a3:bcd9:14c1]) by LV3PR01MB8464.prod.exchangelabs.com ([fe80::7748:d4a3:bcd9:14c1%6]) with mapi id 15.20.7202.024; Fri, 19 Jan 2024 15:46:17 +0000 From: "Rebecca Cran via groups.io" To: Leif Lindholm , Ard Biesheuvel , Sami Mujawar CC: Rebecca Cran , devel@edk2.groups.io Subject: [edk2-devel] [PATCH v4 1/3] ArmPkg: Update GenericWatchdogDxe to allow setting full 48-bit offset Date: Fri, 19 Jan 2024 08:45:52 -0700 Message-ID: <20240119154554.1052736-2-rebecca@os.amperecomputing.com> In-Reply-To: <20240119154554.1052736-1-rebecca@os.amperecomputing.com> References: <20240119154554.1052736-1-rebecca@os.amperecomputing.com> X-ClientProxiedBy: CH2PR04CA0022.namprd04.prod.outlook.com (2603:10b6:610:52::32) To LV3PR01MB8464.prod.exchangelabs.com (2603:10b6:408:1a3::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV3PR01MB8464:EE_|MW4PR01MB6482:EE_ X-MS-Office365-Filtering-Correlation-Id: 81dbbd39-268b-4558-2347-08dc1905c62e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: 32ZEUO3BcQ83+7FdkK48VoSq31DJxrC3J/GNTZqvd57aDtKQC0aaUkMoZrfdYDU6ClSGeYRHix2oFWtV0Mqnb3h5LMKCijtaZo+s1Dysm5wKQlxlotV1XwWDrtWGMGHJCw0Zyi1sQSmtWUFWjdcsmW+gzbp2b5oeX7yH9bJ9lc/K2odusP3wnEKwuD4w/AZlD3y9mfJ+QJPdChkGIGQQv9TRaDPtY2xevwYMzaKo593RaVmgkVdGgZeKfm/debg7awlYJjQ5IE/u059ANE9pnlI6de+gHrgK3X7RhkJVJvMM0EVZBMmKuGaxqL0GT1MfuFsyyymApHYG/QBivfvLmsn1WggHHI7ywwuaMVTF3n593Yhi800toKgVbnudoFoGgET7jF+zch5DXmpgB9t/c9kMwxzq2T7JHyfUWbL/sczuJUD4yPOL401nL+1XwDjU5f7837ZR/a14lvE8+4i7tz9hYY+J+OMXtkX7IQi2aQvrfVBImGtrjG73crkTuinKwebtxQvQxiIUqQ28fdZovcsiwFONX5+lK94IMPJ07HhqkONk8v/sOD/v+WIA9tSuvz4Coe1AgiraxS05YCl4FU/Ly6RooatmOChBdaM8BuQ= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?sfJv4TQCdHeS4ApHfggebxxvWaDOFnKtr9VDRcij3KhD3tFq4HstqoW16d6D?= =?us-ascii?Q?884MgxnmE/+VH9p6Fe7e2UQAKb+IWfO4jRHr3IgGWPGgpaYyF9+Zv0zYXtyG?= =?us-ascii?Q?mBgoP+zVJPdOPQfYA3DTr88OSYGGmKjWkp3Dxaxarl5C09UYPJ2BMvT8Qbdj?= =?us-ascii?Q?n53yBshirNnwcnm9Cr9StTizZsfU2B9G/QYCHrAIA/qHdO2+EOqLc20npiH/?= =?us-ascii?Q?SWcvfrN6FTQkccNzKfEZ+j/CNgERhrzHQhryzpyxBtvy4qyJMq4DpJ0fjR+/?= =?us-ascii?Q?EObN+kX9hpRrrZlzgnxOvkLQHR35ioxKeUmV7H+XGFWgprghiMPxz/cRyXEF?= =?us-ascii?Q?2kPQ9RRwarZFWbxrRuYMw6z18mV9GW2D+CU8qIAWdPIW9GrfDzQzc0Az9aNG?= =?us-ascii?Q?Q/v+KmgXqRBI4bPlvwR/aDOwkHcWNJsinwW1DyBRWXnCd243f3hje9jWJkfk?= =?us-ascii?Q?LCSSORXdQuLDTtu45oVkhUxcItp/wqFhveX4NEZGjJw9PUxTczhNg3HTyHM7?= =?us-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zJhndIda3FuFywwirbZt7E0zim?= =?us-ascii?Q?Cb2JiR7H1C3AJKc3OawYxgaBl8HLlDaUDBHTv1d1dxPB8Z7kwWKbI9HdKFKZ?= =?us-ascii?Q?kkJnD2viRhWV6wN+fc3U7k1Hve2QnHOHQOTSauiqkIhEHgcF/9C1Rsfhjj7t?= =?us-ascii?Q?Khqd60M4GeFcVCwW59T25pfwbcgOTKxU2GWt2yemb/7rjhFlU5onPLL08p6H?= =?us-ascii?Q?QSV3oUnH5PNA6robHYmIe+I=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 81dbbd39-268b-4558-2347-08dc1905c62e X-MS-Exchange-CrossTenant-AuthSource: LV3PR01MB8464.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2024 15:46:17.1834 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: p6TaFgvWIYf/cdiFlQ//bR7Q+gD7qQYrVXTzYpdpfd3QiNl0ny47S4wxy4BZsVf1vdbQk7t5ZF/pO8e0eJ4oUCnluig0dFgrKaZs0LM6P0HKnQ9vWKnof3ZkpwJuxyFQ X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR01MB6482 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,rebecca@os.amperecomputing.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: lk53xuNJHGn0FLASm61P9uqYx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1705679183161100005 Content-Type: text/plain; charset="utf-8" The generic watchdog offset register is 48 bits wide, and can be set by performing two 32-bit writes. Add support for writing the high 16 bits of the offset register and update the signature of the WatchdogWriteOffsetRegister function to take a UINT64 value. Signed-off-by: Rebecca Cran --- ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdog.h | 11 +++++++++- ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c | 23 ++++++++++++++= +----- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdog.h b/ArmPkg/D= rivers/GenericWatchdogDxe/GenericWatchdog.h index 9bc3bf47047c..fb117832683f 100644 --- a/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdog.h +++ b/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdog.h @@ -1,9 +1,13 @@ /** @file * +* Copyright (c) 2023, Ampere Computing LLC. All rights reserved.
* Copyright (c) 2013-2017, ARM Limited. All rights reserved. * * SPDX-License-Identifier: BSD-2-Clause-Patent * +* @par Reference(s): +* - Generic Watchdog specification in Arm Base System Architecture 1.0C: +* https://developer.arm.com/documentation/den0094/c/ **/ =20 #ifndef GENERIC_WATCHDOG_H_ @@ -14,12 +18,17 @@ =20 // Control Frame: #define GENERIC_WDOG_CONTROL_STATUS_REG ((UINTN)FixedPcdGet64 (PcdGen= ericWatchdogControlBase) + 0x000) -#define GENERIC_WDOG_OFFSET_REG ((UINTN)FixedPcdGet64 (PcdGen= ericWatchdogControlBase) + 0x008) +#define GENERIC_WDOG_OFFSET_REG_LOW ((UINTN)FixedPcdGet64 (PcdGen= ericWatchdogControlBase) + 0x008) +#define GENERIC_WDOG_OFFSET_REG_HIGH ((UINTN)FixedPcdGet64 (PcdGen= ericWatchdogControlBase) + 0x00C) #define GENERIC_WDOG_COMPARE_VALUE_REG_LOW ((UINTN)FixedPcdGet64 (PcdGen= ericWatchdogControlBase) + 0x010) #define GENERIC_WDOG_COMPARE_VALUE_REG_HIGH ((UINTN)FixedPcdGet64 (PcdGen= ericWatchdogControlBase) + 0x014) +#define GENERIC_WDOG_IID_REG ((UINTN)FixedPcdGet64 (PcdGen= ericWatchdogControlBase) + 0xFCC) =20 // Values of bit 0 of the Control/Status Register #define GENERIC_WDOG_ENABLED 1 #define GENERIC_WDOG_DISABLED 0 =20 +#define GENERIC_WDOG_IID_REV_SHIFT 16 +#define GENERIC_WDOG_IID_REV_MASK 0xF + #endif // GENERIC_WATCHDOG_H_ diff --git a/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c b/ArmPk= g/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c index 66c6c37c08b0..20549aa91d94 100644 --- a/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c +++ b/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c @@ -1,5 +1,6 @@ /** @file * +* Copyright (c) 2023, Ampere Computing LLC. All rights reserved.
* Copyright (c) 2013-2018, ARM Limited. All rights reserved. * * SPDX-License-Identifier: BSD-2-Clause-Patent @@ -35,16 +36,23 @@ STATIC UINTN mTimerFrequencyHz =3D 0; It is therefore stored here. 0 means the timer is not running. */ STATIC UINT64 mNumTimerTicks =3D 0; =20 +STATIC UINT8 WatchdogRevision; + +#define MAX_UINT48 0xFFFFFFFFFFFFULL + STATIC EFI_HARDWARE_INTERRUPT2_PROTOCOL *mInterruptProtocol; STATIC EFI_WATCHDOG_TIMER_NOTIFY mWatchdogNotify; =20 STATIC VOID WatchdogWriteOffsetRegister ( - UINT32 Value + UINT64 Value ) { - MmioWrite32 (GENERIC_WDOG_OFFSET_REG, Value); + MmioWrite32 (GENERIC_WDOG_OFFSET_REG_LOW, Value & MAX_UINT32); + if (WatchdogRevision =3D=3D 1) { + MmioWrite32 (GENERIC_WDOG_OFFSET_REG_HIGH, (Value >> 32) & MAX_UINT16); + } } =20 STATIC @@ -211,17 +219,17 @@ WatchdogSetTimerPeriod ( /* If the number of required ticks is greater than the max the watchdog's offset register (WOR) can hold, we need to manually compute and set the compare register (WCV) */ - if (mNumTimerTicks > MAX_UINT32) { + if (mNumTimerTicks > MAX_UINT48) { /* We need to enable the watchdog *before* writing to the compare regi= ster, because enabling the watchdog causes an "explicit refresh", which clobbers the compare register (WCV). In order to make sure this doe= sn't trigger an interrupt, set the offset to max. */ - WatchdogWriteOffsetRegister (MAX_UINT32); + WatchdogWriteOffsetRegister (MAX_UINT48); WatchdogEnable (); SystemCount =3D ArmGenericTimerGetSystemCount (); WatchdogWriteCompareRegister (SystemCount + mNumTimerTicks); } else { - WatchdogWriteOffsetRegister ((UINT32)mNumTimerTicks); + WatchdogWriteOffsetRegister (mNumTimerTicks); WatchdogEnable (); } =20 @@ -310,6 +318,7 @@ GenericWatchdogEntry ( { EFI_STATUS Status; EFI_HANDLE Handle; + UINT32 WatchdogIId; =20 Status =3D gBS->LocateProtocol ( &gHardwareInterrupt2ProtocolGuid, @@ -367,7 +376,9 @@ GenericWatchdogEntry ( ); ASSERT_EFI_ERROR (Status); =20 - mNumTimerTicks =3D 0; + mNumTimerTicks =3D 0; + WatchdogIId =3D MmioRead32 (GENERIC_WDOG_IID_REG); + WatchdogRevision =3D (WatchdogIId >> GENERIC_WDOG_IID_REV_SHIFT) & GENER= IC_WDOG_IID_REV_MASK; WatchdogDisable (); =20 return EFI_SUCCESS; --=20 2.34.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114088): https://edk2.groups.io/g/devel/message/114088 Mute This Topic: https://groups.io/mt/103832319/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Mon Dec 2 14:14:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+114087+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114087+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1705679182313351.7544285047926; Fri, 19 Jan 2024 07:46:22 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=XcaIY7uFvdj9+MPI6sAiOjTb4Usv58uHqcD+7LM6F6g=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1705679181; v=1; b=tlpjTxu2UMjJiHMRk7kpYplb9zz8KIyNrL2yFoRL7LiFDtyU/nMMeMCU9sZnFpTyvP2ydP+U SNa5JqiIy6thKb1tG+e5nuyJ57SWpCNe5cM0QSAhg+V+4Y/we/fZZrFMo4k96KKRbpgTnWo0luh Z0lzM4+6ENOIs94O35Zwlgl8= X-Received: by 127.0.0.2 with SMTP id d24xYY1788612xMW4r9zFXvr; Fri, 19 Jan 2024 07:46:21 -0800 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.106]) by mx.groups.io with SMTP id smtpd.web10.25619.1705679180683156874 for ; Fri, 19 Jan 2024 07:46:20 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mD1+FHf0oEMTJCmCYK/Qqpoek2jTEShVwn3xYJxnT+12lISm0xHyxGnqN/zri6PqmpGARI5k9mdVj5kDxjZButztX079zMmlSm+Nzk4yjisLWeVDv3xBP5M5xjUeAfuGIUGewXW4t2axZIij2FS0V1/xF/utuOiBPB1y+QNbbGENsC5eYw2nuQ8GDMv7NanD5LClsJoii3xBpHWKPkgbUEXIV1rxl3sH7Fiwh0gPd8UdIMuc9nHk24IJ98HlwVNHtARWeWoCgcLRdbYRBK64PMWo+Tu81W5ikQG1+nbhU/hQprjgx1KcHblYb+0KQix3etV8QtOXKR3RcdVxOdvHyg== 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=OxRSgQOC9JKh0y9XCK7ZYY4bsRT6B5AbL/orDGfnuoE=; b=jUFuNzYpHOOknTCDar2ubzb2U2r2mWUYYDdsXQqRXhDau0WFHbnY31e3N1k1pbekXbxX8qEYI0TOexjOK7aVPpqrGYqDk/hzAezypx3M6R0kjdz/vaxOf4OIDV8aCUWB4AfwoK7gHztVTsH8i8pSEgJ0nWaZ1UGPz/JOG1unQions0GA7INSIItrEmu3dCM3y69shm/s/2mQvgx6GzlOFIiRXfTCF9bZ01AEKXqKURza/X21/JMlFjaBLb16VZJcno3fduGfg7UyKSjZU0H/ez52ivbcFOv1wufwub0P57CZ3c5D19H0TMX85GYhSva5gIp/nW3+eUpH5lf4KPuh/A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from LV3PR01MB8464.prod.exchangelabs.com (2603:10b6:408:1a3::7) by MW4PR01MB6482.prod.exchangelabs.com (2603:10b6:303:65::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.26; Fri, 19 Jan 2024 15:46:17 +0000 X-Received: from LV3PR01MB8464.prod.exchangelabs.com ([fe80::7748:d4a3:bcd9:14c1]) by LV3PR01MB8464.prod.exchangelabs.com ([fe80::7748:d4a3:bcd9:14c1%6]) with mapi id 15.20.7202.024; Fri, 19 Jan 2024 15:46:17 +0000 From: "Rebecca Cran via groups.io" To: Leif Lindholm , Ard Biesheuvel , Sami Mujawar CC: Rebecca Cran , devel@edk2.groups.io Subject: [edk2-devel] [PATCH v4 2/3] ArmPkg: Introduce global mTimerPeriod and remove calculation Date: Fri, 19 Jan 2024 08:45:53 -0700 Message-ID: <20240119154554.1052736-3-rebecca@os.amperecomputing.com> In-Reply-To: <20240119154554.1052736-1-rebecca@os.amperecomputing.com> References: <20240119154554.1052736-1-rebecca@os.amperecomputing.com> X-ClientProxiedBy: CH2PR04CA0022.namprd04.prod.outlook.com (2603:10b6:610:52::32) To LV3PR01MB8464.prod.exchangelabs.com (2603:10b6:408:1a3::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV3PR01MB8464:EE_|MW4PR01MB6482:EE_ X-MS-Office365-Filtering-Correlation-Id: 2a028bb6-3f20-4876-29e6-08dc1905c694 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: XcmqpLVwYZcDh7v4VdwQ1bRvL+9uqthBmOZ9UJ+2bAEc2efOgThGHEm3y9VnvtIYCwaenOqKci7eGewOg6lGPIV2TfmdzfTbTlNNfNxbRIx2kNjArRZGNy5O/pLyz8EcG1kFgn5XPDoQTvNf/s+MS/pFhLQmDPnBp1QuwD72IE8itwRHLEL09xJ9sxQBHP5Ft167PwTSIOiAIJfFvqxn/uV4q5xkgXT//VXJMAmGg7Esi1FBpm6aDaGQX06vZCbdXpF87aFp70yokizMCCknb5jWnzO0xE1yC8H4fqSFRgnYFG9gZ8PYf3YX1l7ub9twU9+NRTbyQHyL3STmuyFk24RHzFLE93IAOEqaV15BjbF8ySQocTiYJrWR9O/hEH+L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FptmFP9WGQizsWI?= =?us-ascii?Q?HJJmd8pn497G626DQKr0FFTxPyof+np3l9E+qxkhboxzLyCf3+9Kfw0muwVz?= =?us-ascii?Q?58KVyYg44WZ0jTY+6OQLzhHplsG5lfnYbzaEPctukUzWDOMhHJ0JMAwRwFS3?= =?us-ascii?Q?t0yuLaskY0H9su6qgAKcmaQ=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2a028bb6-3f20-4876-29e6-08dc1905c694 X-MS-Exchange-CrossTenant-AuthSource: LV3PR01MB8464.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2024 15:46:17.8134 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: JobT5CEG9yNb3FyphzXmsJOC2KvgFMPtXTHx+HHk8PrLSlOic0f3Qv5OSw/wFc4YxOKwBZn27aA3ew3DSyK9QSzL99uO24eOtAt8Eta9P9hUpB9km06fgP/y+y7J2hSg X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR01MB6482 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,rebecca@os.amperecomputing.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: Z0K44AGnoITjUa99oFwRs0zKx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1705679183156100004 Content-Type: text/plain; charset="utf-8" The calculation of the timer period was broken. Introduce a global mTimerPeriod so the calculation can be removed. Since mTimerFrequencyHz is only used in one place, remove the global and make it a local variable. Do the same with mNumTimerTicks. Signed-off-by: Rebecca Cran Reviewed-by: Sami Mujawar --- ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c | 35 +++++++++-----= ------ 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c b/ArmPk= g/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c index 20549aa91d94..8dd247c44e8f 100644 --- a/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c +++ b/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c @@ -28,13 +28,10 @@ in a second */ #define TIME_UNITS_PER_SECOND 10000000 =20 -// Tick frequency of the generic timer basis of the generic watchdog. -STATIC UINTN mTimerFrequencyHz =3D 0; - /* In cases where the compare register was set manually, information about how long the watchdog was asked to wait cannot be retrieved from hardwa= re. It is therefore stored here. 0 means the timer is not running. */ -STATIC UINT64 mNumTimerTicks =3D 0; +STATIC UINT64 mTimerPeriod =3D 0; =20 STATIC UINT8 WatchdogRevision; =20 @@ -95,7 +92,7 @@ WatchdogExitBootServicesEvent ( ) { WatchdogDisable (); - mNumTimerTicks =3D 0; + mTimerPeriod =3D 0; } =20 /* This function is called when the watchdog's first signal (WS0) goes hig= h. @@ -110,7 +107,6 @@ WatchdogInterruptHandler ( ) { STATIC CONST CHAR16 ResetString[] =3D L"The generic watchdog timer ran = out."; - UINT64 TimerPeriod; =20 WatchdogDisable (); =20 @@ -123,8 +119,7 @@ WatchdogInterruptHandler ( // the timer period plus 1. // if (mWatchdogNotify !=3D NULL) { - TimerPeriod =3D ((TIME_UNITS_PER_SECOND / mTimerFrequencyHz) * mNumTim= erTicks); - mWatchdogNotify (TimerPeriod + 1); + mWatchdogNotify (mTimerPeriod + 1); } =20 gRT->ResetSystem ( @@ -204,22 +199,27 @@ WatchdogSetTimerPeriod ( IN UINT64 TimerPeriod // In 100ns un= its ) { - UINTN SystemCount; + UINTN SystemCount; + UINT64 TimerFrequencyHz; + UINT64 NumTimerTicks; =20 // if TimerPeriod is 0, this is a request to stop the watchdog. if (TimerPeriod =3D=3D 0) { - mNumTimerTicks =3D 0; + mTimerPeriod =3D 0; WatchdogDisable (); return EFI_SUCCESS; } =20 // Work out how many timer ticks will equate to TimerPeriod - mNumTimerTicks =3D (mTimerFrequencyHz * TimerPeriod) / TIME_UNITS_PER_SE= COND; + TimerFrequencyHz =3D ArmGenericTimerGetTimerFreq (); + ASSERT (TimerFrequencyHz !=3D 0); + mTimerPeriod =3D TimerPeriod; + NumTimerTicks =3D (TimerFrequencyHz * TimerPeriod) / TIME_UNITS_PER_SECO= ND; =20 /* If the number of required ticks is greater than the max the watchdog's offset register (WOR) can hold, we need to manually compute and set the compare register (WCV) */ - if (mNumTimerTicks > MAX_UINT48) { + if (NumTimerTicks > MAX_UINT48) { /* We need to enable the watchdog *before* writing to the compare regi= ster, because enabling the watchdog causes an "explicit refresh", which clobbers the compare register (WCV). In order to make sure this doe= sn't @@ -227,9 +227,9 @@ WatchdogSetTimerPeriod ( WatchdogWriteOffsetRegister (MAX_UINT48); WatchdogEnable (); SystemCount =3D ArmGenericTimerGetSystemCount (); - WatchdogWriteCompareRegister (SystemCount + mNumTimerTicks); + WatchdogWriteCompareRegister (SystemCount + NumTimerTicks); } else { - WatchdogWriteOffsetRegister (mNumTimerTicks); + WatchdogWriteOffsetRegister (NumTimerTicks); WatchdogEnable (); } =20 @@ -264,7 +264,7 @@ WatchdogGetTimerPeriod ( return EFI_INVALID_PARAMETER; } =20 - *TimerPeriod =3D ((TIME_UNITS_PER_SECOND / mTimerFrequencyHz) * mNumTime= rTicks); + *TimerPeriod =3D mTimerPeriod; =20 return EFI_SUCCESS; } @@ -332,9 +332,6 @@ GenericWatchdogEntry ( This will avoid conflicts with the universal watchdog */ ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiWatchdogTimerArchProtocolG= uid); =20 - mTimerFrequencyHz =3D ArmGenericTimerGetTimerFreq (); - ASSERT (mTimerFrequencyHz !=3D 0); - // Install interrupt handler Status =3D mInterruptProtocol->RegisterInterruptSource ( mInterruptProtocol, @@ -376,9 +373,9 @@ GenericWatchdogEntry ( ); ASSERT_EFI_ERROR (Status); =20 - mNumTimerTicks =3D 0; WatchdogIId =3D MmioRead32 (GENERIC_WDOG_IID_REG); WatchdogRevision =3D (WatchdogIId >> GENERIC_WDOG_IID_REV_SHIFT) & GENER= IC_WDOG_IID_REV_MASK; + mTimerPeriod =3D 0; WatchdogDisable (); =20 return EFI_SUCCESS; --=20 2.34.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114087): https://edk2.groups.io/g/devel/message/114087 Mute This Topic: https://groups.io/mt/103832318/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Mon Dec 2 14:14:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+114089+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114089+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1705679183063225.5383141308032; Fri, 19 Jan 2024 07:46:23 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=6z4beuS8m5SNeTqF00iYFpNKbGs2TKAWWRWKlO4mpAc=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1705679182; v=1; b=EpDmnzMLReZ02F3QEMHWt9NyXqgKWeEP2uN8IwJ+GdX1NwvOFr82WgaAhYPo9K5PLd1jJEIS c7rsy1BKBUSv2LbgcxCtO9D9whXZNalk9zxsj8t9B6BqmbD6jxTAZtaW8hJOgtw2yYPxdF3qGos LiWyNorfuSyXM8vurwVHban8= X-Received: by 127.0.0.2 with SMTP id LHQbYY1788612xzn6e6YCQMu; Fri, 19 Jan 2024 07:46:22 -0800 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.106]) by mx.groups.io with SMTP id smtpd.web10.25619.1705679180683156874 for ; Fri, 19 Jan 2024 07:46:21 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b5jqeqh2VEMgwvm4kT16MkuGR+3mytt4kxkOwmQgw6DJDSmfpVEpLWysD7IUMDeAtaEPGgM4CbZPC8r81ycHV7Ix6JR+Rboclk1MWPasGVvB2t6t9NGDoRuwhLzG3mSWdyWsxFAmOBV20bg2z/4xva3/w0O/PemlglfG3BcT2F21IPjmabI43bxy1LOcv/F6ZCKtcTTUeZRGg+Q9m2z5RoW4sLMdCKpf+wtR3411ulKIJ0MS628oA9ZcfF10RIKfjFHRcsxdL82qBmVTXvHbzhb7GJJONQoAt4DLL5AWGtSEczTAIq/BhjfU3CPldKcfI8LRSEDD79VDKtr3L57KCw== 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=Kayzn5O5MqC84Ib5bA+w0DexXB2JEG8lU6R3jv5O2zU=; b=gUVWM6orN3FRC5X49xM8tNtl2do2MDxDotv6ePpp15j30MSNF9QL3I5mMEUtaU3YSNdkJU37jPvu2Flaa4M6XfgpeThHOue/evP+YryUU78ELOjmpYxkcLSME1Z7XezWWCS2bV5CRyS1xIqRCAUYZssrTvNepXzVN8P4p9dXHM419KdSasXJcYsF/B0JmasqAxqPkNuDdhPGLtsJIa0PpLgHATamGV5q9om22hE9gizerK2Mml+8m8W7Sj/q9eZVJPgsztyBi22CHtTUqBwFvj4tzY6NQ2sYr3SbY15WWNeNHGkpKS8Rp362gqdb35+wFmrELsMbmp5ifqdWLTamfg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from LV3PR01MB8464.prod.exchangelabs.com (2603:10b6:408:1a3::7) by MW4PR01MB6482.prod.exchangelabs.com (2603:10b6:303:65::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.26; Fri, 19 Jan 2024 15:46:18 +0000 X-Received: from LV3PR01MB8464.prod.exchangelabs.com ([fe80::7748:d4a3:bcd9:14c1]) by LV3PR01MB8464.prod.exchangelabs.com ([fe80::7748:d4a3:bcd9:14c1%6]) with mapi id 15.20.7202.024; Fri, 19 Jan 2024 15:46:18 +0000 From: "Rebecca Cran via groups.io" To: Leif Lindholm , Ard Biesheuvel , Sami Mujawar CC: Rebecca Cran , devel@edk2.groups.io Subject: [edk2-devel] [PATCH v4 3/3] ArmPkg: Disable watchdog interaction after exiting boot services Date: Fri, 19 Jan 2024 08:45:54 -0700 Message-ID: <20240119154554.1052736-4-rebecca@os.amperecomputing.com> In-Reply-To: <20240119154554.1052736-1-rebecca@os.amperecomputing.com> References: <20240119154554.1052736-1-rebecca@os.amperecomputing.com> X-ClientProxiedBy: CH2PR04CA0022.namprd04.prod.outlook.com (2603:10b6:610:52::32) To LV3PR01MB8464.prod.exchangelabs.com (2603:10b6:408:1a3::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV3PR01MB8464:EE_|MW4PR01MB6482:EE_ X-MS-Office365-Filtering-Correlation-Id: 66560cc7-6201-4c73-2271-08dc1905c6ee X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: b5yyadEf1wzBthpH5x0jiaM1/hRsnXaPxrrJj6j9VsNS48wA00VFgEXSPbTCvKjIxKvssympVQCznCn5Hoy5BV2VpRDGUzbLS3gv7R9BBNbcfIiC3XKmHS4UyR8D3WESXw4W6/7K/xkv2Ohy1Tz48EFHuMNwrsikMY/+aVGJbPZawSLCVnp+ZMhsuE+M5YwUW15rcKzKx3aF2o8rYBvf9ML6Wj1lEW9FP9zeVeKOXYkjTY5N7YXhV7l3buU3ZiYmAelA89yOYpMds622uTkSnEN7BvqMOILAkzPZ+0DlJoq9c++BZvKiU71sOkB9xJ3gL+1AM/BX+/2KO3vNcAXuTzm/l/ZRFoRAamsw6dM0VhW0nGNw4sPNXSAJs/TrFPww/6VvP5s5EtofHNY3GDRm9AyB3RViGQUUvOzNOO2dxyHy53+I9v/Ytsuh9knS8J9l8XzJ7SzJ52S527LFZxPNrKrOvp8lcnz573URdj5aRGIojQpKAwabvtVfqbxFysJVO2CNDo/hhP/K0PQd9LyUjMSiWIFy7+iPwFuBv9FJ54sqjiPftxyW6svmrPkaBy44igk5fFZ6lJLnH8koyXgvDYwK2in5M4O0QiA8AGMV5gymNDD0qmcXPaGfolOZw+qb X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?SsyQM94OnkH0KTAkPSZOjHhmJ3iFzae9BXLdAqrpuR9r33uULRzQ3fV7FcRp?= =?us-ascii?Q?s+dXsCIUJvOcjgFcZb/ERXZlDkaAqj3H2S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Xkss6sGmzWKlfsBH5qeBU/8nYKd0/DdSXcpVzgt5IeX1HapSwEV9?= =?us-ascii?Q?9fCEjQ+ftndbXLlPkHNEVWIidQAfCLKE5xS93XyzRMcPv+rK8y7WgKbSZdKa?= =?us-ascii?Q?GrtY9gNnNdas1jnd1xCJm7fZR2bSkePWPAiKJLCfyRS8qmREZ2dJAPSxyGUM?= =?us-ascii?Q?x6TM4AgKCZ9oufXyTdvZbaVyNTrC3gAsyvIjBjh/+DOc83Srd/MvVjemTyzF?= =?us-ascii?Q?EYD4xWkyhFuQRwjWDsCdPgSG7+hJ85y9wtHn+8RqZZX0pNCBtF/CJX+mKO3Y?= =?us-ascii?Q?k4Q99ncm41BGcCZiymh6+PXoMdcIjVcaswWVVotLg6tUlvurH2F3Z6CkEEOC?= =?us-ascii?Q?B2qDw/udxKoQGUvMYZ8f19GwtT6giHqIKMUlK+6i/ZfzaQTxhJVlINe4MMco?= =?us-ascii?Q?mnMQY8jaJjrnAfgiY+32PkfzmXU4+QqP4TMeCk3UMZ5xBuwmW5v1rKzShv8o?= =?us-ascii?Q?kDdvXV86/FqdErhEh2lroyTQNi7mULvAGAIKl/XrcmkfNttepZjAkLxsP1oz?= =?us-ascii?Q?POJubjFnPYat0HU4Kj5+dTswbnljzsh0WiRlQnBgDlsuB5/G21Ak2iImmTWF?= =?us-ascii?Q?Dz0Oq3dxaw+H+1cA96rkv4W/75w6gW711eULGj9eZE/R0AZ+lG81PMxZ85+5?= =?us-ascii?Q?1jgk8n+xDSg4ZTwL5vOIYTI=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 66560cc7-6201-4c73-2271-08dc1905c6ee X-MS-Exchange-CrossTenant-AuthSource: LV3PR01MB8464.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2024 15:46:18.3763 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: CiNeFotOjN5RZfobyVODI6mkKkqp6HU7jITyxexuwSq77mTHNAzQsEhfF2S0JunxYgmqRfaE9qiGd2AAQIKd5RRIun/nk6sG2gOQ0Z9Ogl5Zh3EFZjFLtUD9oFmrrSad X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR01MB6482 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,rebecca@os.amperecomputing.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: T0N3Zjlkf7bE7DoriZbrgKfNx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1705679184993100015 Content-Type: text/plain; charset="utf-8" Update GenericWatchdogDxe to disable watchdog interaction after exiting boot services. Also, move the mEfiExitBootServicesEvent event to the top of the file with the other static variables. Signed-off-by: Rebecca Cran Reviewed-by: Sami Mujawar --- ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c | 17 ++++++++++++++= --- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c b/ArmPk= g/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c index 8dd247c44e8f..189194a2b9ee 100644 --- a/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c +++ b/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c @@ -35,10 +35,14 @@ STATIC UINT64 mTimerPeriod =3D 0; =20 STATIC UINT8 WatchdogRevision; =20 +/* disables watchdog interaction after Exit Boot Services */ +STATIC BOOLEAN mExitedBootServices =3D FALSE; + #define MAX_UINT48 0xFFFFFFFFFFFFULL =20 STATIC EFI_HARDWARE_INTERRUPT2_PROTOCOL *mInterruptProtocol; STATIC EFI_WATCHDOG_TIMER_NOTIFY mWatchdogNotify; +STATIC EFI_EVENT mEfiExitBootServicesEvent; =20 STATIC VOID @@ -93,6 +97,7 @@ WatchdogExitBootServicesEvent ( { WatchdogDisable (); mTimerPeriod =3D 0; + mExitedBootServices =3D TRUE; } =20 /* This function is called when the watchdog's first signal (WS0) goes hig= h. @@ -203,7 +208,15 @@ WatchdogSetTimerPeriod ( UINT64 TimerFrequencyHz; UINT64 NumTimerTicks; =20 - // if TimerPeriod is 0, this is a request to stop the watchdog. + // If we've exited Boot Services but TimerPeriod isn't zero, this + // indicates that the caller is doing something wrong. + if (mExitedBootServices && (TimerPeriod !=3D 0)) { + mTimerPeriod =3D 0; + WatchdogDisable (); + return EFI_DEVICE_ERROR; + } + + // If TimerPeriod is 0 this is a request to stop the watchdog. if (TimerPeriod =3D=3D 0) { mTimerPeriod =3D 0; WatchdogDisable (); @@ -307,8 +320,6 @@ STATIC EFI_WATCHDOG_TIMER_ARCH_PROTOCOL mWatchdogTimer= =3D { WatchdogGetTimerPeriod }; =20 -STATIC EFI_EVENT mEfiExitBootServicesEvent; - EFI_STATUS EFIAPI GenericWatchdogEntry ( --=20 2.34.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114089): https://edk2.groups.io/g/devel/message/114089 Mute This Topic: https://groups.io/mt/103832320/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-