Commit cab0af98 authored by Michael Ellerman's avatar Michael Ellerman

powerpc: Make set_dabr() a ppc_md function

Move pSeries specific code in set_dabr() into a ppc_md function, this will
allow us to keep plpar_wrappers.h private to platforms/pseries.
Signed-off-by: default avatarMichael Ellerman <michael@ellerman.id.au>
parent 60d4f4c6
...@@ -48,8 +48,8 @@ ...@@ -48,8 +48,8 @@
#include <asm/prom.h> #include <asm/prom.h>
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
#include <asm/firmware.h> #include <asm/firmware.h>
#include <asm/plpar_wrappers.h>
#include <asm/time.h> #include <asm/time.h>
#include <asm/machdep.h>
#endif #endif
extern unsigned long _get_SP(void); extern unsigned long _get_SP(void);
...@@ -201,27 +201,15 @@ int dump_spe(struct pt_regs *regs, elf_vrregset_t *evrregs) ...@@ -201,27 +201,15 @@ int dump_spe(struct pt_regs *regs, elf_vrregset_t *evrregs)
} }
#endif /* CONFIG_SPE */ #endif /* CONFIG_SPE */
static void set_dabr_spr(unsigned long val)
{
mtspr(SPRN_DABR, val);
}
int set_dabr(unsigned long dabr) int set_dabr(unsigned long dabr)
{ {
int ret = 0;
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
if (firmware_has_feature(FW_FEATURE_XDABR)) { if (ppc_md.set_dabr)
/* We want to catch accesses from kernel and userspace */ return ppc_md.set_dabr(dabr);
unsigned long flags = H_DABRX_KERNEL|H_DABRX_USER;
ret = plpar_set_xdabr(dabr, flags);
} else if (firmware_has_feature(FW_FEATURE_DABR)) {
ret = plpar_set_dabr(dabr);
} else
#endif #endif
set_dabr_spr(dabr);
return ret; mtspr(SPRN_DABR, dabr);
return 0;
} }
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
......
...@@ -350,6 +350,16 @@ static void pSeries_mach_cpu_die(void) ...@@ -350,6 +350,16 @@ static void pSeries_mach_cpu_die(void)
for(;;); for(;;);
} }
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);
}
/* /*
* Early initialization. Relocation is on but do not reference unbolted pages * Early initialization. Relocation is on but do not reference unbolted pages
...@@ -385,6 +395,8 @@ static void __init pSeries_init_early(void) ...@@ -385,6 +395,8 @@ static void __init pSeries_init_early(void)
DBG("Hello World !\n"); DBG("Hello World !\n");
} }
if (firmware_has_feature(FW_FEATURE_XDABR | FW_FEATURE_DABR))
ppc_md.set_dabr = pseries_set_dabr;
iommu_init_early_pSeries(); iommu_init_early_pSeries();
......
...@@ -80,6 +80,7 @@ struct machdep_calls { ...@@ -80,6 +80,7 @@ struct machdep_calls {
void (*iommu_dev_setup)(struct pci_dev *dev); void (*iommu_dev_setup)(struct pci_dev *dev);
void (*iommu_bus_setup)(struct pci_bus *bus); void (*iommu_bus_setup)(struct pci_bus *bus);
void (*irq_bus_setup)(struct pci_bus *bus); void (*irq_bus_setup)(struct pci_bus *bus);
int (*set_dabr)(unsigned long dabr);
#endif #endif
int (*probe)(int platform); int (*probe)(int platform);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment