Properly report SATA connection speed.

This commit is contained in:
Søren Schmidt 2006-01-18 10:02:23 +00:00
parent d0b8e03914
commit ac1731fb20
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=154511

View File

@ -338,9 +338,18 @@ ata_sata_setmode(device_t dev, int mode)
*/
if (atadev->param.satacapabilities != 0x0000 &&
atadev->param.satacapabilities != 0xffff) {
if (!ata_controlcmd(dev, ATA_SETFEATURES, ATA_SF_SETXFER, 0,
ata_limit_mode(dev, mode, ATA_UDMA6)))
/* XXX SOS we should query SATA STATUS for the speed */
struct ata_channel *ch = device_get_softc(device_get_parent(dev));
int status;
/* on some drives we need to set the transfer mode */
ata_controlcmd(dev, ATA_SETFEATURES, ATA_SF_SETXFER, 0,
ata_limit_mode(dev, mode, ATA_UDMA6));
/* query SATA STATUS for the speed */
status = ATA_IDX_INL(ch, ATA_SSTATUS);
if ((status & ATA_SS_CONWELL_MASK) == ATA_SS_CONWELL_GEN2)
atadev->mode = ATA_SA300;
else
atadev->mode = ATA_SA150;
}
else {