mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-13 15:03:58 +03:00
Merge patch series "scsi: Replace SYNC_CACHE with FUA for scsi write"
Balaji Selvanathan <balaji.selvanathan@oss.qualcomm.com> says: This series replaces the SYNC_CACHE approach with FUA (Force Unit Access) to prevent data loss during board resets while avoiding system hangs during large sparse image flashing operations. The previous SYNC_CACHE implementation caused timeouts and hangs when flashing large sparse images because it issued cache sync commands after every write operation. The FUA approach achieves the same data integrity goal by setting the FUA bit in WRITE10 commands. Link: https://lore.kernel.org/r/20260416-enable_fua-v3-0-84508de2bfd9@oss.qualcomm.com
This commit is contained in:
@@ -82,23 +82,6 @@ static void scsi_setup_inquiry(struct scsi_cmd *pccb)
|
||||
pccb->msgout[0] = SCSI_IDENTIFY; /* NOT USED */
|
||||
}
|
||||
|
||||
static void scsi_setup_sync_cache(struct scsi_cmd *pccb, lbaint_t start,
|
||||
lbaint_t blocks)
|
||||
{
|
||||
pccb->cmd[0] = SCSI_SYNC_CACHE;
|
||||
pccb->cmd[1] = 0;
|
||||
pccb->cmd[2] = (unsigned char)(start >> 24) & 0xff;
|
||||
pccb->cmd[3] = (unsigned char)(start >> 16) & 0xff;
|
||||
pccb->cmd[4] = (unsigned char)(start >> 8) & 0xff;
|
||||
pccb->cmd[5] = (unsigned char)start & 0xff;
|
||||
pccb->cmd[6] = 0;
|
||||
pccb->cmd[7] = (unsigned char)(blocks >> 8) & 0xff;
|
||||
pccb->cmd[8] = (unsigned char)blocks & 0xff;
|
||||
pccb->cmd[9] = 0;
|
||||
pccb->cmdlen = 10;
|
||||
pccb->msgout[0] = SCSI_IDENTIFY; /* NOT USED */
|
||||
}
|
||||
|
||||
static void scsi_setup_read_ext(struct scsi_cmd *pccb, lbaint_t start,
|
||||
lbaint_t blocks)
|
||||
{
|
||||
@@ -124,7 +107,7 @@ static void scsi_setup_write_ext(struct scsi_cmd *pccb, lbaint_t start,
|
||||
lbaint_t blocks)
|
||||
{
|
||||
pccb->cmd[0] = SCSI_WRITE10;
|
||||
pccb->cmd[1] = 0;
|
||||
pccb->cmd[1] = 0x08; /* Set FUA bit to bypass write cache */
|
||||
pccb->cmd[2] = (unsigned char)(start >> 24) & 0xff;
|
||||
pccb->cmd[3] = (unsigned char)(start >> 16) & 0xff;
|
||||
pccb->cmd[4] = (unsigned char)(start >> 8) & 0xff;
|
||||
@@ -301,11 +284,6 @@ static ulong scsi_write(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt,
|
||||
buf_addr += pccb->datalen;
|
||||
} while (blks != 0);
|
||||
|
||||
/* Flush the SCSI cache so we don't lose data on board reset. */
|
||||
scsi_setup_sync_cache(pccb, 0, 0);
|
||||
if (scsi_exec(bdev, pccb))
|
||||
scsi_print_error(pccb);
|
||||
|
||||
debug("%s: end startblk " LBAF ", blccnt " LBAF " buffer %lX\n",
|
||||
__func__, start, blocks, buf_addr);
|
||||
return blkcnt;
|
||||
|
||||
Reference in New Issue
Block a user