From: "H. Peter Anvin" <hpa@zytor.com>
To: joeyli <jlee@suse.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
Alessandro Zummo <a.zummo@towertech.it>,
Matt Fleming <matt@console-pimps.org>,
Matthew Garrett <matthew.garrett@nebula.com>,
Elliott@hp.com, samer.el-haj-mahmoud@hp.com,
Oliver Neukum <oneukum@suse.de>,
werner@suse.com, trenn@suse.de, JBeulich@suse.com,
linux-kernel@vger.kernel.org, rtc-linux@googlegroups.com,
x86@kernel.org,
"linux-efi@vger.kernel.org" <linux-efi@vger.kernel.org>,
linux-acpi@vger.kernel.org
Subject: Re: [RFC PATCH 04/14] ACPI: Add ACPI 5.0 Time and Alarm Device driver
Date: Mon, 06 Jan 2014 21:37:32 -0800 [thread overview]
Message-ID: <52CB929C.6050403@zytor.com> (raw)
In-Reply-To: <1388998707.3539.6070.camel@linux-s257.site>
[-- Attachment #1: Type: text/plain, Size: 807 bytes --]
On 01/06/2014 12:58 AM, joeyli wrote:
> 於 二,2013-12-31 於 16:42 -0800,H. Peter Anvin 提到:
>> On 12/19/2013 09:41 PM, joeyli wrote:
>>>>
>>>> What platform do you have that has TAD support? I am wondering how this
>>>> was tested.
>>>>
>>>
>>> It's a testing platform that's only support get/set time functions of
>>> ACPI TAD.
>>>
>>
>> It would be really, really good to get this into Qemu (either SeaBIOS or
>> OVMF, or ideally both) so we can have anyone test.
>>
>> -hpa
>
> I will try to add to OVMF first.
>
For the record, I posted a patch to Qemu about a year ago to store the
timezone in the CMOS, which might be useful for this implementation. It
was rejected because of no firmware support, so if you implement it for
OVMF we can (update and) push this patch again.
-hpa
[-- Attachment #2: Attached Message --]
[-- Type: message/rfc822, Size: 6214 bytes --]
From: "H. Peter Anvin" <hpa@zytor.com>
To: qemu-devel@nongnu.org
Cc: "Kevin O'Connor" <kevin@koconnor.net>, David Woodhouse <dwmw2@infradead.org>, "H. Peter Anvin" <hpa@zytor.com>
Subject: [Qemu-devel] [RFC PATCH 3/3] mc146818rtc: export the timezone information
Date: Wed, 27 Feb 2013 18:12:34 -0800
Message-ID: <1362017554-1260-3-git-send-email-hpa@zytor.com>
From: "H. Peter Anvin" <hpa@zytor.com>
There is no standard method for storing timezone information
associated with the classic PC/AT RTC, however, there are standard
methods in ACPI (Time and Alarm Device) and EFI (GetTime/SetTime) for
getting this information.
Since these are abstract methods, it is qreally firmware-specific how
it is stored, however, since Qemu initializes the RTC in the virtual
environment that information needs to come from Qemu in the first
place.
Non-PC platforms that use the MC146181 RTC may have their own
firmware-specific methods as well.
The most logical place to stash this information is in the RTC CMOS;
not only is it logically co-located with the relevant information, but
it is also very easy to access from ACPI bytecode. Thus, save the
timezone information in two bytes in CMOS that have no known standard
definition, but are yet within the 64 bytes that even the most basic
RTC CMOS implementations including the original MC146181 support.
Note: all timezones currently in use in the world are on 15-minutes
boundaries, which would allow this information to be stored in a
single signed byte. However, both EFI and ACPI use a minute-granular
interface (specified as -1440 to +1440 with 2047 used to mean
"unknown", this requires a minimum of 12 bits to represent); this
follows that model.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: "Kevin O'Connor" <kevin@koconnor.net>
Cc: David Woodhouse <dwmw2@infradead.org>
---
hw/mc146818rtc.c | 6 ++++++
hw/mc146818rtc_regs.h | 2 ++
2 files changed, 8 insertions(+)
diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c
index 2fb11f6..72541dd 100644
--- a/hw/mc146818rtc.c
+++ b/hw/mc146818rtc.c
@@ -681,6 +681,7 @@ static void rtc_set_date_from_host(ISADevice *dev)
{
RTCState *s = DO_UPCAST(RTCState, dev, dev);
struct tm tm;
+ int minuteseast;
qemu_get_timedate(&tm, 0);
@@ -690,6 +691,11 @@ static void rtc_set_date_from_host(ISADevice *dev)
/* set the CMOS date */
rtc_set_cmos(s, &tm);
+
+ /* Set the timezone information as a signed 16-bit number of minutes */
+ minuteseast = ((int64_t)s->base_rtc - (int64_t)mktime(&tm)) / 60;
+ s->cmos_data[RTC_TIMEZONE_L] = (uint8_t)(minuteseast);
+ s->cmos_data[RTC_TIMEZONE_H] = (uint8_t)(minuteseast >> 8);
}
static int rtc_post_load(void *opaque, int version_id)
diff --git a/hw/mc146818rtc_regs.h b/hw/mc146818rtc_regs.h
index ccdee42..7dd5e0d 100644
--- a/hw/mc146818rtc_regs.h
+++ b/hw/mc146818rtc_regs.h
@@ -47,6 +47,8 @@
/* PC cmos mappings */
#define RTC_CENTURY 0x32
#define RTC_IBM_PS2_CENTURY_BYTE 0x37
+#define RTC_TIMEZONE_L 0x3e
+#define RTC_TIMEZONE_H 0x3f
#define REG_A_UIP 0x80
--
1.7.11.7
next prev parent reply other threads:[~2014-01-07 5:38 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-19 7:51 [RFC PATCH 00/14] Support timezone of ACPI TAD and EFI TIME Lee, Chun-Yi
2013-12-19 7:51 ` [PATCH 01/14] rtc-efi: fix decrease day twice when computing year days Lee, Chun-Yi
[not found] ` <1387439515-8926-1-git-send-email-jlee-IBi9RG/b67k@public.gmane.org>
2013-12-19 7:51 ` [PATCH 03/14] rtc: block registration of rtc-cmos when CMOS RTC Not Present Lee, Chun-Yi
2013-12-19 7:51 ` [RFC PATCH 04/14] ACPI: Add ACPI 5.0 Time and Alarm Device driver Lee, Chun-Yi
[not found] ` <1387439515-8926-5-git-send-email-jlee-IBi9RG/b67k@public.gmane.org>
2013-12-19 15:22 ` H. Peter Anvin
[not found] ` <52B30F43.1060306-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>
2013-12-20 5:41 ` joeyli
[not found] ` <1387518099.3539.4453.camel-ONCj+Eqt86TasUa73XJKwA@public.gmane.org>
2014-01-01 0:42 ` H. Peter Anvin
[not found] ` <52C3647B.7000708-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>
2014-01-06 8:58 ` joeyli
2014-01-07 5:37 ` H. Peter Anvin [this message]
2014-01-07 10:40 ` joeyli
2014-01-07 16:35 ` H. Peter Anvin
2014-01-08 14:59 ` joeyli
[not found] ` <1389193142.3539.6123.camel-ONCj+Eqt86TasUa73XJKwA@public.gmane.org>
2014-01-08 17:56 ` H. Peter Anvin
[not found] ` <52CD9139.2070302-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>
2014-01-09 3:47 ` joeyli
[not found] ` <1389239259.24105.2.camel-ONCj+Eqt86TasUa73XJKwA@public.gmane.org>
2014-01-09 4:00 ` H. Peter Anvin
2014-01-09 12:16 ` Rafael J. Wysocki
2014-01-02 8:09 ` Lan Tianyu
2014-01-06 9:20 ` joeyli
2013-12-19 7:51 ` [RFC PATCH 05/14] rtc: Add RTC driver of ACPI Time and Alarm Device Lee, Chun-Yi
2013-12-19 7:51 ` [RFC PATCH 06/14] rtc-efi: register rtc-efi device when EFI enabled Lee, Chun-Yi
2013-12-19 14:09 ` Matt Fleming
2013-12-20 4:24 ` joeyli
[not found] ` <1387513491.3539.4345.camel-ONCj+Eqt86TasUa73XJKwA@public.gmane.org>
2013-12-20 4:30 ` H. Peter Anvin
2013-12-20 10:37 ` Borislav Petkov
[not found] ` <20131220103755.GA14784-fF5Pk5pvG8Y@public.gmane.org>
2013-12-20 15:14 ` Matthew Garrett
2013-12-20 21:04 ` H. Peter Anvin
[not found] ` <52B4B0ED.7030600-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>
2013-12-21 1:24 ` joeyli
2013-12-21 1:51 ` H. Peter Anvin
2013-12-21 15:34 ` joeyli
2013-12-20 16:48 ` H. Peter Anvin
2013-12-19 7:51 ` [RFC PATCH 07/14] rtc-efi: add GMTOFF support to rtc_efi Lee, Chun-Yi
[not found] ` <1387439515-8926-8-git-send-email-jlee-IBi9RG/b67k@public.gmane.org>
2013-12-20 15:11 ` Matthew Garrett
2013-12-21 3:56 ` joeyli
2013-12-19 7:51 ` [RFC PATCH 08/14] rtc-efi: set uie_unsupported for indicate rtc-efi doesn't support UIE mode Lee, Chun-Yi
2013-12-19 7:51 ` [RFC PATCH 09/14] efi: move functions of access efi time to header file for sharing Lee, Chun-Yi
2013-12-19 7:51 ` [RFC PATCH 10/14] rtc: improve and move week day computing function to rtc header Lee, Chun-Yi
2013-12-19 7:51 ` [RFC PATCH 11/14] rtc: switch to get/set rtc time to efi functions if CMOS RTC Not Present git set Lee, Chun-Yi
2013-12-19 7:51 ` [RFC PATCH 12/14] efi: adjust system time base on timezone from EFI time services Lee, Chun-Yi
2013-12-19 7:51 ` [RFC PATCH 13/14] Documentation/RTC: add document of ACPI TAD and EFI TIME driver Lee, Chun-Yi
2013-12-19 7:51 ` [TEST PATCH 14/14] acpi: add early parameter to set CMOS RTC Not Present bit for testing Lee, Chun-Yi
[not found] ` <1387448416-11672-1-git-send-email-jlee@suse.com>
[not found] ` <1387448416-11672-1-git-send-email-jlee-IBi9RG/b67k@public.gmane.org>
2013-12-19 10:49 ` [PATCH 02/14] x86-64/efi: Use EFI to deal with platform wall clock (again) Matt Fleming
[not found] ` <20131219104908.GE3145-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
2013-12-19 13:32 ` joeyli
[not found] ` <1387459939.3539.4092.camel-ONCj+Eqt86TasUa73XJKwA@public.gmane.org>
2013-12-20 11:29 ` One Thousand Gnomes
2013-12-23 23:25 ` H. Peter Anvin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52CB929C.6050403@zytor.com \
--to=hpa@zytor.com \
--cc=Elliott@hp.com \
--cc=JBeulich@suse.com \
--cc=a.zummo@towertech.it \
--cc=jlee@suse.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matt@console-pimps.org \
--cc=matthew.garrett@nebula.com \
--cc=oneukum@suse.de \
--cc=rjw@rjwysocki.net \
--cc=rtc-linux@googlegroups.com \
--cc=samer.el-haj-mahmoud@hp.com \
--cc=trenn@suse.de \
--cc=werner@suse.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).