[SCSI] pm80xx: Queue rotation logic for inbound and outbound queues.
Signed-off-by: Anandkumar.Santhanam@pmcs.com Reviewed-by: Jack Wang <jinpu.wang@profitbricks.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
This commit is contained in:
parent
e912457bb8
commit
f9cd6cbd80
|
@ -3612,8 +3612,7 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha,
|
||||||
int ret;
|
int ret;
|
||||||
u64 phys_addr;
|
u64 phys_addr;
|
||||||
struct inbound_queue_table *circularQ;
|
struct inbound_queue_table *circularQ;
|
||||||
static u32 inb;
|
u32 q_index;
|
||||||
static u32 outb;
|
|
||||||
u32 opc = OPC_INB_SSPINIIOSTART;
|
u32 opc = OPC_INB_SSPINIIOSTART;
|
||||||
memset(&ssp_cmd, 0, sizeof(ssp_cmd));
|
memset(&ssp_cmd, 0, sizeof(ssp_cmd));
|
||||||
memcpy(ssp_cmd.ssp_iu.lun, task->ssp_task.LUN, 8);
|
memcpy(ssp_cmd.ssp_iu.lun, task->ssp_task.LUN, 8);
|
||||||
|
@ -3632,7 +3631,8 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha,
|
||||||
ssp_cmd.ssp_iu.efb_prio_attr |= (task->ssp_task.task_attr & 7);
|
ssp_cmd.ssp_iu.efb_prio_attr |= (task->ssp_task.task_attr & 7);
|
||||||
memcpy(ssp_cmd.ssp_iu.cdb, task->ssp_task.cmd->cmnd,
|
memcpy(ssp_cmd.ssp_iu.cdb, task->ssp_task.cmd->cmnd,
|
||||||
task->ssp_task.cmd->cmd_len);
|
task->ssp_task.cmd->cmd_len);
|
||||||
circularQ = &pm8001_ha->inbnd_q_tbl[0];
|
q_index = (u32) (pm8001_dev->id & 0x00ffffff) % PM8001_MAX_INB_NUM;
|
||||||
|
circularQ = &pm8001_ha->inbnd_q_tbl[q_index];
|
||||||
|
|
||||||
/* Check if encryption is set */
|
/* Check if encryption is set */
|
||||||
if (pm8001_ha->chip->encrypt &&
|
if (pm8001_ha->chip->encrypt &&
|
||||||
|
@ -3680,7 +3680,7 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha,
|
||||||
} else {
|
} else {
|
||||||
PM8001_IO_DBG(pm8001_ha, pm8001_printk(
|
PM8001_IO_DBG(pm8001_ha, pm8001_printk(
|
||||||
"Sending Normal SAS command 0x%x inb q %x\n",
|
"Sending Normal SAS command 0x%x inb q %x\n",
|
||||||
task->ssp_task.cmd->cmnd[0], inb));
|
task->ssp_task.cmd->cmnd[0], q_index));
|
||||||
/* fill in PRD (scatter/gather) table, if any */
|
/* fill in PRD (scatter/gather) table, if any */
|
||||||
if (task->num_scatter > 1) {
|
if (task->num_scatter > 1) {
|
||||||
pm8001_chip_make_sg(task->scatter, ccb->n_elem,
|
pm8001_chip_make_sg(task->scatter, ccb->n_elem,
|
||||||
|
@ -3706,11 +3706,9 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha,
|
||||||
ssp_cmd.esgl = 0;
|
ssp_cmd.esgl = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &ssp_cmd, outb++);
|
q_index = (u32) (pm8001_dev->id & 0x00ffffff) % PM8001_MAX_OUTB_NUM;
|
||||||
|
ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc,
|
||||||
/* rotate the outb queue */
|
&ssp_cmd, q_index);
|
||||||
outb = outb%PM8001_MAX_SPCV_OUTB_NUM;
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3722,8 +3720,7 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha,
|
||||||
struct pm8001_device *pm8001_ha_dev = dev->lldd_dev;
|
struct pm8001_device *pm8001_ha_dev = dev->lldd_dev;
|
||||||
u32 tag = ccb->ccb_tag;
|
u32 tag = ccb->ccb_tag;
|
||||||
int ret;
|
int ret;
|
||||||
static u32 inb;
|
u32 q_index;
|
||||||
static u32 outb;
|
|
||||||
struct sata_start_req sata_cmd;
|
struct sata_start_req sata_cmd;
|
||||||
u32 hdr_tag, ncg_tag = 0;
|
u32 hdr_tag, ncg_tag = 0;
|
||||||
u64 phys_addr;
|
u64 phys_addr;
|
||||||
|
@ -3733,7 +3730,8 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha,
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
u32 opc = OPC_INB_SATA_HOST_OPSTART;
|
u32 opc = OPC_INB_SATA_HOST_OPSTART;
|
||||||
memset(&sata_cmd, 0, sizeof(sata_cmd));
|
memset(&sata_cmd, 0, sizeof(sata_cmd));
|
||||||
circularQ = &pm8001_ha->inbnd_q_tbl[0];
|
q_index = (u32) (pm8001_ha_dev->id & 0x00ffffff) % PM8001_MAX_INB_NUM;
|
||||||
|
circularQ = &pm8001_ha->inbnd_q_tbl[q_index];
|
||||||
|
|
||||||
if (task->data_dir == PCI_DMA_NONE) {
|
if (task->data_dir == PCI_DMA_NONE) {
|
||||||
ATAP = 0x04; /* no data*/
|
ATAP = 0x04; /* no data*/
|
||||||
|
@ -3814,7 +3812,7 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha,
|
||||||
} else {
|
} else {
|
||||||
PM8001_IO_DBG(pm8001_ha, pm8001_printk(
|
PM8001_IO_DBG(pm8001_ha, pm8001_printk(
|
||||||
"Sending Normal SATA command 0x%x inb %x\n",
|
"Sending Normal SATA command 0x%x inb %x\n",
|
||||||
sata_cmd.sata_fis.command, inb));
|
sata_cmd.sata_fis.command, q_index));
|
||||||
/* dad (bit 0-1) is 0 */
|
/* dad (bit 0-1) is 0 */
|
||||||
sata_cmd.ncqtag_atap_dir_m_dad =
|
sata_cmd.ncqtag_atap_dir_m_dad =
|
||||||
cpu_to_le32(((ncg_tag & 0xff)<<16) |
|
cpu_to_le32(((ncg_tag & 0xff)<<16) |
|
||||||
|
@ -3911,12 +3909,9 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
q_index = (u32) (pm8001_ha_dev->id & 0x00ffffff) % PM8001_MAX_OUTB_NUM;
|
||||||
ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc,
|
ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc,
|
||||||
&sata_cmd, outb++);
|
&sata_cmd, q_index);
|
||||||
|
|
||||||
/* rotate the outb queue */
|
|
||||||
outb = outb%PM8001_MAX_SPCV_OUTB_NUM;
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue