Skip to contentSkip to conversation

ahci: Fix byte count regression for ATAPI/PIO

PATCH Applied John Snow 2 participants 2 messages Nov 11, 2014

lore
Share & tools
lore

John Snow

author
#0 lore raw

PATCH 1/1 ahci: Fix byte count regression for ATAPI/PIO

This patch fixes a regression caused by commit 659142ecf71a0da240ab0ff7cf929ee25c32b9bc. The problem occurs when we wish to return early from the ahci_start_transfer function, but are now updating the transferred byte count in the AHCI command header via ahci_commit_buf.

This will cause problems in the Windows 8 installer.

Don't update the byte count in the command header for the transmission of ATAPI packets: These commands will distort the final byte count of the actual data payload.

The call to ahci_commit_buf remains in the "out" portion of the call in order to clean up the sglist. The byte count is maintained by forcing size to be 0.

---
 hw/ide/ahci.c | 1 +
 1 file changed, 1 insertion(+)
hw/ide/ahci.c +1 -0
index 61dbed1..1f3f951 100644
@@ -1089,6 +1089,7 @@ static void ahci_start_transfer(IDEDMA *dma)
     if (is_atapi && !ad->done_atapi_packet) {
         /* already prepopulated iobuffer */
         ad->done_atapi_packet = true;
+        size = 0;
         goto out;
     }
 
Signature · 1 line
1.9.3
#1 lore raw
Quoted 14 lines · John Snow

This patch fixes a regression caused by commit 659142ecf71a0da240ab0ff7cf929ee25c32b9bc. The problem occurs when we wish to return early from the ahci_start_transfer function, but are now updating the transferred byte count in the AHCI command header via ahci_commit_buf.

This will cause problems in the Windows 8 installer.

Don't update the byte count in the command header for the transmission of ATAPI packets: These commands will distort the final byte count of the actual data payload.

Quoted 8 lines

The call to ahci_commit_buf remains in the "out" portion of the call in order to clean up the sglist. The byte count is maintained by forcing size to be 0.

---
 hw/ide/ahci.c | 1 +
 1 file changed, 1 insertion(+)

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan