aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms
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/powerpc/platforms
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/powerpc/platforms')
-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
7 files changed, 42 insertions, 29 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)