From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Roese Date: Wed, 7 Apr 2021 09:12:36 +0200 Subject: [PATCH v1 10/15] scsi: Add ata_swap_buf_le16() to support big-endian platforms In-Reply-To: <20210407071241.536752-1-sr@denx.de> References: <20210407071241.536752-1-sr@denx.de> Message-ID: <20210407071241.536752-11-sr@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 Cc: Simon Glass Cc: Aaron Williams Cc: Chandrakala Chavva Cc: Daniel Schwierzeck --- drivers/scsi/scsi.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 738948449053..ce69750c7ff0 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -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); -- 2.31.1