return b;
}
-/*
- * Driver host data structure.
- */
-struct host_data {
- struct sym_hcb *ncb;
-};
-
/*
* Used by the eh thread to wait for command completion.
* It is allocated on the eh thread stack.
return use_sg;
}
-static void __sync_scsi_data_for_cpu(struct pci_dev *pdev, struct scsi_cmnd *cmd)
-{
- int dma_dir = cmd->sc_data_direction;
-
- switch(SYM_UCMD_PTR(cmd)->data_mapped) {
- case 2:
- pci_dma_sync_sg_for_cpu(pdev, cmd->buffer, cmd->use_sg, dma_dir);
- break;
- case 1:
- pci_dma_sync_single_for_cpu(pdev, SYM_UCMD_PTR(cmd)->data_mapping,
- cmd->request_bufflen, dma_dir);
- break;
- }
-}
-
-static void __sync_scsi_data_for_device(struct pci_dev *pdev, struct scsi_cmnd *cmd)
-{
- int dma_dir = cmd->sc_data_direction;
-
- switch(SYM_UCMD_PTR(cmd)->data_mapped) {
- case 2:
- pci_dma_sync_sg_for_device(pdev, cmd->buffer, cmd->use_sg, dma_dir);
- break;
- case 1:
- pci_dma_sync_single_for_device(pdev, SYM_UCMD_PTR(cmd)->data_mapping,
- cmd->request_bufflen, dma_dir);
- break;
- }
-}
-
#define unmap_scsi_data(np, cmd) \
__unmap_scsi_data(np->s.device, cmd)
#define map_scsi_single_data(np, cmd) \
__map_scsi_single_data(np->s.device, cmd)
#define map_scsi_sg_data(np, cmd) \
__map_scsi_sg_data(np->s.device, cmd)
-#define sync_scsi_data_for_cpu(np, cmd) \
- __sync_scsi_data_for_cpu(np->s.device, cmd)
-#define sync_scsi_data_for_device(np, cmd) \
- __sync_scsi_data_for_device(np->s.device, cmd)
-
/*
* Complete a pending CAM CCB.
*/
}
-/*
- * Called on successfull INQUIRY response.
- */
-void sym_sniff_inquiry(struct sym_hcb *np, struct scsi_cmnd *cmd, int resid)
-{
- int retv;
-
- if (!cmd || cmd->use_sg)
- return;
-
- sync_scsi_data_for_cpu(np, cmd);
- retv = __sym_sniff_inquiry(np, cmd->device->id, cmd->device->lun,
- (u_char *) cmd->request_buffer,
- cmd->request_bufflen - resid);
- sync_scsi_data_for_device(np, cmd);
- if (retv < 0)
- return;
- else if (retv)
- sym_update_trans_settings(np, &np->target[cmd->device->id]);
-}
-
/*
* Build the scatter/gather array for an I/O.
*/
*/
static void sym_requeue_awaiting_cmds(struct sym_hcb *np)
{
- struct scsi_cmnd *cmd;
- struct sym_ucmd *ucp = SYM_UCMD_PTR(cmd);
+ struct sym_ucmd *ucp;
SYM_QUEHEAD tmp_cmdq;
int sts;
sym_que_move(&np->s.wait_cmdq, &tmp_cmdq);
while ((ucp = (struct sym_ucmd *) sym_remque_head(&tmp_cmdq)) != 0) {
+ struct scsi_cmnd *cmd;
+
sym_insque_tail(&ucp->link_cmdq, &np->s.busy_cmdq);
cmd = SYM_SCMD_PTR(ucp);
sts = sym_queue_command(np, cmd);
np = ((struct host_data *) host->hostdata)->ncb;
tp = &np->target[device->id];
-
- /*
- * Get user settings for transfer parameters.
- */
- tp->inq_byte7_valid = (INQ7_SYNC|INQ7_WIDE16);
- sym_update_trans_settings(np, tp);
+ tp->sdev = device;
/*
* Allocate the LCB if not yet.
}
MODULE_LICENSE("Dual BSD/GPL");
+MODULE_VERSION(SYM_VERSION);
/*
* Driver host template.
struct sym_hcb *np = ((struct host_data *)sdev->host->hostdata)->ncb;
struct sym_tcb *tp = &np->target[sdev->id];
- if (tp->tinfo.curr.options & PPR_OPT_DT) {
- if (offset > np->maxoffs_dt)
- offset = np->maxoffs_dt;
- } else {
- if (offset > np->maxoffs)
- offset = np->maxoffs;
- }
tp->tinfo.goal.offset = offset;
}
struct sym_hcb *np = ((struct host_data *)sdev->host->hostdata)->ncb;
struct sym_tcb *tp = &np->target[sdev->id];
- if (period <= 9 && np->minsync_dt) {
- if (period < np->minsync_dt)
- period = np->minsync_dt;
- tp->tinfo.goal.options = PPR_OPT_DT;
- tp->tinfo.goal.period = period;
- if (!tp->tinfo.curr.offset ||
- tp->tinfo.curr.offset > np->maxoffs_dt)
- tp->tinfo.goal.offset = np->maxoffs_dt;
- } else {
- if (period < np->minsync)
- period = np->minsync;
- tp->tinfo.goal.options = 0;
- tp->tinfo.goal.period = period;
- if (!tp->tinfo.curr.offset ||
- tp->tinfo.curr.offset > np->maxoffs)
- tp->tinfo.goal.offset = np->maxoffs;
- }
+ /* have to have DT for these transfers */
+ if (period <= np->minsync)
+ tp->tinfo.goal.options |= PPR_OPT_DT;
+
+ tp->tinfo.goal.period = period;
}
static void sym2_get_width(struct scsi_device *sdev)
struct sym_hcb *np = ((struct host_data *)sdev->host->hostdata)->ncb;
struct sym_tcb *tp = &np->target[sdev->id];
+ /* It is illegal to have DT set on narrow transfers */
+ if (width == 0)
+ tp->tinfo.goal.options &= ~PPR_OPT_DT;
+
tp->tinfo.goal.width = width;
}
struct sym_hcb *np = ((struct host_data *)sdev->host->hostdata)->ncb;
struct sym_tcb *tp = &np->target[sdev->id];
- if (!dt) {
- /* if clearing DT, then we may need to reduce the
- * period and the offset */
- if (tp->tinfo.curr.period < np->minsync)
- tp->tinfo.goal.period = np->minsync;
- if (tp->tinfo.curr.offset > np->maxoffs)
- tp->tinfo.goal.offset = np->maxoffs;
- tp->tinfo.goal.options &= ~PPR_OPT_DT;
- } else {
+ if (dt)
tp->tinfo.goal.options |= PPR_OPT_DT;
- }
+ else
+ tp->tinfo.goal.options &= ~PPR_OPT_DT;
}