Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 21843
b: refs/heads/master
c: 2940740
h: refs/heads/master
i:
  21841: 55f1e2c
  21839: 03e0b7b
v: v3
  • Loading branch information
Tejun Heo authored and Jeff Garzik committed Feb 12, 2006
1 parent 095fc07 commit a83fcf5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 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: 2e02671daa2cd69d93c828c40579bbe953f17210
refs/heads/master: 2940740bcaa5948967d261dfceec04f40b2d2fa1
26 changes: 18 additions & 8 deletions trunk/drivers/scsi/libata-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,21 @@ void ata_dev_id_c_string(const u16 *id, unsigned char *s,
*p = '\0';
}

static u64 ata_id_n_sectors(const u16 *id)
{
if (ata_id_has_lba(id)) {
if (ata_id_has_lba48(id))
return ata_id_u64(id, 100);
else
return ata_id_u32(id, 60);
} else {
if (ata_id_current_chs_valid(id))
return ata_id_u32(id, 57);
else
return id[1] * id[3] * id[6];
}
}

/**
* ata_noop_dev_select - Select device 0/1 on ATA bus
* @ap: ATA channel to manipulate
Expand Down Expand Up @@ -1009,6 +1024,8 @@ static void ata_dev_identify(struct ata_port *ap, unsigned int device)

/* ATA-specific feature tests */
if (dev->class == ATA_DEV_ATA) {
dev->n_sectors = ata_id_n_sectors(dev->id);

if (!ata_id_is_ata(dev->id)) /* sanity check */
goto err_out_nosup;

Expand Down Expand Up @@ -1038,12 +1055,8 @@ static void ata_dev_identify(struct ata_port *ap, unsigned int device)
if (ata_id_has_lba(dev->id)) {
dev->flags |= ATA_DFLAG_LBA;

if (ata_id_has_lba48(dev->id)) {
if (ata_id_has_lba48(dev->id))
dev->flags |= ATA_DFLAG_LBA48;
dev->n_sectors = ata_id_u64(dev->id, 100);
} else {
dev->n_sectors = ata_id_u32(dev->id, 60);
}

/* print device info to dmesg */
printk(KERN_INFO "ata%u: dev %u ATA-%d, max %s, %Lu sectors:%s\n",
Expand All @@ -1059,15 +1072,12 @@ static void ata_dev_identify(struct ata_port *ap, unsigned int device)
dev->cylinders = dev->id[1];
dev->heads = dev->id[3];
dev->sectors = dev->id[6];
dev->n_sectors = dev->cylinders * dev->heads * dev->sectors;

if (ata_id_current_chs_valid(dev->id)) {
/* Current CHS translation is valid. */
dev->cylinders = dev->id[54];
dev->heads = dev->id[55];
dev->sectors = dev->id[56];

dev->n_sectors = ata_id_u32(dev->id, 57);
}

/* print device info to dmesg */
Expand Down

0 comments on commit a83fcf5

Please sign in to comment.