aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/platforms/iseries/mf.c12
-rw-r--r--arch/powerpc/platforms/iseries/setup.c12
-rw-r--r--arch/powerpc/platforms/iseries/setup.h2
-rw-r--r--arch/powerpc/platforms/powermac/pmac.h7
-rw-r--r--arch/powerpc/platforms/powermac/setup.c2
-rw-r--r--arch/powerpc/platforms/powermac/time.c24
-rw-r--r--arch/powerpc/platforms/pseries/setup.c12
-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
-rw-r--r--include/asm-powerpc/machdep.h (renamed from include/asm-ppc64/machdep.h)121
-rw-r--r--include/asm-powerpc/rtas.h2
17 files changed, 176 insertions, 74 deletions
diff --git a/arch/powerpc/platforms/iseries/mf.c b/arch/powerpc/platforms/iseries/mf.c
index 3f25f7fc79fc..e5de31aa0015 100644
--- a/arch/powerpc/platforms/iseries/mf.c
+++ b/arch/powerpc/platforms/iseries/mf.c
@@ -32,6 +32,7 @@
32#include <linux/delay.h> 32#include <linux/delay.h>
33#include <linux/dma-mapping.h> 33#include <linux/dma-mapping.h>
34#include <linux/bcd.h> 34#include <linux/bcd.h>
35#include <linux/rtc.h>
35 36
36#include <asm/time.h> 37#include <asm/time.h>
37#include <asm/uaccess.h> 38#include <asm/uaccess.h>
@@ -1307,11 +1308,14 @@ int iSeries_set_rtc_time(struct rtc_time *tm)
1307 return 0; 1308 return 0;
1308} 1309}
1309 1310
1310void iSeries_get_boot_time(struct rtc_time *tm) 1311unsigned long iSeries_get_boot_time(void)
1311{ 1312{
1313 struct rtc_time tm;
1314
1312 if (piranha_simulator) 1315 if (piranha_simulator)
1313 return; 1316 return 0;
1314 1317
1315 mf_get_boot_rtc(tm); 1318 mf_get_boot_rtc(&tm);
1316 tm->tm_mon -= 1; 1319 return mktime(tm.tm_year + 1900, tm.tm_mon, tm.tm_mday,
1320 tm.tm_hour, tm.tm_min, tm.tm_sec);
1317} 1321}
diff --git a/arch/powerpc/platforms/iseries/setup.c b/arch/powerpc/platforms/iseries/setup.c
index 93852c2ee5de..41cd5b689545 100644
--- a/arch/powerpc/platforms/iseries/setup.c
+++ b/arch/powerpc/platforms/iseries/setup.c
@@ -73,8 +73,8 @@ extern void hvlog(char *fmt, ...);
73extern void ppcdbg_initialize(void); 73extern void ppcdbg_initialize(void);
74 74
75static void build_iSeries_Memory_Map(void); 75static void build_iSeries_Memory_Map(void);
76static int iseries_shared_idle(void); 76static void iseries_shared_idle(void);
77static int iseries_dedicated_idle(void); 77static void iseries_dedicated_idle(void);
78#ifdef CONFIG_PCI 78#ifdef CONFIG_PCI
79extern void iSeries_pci_final_fixup(void); 79extern void iSeries_pci_final_fixup(void);
80#else 80#else
@@ -693,7 +693,7 @@ static void yield_shared_processor(void)
693 process_iSeries_events(); 693 process_iSeries_events();
694} 694}
695 695
696static int iseries_shared_idle(void) 696static void iseries_shared_idle(void)
697{ 697{
698 while (1) { 698 while (1) {
699 while (!need_resched() && !hvlpevent_is_pending()) { 699 while (!need_resched() && !hvlpevent_is_pending()) {
@@ -715,11 +715,9 @@ static int iseries_shared_idle(void)
715 715
716 schedule(); 716 schedule();
717 } 717 }
718
719 return 0;
720} 718}
721 719
722static int iseries_dedicated_idle(void) 720static void iseries_dedicated_idle(void)
723{ 721{
724 long oldval; 722 long oldval;
725 723
@@ -749,8 +747,6 @@ static int iseries_dedicated_idle(void)
749 ppc64_runlatch_on(); 747 ppc64_runlatch_on();
750 schedule(); 748 schedule();
751 } 749 }
752
753 return 0;
754} 750}
755 751
756#ifndef CONFIG_PCI 752#ifndef CONFIG_PCI
diff --git a/arch/powerpc/platforms/iseries/setup.h b/arch/powerpc/platforms/iseries/setup.h
index 6da89ae991ce..5213044ec411 100644
--- a/arch/powerpc/platforms/iseries/setup.h
+++ b/arch/powerpc/platforms/iseries/setup.h
@@ -17,7 +17,7 @@
17#ifndef __ISERIES_SETUP_H__ 17#ifndef __ISERIES_SETUP_H__
18#define __ISERIES_SETUP_H__ 18#define __ISERIES_SETUP_H__
19 19
20extern void iSeries_get_boot_time(struct rtc_time *tm); 20extern unsigned long iSeries_get_boot_time(void);
21extern int iSeries_set_rtc_time(struct rtc_time *tm); 21extern int iSeries_set_rtc_time(struct rtc_time *tm);
22extern void iSeries_get_rtc_time(struct rtc_time *tm); 22extern void iSeries_get_rtc_time(struct rtc_time *tm);
23 23
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
13struct rtc_time;
14
13extern long pmac_time_init(void); 15extern long pmac_time_init(void);
14extern unsigned long pmac_get_rtc_time(void); 16extern unsigned long pmac_get_boot_time(void);
15extern int pmac_set_rtc_time(unsigned long nowtime); 17extern void pmac_get_rtc_time(struct rtc_time *);
18extern int pmac_set_rtc_time(struct rtc_time *);
16extern void pmac_read_rtc_time(void); 19extern void pmac_read_rtc_time(void);
17extern void pmac_calibrate_decr(void); 20extern void pmac_calibrate_decr(void);
18extern void pmac_pcibios_fixup(void); 21extern 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
80unsigned long 80unsigned long pmac_get_boot_time(void)
81pmac_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
121int 120void pmac_get_rtc_time(struct rtc_time *tm)
122pmac_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
130int 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:
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index eb25ee2eead8..0c84a44b43b4 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -84,8 +84,8 @@ int fwnmi_active; /* TRUE if an FWNMI handler is present */
84extern void pSeries_system_reset_exception(struct pt_regs *regs); 84extern void pSeries_system_reset_exception(struct pt_regs *regs);
85extern int pSeries_machine_check_exception(struct pt_regs *regs); 85extern int pSeries_machine_check_exception(struct pt_regs *regs);
86 86
87static int pseries_shared_idle(void); 87static void pseries_shared_idle(void);
88static int pseries_dedicated_idle(void); 88static void pseries_dedicated_idle(void);
89 89
90static volatile void __iomem * chrp_int_ack_special; 90static volatile void __iomem * chrp_int_ack_special;
91struct mpic *pSeries_mpic; 91struct mpic *pSeries_mpic;
@@ -488,8 +488,8 @@ static inline void dedicated_idle_sleep(unsigned int cpu)
488 } 488 }
489} 489}
490 490
491static int pseries_dedicated_idle(void) 491static void pseries_dedicated_idle(void)
492{ 492{
493 long oldval; 493 long oldval;
494 struct paca_struct *lpaca = get_paca(); 494 struct paca_struct *lpaca = get_paca();
495 unsigned int cpu = smp_processor_id(); 495 unsigned int cpu = smp_processor_id();
@@ -544,7 +544,7 @@ static int pseries_dedicated_idle(void)
544 } 544 }
545} 545}
546 546
547static int pseries_shared_idle(void) 547static void pseries_shared_idle(void)
548{ 548{
549 struct paca_struct *lpaca = get_paca(); 549 struct paca_struct *lpaca = get_paca();
550 unsigned int cpu = smp_processor_id(); 550 unsigned int cpu = smp_processor_id();
@@ -586,8 +586,6 @@ static int pseries_shared_idle(void)
586 if (cpu_is_offline(cpu) && system_state == SYSTEM_RUNNING) 586 if (cpu_is_offline(cpu) && system_state == SYSTEM_RUNNING)
587 cpu_die(); 587 cpu_die();
588 } 588 }
589
590 return 0;
591} 589}
592 590
593static int pSeries_pci_probe_mode(struct pci_bus *bus) 591static int pSeries_pci_probe_mode(struct pci_bus *bus)
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
diff --git a/include/asm-ppc64/machdep.h b/include/asm-powerpc/machdep.h
index d35d9d3e44cf..f060553b997a 100644
--- a/include/asm-ppc64/machdep.h
+++ b/include/asm-powerpc/machdep.h
@@ -1,6 +1,6 @@
1#ifdef __KERNEL__
2#ifndef _PPC64_MACHDEP_H 1#ifndef _PPC64_MACHDEP_H
3#define _PPC64_MACHDEP_H 2#define _PPC64_MACHDEP_H
3#ifdef __KERNEL__
4 4
5/* 5/*
6 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
@@ -16,6 +16,11 @@
16 16
17#include <asm/setup.h> 17#include <asm/setup.h>
18 18
19/* We export this macro for external modules like Alsa to know if
20 * ppc_md.feature_call is implemented or not
21 */
22#define CONFIG_PPC_HAS_FEATURE_CALLS
23
19struct pt_regs; 24struct pt_regs;
20struct pci_bus; 25struct pci_bus;
21struct device_node; 26struct device_node;
@@ -39,6 +44,7 @@ struct smp_ops_t {
39#endif 44#endif
40 45
41struct machdep_calls { 46struct machdep_calls {
47#ifdef CONFIG_PPC64
42 void (*hpte_invalidate)(unsigned long slot, 48 void (*hpte_invalidate)(unsigned long slot,
43 unsigned long va, 49 unsigned long va,
44 int large, 50 int large,
@@ -74,6 +80,7 @@ struct machdep_calls {
74 void (*iommu_dev_setup)(struct pci_dev *dev); 80 void (*iommu_dev_setup)(struct pci_dev *dev);
75 void (*iommu_bus_setup)(struct pci_bus *bus); 81 void (*iommu_bus_setup)(struct pci_bus *bus);
76 void (*irq_bus_setup)(struct pci_bus *bus); 82 void (*irq_bus_setup)(struct pci_bus *bus);
83#endif
77 84
78 int (*probe)(int platform); 85 int (*probe)(int platform);
79 void (*setup_arch)(void); 86 void (*setup_arch)(void);
@@ -86,6 +93,7 @@ struct machdep_calls {
86 void (*cpu_irq_down)(int secondary); 93 void (*cpu_irq_down)(int secondary);
87 94
88 /* PCI stuff */ 95 /* PCI stuff */
96 /* Called after scanning the bus, before allocating resources */
89 void (*pcibios_fixup)(void); 97 void (*pcibios_fixup)(void);
90 int (*pci_probe_mode)(struct pci_bus *); 98 int (*pci_probe_mode)(struct pci_bus *);
91 99
@@ -95,9 +103,13 @@ struct machdep_calls {
95 void (*panic)(char *str); 103 void (*panic)(char *str);
96 void (*cpu_die)(void); 104 void (*cpu_die)(void);
97 105
106 long (*time_init)(void); /* Optional, may be NULL */
107
98 int (*set_rtc_time)(struct rtc_time *); 108 int (*set_rtc_time)(struct rtc_time *);
99 void (*get_rtc_time)(struct rtc_time *); 109 void (*get_rtc_time)(struct rtc_time *);
100 void (*get_boot_time)(struct rtc_time *); 110 unsigned long (*get_boot_time)(void);
111 unsigned char (*rtc_read_val)(int addr);
112 void (*rtc_write_val)(int addr, unsigned char val);
101 113
102 void (*calibrate_decr)(void); 114 void (*calibrate_decr)(void);
103 115
@@ -109,7 +121,7 @@ struct machdep_calls {
109 ssize_t (*nvram_write)(char *buf, size_t count, loff_t *index); 121 ssize_t (*nvram_write)(char *buf, size_t count, loff_t *index);
110 ssize_t (*nvram_read)(char *buf, size_t count, loff_t *index); 122 ssize_t (*nvram_read)(char *buf, size_t count, loff_t *index);
111 ssize_t (*nvram_size)(void); 123 ssize_t (*nvram_size)(void);
112 int (*nvram_sync)(void); 124 void (*nvram_sync)(void);
113 125
114 /* Exception handlers */ 126 /* Exception handlers */
115 void (*system_reset_exception)(struct pt_regs *regs); 127 void (*system_reset_exception)(struct pt_regs *regs);
@@ -134,14 +146,100 @@ struct machdep_calls {
134 pgprot_t vma_prot); 146 pgprot_t vma_prot);
135 147
136 /* Idle loop for this platform, leave empty for default idle loop */ 148 /* Idle loop for this platform, leave empty for default idle loop */
137 int (*idle_loop)(void); 149 void (*idle_loop)(void);
138 150
139 /* Function to enable pmcs for this platform, called once per cpu. */ 151 /* Function to enable performance monitor counters for this
152 platform, called once per cpu. */
140 void (*enable_pmcs)(void); 153 void (*enable_pmcs)(void);
154
155#ifdef CONFIG_PPC32 /* XXX for now */
156 /* Optional, may be NULL. */
157 int (*show_cpuinfo)(struct seq_file *m);
158 int (*show_percpuinfo)(struct seq_file *m, int i);
159
160 /* A general init function, called by ppc_init in init/main.c.
161 May be NULL. */
162 void (*init)(void);
163
164 void (*idle)(void);
165 void (*power_save)(void);
166
167 void (*heartbeat)(void);
168 unsigned long heartbeat_reset;
169 unsigned long heartbeat_count;
170
171 unsigned long (*find_end_of_memory)(void);
172 void (*setup_io_mappings)(void);
173
174 void (*early_serial_map)(void);
175 void (*kgdb_map_scc)(void);
176
177 unsigned char (*nvram_read_val)(int addr);
178 void (*nvram_write_val)(int addr, unsigned char val);
179
180 /*
181 * optional PCI "hooks"
182 */
183
184 /* Called after PPC generic resource fixup to perform
185 machine specific fixups */
186 void (*pcibios_fixup_resources)(struct pci_dev *);
187
188 /* Called for each PCI bus in the system when it's probed */
189 void (*pcibios_fixup_bus)(struct pci_bus *);
190
191 /* Called when pci_enable_device() is called (initial=0) or
192 * when a device with no assigned resource is found (initial=1).
193 * Returns 0 to allow assignment/enabling of the device. */
194 int (*pcibios_enable_device_hook)(struct pci_dev *, int initial);
195
196 /* For interrupt routing */
197 unsigned char (*pci_swizzle)(struct pci_dev *, unsigned char *);
198 int (*pci_map_irq)(struct pci_dev *, unsigned char, unsigned char);
199
200 /* Called in indirect_* to avoid touching devices */
201 int (*pci_exclude_device)(unsigned char, unsigned char);
202
203 /* Called at then very end of pcibios_init() */
204 void (*pcibios_after_init)(void);
205
206 /* this is for modules, since _machine can be a define -- Cort */
207 int ppc_machine;
208
209#ifdef CONFIG_KEXEC
210 /* Called to shutdown machine specific hardware not already controlled
211 * by other drivers.
212 * XXX Should we move this one out of kexec scope?
213 */
214 void (*machine_shutdown)(void);
215
216 /* Called to do the minimal shutdown needed to run a kexec'd kernel
217 * to run successfully.
218 * XXX Should we move this one out of kexec scope?
219 */
220 void (*machine_crash_shutdown)(void);
221
222 /* Called to do what every setup is needed on image and the
223 * reboot code buffer. Returns 0 on success.
224 * Provide your own (maybe dummy) implementation if your platform
225 * claims to support kexec.
226 */
227 int (*machine_kexec_prepare)(struct kimage *image);
228
229 /* Called to handle any machine specific cleanup on image */
230 void (*machine_kexec_cleanup)(struct kimage *image);
231
232 /* Called to perform the _real_ kexec.
233 * Do NOT allocate memory or fail here. We are past the point of
234 * no return.
235 */
236 void (*machine_kexec)(struct kimage *image);
237#endif /* CONFIG_KEXEC */
238#endif /* CONFIG_PPC32 */
141}; 239};
142 240
143extern int default_idle(void); 241extern void default_idle(void);
144extern int native_idle(void); 242extern void native_idle(void);
145 243
146extern struct machdep_calls ppc_md; 244extern struct machdep_calls ppc_md;
147extern char cmd_line[COMMAND_LINE_SIZE]; 245extern char cmd_line[COMMAND_LINE_SIZE];
@@ -161,6 +259,13 @@ extern sys_ctrler_t sys_ctrler;
161 259
162#endif /* CONFIG_PPC_PMAC */ 260#endif /* CONFIG_PPC_PMAC */
163 261
262extern void setup_pci_ptrs(void);
263
264#ifdef CONFIG_SMP
265/* Poor default implementations */
266extern void __devinit smp_generic_give_timebase(void);
267extern void __devinit smp_generic_take_timebase(void);
268#endif /* CONFIG_SMP */
164 269
165 270
166/* Functions to produce codes on the leds. 271/* Functions to produce codes on the leds.
@@ -180,5 +285,5 @@ static inline void log_error(char *buf, unsigned int err_type, int fatal)
180 ppc_md.log_error(buf, err_type, fatal); 285 ppc_md.log_error(buf, err_type, fatal);
181} 286}
182 287
183#endif /* _PPC64_MACHDEP_H */
184#endif /* __KERNEL__ */ 288#endif /* __KERNEL__ */
289#endif /* _PPC64_MACHDEP_H */
diff --git a/include/asm-powerpc/rtas.h b/include/asm-powerpc/rtas.h
index 5c904d371963..2c050332471d 100644
--- a/include/asm-powerpc/rtas.h
+++ b/include/asm-powerpc/rtas.h
@@ -190,7 +190,7 @@ extern void rtas_progress(char *s, unsigned short hex);
190extern void rtas_initialize(void); 190extern void rtas_initialize(void);
191 191
192struct rtc_time; 192struct rtc_time;
193extern void rtas_get_boot_time(struct rtc_time *rtc_time); 193extern unsigned long rtas_get_boot_time(void);
194extern void rtas_get_rtc_time(struct rtc_time *rtc_time); 194extern void rtas_get_rtc_time(struct rtc_time *rtc_time);
195extern int rtas_set_rtc_time(struct rtc_time *rtc_time); 195extern int rtas_set_rtc_time(struct rtc_time *rtc_time);
196 196