Merge tag 'mips_fixes_5.9_2' of git://git.kernel.org/pub/scm/linux/kernel/git/mips...
[linux-2.6-microblaze.git] / drivers / ata / libata-scsi.c
index 4ce4cd3..7043191 100644 (file)
@@ -2080,6 +2080,7 @@ static unsigned int ata_scsiop_inq_89(struct ata_scsi_args *args, u8 *rbuf)
 
 static unsigned int ata_scsiop_inq_b0(struct ata_scsi_args *args, u8 *rbuf)
 {
+       struct ata_device *dev = args->dev;
        u16 min_io_sectors;
 
        rbuf[1] = 0xb0;
@@ -2105,7 +2106,12 @@ static unsigned int ata_scsiop_inq_b0(struct ata_scsi_args *args, u8 *rbuf)
         * with the unmap bit set.
         */
        if (ata_id_has_trim(args->id)) {
-               put_unaligned_be64(65535 * ATA_MAX_TRIM_RNUM, &rbuf[36]);
+               u64 max_blocks = 65535 * ATA_MAX_TRIM_RNUM;
+
+               if (dev->horkage & ATA_HORKAGE_MAX_TRIM_128M)
+                       max_blocks = 128 << (20 - SECTOR_SHIFT);
+
+               put_unaligned_be64(max_blocks, &rbuf[36]);
                put_unaligned_be32(1, &rbuf[28]);
        }