patch-2.4.2 linux/arch/s390/kernel/time.c

Next file: linux/arch/s390/kernel/traps.c
Previous file: linux/arch/s390/kernel/sys_s390.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.1/linux/arch/s390/kernel/time.c linux/arch/s390/kernel/time.c
@@ -11,7 +11,6 @@
  *    Copyright (C) 1991, 1992, 1995  Linus Torvalds
  */
 
-#include <linux/config.h>
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
@@ -27,15 +26,14 @@
 
 #include <asm/uaccess.h>
 #include <asm/delay.h>
+#include <asm/s390_ext.h>
 
-#include <linux/mc146818rtc.h>
 #include <linux/timex.h>
+#include <linux/config.h>
 
 #include <asm/irq.h>
 
 
-extern volatile unsigned long lost_ticks;
-
 /* change this if you have some constant time drift */
 #define USECS_PER_JIFFY ((signed long)1000000/HZ)
 #define CLK_TICKS_PER_JIFFY ((signed long)USECS_PER_JIFFY<<12)
@@ -45,6 +43,7 @@
 static uint64_t init_timer_cc, last_timer_cc;
 
 extern rwlock_t xtime_lock;
+extern unsigned long wall_jiffies;
 
 void tod_to_timeval(uint64_t todval, struct timeval *xtime)
 {
@@ -94,9 +93,9 @@
  */
 void do_gettimeofday(struct timeval *tv)
 {
-	extern volatile unsigned long lost_ticks;
 	unsigned long flags;
 	unsigned long usec, sec;
+	unsigned long lost_ticks = jiffies - wall_jiffies;
 
 	read_lock_irqsave(&xtime_lock, flags);
 	usec = do_gettimeoffset();
@@ -149,7 +148,7 @@
 extern __u16 boot_cpu_addr;
 #endif
 
-void do_timer_interrupt(struct pt_regs *regs,int error_code)
+void do_timer_interrupt(struct pt_regs *regs, __u16 error_code)
 {
         unsigned long flags;
 
@@ -242,6 +241,9 @@
                 printk("time_init: TOD clock stopped/non-operational\n");
                 break;
         }
+        /* request the 0x1004 external interrupt */
+        if (register_external_interrupt(0x1004, do_timer_interrupt) != 0)
+                panic("Couldn't request external interrupts 0x1004");
         init_100hz_timer();
         init_timer_cc = S390_lowcore.jiffy_timer_cc;
         init_timer_cc -= 0x8126d60e46000000LL -

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)