Skip to content

Commit

Permalink
[PATCH] powerpc: Make ppc_md.set_dabr non 64-bit specific
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Michael Ellerman authored and Paul Mackerras committed Nov 7, 2005
1 parent 2249ca9 commit 76032de
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 21 deletions.
4 changes: 1 addition & 3 deletions arch/powerpc/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
10 changes: 0 additions & 10 deletions arch/powerpc/platforms/pseries/plpar_wrappers.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
17 changes: 10 additions & 7 deletions arch/powerpc/platforms/pseries/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();

Expand Down
4 changes: 3 additions & 1 deletion include/asm-powerpc/machdep.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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. */
Expand Down

0 comments on commit 76032de

Please sign in to comment.