git://ftp.safe.ca
/
safe
/
jmp
/
linux-2.6
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
topology: convert cpu notifier to return encapsulate errno value
[safe/jmp/linux-2.6]
/
drivers
/
scsi
/
fdomain.c
diff --git
a/drivers/scsi/fdomain.c
b/drivers/scsi/fdomain.c
index
0335688
..
e296bcc
100644
(file)
--- a/
drivers/scsi/fdomain.c
+++ b/
drivers/scsi/fdomain.c
@@
-3,7
+3,7
@@
* Revised: Mon Dec 28 21:59:02 1998 by faith@acm.org
* Author: Rickard E. Faith, faith@cs.unc.edu
* Copyright 1992-1996, 1998 Rickard E. Faith (faith@acm.org)
* Revised: Mon Dec 28 21:59:02 1998 by faith@acm.org
* Author: Rickard E. Faith, faith@cs.unc.edu
* Copyright 1992-1996, 1998 Rickard E. Faith (faith@acm.org)
- * Shared IRQ supported added 7/7/2001 Alan Cox <alan@
redhat.com
>
+ * Shared IRQ supported added 7/7/2001 Alan Cox <alan@
lxorguk.ukuu.org.uk
>
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@
-278,9
+278,10
@@
#include <linux/pci.h>
#include <linux/stat.h>
#include <linux/delay.h>
#include <linux/pci.h>
#include <linux/stat.h>
#include <linux/delay.h>
+#include <linux/io.h>
+#include <linux/slab.h>
#include <scsi/scsicam.h>
#include <scsi/scsicam.h>
-#include <asm/io.h>
#include <asm/system.h>
#include <scsi/scsi.h>
#include <asm/system.h>
#include <scsi/scsi.h>
@@
-290,9
+291,11
@@
#include <scsi/scsi_ioctl.h>
#include "fdomain.h"
#include <scsi/scsi_ioctl.h>
#include "fdomain.h"
+#ifndef PCMCIA
MODULE_AUTHOR("Rickard E. Faith");
MODULE_DESCRIPTION("Future domain SCSI driver");
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Rickard E. Faith");
MODULE_DESCRIPTION("Future domain SCSI driver");
MODULE_LICENSE("GPL");
+#endif
#define VERSION "$Revision: 5.51 $"
#define VERSION "$Revision: 5.51 $"
@@
-387,6
+390,9
@@
static void __iomem * bios_mem;
static int bios_major;
static int bios_minor;
static int PCI_bus;
static int bios_major;
static int bios_minor;
static int PCI_bus;
+#ifdef CONFIG_PCI
+static struct pci_dev *PCI_dev;
+#endif
static int Quantum; /* Quantum board variant */
static int interrupt_level;
static volatile int in_command;
static int Quantum; /* Quantum board variant */
static int interrupt_level;
static volatile int in_command;
@@
-403,13
+409,14
@@
static volatile int in_interrupt_flag;
static int FIFO_Size = 0x2000; /* 8k FIFO for
pre-tmc18c30 chips */
static int FIFO_Size = 0x2000; /* 8k FIFO for
pre-tmc18c30 chips */
-static irqreturn_t do_fdomain_16x0_intr( int irq, void *dev_id,
- struct pt_regs * regs );
+static irqreturn_t do_fdomain_16x0_intr( int irq, void *dev_id );
/* Allow insmod parameters to be like LILO parameters. For example:
insmod fdomain fdomain=0x140,11 */
static char * fdomain = NULL;
module_param(fdomain, charp, 0);
/* Allow insmod parameters to be like LILO parameters. For example:
insmod fdomain fdomain=0x140,11 */
static char * fdomain = NULL;
module_param(fdomain, charp, 0);
+#ifndef PCMCIA
+
static unsigned long addresses[] = {
0xc8000,
0xca000,
static unsigned long addresses[] = {
0xc8000,
0xca000,
@@
-426,6
+433,8
@@
static unsigned short ports[] = { 0x140, 0x150, 0x160, 0x170 };
static unsigned short ints[] = { 3, 5, 10, 11, 12, 14, 15, 0 };
static unsigned short ints[] = { 3, 5, 10, 11, 12, 14, 15, 0 };
+#endif /* !PCMCIA */
+
/*
READ THIS BEFORE YOU ADD A SIGNATURE!
/*
READ THIS BEFORE YOU ADD A SIGNATURE!
@@
-458,6
+467,8
@@
static unsigned short ints[] = { 3, 5, 10, 11, 12, 14, 15, 0 };
*/
*/
+#ifndef PCMCIA
+
static struct signature {
const char *signature;
int sig_offset;
static struct signature {
const char *signature;
int sig_offset;
@@
-503,6
+514,8
@@
static struct signature {
#define SIGNATURE_COUNT ARRAY_SIZE(signatures)
#define SIGNATURE_COUNT ARRAY_SIZE(signatures)
+#endif /* !PCMCIA */
+
static void print_banner( struct Scsi_Host *shpnt )
{
if (!shpnt) return; /* This won't ever happen */
static void print_banner( struct Scsi_Host *shpnt )
{
if (!shpnt) return; /* This won't ever happen */
@@
-633,6
+646,8
@@
static int fdomain_test_loopback( void )
return 0;
}
return 0;
}
+#ifndef PCMCIA
+
/* fdomain_get_irq assumes that we have a valid MCA ID for a
TMC-1660/TMC-1680 Future Domain board. Now, check to be sure the
bios_base matches these ports. If someone was unlucky enough to have
/* fdomain_get_irq assumes that we have a valid MCA ID for a
TMC-1660/TMC-1680 Future Domain board. Now, check to be sure the
bios_base matches these ports. If someone was unlucky enough to have
@@
-667,7
+682,6
@@
static int fdomain_get_irq( int base )
static int fdomain_isa_detect( int *irq, int *iobase )
{
static int fdomain_isa_detect( int *irq, int *iobase )
{
-#ifndef PCMCIA
int i, j;
int base = 0xdeadbeef;
int flag = 0;
int i, j;
int base = 0xdeadbeef;
int flag = 0;
@@
-786,11
+800,22
@@
found:
*iobase = base;
return 1; /* success */
*iobase = base;
return 1; /* success */
-#else
- return 0;
-#endif
}
}
+#else /* PCMCIA */
+
+static int fdomain_isa_detect( int *irq, int *iobase )
+{
+ if (irq)
+ *irq = 0;
+ if (iobase)
+ *iobase = 0;
+ return 0;
+}
+
+#endif /* !PCMCIA */
+
+
/* PCI detection function: int fdomain_pci_bios_detect(int* irq, int*
iobase) This function gets the Interrupt Level and I/O base address from
the PCI configuration registers. */
/* PCI detection function: int fdomain_pci_bios_detect(int* irq, int*
iobase) This function gets the Interrupt Level and I/O base address from
the PCI configuration registers. */
@@
-813,9
+838,10
@@
static int fdomain_pci_bios_detect( int *irq, int *iobase, struct pci_dev **ret_
PCI_DEVICE_ID_FD_36C70 );
#endif
PCI_DEVICE_ID_FD_36C70 );
#endif
- if ((pdev = pci_
find
_device(PCI_VENDOR_ID_FD, PCI_DEVICE_ID_FD_36C70, pdev)) == NULL)
+ if ((pdev = pci_
get
_device(PCI_VENDOR_ID_FD, PCI_DEVICE_ID_FD_36C70, pdev)) == NULL)
return 0;
return 0;
- if (pci_enable_device(pdev)) return 0;
+ if (pci_enable_device(pdev))
+ goto fail;
#if DEBUG_DETECT
printk( "scsi: <fdomain> TMC-3260 detect:"
#if DEBUG_DETECT
printk( "scsi: <fdomain> TMC-3260 detect:"
@@
-832,7
+858,7
@@
static int fdomain_pci_bios_detect( int *irq, int *iobase, struct pci_dev **ret_
pci_irq = pdev->irq;
if (!request_region( pci_base, 0x10, "fdomain" ))
pci_irq = pdev->irq;
if (!request_region( pci_base, 0x10, "fdomain" ))
-
return 0
;
+
goto fail
;
/* Now we have the I/O base address and interrupt from the PCI
configuration registers. */
/* Now we have the I/O base address and interrupt from the PCI
configuration registers. */
@@
-849,17
+875,22
@@
static int fdomain_pci_bios_detect( int *irq, int *iobase, struct pci_dev **ret_
if (!fdomain_is_valid_port(pci_base)) {
printk(KERN_ERR "scsi: <fdomain> PCI card detected, but driver not loaded (invalid port)\n" );
release_region(pci_base, 0x10);
if (!fdomain_is_valid_port(pci_base)) {
printk(KERN_ERR "scsi: <fdomain> PCI card detected, but driver not loaded (invalid port)\n" );
release_region(pci_base, 0x10);
-
return 0
;
+
goto fail
;
}
/* Fill in a few global variables. Ugh. */
bios_major = bios_minor = -1;
PCI_bus = 1;
}
/* Fill in a few global variables. Ugh. */
bios_major = bios_minor = -1;
PCI_bus = 1;
+ PCI_dev = pdev;
Quantum = 0;
bios_base = 0;
return 1;
Quantum = 0;
bios_base = 0;
return 1;
+fail:
+ pci_dev_put(pdev);
+ return 0;
}
}
+
#endif
struct Scsi_Host *__fdomain_16x0_detect(struct scsi_host_template *tpnt )
#endif
struct Scsi_Host *__fdomain_16x0_detect(struct scsi_host_template *tpnt )
@@
-910,8
+941,7
@@
struct Scsi_Host *__fdomain_16x0_detect(struct scsi_host_template *tpnt )
if (setup_called) {
printk(KERN_ERR "scsi: <fdomain> Bad LILO/INSMOD parameters?\n");
}
if (setup_called) {
printk(KERN_ERR "scsi: <fdomain> Bad LILO/INSMOD parameters?\n");
}
- release_region(port_base, 0x10);
- return NULL;
+ goto fail;
}
if (this_id) {
}
if (this_id) {
@@
-943,13
+973,12
@@
struct Scsi_Host *__fdomain_16x0_detect(struct scsi_host_template *tpnt )
/* Log IRQ with kernel */
if (!interrupt_level) {
printk(KERN_ERR "scsi: <fdomain> Card Detected, but driver not loaded (no IRQ)\n" );
/* Log IRQ with kernel */
if (!interrupt_level) {
printk(KERN_ERR "scsi: <fdomain> Card Detected, but driver not loaded (no IRQ)\n" );
- release_region(port_base, 0x10);
- return NULL;
+ goto fail;
} else {
/* Register the IRQ with the kernel */
retcode = request_irq( interrupt_level,
} else {
/* Register the IRQ with the kernel */
retcode = request_irq( interrupt_level,
- do_fdomain_16x0_intr, pdev?
SA_SHIRQ
:0, "fdomain", shpnt);
+ do_fdomain_16x0_intr, pdev?
IRQF_SHARED
:0, "fdomain", shpnt);
if (retcode < 0) {
if (retcode == -EINVAL) {
if (retcode < 0) {
if (retcode == -EINVAL) {
@@
-965,11
+994,14
@@
struct Scsi_Host *__fdomain_16x0_detect(struct scsi_host_template *tpnt )
printk(KERN_ERR " Send mail to faith@acm.org\n" );
}
printk(KERN_ERR "scsi: <fdomain> Detected, but driver not loaded (IRQ)\n" );
printk(KERN_ERR " Send mail to faith@acm.org\n" );
}
printk(KERN_ERR "scsi: <fdomain> Detected, but driver not loaded (IRQ)\n" );
- release_region(port_base, 0x10);
- return NULL;
+ goto fail;
}
}
return shpnt;
}
}
return shpnt;
+fail:
+ pci_dev_put(pdev);
+ release_region(port_base, 0x10);
+ return NULL;
}
static int fdomain_16x0_detect(struct scsi_host_template *tpnt)
}
static int fdomain_16x0_detect(struct scsi_host_template *tpnt)
@@
-1094,8
+1126,7
@@
static void my_done(int error)
#endif
}
#endif
}
-static irqreturn_t do_fdomain_16x0_intr(int irq, void *dev_id,
- struct pt_regs * regs )
+static irqreturn_t do_fdomain_16x0_intr(int irq, void *dev_id)
{
unsigned long flags;
int status;
{
unsigned long flags;
int status;
@@
-1293,7
+1324,7
@@
static irqreturn_t do_fdomain_16x0_intr(int irq, void *dev_id,
if (current_SC->SCp.buffers_residual) {
--current_SC->SCp.buffers_residual;
++current_SC->SCp.buffer;
if (current_SC->SCp.buffers_residual) {
--current_SC->SCp.buffers_residual;
++current_SC->SCp.buffer;
- current_SC->SCp.ptr =
page_address(current_SC->SCp.buffer->page) + current_SC->SCp.buffer->offset
;
+ current_SC->SCp.ptr =
sg_virt(current_SC->SCp.buffer)
;
current_SC->SCp.this_residual = current_SC->SCp.buffer->length;
} else
break;
current_SC->SCp.this_residual = current_SC->SCp.buffer->length;
} else
break;
@@
-1326,7
+1357,7
@@
static irqreturn_t do_fdomain_16x0_intr(int irq, void *dev_id,
&& current_SC->SCp.buffers_residual) {
--current_SC->SCp.buffers_residual;
++current_SC->SCp.buffer;
&& current_SC->SCp.buffers_residual) {
--current_SC->SCp.buffers_residual;
++current_SC->SCp.buffer;
- current_SC->SCp.ptr =
page_address(current_SC->SCp.buffer->page) + current_SC->SCp.buffer->offset
;
+ current_SC->SCp.ptr =
sg_virt(current_SC->SCp.buffer)
;
current_SC->SCp.this_residual = current_SC->SCp.buffer->length;
}
}
current_SC->SCp.this_residual = current_SC->SCp.buffer->length;
}
}
@@
-1339,16
+1370,15
@@
static irqreturn_t do_fdomain_16x0_intr(int irq, void *dev_id,
#if ERRORS_ONLY
if (current_SC->cmnd[0] == REQUEST_SENSE && !current_SC->SCp.Status) {
#if ERRORS_ONLY
if (current_SC->cmnd[0] == REQUEST_SENSE && !current_SC->SCp.Status) {
- if ((unsigned char)(*((char *)current_SC->request_buffer+2)) & 0x0f) {
+ char *buf = scsi_sglist(current_SC);
+ if ((unsigned char)(*(buf + 2)) & 0x0f) {
unsigned char key;
unsigned char code;
unsigned char qualifier;
unsigned char key;
unsigned char code;
unsigned char qualifier;
- key = (unsigned char)(*((char *)current_SC->request_buffer + 2))
- & 0x0f;
- code = (unsigned char)(*((char *)current_SC->request_buffer + 12));
- qualifier = (unsigned char)(*((char *)current_SC->request_buffer
- + 13));
+ key = (unsigned char)(*(buf + 2)) & 0x0f;
+ code = (unsigned char)(*(buf + 12));
+ qualifier = (unsigned char)(*(buf + 13));
if (key != UNIT_ATTENTION
&& !(key == NOT_READY
if (key != UNIT_ATTENTION
&& !(key == NOT_READY
@@
-1399,8
+1429,8
@@
static int fdomain_16x0_queue(struct scsi_cmnd *SCpnt,
printk( "queue: target = %d cmnd = 0x%02x pieces = %d size = %u\n",
SCpnt->target,
*(unsigned char *)SCpnt->cmnd,
printk( "queue: target = %d cmnd = 0x%02x pieces = %d size = %u\n",
SCpnt->target,
*(unsigned char *)SCpnt->cmnd,
-
SCpnt->use_sg
,
-
SCpnt->request_bufflen
);
+
scsi_sg_count(SCpnt)
,
+
scsi_bufflen(SCpnt)
);
#endif
fdomain_make_bus_idle();
#endif
fdomain_make_bus_idle();
@@
-1410,20
+1440,18
@@
static int fdomain_16x0_queue(struct scsi_cmnd *SCpnt,
/* Initialize static data */
/* Initialize static data */
- if (current_SC->use_sg) {
- current_SC->SCp.buffer =
- (struct scatterlist *)current_SC->request_buffer;
- current_SC->SCp.ptr = page_address(current_SC->SCp.buffer->page) + current_SC->SCp.buffer->offset;
- current_SC->SCp.this_residual = current_SC->SCp.buffer->length;
- current_SC->SCp.buffers_residual = current_SC->use_sg - 1;
+ if (scsi_sg_count(current_SC)) {
+ current_SC->SCp.buffer = scsi_sglist(current_SC);
+ current_SC->SCp.ptr = sg_virt(current_SC->SCp.buffer);
+ current_SC->SCp.this_residual = current_SC->SCp.buffer->length;
+ current_SC->SCp.buffers_residual = scsi_sg_count(current_SC) - 1;
} else {
} else {
-
current_SC->SCp.ptr = (char *)current_SC->request_buffer
;
-
current_SC->SCp.this_residual = current_SC->request_bufflen
;
- current_SC->SCp.buffer = NULL;
- current_SC->SCp.buffers_residual = 0;
+
current_SC->SCp.ptr = NULL
;
+
current_SC->SCp.this_residual = 0
;
+
current_SC->SCp.buffer = NULL;
+
current_SC->SCp.buffers_residual = 0;
}
}
-
-
+
current_SC->SCp.Status = 0;
current_SC->SCp.Message = 0;
current_SC->SCp.have_data_in = 0;
current_SC->SCp.Status = 0;
current_SC->SCp.Message = 0;
current_SC->SCp.have_data_in = 0;
@@
-1466,8
+1494,8
@@
static void print_info(struct scsi_cmnd *SCpnt)
SCpnt->SCp.phase,
SCpnt->device->id,
*(unsigned char *)SCpnt->cmnd,
SCpnt->SCp.phase,
SCpnt->device->id,
*(unsigned char *)SCpnt->cmnd,
-
SCpnt->use_sg
,
-
SCpnt->request_bufflen
);
+
scsi_sg_count(SCpnt)
,
+
scsi_bufflen(SCpnt)
);
printk( "sent_command = %d, have_data_in = %d, timeout = %d\n",
SCpnt->SCp.sent_command,
SCpnt->SCp.have_data_in,
printk( "sent_command = %d, have_data_in = %d, timeout = %d\n",
SCpnt->SCp.sent_command,
SCpnt->SCp.have_data_in,
@@
-1716,6
+1744,8
@@
static int fdomain_16x0_release(struct Scsi_Host *shpnt)
free_irq(shpnt->irq, shpnt);
if (shpnt->io_port && shpnt->n_io_port)
release_region(shpnt->io_port, shpnt->n_io_port);
free_irq(shpnt->irq, shpnt);
if (shpnt->io_port && shpnt->n_io_port)
release_region(shpnt->io_port, shpnt->n_io_port);
+ if (PCI_bus)
+ pci_dev_put(PCI_dev);
return 0;
}
return 0;
}
@@
-1738,6
+1768,16
@@
struct scsi_host_template fdomain_driver_template = {
};
#ifndef PCMCIA
};
#ifndef PCMCIA
+#ifdef CONFIG_PCI
+
+static struct pci_device_id fdomain_pci_tbl[] __devinitdata = {
+ { PCI_VENDOR_ID_FD, PCI_DEVICE_ID_FD_36C70,
+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
+ { }
+};
+MODULE_DEVICE_TABLE(pci, fdomain_pci_tbl);
+#endif
#define driver_template fdomain_driver_template
#include "scsi_module.c"
#define driver_template fdomain_driver_template
#include "scsi_module.c"
+
#endif
#endif