* [PATCH] [2/5] Improve 53c700 /proc/interrupt output
@ 2005-03-19 3:56 Matthew Wilcox
2005-03-19 15:53 ` James Bottomley
0 siblings, 1 reply; 4+ messages in thread
From: Matthew Wilcox @ 2005-03-19 3:56 UTC (permalink / raw)
To: James.Bottomley; +Cc: linux-scsi
Improve 53c700 /proc/interrupt output
Request the IRQ in the name of the chip rather than the bus address.
Signed-off-by: Matthew Wilcox <willy@parisc-linux.org>
diff -urpNX dontdiff linus-2.6/drivers/scsi/53c700.c parisc-2.6/drivers/scsi/53c700.c
--- linus-2.6/drivers/scsi/53c700.c 2005-03-18 06:21:10.744516094 -0700
+++ parisc-2.6/drivers/scsi/53c700.c 2005-03-18 06:02:57.000000000 -0700
@@ -304,6 +304,7 @@ NCR_700_detect(struct scsi_host_template
__u8 *memory;
__u32 *script;
struct Scsi_Host *host;
+ const char *chipname;
static int banner = 0;
int j;
@@ -408,15 +409,15 @@ NCR_700_detect(struct scsi_host_template
printk(KERN_NOTICE "53c700: Version " NCR_700_VERSION " By James.Bottomley@HansenPartnership.com\n");
banner = 1;
}
+ chipname = hostdata->chip710 ? "53c710" : \
+ (hostdata->fast ? "53c700-66" : "53c700");
printk(KERN_NOTICE "scsi%d: %s rev %d %s\n", host->host_no,
- hostdata->chip710 ? "53c710" :
- (hostdata->fast ? "53c700-66" : "53c700"),
- hostdata->rev, hostdata->differential ?
- "(Differential)" : "");
+ chipname, hostdata->rev,
+ hostdata->differential ? "(Differential)" : "");
/* reset the chip */
NCR_700_chip_reset(host);
- if (request_irq(irq, NCR_700_intr, SA_SHIRQ, dev->bus_id, host)) {
+ if (request_irq(irq, NCR_700_intr, SA_SHIRQ, chipname, host)) {
dev_printk(KERN_ERR, dev, "53c700: irq %lu request failed\n ",
irq);
goto out_put_host;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] [2/5] Improve 53c700 /proc/interrupt output
2005-03-19 3:56 [PATCH] [2/5] Improve 53c700 /proc/interrupt output Matthew Wilcox
@ 2005-03-19 15:53 ` James Bottomley
2005-03-19 16:23 ` Matthew Wilcox
0 siblings, 1 reply; 4+ messages in thread
From: James Bottomley @ 2005-03-19 15:53 UTC (permalink / raw)
To: Matthew Wilcox; +Cc: SCSI Mailing List
On Fri, 2005-03-18 at 20:56 -0700, Matthew Wilcox wrote:
> Improve 53c700 /proc/interrupt output
>
> Request the IRQ in the name of the chip rather than the bus address.
This I don't really like for two reasons:
1) I don't know of any other driver that uses the actual chip name in
the interrupt (most use either the driver name or the module name)
2) As someone with a large number of these things in a single box,
knowing which actual device is going up in /proc/interrupts is valuable
to me
How about I look at abstracting the name so that the glue driver (in
your case lasi700) can set the name?
James
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] [2/5] Improve 53c700 /proc/interrupt output
2005-03-19 15:53 ` James Bottomley
@ 2005-03-19 16:23 ` Matthew Wilcox
2005-03-21 2:56 ` James Bottomley
0 siblings, 1 reply; 4+ messages in thread
From: Matthew Wilcox @ 2005-03-19 16:23 UTC (permalink / raw)
To: James Bottomley; +Cc: Matthew Wilcox, SCSI Mailing List
On Sat, Mar 19, 2005 at 09:53:07AM -0600, James Bottomley wrote:
> On Fri, 2005-03-18 at 20:56 -0700, Matthew Wilcox wrote:
> > Request the IRQ in the name of the chip rather than the bus address.
>
> This I don't really like for two reasons:
>
> 1) I don't know of any other driver that uses the actual chip name in
> the interrupt (most use either the driver name or the module name)
I'm fine with that.
> 2) As someone with a large number of these things in a single box,
> knowing which actual device is going up in /proc/interrupts is valuable
> to me
You can get that information through /sys ...
# for i in /sys/class/scsi_host/*; do echo -n "`basename $i` "; irq=`cat $i/device/../irq`; grep $irq /proc/interrupts; done
host0 67: 11349 CPU zalon
host1 68: 15 CPU zalon
host2 16: 50 GSC-ASIC 53c710
> How about I look at abstracting the name so that the glue driver (in
> your case lasi700) can set the name?
That would work too ...
--
"Next the statesmen will invent cheap lies, putting the blame upon
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince
himself that the war is just, and will thank God for the better sleep
he enjoys after this process of grotesque self-deception." -- Mark Twain
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] [2/5] Improve 53c700 /proc/interrupt output
2005-03-19 16:23 ` Matthew Wilcox
@ 2005-03-21 2:56 ` James Bottomley
0 siblings, 0 replies; 4+ messages in thread
From: James Bottomley @ 2005-03-21 2:56 UTC (permalink / raw)
To: Matthew Wilcox; +Cc: Matthew Wilcox, SCSI Mailing List
On Sat, 2005-03-19 at 16:23 +0000, Matthew Wilcox wrote:
> On Sat, Mar 19, 2005 at 09:53:07AM -0600, James Bottomley wrote:
> > How about I look at abstracting the name so that the glue driver (in
> > your case lasi700) can set the name?
>
> That would work too ...
OK, how about the attached. It does what you want for lasi700 and what
I want for NCR_D700 (plus it's actually slightly more efficient for the
D700 interrupts).
James
===== drivers/scsi/53c700.c 1.63 vs edited =====
--- 1.63/drivers/scsi/53c700.c 2005-03-20 10:11:44 -06:00
+++ edited/drivers/scsi/53c700.c 2005-03-20 17:28:01 -06:00
@@ -296,8 +296,7 @@
struct Scsi_Host *
NCR_700_detect(struct scsi_host_template *tpnt,
- struct NCR_700_Host_Parameters *hostdata, struct device *dev,
- unsigned long irq, u8 scsi_id)
+ struct NCR_700_Host_Parameters *hostdata, struct device *dev)
{
dma_addr_t pScript, pSlots;
__u8 *memory;
@@ -393,8 +392,6 @@
host->unique_id = hostdata->base;
host->base = hostdata->base;
hostdata->eh_complete = NULL;
- host->irq = irq;
- host->this_id = scsi_id;
host->hostdata[0] = (unsigned long)hostdata;
/* kick the chip */
NCR_700_writeb(0xff, host, CTEST9_REG);
@@ -415,28 +412,16 @@
/* reset the chip */
NCR_700_chip_reset(host);
- if (request_irq(irq, NCR_700_intr, SA_SHIRQ, dev->bus_id, host)) {
- dev_printk(KERN_ERR, dev, "53c700: irq %lu request failed\n ",
- irq);
- goto out_put_host;
- }
-
if (scsi_add_host(host, dev)) {
dev_printk(KERN_ERR, dev, "53c700: scsi_add_host failed\n");
- goto out_release_irq;
+ scsi_host_put(host);
+ return NULL;
}
spi_signalling(host) = hostdata->differential ? SPI_SIGNAL_HVD :
SPI_SIGNAL_SE;
return host;
-
- out_release_irq:
- free_irq(irq, host);
- out_put_host:
- scsi_host_put(host);
-
- return NULL;
}
int
===== drivers/scsi/53c700.h 1.22 vs edited =====
--- 1.22/drivers/scsi/53c700.h 2005-03-20 10:11:44 -06:00
+++ edited/drivers/scsi/53c700.h 2005-03-20 17:28:01 -06:00
@@ -60,8 +60,7 @@
/* These are the externally used routines */
struct Scsi_Host *NCR_700_detect(struct scsi_host_template *,
- struct NCR_700_Host_Parameters *, struct device *,
- unsigned long, u8);
+ struct NCR_700_Host_Parameters *, struct device *);
int NCR_700_release(struct Scsi_Host *host);
irqreturn_t NCR_700_intr(int, void *, struct pt_regs *);
===== drivers/scsi/NCR_D700.c 1.23 vs edited =====
--- 1.23/drivers/scsi/NCR_D700.c 2005-02-26 18:04:25 -06:00
+++ edited/drivers/scsi/NCR_D700.c 2005-03-20 19:40:32 -06:00
@@ -97,6 +97,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mca.h>
+#include <linux/interrupt.h>
#include <asm/io.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_device.h>
@@ -168,11 +169,13 @@
struct NCR_D700_private {
struct device *dev;
struct Scsi_Host *hosts[2];
+ char name[30];
+ char pad;
};
static int
-NCR_D700_probe_one(struct NCR_D700_private *p, int siop,
- int irq, int slot, u32 region, int differential)
+NCR_D700_probe_one(struct NCR_D700_private *p, int siop, int irq,
+ int slot, u32 region, int differential)
{
struct NCR_700_Host_Parameters *hostdata;
struct Scsi_Host *host;
@@ -201,18 +204,18 @@
NCR_700_set_io_mapped(hostdata);
/* and register the siop */
- host = NCR_700_detect(&NCR_D700_driver_template, hostdata,
- p->dev, irq,
- /* FIXME: read this from SUS */
- id_array[slot * 2 + siop]);
+ host = NCR_700_detect(&NCR_D700_driver_template, hostdata, p->dev);
if (!host) {
ret = -ENOMEM;
goto detect_failed;
}
+ p->hosts[siop] = host;
+ /* FIXME: read this from SUS */
+ host->this_id = id_array[slot * 2 + siop];
+ host->irq = irq;
scsi_scan_host(host);
- p->hosts[siop] = host;
return 0;
detect_failed:
@@ -223,6 +226,20 @@
return ret;
}
+static int
+NCR_D700_intr(int irq, void *data, struct pt_regs *regs)
+{
+ struct NCR_D700_private *p = (struct NCR_D700_private *)data;
+ int i, found = 0;
+
+ for (i = 0; i < 2; i++)
+ if (p->hosts[i] &&
+ NCR_700_intr(irq, p->hosts[i], regs) == IRQ_HANDLED)
+ found++;
+
+ return found ? IRQ_HANDLED : IRQ_NONE;
+}
+
/* Detect a D700 card. Note, because of the setup --- the chips are
* essentially connectecd to the MCA bus independently, it is easier
* to set them up as two separate host adapters, rather than one
@@ -301,13 +318,19 @@
p = kmalloc(sizeof(*p), GFP_KERNEL);
if (!p)
return -ENOMEM;
+ memset(p, '\0', sizeof(*p));
p->dev = dev;
-
+ snprintf(p->name, sizeof(p->name), "D700(%s)", dev->bus_id);
+ if (request_irq(irq, NCR_D700_intr, SA_SHIRQ, p->name, p)) {
+ printk(KERN_ERR "D700: request_irq failed\n");
+ kfree(p);
+ return -EBUSY;
+ }
/* plumb in both 700 chips */
for (i = 0; i < 2; i++) {
int err;
- if ((err = NCR_D700_probe_one(p, i, irq, slot,
+ if ((err = NCR_D700_probe_one(p, i, slot, irq,
offset_addr + (0x80 * i),
differential)) != 0)
printk("D700: SIOP%d: probe failed, error = %d\n",
===== drivers/scsi/lasi700.c 1.24 vs edited =====
--- 1.24/drivers/scsi/lasi700.c 2005-03-18 07:03:01 -06:00
+++ edited/drivers/scsi/lasi700.c 2005-03-20 20:51:59 -06:00
@@ -127,16 +127,23 @@
NCR_700_set_mem_mapped(hostdata);
- host = NCR_700_detect(&lasi700_template, hostdata, &dev->dev,
- dev->irq, 7);
+ host = NCR_700_detect(&lasi700_template, hostdata, &dev->dev);
if (!host)
goto out_kfree;
+ host->this_id = 7;
+ host->irq = dev->irq;
+ if(request_irq(dev->irq, NCR_700_intr, SA_SHIRQ, "lasi700", host)) {
+ printk(KERN_ERR "lasi700: request_irq failed!\n");
+ goto out_put_host;
+ }
dev_set_drvdata(&dev->dev, host);
scsi_scan_host(host);
return 0;
+ out_put_host:
+ scsi_host_put(host);
out_kfree:
iounmap(hostdata->base);
kfree(hostdata);
===== drivers/scsi/sim710.c 1.26 vs edited =====
--- 1.26/drivers/scsi/sim710.c 2004-11-13 18:28:48 -06:00
+++ edited/drivers/scsi/sim710.c 2005-03-20 19:23:49 -06:00
@@ -127,16 +127,24 @@
NCR_700_set_io_mapped(hostdata);
/* and register the chip */
- if((host = NCR_700_detect(&sim710_driver_template, hostdata, dev, irq,
- scsi_id)) == NULL) {
+ if((host = NCR_700_detect(&sim710_driver_template, hostdata, dev))
+ == NULL) {
printk(KERN_ERR "sim710: No host detected; card configuration problem?\n");
goto out_release;
}
+ host->this_id = scsi_id;
+ host->irq = irq;
+ if (request_irq(irq, NCR_700_intr, SA_SHIRQ, "sim710", host)) {
+ printk(KERN_ERR "sim710: request_irq failed\n");
+ goto out_put_host;
+ }
scsi_scan_host(host);
return 0;
+ out_put_host:
+ scsi_host_put(host);
out_release:
release_region(host->base, 64);
out_free:
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-03-21 2:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-19 3:56 [PATCH] [2/5] Improve 53c700 /proc/interrupt output Matthew Wilcox
2005-03-19 15:53 ` James Bottomley
2005-03-19 16:23 ` Matthew Wilcox
2005-03-21 2:56 ` James Bottomley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox