Skip to content

Commit

Permalink
Change prdbc value reporting.
Browse files Browse the repository at this point in the history
MFC after:	2 weeks
  • Loading branch information
amotin committed Mar 13, 2015
1 parent 7d3392b commit 358865b
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions usr.sbin/bhyve/pci_ahci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1662,6 +1662,9 @@ ata_ioreq_cb(struct blockif_req *br, int err)
*/
STAILQ_INSERT_TAIL(&p->iofhd, aior, io_flist);

if (!err)
hdr->prdbc = aior->done;

if (dsm) {
if (aior->done != aior->len && !err) {
ahci_handle_dsm_trim(p, slot, cfis, aior->done);
Expand All @@ -1677,13 +1680,8 @@ ata_ioreq_cb(struct blockif_req *br, int err)

if (!err && aior->done == aior->len) {
tfd = ATA_S_READY | ATA_S_DSC;
if (ncq)
hdr->prdbc = 0;
else
hdr->prdbc = aior->len;
} else {
tfd = (ATA_E_ABORT << 8) | ATA_S_READY | ATA_S_ERROR;
hdr->prdbc = 0;
if (ncq)
p->serr |= (1 << slot);
}
Expand Down Expand Up @@ -1738,19 +1736,20 @@ atapi_ioreq_cb(struct blockif_req *br, int err)
*/
STAILQ_INSERT_TAIL(&p->iofhd, aior, io_flist);

if (!err)
hdr->prdbc = aior->done;

if (pending && !err) {
atapi_read(p, slot, cfis, aior->done, hdr->prdtl - pending);
goto out;
}

if (!err && aior->done == aior->len) {
tfd = ATA_S_READY | ATA_S_DSC;
hdr->prdbc = aior->len;
} else {
p->sense_key = ATA_SENSE_ILLEGAL_REQUEST;
p->asc = 0x21;
tfd = (p->sense_key << 12) | ATA_S_READY | ATA_S_ERROR;
hdr->prdbc = 0;
}

cfis[4] = (cfis[4] & ~7) | ATA_I_CMD | ATA_I_IN;
Expand Down

0 comments on commit 358865b

Please sign in to comment.