Fix 64-bit system enumeration error for Buslogic
Subsystems (2)
PATCH 1/1 Fix 64-bit system enumeration error for Buslogic
From: matt <[email protected]>
Date: Tue, 20 Apr 2021 15:27:48 +0800
Subject: [PATCH] Fix 64-bit system enumeration error for Buslogic
Commit 391e2f25601e("BusLogic: Port driver to 64-bit") in Buslogic driver introduced a serious issue for 64-bit systems. With this commit, 64-bit kernel will enumerate 8*15 non-existing disks. This is caused by the broken CCB structure. The change from u32 data to void *data increased CCB length on 64-bit system, which introduced an extra 4 byte offset of the CDB. This leads to incorrect response to Inquiry commands during enumeration.
This patch fixes the error.
--- drivers/scsi/BusLogic.c | 6 +++--- drivers/scsi/BusLogic.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/BusLogic.c +3 -3
@@ -3078,11 +3078,11 @@ static int blogic_qcmd_lck(struct scsi_cmnd *command, ccb->opcode =BLOGIC_INITIATOR_CCB_SG ; ccb->datalen = count *sizeof (struct blogic_sg_seg );if (blogic_multimaster_type (adapter)) - ccb->data = (void *)((unsigned int ) ccb->dma_handle + + ccb->data = (unsigned int ) ccb->dma_handle + ((unsigned long ) &ccb->sglist - - (unsigned long ) ccb)); + (unsigned long ) ccb);else - ccb->data = ccb->sglist; + ccb->data =virt_to_32bit_virt (ccb->sglist);scsi_for_each_sg (command, sg, count, i) { ccb->sglist[i].segbytes =sg_dma_len (sg);
drivers/scsi/BusLogic.h +1 -1
@@ -814,7 +814,7 @@ struct blogic_ccb {unsigned char cdblen;/* Byte 2 */ unsigned char sense_datalen;/* Byte 3 */ u32 datalen;/* Bytes 4-7 */ -void *data;/* Bytes 8-11 */ +u32 data;/* Bytes 8-11 */ unsigned char:8; /* Byte 12 */ unsigned char:8; /* Byte 13 */enum blogic_adapter_status adapter_status;/* Byte 14 */
Signature · 1 line
2.17.1
Quoted 3 lines · 王文涛
From: matt <[email protected]>
Date: Tue, 20 Apr 2021 15:27:48 +0800
Subject: [PATCH] Fix 64-bit system enumeration error for Buslogic
I would update this to "scsi: BusLogic: Fix 64-bit system enumeration error for Buslogic". Martin, if you can do that when applying it to scsi-staging,
Quoted 50 lines
Commit 391e2f25601e("BusLogic: Port driver to 64-bit") in Buslogic driver introduced a serious issue for 64-bit systems. With this commit, 64-bit kernel will enumerate 8*15 non-existing disks. This is caused by the broken CCB structure. The change from u32 data to void *data increased CCB length on 64-bit system, which introduced an extra 4 byte offset of the CDB. This leads to incorrect response to Inquiry commands during enumeration.
This patch fixes the error.
Signed-off-by matt <[email protected]>--- drivers/scsi/BusLogic.c | 6 +++--- drivers/scsi/BusLogic.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)drivers/scsi/BusLogic.c +3
-3@@ -3078,11 +3078,11 @@ static int blogic_qcmd_lck(struct scsi_cmnd *command, ccb->opcode =BLOGIC_INITIATOR_CCB_SG ; ccb->datalen = count *sizeof (struct blogic_sg_seg );if (blogic_multimaster_type (adapter)) - ccb->data = (void *)((unsigned int ) ccb->dma_handle + + ccb->data = (unsigned int ) ccb->dma_handle + ((unsigned long ) &ccb->sglist - - (unsigned long ) ccb)); + (unsigned long ) ccb);else - ccb->data = ccb->sglist; + ccb->data =virt_to_32bit_virt (ccb->sglist);scsi_for_each_sg (command, sg, count, i) { ccb->sglist[i].segbytes =sg_dma_len (sg);drivers/scsi/BusLogic.h +1
-1@@ -814,7 +814,7 @@ struct blogic_ccb {unsigned char cdblen;/* Byte 2 */ unsigned char sense_datalen;/* Byte 3 */ u32 datalen;/* Bytes 4-7 */ -void *data;/* Bytes 8-11 */ +u32 data;/* Bytes 8-11 */ unsigned char:8; /* Byte 12 */ unsigned char:8; /* Byte 13 */enum blogic_adapter_status adapter_status;/* Byte 14 */