Skip to content

Commit

Permalink
[POWERPC] 4xx: Add dcri_clrset() for locked read/modify/write functio…
Browse files Browse the repository at this point in the history
…nality

This adds dcri_clrset() macro which does read/modify/write
on indirect dcr registers while holding indirect dcr lock.

Signed-off-by: Valentine Barshak <vbarshak@ru.mvista.com>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
  • Loading branch information
Valentine Barshak authored and Josh Boyer committed Mar 26, 2008
1 parent d0a48c9 commit 266d028
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions include/asm-powerpc/dcr-native.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,19 @@ static inline void __mtdcri(int base_addr, int base_data, int reg,
spin_unlock_irqrestore(&dcr_ind_lock, flags);
}

static inline void __dcri_clrset(int base_addr, int base_data, int reg,
unsigned clr, unsigned set)
{
unsigned long flags;
unsigned int val;

spin_lock_irqsave(&dcr_ind_lock, flags);
__mtdcr(base_addr, reg);
val = (__mfdcr(base_data) & ~clr) | set;
__mtdcr(base_data, val);
spin_unlock_irqrestore(&dcr_ind_lock, flags);
}

#define mfdcri(base, reg) __mfdcri(DCRN_ ## base ## _CONFIG_ADDR, \
DCRN_ ## base ## _CONFIG_DATA, \
reg)
Expand All @@ -90,6 +103,10 @@ static inline void __mtdcri(int base_addr, int base_data, int reg,
DCRN_ ## base ## _CONFIG_DATA, \
reg, data)

#define dcri_clrset(base, reg, clr, set) __dcri_clrset(DCRN_ ## base ## _CONFIG_ADDR, \
DCRN_ ## base ## _CONFIG_DATA, \
reg, clr, set)

#endif /* __ASSEMBLY__ */
#endif /* __KERNEL__ */
#endif /* _ASM_POWERPC_DCR_NATIVE_H */

0 comments on commit 266d028

Please sign in to comment.