summaryrefslogtreecommitdiffstats
path: root/arch/ppc/kernel/time.h
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1998-03-17 22:05:47 +0000
committerRalf Baechle <ralf@linux-mips.org>1998-03-17 22:05:47 +0000
commit27cfca1ec98e91261b1a5355d10a8996464b63af (patch)
tree8e895a53e372fa682b4c0a585b9377d67ed70d0e /arch/ppc/kernel/time.h
parent6a76fb7214c477ccf6582bd79c5b4ccc4f9c41b1 (diff)
Look Ma' what I found on my harddisk ...
o New faster syscalls for 2.1.x, too o Upgrade to 2.1.89. Don't try to run this. It's flaky as hell. But feel free to debug ...
Diffstat (limited to 'arch/ppc/kernel/time.h')
-rw-r--r--arch/ppc/kernel/time.h58
1 files changed, 15 insertions, 43 deletions
diff --git a/arch/ppc/kernel/time.h b/arch/ppc/kernel/time.h
index 9ce5921dc..538ac7bb1 100644
--- a/arch/ppc/kernel/time.h
+++ b/arch/ppc/kernel/time.h
@@ -1,5 +1,5 @@
/*
- * $Id: time.h,v 1.5 1997/08/27 22:06:58 cort Exp $
+ * $Id: time.h,v 1.7 1997/12/28 22:47:24 paulus Exp $
* Common time prototypes and such for all ppc machines.
*
* Written by Cort Dougan (cort@cs.nmt.edu) to merge
@@ -9,17 +9,16 @@
#include <linux/mc146818rtc.h>
/* time.c */
-__inline__ unsigned long get_dec(void);
-__inline__ void set_dec(int val);
void prep_calibrate_decr_handler(int, void *,struct pt_regs *);
void prep_calibrate_decr(void);
void pmac_calibrate_decr(void);
-void chrp_calibrate_decr(void);
extern unsigned decrementer_count;
extern unsigned count_period_num;
extern unsigned count_period_den;
extern unsigned long mktime(unsigned int, unsigned int,unsigned int,
- unsigned int, unsigned int, unsigned int);
+ unsigned int, unsigned int, unsigned int);
+extern void to_tm(int tim, struct rtc_time * tm);
+extern unsigned long last_rtc_update;
/* pmac/prep/chrp_time.c */
unsigned long prep_get_rtc_time(void);
@@ -29,46 +28,19 @@ int prep_set_rtc_time(unsigned long nowtime);
int pmac_set_rtc_time(unsigned long nowtime);
int chrp_set_rtc_time(unsigned long nowtime);
void pmac_read_rtc_time(void);
+void chrp_calibrate_decr(void);
+void chrp_time_init(void);
-#define TICK_SIZE tick
-#define FEBRUARY 2
-#define STARTOFTIME 1970
-#define SECDAY 86400L
-#define SECYR (SECDAY * 365)
-#define leapyear(year) ((year) % 4 == 0)
-#define days_in_year(a) (leapyear(a) ? 366 : 365)
-#define days_in_month(a) (month_days[(a) - 1])
-
-static int month_days[12] = {
- 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
-};
-
-extern void inline to_tm(int tim, struct rtc_time * tm)
+/* Accessor functions for the decrementer register. */
+static __inline__ unsigned int get_dec(void)
{
- register int i;
- register long hms, day;
-
- day = tim / SECDAY;
- hms = tim % SECDAY;
+ unsigned int ret;
- /* Hours, minutes, seconds are easy */
- tm->tm_hour = hms / 3600;
- tm->tm_min = (hms % 3600) / 60;
- tm->tm_sec = (hms % 3600) % 60;
-
- /* Number of years in days */
- for (i = STARTOFTIME; day >= days_in_year(i); i++)
- day -= days_in_year(i);
- tm->tm_year = i;
-
- /* Number of months in days left */
- if (leapyear(tm->tm_year))
- days_in_month(FEBRUARY) = 29;
- for (i = 1; day >= days_in_month(i); i++)
- day -= days_in_month(i);
- days_in_month(FEBRUARY) = 28;
- tm->tm_mon = i;
+ asm volatile("mfspr %0,22" : "=r" (ret) :);
+ return ret;
+}
- /* Days are what is left over (+1) from all that. */
- tm->tm_mday = day + 1;
+static __inline__ void set_dec(unsigned int val)
+{
+ asm volatile("mtspr 22,%0" : : "r" (val));
}