aboutsummaryrefslogtreecommitdiff
path: root/drivers/scsi
diff options
context:
space:
mode:
authorStefan Roese2021-04-07 09:12:36 +0200
committerDaniel Schwierzeck2021-04-23 21:22:55 +0200
commitdc0731ec256f7e6050859ee37f61cd866e7608ed (patch)
treebea48afd3769610d8fd74feb452e8531048198ce /drivers/scsi
parent1cf2700f269e8f81cf99a68b8746c80e12c410be (diff)
scsi: Add ata_swap_buf_le16() to support big-endian platforms
Otherwise the output will look like this on MIPS Octeon NIC23: Device 0: (0:0) Vendor: ATA Prod.: aSDnsi klUrt aII Rev: 4X11 Type: Hard Disk Capacity: 457862.8 MB = 447.1 GB (937703088 x 512) instead of this version: Device 0: (0:0) Vendor: TA Prod.: SanDisk Ultra II Rev: X411 Type: Hard Disk Capacity: 457862.8 MB = 447.1 GB (937703088 x 512) Signed-off-by: Stefan Roese <sr@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Aaron Williams <awilliams@marvell.com> Cc: Chandrakala Chavva <cchavva@marvell.com> Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/scsi.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 73894844905..ce69750c7ff 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -9,6 +9,7 @@
#include <bootstage.h>
#include <dm.h>
#include <env.h>
+#include <libata.h>
#include <log.h>
#include <part.h>
#include <pci.h>
@@ -594,6 +595,11 @@ static int do_scsi_scan_one(struct udevice *dev, int id, int lun, bool verbose)
memcpy(&bdesc->vendor, &bd.vendor, sizeof(bd.vendor));
memcpy(&bdesc->product, &bd.product, sizeof(bd.product));
memcpy(&bdesc->revision, &bd.revision, sizeof(bd.revision));
+ if (IS_ENABLED(CONFIG_SYS_BIG_ENDIAN)) {
+ ata_swap_buf_le16((u16 *)&bdesc->vendor, sizeof(bd.vendor) / 2);
+ ata_swap_buf_le16((u16 *)&bdesc->product, sizeof(bd.product) / 2);
+ ata_swap_buf_le16((u16 *)&bdesc->revision, sizeof(bd.revision) / 2);
+ }
if (verbose) {
printf(" Device %d: ", bdesc->devnum);