Commit dc4f60c2 authored by Geoff Levand's avatar Geoff Levand Committed by Paul Mackerras

[POWERPC] PS3: Interrupt routine fixups.

Fixups for the ps3 interrupt routines to support all HV device
in a generic way.
Signed-off-by: default avatarGeoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 12828856
This diff is collapsed.
...@@ -110,7 +110,7 @@ static void __init ps3_smp_setup_cpu(int cpu) ...@@ -110,7 +110,7 @@ static void __init ps3_smp_setup_cpu(int cpu)
BUILD_BUG_ON(PPC_MSG_DEBUGGER_BREAK != 3); BUILD_BUG_ON(PPC_MSG_DEBUGGER_BREAK != 3);
for (i = 0; i < MSG_COUNT; i++) { for (i = 0; i < MSG_COUNT; i++) {
result = ps3_alloc_event_irq(cpu, &virqs[i]); result = ps3_event_receive_port_setup(cpu, &virqs[i]);
if (result) if (result)
continue; continue;
...@@ -134,11 +134,13 @@ void ps3_smp_cleanup_cpu(int cpu) ...@@ -134,11 +134,13 @@ void ps3_smp_cleanup_cpu(int cpu)
int i; int i;
DBG(" -> %s:%d: (%d)\n", __func__, __LINE__, cpu); DBG(" -> %s:%d: (%d)\n", __func__, __LINE__, cpu);
for (i = 0; i < MSG_COUNT; i++) { for (i = 0; i < MSG_COUNT; i++) {
ps3_free_event_irq(virqs[i]);
free_irq(virqs[i], (void*)(long)i); free_irq(virqs[i], (void*)(long)i);
ps3_event_receive_port_destroy(virqs[i]);
virqs[i] = NO_IRQ; virqs[i] = NO_IRQ;
} }
DBG(" <- %s:%d: (%d)\n", __func__, __LINE__, cpu); DBG(" <- %s:%d: (%d)\n", __func__, __LINE__, cpu);
} }
......
...@@ -230,19 +230,19 @@ static int __init setup_interrupts(struct spu *spu) ...@@ -230,19 +230,19 @@ static int __init setup_interrupts(struct spu *spu)
{ {
int result; int result;
result = ps3_alloc_spe_irq(PS3_BINDING_CPU_ANY, spu_pdata(spu)->spe_id, result = ps3_spe_irq_setup(PS3_BINDING_CPU_ANY, spu_pdata(spu)->spe_id,
0, &spu->irqs[0]); 0, &spu->irqs[0]);
if (result) if (result)
goto fail_alloc_0; goto fail_alloc_0;
result = ps3_alloc_spe_irq(PS3_BINDING_CPU_ANY, spu_pdata(spu)->spe_id, result = ps3_spe_irq_setup(PS3_BINDING_CPU_ANY, spu_pdata(spu)->spe_id,
1, &spu->irqs[1]); 1, &spu->irqs[1]);
if (result) if (result)
goto fail_alloc_1; goto fail_alloc_1;
result = ps3_alloc_spe_irq(PS3_BINDING_CPU_ANY, spu_pdata(spu)->spe_id, result = ps3_spe_irq_setup(PS3_BINDING_CPU_ANY, spu_pdata(spu)->spe_id,
2, &spu->irqs[2]); 2, &spu->irqs[2]);
if (result) if (result)
...@@ -251,9 +251,9 @@ static int __init setup_interrupts(struct spu *spu) ...@@ -251,9 +251,9 @@ static int __init setup_interrupts(struct spu *spu)
return result; return result;
fail_alloc_2: fail_alloc_2:
ps3_free_spe_irq(spu->irqs[1]); ps3_spe_irq_destroy(spu->irqs[1]);
fail_alloc_1: fail_alloc_1:
ps3_free_spe_irq(spu->irqs[0]); ps3_spe_irq_destroy(spu->irqs[0]);
fail_alloc_0: fail_alloc_0:
spu->irqs[0] = spu->irqs[1] = spu->irqs[2] = NO_IRQ; spu->irqs[0] = spu->irqs[1] = spu->irqs[2] = NO_IRQ;
return result; return result;
...@@ -301,9 +301,9 @@ static int ps3_destroy_spu(struct spu *spu) ...@@ -301,9 +301,9 @@ static int ps3_destroy_spu(struct spu *spu)
result = lv1_disable_logical_spe(spu_pdata(spu)->spe_id, 0); result = lv1_disable_logical_spe(spu_pdata(spu)->spe_id, 0);
BUG_ON(result); BUG_ON(result);
ps3_free_spe_irq(spu->irqs[2]); ps3_spe_irq_destroy(spu->irqs[2]);
ps3_free_spe_irq(spu->irqs[1]); ps3_spe_irq_destroy(spu->irqs[1]);
ps3_free_spe_irq(spu->irqs[0]); ps3_spe_irq_destroy(spu->irqs[0]);
spu->irqs[0] = spu->irqs[1] = spu->irqs[2] = NO_IRQ; spu->irqs[0] = spu->irqs[1] = spu->irqs[2] = NO_IRQ;
......
...@@ -886,12 +886,12 @@ static int ps3_vuart_probe(struct device *_dev) ...@@ -886,12 +886,12 @@ static int ps3_vuart_probe(struct device *_dev)
if (++vuart_bus_priv.use_count == 1) { if (++vuart_bus_priv.use_count == 1) {
result = ps3_alloc_vuart_irq(PS3_BINDING_CPU_ANY, result = ps3_vuart_irq_setup(PS3_BINDING_CPU_ANY,
(void*)&vuart_bus_priv.bmp.status, &vuart_bus_priv.virq); (void*)&vuart_bus_priv.bmp.status, &vuart_bus_priv.virq);
if (result) { if (result) {
dev_dbg(&dev->core, dev_dbg(&dev->core,
"%s:%d: ps3_alloc_vuart_irq failed (%d)\n", "%s:%d: ps3_vuart_irq_setup failed (%d)\n",
__func__, __LINE__, result); __func__, __LINE__, result);
result = -EPERM; result = -EPERM;
goto fail_alloc_irq; goto fail_alloc_irq;
...@@ -937,7 +937,7 @@ static int ps3_vuart_probe(struct device *_dev) ...@@ -937,7 +937,7 @@ static int ps3_vuart_probe(struct device *_dev)
fail_probe: fail_probe:
ps3_vuart_set_interrupt_mask(dev, 0); ps3_vuart_set_interrupt_mask(dev, 0);
fail_request_irq: fail_request_irq:
ps3_free_vuart_irq(vuart_bus_priv.virq); ps3_vuart_irq_destroy(vuart_bus_priv.virq);
vuart_bus_priv.virq = NO_IRQ; vuart_bus_priv.virq = NO_IRQ;
fail_alloc_irq: fail_alloc_irq:
--vuart_bus_priv.use_count; --vuart_bus_priv.use_count;
...@@ -975,7 +975,7 @@ static int ps3_vuart_remove(struct device *_dev) ...@@ -975,7 +975,7 @@ static int ps3_vuart_remove(struct device *_dev)
if (--vuart_bus_priv.use_count == 0) { if (--vuart_bus_priv.use_count == 0) {
BUG(); BUG();
free_irq(vuart_bus_priv.virq, &vuart_bus_priv); free_irq(vuart_bus_priv.virq, &vuart_bus_priv);
ps3_free_vuart_irq(vuart_bus_priv.virq); ps3_vuart_irq_destroy(vuart_bus_priv.virq);
vuart_bus_priv.virq = NO_IRQ; vuart_bus_priv.virq = NO_IRQ;
} }
......
...@@ -104,7 +104,7 @@ static int ps3_ehci_sb_probe(struct ps3_system_bus_device *dev) ...@@ -104,7 +104,7 @@ static int ps3_ehci_sb_probe(struct ps3_system_bus_device *dev)
dev_dbg(&dev->core, "%s:%d: mmio mapped_addr %lxh\n", __func__, dev_dbg(&dev->core, "%s:%d: mmio mapped_addr %lxh\n", __func__,
__LINE__, dev->m_region->lpar_addr); __LINE__, dev->m_region->lpar_addr);
result = ps3_alloc_io_irq(PS3_BINDING_CPU_ANY, dev->interrupt_id, &virq); result = ps3_io_irq_setup(PS3_BINDING_CPU_ANY, dev->interrupt_id, &virq);
if (result) { if (result) {
dev_dbg(&dev->core, "%s:%d: ps3_construct_io_irq(%d) failed.\n", dev_dbg(&dev->core, "%s:%d: ps3_construct_io_irq(%d) failed.\n",
...@@ -162,7 +162,7 @@ fail_add_hcd: ...@@ -162,7 +162,7 @@ fail_add_hcd:
fail_ioremap: fail_ioremap:
usb_put_hcd(hcd); usb_put_hcd(hcd);
fail_create_hcd: fail_create_hcd:
ps3_free_io_irq(virq); ps3_io_irq_destroy(virq);
fail_irq: fail_irq:
ps3_free_mmio_region(dev->m_region); ps3_free_mmio_region(dev->m_region);
fail_mmio: fail_mmio:
......
...@@ -107,7 +107,7 @@ static int ps3_ohci_sb_probe(struct ps3_system_bus_device *dev) ...@@ -107,7 +107,7 @@ static int ps3_ohci_sb_probe(struct ps3_system_bus_device *dev)
dev_dbg(&dev->core, "%s:%d: mmio mapped_addr %lxh\n", __func__, dev_dbg(&dev->core, "%s:%d: mmio mapped_addr %lxh\n", __func__,
__LINE__, dev->m_region->lpar_addr); __LINE__, dev->m_region->lpar_addr);
result = ps3_alloc_io_irq(PS3_BINDING_CPU_ANY, dev->interrupt_id, &virq); result = ps3_io_irq_setup(PS3_BINDING_CPU_ANY, dev->interrupt_id, &virq);
if (result) { if (result) {
dev_dbg(&dev->core, "%s:%d: ps3_construct_io_irq(%d) failed.\n", dev_dbg(&dev->core, "%s:%d: ps3_construct_io_irq(%d) failed.\n",
...@@ -165,7 +165,7 @@ fail_add_hcd: ...@@ -165,7 +165,7 @@ fail_add_hcd:
fail_ioremap: fail_ioremap:
usb_put_hcd(hcd); usb_put_hcd(hcd);
fail_create_hcd: fail_create_hcd:
ps3_free_io_irq(virq); ps3_io_irq_destroy(virq);
fail_irq: fail_irq:
ps3_free_mmio_region(dev->m_region); ps3_free_mmio_region(dev->m_region);
fail_mmio: fail_mmio:
......
...@@ -885,8 +885,8 @@ static int ps3fb_vsync_settings(struct gpu_driver_info *dinfo, void *dev) ...@@ -885,8 +885,8 @@ static int ps3fb_vsync_settings(struct gpu_driver_info *dinfo, void *dev)
} }
ps3fb.dev = dev; ps3fb.dev = dev;
error = ps3_alloc_irq(PS3_BINDING_CPU_ANY, dinfo->irq.irq_outlet, error = ps3_irq_plug_setup(PS3_BINDING_CPU_ANY, dinfo->irq.irq_outlet,
&ps3fb.irq_no); &ps3fb.irq_no);
if (error) { if (error) {
printk(KERN_ERR "%s: ps3_alloc_irq failed %d\n", __FUNCTION__, printk(KERN_ERR "%s: ps3_alloc_irq failed %d\n", __FUNCTION__,
error); error);
...@@ -898,7 +898,7 @@ static int ps3fb_vsync_settings(struct gpu_driver_info *dinfo, void *dev) ...@@ -898,7 +898,7 @@ static int ps3fb_vsync_settings(struct gpu_driver_info *dinfo, void *dev)
if (error) { if (error) {
printk(KERN_ERR "%s: request_irq failed %d\n", __FUNCTION__, printk(KERN_ERR "%s: request_irq failed %d\n", __FUNCTION__,
error); error);
ps3_free_irq(ps3fb.irq_no); ps3_irq_plug_destroy(ps3fb.irq_no);
return error; return error;
} }
...@@ -1059,7 +1059,7 @@ err_framebuffer_release: ...@@ -1059,7 +1059,7 @@ err_framebuffer_release:
framebuffer_release(info); framebuffer_release(info);
err_free_irq: err_free_irq:
free_irq(ps3fb.irq_no, ps3fb.dev); free_irq(ps3fb.irq_no, ps3fb.dev);
ps3_free_irq(ps3fb.irq_no); ps3_irq_plug_destroy(ps3fb.irq_no);
err_iounmap_dinfo: err_iounmap_dinfo:
iounmap((u8 __iomem *)ps3fb.dinfo); iounmap((u8 __iomem *)ps3fb.dinfo);
err_gpu_context_free: err_gpu_context_free:
...@@ -1075,7 +1075,7 @@ static void ps3fb_shutdown(struct platform_device *dev) ...@@ -1075,7 +1075,7 @@ static void ps3fb_shutdown(struct platform_device *dev)
ps3fb_flip_ctl(0); /* flip off */ ps3fb_flip_ctl(0); /* flip off */
ps3fb.dinfo->irq.mask = 0; ps3fb.dinfo->irq.mask = 0;
free_irq(ps3fb.irq_no, ps3fb.dev); free_irq(ps3fb.irq_no, ps3fb.dev);
ps3_free_irq(ps3fb.irq_no); ps3_irq_plug_destroy(ps3fb.irq_no);
iounmap((u8 __iomem *)ps3fb.dinfo); iounmap((u8 __iomem *)ps3fb.dinfo);
} }
...@@ -1085,7 +1085,7 @@ void ps3fb_cleanup(void) ...@@ -1085,7 +1085,7 @@ void ps3fb_cleanup(void)
if (ps3fb.irq_no) { if (ps3fb.irq_no) {
free_irq(ps3fb.irq_no, ps3fb.dev); free_irq(ps3fb.irq_no, ps3fb.dev);
ps3_free_irq(ps3fb.irq_no); ps3_irq_plug_destroy(ps3fb.irq_no);
} }
iounmap((u8 __iomem *)ps3fb.dinfo); iounmap((u8 __iomem *)ps3fb.dinfo);
......
...@@ -167,26 +167,31 @@ enum ps3_cpu_binding { ...@@ -167,26 +167,31 @@ enum ps3_cpu_binding {
PS3_BINDING_CPU_1 = 1, PS3_BINDING_CPU_1 = 1,
}; };
int ps3_alloc_io_irq(enum ps3_cpu_binding cpu, unsigned int interrupt_id, int ps3_virq_setup(enum ps3_cpu_binding cpu, unsigned long outlet,
unsigned int *virq); unsigned int *virq);
int ps3_free_io_irq(unsigned int virq); int ps3_virq_destroy(unsigned int virq);
int ps3_alloc_event_irq(enum ps3_cpu_binding cpu, unsigned int *virq); int ps3_irq_plug_setup(enum ps3_cpu_binding cpu, unsigned long outlet,
int ps3_free_event_irq(unsigned int virq); unsigned int *virq);
int ps3_irq_plug_destroy(unsigned int virq);
int ps3_event_receive_port_setup(enum ps3_cpu_binding cpu, unsigned int *virq);
int ps3_event_receive_port_destroy(unsigned int virq);
int ps3_send_event_locally(unsigned int virq); int ps3_send_event_locally(unsigned int virq);
int ps3_connect_event_irq(enum ps3_cpu_binding cpu,
const struct ps3_device_id *did, unsigned int interrupt_id, int ps3_io_irq_setup(enum ps3_cpu_binding cpu, unsigned int interrupt_id,
unsigned int *virq); unsigned int *virq);
int ps3_disconnect_event_irq(const struct ps3_device_id *did, int ps3_io_irq_destroy(unsigned int virq);
unsigned int interrupt_id, unsigned int virq); int ps3_vuart_irq_setup(enum ps3_cpu_binding cpu, void* virt_addr_bmp,
int ps3_alloc_vuart_irq(enum ps3_cpu_binding cpu, void* virt_addr_bmp,
unsigned int *virq); unsigned int *virq);
int ps3_free_vuart_irq(unsigned int virq); int ps3_vuart_irq_destroy(unsigned int virq);
int ps3_alloc_spe_irq(enum ps3_cpu_binding cpu, unsigned long spe_id, int ps3_spe_irq_setup(enum ps3_cpu_binding cpu, unsigned long spe_id,
unsigned int class, unsigned int *virq); unsigned int class, unsigned int *virq);
int ps3_free_spe_irq(unsigned int virq); int ps3_spe_irq_destroy(unsigned int virq);
int ps3_alloc_irq(enum ps3_cpu_binding cpu, unsigned long outlet,
int ps3_sb_event_receive_port_setup(enum ps3_cpu_binding cpu,
const struct ps3_device_id *did, unsigned int interrupt_id,
unsigned int *virq); unsigned int *virq);
int ps3_free_irq(unsigned int virq); int ps3_sb_event_receive_port_destroy(const struct ps3_device_id *did,
unsigned int interrupt_id, unsigned int virq);
/* lv1 result codes */ /* lv1 result codes */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment