Commit 33eec3bf authored by James Bottomley's avatar James Bottomley

Fix ncr53c8xx for PA-RISC Zalon SCSI driver

Although this driver is ancient and unmaintained, it is still used
by the 53c700 based PA-RISC zalon.  The changes are:

- Add slave_configure entry for zalon
- Moved to new error handling
- changed to irqreturn_t for interrupt handler
parent af5f0a3a
...@@ -398,7 +398,7 @@ static Scsi_Host_Template *the_template = NULL; ...@@ -398,7 +398,7 @@ static Scsi_Host_Template *the_template = NULL;
#define ScsiResult(host_code, scsi_code) (((host_code) << 16) + ((scsi_code) & 0x7f)) #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 void ncr53c8xx_timeout(unsigned long np);
static int ncr53c8xx_proc_info(char *buffer, char **start, off_t offset, static int ncr53c8xx_proc_info(char *buffer, char **start, off_t offset,
int length, int hostno, int func); int length, int hostno, int func);
...@@ -4883,7 +4883,7 @@ static int ncr_reset_bus (ncb_p np, Scsi_Cmnd *cmd, int sync_reset) ...@@ -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. * Return immediately if reset is in progress.
*/ */
if (np->settle_time) { if (np->settle_time) {
return SCSI_RESET_PUNT; return FAILED;
} }
/* /*
* Start the reset process. * Start the reset process.
...@@ -4929,7 +4929,7 @@ static int ncr_reset_bus (ncb_p np, Scsi_Cmnd *cmd, int sync_reset) ...@@ -4929,7 +4929,7 @@ static int ncr_reset_bus (ncb_p np, Scsi_Cmnd *cmd, int sync_reset)
ncr_queue_done_cmd(np, cmd); ncr_queue_done_cmd(np, cmd);
} }
return SCSI_RESET_SUCCESS; return SUCCESS;
} }
/*========================================================== /*==========================================================
...@@ -8775,7 +8775,7 @@ printk("ncr53c8xx : command successfully queued\n"); ...@@ -8775,7 +8775,7 @@ printk("ncr53c8xx : command successfully queued\n");
** routine for each host that uses this IRQ. ** 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; unsigned long flags;
ncb_p np = (ncb_p) dev_id; ncb_p np = (ncb_p) dev_id;
...@@ -8800,6 +8800,7 @@ static void ncr53c8xx_intr(int irq, void *dev_id, struct pt_regs * regs) ...@@ -8800,6 +8800,7 @@ static void ncr53c8xx_intr(int irq, void *dev_id, struct pt_regs * regs)
ncr_flush_done_cmds(done_list); ncr_flush_done_cmds(done_list);
NCR_UNLOCK_SCSI_DONE(done_list->device->host, flags); NCR_UNLOCK_SCSI_DONE(done_list->device->host, flags);
} }
return IRQ_HANDLED;
} }
/* /*
...@@ -8829,59 +8830,24 @@ static void ncr53c8xx_timeout(unsigned long npref) ...@@ -8829,59 +8830,24 @@ static void ncr53c8xx_timeout(unsigned long npref)
** Linux entry point of reset() function ** Linux entry point of reset() function
*/ */
#if defined SCSI_RESET_SYNCHRONOUS && defined SCSI_RESET_ASYNCHRONOUS int ncr53c8xx_bus_reset(Scsi_Cmnd *cmd)
int ncr53c8xx_reset(Scsi_Cmnd *cmd, unsigned int reset_flags)
#else
int ncr53c8xx_reset(Scsi_Cmnd *cmd)
#endif
{ {
ncb_p np = ((struct host_data *) cmd->device->host->hostdata)->ncb; ncb_p np = ((struct host_data *) cmd->device->host->hostdata)->ncb;
int sts; int sts;
unsigned long flags; unsigned long flags;
Scsi_Cmnd *done_list; 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); 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 * If the mid-level driver told us reset is synchronous, it seems
* that we must call the done() callback for the involved command, * that we must call the done() callback for the involved command,
* even if this command was not queued to the low-level driver, * 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, 1);
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
out:
done_list = np->done_list; done_list = np->done_list;
np->done_list = 0; np->done_list = 0;
NCR_UNLOCK_NCB(np, flags); NCR_UNLOCK_NCB(np, flags);
...@@ -9513,6 +9479,8 @@ Scsi_Host_Template driver_template = { ...@@ -9513,6 +9479,8 @@ Scsi_Host_Template driver_template = {
.release = zalon7xx_release, .release = zalon7xx_release,
.info = ncr53c8xx_info, .info = ncr53c8xx_info,
.queuecommand = ncr53c8xx_queue_command, .queuecommand = ncr53c8xx_queue_command,
.slave_configure = ncr53c8xx_slave_configure,
.eh_bus_reset_handler = ncr53c8xx_bus_reset,
.can_queue = SCSI_NCR_CAN_QUEUE, .can_queue = SCSI_NCR_CAN_QUEUE,
.this_id = 7, .this_id = 7,
.sg_tablesize = SCSI_NCR_SG_TABLESIZE, .sg_tablesize = SCSI_NCR_SG_TABLESIZE,
......
...@@ -63,35 +63,19 @@ int ncr53c8xx_slave_configure(Scsi_Device *); ...@@ -63,35 +63,19 @@ int ncr53c8xx_slave_configure(Scsi_Device *);
int ncr53c8xx_release(struct Scsi_Host *); int ncr53c8xx_release(struct Scsi_Host *);
#if LINUX_VERSION_CODE >= LinuxVersionCode(2,1,75)
#define NCR53C8XX { .name = "ncr53c8xx", \ #define NCR53C8XX { .name = "ncr53c8xx", \
.detect = ncr53c8xx_detect, \ .detect = ncr53c8xx_detect, \
.release = ncr53c8xx_release, \ .release = ncr53c8xx_release, \
.info = ncr53c8xx_info, \ .info = ncr53c8xx_info, \
.queuecommand = ncr53c8xx_queue_command,\ .queuecommand = ncr53c8xx_queue_command,\
.slave_configure = ncr53c8xx_slave_configure,\ .slave_configure = ncr53c8xx_slave_configure,\
.abort = ncr53c8xx_abort, \ .eh_bus_reset_handler = ncr53c8xx_bus_reset, \
.reset = ncr53c8xx_reset, \
.can_queue = SCSI_NCR_CAN_QUEUE, \ .can_queue = SCSI_NCR_CAN_QUEUE, \
.this_id = 7, \ .this_id = 7, \
.sg_tablesize = SCSI_NCR_SG_TABLESIZE, \ .sg_tablesize = SCSI_NCR_SG_TABLESIZE, \
.cmd_per_lun = SCSI_NCR_CMD_PER_LUN, \ .cmd_per_lun = SCSI_NCR_CMD_PER_LUN, \
.use_clustering = DISABLE_CLUSTERING} .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 /* defined(HOSTS_C) || defined(MODULE) */
#endif /* NCR53C8XX_H */ #endif /* NCR53C8XX_H */
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