vserver 2.0 rc7
[linux-2.6.git] / arch / sparc64 / kernel / time.c
index b50e16d..71b4e38 100644 (file)
@@ -46,9 +46,9 @@
 #include <asm/sections.h>
 #include <asm/cpudata.h>
 
-spinlock_t mostek_lock = SPIN_LOCK_UNLOCKED;
-spinlock_t rtc_lock = SPIN_LOCK_UNLOCKED;
-unsigned long mstk48t02_regs = 0UL;
+DEFINE_SPINLOCK(mostek_lock);
+DEFINE_SPINLOCK(rtc_lock);
+void __iomem *mstk48t02_regs = NULL;
 #ifdef CONFIG_PCI
 unsigned long ds1287_regs = 0UL;
 #endif
@@ -59,12 +59,21 @@ u64 jiffies_64 = INITIAL_JIFFIES;
 
 EXPORT_SYMBOL(jiffies_64);
 
-static unsigned long mstk48t08_regs = 0UL;
-static unsigned long mstk48t59_regs = 0UL;
+static void __iomem *mstk48t08_regs;
+static void __iomem *mstk48t59_regs;
 
 static int set_rtc_mmss(unsigned long);
 
-struct sparc64_tick_ops *tick_ops;
+static __init unsigned long dummy_get_tick(void)
+{
+       return 0;
+}
+
+static __initdata struct sparc64_tick_ops dummy_tick_ops = {
+       .get_tick       = dummy_get_tick,
+};
+
+struct sparc64_tick_ops *tick_ops = &dummy_tick_ops;
 
 #define TICK_PRIV_BIT  (1UL << 63)
 
@@ -462,6 +471,7 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs * regs)
        do {
 #ifndef CONFIG_SMP
                profile_tick(CPU_PROFILING, regs);
+               update_process_times(user_mode(regs));
 #endif
                do_timer(regs);
 
@@ -510,7 +520,7 @@ void timer_tick_interrupt(struct pt_regs *regs)
 /* Kick start a stopped clock (procedure from the Sun NVRAM/hostid FAQ). */
 static void __init kick_start_clock(void)
 {
-       unsigned long regs = mstk48t02_regs;
+       void __iomem *regs = mstk48t02_regs;
        u8 sec, tmp;
        int i, count;
 
@@ -594,7 +604,7 @@ static void __init kick_start_clock(void)
 /* Return nonzero if the clock chip battery is low. */
 static int __init has_low_battery(void)
 {
-       unsigned long regs = mstk48t02_regs;
+       void __iomem *regs = mstk48t02_regs;
        u8 data1, data2;
 
        spin_lock_irq(&mostek_lock);
@@ -613,7 +623,7 @@ static int __init has_low_battery(void)
 static void __init set_system_time(void)
 {
        unsigned int year, mon, day, hour, min, sec;
-       unsigned long mregs = mstk48t02_regs;
+       void __iomem *mregs = mstk48t02_regs;
 #ifdef CONFIG_PCI
        unsigned long dregs = ds1287_regs;
 #else
@@ -769,6 +779,7 @@ void __init clock_probe(void)
                    strcmp(model, "mk48t59") &&
                    strcmp(model, "m5819") &&
                    strcmp(model, "m5819p") &&
+                   strcmp(model, "m5823") &&
                    strcmp(model, "ds1287")) {
                        if (cbus != NULL) {
                                prom_printf("clock_probe: Central bus lacks timer chip.\n");
@@ -828,10 +839,12 @@ void __init clock_probe(void)
 
                        if (!strcmp(model, "ds1287") ||
                            !strcmp(model, "m5819") ||
-                           !strcmp(model, "m5819p")) {
+                           !strcmp(model, "m5819p") ||
+                           !strcmp(model, "m5823")) {
                                ds1287_regs = edev->resource[0].start;
                        } else {
-                               mstk48t59_regs = edev->resource[0].start;
+                               mstk48t59_regs = (void __iomem *)
+                                       edev->resource[0].start;
                                mstk48t02_regs = mstk48t59_regs + MOSTEK_48T59_48T02;
                        }
                        break;
@@ -849,10 +862,12 @@ try_isa_clock:
                        }
                        if (!strcmp(model, "ds1287") ||
                            !strcmp(model, "m5819") ||
-                           !strcmp(model, "m5819p")) {
+                           !strcmp(model, "m5819p") ||
+                           !strcmp(model, "m5823")) {
                                ds1287_regs = isadev->resource.start;
                        } else {
-                               mstk48t59_regs = isadev->resource.start;
+                               mstk48t59_regs = (void __iomem *)
+                                       isadev->resource.start;
                                mstk48t02_regs = mstk48t59_regs + MOSTEK_48T59_48T02;
                        }
                        break;
@@ -880,21 +895,24 @@ try_isa_clock:
                }
 
                if(model[5] == '0' && model[6] == '2') {
-                       mstk48t02_regs = (((u64)clk_reg[0].phys_addr) |
-                                         (((u64)clk_reg[0].which_io)<<32UL));
+                       mstk48t02_regs = (void __iomem *)
+                               (((u64)clk_reg[0].phys_addr) |
+                                (((u64)clk_reg[0].which_io)<<32UL));
                } else if(model[5] == '0' && model[6] == '8') {
-                       mstk48t08_regs = (((u64)clk_reg[0].phys_addr) |
-                                         (((u64)clk_reg[0].which_io)<<32UL));
+                       mstk48t08_regs = (void __iomem *)
+                               (((u64)clk_reg[0].phys_addr) |
+                                (((u64)clk_reg[0].which_io)<<32UL));
                        mstk48t02_regs = mstk48t08_regs + MOSTEK_48T08_48T02;
                } else {
-                       mstk48t59_regs = (((u64)clk_reg[0].phys_addr) |
-                                         (((u64)clk_reg[0].which_io)<<32UL));
+                       mstk48t59_regs = (void __iomem *)
+                               (((u64)clk_reg[0].phys_addr) |
+                                (((u64)clk_reg[0].which_io)<<32UL));
                        mstk48t02_regs = mstk48t59_regs + MOSTEK_48T59_48T02;
                }
                break;
        }
 
-       if (mstk48t02_regs != 0UL) {
+       if (mstk48t02_regs != NULL) {
                /* Report a low battery voltage condition. */
                if (has_low_battery())
                        prom_printf("NVRAM: Low battery voltage!\n");
@@ -1036,6 +1054,7 @@ static struct notifier_block sparc64_cpufreq_notifier_block = {
 static struct time_interpolator sparc64_cpu_interpolator = {
        .source         =       TIME_SOURCE_CPU,
        .shift          =       16,
+       .mask           =       0xffffffffffffffffLL
 };
 
 /* The quotient formula is taken from the IA64 port. */
@@ -1073,7 +1092,7 @@ unsigned long long sched_clock(void)
 static int set_rtc_mmss(unsigned long nowtime)
 {
        int real_seconds, real_minutes, chip_minutes;
-       unsigned long mregs = mstk48t02_regs;
+       void __iomem *mregs = mstk48t02_regs;
 #ifdef CONFIG_PCI
        unsigned long dregs = ds1287_regs;
 #else