Skip to content

Commit 5454329

Browse files
ipylypivmartinkpetersen
authored andcommitted
scsi: pm80xx: Set RETFIS when requested by libsas
By default PM80xx HBAs return FIS only when a drive reports an error. The RETFIS bit forces the controller to populate FIS even when a drive reports no error. Signed-off-by: Igor Pylypiv <ipylypiv@google.com> Link: https://lore.kernel.org/r/20230819213040.1101044-3-ipylypiv@google.com Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 7287501 commit 5454329

File tree

4 files changed

+19
-18
lines changed

4 files changed

+19
-18
lines changed

drivers/scsi/pm8001/pm8001_hwi.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4095,7 +4095,7 @@ static int pm8001_chip_sata_req(struct pm8001_hba_info *pm8001_ha,
40954095
u32 hdr_tag, ncg_tag = 0;
40964096
u64 phys_addr;
40974097
u32 ATAP = 0x0;
4098-
u32 dir;
4098+
u32 dir, retfis = 0;
40994099
u32 opc = OPC_INB_SATA_HOST_OPSTART;
41004100

41014101
memset(&sata_cmd, 0, sizeof(sata_cmd));
@@ -4124,8 +4124,11 @@ static int pm8001_chip_sata_req(struct pm8001_hba_info *pm8001_ha,
41244124
sata_cmd.tag = cpu_to_le32(tag);
41254125
sata_cmd.device_id = cpu_to_le32(pm8001_ha_dev->device_id);
41264126
sata_cmd.data_len = cpu_to_le32(task->total_xfer_len);
4127-
sata_cmd.ncqtag_atap_dir_m =
4128-
cpu_to_le32(((ncg_tag & 0xff)<<16)|((ATAP & 0x3f) << 10) | dir);
4127+
if (task->ata_task.return_fis_on_success)
4128+
retfis = 1;
4129+
sata_cmd.retfis_ncqtag_atap_dir_m =
4130+
cpu_to_le32((retfis << 24) | ((ncg_tag & 0xff) << 16) |
4131+
((ATAP & 0x3f) << 10) | dir);
41294132
sata_cmd.sata_fis = task->ata_task.fis;
41304133
if (likely(!task->ata_task.device_control_reg_update))
41314134
sata_cmd.sata_fis.flags |= 0x80;/* C=1: update ATA cmd reg */

drivers/scsi/pm8001/pm8001_hwi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ struct sata_start_req {
515515
__le32 tag;
516516
__le32 device_id;
517517
__le32 data_len;
518-
__le32 ncqtag_atap_dir_m;
518+
__le32 retfis_ncqtag_atap_dir_m;
519519
struct host_to_dev_fis sata_fis;
520520
u32 reserved1;
521521
u32 reserved2;

drivers/scsi/pm8001/pm80xx_hwi.c

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4457,7 +4457,7 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha,
44574457
u64 phys_addr, end_addr;
44584458
u32 end_addr_high, end_addr_low;
44594459
u32 ATAP = 0x0;
4460-
u32 dir;
4460+
u32 dir, retfis = 0;
44614461
u32 opc = OPC_INB_SATA_HOST_OPSTART;
44624462
memset(&sata_cmd, 0, sizeof(sata_cmd));
44634463

@@ -4487,7 +4487,8 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha,
44874487
sata_cmd.tag = cpu_to_le32(tag);
44884488
sata_cmd.device_id = cpu_to_le32(pm8001_ha_dev->device_id);
44894489
sata_cmd.data_len = cpu_to_le32(task->total_xfer_len);
4490-
4490+
if (task->ata_task.return_fis_on_success)
4491+
retfis = 1;
44914492
sata_cmd.sata_fis = task->ata_task.fis;
44924493
if (likely(!task->ata_task.device_control_reg_update))
44934494
sata_cmd.sata_fis.flags |= 0x80;/* C=1: update ATA cmd reg */
@@ -4500,12 +4501,10 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha,
45004501
"Encryption enabled.Sending Encrypt SATA cmd 0x%x\n",
45014502
sata_cmd.sata_fis.command);
45024503
opc = OPC_INB_SATA_DIF_ENC_IO;
4503-
4504-
/* set encryption bit */
4505-
sata_cmd.ncqtag_atap_dir_m_dad =
4506-
cpu_to_le32(((ncg_tag & 0xff)<<16)|
4507-
((ATAP & 0x3f) << 10) | 0x20 | dir);
4508-
/* dad (bit 0-1) is 0 */
4504+
/* set encryption bit; dad (bits 0-1) is 0 */
4505+
sata_cmd.retfis_ncqtag_atap_dir_m_dad =
4506+
cpu_to_le32((retfis << 24) | ((ncg_tag & 0xff) << 16) |
4507+
((ATAP & 0x3f) << 10) | 0x20 | dir);
45094508
/* fill in PRD (scatter/gather) table, if any */
45104509
if (task->num_scatter > 1) {
45114510
pm8001_chip_make_sg(task->scatter,
@@ -4568,11 +4567,10 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha,
45684567
pm8001_dbg(pm8001_ha, IO,
45694568
"Sending Normal SATA command 0x%x inb %x\n",
45704569
sata_cmd.sata_fis.command, q_index);
4571-
/* dad (bit 0-1) is 0 */
4572-
sata_cmd.ncqtag_atap_dir_m_dad =
4573-
cpu_to_le32(((ncg_tag & 0xff)<<16) |
4574-
((ATAP & 0x3f) << 10) | dir);
4575-
4570+
/* dad (bits 0-1) is 0 */
4571+
sata_cmd.retfis_ncqtag_atap_dir_m_dad =
4572+
cpu_to_le32((retfis << 24) | ((ncg_tag & 0xff) << 16) |
4573+
((ATAP & 0x3f) << 10) | dir);
45764574
/* fill in PRD (scatter/gather) table, if any */
45774575
if (task->num_scatter > 1) {
45784576
pm8001_chip_make_sg(task->scatter,

drivers/scsi/pm8001/pm80xx_hwi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ struct sata_start_req {
731731
__le32 tag;
732732
__le32 device_id;
733733
__le32 data_len;
734-
__le32 ncqtag_atap_dir_m_dad;
734+
__le32 retfis_ncqtag_atap_dir_m_dad;
735735
struct host_to_dev_fis sata_fis;
736736
u32 reserved1;
737737
u32 reserved2; /* dword 11. rsvd for normal I/O. */

0 commit comments

Comments
 (0)