diff options
Diffstat (limited to 'arch/sparc64/kernel/time.c')
| -rw-r--r-- | arch/sparc64/kernel/time.c | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c index f2e73e613748..a31a0439244f 100644 --- a/arch/sparc64/kernel/time.c +++ b/arch/sparc64/kernel/time.c | |||
| @@ -680,22 +680,14 @@ static int starfire_set_time(u32 val) | |||
| 680 | 680 | ||
| 681 | static u32 hypervisor_get_time(void) | 681 | static u32 hypervisor_get_time(void) |
| 682 | { | 682 | { |
| 683 | register unsigned long func asm("%o5"); | 683 | unsigned long ret, time; |
| 684 | register unsigned long arg0 asm("%o0"); | ||
| 685 | register unsigned long arg1 asm("%o1"); | ||
| 686 | int retries = 10000; | 684 | int retries = 10000; |
| 687 | 685 | ||
| 688 | retry: | 686 | retry: |
| 689 | func = HV_FAST_TOD_GET; | 687 | ret = sun4v_tod_get(&time); |
| 690 | arg0 = 0; | 688 | if (ret == HV_EOK) |
| 691 | arg1 = 0; | 689 | return time; |
| 692 | __asm__ __volatile__("ta %6" | 690 | if (ret == HV_EWOULDBLOCK) { |
| 693 | : "=&r" (func), "=&r" (arg0), "=&r" (arg1) | ||
| 694 | : "0" (func), "1" (arg0), "2" (arg1), | ||
| 695 | "i" (HV_FAST_TRAP)); | ||
| 696 | if (arg0 == HV_EOK) | ||
| 697 | return arg1; | ||
| 698 | if (arg0 == HV_EWOULDBLOCK) { | ||
| 699 | if (--retries > 0) { | 691 | if (--retries > 0) { |
| 700 | udelay(100); | 692 | udelay(100); |
| 701 | goto retry; | 693 | goto retry; |
| @@ -709,20 +701,14 @@ retry: | |||
| 709 | 701 | ||
| 710 | static int hypervisor_set_time(u32 secs) | 702 | static int hypervisor_set_time(u32 secs) |
| 711 | { | 703 | { |
| 712 | register unsigned long func asm("%o5"); | 704 | unsigned long ret; |
| 713 | register unsigned long arg0 asm("%o0"); | ||
| 714 | int retries = 10000; | 705 | int retries = 10000; |
| 715 | 706 | ||
| 716 | retry: | 707 | retry: |
| 717 | func = HV_FAST_TOD_SET; | 708 | ret = sun4v_tod_set(secs); |
| 718 | arg0 = secs; | 709 | if (ret == HV_EOK) |
| 719 | __asm__ __volatile__("ta %4" | ||
| 720 | : "=&r" (func), "=&r" (arg0) | ||
| 721 | : "0" (func), "1" (arg0), | ||
| 722 | "i" (HV_FAST_TRAP)); | ||
| 723 | if (arg0 == HV_EOK) | ||
| 724 | return 0; | 710 | return 0; |
| 725 | if (arg0 == HV_EWOULDBLOCK) { | 711 | if (ret == HV_EWOULDBLOCK) { |
| 726 | if (--retries > 0) { | 712 | if (--retries > 0) { |
| 727 | udelay(100); | 713 | udelay(100); |
| 728 | goto retry; | 714 | goto retry; |
