[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 14/19] libqos/ahci: add ahci command size setters
From: |
John Snow |
Subject: |
[Qemu-devel] [PATCH v2 14/19] libqos/ahci: add ahci command size setters |
Date: |
Tue, 3 Feb 2015 16:46:34 -0500 |
Adds setters for size, prd_size and both via set_sizes.
Signed-off-by: John Snow <address@hidden>
---
tests/libqos/ahci.c | 22 ++++++++++++++++++++++
tests/libqos/ahci.h | 5 +++++
2 files changed, 27 insertions(+)
diff --git a/tests/libqos/ahci.c b/tests/libqos/ahci.c
index d1e511a..60849ea 100644
--- a/tests/libqos/ahci.c
+++ b/tests/libqos/ahci.c
@@ -656,6 +656,28 @@ void ahci_command_set_buffer(AHCICommand *cmd, uint64_t
buffer)
cmd->buffer = buffer;
}
+void ahci_command_set_sizes(AHCICommand *cmd, uint64_t xbytes,
+ unsigned prd_size)
+{
+ /* Each PRD can describe up to 4MiB, and must not be odd. */
+ g_assert_cmphex(prd_size, <=, 4096 * 1024);
+ g_assert_cmphex(prd_size & 0x01, ==, 0x00);
+ cmd->prd_size = prd_size;
+ cmd->xbytes = xbytes;
+ cmd->fis.count = (cmd->xbytes / AHCI_SECTOR_SIZE);
+ cmd->header.prdtl = size_to_prdtl(cmd->xbytes, cmd->prd_size);
+}
+
+void ahci_command_set_size(AHCICommand *cmd, uint64_t xbytes)
+{
+ ahci_command_set_sizes(cmd, xbytes, cmd->prd_size);
+}
+
+void ahci_command_set_prd_size(AHCICommand *cmd, unsigned prd_size)
+{
+ ahci_command_set_sizes(cmd, cmd->xbytes, prd_size);
+}
+
void ahci_command_commit(AHCIQState *ahci, AHCICommand *cmd, uint8_t px)
{
uint16_t i, prdtl;
diff --git a/tests/libqos/ahci.h b/tests/libqos/ahci.h
index 500319a..1f09ef1 100644
--- a/tests/libqos/ahci.h
+++ b/tests/libqos/ahci.h
@@ -532,6 +532,11 @@ void ahci_command_verify(AHCIQState *ahci, AHCICommand
*cmd);
void ahci_command_free(AHCICommand *cmd);
/* Command adjustments */
void ahci_command_set_buffer(AHCICommand *cmd, uint64_t buffer);
+void ahci_command_set_size(AHCICommand *cmd, uint64_t xbytes);
+void ahci_command_set_prd_size(AHCICommand *cmd, unsigned prd_size);
+void ahci_command_set_sizes(AHCICommand *cmd, uint64_t xbytes,
+ unsigned prd_size);
uint8_t ahci_command_slot(AHCICommand *cmd);
+
#endif
--
1.9.3
- [Qemu-devel] [PATCH v2 10/19] qtest/ahci: add ahci_write_fis, (continued)
- [Qemu-devel] [PATCH v2 05/19] libqos/ahci: Add ahci_port_check_error helper, John Snow, 2015/02/03
- [Qemu-devel] [PATCH v2 04/19] libqos/ahci: Add command header helpers, John Snow, 2015/02/03
- [Qemu-devel] [PATCH v2 11/19] libqos/ahci: Add ide cmd properties, John Snow, 2015/02/03
- [Qemu-devel] [PATCH v2 07/19] libqos/ahci: Add port_check_nonbusy helper, John Snow, 2015/02/03
- [Qemu-devel] [PATCH v2 14/19] libqos/ahci: add ahci command size setters,
John Snow <=
- [Qemu-devel] [PATCH v2 09/19] qtest/ahci: Demagic ahci tests., John Snow, 2015/02/03
- [Qemu-devel] [PATCH v2 08/19] libqos/ahci: Add cmd response sanity check helpers, John Snow, 2015/02/03
- [Qemu-devel] [PATCH v2 15/19] libqos/ahci: Add ahci_guest_io, John Snow, 2015/02/03
- [Qemu-devel] [PATCH v2 06/19] libqos/ahci: Add ahci_port_check_interrupts helper, John Snow, 2015/02/03
- [Qemu-devel] [PATCH v2 13/19] libqos/ahci: add ahci command verify, John Snow, 2015/02/03
- [Qemu-devel] [PATCH v2 12/19] libqos/ahci: add ahci command functions, John Snow, 2015/02/03
- [Qemu-devel] [PATCH v2 16/19] libqos/ahci: add ahci_io, John Snow, 2015/02/03