From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: john stultz <johnstul@us.ibm.com>
Cc: lkml <linux-kernel@vger.kernel.org>,
takata@linux-m32r.org, davem@davemloft.net, wli@holomorphy.com,
Joel Becker <Joel.Becker@oracle.com>
Subject: Re: [RFC][PATCH] Unify interface to persistent CMOS/RTC/whatever clock
Date: Thu, 17 Aug 2006 11:20:08 +0200 [thread overview]
Message-ID: <1155806408.10261.2.camel@localhost> (raw)
In-Reply-To: <1155768332.6785.58.camel@localhost.localdomain>
On Wed, 2006-08-16 at 15:45 -0700, john stultz wrote:
> My first pass at this can be found below. There are a few arches
> (specifically: m32r, s390, sparc, sparc64) where I just didn't know
> what
> to do, or where I suspect I didn't get it right, so I've CC'ed those
> maintainers for suggestions.
But it is sooo easy ;-)
See patch below.
--
blue skies,
Martin.
Martin Schwidefsky
Linux for zSeries Development & Services
IBM Deutschland Entwicklung GmbH
"Reality continues to ruin my life." - Calvin.
---
arch/s390/kernel/time.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff -urpN linux-2.6/arch/s390/kernel/time.c linux-2.6-clock/arch/s390/kernel/time.c
--- linux-2.6/arch/s390/kernel/time.c 2006-08-17 10:34:58.000000000 +0200
+++ linux-2.6-clock/arch/s390/kernel/time.c 2006-08-17 11:05:28.000000000 +0200
@@ -40,6 +40,9 @@
#define USECS_PER_JIFFY ((unsigned long) 1000000/HZ)
#define CLK_TICKS_PER_JIFFY ((unsigned long) USECS_PER_JIFFY << 12)
+/* The value of the TOD clock for 1.1.1970. */
+#define TOD_UNIX_EPOCH 0x7d91048bca000000ULL
+
/*
* Create a small time difference between the timer interrupts
* on the different cpus to avoid lock contention.
@@ -343,8 +346,9 @@ extern void vtime_init(void);
unsigned long read_persistent_clock(void)
{
- /* XXX I have no clue here. s390 folks, help! */
- return 0;
+ __u64 tod = (get_clock() - TOD_UNIX_EPOCH) >> 12;
+ do_div(tod, 1000000);
+ return (unsigned long) tod;
}
/*
@@ -353,7 +357,6 @@ unsigned long read_persistent_clock(void
*/
void __init time_init(void)
{
- __u64 set_time_cc;
int cc;
/* kick the TOD clock */
@@ -378,9 +381,7 @@ void __init time_init(void)
/* set xtime */
xtime_cc = init_timer_cc + CLK_TICKS_PER_JIFFY;
- set_time_cc = init_timer_cc - 0x8126d60e46000000LL +
- (0x3c26700LL*1000000*4096);
- tod_to_timeval(set_time_cc, &xtime);
+ tod_to_timeval(init_timer_cc - TOD_UNIX_EPOCH, &xtime);
set_normalized_timespec(&wall_to_monotonic,
-xtime.tv_sec, -xtime.tv_nsec);
next prev parent reply other threads:[~2006-08-17 9:20 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-16 22:45 [RFC][PATCH] Unify interface to persistent CMOS/RTC/whatever clock john stultz
2006-08-17 1:49 ` john stultz
2006-08-17 9:20 ` Martin Schwidefsky [this message]
-- strict thread matches above, loose matches on Subject: below --
2006-08-17 5:47 David Brownell
2006-08-17 19:08 ` john stultz
2006-08-17 20:28 ` David Brownell
2006-08-17 21:42 ` john stultz
2006-08-17 23:41 ` David Brownell
2006-08-18 0:07 ` john stultz
2006-08-18 1:38 ` David Brownell
2006-08-18 23:36 ` john stultz
2006-08-19 16:39 ` David Brownell
2006-08-19 16:44 ` David Brownell
2006-08-18 5:50 ` David Brownell
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=1155806408.10261.2.camel@localhost \
--to=schwidefsky@de.ibm.com \
--cc=Joel.Becker@oracle.com \
--cc=davem@davemloft.net \
--cc=johnstul@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=takata@linux-m32r.org \
--cc=wli@holomorphy.com \
/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