2012-03-29 00:30:02 +07:00
|
|
|
/*
|
|
|
|
* Copyright IBM Corp. 1999, 2009
|
|
|
|
*
|
|
|
|
* Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ASM_CTL_REG_H
|
|
|
|
#define __ASM_CTL_REG_H
|
|
|
|
|
2012-05-23 21:24:51 +07:00
|
|
|
#ifdef CONFIG_64BIT
|
2012-03-29 00:30:02 +07:00
|
|
|
|
|
|
|
#define __ctl_load(array, low, high) ({ \
|
|
|
|
typedef struct { char _[sizeof(array)]; } addrtype; \
|
|
|
|
asm volatile( \
|
|
|
|
" lctlg %1,%2,%0\n" \
|
|
|
|
: : "Q" (*(addrtype *)(&array)), \
|
|
|
|
"i" (low), "i" (high)); \
|
|
|
|
})
|
|
|
|
|
|
|
|
#define __ctl_store(array, low, high) ({ \
|
|
|
|
typedef struct { char _[sizeof(array)]; } addrtype; \
|
|
|
|
asm volatile( \
|
|
|
|
" stctg %1,%2,%0\n" \
|
|
|
|
: "=Q" (*(addrtype *)(&array)) \
|
|
|
|
: "i" (low), "i" (high)); \
|
|
|
|
})
|
|
|
|
|
2012-05-23 21:24:51 +07:00
|
|
|
#else /* CONFIG_64BIT */
|
2012-03-29 00:30:02 +07:00
|
|
|
|
|
|
|
#define __ctl_load(array, low, high) ({ \
|
|
|
|
typedef struct { char _[sizeof(array)]; } addrtype; \
|
|
|
|
asm volatile( \
|
|
|
|
" lctl %1,%2,%0\n" \
|
|
|
|
: : "Q" (*(addrtype *)(&array)), \
|
|
|
|
"i" (low), "i" (high)); \
|
|
|
|
})
|
|
|
|
|
|
|
|
#define __ctl_store(array, low, high) ({ \
|
|
|
|
typedef struct { char _[sizeof(array)]; } addrtype; \
|
|
|
|
asm volatile( \
|
|
|
|
" stctl %1,%2,%0\n" \
|
|
|
|
: "=Q" (*(addrtype *)(&array)) \
|
|
|
|
: "i" (low), "i" (high)); \
|
|
|
|
})
|
|
|
|
|
2012-05-23 21:24:51 +07:00
|
|
|
#endif /* CONFIG_64BIT */
|
2012-03-29 00:30:02 +07:00
|
|
|
|
|
|
|
#define __ctl_set_bit(cr, bit) ({ \
|
|
|
|
unsigned long __dummy; \
|
|
|
|
__ctl_store(__dummy, cr, cr); \
|
|
|
|
__dummy |= 1UL << (bit); \
|
|
|
|
__ctl_load(__dummy, cr, cr); \
|
|
|
|
})
|
|
|
|
|
|
|
|
#define __ctl_clear_bit(cr, bit) ({ \
|
|
|
|
unsigned long __dummy; \
|
|
|
|
__ctl_store(__dummy, cr, cr); \
|
|
|
|
__dummy &= ~(1UL << (bit)); \
|
|
|
|
__ctl_load(__dummy, cr, cr); \
|
|
|
|
})
|
|
|
|
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
|
|
|
|
extern void smp_ctl_set_bit(int cr, int bit);
|
|
|
|
extern void smp_ctl_clear_bit(int cr, int bit);
|
|
|
|
#define ctl_set_bit(cr, bit) smp_ctl_set_bit(cr, bit)
|
|
|
|
#define ctl_clear_bit(cr, bit) smp_ctl_clear_bit(cr, bit)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define ctl_set_bit(cr, bit) __ctl_set_bit(cr, bit)
|
|
|
|
#define ctl_clear_bit(cr, bit) __ctl_clear_bit(cr, bit)
|
|
|
|
|
|
|
|
#endif /* CONFIG_SMP */
|
|
|
|
|
|
|
|
#endif /* __ASM_CTL_REG_H */
|