Commit e72fc23c authored by James Bottomley's avatar James Bottomley

Merge raven.il.steeleye.com:/home/jejb/BK/scsi-misc-2.5

into raven.il.steeleye.com:/home/jejb/BK/scsi-for-linus-2.5
parents 5ac8451a c544afb9
### Version 2.00.3
Wed Jan 29 09:13:44 EST 200 - Atul Mukker <atulm@lsil.com>
i. Change the handshake in ISR while acknowledging interrupts. Write the
valid interrupt pattern 0x10001234 as soon as it is read from the
outdoor register. In existing driver and on certain platform, invalid
command ids were being returned.
Also, do not wait on status be become 0xFF, since FW can return this
status in certain circumstances.
Initialize the numstatus field of mailbox to 0xFF so that we can wait
on this wait in next interrupt. Firmware does not change its value
unless there are some status to be posted
ii. Specify the logical drive number while issuing the RESERVATION_STATUS
iii. Reduce the default mailbox busy wait time from 300us to 10us. This is
done to avaoid a possible deadlock in FW because of longer bust waits.
iv. The max outstanding commands are reduced to 126 because that't the
safest value on all FW.
v. Number of sectors per IO are reduced to 128 (64kb), becuase FW needs
resources in special circumstances like check consistency, rebuilds
etc.
vi. max_commands is no longer a module parameter because of iv.
### Version: 2.00.2
i. Intermediate release with kernel specific code
### Version: 2.00.1i
Wed Dec 4 14:34:51 EST 2002 - Atul Mukker <atulm@lsil.com>
i. Making the older IO based controllers to work with this driver
### Version 2.00.1
Fri Nov 15 10:59:44 EST 2002 - Atul Mukker <atulm@lsil.com>
i. Release host lock before issuing internal command to reset
reservations in megaraid_reset() and reacquire after internal command
is completed.
This diff is collapsed.
......@@ -226,10 +226,10 @@ static struct notifier_block tw_notifier = {
/* File operations struct for character device */
static struct file_operations tw_fops = {
owner: THIS_MODULE,
ioctl: tw_chrdev_ioctl,
open: tw_chrdev_open,
release: tw_chrdev_release
.owner = THIS_MODULE,
.ioctl = tw_chrdev_ioctl,
.open = tw_chrdev_open,
.release = tw_chrdev_release
};
/* Globals */
......
......@@ -133,6 +133,7 @@
#include <linux/blk.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/interrupt.h>
#include "scsi.h"
#include "hosts.h"
......@@ -1432,7 +1433,7 @@ NCR_700_start_command(Scsi_Cmnd *SCp)
return 1;
}
void
irqreturn_t
NCR_700_intr(int irq, void *dev_id, struct pt_regs *regs)
{
struct Scsi_Host *host = (struct Scsi_Host *)dev_id;
......@@ -1442,6 +1443,7 @@ NCR_700_intr(int irq, void *dev_id, struct pt_regs *regs)
__u32 resume_offset = 0;
__u8 pun = 0xff, lun = 0xff;
unsigned long flags;
irqreturn_t retval = IRQ_NONE;
/* Use the host lock to serialise acess to the 53c700
* hardware. Note: In future, we may need to take the queue
......@@ -1457,6 +1459,8 @@ NCR_700_intr(int irq, void *dev_id, struct pt_regs *regs)
Scsi_Cmnd *SCp = hostdata->cmd;
enum NCR_700_Host_State state;
retval = IRQ_HANDLED;
state = hostdata->state;
SCp = hostdata->cmd;
......@@ -1697,6 +1701,7 @@ NCR_700_intr(int irq, void *dev_id, struct pt_regs *regs)
}
out_unlock:
spin_unlock_irqrestore(host->host_lock, flags);
return retval;
}
/* FIXME: Need to put some proc information in and plumb it
......
......@@ -52,7 +52,7 @@ struct NCR_700_Host_Parameters;
/* These are the externally used routines */
struct Scsi_Host *NCR_700_detect(Scsi_Host_Template *, struct NCR_700_Host_Parameters *);
int NCR_700_release(struct Scsi_Host *host);
void NCR_700_intr(int, void *, struct pt_regs *);
irqreturn_t NCR_700_intr(int, void *, struct pt_regs *);
enum NCR_700_Host_State {
......
......@@ -1379,8 +1379,6 @@ static int aha152x_release(struct Scsi_Host *shpnt)
*/
static int setup_expected_interrupts(struct Scsi_Host *shpnt)
{
ASSERT_LOCK(&QLOCK,1);
if(CURRENT_SC) {
CURRENT_SC->SCp.phase |= 1 << 16;
......
......@@ -30,26 +30,26 @@
* to do with card config are filled in after the card is detected.
*/
#define AIC7XXX { \
proc_info: aic7xxx_proc_info, \
detect: aic7xxx_detect, \
release: aic7xxx_release, \
info: aic7xxx_info, \
queuecommand: aic7xxx_queue, \
slave_alloc: aic7xxx_slave_alloc, \
slave_configure: aic7xxx_slave_configure, \
slave_destroy: aic7xxx_slave_destroy, \
bios_param: aic7xxx_biosparam, \
eh_abort_handler: aic7xxx_abort, \
eh_device_reset_handler: aic7xxx_bus_device_reset, \
eh_host_reset_handler: aic7xxx_reset, \
can_queue: 255, /* max simultaneous cmds */\
this_id: -1, /* scsi id of host adapter */\
sg_tablesize: 0, /* max scatter-gather cmds */\
max_sectors: 2048, /* max physical sectors in 1 cmd */\
cmd_per_lun: 3, /* cmds per lun (linked cmds) */\
present: 0, /* number of 7xxx's present */\
unchecked_isa_dma: 0, /* no memory DMA restrictions */\
use_clustering: ENABLE_CLUSTERING, \
.proc_info = aic7xxx_proc_info, \
.detect = aic7xxx_detect, \
.release = aic7xxx_release, \
.info = aic7xxx_info, \
.queuecommand = aic7xxx_queue, \
.slave_alloc = aic7xxx_slave_alloc, \
.slave_configure = aic7xxx_slave_configure, \
.slave_destroy = aic7xxx_slave_destroy, \
.bios_param = aic7xxx_biosparam, \
.eh_abort_handler = aic7xxx_abort, \
.eh_device_reset_handler = aic7xxx_bus_device_reset, \
.eh_host_reset_handler = aic7xxx_reset, \
.can_queue = 255, /* max simultaneous cmds */\
.this_id = -1, /* scsi id of host adapter */\
.sg_tablesize = 0, /* max scatter-gather cmds */\
.max_sectors = 2048, /* max physical sectors in 1 cmd */\
.cmd_per_lun = 3, /* cmds per lun (linked cmds) */\
.present = 0, /* number of 7xxx's present */\
.unchecked_isa_dma = 0, /* no memory DMA restrictions */\
.use_clustering = ENABLE_CLUSTERING, \
}
extern int aic7xxx_queue(Scsi_Cmnd *, void (*)(Scsi_Cmnd *));
......
......@@ -747,9 +747,9 @@ MODULE_LICENSE("GPL");
#ifdef GDTH_IOCTL_CHRDEV
/* ioctl interface */
static struct file_operations gdth_fops = {
ioctl:gdth_ioctl,
open:gdth_open,
release:gdth_close,
.ioctl = gdth_ioctl,
.open = gdth_open,
.release = gdth_close,
};
#endif
......
This diff is collapsed.
This diff is collapsed.
......@@ -398,7 +398,7 @@ static Scsi_Host_Template *the_template = NULL;
#define ScsiResult(host_code, scsi_code) (((host_code) << 16) + ((scsi_code) & 0x7f))
static void ncr53c8xx_intr(int irq, void *dev_id, struct pt_regs * regs);
static irqreturn_t ncr53c8xx_intr(int irq, void *dev_id, struct pt_regs * regs);
static void ncr53c8xx_timeout(unsigned long np);
static int ncr53c8xx_proc_info(char *buffer, char **start, off_t offset,
int length, int hostno, int func);
......@@ -4883,7 +4883,7 @@ static int ncr_reset_bus (ncb_p np, Scsi_Cmnd *cmd, int sync_reset)
* Return immediately if reset is in progress.
*/
if (np->settle_time) {
return SCSI_RESET_PUNT;
return FAILED;
}
/*
* Start the reset process.
......@@ -4929,7 +4929,7 @@ static int ncr_reset_bus (ncb_p np, Scsi_Cmnd *cmd, int sync_reset)
ncr_queue_done_cmd(np, cmd);
}
return SCSI_RESET_SUCCESS;
return SUCCESS;
}
/*==========================================================
......@@ -8775,7 +8775,7 @@ printk("ncr53c8xx : command successfully queued\n");
** routine for each host that uses this IRQ.
*/
static void ncr53c8xx_intr(int irq, void *dev_id, struct pt_regs * regs)
static irqreturn_t ncr53c8xx_intr(int irq, void *dev_id, struct pt_regs * regs)
{
unsigned long flags;
ncb_p np = (ncb_p) dev_id;
......@@ -8800,6 +8800,7 @@ static void ncr53c8xx_intr(int irq, void *dev_id, struct pt_regs * regs)
ncr_flush_done_cmds(done_list);
NCR_UNLOCK_SCSI_DONE(done_list->device->host, flags);
}
return IRQ_HANDLED;
}
/*
......@@ -8829,59 +8830,24 @@ static void ncr53c8xx_timeout(unsigned long npref)
** Linux entry point of reset() function
*/
#if defined SCSI_RESET_SYNCHRONOUS && defined SCSI_RESET_ASYNCHRONOUS
int ncr53c8xx_reset(Scsi_Cmnd *cmd, unsigned int reset_flags)
#else
int ncr53c8xx_reset(Scsi_Cmnd *cmd)
#endif
int ncr53c8xx_bus_reset(Scsi_Cmnd *cmd)
{
ncb_p np = ((struct host_data *) cmd->device->host->hostdata)->ncb;
int sts;
unsigned long flags;
Scsi_Cmnd *done_list;
#if defined SCSI_RESET_SYNCHRONOUS && defined SCSI_RESET_ASYNCHRONOUS
printk("ncr53c8xx_reset: pid=%lu reset_flags=%x serial_number=%ld serial_number_at_timeout=%ld\n",
cmd->pid, reset_flags, cmd->serial_number, cmd->serial_number_at_timeout);
#else
printk("ncr53c8xx_reset: command pid %lu\n", cmd->pid);
#endif
NCR_LOCK_NCB(np, flags);
/*
* We have to just ignore reset requests in some situations.
*/
#if defined SCSI_RESET_NOT_RUNNING
if (cmd->serial_number != cmd->serial_number_at_timeout) {
sts = SCSI_RESET_NOT_RUNNING;
goto out;
}
#endif
/*
* If the mid-level driver told us reset is synchronous, it seems
* that we must call the done() callback for the involved command,
* even if this command was not queued to the low-level driver,
* before returning SCSI_RESET_SUCCESS.
* before returning SUCCESS.
*/
#if defined SCSI_RESET_SYNCHRONOUS && defined SCSI_RESET_ASYNCHRONOUS
sts = ncr_reset_bus(np, cmd,
(reset_flags & (SCSI_RESET_SYNCHRONOUS | SCSI_RESET_ASYNCHRONOUS)) == SCSI_RESET_SYNCHRONOUS);
#else
sts = ncr_reset_bus(np, cmd, 0);
#endif
/*
* Since we always reset the controller, when we return success,
* we add this information to the return code.
*/
#if defined SCSI_RESET_HOST_RESET
if (sts == SCSI_RESET_SUCCESS)
sts |= SCSI_RESET_HOST_RESET;
#endif
sts = ncr_reset_bus(np, cmd, 1);
out:
done_list = np->done_list;
np->done_list = 0;
NCR_UNLOCK_NCB(np, flags);
......@@ -9513,6 +9479,8 @@ Scsi_Host_Template driver_template = {
.release = zalon7xx_release,
.info = ncr53c8xx_info,
.queuecommand = ncr53c8xx_queue_command,
.slave_configure = ncr53c8xx_slave_configure,
.eh_bus_reset_handler = ncr53c8xx_bus_reset,
.can_queue = SCSI_NCR_CAN_QUEUE,
.this_id = 7,
.sg_tablesize = SCSI_NCR_SG_TABLESIZE,
......
......@@ -63,35 +63,19 @@ int ncr53c8xx_slave_configure(Scsi_Device *);
int ncr53c8xx_release(struct Scsi_Host *);
#if LINUX_VERSION_CODE >= LinuxVersionCode(2,1,75)
#define NCR53C8XX { .name = "ncr53c8xx", \
.detect = ncr53c8xx_detect, \
.release = ncr53c8xx_release, \
.info = ncr53c8xx_info, \
.queuecommand = ncr53c8xx_queue_command,\
.slave_configure = ncr53c8xx_slave_configure,\
.abort = ncr53c8xx_abort, \
.reset = ncr53c8xx_reset, \
.eh_bus_reset_handler = ncr53c8xx_bus_reset, \
.can_queue = SCSI_NCR_CAN_QUEUE, \
.this_id = 7, \
.sg_tablesize = SCSI_NCR_SG_TABLESIZE, \
.cmd_per_lun = SCSI_NCR_CMD_PER_LUN, \
.use_clustering = DISABLE_CLUSTERING}
#else
#define NCR53C8XX { NULL, NULL, NULL, NULL, \
NULL, ncr53c8xx_detect, \
ncr53c8xx_release, ncr53c8xx_info, NULL, \
ncr53c8xx_queue_command,ncr53c8xx_abort, \
ncr53c8xx_reset, NULL, scsicam_bios_param, \
SCSI_NCR_CAN_QUEUE, 7, \
SCSI_NCR_SG_TABLESIZE, SCSI_NCR_CMD_PER_LUN, \
0, 0, DISABLE_CLUSTERING}
#endif /* LINUX_VERSION_CODE */
#endif /* defined(HOSTS_C) || defined(MODULE) */
#endif /* NCR53C8XX_H */
......@@ -219,15 +219,12 @@ int ppa_detect(Scsi_Host_Template * host)
printk(" supported by the imm (ZIP Plus) driver. If the\n");
printk(" cable is marked with \"AutoDetect\", this is what has\n");
printk(" happened.\n");
spin_lock_irq(hreg->host_lock);
return 0;
}
try_again = 1;
goto retry_entry;
} else {
spin_lock_irq(hreg->host_lock);
} else
return 1; /* return number of hosts detected */
}
}
/* This is to give the ppa driver a way to modify the timings (and other
......
......@@ -54,7 +54,7 @@
#define DEB(x)
#endif
#define MAXBOARDS 2 /* Increase this and the sizes of the arrays below, if you need more. */
#define MAXBOARDS 6 /* Increase this and the sizes of the arrays below, if you need more. */
#define PORT_DATA 0
#define PORT_ERROR 1
......@@ -367,7 +367,7 @@ irqerror:;
SCpnt->result = DecodeError (shost, status);
SCpnt->scsi_done (SCpnt);
}
static void do_Irq_Handler (int irq, void *dev_id, struct pt_regs *regs)
static irqreturn_t do_Irq_Handler (int irq, void *dev_id, struct pt_regs *regs)
{
unsigned long flags;
struct Scsi_Host *dev = dev_id;
......@@ -375,6 +375,8 @@ static void do_Irq_Handler (int irq, void *dev_id, struct pt_regs *regs)
spin_lock_irqsave(dev->host_lock, flags);
Irq_Handler(irq, dev_id, regs);
spin_unlock_irqrestore(dev->host_lock, flags);
/* FIXME: we should check to see if this is true */
return IRQ_HANDLED;
}
/****************************************************************
* Name: Psi240i_QueueCommand
......@@ -390,8 +392,8 @@ static void do_Irq_Handler (int irq, void *dev_id, struct pt_regs *regs)
int Psi240i_QueueCommand (Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
{
UCHAR *cdb = (UCHAR *)SCpnt->cmnd; // Pointer to SCSI CDB
PADAPTER240I padapter = HOSTDATA(SCpnt->host); // Pointer to adapter control structure
POUR_DEVICE pdev = &padapter->device[SCpnt->target];// Pointer to device information
PADAPTER240I padapter = HOSTDATA (SCpnt->device->host); // Pointer to adapter control structure
POUR_DEVICE pdev = &padapter->device [SCpnt->device->id];// Pointer to device information
UCHAR rc; // command return code
SCpnt->scsi_done = done;
......@@ -566,25 +568,25 @@ int Psi240i_Detect (Scsi_Host_Template *tpnt)
int count = 0;
int unit;
int z;
USHORT port;
USHORT port, port_range = 16;
CHIP_CONFIG_N chipConfig;
CHIP_DEVICE_N chipDevice[8];
struct Scsi_Host *pshost;
ULONG flags;
for ( board = 0; board < 6; board++ ) // scan for I/O ports
for ( board = 0; board < MAXBOARDS; board++ ) // scan for I/O ports
{
pshost = NULL;
port = portAddr[board]; // get base address to test
if ( check_region (port, 16) ) // test for I/O addresses available
continue; // nope
if ( inb_p (port + REG_FAIL) != CHIP_ID ) // do the first test for likley hood that it is us
if ( !request_region (port, port_range, "psi240i") )
continue;
if ( inb_p (port + REG_FAIL) != CHIP_ID ) // do the first test for likley hood that it is us
goto host_init_failure;
outb_p (SEL_NONE, port + REG_SEL_FAIL); // setup EEPROM/RAM access
outw (0, port + REG_ADDRESS); // setup EEPROM address zero
if ( inb_p (port) != 0x55 ) // test 1st byte
continue; // nope
goto host_init_failure; // nope
if ( inb_p (port + 1) != 0xAA ) // test 2nd byte
continue; // nope
goto host_init_failure; // nope
// at this point our board is found and can be accessed. Now we need to initialize
// our informatation and register with the kernel.
......@@ -595,20 +597,11 @@ int Psi240i_Detect (Scsi_Host_Template *tpnt)
ReadChipMemory (&ChipSetup, CHIP_EEPROM_DATA, sizeof (ChipSetup), port);
if ( !chipConfig.numDrives ) // if no devices on this board
continue;
goto host_init_failure;
pshost = scsi_register (tpnt, sizeof(ADAPTER240I));
if(pshost == NULL)
continue;
save_flags (flags);
cli ();
if ( request_irq (chipConfig.irq, do_Irq_Handler, 0, "psi240i", pshost) )
{
printk ("Unable to allocate IRQ for PSI-240I controller.\n");
restore_flags (flags);
goto unregister;
}
goto host_init_failure;
PsiHost[chipConfig.irq - 10] = pshost;
pshost->unique_id = port;
......@@ -642,14 +635,22 @@ int Psi240i_Detect (Scsi_Host_Template *tpnt)
DEB (printk ("\n blocks = %lX", HOSTDATA(pshost)->device[unit].blocks));
}
restore_flags (flags);
printk("\nPSI-240I EIDE CONTROLLER: at I/O = %x IRQ = %d\n", port, chipConfig.irq);
printk("(C) 1997 Perceptive Solutions, Inc. All rights reserved\n\n");
count++;
continue;
if ( request_irq (chipConfig.irq, do_Irq_Handler, 0, "psi240i", pshost) == 0 )
{
printk("\nPSI-240I EIDE CONTROLLER: at I/O = %x IRQ = %d\n", port, chipConfig.irq);
printk("(C) 1997 Perceptive Solutions, Inc. All rights reserved\n\n");
count++;
continue;
}
printk ("Unable to allocate IRQ for PSI-240I controller.\n");
host_init_failure:
release_region (port, port_range);
if (pshost)
scsi_unregister (pshost);
unregister:;
scsi_unregister (pshost);
}
return count;
}
......
......@@ -224,8 +224,10 @@ void scsi_release_request(Scsi_Request * req)
{
if( req->sr_command != NULL )
{
request_queue_t *q = req->sr_device->request_queue;
scsi_put_command(req->sr_command);
req->sr_command = NULL;
scsi_queue_next_request(q, NULL);
}
kfree(req);
......
......@@ -86,21 +86,6 @@ extern const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE];
#define SCSI_TIMEOUT (2*HZ)
#endif
/*
* Used for debugging the new queueing code. We want to make sure
* that the lock state is consistent with design. Only do this in
* the user space simulator.
*/
#define ASSERT_LOCK(_LOCK, _COUNT)
#if defined(CONFIG_SMP) && defined(CONFIG_USER_DEBUG)
#undef ASSERT_LOCK
#define ASSERT_LOCK(_LOCK,_COUNT) \
{ if( (_LOCK)->lock != _COUNT ) \
panic("Lock count inconsistent %s %d\n", __FILE__, __LINE__); \
}
#endif
/*
* Use these to separate status msg and our bytes
*
......
......@@ -1334,10 +1334,6 @@ static void scsi_eh_lock_done(struct scsi_cmnd *scmd)
{
struct scsi_request *sreq = scmd->sc_request;
scmd->sc_request = NULL;
sreq->sr_command = NULL;
scsi_put_command(scmd);
scsi_release_request(sreq);
}
......
......@@ -733,7 +733,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, int good_sectors,
if (good_sectors >= 0) {
SCSI_LOG_HLCOMPLETE(1, printk("%ld sectors total, %d sectors done.\n",
req->nr_sectors, good_sectors));
SCSI_LOG_HLCOMPLETE(1, printk("use_sg is %d\n ", cmd->use_sg));
SCSI_LOG_HLCOMPLETE(1, printk("use_sg is %d\n", cmd->use_sg));
if (clear_errors)
req->errors = 0;
......
This diff is collapsed.
......@@ -92,7 +92,6 @@ EXPORT_SYMBOL(scsi_reset_provider);
/*
* These are here only while I debug the rest of the scsi stuff.
*/
EXPORT_SYMBOL(scsi_host_get_next);
EXPORT_SYMBOL(scsi_host_hn_get);
EXPORT_SYMBOL(scsi_host_put);
EXPORT_SYMBOL(scsi_device_types);
......
......@@ -106,22 +106,22 @@ int sym53c8xx_release(struct Scsi_Host *);
#include <scsi/scsicam.h>
#define SYM53C8XX { \
name: "sym53c8xx", \
detect: sym53c8xx_detect, \
release: sym53c8xx_release, \
info: sym53c8xx_info, \
queuecommand: sym53c8xx_queue_command, \
slave_configure: sym53c8xx_slave_configure, \
eh_abort_handler: sym53c8xx_eh_abort_handler, \
eh_device_reset_handler:sym53c8xx_eh_device_reset_handler, \
eh_bus_reset_handler: sym53c8xx_eh_bus_reset_handler, \
eh_host_reset_handler: sym53c8xx_eh_host_reset_handler, \
can_queue: 0, \
this_id: 7, \
sg_tablesize: 0, \
cmd_per_lun: 0, \
use_clustering: DISABLE_CLUSTERING, \
highmem_io: 1}
.name = "sym53c8xx", \
.detect = sym53c8xx_detect, \
.release = sym53c8xx_release, \
.info = sym53c8xx_info, \
.queuecommand = sym53c8xx_queue_command, \
.slave_configure = sym53c8xx_slave_configure, \
.eh_abort_handler = sym53c8xx_eh_abort_handler, \
.eh_device_reset_handler = sym53c8xx_eh_device_reset_handler,\
.eh_bus_reset_handler = sym53c8xx_eh_bus_reset_handler, \
.eh_host_reset_handler = sym53c8xx_eh_host_reset_handler, \
.can_queue = 0, \
.this_id = 7, \
.sg_tablesize = 0, \
.cmd_per_lun = 0, \
.use_clustering = DISABLE_CLUSTERING, \
.highmem_io = 1}
#endif /* defined(HOSTS_C) || defined(MODULE) */
......
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