Improve output for controllers that doesn't report SATA speed.

This commit is contained in:
mav 2010-02-22 10:45:40 +00:00
parent 6fc9b03b75
commit 6941483833
6 changed files with 23 additions and 6 deletions

View File

@ -72,6 +72,7 @@ satarev2str(int mode)
case 1: return "SATA 1.5Gb/s";
case 2: return "SATA 3Gb/s";
case 3: return "SATA 6Gb/s";
case 0xff: return "SATA";
default: return "???";
}
}

View File

@ -1022,6 +1022,8 @@ camxferrate(struct cam_device *device)
printf(" (");
if (sata->valid & CTS_SATA_VALID_REVISION)
printf("SATA %d.x, ", sata->revision);
else
printf("SATA, ");
if (sata->valid & CTS_SATA_VALID_MODE)
printf("%s, ", ata_mode2string(sata->mode));
if ((sata->valid & CTS_SATA_VALID_ATAPI) && sata->atapi != 0)

View File

@ -1219,6 +1219,8 @@ xpt_announce_periph(struct cam_periph *periph, char *announce_string)
printf(" (");
if (sata->valid & CTS_SATA_VALID_REVISION)
printf("SATA %d.x, ", sata->revision);
else
printf("SATA, ");
if (sata->valid & CTS_SATA_VALID_MODE)
printf("%s, ", ata_mode2string(sata->mode));
if ((sata->valid & CTS_ATA_VALID_ATAPI) && sata->atapi != 0)

View File

@ -1160,6 +1160,7 @@ ata_satarev2str(int rev)
case 1: return "SATA 1.5Gb/s";
case 2: return "SATA 3Gb/s";
case 3: return "SATA 6Gb/s";
case 0xff: return "SATA";
default: return "???";
}
}
@ -1536,6 +1537,7 @@ ataaction(struct cam_sim *sim, union ccb *ccb)
if (ch->flags & ATA_SATA) {
cts->transport = XPORT_SATA;
cts->transport_version = XPORT_VERSION_UNSPECIFIED;
cts->xport_specific.sata.valid = 0;
cts->xport_specific.sata.mode = d->mode;
cts->xport_specific.sata.valid |= CTS_SATA_VALID_MODE;
cts->xport_specific.sata.bytecount = d->bytecount;
@ -1543,14 +1545,20 @@ ataaction(struct cam_sim *sim, union ccb *ccb)
if (cts->type == CTS_TYPE_CURRENT_SETTINGS) {
cts->xport_specific.sata.revision =
ATA_GETREV(dev, ccb->ccb_h.target_id);
} else
if (cts->xport_specific.sata.revision != 0xff) {
cts->xport_specific.sata.valid |=
CTS_SATA_VALID_REVISION;
}
} else {
cts->xport_specific.sata.revision = d->revision;
cts->xport_specific.sata.valid |= CTS_SATA_VALID_REVISION;
cts->xport_specific.sata.valid |= CTS_SATA_VALID_REVISION;
}
cts->xport_specific.sata.atapi = d->atapi;
cts->xport_specific.sata.valid |= CTS_SATA_VALID_ATAPI;
} else {
cts->transport = XPORT_ATA;
cts->transport_version = XPORT_VERSION_UNSPECIFIED;
cts->xport_specific.ata.valid = 0;
cts->xport_specific.ata.mode = d->mode;
cts->xport_specific.ata.valid |= CTS_ATA_VALID_MODE;
cts->xport_specific.ata.bytecount = d->bytecount;

View File

@ -714,10 +714,14 @@ static int
ata_pcichannel_getrev(device_t dev, int target)
{
struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
struct ata_channel *ch = device_get_softc(dev);
if (ctlr->getrev)
return (ctlr->getrev(dev, target));
else
if (ch->flags & ATA_SATA) {
if (ctlr->getrev)
return (ctlr->getrev(dev, target));
else
return (0xff);
} else
return (0);
}

View File

@ -223,7 +223,7 @@ ata_sata_getrev(device_t dev, int target)
if (ch->r_io[ATA_SSTATUS].res)
return ((ATA_IDX_INL(ch, ATA_SSTATUS) & 0x0f0) >> 4);
return (0);
return (0xff);
}
int