diff options
author | Paul Mackerras <paulus@samba.org> | 2005-10-19 09:11:21 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2005-10-19 09:11:21 -0400 |
commit | 143a1dec7e04e0a9712ff93e779aabfb21dfd97c (patch) | |
tree | 3a60a4e630d792fb3cdc6e962ce0ecfd94bb2672 /arch/powerpc/platforms/powermac | |
parent | 7ed476d17f04473f70d796cb6c172bdcfcc9b8e5 (diff) |
powerpc: Merge machdep.h
A few things change for consistency between ppc32 and ppc64:
idle functions return void; *_get_boot_time functions return
unsigned long (i.e. time_t) rather than filling in a struct rtc_time
(since that's useful to the callers and easier for pmac to
generate); *_get_rtc_time and *_set_rtc_time functions take
a struct rtc_time; irq_canonicalize is gone; nvram_sync returns
void.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/platforms/powermac')
-rw-r--r-- | arch/powerpc/platforms/powermac/pmac.h | 7 | ||||
-rw-r--r-- | arch/powerpc/platforms/powermac/setup.c | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/powermac/time.c | 24 |
3 files changed, 24 insertions, 9 deletions
diff --git a/arch/powerpc/platforms/powermac/pmac.h b/arch/powerpc/platforms/powermac/pmac.h index 81f52512b046..0a9ba704865e 100644 --- a/arch/powerpc/platforms/powermac/pmac.h +++ b/arch/powerpc/platforms/powermac/pmac.h | |||
@@ -10,9 +10,12 @@ | |||
10 | * pmac_* files. Mostly for use by pmac_setup | 10 | * pmac_* files. Mostly for use by pmac_setup |
11 | */ | 11 | */ |
12 | 12 | ||
13 | struct rtc_time; | ||
14 | |||
13 | extern long pmac_time_init(void); | 15 | extern long pmac_time_init(void); |
14 | extern unsigned long pmac_get_rtc_time(void); | 16 | extern unsigned long pmac_get_boot_time(void); |
15 | extern int pmac_set_rtc_time(unsigned long nowtime); | 17 | extern void pmac_get_rtc_time(struct rtc_time *); |
18 | extern int pmac_set_rtc_time(struct rtc_time *); | ||
16 | extern void pmac_read_rtc_time(void); | 19 | extern void pmac_read_rtc_time(void); |
17 | extern void pmac_calibrate_decr(void); | 20 | extern void pmac_calibrate_decr(void); |
18 | extern void pmac_pcibios_fixup(void); | 21 | extern void pmac_pcibios_fixup(void); |
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c index 7eb0c34b6994..b6414e7c37d4 100644 --- a/arch/powerpc/platforms/powermac/setup.c +++ b/arch/powerpc/platforms/powermac/setup.c | |||
@@ -562,7 +562,6 @@ void __init pmac_init(void) | |||
562 | ppc_md.setup_arch = pmac_setup_arch; | 562 | ppc_md.setup_arch = pmac_setup_arch; |
563 | ppc_md.show_cpuinfo = pmac_show_cpuinfo; | 563 | ppc_md.show_cpuinfo = pmac_show_cpuinfo; |
564 | ppc_md.show_percpuinfo = pmac_show_percpuinfo; | 564 | ppc_md.show_percpuinfo = pmac_show_percpuinfo; |
565 | ppc_md.irq_canonicalize = NULL; | ||
566 | ppc_md.init_IRQ = pmac_pic_init; | 565 | ppc_md.init_IRQ = pmac_pic_init; |
567 | ppc_md.get_irq = pmac_get_irq; /* Changed later on ... */ | 566 | ppc_md.get_irq = pmac_get_irq; /* Changed later on ... */ |
568 | 567 | ||
@@ -578,6 +577,7 @@ void __init pmac_init(void) | |||
578 | ppc_md.time_init = pmac_time_init; | 577 | ppc_md.time_init = pmac_time_init; |
579 | ppc_md.set_rtc_time = pmac_set_rtc_time; | 578 | ppc_md.set_rtc_time = pmac_set_rtc_time; |
580 | ppc_md.get_rtc_time = pmac_get_rtc_time; | 579 | ppc_md.get_rtc_time = pmac_get_rtc_time; |
580 | ppc_md.get_boot_time = pmac_get_boot_time; | ||
581 | ppc_md.calibrate_decr = pmac_calibrate_decr; | 581 | ppc_md.calibrate_decr = pmac_calibrate_decr; |
582 | 582 | ||
583 | ppc_md.feature_call = pmac_do_feature_call; | 583 | ppc_md.feature_call = pmac_do_feature_call; |
diff --git a/arch/powerpc/platforms/powermac/time.c b/arch/powerpc/platforms/powermac/time.c index edb9fcc64790..3ee6d8aa14c4 100644 --- a/arch/powerpc/platforms/powermac/time.c +++ b/arch/powerpc/platforms/powermac/time.c | |||
@@ -77,8 +77,7 @@ pmac_time_init(void) | |||
77 | #endif | 77 | #endif |
78 | } | 78 | } |
79 | 79 | ||
80 | unsigned long | 80 | unsigned long pmac_get_boot_time(void) |
81 | pmac_get_rtc_time(void) | ||
82 | { | 81 | { |
83 | #if defined(CONFIG_ADB_CUDA) || defined(CONFIG_ADB_PMU) | 82 | #if defined(CONFIG_ADB_CUDA) || defined(CONFIG_ADB_PMU) |
84 | struct adb_request req; | 83 | struct adb_request req; |
@@ -118,20 +117,33 @@ pmac_get_rtc_time(void) | |||
118 | return 0; | 117 | return 0; |
119 | } | 118 | } |
120 | 119 | ||
121 | int | 120 | void pmac_get_rtc_time(struct rtc_time *tm) |
122 | pmac_set_rtc_time(unsigned long nowtime) | ||
123 | { | 121 | { |
122 | unsigned long now; | ||
123 | |||
124 | now = pmac_get_boot_time(); | ||
125 | to_tm(now, tm); | ||
126 | tm->tm_year -= 1900; | ||
127 | tm->tm_mon -= 1; /* month is 0-based */ | ||
128 | } | ||
129 | |||
130 | int pmac_set_rtc_time(struct rtc_time *tm) | ||
131 | { | ||
132 | unsigned long nowtime; | ||
124 | #if defined(CONFIG_ADB_CUDA) || defined(CONFIG_ADB_PMU) | 133 | #if defined(CONFIG_ADB_CUDA) || defined(CONFIG_ADB_PMU) |
125 | struct adb_request req; | 134 | struct adb_request req; |
126 | #endif | 135 | #endif |
127 | 136 | ||
137 | nowtime = mktime(tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday, | ||
138 | tm->tm_hour, tm->tm_min, tm->tm_sec); | ||
128 | nowtime += RTC_OFFSET; | 139 | nowtime += RTC_OFFSET; |
129 | 140 | ||
130 | switch (sys_ctrler) { | 141 | switch (sys_ctrler) { |
131 | #ifdef CONFIG_ADB_CUDA | 142 | #ifdef CONFIG_ADB_CUDA |
132 | case SYS_CTRLER_CUDA: | 143 | case SYS_CTRLER_CUDA: |
133 | if (cuda_request(&req, NULL, 6, CUDA_PACKET, CUDA_SET_TIME, | 144 | if (cuda_request(&req, NULL, 6, CUDA_PACKET, CUDA_SET_TIME, |
134 | nowtime >> 24, nowtime >> 16, nowtime >> 8, nowtime) < 0) | 145 | nowtime >> 24, nowtime >> 16, nowtime >> 8, |
146 | nowtime) < 0) | ||
135 | return 0; | 147 | return 0; |
136 | while (!req.complete) | 148 | while (!req.complete) |
137 | cuda_poll(); | 149 | cuda_poll(); |
@@ -221,7 +233,7 @@ time_sleep_notify(struct pmu_sleep_notifier *self, int when) | |||
221 | case PBOOK_SLEEP_NOW: | 233 | case PBOOK_SLEEP_NOW: |
222 | do { | 234 | do { |
223 | seq = read_seqbegin_irqsave(&xtime_lock, flags); | 235 | seq = read_seqbegin_irqsave(&xtime_lock, flags); |
224 | time_diff = xtime.tv_sec - pmac_get_rtc_time(); | 236 | time_diff = xtime.tv_sec - pmac_get_boot_time(); |
225 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); | 237 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); |
226 | break; | 238 | break; |
227 | case PBOOK_WAKE: | 239 | case PBOOK_WAKE: |