git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
vserver 1.9.5.x5
[linux-2.6.git]
/
arch
/
i386
/
kernel
/
time.c
diff --git
a/arch/i386/kernel/time.c
b/arch/i386/kernel/time.c
index
a9711fc
..
22d38b3
100644
(file)
--- a/
arch/i386/kernel/time.c
+++ b/
arch/i386/kernel/time.c
@@
-45,6
+45,7
@@
#include <linux/sysdev.h>
#include <linux/bcd.h>
#include <linux/efi.h>
#include <linux/sysdev.h>
#include <linux/bcd.h>
#include <linux/efi.h>
+#include <linux/mca.h>
#include <asm/io.h>
#include <asm/smp.h>
#include <asm/io.h>
#include <asm/smp.h>
@@
-80,9
+81,9
@@
unsigned long cpu_khz; /* Detected as we calibrate the TSC */
extern unsigned long wall_jiffies;
extern unsigned long wall_jiffies;
-
spinlock_t rtc_lock = SPIN_LOCK_UNLOCKED
;
+
DEFINE_SPINLOCK(rtc_lock)
;
-
spinlock_t i8253_lock = SPIN_LOCK_UNLOCKED
;
+
DEFINE_SPINLOCK(i8253_lock)
;
EXPORT_SYMBOL(i8253_lock);
struct timer_opts *cur_timer = &timer_none;
EXPORT_SYMBOL(i8253_lock);
struct timer_opts *cur_timer = &timer_none;
@@
-261,8
+262,7
@@
static inline void do_timer_interrupt(int irq, void *dev_id,
last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */
}
last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */
}
-#ifdef CONFIG_MCA
- if( MCA_bus ) {
+ if (MCA_bus) {
/* The PS/2 uses level-triggered interrupts. You can't
turn them off, nor would you want to (any attempt to
enable edge-triggered interrupts usually gets intercepted by a
/* The PS/2 uses level-triggered interrupts. You can't
turn them off, nor would you want to (any attempt to
enable edge-triggered interrupts usually gets intercepted by a
@@
-275,7
+275,6
@@
static inline void do_timer_interrupt(int irq, void *dev_id,
irq = inb_p( 0x61 ); /* read the current state */
outb_p( irq|0x80, 0x61 ); /* reset the IRQ */
}
irq = inb_p( 0x61 ); /* read the current state */
outb_p( irq|0x80, 0x61 ); /* reset the IRQ */
}
-#endif
}
/*
}
/*
@@
-319,47
+318,58
@@
unsigned long get_cmos_time(void)
return retval;
}
return retval;
}
-static long clock_cmos_diff;
+static long clock_cmos_diff
, sleep_start
;
-static int time_suspend(struct sys_device *dev, u32 state)
+static int time
r
_suspend(struct sys_device *dev, u32 state)
{
/*
* Estimate time zone so that set_time can update the clock
*/
clock_cmos_diff = -get_cmos_time();
clock_cmos_diff += get_seconds();
{
/*
* Estimate time zone so that set_time can update the clock
*/
clock_cmos_diff = -get_cmos_time();
clock_cmos_diff += get_seconds();
+ sleep_start = get_cmos_time();
return 0;
}
return 0;
}
-static int time_resume(struct sys_device *dev)
+static int time
r
_resume(struct sys_device *dev)
{
unsigned long flags;
{
unsigned long flags;
- unsigned long sec = get_cmos_time() + clock_cmos_diff;
+ unsigned long sec;
+ unsigned long sleep_length;
+
+#ifdef CONFIG_HPET_TIMER
+ if (is_hpet_enabled())
+ hpet_reenable();
+#endif
+ sec = get_cmos_time() + clock_cmos_diff;
+ sleep_length = (get_cmos_time() - sleep_start) * HZ;
write_seqlock_irqsave(&xtime_lock, flags);
xtime.tv_sec = sec;
xtime.tv_nsec = 0;
write_sequnlock_irqrestore(&xtime_lock, flags);
write_seqlock_irqsave(&xtime_lock, flags);
xtime.tv_sec = sec;
xtime.tv_nsec = 0;
write_sequnlock_irqrestore(&xtime_lock, flags);
+ jiffies += sleep_length;
+ wall_jiffies += sleep_length;
return 0;
}
return 0;
}
-static struct sysdev_class
pit
_sysclass = {
- .resume = time_resume,
- .suspend = time_suspend,
- set_kset_name("
pit
"),
+static struct sysdev_class
timer
_sysclass = {
+ .resume = time
r
_resume,
+ .suspend = time
r
_suspend,
+ set_kset_name("
timer
"),
};
/* XXX this driverfs stuff should probably go elsewhere later -john */
};
/* XXX this driverfs stuff should probably go elsewhere later -john */
-static struct sys_device device_
i8253
= {
+static struct sys_device device_
timer
= {
.id = 0,
.id = 0,
- .cls = &
pit
_sysclass,
+ .cls = &
timer
_sysclass,
};
static int time_init_device(void)
{
};
static int time_init_device(void)
{
- int error = sysdev_class_register(&
pit
_sysclass);
+ int error = sysdev_class_register(&
timer
_sysclass);
if (!error)
if (!error)
- error = sysdev_register(&device_
i8253
);
+ error = sysdev_register(&device_
timer
);
return error;
}
return error;
}
@@
-371,9
+381,9
@@
extern void (*late_time_init)(void);
void __init hpet_time_init(void)
{
xtime.tv_sec = get_cmos_time();
void __init hpet_time_init(void)
{
xtime.tv_sec = get_cmos_time();
- wall_to_monotonic.tv_sec = -xtime.tv_sec;
xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ);
xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ);
- wall_to_monotonic.tv_nsec = -xtime.tv_nsec;
+ set_normalized_timespec(&wall_to_monotonic,
+ -xtime.tv_sec, -xtime.tv_nsec);
if (hpet_enable() >= 0) {
printk("Using HPET for base-timer\n");
if (hpet_enable() >= 0) {
printk("Using HPET for base-timer\n");
@@
-399,9
+409,9
@@
void __init time_init(void)
}
#endif
xtime.tv_sec = get_cmos_time();
}
#endif
xtime.tv_sec = get_cmos_time();
- wall_to_monotonic.tv_sec = -xtime.tv_sec;
xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ);
xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ);
- wall_to_monotonic.tv_nsec = -xtime.tv_nsec;
+ set_normalized_timespec(&wall_to_monotonic,
+ -xtime.tv_sec, -xtime.tv_nsec);
cur_timer = select_timer();
printk(KERN_INFO "Using %s for high-res timesource\n",cur_timer->name);
cur_timer = select_timer();
printk(KERN_INFO "Using %s for high-res timesource\n",cur_timer->name);