From nobody Thu Feb 02 07:25:47 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 4P6r176CVWz3c7Kp; Thu, 2 Feb 2023 07:25:47 +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 4P6r175Vm2z4P9b; Thu, 2 Feb 2023 07:25:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675322747; 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=Vlm8n0vRlOtxa7009uCh581rSJ059EzDf2dCQm38NR8=; b=W74z3oiVkv6pOUdIc0xWS2Xoo2r0SCAXLLgvf4aLmoVO2hneaa45bpKqFcOX1BasTGmc13 jrX6YDChR+WADNK8rCZ8awBA7uQyrv1w4m/+jYqbyBNU4vRab+wCuXgaNxMy6Pb5uFEDVP 1IyHYPFIvX7SEIx5P6+m5ZLKWLMhzqb5OV32MyxHNpWoPI4fI2mZ5/JvuDiSQS2abQtJ5z h6i6Wbf8SZNWB5VlyHnMtg2jzWclBcHK44XIqjffNgxMYizRDhtsNZUfz0Xt6e0mS55rte bItpkhFPDOpXaVhZfGiFakOe2Ebdmw865HAFgL+5xkFMmBiSaCbZ6ahscHpuRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675322747; 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=Vlm8n0vRlOtxa7009uCh581rSJ059EzDf2dCQm38NR8=; b=OeP/rL32Qk4oUJivnuzF9vi6UnyLliYgOHWt6AbcVMcUGFSjkKiZ5mQvWHCaDHMB7YPIuF UdBTg4LpnikQRjw/o6uINFgkUhZJXQyKIV8GtrJ42Cbvi4QWMM6aFFXjkc+HVi2DtnjDqG AM2UGj/pDKV+KPhiOk+b1cwhAj7G7FRPKjcxFCCf4o5fv4XGOVfL6FPZR5x/x8NhWJn0WM YtQPrjpe0sfHbU2Gb+ANKF1YzxfIfIVLABc2XLKdBOQxIlQmyLlIQAnSbOwK0AtvegNE9F Yhz4ky9Ya0TxlVOZ9TvPeOGa9C116ceKkthtV1ktQ2OE8aqAqqkdWeHqHUf+kA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675322747; a=rsa-sha256; cv=none; b=D2DTABQardT6MmrA57IijecN5tHSnZ1Rnz6DTbUoxmYhLie4sf17NM7nYGrZQQhbBFsEYu MOJiJEH1BDA6jrILxv23Wz8xtxiptvfO9CXyD5TwzPSqgES4MP+pk7RUD6ZmOZzKdADyG2 5DZWsgEdncic3foqk0XLvF6URN0tzeNNw7/OlNijKPkBhmBCuny7e3UDyg1FNRP3FIszmz 6m0mdX3q96RJlx8prPMHTaIzZ7Wh5hgM7wJJgJ1VszuMAiXblDYAWh2F6S/JTQSDA/YJRY bu5j1o6qOqyruS0Z55Wi3VJWRyItewti+XXhlq9s08N3RBz0D4ofTtG9IZaqHA== 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 4P6r174Sx7zmHs; Thu, 2 Feb 2023 07:25:47 +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 3127Pleb046634; Thu, 2 Feb 2023 07:25:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 3127PlLK046633; Thu, 2 Feb 2023 07:25:47 GMT (envelope-from git) Date: Thu, 2 Feb 2023 07:25:47 GMT Message-Id: <202302020725.3127PlLK046633@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Corvin=20K=C3=B6hne?= Subject: git: 55f1ca209d37 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 55f1ca209d37d7b5a6faf57b23c7341cb7f84ee6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=55f1ca209d37d7b5a6faf57b23c7341cb7f84ee6 commit 55f1ca209d37d7b5a6faf57b23c7341cb7f84ee6 Author: Corvin Köhne AuthorDate: 2022-12-08 07:28:42 +0000 Commit: Corvin Köhne CommitDate: 2023-02-02 07:25:08 +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 --- 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 33eb9a4bbdf0..81ba400619cc 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 @@ -600,6 +605,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); }