From nobody Thu Mar 03 14:20:43 2022 X-Original-To: dev-commits-src-branches@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 CCDF219E5FBE; Thu, 3 Mar 2022 14:20:44 +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 4K8Y701sTnz3Lds; Thu, 3 Mar 2022 14:20:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646317244; 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=NRxkNLX4oHbmOgqHDs6snT/jx7KesqMm+RvNv5EgaK4=; b=CfnQ7pZv0M7HKHHxKdX1+TcMYGbYKUuvj//OlMmvlwrZDfZfyTpBAZTGdPiFEI45MmJqB8 K+2cXUzcxSexkZXS7zuo/xJrNkku/lPoqSxh0MmDRIG5s92ZxTKws28MmkODuhfAQz5oyI Xkh7LE475ZNhGopNywDjPWyREZyn7E1y9PysV+MXAKL5qEXf0uCasMojPDEgMo0Nw2FdPI ONwY+cupZADImFiU28uyTGkSrkXsf2CyIOUvRDT8tuDCfbWdjYupWoZuoq4Cg8CnaNwyz9 tOIb0akUc9tw4IzTfrwooWNPwQltfJLCF6GaEuV8cLuJ1/M+y7xyIwgwXnK6XA== 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 B829E18F4E; Thu, 3 Mar 2022 14:20:43 +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 223EKhWU090756; Thu, 3 Mar 2022 14:20:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 223EKhSx090755; Thu, 3 Mar 2022 14:20:43 GMT (envelope-from git) Date: Thu, 3 Mar 2022 14:20:43 GMT Message-Id: <202203031420.223EKhSx090755@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric van Gyzen Subject: git: b8319d9f78f7 - stable/13 - atrtc: reads Century field from FADT table List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vangyzen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b8319d9f78f7456bb90b69d59403918e27b640d4 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646317244; 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=NRxkNLX4oHbmOgqHDs6snT/jx7KesqMm+RvNv5EgaK4=; b=At1ppgMbz6T0N/WCvkIVrNoMZwntlfsu5Rw6ZNj+BDdcWDTtGyUdFceQFQRQT0tb924LQY gRMgZtbUhc4ro7xgtsLio0oaPr12wgcn3K1a7TzyTHHn65d19ndEe3ct9Ix+IQiAg/vKKt YNV7bLIK/CXIECUj4kAmCOFIthZa26ifZoWbWkV/my6aD4AfmWOwNz7HR8n8m2f/QSYxje CytumGxNH2/ZF7v2UEEhCwruxBzrpCRlkp9AHR1wpcgLVgcVX7LfLUtAaCVmMsj3+dm34k SSDHqzSzVmt3l9yVCTSA5J0mGwtJdr+nt+nti2G+hSsVO1XBKPi6+0xi299+Mg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1646317244; a=rsa-sha256; cv=none; b=DURIBokupcjuVtKVW8EuJV7xQTMWi9kRjoHnPWlaQnLRijBI4oRUcdv5CSlX+xYzabK1YY Am6hwrD2VKeGSOc3Ao8rheUd0D0OWxYhbkDbUZtUCuInB8pC92VTkr9VlcdDxjLfprJiRo J5eUQeL7m6hXuyBs1/TfXExc+gZrZGKGgbhZeUNCCmf5wTHeqQsVtiCe74ELxTDwCzHeA6 oIfT2JV2nIEekF41FWbXkPncVjJY7+ePsz+ApiBCAEnyHSNVjkW1Db9bdh7rhetngeFwK9 Ln2sMfylPH5QTJPHbMgAaD9mSQa5dDNCoF1zmbLhJLK1apo407veqmCV+ZSg2A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by vangyzen: URL: https://cgit.FreeBSD.org/src/commit/?id=b8319d9f78f7456bb90b69d59403918e27b640d4 commit b8319d9f78f7456bb90b69d59403918e27b640d4 Author: Austin Zhang AuthorDate: 2022-01-13 17:13:25 +0000 Commit: Eric van Gyzen CommitDate: 2022-03-03 14:20:07 +0000 atrtc: reads Century field from FADT table The ACPI spec describes the FADT->Century field as: The RTC CMOS RAM index to the century of data value (hundred and thousand year decimals). If this field contains a zero, then the RTC centenary feature is not supported. If this field has a non-zero value, then this field contains an index into RTC RAM space that OSPM can use to program the centenary field. Use this field to decide whether to program the CENTURY register of the CMOS RTC device. Reviewed by: akumar3@isilon.com, dab, vangyzen MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D33667 MFC after: 1 week Sponsored by: Dell EMC Isilon (cherry picked from commit e1ef6c0ef256f797d629b9490db3f0034b28ae43) --- sys/x86/isa/atrtc.c | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/sys/x86/isa/atrtc.c b/sys/x86/isa/atrtc.c index cad8015435d0..aff838c53851 100644 --- a/sys/x86/isa/atrtc.c +++ b/sys/x86/isa/atrtc.c @@ -79,6 +79,7 @@ MTX_SYSINIT(atrtc_time_lock_init, &atrtc_time_lock, "atrtc_time", MTX_DEF); int atrtcclock_disable = 0; +static int rtc_century = 0; static int rtc_reg = -1; static u_char rtc_statusa = RTCSA_DIVIDER | RTCSA_NOPROF; static u_char rtc_statusb = RTCSB_24HR; @@ -420,6 +421,31 @@ atrtc_acpi_disabled(void) #endif } +static int +rtc_acpi_century_get(void) +{ +#ifdef DEV_ACPI + ACPI_TABLE_FADT *fadt; + vm_paddr_t physaddr; + int century; + + physaddr = acpi_find_table(ACPI_SIG_FADT); + if (physaddr == 0) + return (0); + + fadt = acpi_map_table(physaddr, ACPI_SIG_FADT); + if (fadt == NULL) + return (0); + + century = fadt->Century; + acpi_unmap_table(fadt); + + return (century); +#else + return (0); +#endif +} + static int atrtc_probe(device_t dev) { @@ -435,6 +461,7 @@ atrtc_probe(device_t dev) device_set_desc(dev, "AT realtime clock"); return (BUS_PROBE_LOW_PRIORITY); } + rtc_century = rtc_acpi_century_get(); return (result); } @@ -548,9 +575,8 @@ atrtc_settime(device_t dev __unused, struct timespec *ts) rtcout_locked(RTC_DAY, bct.day); rtcout_locked(RTC_MONTH, bct.mon); rtcout_locked(RTC_YEAR, bct.year & 0xff); -#ifdef USE_RTC_CENTURY - rtcout_locked(RTC_CENTURY, bct.year >> 8); -#endif + if (rtc_century) + rtcout_locked(rtc_century, bct.year >> 8); /* * Re-enable RTC updates and interrupts. @@ -592,9 +618,8 @@ atrtc_gettime(device_t dev, struct timespec *ts) bct.day = rtcin_locked(RTC_DAY); bct.mon = rtcin_locked(RTC_MONTH); bct.year = rtcin_locked(RTC_YEAR); -#ifdef USE_RTC_CENTURY - bct.year |= rtcin_locked(RTC_CENTURY) << 8; -#endif + if (rtc_century) + bct.year |= rtcin_locked(rtc_century) << 8; mtx_unlock_spin(&atrtc_lock); mtx_unlock(&atrtc_time_lock); /* dow is unused in timespec conversion and we have no nsec info. */