]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] powerpc: Make ppc_md.set_dabr non 64-bit specific
authorMichael Ellerman <michael@ellerman.id.au>
Mon, 7 Nov 2005 02:12:03 +0000 (13:12 +1100)
committerPaul Mackerras <paulus@samba.org>
Mon, 7 Nov 2005 02:31:13 +0000 (13:31 +1100)
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>
arch/powerpc/kernel/process.c
arch/powerpc/platforms/pseries/plpar_wrappers.h
arch/powerpc/platforms/pseries/setup.c
include/asm-powerpc/machdep.h

index 96843211cc5c3187ff09fbe8c6690626f9792f93..29f6e875cf1c77b8020d05784a94f70feb7f975a 100644 (file)
 #include <asm/processor.h>
 #include <asm/mmu.h>
 #include <asm/prom.h>
+#include <asm/machdep.h>
 #ifdef CONFIG_PPC64
 #include <asm/firmware.h>
 #include <asm/time.h>
-#include <asm/machdep.h>
 #endif
 
 extern unsigned long _get_SP(void);
@@ -203,10 +203,8 @@ int dump_spe(struct pt_regs *regs, elf_vrregset_t *evrregs)
 
 int set_dabr(unsigned long dabr)
 {
-#ifdef CONFIG_PPC64
        if (ppc_md.set_dabr)
                return ppc_md.set_dabr(dabr);
-#endif
 
        mtspr(SPRN_DABR, dabr);
        return 0;
index 382f8c5b0e7c0978892cf5f9a873ab9754477a25..3bd1b3e0600362237c410bbb7f008a67ddd68862 100644 (file)
@@ -107,14 +107,4 @@ static inline long plpar_put_term_char(unsigned long termno, unsigned long len,
                        lbuf[1]);
 }
 
-static inline long plpar_set_xdabr(unsigned long address, unsigned long flags)
-{
-       return plpar_hcall_norets(H_SET_XDABR, address, flags);
-}
-
-static inline long plpar_set_dabr(unsigned long val)
-{
-       return plpar_hcall_norets(H_SET_DABR, val);
-}
-
 #endif /* _PSERIES_PLPAR_WRAPPERS_H */
index 934d7006353f19806b2577c8fc2b18cfc1c897ae..e78c39368841ba39251f3f6f219a987f2206a926 100644 (file)
@@ -354,14 +354,15 @@ static void pSeries_mach_cpu_die(void)
 
 static int pseries_set_dabr(unsigned long dabr)
 {
-       if (firmware_has_feature(FW_FEATURE_XDABR)) {
-               /* We want to catch accesses from kernel and userspace */
-               return plpar_set_xdabr(dabr, H_DABRX_KERNEL | H_DABRX_USER);
-       }
-
-       return plpar_set_dabr(dabr);
+       return plpar_hcall_norets(H_SET_DABR, dabr);
 }
 
+static int pseries_set_xdabr(unsigned long dabr)
+{
+       /* We want to catch accesses from kernel and userspace */
+       return plpar_hcall_norets(H_SET_XDABR, dabr,
+                       H_DABRX_KERNEL | H_DABRX_USER);
+}
 
 /*
  * Early initialization.  Relocation is on but do not reference unbolted pages
@@ -397,8 +398,10 @@ static void __init pSeries_init_early(void)
                DBG("Hello World !\n");
        }
 
-       if (firmware_has_feature(FW_FEATURE_XDABR | FW_FEATURE_DABR))
+       if (firmware_has_feature(FW_FEATURE_DABR))
                ppc_md.set_dabr = pseries_set_dabr;
+       else if (firmware_has_feature(FW_FEATURE_XDABR))
+               ppc_md.set_dabr = pseries_set_xdabr;
 
        iommu_init_early_pSeries();
 
index 629ca964b974740d8aac09eafd1f03efbf148b4a..b623bc4a15539c7ecf946a3a65995eb8891c3518 100644 (file)
@@ -80,7 +80,6 @@ struct machdep_calls {
        void            (*iommu_dev_setup)(struct pci_dev *dev);
        void            (*iommu_bus_setup)(struct pci_bus *bus);
        void            (*irq_bus_setup)(struct pci_bus *bus);
-       int             (*set_dabr)(unsigned long dabr);
 #endif
 
        int             (*probe)(int platform);
@@ -156,6 +155,9 @@ struct machdep_calls {
           platform, called once per cpu. */
        void            (*enable_pmcs)(void);
 
+       /* Set DABR for this platform, leave empty for default implemenation */
+       int             (*set_dabr)(unsigned long dabr);
+
 #ifdef CONFIG_PPC32    /* XXX for now */
        /* A general init function, called by ppc_init in init/main.c.
           May be NULL. */