From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id E9044780091 for ; Wed, 3 Jan 2024 20:44:26 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=+tLNAx1yfRj4uNLVfF8BxF5zm7sp0R6CihEXi1VdxU8=; 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=1704314665; v=1; b=jlssQ8/4MPryoBtcQCRhhITUSy8ZsTqSw8C5fy2kDFpY0OS9fflQAmw7nUiOoA63pLuy8Qw5 DufvhD+2G7qs+i/N+cFps2YoZYwiB9W+bDN/hdxH40MS84ql3ChFhlq9JDtdXZL27rq/6ICnseH onx7EHerVvzzGd+whyGv3VkE= X-Received: by 127.0.0.2 with SMTP id Z4spYY7687511xjSvinXCx87; Wed, 03 Jan 2024 12:44:25 -0800 X-Received: from NAM10-DM6-obe.outbound.protection.outlook.com (NAM10-DM6-obe.outbound.protection.outlook.com [40.107.93.131]) by mx.groups.io with SMTP id smtpd.web10.28992.1704314663228833425 for ; Wed, 03 Jan 2024 12:44:23 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kcQ3blsgBg3QZkJY0/07chHPZ/TX35eUnBwPIvDT0mWXv0ltlfHL+F8R2CWztznRgN2Z5ntXO23/rnCGh1S+hyT7AfOJarTfBLaLxHZG5vz7mFWuQVQpEpC+ePg3s1YNYILoFBfiWHdEJqbOjGwbUKsY2dlW+4w+0T79RR+yT3b2IR2eCeNdRzB7NOka5SEO6dXC3/JJrG7mNlcChVSiSdCz62VBj5Gut7YMdXzpyzA+nGyzninlP7dW8JsuxLTO4rg84r+l7KSDaRWGrZWo6w8jT41qCUEKzjnAhDKZB96zhAd4VWEQcv57cl9+KpDhY3kMuCPzFPwKgqw0XJHB6w== 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=Wd5JkH9YSpIWnkm5yxU9AS8Z3jOXPQqhe82w4++AFYk=; b=DR4o/uKnnftAfrTH+R/fImNVyRYemhvF2H/l/fPzhf+Amc1z+F1Iwo/XVZLDnZQX/JZss9JaB7rEg0XH2XmP5d2onrP2kQfJngWA4TLDzDCtoUerpwHV5x43o/lU/d1EMIVq4nPkH3KxA9o5ByAA/M48GYXbLQNik208RDzq56gvA3ez2BAH+JYmSJuwdTLipbpsWII4SbiWCS+TAsAVZ/B1r9dckK/PujWucGeJs2F3QMxj/X+zSwZfnhd6X+8+zl494l5bEwH856RKlCXouy7iiGLaxEjgQLN9ezbulI+FNln0sUqRreRWpbOrJ71B8wdLWn+1+Rp/8jiYqgeTZw== 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 CH0PR01MB7139.prod.exchangelabs.com (2603:10b6:610:f6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.25; Wed, 3 Jan 2024 20:44: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.7159.013; Wed, 3 Jan 2024 20:44:16 +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 1/3] ArmPkg: Update GenericWatchdogDxe to allow setting full 48-bit offset Date: Wed, 3 Jan 2024 13:43:51 -0700 Message-ID: <20240103204353.361541-2-rebecca@os.amperecomputing.com> In-Reply-To: <20240103204353.361541-1-rebecca@os.amperecomputing.com> References: <20240103204353.361541-1-rebecca@os.amperecomputing.com> X-ClientProxiedBy: CH2PR18CA0049.namprd18.prod.outlook.com (2603:10b6:610:55::29) To LV3PR01MB8464.prod.exchangelabs.com (2603:10b6:408:1a3::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV3PR01MB8464:EE_|CH0PR01MB7139:EE_ X-MS-Office365-Filtering-Correlation-Id: b3d284d5-815e-4246-cbd2-08dc0c9cc0b7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: brqJZKs9obfnrBoKmQSO/XbQfWd7qmRi9H3ax36kupXSHipl5ppTIjPpfjdEp73IfAbI7Hvm1nIMJ3ZzAfnQvL5aPbsZFjTpIAVx+aqtR4q0pfbRHczvQb0oUchJ9esuRcUpfM0BiBesztEyYKMARk8qxHU5gaGQfALvu1glMZzIKf2r8KlnNLEIKI6h7wokbU+GJ4txRgybBDiBDti+uVi60AKfpgYrz30LaxsXoP/pgANVv+y8dQ616PUU1ug6jBFzBoUoxG3vIrxncccDkR0O3GBVqitZVt0DDDf4glmq/QEaOxKK/00FslWS5fppqPGcAaHCp7Un3QNGheTuWxejFhCF7ug7BiiTH1si/aPfwheD2jWcp4J1KjtkIU9uPsRuooLlfKeKMwuZeXO7BomsIupLq2E+ll1ygKQyM1UJKmjq74phYtKAKy3mWlWLp1RCF46Fzk7r24uiTNdeaiwkb3MIAQg6W9KPiumUL+KWQu0CDQ2KOSa+2DrNnrhzW9u0P4+lqIdybSJBhsXdThvkLuRQY1dlxM4cB+tv9yaMdVbnzq9piDJVgzBILlw3GzAuWIsrAe9K3yE78RQbdCgpYfd/hmSbGXPjyukct18kpdVOyifS5KasQdlfRAPe X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?W57ZMkFTWHCJfL8O5YPuGGUG5Z5S1STfaQGlkV/DnNh6dMNvm214oWQO8hf7?= =?us-ascii?Q?w4O5qzZ+d2lcFtqKZj+xEhETBIlEfKi0wTXFJC9IuIB6NoIRHi+hhelGjSaT?= =?us-ascii?Q?dBGIeXD6Fku2QQw1JrLapkfq4bkPdlFPhwkTIF0c2+/5PY6K1bmqpyBWZxNA?= =?us-ascii?Q?hSxJlSVefs9yIxSoNdHRtVg3bhMPBRerSIqgNHYyIMshaz7DlGRNXfh5khaB?= =?us-ascii?Q?CyEar8SNU1ElwKEU3TwBMMhuqGKIXdHsA96p1pJa4jyV2ULMevMbtb/phHLk?= =?us-ascii?Q?2/rcQKf9BYaLDT7sPo2NiiYCAotrK+1ole4nr8I0Ni4lzFhhF+C2pQVY/fvy?= =?us-ascii?Q?s/XxcjB+zPZK6+oK8+H+ohyP9FHPEu/0bire40714ez9Mp1AGgv52oJBtQg5?= =?us-ascii?Q?a8HtCxCZH+xWmxriDoO8hJFeQxgeGCvHjlHYA7E80oVMRUaZ/swZqxswe8/i?= =?us-ascii?Q?BfSYab9bCopIaaJ257IXTK+s0ir/N2DUvC3a/7uXM344RHUEV+nPXy4gunf4?= =?us-ascii?Q?qPFTUaShkkHlGvxX8YNAU52Cj8VJPiU/8J1ZLfJSnQVecM14sCWjRhVhhSMT?= =?us-ascii?Q?oteYXP85vnq1cTqOlvDjoNGIfilHdc52PucjJjBhhDE/m2ha8tlfKp0dLjcE?= =?us-ascii?Q?bWBdmmA8WWsZMwZgH+1XSp8tXA0/hFBdnhbfiCfB9T5c/PQou8FJXf/ksCJ7?= =?us-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MDp8ECQ7swwiQQF5A81luT+juvsk?= =?us-ascii?Q?h7GHwS/XEukovw/WkhTCYKQ=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: b3d284d5-815e-4246-cbd2-08dc0c9cc0b7 X-MS-Exchange-CrossTenant-AuthSource: LV3PR01MB8464.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2024 20:44:16.8618 (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: S6VrsUa4d4UnB2vVKuIGSO4lCGtgwrXFsEgPvFqveLXD3tCmLe5kRJmcB5J7Q/BNjpvmZwA34GjmdXNzMd1/W/XyvZgVefpDarmeXA6UoC9lkaxAPZcM1Yun6MOLYnrp X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR01MB7139 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: jKGmN9m1AV92hdcqopCAHgnZx7686176AA= Content-Transfer-Encoding: quoted-printable Content-Type: text/plain X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b="jlssQ8/4"; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}"); dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io 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 | 4 +++- ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c | 14 +++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdog.h b/ArmPkg/D= rivers/GenericWatchdogDxe/GenericWatchdog.h index 9bc3bf47047c..504bc4cacb33 100644 --- a/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdog.h +++ b/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdog.h @@ -1,5 +1,6 @@ /** @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 @@ -14,7 +15,8 @@ =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) =20 diff --git a/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c b/ArmPk= g/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c index 66c6c37c08b0..05df101d5f4b 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,19 @@ STATIC UINTN mTimerFrequencyHz =3D 0; It is therefore stored here. 0 means the timer is not running. */ STATIC UINT64 mNumTimerTicks =3D 0; =20 +#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); + MmioWrite32 (GENERIC_WDOG_OFFSET_REG_HIGH, (Value >> 32) & MAX_UINT32); } =20 STATIC @@ -211,17 +215,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 --=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 (#113106): https://edk2.groups.io/g/devel/message/113106 Mute This Topic: https://groups.io/mt/103510103/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-