diff options
author | Paul Mackerras <paulus@samba.org> | 2005-11-04 00:17:32 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2005-11-04 00:17:32 -0500 |
commit | 292a6c58e9133b57d004d92a846fff326dd31e92 (patch) | |
tree | a267d1881a9a0bcb69938becd0c182874cd6c19c /arch/powerpc/platforms | |
parent | 8ad200d7b7c8fac77cf705831e90e889360d7030 (diff) | |
parent | dc3a9efb5ee89493a42c3365d219e339e4720c2b (diff) |
Merge branch 'for-paulus' of git://kernel/home/michael/src/work/
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r-- | arch/powerpc/platforms/pseries/iommu.c | 3 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/lpar.c | 13 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/plpar_wrappers.h | 120 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/setup.c | 15 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/smp.c | 3 |
5 files changed, 143 insertions, 11 deletions
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c index a73faafaac8c..513e27231493 100644 --- a/arch/powerpc/platforms/pseries/iommu.c +++ b/arch/powerpc/platforms/pseries/iommu.c | |||
@@ -42,13 +42,14 @@ | |||
42 | #include <asm/pci-bridge.h> | 42 | #include <asm/pci-bridge.h> |
43 | #include <asm/machdep.h> | 43 | #include <asm/machdep.h> |
44 | #include <asm/abs_addr.h> | 44 | #include <asm/abs_addr.h> |
45 | #include <asm/plpar_wrappers.h> | ||
46 | #include <asm/pSeries_reconfig.h> | 45 | #include <asm/pSeries_reconfig.h> |
47 | #include <asm/systemcfg.h> | 46 | #include <asm/systemcfg.h> |
48 | #include <asm/firmware.h> | 47 | #include <asm/firmware.h> |
49 | #include <asm/tce.h> | 48 | #include <asm/tce.h> |
50 | #include <asm/ppc-pci.h> | 49 | #include <asm/ppc-pci.h> |
51 | 50 | ||
51 | #include "plpar_wrappers.h" | ||
52 | |||
52 | #define DBG(fmt...) | 53 | #define DBG(fmt...) |
53 | 54 | ||
54 | extern int is_python(struct device_node *); | 55 | extern int is_python(struct device_node *); |
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c index 268d8362dde7..e384a5a91796 100644 --- a/arch/powerpc/platforms/pseries/lpar.c +++ b/arch/powerpc/platforms/pseries/lpar.c | |||
@@ -38,7 +38,8 @@ | |||
38 | #include <asm/prom.h> | 38 | #include <asm/prom.h> |
39 | #include <asm/abs_addr.h> | 39 | #include <asm/abs_addr.h> |
40 | #include <asm/cputable.h> | 40 | #include <asm/cputable.h> |
41 | #include <asm/plpar_wrappers.h> | 41 | |
42 | #include "plpar_wrappers.h" | ||
42 | 43 | ||
43 | #ifdef DEBUG | 44 | #ifdef DEBUG |
44 | #define DBG(fmt...) udbg_printf(fmt) | 45 | #define DBG(fmt...) udbg_printf(fmt) |
@@ -260,22 +261,18 @@ out: | |||
260 | void vpa_init(int cpu) | 261 | void vpa_init(int cpu) |
261 | { | 262 | { |
262 | int hwcpu = get_hard_smp_processor_id(cpu); | 263 | int hwcpu = get_hard_smp_processor_id(cpu); |
263 | unsigned long vpa = (unsigned long)&(paca[cpu].lppaca); | 264 | unsigned long vpa = __pa(&paca[cpu].lppaca); |
264 | long ret; | 265 | long ret; |
265 | unsigned long flags; | ||
266 | |||
267 | /* Register the Virtual Processor Area (VPA) */ | ||
268 | flags = 1UL << (63 - 18); | ||
269 | 266 | ||
270 | if (cpu_has_feature(CPU_FTR_ALTIVEC)) | 267 | if (cpu_has_feature(CPU_FTR_ALTIVEC)) |
271 | paca[cpu].lppaca.vmxregs_in_use = 1; | 268 | paca[cpu].lppaca.vmxregs_in_use = 1; |
272 | 269 | ||
273 | ret = register_vpa(flags, hwcpu, __pa(vpa)); | 270 | ret = register_vpa(hwcpu, vpa); |
274 | 271 | ||
275 | if (ret) | 272 | if (ret) |
276 | printk(KERN_ERR "WARNING: vpa_init: VPA registration for " | 273 | printk(KERN_ERR "WARNING: vpa_init: VPA registration for " |
277 | "cpu %d (hw %d) of area %lx returns %ld\n", | 274 | "cpu %d (hw %d) of area %lx returns %ld\n", |
278 | cpu, hwcpu, __pa(vpa), ret); | 275 | cpu, hwcpu, vpa, ret); |
279 | } | 276 | } |
280 | 277 | ||
281 | long pSeries_lpar_hpte_insert(unsigned long hpte_group, | 278 | long pSeries_lpar_hpte_insert(unsigned long hpte_group, |
diff --git a/arch/powerpc/platforms/pseries/plpar_wrappers.h b/arch/powerpc/platforms/pseries/plpar_wrappers.h new file mode 100644 index 000000000000..382f8c5b0e7c --- /dev/null +++ b/arch/powerpc/platforms/pseries/plpar_wrappers.h | |||
@@ -0,0 +1,120 @@ | |||
1 | #ifndef _PSERIES_PLPAR_WRAPPERS_H | ||
2 | #define _PSERIES_PLPAR_WRAPPERS_H | ||
3 | |||
4 | #include <asm/hvcall.h> | ||
5 | |||
6 | static inline long poll_pending(void) | ||
7 | { | ||
8 | unsigned long dummy; | ||
9 | return plpar_hcall(H_POLL_PENDING, 0, 0, 0, 0, &dummy, &dummy, &dummy); | ||
10 | } | ||
11 | |||
12 | static inline long prod_processor(void) | ||
13 | { | ||
14 | plpar_hcall_norets(H_PROD); | ||
15 | return 0; | ||
16 | } | ||
17 | |||
18 | static inline long cede_processor(void) | ||
19 | { | ||
20 | plpar_hcall_norets(H_CEDE); | ||
21 | return 0; | ||
22 | } | ||
23 | |||
24 | static inline long vpa_call(unsigned long flags, unsigned long cpu, | ||
25 | unsigned long vpa) | ||
26 | { | ||
27 | /* flags are in bits 16-18 (counting from most significant bit) */ | ||
28 | flags = flags << (63 - 18); | ||
29 | |||
30 | return plpar_hcall_norets(H_REGISTER_VPA, flags, cpu, vpa); | ||
31 | } | ||
32 | |||
33 | static inline long unregister_vpa(unsigned long cpu, unsigned long vpa) | ||
34 | { | ||
35 | return vpa_call(0x5, cpu, vpa); | ||
36 | } | ||
37 | |||
38 | static inline long register_vpa(unsigned long cpu, unsigned long vpa) | ||
39 | { | ||
40 | return vpa_call(0x1, cpu, vpa); | ||
41 | } | ||
42 | |||
43 | extern void vpa_init(int cpu); | ||
44 | |||
45 | static inline long plpar_pte_remove(unsigned long flags, unsigned long ptex, | ||
46 | unsigned long avpn, unsigned long *old_pteh_ret, | ||
47 | unsigned long *old_ptel_ret) | ||
48 | { | ||
49 | unsigned long dummy; | ||
50 | return plpar_hcall(H_REMOVE, flags, ptex, avpn, 0, old_pteh_ret, | ||
51 | old_ptel_ret, &dummy); | ||
52 | } | ||
53 | |||
54 | static inline long plpar_pte_read(unsigned long flags, unsigned long ptex, | ||
55 | unsigned long *old_pteh_ret, unsigned long *old_ptel_ret) | ||
56 | { | ||
57 | unsigned long dummy; | ||
58 | return plpar_hcall(H_READ, flags, ptex, 0, 0, old_pteh_ret, | ||
59 | old_ptel_ret, &dummy); | ||
60 | } | ||
61 | |||
62 | static inline long plpar_pte_protect(unsigned long flags, unsigned long ptex, | ||
63 | unsigned long avpn) | ||
64 | { | ||
65 | return plpar_hcall_norets(H_PROTECT, flags, ptex, avpn); | ||
66 | } | ||
67 | |||
68 | static inline long plpar_tce_get(unsigned long liobn, unsigned long ioba, | ||
69 | unsigned long *tce_ret) | ||
70 | { | ||
71 | unsigned long dummy; | ||
72 | return plpar_hcall(H_GET_TCE, liobn, ioba, 0, 0, tce_ret, &dummy, | ||
73 | &dummy); | ||
74 | } | ||
75 | |||
76 | static inline long plpar_tce_put(unsigned long liobn, unsigned long ioba, | ||
77 | unsigned long tceval) | ||
78 | { | ||
79 | return plpar_hcall_norets(H_PUT_TCE, liobn, ioba, tceval); | ||
80 | } | ||
81 | |||
82 | static inline long plpar_tce_put_indirect(unsigned long liobn, | ||
83 | unsigned long ioba, unsigned long page, unsigned long count) | ||
84 | { | ||
85 | return plpar_hcall_norets(H_PUT_TCE_INDIRECT, liobn, ioba, page, count); | ||
86 | } | ||
87 | |||
88 | static inline long plpar_tce_stuff(unsigned long liobn, unsigned long ioba, | ||
89 | unsigned long tceval, unsigned long count) | ||
90 | { | ||
91 | return plpar_hcall_norets(H_STUFF_TCE, liobn, ioba, tceval, count); | ||
92 | } | ||
93 | |||
94 | static inline long plpar_get_term_char(unsigned long termno, | ||
95 | unsigned long *len_ret, char *buf_ret) | ||
96 | { | ||
97 | unsigned long *lbuf = (unsigned long *)buf_ret; /* TODO: alignment? */ | ||
98 | return plpar_hcall(H_GET_TERM_CHAR, termno, 0, 0, 0, len_ret, | ||
99 | lbuf + 0, lbuf + 1); | ||
100 | } | ||
101 | |||
102 | static inline long plpar_put_term_char(unsigned long termno, unsigned long len, | ||
103 | const char *buffer) | ||
104 | { | ||
105 | unsigned long *lbuf = (unsigned long *)buffer; /* TODO: alignment? */ | ||
106 | return plpar_hcall_norets(H_PUT_TERM_CHAR, termno, len, lbuf[0], | ||
107 | lbuf[1]); | ||
108 | } | ||
109 | |||
110 | static inline long plpar_set_xdabr(unsigned long address, unsigned long flags) | ||
111 | { | ||
112 | return plpar_hcall_norets(H_SET_XDABR, address, flags); | ||
113 | } | ||
114 | |||
115 | static inline long plpar_set_dabr(unsigned long val) | ||
116 | { | ||
117 | return plpar_hcall_norets(H_SET_DABR, val); | ||
118 | } | ||
119 | |||
120 | #endif /* _PSERIES_PLPAR_WRAPPERS_H */ | ||
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index f73d69143d35..65bee939eecc 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c | |||
@@ -58,7 +58,6 @@ | |||
58 | #include <asm/irq.h> | 58 | #include <asm/irq.h> |
59 | #include <asm/time.h> | 59 | #include <asm/time.h> |
60 | #include <asm/nvram.h> | 60 | #include <asm/nvram.h> |
61 | #include <asm/plpar_wrappers.h> | ||
62 | #include "xics.h" | 61 | #include "xics.h" |
63 | #include <asm/firmware.h> | 62 | #include <asm/firmware.h> |
64 | #include <asm/pmc.h> | 63 | #include <asm/pmc.h> |
@@ -67,6 +66,8 @@ | |||
67 | #include <asm/i8259.h> | 66 | #include <asm/i8259.h> |
68 | #include <asm/udbg.h> | 67 | #include <asm/udbg.h> |
69 | 68 | ||
69 | #include "plpar_wrappers.h" | ||
70 | |||
70 | #ifdef DEBUG | 71 | #ifdef DEBUG |
71 | #define DBG(fmt...) udbg_printf(fmt) | 72 | #define DBG(fmt...) udbg_printf(fmt) |
72 | #else | 73 | #else |
@@ -350,6 +351,16 @@ static void pSeries_mach_cpu_die(void) | |||
350 | for(;;); | 351 | for(;;); |
351 | } | 352 | } |
352 | 353 | ||
354 | static int pseries_set_dabr(unsigned long dabr) | ||
355 | { | ||
356 | if (firmware_has_feature(FW_FEATURE_XDABR)) { | ||
357 | /* We want to catch accesses from kernel and userspace */ | ||
358 | return plpar_set_xdabr(dabr, H_DABRX_KERNEL | H_DABRX_USER); | ||
359 | } | ||
360 | |||
361 | return plpar_set_dabr(dabr); | ||
362 | } | ||
363 | |||
353 | 364 | ||
354 | /* | 365 | /* |
355 | * Early initialization. Relocation is on but do not reference unbolted pages | 366 | * Early initialization. Relocation is on but do not reference unbolted pages |
@@ -385,6 +396,8 @@ static void __init pSeries_init_early(void) | |||
385 | DBG("Hello World !\n"); | 396 | DBG("Hello World !\n"); |
386 | } | 397 | } |
387 | 398 | ||
399 | if (firmware_has_feature(FW_FEATURE_XDABR | FW_FEATURE_DABR)) | ||
400 | ppc_md.set_dabr = pseries_set_dabr; | ||
388 | 401 | ||
389 | iommu_init_early_pSeries(); | 402 | iommu_init_early_pSeries(); |
390 | 403 | ||
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c index 9c9458ddfc25..7a243e8ccd7e 100644 --- a/arch/powerpc/platforms/pseries/smp.c +++ b/arch/powerpc/platforms/pseries/smp.c | |||
@@ -44,10 +44,11 @@ | |||
44 | #include <asm/firmware.h> | 44 | #include <asm/firmware.h> |
45 | #include <asm/system.h> | 45 | #include <asm/system.h> |
46 | #include <asm/rtas.h> | 46 | #include <asm/rtas.h> |
47 | #include <asm/plpar_wrappers.h> | ||
48 | #include <asm/pSeries_reconfig.h> | 47 | #include <asm/pSeries_reconfig.h> |
49 | #include <asm/mpic.h> | 48 | #include <asm/mpic.h> |
50 | 49 | ||
50 | #include "plpar_wrappers.h" | ||
51 | |||
51 | #ifdef DEBUG | 52 | #ifdef DEBUG |
52 | #define DBG(fmt...) udbg_printf(fmt) | 53 | #define DBG(fmt...) udbg_printf(fmt) |
53 | #else | 54 | #else |