diff options
Diffstat (limited to 'drivers/scsi/libata-core.c')
-rw-r--r-- | drivers/scsi/libata-core.c | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 175d4646333..09639e7aaa7 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -1082,6 +1082,31 @@ static inline void ata_dump_id(struct ata_device *dev) | |||
1082 | dev->id[93]); | 1082 | dev->id[93]); |
1083 | } | 1083 | } |
1084 | 1084 | ||
1085 | /* | ||
1086 | * Compute the PIO modes available for this device. This is not as | ||
1087 | * trivial as it seems if we must consider early devices correctly. | ||
1088 | * | ||
1089 | * FIXME: pre IDE drive timing (do we care ?). | ||
1090 | */ | ||
1091 | |||
1092 | static unsigned int ata_pio_modes(struct ata_device *adev) | ||
1093 | { | ||
1094 | u16 modes; | ||
1095 | |||
1096 | /* Usual case. Word 53 indicates word 88 is valid */ | ||
1097 | if (adev->id[ATA_ID_FIELD_VALID] & (1 << 2)) { | ||
1098 | modes = adev->id[ATA_ID_PIO_MODES] & 0x03; | ||
1099 | modes <<= 3; | ||
1100 | modes |= 0x7; | ||
1101 | return modes; | ||
1102 | } | ||
1103 | |||
1104 | /* If word 88 isn't valid then Word 51 holds the PIO timing number | ||
1105 | for the maximum. Turn it into a mask and return it */ | ||
1106 | modes = (2 << (adev->id[ATA_ID_OLD_PIO_MODES] & 0xFF)) - 1 ; | ||
1107 | return modes; | ||
1108 | } | ||
1109 | |||
1085 | /** | 1110 | /** |
1086 | * ata_dev_identify - obtain IDENTIFY x DEVICE page | 1111 | * ata_dev_identify - obtain IDENTIFY x DEVICE page |
1087 | * @ap: port on which device we wish to probe resides | 1112 | * @ap: port on which device we wish to probe resides |
@@ -1215,10 +1240,8 @@ retry: | |||
1215 | xfer_modes = dev->id[ATA_ID_UDMA_MODES]; | 1240 | xfer_modes = dev->id[ATA_ID_UDMA_MODES]; |
1216 | if (!xfer_modes) | 1241 | if (!xfer_modes) |
1217 | xfer_modes = (dev->id[ATA_ID_MWDMA_MODES]) << ATA_SHIFT_MWDMA; | 1242 | xfer_modes = (dev->id[ATA_ID_MWDMA_MODES]) << ATA_SHIFT_MWDMA; |
1218 | if (!xfer_modes) { | 1243 | if (!xfer_modes) |
1219 | xfer_modes = (dev->id[ATA_ID_PIO_MODES]) << (ATA_SHIFT_PIO + 3); | 1244 | xfer_modes = ata_pio_modes(dev); |
1220 | xfer_modes |= (0x7 << ATA_SHIFT_PIO); | ||
1221 | } | ||
1222 | 1245 | ||
1223 | ata_dump_id(dev); | 1246 | ata_dump_id(dev); |
1224 | 1247 | ||