mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
scsi: atp870u: Use standard definitions
Use standard definitions for SCSI commands and return status instead of the hardcoded values. Link: https://lore.kernel.org/r/20210113090500.129644-25-hare@suse.de Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
committed by
Martin K. Petersen
parent
db83d8a5c8
commit
f3272258d7
@@ -379,28 +379,28 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id)
|
|||||||
if (is885(dev)) {
|
if (is885(dev)) {
|
||||||
i = atp_readb_pci(dev, c, 1) & 0xf3;
|
i = atp_readb_pci(dev, c, 1) & 0xf3;
|
||||||
//j=workreq->cmnd[0];
|
//j=workreq->cmnd[0];
|
||||||
if ((workreq->cmnd[0] == 0x08) ||
|
if ((workreq->cmnd[0] == READ_6) ||
|
||||||
(workreq->cmnd[0] == 0x28) ||
|
(workreq->cmnd[0] == READ_10) ||
|
||||||
(workreq->cmnd[0] == 0x0a) ||
|
(workreq->cmnd[0] == WRITE_6) ||
|
||||||
(workreq->cmnd[0] == 0x2a)) {
|
(workreq->cmnd[0] == WRITE_10)) {
|
||||||
i |= 0x0c;
|
i |= 0x0c;
|
||||||
}
|
}
|
||||||
atp_writeb_pci(dev, c, 1, i);
|
atp_writeb_pci(dev, c, 1, i);
|
||||||
} else if (is880(dev)) {
|
} else if (is880(dev)) {
|
||||||
if ((workreq->cmnd[0] == 0x08) ||
|
if ((workreq->cmnd[0] == READ_6) ||
|
||||||
(workreq->cmnd[0] == 0x28) ||
|
(workreq->cmnd[0] == READ_10) ||
|
||||||
(workreq->cmnd[0] == 0x0a) ||
|
(workreq->cmnd[0] == WRITE_6) ||
|
||||||
(workreq->cmnd[0] == 0x2a))
|
(workreq->cmnd[0] == WRITE_10))
|
||||||
atp_writeb_base(dev, 0x3b,
|
atp_writeb_base(dev, 0x3b,
|
||||||
(atp_readb_base(dev, 0x3b) & 0x3f) | 0xc0);
|
(atp_readb_base(dev, 0x3b) & 0x3f) | 0xc0);
|
||||||
else
|
else
|
||||||
atp_writeb_base(dev, 0x3b,
|
atp_writeb_base(dev, 0x3b,
|
||||||
atp_readb_base(dev, 0x3b) & 0x3f);
|
atp_readb_base(dev, 0x3b) & 0x3f);
|
||||||
} else {
|
} else {
|
||||||
if ((workreq->cmnd[0] == 0x08) ||
|
if ((workreq->cmnd[0] == READ_6) ||
|
||||||
(workreq->cmnd[0] == 0x28) ||
|
(workreq->cmnd[0] == READ_10) ||
|
||||||
(workreq->cmnd[0] == 0x0a) ||
|
(workreq->cmnd[0] == WRITE_6) ||
|
||||||
(workreq->cmnd[0] == 0x2a))
|
(workreq->cmnd[0] == WRITE_10))
|
||||||
atp_writeb_base(dev, 0x3a,
|
atp_writeb_base(dev, 0x3a,
|
||||||
(atp_readb_base(dev, 0x3a) & 0xf3) | 0x08);
|
(atp_readb_base(dev, 0x3a) & 0xf3) | 0x08);
|
||||||
else
|
else
|
||||||
@@ -497,10 +497,10 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id)
|
|||||||
workreq->result = atp_readb_io(dev, c, 0x0f);
|
workreq->result = atp_readb_io(dev, c, 0x0f);
|
||||||
if (((dev->r1f[c][target_id] & 0x10) != 0) && is885(dev)) {
|
if (((dev->r1f[c][target_id] & 0x10) != 0) && is885(dev)) {
|
||||||
printk(KERN_WARNING "AEC67162 CRC ERROR !\n");
|
printk(KERN_WARNING "AEC67162 CRC ERROR !\n");
|
||||||
workreq->result = 0x02;
|
workreq->result = SAM_STAT_CHECK_CONDITION;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
workreq->result = 0x02;
|
workreq->result = SAM_STAT_CHECK_CONDITION;
|
||||||
|
|
||||||
if (is885(dev)) {
|
if (is885(dev)) {
|
||||||
j = atp_readb_base(dev, 0x29) | 0x01;
|
j = atp_readb_base(dev, 0x29) | 0x01;
|
||||||
@@ -630,7 +630,7 @@ static int atp870u_queuecommand_lck(struct scsi_cmnd *req_p,
|
|||||||
req_p->sense_buffer[0]=0;
|
req_p->sense_buffer[0]=0;
|
||||||
scsi_set_resid(req_p, 0);
|
scsi_set_resid(req_p, 0);
|
||||||
if (scmd_channel(req_p) > 1) {
|
if (scmd_channel(req_p) > 1) {
|
||||||
req_p->result = 0x00040000;
|
req_p->result = DID_BAD_TARGET << 16;
|
||||||
done(req_p);
|
done(req_p);
|
||||||
#ifdef ED_DBGP
|
#ifdef ED_DBGP
|
||||||
printk("atp870u_queuecommand : req_p->device->channel > 1\n");
|
printk("atp870u_queuecommand : req_p->device->channel > 1\n");
|
||||||
@@ -649,7 +649,7 @@ static int atp870u_queuecommand_lck(struct scsi_cmnd *req_p,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if ((m & dev->active_id[c]) == 0) {
|
if ((m & dev->active_id[c]) == 0) {
|
||||||
req_p->result = 0x00040000;
|
req_p->result = DID_BAD_TARGET << 16;
|
||||||
done(req_p);
|
done(req_p);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -684,7 +684,7 @@ static int atp870u_queuecommand_lck(struct scsi_cmnd *req_p,
|
|||||||
printk("atp870u_queuecommand : dev->quhd[c] == dev->quend[c]\n");
|
printk("atp870u_queuecommand : dev->quhd[c] == dev->quend[c]\n");
|
||||||
#endif
|
#endif
|
||||||
dev->quend[c]--;
|
dev->quend[c]--;
|
||||||
req_p->result = 0x00020000;
|
req_p->result = DID_BUS_BUSY << 16;
|
||||||
done(req_p);
|
done(req_p);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -800,7 +800,7 @@ static void send_s870(struct atp_unit *dev,unsigned char c)
|
|||||||
if (l > 8)
|
if (l > 8)
|
||||||
l = 8;
|
l = 8;
|
||||||
}
|
}
|
||||||
if (workreq->cmnd[0] == 0x00) {
|
if (workreq->cmnd[0] == TEST_UNIT_READY) {
|
||||||
l = 0;
|
l = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -934,22 +934,28 @@ static void send_s870(struct atp_unit *dev,unsigned char c)
|
|||||||
atp_writeb_pci(dev, c, 2, 0x00);
|
atp_writeb_pci(dev, c, 2, 0x00);
|
||||||
if (is885(dev)) {
|
if (is885(dev)) {
|
||||||
j = atp_readb_pci(dev, c, 1) & 0xf3;
|
j = atp_readb_pci(dev, c, 1) & 0xf3;
|
||||||
if ((workreq->cmnd[0] == 0x08) || (workreq->cmnd[0] == 0x28) ||
|
if ((workreq->cmnd[0] == READ_6) ||
|
||||||
(workreq->cmnd[0] == 0x0a) || (workreq->cmnd[0] == 0x2a)) {
|
(workreq->cmnd[0] == READ_10) ||
|
||||||
|
(workreq->cmnd[0] == WRITE_6) ||
|
||||||
|
(workreq->cmnd[0] == WRITE_10)) {
|
||||||
j |= 0x0c;
|
j |= 0x0c;
|
||||||
}
|
}
|
||||||
atp_writeb_pci(dev, c, 1, j);
|
atp_writeb_pci(dev, c, 1, j);
|
||||||
} else if (is880(dev)) {
|
} else if (is880(dev)) {
|
||||||
if ((workreq->cmnd[0] == 0x08) || (workreq->cmnd[0] == 0x28) ||
|
if ((workreq->cmnd[0] == READ_6) ||
|
||||||
(workreq->cmnd[0] == 0x0a) || (workreq->cmnd[0] == 0x2a))
|
(workreq->cmnd[0] == READ_10) ||
|
||||||
|
(workreq->cmnd[0] == WRITE_6) ||
|
||||||
|
(workreq->cmnd[0] == WRITE_10))
|
||||||
atp_writeb_base(dev, 0x3b,
|
atp_writeb_base(dev, 0x3b,
|
||||||
(atp_readb_base(dev, 0x3b) & 0x3f) | 0xc0);
|
(atp_readb_base(dev, 0x3b) & 0x3f) | 0xc0);
|
||||||
else
|
else
|
||||||
atp_writeb_base(dev, 0x3b,
|
atp_writeb_base(dev, 0x3b,
|
||||||
atp_readb_base(dev, 0x3b) & 0x3f);
|
atp_readb_base(dev, 0x3b) & 0x3f);
|
||||||
} else {
|
} else {
|
||||||
if ((workreq->cmnd[0] == 0x08) || (workreq->cmnd[0] == 0x28) ||
|
if ((workreq->cmnd[0] == READ_6) ||
|
||||||
(workreq->cmnd[0] == 0x0a) || (workreq->cmnd[0] == 0x2a))
|
(workreq->cmnd[0] == READ_10) ||
|
||||||
|
(workreq->cmnd[0] == WRITE_6) ||
|
||||||
|
(workreq->cmnd[0] == WRITE_10))
|
||||||
atp_writeb_base(dev, 0x3a,
|
atp_writeb_base(dev, 0x3a,
|
||||||
(atp_readb_base(dev, 0x3a) & 0xf3) | 0x08);
|
(atp_readb_base(dev, 0x3a) & 0xf3) | 0x08);
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user