forked from luck/tmp_suning_uos_patched
[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>
This commit is contained in:
parent
2249ca9d60
commit
76032de898
@ -46,10 +46,10 @@
|
||||
#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;
|
||||
|
@ -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 */
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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. */
|
||||
|
Loading…
Reference in New Issue
Block a user