aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc64
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2005-10-19 09:11:21 -0400
committerPaul Mackerras <paulus@samba.org>2005-10-19 09:11:21 -0400
commit143a1dec7e04e0a9712ff93e779aabfb21dfd97c (patch)
tree3a60a4e630d792fb3cdc6e962ce0ecfd94bb2672 /arch/ppc64
parent7ed476d17f04473f70d796cb6c172bdcfcc9b8e5 (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/ppc64')
-rw-r--r--arch/ppc64/kernel/idle.c8
-rw-r--r--arch/ppc64/kernel/maple_setup.c2
-rw-r--r--arch/ppc64/kernel/maple_time.c7
-rw-r--r--arch/ppc64/kernel/pmac.h2
-rw-r--r--arch/ppc64/kernel/pmac_nvram.c4
-rw-r--r--arch/ppc64/kernel/pmac_time.c21
-rw-r--r--arch/ppc64/kernel/rtas-proc.c1
-rw-r--r--arch/ppc64/kernel/rtc.c11
8 files changed, 20 insertions, 36 deletions
diff --git a/arch/ppc64/kernel/idle.c b/arch/ppc64/kernel/idle.c
index 954395d42636..8abd2ad92832 100644
--- a/arch/ppc64/kernel/idle.c
+++ b/arch/ppc64/kernel/idle.c
@@ -31,7 +31,7 @@
31 31
32extern void power4_idle(void); 32extern void power4_idle(void);
33 33
34int default_idle(void) 34void default_idle(void)
35{ 35{
36 long oldval; 36 long oldval;
37 unsigned int cpu = smp_processor_id(); 37 unsigned int cpu = smp_processor_id();
@@ -64,11 +64,9 @@ int default_idle(void)
64 if (cpu_is_offline(cpu) && system_state == SYSTEM_RUNNING) 64 if (cpu_is_offline(cpu) && system_state == SYSTEM_RUNNING)
65 cpu_die(); 65 cpu_die();
66 } 66 }
67
68 return 0;
69} 67}
70 68
71int native_idle(void) 69void native_idle(void)
72{ 70{
73 while (1) { 71 while (1) {
74 ppc64_runlatch_off(); 72 ppc64_runlatch_off();
@@ -85,8 +83,6 @@ int native_idle(void)
85 system_state == SYSTEM_RUNNING) 83 system_state == SYSTEM_RUNNING)
86 cpu_die(); 84 cpu_die();
87 } 85 }
88
89 return 0;
90} 86}
91 87
92void cpu_idle(void) 88void cpu_idle(void)
diff --git a/arch/ppc64/kernel/maple_setup.c b/arch/ppc64/kernel/maple_setup.c
index 22987675f544..a107ed69a355 100644
--- a/arch/ppc64/kernel/maple_setup.c
+++ b/arch/ppc64/kernel/maple_setup.c
@@ -70,7 +70,7 @@
70 70
71extern int maple_set_rtc_time(struct rtc_time *tm); 71extern int maple_set_rtc_time(struct rtc_time *tm);
72extern void maple_get_rtc_time(struct rtc_time *tm); 72extern void maple_get_rtc_time(struct rtc_time *tm);
73extern void maple_get_boot_time(struct rtc_time *tm); 73extern unsigned long maple_get_boot_time(void);
74extern void maple_calibrate_decr(void); 74extern void maple_calibrate_decr(void);
75extern void maple_pci_init(void); 75extern void maple_pci_init(void);
76extern void maple_pcibios_fixup(void); 76extern void maple_pcibios_fixup(void);
diff --git a/arch/ppc64/kernel/maple_time.c b/arch/ppc64/kernel/maple_time.c
index d65210abcd03..cf5186335900 100644
--- a/arch/ppc64/kernel/maple_time.c
+++ b/arch/ppc64/kernel/maple_time.c
@@ -156,8 +156,9 @@ int maple_set_rtc_time(struct rtc_time *tm)
156 return 0; 156 return 0;
157} 157}
158 158
159void __init maple_get_boot_time(struct rtc_time *tm) 159unsigned long __init maple_get_boot_time(void)
160{ 160{
161 struct rtc_time tm;
161 struct device_node *rtcs; 162 struct device_node *rtcs;
162 163
163 rtcs = find_compatible_devices("rtc", "pnpPNP,b00"); 164 rtcs = find_compatible_devices("rtc", "pnpPNP,b00");
@@ -170,6 +171,8 @@ void __init maple_get_boot_time(struct rtc_time *tm)
170 "legacy address (0x%x)\n", maple_rtc_addr); 171 "legacy address (0x%x)\n", maple_rtc_addr);
171 } 172 }
172 173
173 maple_get_rtc_time(tm); 174 maple_get_rtc_time(&tm);
175 return mktime(time->tm_year+1900, time->tm_mon+1, time->tm_mday,
176 time->tm_hour, time->tm_min, time->tm_sec);
174} 177}
175 178
diff --git a/arch/ppc64/kernel/pmac.h b/arch/ppc64/kernel/pmac.h
index 40e1c5030f74..fa59f2a5c722 100644
--- a/arch/ppc64/kernel/pmac.h
+++ b/arch/ppc64/kernel/pmac.h
@@ -9,7 +9,7 @@
9 * pmac_* files. Mostly for use by pmac_setup 9 * pmac_* files. Mostly for use by pmac_setup
10 */ 10 */
11 11
12extern void pmac_get_boot_time(struct rtc_time *tm); 12extern unsigned long pmac_get_boot_time(void);
13extern void pmac_get_rtc_time(struct rtc_time *tm); 13extern void pmac_get_rtc_time(struct rtc_time *tm);
14extern int pmac_set_rtc_time(struct rtc_time *tm); 14extern int pmac_set_rtc_time(struct rtc_time *tm);
15extern void pmac_read_rtc_time(void); 15extern void pmac_read_rtc_time(void);
diff --git a/arch/ppc64/kernel/pmac_nvram.c b/arch/ppc64/kernel/pmac_nvram.c
index 11586d535f81..5fe9785ad7d8 100644
--- a/arch/ppc64/kernel/pmac_nvram.c
+++ b/arch/ppc64/kernel/pmac_nvram.c
@@ -341,7 +341,7 @@ static int amd_write_bank(int bank, u8* datas)
341} 341}
342 342
343 343
344static int core99_nvram_sync(void) 344static void core99_nvram_sync(void)
345{ 345{
346 struct core99_header* hdr99; 346 struct core99_header* hdr99;
347 unsigned long flags; 347 unsigned long flags;
@@ -369,8 +369,6 @@ static int core99_nvram_sync(void)
369 printk("nvram: Error writing bank %d\n", core99_bank); 369 printk("nvram: Error writing bank %d\n", core99_bank);
370 bail: 370 bail:
371 spin_unlock_irqrestore(&nv_lock, flags); 371 spin_unlock_irqrestore(&nv_lock, flags);
372
373 return 0;
374} 372}
375 373
376int __init pmac_nvram_init(void) 374int __init pmac_nvram_init(void)
diff --git a/arch/ppc64/kernel/pmac_time.c b/arch/ppc64/kernel/pmac_time.c
index 9d8c97decd32..c89bfefbbecd 100644
--- a/arch/ppc64/kernel/pmac_time.c
+++ b/arch/ppc64/kernel/pmac_time.c
@@ -21,6 +21,7 @@
21#include <linux/adb.h> 21#include <linux/adb.h>
22#include <linux/pmu.h> 22#include <linux/pmu.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/rtc.h>
24 25
25#include <asm/sections.h> 26#include <asm/sections.h>
26#include <asm/prom.h> 27#include <asm/prom.h>
@@ -135,23 +136,13 @@ int pmac_set_rtc_time(struct rtc_time *tm)
135 } 136 }
136} 137}
137 138
138void __init pmac_get_boot_time(struct rtc_time *tm) 139unsigned long __init pmac_get_boot_time(void)
139{ 140{
140 pmac_get_rtc_time(tm); 141 struct rtc_time tm;
141 142
142#ifdef disabled__CONFIG_NVRAM 143 pmac_get_rtc_time(&tm);
143 s32 delta = 0; 144 return mktime(tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday,
144 int dst; 145 tm.tm_hour, tm.tm_min, tm.tm_sec);
145
146 delta = ((s32)pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0x9)) << 16;
147 delta |= ((s32)pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0xa)) << 8;
148 delta |= pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0xb);
149 if (delta & 0x00800000UL)
150 delta |= 0xFF000000UL;
151 dst = ((pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0x8) & 0x80) != 0);
152 printk("GMT Delta read from XPRAM: %d minutes, DST: %s\n", delta/60,
153 dst ? "on" : "off");
154#endif
155} 146}
156 147
157/* 148/*
diff --git a/arch/ppc64/kernel/rtas-proc.c b/arch/ppc64/kernel/rtas-proc.c
index 1f3ff860fdf0..5bdd5b079d96 100644
--- a/arch/ppc64/kernel/rtas-proc.c
+++ b/arch/ppc64/kernel/rtas-proc.c
@@ -23,6 +23,7 @@
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/seq_file.h> 24#include <linux/seq_file.h>
25#include <linux/bitops.h> 25#include <linux/bitops.h>
26#include <linux/rtc.h>
26 27
27#include <asm/uaccess.h> 28#include <asm/uaccess.h>
28#include <asm/processor.h> 29#include <asm/processor.h>
diff --git a/arch/ppc64/kernel/rtc.c b/arch/ppc64/kernel/rtc.c
index 88ae13f81c46..79e7ed2858dd 100644
--- a/arch/ppc64/kernel/rtc.c
+++ b/arch/ppc64/kernel/rtc.c
@@ -265,7 +265,7 @@ static int rtc_read_proc(char *page, char **start, off_t off,
265#ifdef CONFIG_PPC_RTAS 265#ifdef CONFIG_PPC_RTAS
266#define MAX_RTC_WAIT 5000 /* 5 sec */ 266#define MAX_RTC_WAIT 5000 /* 5 sec */
267#define RTAS_CLOCK_BUSY (-2) 267#define RTAS_CLOCK_BUSY (-2)
268void rtas_get_boot_time(struct rtc_time *rtc_tm) 268unsigned long rtas_get_boot_time(void)
269{ 269{
270 int ret[8]; 270 int ret[8];
271 int error, wait_time; 271 int error, wait_time;
@@ -285,15 +285,10 @@ void rtas_get_boot_time(struct rtc_time *rtc_tm)
285 if (error != 0 && printk_ratelimit()) { 285 if (error != 0 && printk_ratelimit()) {
286 printk(KERN_WARNING "error: reading the clock failed (%d)\n", 286 printk(KERN_WARNING "error: reading the clock failed (%d)\n",
287 error); 287 error);
288 return; 288 return 0;
289 } 289 }
290 290
291 rtc_tm->tm_sec = ret[5]; 291 return mktime(ret[0], ret[1], ret[2], ret[3], ret[4], ret[5]);
292 rtc_tm->tm_min = ret[4];
293 rtc_tm->tm_hour = ret[3];
294 rtc_tm->tm_mday = ret[2];
295 rtc_tm->tm_mon = ret[1] - 1;
296 rtc_tm->tm_year = ret[0] - 1900;
297} 292}
298 293
299/* NOTE: get_rtc_time will get an error if executed in interrupt context 294/* NOTE: get_rtc_time will get an error if executed in interrupt context