Skip to content

Commit

Permalink
scsi: Cache align temporary buffer
Browse files Browse the repository at this point in the history
The temporary buffer may be passed to DMA capable device,
make sure it is cache aligned.

Signed-off-by: Marek Vasut <[email protected]>
  • Loading branch information
Marek Vasut authored and trini committed Aug 17, 2023
1 parent 4b316f1 commit 02660de
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/scsi/scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <env.h>
#include <libata.h>
#include <log.h>
#include <memalign.h>
#include <part.h>
#include <pci.h>
#include <scsi.h>
Expand Down Expand Up @@ -42,7 +43,7 @@ const struct pci_device_id scsi_device_list[] = { SCSI_DEV_LIST };
#endif
static struct scsi_cmd tempccb; /* temporary scsi command buffer */

static unsigned char tempbuff[512]; /* temporary data buffer */
DEFINE_CACHE_ALIGN_BUFFER(u8, tempbuff, 512); /* temporary data buffer */

#if !defined(CONFIG_DM_SCSI)
static int scsi_max_devs; /* number of highest available scsi device */
Expand Down Expand Up @@ -490,7 +491,7 @@ static int scsi_detect_dev(struct udevice *dev, int target, int lun,

pccb->target = target;
pccb->lun = lun;
pccb->pdata = (unsigned char *)&tempbuff;
pccb->pdata = tempbuff;
pccb->datalen = 512;
pccb->dma_dir = DMA_FROM_DEVICE;
scsi_setup_inquiry(pccb);
Expand Down

0 comments on commit 02660de

Please sign in to comment.