Commit a20480b8 authored by Rask Ingemann Lambertsen's avatar Rask Ingemann Lambertsen Committed by James Bottomley

[PATCH] aha1740.c: Allow level triggered interrupts to be shared

Hi.

The patch below (against 2.6.0-test8) makes it possible to share the
interrupt when the aha1740 is configured for a level triggered interrupt.
It appears to work fine on my i486 EISA box with an AHA-1742A and an NE3200
Ethernet board sharing an irq. Comments, please.
parent f36d0268
...@@ -27,6 +27,9 @@ ...@@ -27,6 +27,9 @@
* Converted to EISA and generic DMA APIs by Marc Zyngier * Converted to EISA and generic DMA APIs by Marc Zyngier
* <maz@wild-wind.fr.eu.org>, 4/2003. * <maz@wild-wind.fr.eu.org>, 4/2003.
* *
* Shared interrupt support added by Rask Ingemann Lambertsen
* <rask@sygehus.dk>, 10/2003
*
* For the avoidance of doubt the "preferred form" of this code is one which * For the avoidance of doubt the "preferred form" of this code is one which
* is in an open non patent encumbered format. Where cryptographic key signing * is in an open non patent encumbered format. Where cryptographic key signing
* forms part of the process of creating an executable the information * forms part of the process of creating an executable the information
...@@ -518,15 +521,17 @@ static int aha1740_queuecommand(Scsi_Cmnd * SCpnt, void (*done)(Scsi_Cmnd *)) ...@@ -518,15 +521,17 @@ static int aha1740_queuecommand(Scsi_Cmnd * SCpnt, void (*done)(Scsi_Cmnd *))
return 0; return 0;
} }
/* Query the board for its irq_level. Nothing else matters /* Query the board for its irq_level and irq_type. Nothing else matters
in enhanced mode on an EISA bus. */ in enhanced mode on an EISA bus. */
static void aha1740_getconfig(unsigned int base, unsigned int *irq_level, static void aha1740_getconfig(unsigned int base, unsigned int *irq_level,
unsigned int *irq_type,
unsigned int *translation) unsigned int *translation)
{ {
static int intab[] = { 9, 10, 11, 12, 0, 14, 15, 0 }; static int intab[] = { 9, 10, 11, 12, 0, 14, 15, 0 };
*irq_level = intab[inb(INTDEF(base)) & 0x7]; *irq_level = intab[inb(INTDEF(base)) & 0x7];
*irq_type = (inb(INTDEF(base)) & 0x8) >> 3;
*translation = inb(RESV1(base)) & 0x1; *translation = inb(RESV1(base)) & 0x1;
outb(inb(INTDEF(base)) | 0x10, INTDEF(base)); outb(inb(INTDEF(base)) | 0x10, INTDEF(base));
} }
...@@ -583,7 +588,7 @@ static Scsi_Host_Template aha1740_template = { ...@@ -583,7 +588,7 @@ static Scsi_Host_Template aha1740_template = {
static int aha1740_probe (struct device *dev) static int aha1740_probe (struct device *dev)
{ {
int slotbase; int slotbase;
unsigned int irq_level, translation; unsigned int irq_level, irq_type, translation;
struct Scsi_Host *shpnt; struct Scsi_Host *shpnt;
struct aha1740_hostdata *host; struct aha1740_hostdata *host;
struct eisa_device *edev = to_eisa_device (dev); struct eisa_device *edev = to_eisa_device (dev);
...@@ -595,15 +600,15 @@ static int aha1740_probe (struct device *dev) ...@@ -595,15 +600,15 @@ static int aha1740_probe (struct device *dev)
return -EBUSY; return -EBUSY;
if (!aha1740_test_port(slotbase)) if (!aha1740_test_port(slotbase))
goto err_release_region; goto err_release_region;
aha1740_getconfig(slotbase,&irq_level,&translation); aha1740_getconfig(slotbase,&irq_level,&irq_type,&translation);
if ((inb(G2STAT(slotbase)) & if ((inb(G2STAT(slotbase)) &
(G2STAT_MBXOUT|G2STAT_BUSY)) != G2STAT_MBXOUT) { (G2STAT_MBXOUT|G2STAT_BUSY)) != G2STAT_MBXOUT) {
/* If the card isn't ready, hard reset it */ /* If the card isn't ready, hard reset it */
outb(G2CNTRL_HRST, G2CNTRL(slotbase)); outb(G2CNTRL_HRST, G2CNTRL(slotbase));
outb(0, G2CNTRL(slotbase)); outb(0, G2CNTRL(slotbase));
} }
printk(KERN_INFO "Configuring slot %d at IO:%x, IRQ %d\n", printk(KERN_INFO "Configuring slot %d at IO:%x, IRQ %u (%s)\n",
edev->slot, slotbase, irq_level); edev->slot, slotbase, irq_level, irq_type ? "edge" : "level");
printk(KERN_INFO "aha174x: Extended translation %sabled.\n", printk(KERN_INFO "aha174x: Extended translation %sabled.\n",
translation ? "en" : "dis"); translation ? "en" : "dis");
shpnt = scsi_host_alloc(&aha1740_template, shpnt = scsi_host_alloc(&aha1740_template,
...@@ -629,7 +634,8 @@ static int aha1740_probe (struct device *dev) ...@@ -629,7 +634,8 @@ static int aha1740_probe (struct device *dev)
} }
DEB(printk("aha1740_probe: enable interrupt channel %d\n",irq_level)); DEB(printk("aha1740_probe: enable interrupt channel %d\n",irq_level));
if (request_irq(irq_level,aha1740_intr_handle,0,"aha1740",shpnt)) { if (request_irq(irq_level,aha1740_intr_handle,irq_type ? 0 : SA_SHIRQ,
"aha1740",shpnt)) {
printk(KERN_ERR "aha1740_probe: Unable to allocate IRQ %d.\n", printk(KERN_ERR "aha1740_probe: Unable to allocate IRQ %d.\n",
irq_level); irq_level);
goto err_unmap; goto err_unmap;
......
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