summary refs log tree commit diff stats
path: root/tests/libqos/ahci.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2015-07-08 19:44:28 +0100
committerPeter Maydell <peter.maydell@linaro.org>2015-07-08 19:44:28 +0100
commitc8e84287da7dd6a46c0bb0e53190e79ba4eedf24 (patch)
tree2e5d2db6fa9dfd0b1fa2c995b5a43c6a666aebf5 /tests/libqos/ahci.c
parentd09952ee8caeea928695d5a3dc3ec50d8afb98c6 (diff)
parent702c8c8be2f3317c81fff83f82d8a5f1d50d41b8 (diff)
downloadfocaccia-qemu-c8e84287da7dd6a46c0bb0e53190e79ba4eedf24.tar.gz
focaccia-qemu-c8e84287da7dd6a46c0bb0e53190e79ba4eedf24.zip
Merge remote-tracking branch 'remotes/jnsnow/tags/ide-pull-request' into staging
# gpg: Signature made Wed Jul  8 19:08:28 2015 BST using RSA key ID AAFC390E
# gpg: Good signature from "John Snow (John Huston) <jsnow@redhat.com>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: FAEB 9711 A12C F475 812F  18F2 88A9 064D 1835 61EB
#      Subkey fingerprint: F9B7 ABDB BCAC DF95 BE76  CBD0 7DEF 8106 AAFC 390E

* remotes/jnsnow/tags/ide-pull-request:
  ahci: Fix CD-ROM signature
  libqos/ahci: fix ahci_write_fis for ncq on ppc64

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests/libqos/ahci.c')
-rw-r--r--tests/libqos/ahci.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/tests/libqos/ahci.c b/tests/libqos/ahci.c
index 33ecd2abfb..cf66b3e32c 100644
--- a/tests/libqos/ahci.c
+++ b/tests/libqos/ahci.c
@@ -545,16 +545,18 @@ void ahci_destroy_command(AHCIQState *ahci, uint8_t port, uint8_t slot)
     ahci->port[port].prdtl[slot] = 0;
 }
 
-void ahci_write_fis(AHCIQState *ahci, RegH2DFIS *fis, uint64_t addr)
+void ahci_write_fis(AHCIQState *ahci, AHCICommand *cmd)
 {
-    RegH2DFIS tmp = *fis;
+    RegH2DFIS tmp = cmd->fis;
+    uint64_t addr = cmd->header.ctba;
 
-    /* The auxiliary FIS fields are defined per-command and are not
-     * currently implemented in libqos/ahci.o, but may or may not need
-     * to be flipped. */
-
-    /* All other FIS fields are 8 bit and do not need to be flipped. */
-    tmp.count = cpu_to_le16(tmp.count);
+    /* NCQ commands use exclusively 8 bit fields and needs no adjustment.
+     * Only the count field needs to be adjusted for non-NCQ commands.
+     * The auxiliary FIS fields are defined per-command and are not currently
+     * implemented in libqos/ahci.o, but may or may not need to be flipped. */
+    if (!cmd->props->ncq) {
+        tmp.count = cpu_to_le16(tmp.count);
+    }
 
     memwrite(addr, &tmp, sizeof(tmp));
 }
@@ -877,7 +879,7 @@ void ahci_command_commit(AHCIQState *ahci, AHCICommand *cmd, uint8_t port)
 
     /* Commit the command header and command FIS */
     ahci_set_command_header(ahci, port, cmd->slot, &(cmd->header));
-    ahci_write_fis(ahci, &(cmd->fis), table_ptr);
+    ahci_write_fis(ahci, cmd);
 
     /* Construct and write the PRDs to the command table */
     g_assert_cmphex(prdtl, ==, cmd->header.prdtl);