aboutsummaryrefslogtreecommitdiff
path: root/tests/libqos/ahci.c
diff options
context:
space:
mode:
authorJohn Snow <jsnow@redhat.com>2015-02-05 12:41:21 -0500
committerStefan Hajnoczi <stefanha@redhat.com>2015-02-16 15:07:17 +0000
commit52515766f1e18b596a6dc31421ca14a63114c9eb (patch)
tree651c3dc0fc798901afea7aefa4e652bf9dd98728 /tests/libqos/ahci.c
parent36e367261c15f0fa9acfbe9f4301c96e19be7f52 (diff)
qtest/ahci: add ahci_write_fis
Similar to ahci_set_command_header, add a helper that takes an in-memory representation of a command FIS and writes it to guest memory, handling endianness as-needed. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1423158090-25580-11-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'tests/libqos/ahci.c')
-rw-r--r--tests/libqos/ahci.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/libqos/ahci.c b/tests/libqos/ahci.c
index 8ecfdd30d8..1294f8083c 100644
--- a/tests/libqos/ahci.c
+++ b/tests/libqos/ahci.c
@@ -464,6 +464,20 @@ 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)
+{
+ RegH2DFIS tmp = *fis;
+
+ /* 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);
+
+ memwrite(addr, &tmp, sizeof(tmp));
+}
+
unsigned ahci_pick_cmd(AHCIQState *ahci, uint8_t port)
{
unsigned i;