Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 145027
b: refs/heads/master
c: 61d79a8
h: refs/heads/master
i:
  145025: 52e37d3
  145023: 3c80fb7
v: v3
  • Loading branch information
Martin K. Petersen authored and Jeff Garzik committed May 15, 2009
1 parent 6564c02 commit 4881ad4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d358724385d9bb3e360f5b95c17ec4f77c913460
refs/heads/master: 61d79a8eb362f826a002d3d14c4f9a070a818542
23 changes: 22 additions & 1 deletion trunk/drivers/ata/libata-scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -2376,7 +2376,23 @@ static unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf)
*/
static unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf)
{
u64 last_lba = args->dev->n_sectors - 1; /* LBA of the last block */
struct ata_device *dev = args->dev;
u64 last_lba = dev->n_sectors - 1; /* LBA of the last block */
u8 log_per_phys = 0;
u16 lowest_aligned = 0;
u16 word_106 = dev->id[106];
u16 word_209 = dev->id[209];

if ((word_106 & 0xc000) == 0x4000) {
/* Number and offset of logical sectors per physical sector */
if (word_106 & (1 << 13))
log_per_phys = word_106 & 0xf;
if ((word_209 & 0xc000) == 0x4000) {
u16 first = dev->id[209] & 0x3fff;
if (first > 0)
lowest_aligned = (1 << log_per_phys) - first;
}
}

VPRINTK("ENTER\n");

Expand Down Expand Up @@ -2407,6 +2423,11 @@ static unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf)
/* sector size */
rbuf[10] = ATA_SECT_SIZE >> 8;
rbuf[11] = ATA_SECT_SIZE & 0xff;

rbuf[12] = 0;
rbuf[13] = log_per_phys;
rbuf[14] = (lowest_aligned >> 8) & 0x3f;
rbuf[15] = lowest_aligned;
}

return 0;
Expand Down

0 comments on commit 4881ad4

Please sign in to comment.