ide: ide_dev_is_sata() -> ata_id_is_sata()

* Use optimized ATA version check from Sergei in ata_id_is_sata().

* ide_dev_is_sata() -> ata_id_is_sata()

Cc: Jeff Garzik <jgarzik@pobox.com>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent 5d5870f0
...@@ -630,7 +630,7 @@ u8 eighty_ninty_three (ide_drive_t *drive) ...@@ -630,7 +630,7 @@ u8 eighty_ninty_three (ide_drive_t *drive)
printk(KERN_DEBUG "%s: skipping word 93 validity check\n", printk(KERN_DEBUG "%s: skipping word 93 validity check\n",
drive->name); drive->name);
if (ide_dev_is_sata(id) && !ivb) if (ata_id_is_sata(id) && !ivb)
return 1; return 1;
if (hwif->cbl != ATA_CBL_PATA80 && !ivb) if (hwif->cbl != ATA_CBL_PATA80 && !ivb)
......
...@@ -654,7 +654,7 @@ static u8 hpt3xx_udma_filter(ide_drive_t *drive) ...@@ -654,7 +654,7 @@ static u8 hpt3xx_udma_filter(ide_drive_t *drive)
case HPT372A: case HPT372A:
case HPT372N: case HPT372N:
case HPT374 : case HPT374 :
if (ide_dev_is_sata(drive->id)) if (ata_id_is_sata(drive->id))
mask &= ~0x0e; mask &= ~0x0e;
/* Fall thru */ /* Fall thru */
default: default:
...@@ -674,7 +674,7 @@ static u8 hpt3xx_mdma_filter(ide_drive_t *drive) ...@@ -674,7 +674,7 @@ static u8 hpt3xx_mdma_filter(ide_drive_t *drive)
case HPT372A: case HPT372A:
case HPT372N: case HPT372N:
case HPT374 : case HPT374 :
if (ide_dev_is_sata(drive->id)) if (ata_id_is_sata(drive->id))
return 0x00; return 0x00;
/* Fall thru */ /* Fall thru */
default: default:
......
...@@ -645,7 +645,15 @@ static inline unsigned int ata_id_major_version(const u16 *id) ...@@ -645,7 +645,15 @@ static inline unsigned int ata_id_major_version(const u16 *id)
static inline int ata_id_is_sata(const u16 *id) static inline int ata_id_is_sata(const u16 *id)
{ {
return ata_id_major_version(id) >= 5 && id[ATA_ID_HW_CONFIG] == 0; /*
* See if word 93 is 0 AND drive is at least ATA-5 compatible
* verifying that word 80 by casting it to a signed type --
* this trick allows us to filter out the reserved values of
* 0x0000 and 0xffff along with the earlier ATA revisions...
*/
if (id[ATA_ID_HW_CONFIG] == 0 && (short)id[ATA_ID_MAJOR_VER] >= 0x0020)
return 1;
return 0;
} }
static inline int ata_id_has_tpm(const u16 *id) static inline int ata_id_has_tpm(const u16 *id)
......
...@@ -1382,19 +1382,6 @@ const char *ide_xfer_verbose(u8 mode); ...@@ -1382,19 +1382,6 @@ const char *ide_xfer_verbose(u8 mode);
extern void ide_toggle_bounce(ide_drive_t *drive, int on); extern void ide_toggle_bounce(ide_drive_t *drive, int on);
extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate); extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate);
static inline int ide_dev_is_sata(u16 *id)
{
/*
* See if word 93 is 0 AND drive is at least ATA-5 compatible
* verifying that word 80 by casting it to a signed type --
* this trick allows us to filter out the reserved values of
* 0x0000 and 0xffff along with the earlier ATA revisions...
*/
if (id[ATA_ID_HW_CONFIG] == 0 && (short)id[ATA_ID_MAJOR_VER] >= 0x0020)
return 1;
return 0;
}
u64 ide_get_lba_addr(struct ide_taskfile *, int); u64 ide_get_lba_addr(struct ide_taskfile *, int);
u8 ide_dump_status(ide_drive_t *, const char *, u8); u8 ide_dump_status(ide_drive_t *, const char *, u8);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment