[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 29/65] qtest/ahci: add ahci_write_fis
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 29/65] qtest/ahci: add ahci_write_fis |
Date: |
Fri, 13 Feb 2015 16:24:25 +0000 |
From: John Snow <address@hidden>
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 <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
tests/ahci-test.c | 2 +-
tests/libqos/ahci.c | 14 ++++++++++++++
tests/libqos/ahci.h | 3 ++-
3 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/tests/ahci-test.c b/tests/ahci-test.c
index 211274e..658956d 100644
--- a/tests/ahci-test.c
+++ b/tests/ahci-test.c
@@ -728,7 +728,7 @@ static void ahci_test_identify(AHCIQState *ahci)
g_assert_cmphex(ahci_px_rreg(ahci, i, AHCI_PX_IS), ==, 0);
/* Commit the Command FIS to the Command Table */
- memwrite(table, &fis, sizeof(fis));
+ ahci_write_fis(ahci, &fis, table);
/* Commit the PRD entry to the Command Table */
memwrite(table + 0x80, &prd, sizeof(prd));
diff --git a/tests/libqos/ahci.c b/tests/libqos/ahci.c
index 36a7c93..ac32849 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;
diff --git a/tests/libqos/ahci.h b/tests/libqos/ahci.h
index 0837bf5..83a62ac 100644
--- a/tests/libqos/ahci.h
+++ b/tests/libqos/ahci.h
@@ -393,7 +393,7 @@ typedef struct RegH2DFIS {
uint8_t icc;
uint8_t control;
/* DW4 */
- uint32_t aux;
+ uint8_t aux[4];
} __attribute__((__packed__)) RegH2DFIS;
/**
@@ -515,6 +515,7 @@ void ahci_get_command_header(AHCIQState *ahci, uint8_t port,
void ahci_set_command_header(AHCIQState *ahci, uint8_t port,
uint8_t slot, AHCICommandHeader *cmd);
void ahci_destroy_command(AHCIQState *ahci, uint8_t port, uint8_t slot);
+void ahci_write_fis(AHCIQState *ahci, RegH2DFIS *fis, uint64_t addr);
unsigned ahci_pick_cmd(AHCIQState *ahci, uint8_t port);
#endif
--
2.1.0
- [Qemu-devel] [PULL 20/65] libqos/ahci: Add ahci_port_select helper, (continued)
- [Qemu-devel] [PULL 20/65] libqos/ahci: Add ahci_port_select helper, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 19/65] dataplane: endianness-aware accesses, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 23/65] libqos/ahci: Add command header helpers, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 21/65] libqos/ahci: Add ahci_port_clear helper, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 24/65] libqos/ahci: Add ahci_port_check_error helper, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 22/65] qtest/ahci: rename 'Command' to 'CommandHeader', Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 26/65] libqos/ahci: Add port_check_nonbusy helper, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 25/65] libqos/ahci: Add ahci_port_check_interrupts helper, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 28/65] qtest/ahci: Demagic ahci tests., Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 30/65] libqos/ahci: Add ide cmd properties, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 29/65] qtest/ahci: add ahci_write_fis,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 31/65] libqos/ahci: add ahci command functions, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 34/65] libqos/ahci: Add ahci_guest_io, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 27/65] libqos/ahci: Add cmd response sanity check helpers, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 32/65] libqos/ahci: add ahci command verify, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 33/65] libqos/ahci: add ahci command size setters, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 36/65] libqos/ahci: Add ahci_clean_mem, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 37/65] qtest/ahci: Assert sector size in identify test, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 40/65] savevm: Improve error message for blocked migration, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 38/65] qtest/ahci: Adding simple dma read-write test, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 35/65] libqos/ahci: add ahci_io, Stefan Hajnoczi, 2015/02/13