[POWERPC] PS3: Move chip mask defs up

This just moves the definitions of the PS3 chip_mask routines up
above the irq setup routines.  This change is needed for the
kexec updates that follow.  Also adds some inline documentation
to the routines.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
This commit is contained in:
Geoff Levand 2007-06-16 07:19:18 +10:00 коммит произвёл Paul Mackerras
Родитель dc23fba706
Коммит 743c1bb074
1 изменённых файлов: 86 добавлений и 61 удалений

Просмотреть файл

@ -90,6 +90,92 @@ struct ps3_private {
static DEFINE_PER_CPU(struct ps3_private, ps3_private);
/**
* ps3_chip_mask - Set an interrupt mask bit in ps3_bmp.
* @virq: The assigned Linux virq.
*
* Sets ps3_bmp.mask and calls lv1_did_update_interrupt_mask().
*/
static void ps3_chip_mask(unsigned int virq)
{
struct ps3_private *pd = get_irq_chip_data(virq);
u64 bit = 0x8000000000000000UL >> virq;
u64 *p = &pd->bmp.mask;
u64 old;
unsigned long flags;
pr_debug("%s:%d: cpu %u, virq %d\n", __func__, __LINE__, pd->cpu, virq);
local_irq_save(flags);
asm volatile(
"1: ldarx %0,0,%3\n"
"andc %0,%0,%2\n"
"stdcx. %0,0,%3\n"
"bne- 1b"
: "=&r" (old), "+m" (*p)
: "r" (bit), "r" (p)
: "cc" );
lv1_did_update_interrupt_mask(pd->node, pd->cpu);
local_irq_restore(flags);
}
/**
* ps3_chip_unmask - Clear an interrupt mask bit in ps3_bmp.
* @virq: The assigned Linux virq.
*
* Clears ps3_bmp.mask and calls lv1_did_update_interrupt_mask().
*/
static void ps3_chip_unmask(unsigned int virq)
{
struct ps3_private *pd = get_irq_chip_data(virq);
u64 bit = 0x8000000000000000UL >> virq;
u64 *p = &pd->bmp.mask;
u64 old;
unsigned long flags;
pr_debug("%s:%d: cpu %u, virq %d\n", __func__, __LINE__, pd->cpu, virq);
local_irq_save(flags);
asm volatile(
"1: ldarx %0,0,%3\n"
"or %0,%0,%2\n"
"stdcx. %0,0,%3\n"
"bne- 1b"
: "=&r" (old), "+m" (*p)
: "r" (bit), "r" (p)
: "cc" );
lv1_did_update_interrupt_mask(pd->node, pd->cpu);
local_irq_restore(flags);
}
/**
* ps3_chip_eoi - HV end-of-interrupt.
* @virq: The assigned Linux virq.
*
* Calls lv1_end_of_interrupt_ext().
*/
static void ps3_chip_eoi(unsigned int virq)
{
const struct ps3_private *pd = get_irq_chip_data(virq);
lv1_end_of_interrupt_ext(pd->node, pd->cpu, virq);
}
/**
* ps3_irq_chip - Represents the ps3_bmp as a Linux struct irq_chip.
*/
static struct irq_chip ps3_irq_chip = {
.typename = "ps3",
.mask = ps3_chip_mask,
.unmask = ps3_chip_unmask,
.eoi = ps3_chip_eoi,
};
/**
* ps3_virq_setup - virq related setup.
* @cpu: enum ps3_cpu_binding indicating the cpu the interrupt should be
@ -565,67 +651,6 @@ static void __maybe_unused _dump_mask(struct ps3_private *pd,
static void dump_bmp(struct ps3_private* pd) {};
#endif /* defined(DEBUG) */
static void ps3_chip_mask(unsigned int virq)
{
struct ps3_private *pd = get_irq_chip_data(virq);
u64 bit = 0x8000000000000000UL >> virq;
u64 *p = &pd->bmp.mask;
u64 old;
unsigned long flags;
pr_debug("%s:%d: cpu %u, virq %d\n", __func__, __LINE__, pd->cpu, virq);
local_irq_save(flags);
asm volatile(
"1: ldarx %0,0,%3\n"
"andc %0,%0,%2\n"
"stdcx. %0,0,%3\n"
"bne- 1b"
: "=&r" (old), "+m" (*p)
: "r" (bit), "r" (p)
: "cc" );
lv1_did_update_interrupt_mask(pd->node, pd->cpu);
local_irq_restore(flags);
}
static void ps3_chip_unmask(unsigned int virq)
{
struct ps3_private *pd = get_irq_chip_data(virq);
u64 bit = 0x8000000000000000UL >> virq;
u64 *p = &pd->bmp.mask;
u64 old;
unsigned long flags;
pr_debug("%s:%d: cpu %u, virq %d\n", __func__, __LINE__, pd->cpu, virq);
local_irq_save(flags);
asm volatile(
"1: ldarx %0,0,%3\n"
"or %0,%0,%2\n"
"stdcx. %0,0,%3\n"
"bne- 1b"
: "=&r" (old), "+m" (*p)
: "r" (bit), "r" (p)
: "cc" );
lv1_did_update_interrupt_mask(pd->node, pd->cpu);
local_irq_restore(flags);
}
static void ps3_chip_eoi(unsigned int virq)
{
const struct ps3_private *pd = get_irq_chip_data(virq);
lv1_end_of_interrupt_ext(pd->node, pd->cpu, virq);
}
static struct irq_chip irq_chip = {
.typename = "ps3",
.mask = ps3_chip_mask,
.unmask = ps3_chip_unmask,
.eoi = ps3_chip_eoi,
};
static void ps3_host_unmap(struct irq_host *h, unsigned int virq)
{
set_irq_chip_data(virq, NULL);