aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/platform/efi/efi.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-04-30 11:15:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-30 11:15:40 -0400
commitab86e974f04b1cd827a9c7c35273834ebcd9ab38 (patch)
tree41df33732d2700d6d57d1e7ab3f430942f09ffcc /arch/x86/platform/efi/efi.c
parent8700c95adb033843fc163d112b9d21d4fda78018 (diff)
parent6f7a05d7018de222e40ca003721037a530979974 (diff)
Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull core timer updates from Ingo Molnar: "The main changes in this cycle's merge are: - Implement shadow timekeeper to shorten in kernel reader side blocking, by Thomas Gleixner. - Posix timers enhancements by Pavel Emelyanov: - allocate timer ID per process, so that exact timer ID allocations can be re-created be checkpoint/restore code. - debuggability and tooling (/proc/PID/timers, etc.) improvements. - suspend/resume enhancements by Feng Tang: on certain new Intel Atom processors (Penwell and Cloverview), there is a feature that the TSC won't stop in S3 state, so the TSC value won't be reset to 0 after resume. This can be taken advantage of by the generic via the CLOCK_SOURCE_SUSPEND_NONSTOP flag: instead of using the RTC to recover/approximate sleep time, the main (and precise) clocksource can be used. - Fix /proc/timer_list for 4096 CPUs by Nathan Zimmer: on so many CPUs the file goes beyond 4MB of size and thus the current simplistic seqfile approach fails. Convert /proc/timer_list to a proper seq_file with its own iterator. - Cleanups and refactorings of the core timekeeping code by John Stultz. - International Atomic Clock time is managed by the NTP code internally currently but not exposed externally. Separate the TAI code out and add CLOCK_TAI support and TAI support to the hrtimer and posix-timer code, by John Stultz. - Add deep idle support enhacement to the broadcast clockevents core timer code, by Daniel Lezcano: add an opt-in CLOCK_EVT_FEAT_DYNIRQ clockevents feature (which will be utilized by future clockevents driver updates), which allows the use of IRQ affinities to avoid spurious wakeups of idle CPUs - the right CPU with an expiring timer will be woken. - Add new ARM bcm281xx clocksource driver, by Christian Daudt - ... various other fixes and cleanups" * 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (52 commits) clockevents: Set dummy handler on CPU_DEAD shutdown timekeeping: Update tk->cycle_last in resume posix-timers: Remove unused variable clockevents: Switch into oneshot mode even if broadcast registered late timer_list: Convert timer list to be a proper seq_file timer_list: Split timer_list_show_tickdevices posix-timers: Show sigevent info in proc file posix-timers: Introduce /proc/PID/timers file posix timers: Allocate timer id per process (v2) timekeeping: Make sure to notify hrtimers when TAI offset changes hrtimer: Fix ktime_add_ns() overflow on 32bit architectures hrtimer: Add expiry time overflow check in hrtimer_interrupt timekeeping: Shorten seq_count region timekeeping: Implement a shadow timekeeper timekeeping: Delay update of clock->cycle_last timekeeping: Store cycle_last value in timekeeper struct as well ntp: Remove ntp_lock, using the timekeeping locks to protect ntp state timekeeping: Simplify tai updating from do_adjtimex timekeeping: Hold timekeepering locks in do_adjtimex and hardpps timekeeping: Move ADJ_SETOFFSET to top level do_adjtimex() ...
Diffstat (limited to 'arch/x86/platform/efi/efi.c')
-rw-r--r--arch/x86/platform/efi/efi.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index e4a86a677ce1..b55d174e5034 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -49,6 +49,7 @@
49#include <asm/cacheflush.h> 49#include <asm/cacheflush.h>
50#include <asm/tlbflush.h> 50#include <asm/tlbflush.h>
51#include <asm/x86_init.h> 51#include <asm/x86_init.h>
52#include <asm/rtc.h>
52 53
53#define EFI_DEBUG 1 54#define EFI_DEBUG 1
54 55
@@ -352,10 +353,10 @@ static efi_status_t __init phys_efi_get_time(efi_time_t *tm,
352 353
353int efi_set_rtc_mmss(unsigned long nowtime) 354int efi_set_rtc_mmss(unsigned long nowtime)
354{ 355{
355 int real_seconds, real_minutes;
356 efi_status_t status; 356 efi_status_t status;
357 efi_time_t eft; 357 efi_time_t eft;
358 efi_time_cap_t cap; 358 efi_time_cap_t cap;
359 struct rtc_time tm;
359 360
360 status = efi.get_time(&eft, &cap); 361 status = efi.get_time(&eft, &cap);
361 if (status != EFI_SUCCESS) { 362 if (status != EFI_SUCCESS) {
@@ -363,13 +364,20 @@ int efi_set_rtc_mmss(unsigned long nowtime)
363 return -1; 364 return -1;
364 } 365 }
365 366
366 real_seconds = nowtime % 60; 367 rtc_time_to_tm(nowtime, &tm);
367 real_minutes = nowtime / 60; 368 if (!rtc_valid_tm(&tm)) {
368 if (((abs(real_minutes - eft.minute) + 15)/30) & 1) 369 eft.year = tm.tm_year + 1900;
369 real_minutes += 30; 370 eft.month = tm.tm_mon + 1;
370 real_minutes %= 60; 371 eft.day = tm.tm_mday;
371 eft.minute = real_minutes; 372 eft.minute = tm.tm_min;
372 eft.second = real_seconds; 373 eft.second = tm.tm_sec;
374 eft.nanosecond = 0;
375 } else {
376 printk(KERN_ERR
377 "%s: Invalid EFI RTC value: write of %lx to EFI RTC failed\n",
378 __FUNCTION__, nowtime);
379 return -1;
380 }
373 381
374 status = efi.set_time(&eft); 382 status = efi.set_time(&eft);
375 if (status != EFI_SUCCESS) { 383 if (status != EFI_SUCCESS) {