]> nv-tegra.nvidia Code Review - linux-2.6.git/commitdiff
/spare/repo/libata-dev branch 'v2.6.13'
authorJeff Garzik <jgarzik@pobox.com>
Mon, 29 Aug 2005 20:12:36 +0000 (16:12 -0400)
committerJeff Garzik <jgarzik@pobox.com>
Mon, 29 Aug 2005 20:12:36 +0000 (16:12 -0400)
1  2 
drivers/scsi/libata-core.c
drivers/scsi/libata-scsi.c

Simple merge
index 5367c10e4db85db08ee0be44654daffb07928af3,6a75ec2187fde5451b1ae77443ecc8aceb96e319..954d1bca3b2a4616df8cfae13ec7882a798bb287
@@@ -1234,24 -1171,18 +1235,28 @@@ unsigned int ata_scsiop_read_cap(struc
  
        VPRINTK("ENTER\n");
  
 -      if (ata_id_has_lba48(args->id))
 -              n_sectors = ata_id_u64(args->id, 100);
 -      else
 -              n_sectors = ata_id_u32(args->id, 60);
 +      if (ata_id_has_lba(args->id)) {
 +              if (ata_id_has_lba48(args->id))
 +                      n_sectors = ata_id_u64(args->id, 100);
 +              else
 +                      n_sectors = ata_id_u32(args->id, 60);
 +      } else {
 +              /* CHS default translation */
 +              n_sectors = args->id[1] * args->id[3] * args->id[6];
 +
 +              if (ata_id_current_chs_valid(args->id))
 +                      /* CHS current translation */
 +                      n_sectors = ata_id_u32(args->id, 57);
 +      }
 +
        n_sectors--;            /* ATA TotalUserSectors - 1 */
  
-       tmp = n_sectors;        /* note: truncates, if lba48 */
        if (args->cmd->cmnd[0] == READ_CAPACITY) {
+               if( n_sectors >= 0xffffffffULL )
+                       tmp = 0xffffffff ;  /* Return max count on overflow */
+               else
+                       tmp = n_sectors ;
                /* sector count, 32-bit */
                rbuf[0] = tmp >> (8 * 3);
                rbuf[1] = tmp >> (8 * 2);