From nobody Thu Feb 09 07:04:23 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PC7CC63YVz3pqXk; Thu, 9 Feb 2023 07:04:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PC7CC5ScGz3xgZ; Thu, 9 Feb 2023 07:04:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675926263; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YTTxFG6PWkbqa8WweMa1JUUQZBzK5saHZnrV92Uq2Pk=; b=a7QGmVjfW+fp0DxSO05zsAiVsraYYHHogZYMZzsVqNOL3twCKCAr6HTMcvK0jcxm8b0hIi I2aHJedM9tc15cXfo+FJngZmzsYFMIebRtVUAMJmzd3779Zbg4+rjGNuyj5oDRg7BCJQwr wuyQ0dcU+azNacp5FqTF+QFUXzIX68b5FvPcU8JKVoMDCim6I5AOQ/i16EpU9r6dS8Ktsc AaTMjpJ8O0nENBSBsqWIuC6qR6/QLBuWicglh5RhBchnsOpQsmIoBkUt+ub3xz/YVh5OBu Kpl2ZZKd04C2OqQ4CdiDxH6axJHiKV/064kxrejQ1N/hC2VDTa4LgsiQzrf+QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675926263; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YTTxFG6PWkbqa8WweMa1JUUQZBzK5saHZnrV92Uq2Pk=; b=o3cJHDhjx8FOCt7+WWaGyuwWzzjuEnNeKhRQapullyT6ifRZgJotw9MYV7CawO7EaAZMg2 QmH3RCyRNa1l34dMCjPGfqZD1BrFD6Mu7Xd52S5n9ag2lXdKf+14V06921X7887YeQVCZi Tr3PmCGuhBvhWF+eCAukE94U1gkJvCTBvXFynAuhlwFWPk4L5MpL03+1B+SNFrYFmfHQlj FyuNIgzvctIiiQkZR6xPI0T0GIf8YouW5Q5/9lw9FGNQ073n0yUPPOAYU7YvE3QCTEoVEa RhJP0IpUQwIypG697YEe6Uf7F12sIS4KT8cYi4CJOa3P6/Z6i/GXATTrdpapLQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675926263; a=rsa-sha256; cv=none; b=Oip4mK4XdAAcd08nqbHn5YTVMzPjvJQChMvmVDFTNZLPc/GgC1VJft6sJAmjvc3L7WbCVK 1SyG+/gki+mZ3YxumZ3zV+rFU/OF8BhULkzy1LisncUUK+162jhiwWSl58DhpDOCGOmBeX lmNMfARBwM2KYPnqQ5txfM83l8o/kfm6637E4o0I1D2m8UG/vLP1gyGVWbTc93eN08T444 zfQFozQq65zsaW0m3ks9NiQl19UYHNb8Kz6mZezGVOz+8ymYyZyytoaiBOqf5PsPS7sHFC 7plLaRADgWZNx+CbmXuilrRocKaJStYjj72OKVRZGQWRr7+d09N279gbn/hQ8g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PC7CC4VwgzSZP; Thu, 9 Feb 2023 07:04:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31974NXk021871; Thu, 9 Feb 2023 07:04:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31974NDH021870; Thu, 9 Feb 2023 07:04:23 GMT (envelope-from git) Date: Thu, 9 Feb 2023 07:04:23 GMT Message-Id: <202302090704.31974NDH021870@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: =?utf-8?Q?Corvin=20K=C3=B6hne?= Subject: git: c592a3b0ae98 - stable/13 - atrtc: expose power loss as sysctl List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: corvink X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c592a3b0ae98ca90c09f300afde6d705b84ff0d7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=c592a3b0ae98ca90c09f300afde6d705b84ff0d7 commit c592a3b0ae98ca90c09f300afde6d705b84ff0d7 Author: Corvin Köhne AuthorDate: 2022-12-08 07:28:42 +0000 Commit: Corvin Köhne CommitDate: 2023-02-09 07:03:59 +0000 atrtc: expose power loss as sysctl Exposing the a power loss of the rtc as an sysctl makes it easier to detect an empty cmos battery. Reviewed by: manu MFC after: 1 week Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D38325 (cherry picked from commit 55f1ca209d37d7b5a6faf57b23c7341cb7f84ee6) --- sys/x86/isa/atrtc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/x86/isa/atrtc.c b/sys/x86/isa/atrtc.c index aff838c53851..167e7cfbf8fd 100644 --- a/sys/x86/isa/atrtc.c +++ b/sys/x86/isa/atrtc.c @@ -62,6 +62,11 @@ __FBSDID("$FreeBSD$"); #include #endif +/* tunable to detect a power loss of the rtc */ +static bool atrtc_power_lost = false; +SYSCTL_BOOL(_machdep, OID_AUTO, atrtc_power_lost, CTLFLAG_RD, &atrtc_power_lost, + false, "RTC lost power on last power cycle (probably caused by an emtpy cmos battery)"); + /* * atrtc_lock protects low-level access to individual hardware registers. * atrtc_time_lock protects the entire sequence of accessing multiple registers @@ -597,6 +602,7 @@ atrtc_gettime(device_t dev, struct timespec *ts) /* Look if we have a RTC present and the time is valid */ if (!(rtcin(RTC_STATUSD) & RTCSD_PWR)) { + atrtc_power_lost = true; device_printf(dev, "WARNING: Battery failure indication\n"); return (EINVAL); }