aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2016-07-17 14:13:47 +0000
committerAlexander Motin <mav@FreeBSD.org>2016-07-17 14:13:47 +0000
commit6d6fccace25ad90b8b6706651d552310dbef3c0c (patch)
tree52859724f18e75a358d0644bfbdd238f1b602917 /usr.sbin
parentefafbd0a871888db6fe8a52b241528b86a17bcb1 (diff)
downloadsrc-6d6fccace25ad90b8b6706651d552310dbef3c0c.tar.gz
src-6d6fccace25ad90b8b6706651d552310dbef3c0c.zip
Fix NCQ TRIM emulation.
When this code was written, there was no guests using it to test.
Notes
Notes: svn path=/head/; revision=302957
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bhyve/pci_ahci.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/usr.sbin/bhyve/pci_ahci.c b/usr.sbin/bhyve/pci_ahci.c
index f831eaf087ca..681deabe7cfd 100644
--- a/usr.sbin/bhyve/pci_ahci.c
+++ b/usr.sbin/bhyve/pci_ahci.c
@@ -837,7 +837,15 @@ next:
done += 8;
if (elen == 0) {
if (done >= len) {
- ahci_write_fis_d2h(p, slot, cfis, ATA_S_READY | ATA_S_DSC);
+ if (ncq) {
+ if (first)
+ ahci_write_fis_d2h_ncq(p, slot);
+ ahci_write_fis_sdb(p, slot, cfis,
+ ATA_S_READY | ATA_S_DSC);
+ } else {
+ ahci_write_fis_d2h(p, slot, cfis,
+ ATA_S_READY | ATA_S_DSC);
+ }
p->pending &= ~(1 << slot);
ahci_check_stopped(p);
if (!first)
@@ -1718,7 +1726,7 @@ ahci_handle_cmd(struct ahci_port *p, int slot, uint8_t *cfis)
case ATA_SEND_FPDMA_QUEUED:
if ((cfis[13] & 0x1f) == ATA_SFPDMA_DSM &&
cfis[17] == 0 && cfis[16] == ATA_DSM_TRIM &&
- cfis[11] == 0 && cfis[13] == 1) {
+ cfis[11] == 0 && cfis[3] == 1) {
ahci_handle_dsm_trim(p, slot, cfis, 0);
break;
}