Commit a4f7980f authored by Andrew Vasquez's avatar Andrew Vasquez Committed by James Bottomley

[PATCH] PATCH [4/8] qla2xxx: Small fixes

o Always set an TCQ modifier for each command submitted.
o Always (re)-initialize NVRAM during execution.
o Add pci_disable_device() calls to proper locations during
  pci-probe failure and pci-remove.
o Do not begin processing until the DPC has been marked
  'active'.
o Fix off-by-one error while copying sense-data.
o Fix bus-reset issue during back-door execution.
Signed-off-by: default avatarAndrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 9a583e9f
...@@ -217,7 +217,9 @@ qla2x00_initialize_adapter(scsi_qla_host_t *ha) ...@@ -217,7 +217,9 @@ qla2x00_initialize_adapter(scsi_qla_host_t *ha)
rval = QLA_FUNCTION_FAILED; rval = QLA_FUNCTION_FAILED;
if (ha->mem_err) if (ha->mem_err)
restart_risc = 1; restart_risc = 1;
} } else if (ha->device_flags & DFLG_NO_CABLE)
/* If no cable, then all is good. */
rval = QLA_SUCCESS;
} }
} while (restart_risc && retry--); } while (restart_risc && retry--);
...@@ -1202,9 +1204,6 @@ qla2x00_nvram_config(scsi_qla_host_t *ha) ...@@ -1202,9 +1204,6 @@ qla2x00_nvram_config(scsi_qla_host_t *ha)
rval = QLA_SUCCESS; rval = QLA_SUCCESS;
if (ha->flags.init_done)
return (rval);
/* Determine NVRAM starting address. */ /* Determine NVRAM starting address. */
ha->nvram_base = 0; ha->nvram_base = 0;
if (!IS_QLA2100(ha) && !IS_QLA2200(ha) && !IS_QLA2300(ha)) if (!IS_QLA2100(ha) && !IS_QLA2200(ha) && !IS_QLA2300(ha))
......
...@@ -418,12 +418,9 @@ qla2x00_start_scsi(srb_t *sp) ...@@ -418,12 +418,9 @@ qla2x00_start_scsi(srb_t *sp)
cmd_pkt->lun = cpu_to_le16(fclun->lun); cmd_pkt->lun = cpu_to_le16(fclun->lun);
/* Update tagged queuing modifier */ /* Update tagged queuing modifier */
cmd_pkt->control_flags = __constant_cpu_to_le16(CF_SIMPLE_TAG);
if (scsi_populate_tag_msg(cmd, tag)) { if (scsi_populate_tag_msg(cmd, tag)) {
switch (tag[0]) { switch (tag[0]) {
case MSG_SIMPLE_TAG:
cmd_pkt->control_flags =
__constant_cpu_to_le16(CF_SIMPLE_TAG);
break;
case MSG_HEAD_TAG: case MSG_HEAD_TAG:
cmd_pkt->control_flags = cmd_pkt->control_flags =
__constant_cpu_to_le16(CF_HEAD_TAG); __constant_cpu_to_le16(CF_HEAD_TAG);
......
...@@ -969,7 +969,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt) ...@@ -969,7 +969,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt)
sizeof(cp->sense_buffer)) sizeof(cp->sense_buffer))
sense_sz = le16_to_cpu(pkt->req_sense_length); sense_sz = le16_to_cpu(pkt->req_sense_length);
else else
sense_sz = sizeof(cp->sense_buffer) - 1; sense_sz = sizeof(cp->sense_buffer);
CMD_ACTUAL_SNSLEN(cp) = sense_sz; CMD_ACTUAL_SNSLEN(cp) = sense_sz;
sp->request_sense_length = sense_sz; sp->request_sense_length = sense_sz;
...@@ -1039,7 +1039,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt) ...@@ -1039,7 +1039,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt)
sizeof(cp->sense_buffer)) sizeof(cp->sense_buffer))
sense_sz = le16_to_cpu(pkt->req_sense_length); sense_sz = le16_to_cpu(pkt->req_sense_length);
else else
sense_sz = sizeof(cp->sense_buffer) - 1; sense_sz = sizeof(cp->sense_buffer);
CMD_ACTUAL_SNSLEN(cp) = sense_sz; CMD_ACTUAL_SNSLEN(cp) = sense_sz;
sp->request_sense_length = sense_sz; sp->request_sense_length = sense_sz;
......
...@@ -1582,14 +1582,10 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd) ...@@ -1582,14 +1582,10 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd)
if (rval == FAILED) if (rval == FAILED)
goto out; goto out;
/*
* Blocking Call. It goes to sleep waiting for cmd to get to done q
*
* XXX(hch): really? We're under host_lock here..
*/
/* Waiting for our command in done_queue to be returned to OS.*/ /* Waiting for our command in done_queue to be returned to OS.*/
if (!qla2x00_eh_wait_for_pending_commands(ha)) if (cmd->device->host->eh_active)
rval = FAILED; if (!qla2x00_eh_wait_for_pending_commands(ha))
rval = FAILED;
out: out:
qla_printk(KERN_INFO, ha, "%s: reset %s\n", __func__, qla_printk(KERN_INFO, ha, "%s: reset %s\n", __func__,
...@@ -1932,7 +1928,7 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) ...@@ -1932,7 +1928,7 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info)
if (host == NULL) { if (host == NULL) {
printk(KERN_WARNING printk(KERN_WARNING
"qla2xxx: Couldn't allocate host from scsi layer!\n"); "qla2xxx: Couldn't allocate host from scsi layer!\n");
return -1; goto probe_disable_device;
} }
/* Clear our data area */ /* Clear our data area */
...@@ -2155,6 +2151,9 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) ...@@ -2155,6 +2151,9 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info)
scsi_host_put(host); scsi_host_put(host);
probe_disable_device:
pci_disable_device(pdev);
return -1; return -1;
} }
EXPORT_SYMBOL_GPL(qla2x00_probe_one); EXPORT_SYMBOL_GPL(qla2x00_probe_one);
...@@ -2223,6 +2222,8 @@ qla2x00_free_device(scsi_qla_host_t *ha) ...@@ -2223,6 +2222,8 @@ qla2x00_free_device(scsi_qla_host_t *ha)
/* release io space registers */ /* release io space registers */
pci_release_regions(ha->pdev); pci_release_regions(ha->pdev);
pci_disable_device(ha->pdev);
#if MEMORY_MAPPED_IO #if MEMORY_MAPPED_IO
if (ha->mmio_address) if (ha->mmio_address)
iounmap(ha->mmio_address); iounmap(ha->mmio_address);
...@@ -3231,9 +3232,6 @@ qla2x00_do_dpc(void *data) ...@@ -3231,9 +3232,6 @@ qla2x00_do_dpc(void *data)
if (ha->dpc_should_die) if (ha->dpc_should_die)
break; break;
if (!list_empty(&ha->done_queue))
qla2x00_done(ha);
DEBUG3(printk("qla2x00: DPC handler waking up\n")); DEBUG3(printk("qla2x00: DPC handler waking up\n"));
/* Initialization not yet finished. Don't do anything yet. */ /* Initialization not yet finished. Don't do anything yet. */
...@@ -3244,6 +3242,9 @@ qla2x00_do_dpc(void *data) ...@@ -3244,6 +3242,9 @@ qla2x00_do_dpc(void *data)
ha->dpc_active = 1; ha->dpc_active = 1;
if (!list_empty(&ha->done_queue))
qla2x00_done(ha);
/* Process commands in retry queue */ /* Process commands in retry queue */
if (test_and_clear_bit(PORT_RESTART_NEEDED, &ha->dpc_flags)) { if (test_and_clear_bit(PORT_RESTART_NEEDED, &ha->dpc_flags)) {
DEBUG(printk("scsi(%ld): DPC checking retry_q. " DEBUG(printk("scsi(%ld): DPC checking retry_q. "
......
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