aboutsummaryrefslogtreecommitdiffstats
path: root/arch/alpha
diff options
context:
space:
mode:
Diffstat (limited to 'arch/alpha')
-rw-r--r--arch/alpha/Kconfig3
-rw-r--r--arch/alpha/include/asm/atomic.h4
-rw-r--r--arch/alpha/include/asm/bitops.h18
-rw-r--r--arch/alpha/include/asm/thread_info.h2
-rw-r--r--arch/alpha/kernel/time.c101
5 files changed, 63 insertions, 65 deletions
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 75291fdd379..b7193986cbf 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -55,6 +55,9 @@ config ARCH_USES_GETTIMEOFFSET
55 bool 55 bool
56 default y 56 default y
57 57
58config GENERIC_CMOS_UPDATE
59 def_bool y
60
58config ZONE_DMA 61config ZONE_DMA
59 bool 62 bool
60 default y 63 default y
diff --git a/arch/alpha/include/asm/atomic.h b/arch/alpha/include/asm/atomic.h
index 610dff44d94..e756d04b6cd 100644
--- a/arch/alpha/include/asm/atomic.h
+++ b/arch/alpha/include/asm/atomic.h
@@ -17,8 +17,8 @@
17#define ATOMIC_INIT(i) ( (atomic_t) { (i) } ) 17#define ATOMIC_INIT(i) ( (atomic_t) { (i) } )
18#define ATOMIC64_INIT(i) ( (atomic64_t) { (i) } ) 18#define ATOMIC64_INIT(i) ( (atomic64_t) { (i) } )
19 19
20#define atomic_read(v) ((v)->counter + 0) 20#define atomic_read(v) (*(volatile int *)&(v)->counter)
21#define atomic64_read(v) ((v)->counter + 0) 21#define atomic64_read(v) (*(volatile long *)&(v)->counter)
22 22
23#define atomic_set(v,i) ((v)->counter = (i)) 23#define atomic_set(v,i) ((v)->counter = (i))
24#define atomic64_set(v,i) ((v)->counter = (i)) 24#define atomic64_set(v,i) ((v)->counter = (i))
diff --git a/arch/alpha/include/asm/bitops.h b/arch/alpha/include/asm/bitops.h
index 15f3ae25c51..296da1d5ed5 100644
--- a/arch/alpha/include/asm/bitops.h
+++ b/arch/alpha/include/asm/bitops.h
@@ -405,29 +405,31 @@ static inline int fls(int x)
405 405
406#if defined(CONFIG_ALPHA_EV6) && defined(CONFIG_ALPHA_EV67) 406#if defined(CONFIG_ALPHA_EV6) && defined(CONFIG_ALPHA_EV67)
407/* Whee. EV67 can calculate it directly. */ 407/* Whee. EV67 can calculate it directly. */
408static inline unsigned long hweight64(unsigned long w) 408static inline unsigned long __arch_hweight64(unsigned long w)
409{ 409{
410 return __kernel_ctpop(w); 410 return __kernel_ctpop(w);
411} 411}
412 412
413static inline unsigned int hweight32(unsigned int w) 413static inline unsigned int __arch_weight32(unsigned int w)
414{ 414{
415 return hweight64(w); 415 return __arch_hweight64(w);
416} 416}
417 417
418static inline unsigned int hweight16(unsigned int w) 418static inline unsigned int __arch_hweight16(unsigned int w)
419{ 419{
420 return hweight64(w & 0xffff); 420 return __arch_hweight64(w & 0xffff);
421} 421}
422 422
423static inline unsigned int hweight8(unsigned int w) 423static inline unsigned int __arch_hweight8(unsigned int w)
424{ 424{
425 return hweight64(w & 0xff); 425 return __arch_hweight64(w & 0xff);
426} 426}
427#else 427#else
428#include <asm-generic/bitops/hweight.h> 428#include <asm-generic/bitops/arch_hweight.h>
429#endif 429#endif
430 430
431#include <asm-generic/bitops/const_hweight.h>
432
431#endif /* __KERNEL__ */ 433#endif /* __KERNEL__ */
432 434
433#include <asm-generic/bitops/find.h> 435#include <asm-generic/bitops/find.h>
diff --git a/arch/alpha/include/asm/thread_info.h b/arch/alpha/include/asm/thread_info.h
index b3e888638bb..6f32f9c84a2 100644
--- a/arch/alpha/include/asm/thread_info.h
+++ b/arch/alpha/include/asm/thread_info.h
@@ -77,7 +77,7 @@ register struct thread_info *__current_thread_info __asm__("$8");
77#define TIF_UAC_NOPRINT 10 /* see sysinfo.h */ 77#define TIF_UAC_NOPRINT 10 /* see sysinfo.h */
78#define TIF_UAC_NOFIX 11 78#define TIF_UAC_NOFIX 11
79#define TIF_UAC_SIGBUS 12 79#define TIF_UAC_SIGBUS 12
80#define TIF_MEMDIE 13 80#define TIF_MEMDIE 13 /* is terminating due to OOM killer */
81#define TIF_RESTORE_SIGMASK 14 /* restore signal mask in do_signal */ 81#define TIF_RESTORE_SIGMASK 14 /* restore signal mask in do_signal */
82#define TIF_FREEZE 16 /* is freezing for suspend */ 82#define TIF_FREEZE 16 /* is freezing for suspend */
83 83
diff --git a/arch/alpha/kernel/time.c b/arch/alpha/kernel/time.c
index 5d0826654c6..5465e932e56 100644
--- a/arch/alpha/kernel/time.c
+++ b/arch/alpha/kernel/time.c
@@ -75,8 +75,6 @@ static struct {
75 __u32 last_time; 75 __u32 last_time;
76 /* ticks/cycle * 2^48 */ 76 /* ticks/cycle * 2^48 */
77 unsigned long scaled_ticks_per_cycle; 77 unsigned long scaled_ticks_per_cycle;
78 /* last time the CMOS clock got updated */
79 time_t last_rtc_update;
80 /* partial unused tick */ 78 /* partial unused tick */
81 unsigned long partial_tick; 79 unsigned long partial_tick;
82} state; 80} state;
@@ -91,6 +89,52 @@ static inline __u32 rpcc(void)
91 return result; 89 return result;
92} 90}
93 91
92int update_persistent_clock(struct timespec now)
93{
94 return set_rtc_mmss(now.tv_sec);
95}
96
97void read_persistent_clock(struct timespec *ts)
98{
99 unsigned int year, mon, day, hour, min, sec, epoch;
100
101 sec = CMOS_READ(RTC_SECONDS);
102 min = CMOS_READ(RTC_MINUTES);
103 hour = CMOS_READ(RTC_HOURS);
104 day = CMOS_READ(RTC_DAY_OF_MONTH);
105 mon = CMOS_READ(RTC_MONTH);
106 year = CMOS_READ(RTC_YEAR);
107
108 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
109 sec = bcd2bin(sec);
110 min = bcd2bin(min);
111 hour = bcd2bin(hour);
112 day = bcd2bin(day);
113 mon = bcd2bin(mon);
114 year = bcd2bin(year);
115 }
116
117 /* PC-like is standard; used for year >= 70 */
118 epoch = 1900;
119 if (year < 20)
120 epoch = 2000;
121 else if (year >= 20 && year < 48)
122 /* NT epoch */
123 epoch = 1980;
124 else if (year >= 48 && year < 70)
125 /* Digital UNIX epoch */
126 epoch = 1952;
127
128 printk(KERN_INFO "Using epoch = %d\n", epoch);
129
130 if ((year += epoch) < 1970)
131 year += 100;
132
133 ts->tv_sec = mktime(year, mon, day, hour, min, sec);
134}
135
136
137
94/* 138/*
95 * timer_interrupt() needs to keep up the real-time clock, 139 * timer_interrupt() needs to keep up the real-time clock,
96 * as well as call the "do_timer()" routine every clocktick 140 * as well as call the "do_timer()" routine every clocktick
@@ -123,19 +167,6 @@ irqreturn_t timer_interrupt(int irq, void *dev)
123 if (nticks) 167 if (nticks)
124 do_timer(nticks); 168 do_timer(nticks);
125 169
126 /*
127 * If we have an externally synchronized Linux clock, then update
128 * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
129 * called as close as possible to 500 ms before the new second starts.
130 */
131 if (ntp_synced()
132 && xtime.tv_sec > state.last_rtc_update + 660
133 && xtime.tv_nsec >= 500000 - ((unsigned) TICK_SIZE) / 2
134 && xtime.tv_nsec <= 500000 + ((unsigned) TICK_SIZE) / 2) {
135 int tmp = set_rtc_mmss(xtime.tv_sec);
136 state.last_rtc_update = xtime.tv_sec - (tmp ? 600 : 0);
137 }
138
139 write_sequnlock(&xtime_lock); 170 write_sequnlock(&xtime_lock);
140 171
141#ifndef CONFIG_SMP 172#ifndef CONFIG_SMP
@@ -304,7 +335,7 @@ rpcc_after_update_in_progress(void)
304void __init 335void __init
305time_init(void) 336time_init(void)
306{ 337{
307 unsigned int year, mon, day, hour, min, sec, cc1, cc2, epoch; 338 unsigned int cc1, cc2;
308 unsigned long cycle_freq, tolerance; 339 unsigned long cycle_freq, tolerance;
309 long diff; 340 long diff;
310 341
@@ -348,43 +379,6 @@ time_init(void)
348 bogomips yet, but this is close on a 500Mhz box. */ 379 bogomips yet, but this is close on a 500Mhz box. */
349 __delay(1000000); 380 __delay(1000000);
350 381
351 sec = CMOS_READ(RTC_SECONDS);
352 min = CMOS_READ(RTC_MINUTES);
353 hour = CMOS_READ(RTC_HOURS);
354 day = CMOS_READ(RTC_DAY_OF_MONTH);
355 mon = CMOS_READ(RTC_MONTH);
356 year = CMOS_READ(RTC_YEAR);
357
358 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
359 sec = bcd2bin(sec);
360 min = bcd2bin(min);
361 hour = bcd2bin(hour);
362 day = bcd2bin(day);
363 mon = bcd2bin(mon);
364 year = bcd2bin(year);
365 }
366
367 /* PC-like is standard; used for year >= 70 */
368 epoch = 1900;
369 if (year < 20)
370 epoch = 2000;
371 else if (year >= 20 && year < 48)
372 /* NT epoch */
373 epoch = 1980;
374 else if (year >= 48 && year < 70)
375 /* Digital UNIX epoch */
376 epoch = 1952;
377
378 printk(KERN_INFO "Using epoch = %d\n", epoch);
379
380 if ((year += epoch) < 1970)
381 year += 100;
382
383 xtime.tv_sec = mktime(year, mon, day, hour, min, sec);
384 xtime.tv_nsec = 0;
385
386 wall_to_monotonic.tv_sec -= xtime.tv_sec;
387 wall_to_monotonic.tv_nsec = 0;
388 382
389 if (HZ > (1<<16)) { 383 if (HZ > (1<<16)) {
390 extern void __you_loose (void); 384 extern void __you_loose (void);
@@ -394,7 +388,6 @@ time_init(void)
394 state.last_time = cc1; 388 state.last_time = cc1;
395 state.scaled_ticks_per_cycle 389 state.scaled_ticks_per_cycle
396 = ((unsigned long) HZ << FIX_SHIFT) / cycle_freq; 390 = ((unsigned long) HZ << FIX_SHIFT) / cycle_freq;
397 state.last_rtc_update = 0;
398 state.partial_tick = 0L; 391 state.partial_tick = 0L;
399 392
400 /* Startup the timer source. */ 393 /* Startup the timer source. */