Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 60571
b: refs/heads/master
c: 743c1bb
h: refs/heads/master
i:
  60569: 66c50f1
  60567: 9d047fa
v: v3
  • Loading branch information
Geoff Levand authored and Paul Mackerras committed Jun 28, 2007
1 parent 5d49591 commit af4a151
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 62 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: dc23fba7063867ed745cb6f0bd27a0dc5f558dbc
refs/heads/master: 743c1bb074c78cb467e42a18853c22e9cf1cd0ba
147 changes: 86 additions & 61 deletions trunk/arch/powerpc/platforms/ps3/interrupt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit af4a151

Please sign in to comment.