aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Ellerman <michael@ellerman.id.au>2005-11-06 21:12:03 -0500
committerPaul Mackerras <paulus@samba.org>2005-11-06 21:31:13 -0500
commit76032de898f34db55b5048349db56557828a1390 (patch)
treedd92b9155c1b49b20c05b64a86742aeb73a537f8
parent2249ca9d60d3a8a1f6f223f0f0a0283fcb7ce33e (diff)
[PATCH] powerpc: Make ppc_md.set_dabr non 64-bit specific
Define ppc_md.set_dabr for both 32 + 64 bit. Cleanup the implementation for pSeries also, it was needlessly complex. Now we just do two firmware tests at setup time, and use one of two functions, rather than using one function and testing on every call. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r--arch/powerpc/kernel/process.c4
-rw-r--r--arch/powerpc/platforms/pseries/plpar_wrappers.h10
-rw-r--r--arch/powerpc/platforms/pseries/setup.c17
-rw-r--r--include/asm-powerpc/machdep.h4
4 files changed, 14 insertions, 21 deletions
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 96843211cc5c..29f6e875cf1c 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -46,10 +46,10 @@
46#include <asm/processor.h> 46#include <asm/processor.h>
47#include <asm/mmu.h> 47#include <asm/mmu.h>
48#include <asm/prom.h> 48#include <asm/prom.h>
49#include <asm/machdep.h>
49#ifdef CONFIG_PPC64 50#ifdef CONFIG_PPC64
50#include <asm/firmware.h> 51#include <asm/firmware.h>
51#include <asm/time.h> 52#include <asm/time.h>
52#include <asm/machdep.h>
53#endif 53#endif
54 54
55extern unsigned long _get_SP(void); 55extern unsigned long _get_SP(void);
@@ -203,10 +203,8 @@ int dump_spe(struct pt_regs *regs, elf_vrregset_t *evrregs)
203 203
204int set_dabr(unsigned long dabr) 204int set_dabr(unsigned long dabr)
205{ 205{
206#ifdef CONFIG_PPC64
207 if (ppc_md.set_dabr) 206 if (ppc_md.set_dabr)
208 return ppc_md.set_dabr(dabr); 207 return ppc_md.set_dabr(dabr);
209#endif
210 208
211 mtspr(SPRN_DABR, dabr); 209 mtspr(SPRN_DABR, dabr);
212 return 0; 210 return 0;
diff --git a/arch/powerpc/platforms/pseries/plpar_wrappers.h b/arch/powerpc/platforms/pseries/plpar_wrappers.h
index 382f8c5b0e7c..3bd1b3e06003 100644
--- a/arch/powerpc/platforms/pseries/plpar_wrappers.h
+++ b/arch/powerpc/platforms/pseries/plpar_wrappers.h
@@ -107,14 +107,4 @@ static inline long plpar_put_term_char(unsigned long termno, unsigned long len,
107 lbuf[1]); 107 lbuf[1]);
108} 108}
109 109
110static inline long plpar_set_xdabr(unsigned long address, unsigned long flags)
111{
112 return plpar_hcall_norets(H_SET_XDABR, address, flags);
113}
114
115static 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 */ 110#endif /* _PSERIES_PLPAR_WRAPPERS_H */
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 934d7006353f..e78c39368841 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -354,14 +354,15 @@ static void pSeries_mach_cpu_die(void)
354 354
355static int pseries_set_dabr(unsigned long dabr) 355static int pseries_set_dabr(unsigned long dabr)
356{ 356{
357 if (firmware_has_feature(FW_FEATURE_XDABR)) { 357 return plpar_hcall_norets(H_SET_DABR, dabr);
358 /* We want to catch accesses from kernel and userspace */
359 return plpar_set_xdabr(dabr, H_DABRX_KERNEL | H_DABRX_USER);
360 }
361
362 return plpar_set_dabr(dabr);
363} 358}
364 359
360static int pseries_set_xdabr(unsigned long dabr)
361{
362 /* We want to catch accesses from kernel and userspace */
363 return plpar_hcall_norets(H_SET_XDABR, dabr,
364 H_DABRX_KERNEL | H_DABRX_USER);
365}
365 366
366/* 367/*
367 * Early initialization. Relocation is on but do not reference unbolted pages 368 * Early initialization. Relocation is on but do not reference unbolted pages
@@ -397,8 +398,10 @@ static void __init pSeries_init_early(void)
397 DBG("Hello World !\n"); 398 DBG("Hello World !\n");
398 } 399 }
399 400
400 if (firmware_has_feature(FW_FEATURE_XDABR | FW_FEATURE_DABR)) 401 if (firmware_has_feature(FW_FEATURE_DABR))
401 ppc_md.set_dabr = pseries_set_dabr; 402 ppc_md.set_dabr = pseries_set_dabr;
403 else if (firmware_has_feature(FW_FEATURE_XDABR))
404 ppc_md.set_dabr = pseries_set_xdabr;
402 405
403 iommu_init_early_pSeries(); 406 iommu_init_early_pSeries();
404 407
diff --git a/include/asm-powerpc/machdep.h b/include/asm-powerpc/machdep.h
index 629ca964b974..b623bc4a1553 100644
--- a/include/asm-powerpc/machdep.h
+++ b/include/asm-powerpc/machdep.h
@@ -80,7 +80,6 @@ struct machdep_calls {
80 void (*iommu_dev_setup)(struct pci_dev *dev); 80 void (*iommu_dev_setup)(struct pci_dev *dev);
81 void (*iommu_bus_setup)(struct pci_bus *bus); 81 void (*iommu_bus_setup)(struct pci_bus *bus);
82 void (*irq_bus_setup)(struct pci_bus *bus); 82 void (*irq_bus_setup)(struct pci_bus *bus);
83 int (*set_dabr)(unsigned long dabr);
84#endif 83#endif
85 84
86 int (*probe)(int platform); 85 int (*probe)(int platform);
@@ -156,6 +155,9 @@ struct machdep_calls {
156 platform, called once per cpu. */ 155 platform, called once per cpu. */
157 void (*enable_pmcs)(void); 156 void (*enable_pmcs)(void);
158 157
158 /* Set DABR for this platform, leave empty for default implemenation */
159 int (*set_dabr)(unsigned long dabr);
160
159#ifdef CONFIG_PPC32 /* XXX for now */ 161#ifdef CONFIG_PPC32 /* XXX for now */
160 /* A general init function, called by ppc_init in init/main.c. 162 /* A general init function, called by ppc_init in init/main.c.
161 May be NULL. */ 163 May be NULL. */