diff options
author | Anand Kumar Santhanam <AnandKumar.Santhanam@pmcs.com> | 2013-09-18 01:42:59 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2013-10-25 04:58:14 -0400 |
commit | f9cd6cbd80d1d5963ffd0eab3970235cd4205984 (patch) | |
tree | 9754416cbfeaff6570c6f838e594c1fd93858038 /drivers/scsi/pm8001 | |
parent | e912457bb8a2fc56e7036c5837e2947b430e93e1 (diff) |
[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>
Diffstat (limited to 'drivers/scsi/pm8001')
-rw-r--r-- | drivers/scsi/pm8001/pm80xx_hwi.c | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c index 8bac5aeaa804..fa06f24e1656 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c | |||
@@ -3612,8 +3612,7 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha, | |||
3612 | int ret; | 3612 | int ret; |
3613 | u64 phys_addr; | 3613 | u64 phys_addr; |
3614 | struct inbound_queue_table *circularQ; | 3614 | struct inbound_queue_table *circularQ; |
3615 | static u32 inb; | 3615 | u32 q_index; |
3616 | static u32 outb; | ||
3617 | u32 opc = OPC_INB_SSPINIIOSTART; | 3616 | u32 opc = OPC_INB_SSPINIIOSTART; |
3618 | memset(&ssp_cmd, 0, sizeof(ssp_cmd)); | 3617 | memset(&ssp_cmd, 0, sizeof(ssp_cmd)); |
3619 | memcpy(ssp_cmd.ssp_iu.lun, task->ssp_task.LUN, 8); | 3618 | 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, | |||
3632 | ssp_cmd.ssp_iu.efb_prio_attr |= (task->ssp_task.task_attr & 7); | 3631 | ssp_cmd.ssp_iu.efb_prio_attr |= (task->ssp_task.task_attr & 7); |
3633 | memcpy(ssp_cmd.ssp_iu.cdb, task->ssp_task.cmd->cmnd, | 3632 | memcpy(ssp_cmd.ssp_iu.cdb, task->ssp_task.cmd->cmnd, |
3634 | task->ssp_task.cmd->cmd_len); | 3633 | task->ssp_task.cmd->cmd_len); |
3635 | circularQ = &pm8001_ha->inbnd_q_tbl[0]; | 3634 | q_index = (u32) (pm8001_dev->id & 0x00ffffff) % PM8001_MAX_INB_NUM; |
3635 | circularQ = &pm8001_ha->inbnd_q_tbl[q_index]; | ||
3636 | 3636 | ||
3637 | /* Check if encryption is set */ | 3637 | /* Check if encryption is set */ |
3638 | if (pm8001_ha->chip->encrypt && | 3638 | if (pm8001_ha->chip->encrypt && |
@@ -3680,7 +3680,7 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha, | |||
3680 | } else { | 3680 | } else { |
3681 | PM8001_IO_DBG(pm8001_ha, pm8001_printk( | 3681 | PM8001_IO_DBG(pm8001_ha, pm8001_printk( |
3682 | "Sending Normal SAS command 0x%x inb q %x\n", | 3682 | "Sending Normal SAS command 0x%x inb q %x\n", |
3683 | task->ssp_task.cmd->cmnd[0], inb)); | 3683 | task->ssp_task.cmd->cmnd[0], q_index)); |
3684 | /* fill in PRD (scatter/gather) table, if any */ | 3684 | /* fill in PRD (scatter/gather) table, if any */ |
3685 | if (task->num_scatter > 1) { | 3685 | if (task->num_scatter > 1) { |
3686 | pm8001_chip_make_sg(task->scatter, ccb->n_elem, | 3686 | 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, | |||
3706 | ssp_cmd.esgl = 0; | 3706 | ssp_cmd.esgl = 0; |
3707 | } | 3707 | } |
3708 | } | 3708 | } |
3709 | ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &ssp_cmd, outb++); | 3709 | q_index = (u32) (pm8001_dev->id & 0x00ffffff) % PM8001_MAX_OUTB_NUM; |
3710 | 3710 | ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, | |
3711 | /* rotate the outb queue */ | 3711 | &ssp_cmd, q_index); |
3712 | outb = outb%PM8001_MAX_SPCV_OUTB_NUM; | ||
3713 | |||
3714 | return ret; | 3712 | return ret; |
3715 | } | 3713 | } |
3716 | 3714 | ||
@@ -3722,8 +3720,7 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha, | |||
3722 | struct pm8001_device *pm8001_ha_dev = dev->lldd_dev; | 3720 | struct pm8001_device *pm8001_ha_dev = dev->lldd_dev; |
3723 | u32 tag = ccb->ccb_tag; | 3721 | u32 tag = ccb->ccb_tag; |
3724 | int ret; | 3722 | int ret; |
3725 | static u32 inb; | 3723 | u32 q_index; |
3726 | static u32 outb; | ||
3727 | struct sata_start_req sata_cmd; | 3724 | struct sata_start_req sata_cmd; |
3728 | u32 hdr_tag, ncg_tag = 0; | 3725 | u32 hdr_tag, ncg_tag = 0; |
3729 | u64 phys_addr; | 3726 | u64 phys_addr; |
@@ -3733,7 +3730,8 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha, | |||
3733 | unsigned long flags; | 3730 | unsigned long flags; |
3734 | u32 opc = OPC_INB_SATA_HOST_OPSTART; | 3731 | u32 opc = OPC_INB_SATA_HOST_OPSTART; |
3735 | memset(&sata_cmd, 0, sizeof(sata_cmd)); | 3732 | memset(&sata_cmd, 0, sizeof(sata_cmd)); |
3736 | circularQ = &pm8001_ha->inbnd_q_tbl[0]; | 3733 | q_index = (u32) (pm8001_ha_dev->id & 0x00ffffff) % PM8001_MAX_INB_NUM; |
3734 | circularQ = &pm8001_ha->inbnd_q_tbl[q_index]; | ||
3737 | 3735 | ||
3738 | if (task->data_dir == PCI_DMA_NONE) { | 3736 | if (task->data_dir == PCI_DMA_NONE) { |
3739 | ATAP = 0x04; /* no data*/ | 3737 | ATAP = 0x04; /* no data*/ |
@@ -3814,7 +3812,7 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha, | |||
3814 | } else { | 3812 | } else { |
3815 | PM8001_IO_DBG(pm8001_ha, pm8001_printk( | 3813 | PM8001_IO_DBG(pm8001_ha, pm8001_printk( |
3816 | "Sending Normal SATA command 0x%x inb %x\n", | 3814 | "Sending Normal SATA command 0x%x inb %x\n", |
3817 | sata_cmd.sata_fis.command, inb)); | 3815 | sata_cmd.sata_fis.command, q_index)); |
3818 | /* dad (bit 0-1) is 0 */ | 3816 | /* dad (bit 0-1) is 0 */ |
3819 | sata_cmd.ncqtag_atap_dir_m_dad = | 3817 | sata_cmd.ncqtag_atap_dir_m_dad = |
3820 | cpu_to_le32(((ncg_tag & 0xff)<<16) | | 3818 | cpu_to_le32(((ncg_tag & 0xff)<<16) | |
@@ -3911,12 +3909,9 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha, | |||
3911 | } | 3909 | } |
3912 | } | 3910 | } |
3913 | } | 3911 | } |
3914 | 3912 | q_index = (u32) (pm8001_ha_dev->id & 0x00ffffff) % PM8001_MAX_OUTB_NUM; | |
3915 | ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, | 3913 | ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, |
3916 | &sata_cmd, outb++); | 3914 | &sata_cmd, q_index); |
3917 | |||
3918 | /* rotate the outb queue */ | ||
3919 | outb = outb%PM8001_MAX_SPCV_OUTB_NUM; | ||
3920 | return ret; | 3915 | return ret; |
3921 | } | 3916 | } |
3922 | 3917 | ||