diff options
author | Geoff Levand <geoffrey.levand@am.sony.com> | 2007-06-15 17:19:18 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-06-28 05:16:36 -0400 |
commit | 743c1bb074c78cb467e42a18853c22e9cf1cd0ba (patch) | |
tree | 1e01e519b3f3a3779e83784e1a6dc92cf90fd045 /arch/powerpc/platforms/ps3 | |
parent | dc23fba7063867ed745cb6f0bd27a0dc5f558dbc (diff) |
[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>
Diffstat (limited to 'arch/powerpc/platforms/ps3')
-rw-r--r-- | arch/powerpc/platforms/ps3/interrupt.c | 147 |
1 files changed, 86 insertions, 61 deletions
diff --git a/arch/powerpc/platforms/ps3/interrupt.c b/arch/powerpc/platforms/ps3/interrupt.c index b050fc4cd883..c9fd4ed66e8f 100644 --- a/arch/powerpc/platforms/ps3/interrupt.c +++ b/arch/powerpc/platforms/ps3/interrupt.c | |||
@@ -91,6 +91,92 @@ struct ps3_private { | |||
91 | static DEFINE_PER_CPU(struct ps3_private, ps3_private); | 91 | static DEFINE_PER_CPU(struct ps3_private, ps3_private); |
92 | 92 | ||
93 | /** | 93 | /** |
94 | * ps3_chip_mask - Set an interrupt mask bit in ps3_bmp. | ||
95 | * @virq: The assigned Linux virq. | ||
96 | * | ||
97 | * Sets ps3_bmp.mask and calls lv1_did_update_interrupt_mask(). | ||
98 | */ | ||
99 | |||
100 | static void ps3_chip_mask(unsigned int virq) | ||
101 | { | ||
102 | struct ps3_private *pd = get_irq_chip_data(virq); | ||
103 | u64 bit = 0x8000000000000000UL >> virq; | ||
104 | u64 *p = &pd->bmp.mask; | ||
105 | u64 old; | ||
106 | unsigned long flags; | ||
107 | |||
108 | pr_debug("%s:%d: cpu %u, virq %d\n", __func__, __LINE__, pd->cpu, virq); | ||
109 | |||
110 | local_irq_save(flags); | ||
111 | asm volatile( | ||
112 | "1: ldarx %0,0,%3\n" | ||
113 | "andc %0,%0,%2\n" | ||
114 | "stdcx. %0,0,%3\n" | ||
115 | "bne- 1b" | ||
116 | : "=&r" (old), "+m" (*p) | ||
117 | : "r" (bit), "r" (p) | ||
118 | : "cc" ); | ||
119 | |||
120 | lv1_did_update_interrupt_mask(pd->node, pd->cpu); | ||
121 | local_irq_restore(flags); | ||
122 | } | ||
123 | |||
124 | /** | ||
125 | * ps3_chip_unmask - Clear an interrupt mask bit in ps3_bmp. | ||
126 | * @virq: The assigned Linux virq. | ||
127 | * | ||
128 | * Clears ps3_bmp.mask and calls lv1_did_update_interrupt_mask(). | ||
129 | */ | ||
130 | |||
131 | static void ps3_chip_unmask(unsigned int virq) | ||
132 | { | ||
133 | struct ps3_private *pd = get_irq_chip_data(virq); | ||
134 | u64 bit = 0x8000000000000000UL >> virq; | ||
135 | u64 *p = &pd->bmp.mask; | ||
136 | u64 old; | ||
137 | unsigned long flags; | ||
138 | |||
139 | pr_debug("%s:%d: cpu %u, virq %d\n", __func__, __LINE__, pd->cpu, virq); | ||
140 | |||
141 | local_irq_save(flags); | ||
142 | asm volatile( | ||
143 | "1: ldarx %0,0,%3\n" | ||
144 | "or %0,%0,%2\n" | ||
145 | "stdcx. %0,0,%3\n" | ||
146 | "bne- 1b" | ||
147 | : "=&r" (old), "+m" (*p) | ||
148 | : "r" (bit), "r" (p) | ||
149 | : "cc" ); | ||
150 | |||
151 | lv1_did_update_interrupt_mask(pd->node, pd->cpu); | ||
152 | local_irq_restore(flags); | ||
153 | } | ||
154 | |||
155 | /** | ||
156 | * ps3_chip_eoi - HV end-of-interrupt. | ||
157 | * @virq: The assigned Linux virq. | ||
158 | * | ||
159 | * Calls lv1_end_of_interrupt_ext(). | ||
160 | */ | ||
161 | |||
162 | static void ps3_chip_eoi(unsigned int virq) | ||
163 | { | ||
164 | const struct ps3_private *pd = get_irq_chip_data(virq); | ||
165 | lv1_end_of_interrupt_ext(pd->node, pd->cpu, virq); | ||
166 | } | ||
167 | |||
168 | /** | ||
169 | * ps3_irq_chip - Represents the ps3_bmp as a Linux struct irq_chip. | ||
170 | */ | ||
171 | |||
172 | static struct irq_chip ps3_irq_chip = { | ||
173 | .typename = "ps3", | ||
174 | .mask = ps3_chip_mask, | ||
175 | .unmask = ps3_chip_unmask, | ||
176 | .eoi = ps3_chip_eoi, | ||
177 | }; | ||
178 | |||
179 | /** | ||
94 | * ps3_virq_setup - virq related setup. | 180 | * ps3_virq_setup - virq related setup. |
95 | * @cpu: enum ps3_cpu_binding indicating the cpu the interrupt should be | 181 | * @cpu: enum ps3_cpu_binding indicating the cpu the interrupt should be |
96 | * serviced on. | 182 | * serviced on. |
@@ -565,67 +651,6 @@ static void __maybe_unused _dump_mask(struct ps3_private *pd, | |||
565 | static void dump_bmp(struct ps3_private* pd) {}; | 651 | static void dump_bmp(struct ps3_private* pd) {}; |
566 | #endif /* defined(DEBUG) */ | 652 | #endif /* defined(DEBUG) */ |
567 | 653 | ||
568 | static void ps3_chip_mask(unsigned int virq) | ||
569 | { | ||
570 | struct ps3_private *pd = get_irq_chip_data(virq); | ||
571 | u64 bit = 0x8000000000000000UL >> virq; | ||
572 | u64 *p = &pd->bmp.mask; | ||
573 | u64 old; | ||
574 | unsigned long flags; | ||
575 | |||
576 | pr_debug("%s:%d: cpu %u, virq %d\n", __func__, __LINE__, pd->cpu, virq); | ||
577 | |||
578 | local_irq_save(flags); | ||
579 | asm volatile( | ||
580 | "1: ldarx %0,0,%3\n" | ||
581 | "andc %0,%0,%2\n" | ||
582 | "stdcx. %0,0,%3\n" | ||
583 | "bne- 1b" | ||
584 | : "=&r" (old), "+m" (*p) | ||
585 | : "r" (bit), "r" (p) | ||
586 | : "cc" ); | ||
587 | |||
588 | lv1_did_update_interrupt_mask(pd->node, pd->cpu); | ||
589 | local_irq_restore(flags); | ||
590 | } | ||
591 | |||
592 | static void ps3_chip_unmask(unsigned int virq) | ||
593 | { | ||
594 | struct ps3_private *pd = get_irq_chip_data(virq); | ||
595 | u64 bit = 0x8000000000000000UL >> virq; | ||
596 | u64 *p = &pd->bmp.mask; | ||
597 | u64 old; | ||
598 | unsigned long flags; | ||
599 | |||
600 | pr_debug("%s:%d: cpu %u, virq %d\n", __func__, __LINE__, pd->cpu, virq); | ||
601 | |||
602 | local_irq_save(flags); | ||
603 | asm volatile( | ||
604 | "1: ldarx %0,0,%3\n" | ||
605 | "or %0,%0,%2\n" | ||
606 | "stdcx. %0,0,%3\n" | ||
607 | "bne- 1b" | ||
608 | : "=&r" (old), "+m" (*p) | ||
609 | : "r" (bit), "r" (p) | ||
610 | : "cc" ); | ||
611 | |||
612 | lv1_did_update_interrupt_mask(pd->node, pd->cpu); | ||
613 | local_irq_restore(flags); | ||
614 | } | ||
615 | |||
616 | static void ps3_chip_eoi(unsigned int virq) | ||
617 | { | ||
618 | const struct ps3_private *pd = get_irq_chip_data(virq); | ||
619 | lv1_end_of_interrupt_ext(pd->node, pd->cpu, virq); | ||
620 | } | ||
621 | |||
622 | static struct irq_chip irq_chip = { | ||
623 | .typename = "ps3", | ||
624 | .mask = ps3_chip_mask, | ||
625 | .unmask = ps3_chip_unmask, | ||
626 | .eoi = ps3_chip_eoi, | ||
627 | }; | ||
628 | |||
629 | static void ps3_host_unmap(struct irq_host *h, unsigned int virq) | 654 | static void ps3_host_unmap(struct irq_host *h, unsigned int virq) |
630 | { | 655 | { |
631 | set_irq_chip_data(virq, NULL); | 656 | set_irq_chip_data(virq, NULL); |