[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 33/65] libqos/ahci: add ahci command size setters
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL v2 33/65] libqos/ahci: add ahci command size setters |
Date: |
Mon, 16 Feb 2015 15:45:58 +0000 |
From: John Snow <address@hidden>
Adds setters for size, prd_size and both via set_sizes.
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: John Snow <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
tests/libqos/ahci.c | 22 ++++++++++++++++++++++
tests/libqos/ahci.h | 4 ++++
2 files changed, 26 insertions(+)
diff --git a/tests/libqos/ahci.c b/tests/libqos/ahci.c
index 09e7159..cd1f3ff 100644
--- a/tests/libqos/ahci.c
+++ b/tests/libqos/ahci.c
@@ -660,6 +660,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 port)
{
uint16_t i, prdtl;
diff --git a/tests/libqos/ahci.h b/tests/libqos/ahci.h
index 26ccdd6..57ff344 100644
--- a/tests/libqos/ahci.h
+++ b/tests/libqos/ahci.h
@@ -533,6 +533,10 @@ 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);
/* Command Misc */
uint8_t ahci_command_slot(AHCICommand *cmd);
--
2.1.0
- [Qemu-devel] [PULL v2 23/65] libqos/ahci: Add command header helpers, (continued)
- [Qemu-devel] [PULL v2 23/65] libqos/ahci: Add command header helpers, Stefan Hajnoczi, 2015/02/16
- [Qemu-devel] [PULL v2 25/65] libqos/ahci: Add ahci_port_check_interrupts helper, Stefan Hajnoczi, 2015/02/16
- [Qemu-devel] [PULL v2 26/65] libqos/ahci: Add port_check_nonbusy helper, Stefan Hajnoczi, 2015/02/16
- [Qemu-devel] [PULL v2 28/65] qtest/ahci: Demagic ahci tests., Stefan Hajnoczi, 2015/02/16
- [Qemu-devel] [PULL v2 29/65] qtest/ahci: add ahci_write_fis, Stefan Hajnoczi, 2015/02/16
- [Qemu-devel] [PULL v2 30/65] libqos/ahci: Add ide cmd properties, Stefan Hajnoczi, 2015/02/16
- [Qemu-devel] [PULL v2 32/65] libqos/ahci: add ahci command verify, Stefan Hajnoczi, 2015/02/16
- [Qemu-devel] [PULL v2 34/65] libqos/ahci: Add ahci_guest_io, Stefan Hajnoczi, 2015/02/16
- [Qemu-devel] [PULL v2 31/65] libqos/ahci: add ahci command functions, Stefan Hajnoczi, 2015/02/16
- [Qemu-devel] [PULL v2 36/65] libqos/ahci: Add ahci_clean_mem, Stefan Hajnoczi, 2015/02/16
- [Qemu-devel] [PULL v2 33/65] libqos/ahci: add ahci command size setters,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL v2 35/65] libqos/ahci: add ahci_io, Stefan Hajnoczi, 2015/02/16
- [Qemu-devel] [PULL v2 41/65] block: vmdk - fixed sizeof() error, Stefan Hajnoczi, 2015/02/16
- [Qemu-devel] [PULL v2 43/65] qemu-io: Account IO by aio_read and aio_write, Stefan Hajnoczi, 2015/02/16
- [Qemu-devel] [PULL v2 38/65] qtest/ahci: Adding simple dma read-write test, Stefan Hajnoczi, 2015/02/16
- [Qemu-devel] [PULL v2 40/65] savevm: Improve error message for blocked migration, Stefan Hajnoczi, 2015/02/16
- [Qemu-devel] [PULL v2 39/65] nbd: fix the co_queue multi-adding bug, Stefan Hajnoczi, 2015/02/16
- [Qemu-devel] [PULL v2 42/65] qtest: Fix deadloop by running main loop AIO context's timers, Stefan Hajnoczi, 2015/02/16
- [Qemu-devel] [PULL v2 44/65] qtest: Add scripts/qtest.py, Stefan Hajnoczi, 2015/02/16
- [Qemu-devel] [PULL v2 37/65] qtest/ahci: Assert sector size in identify test, Stefan Hajnoczi, 2015/02/16
- [Qemu-devel] [PULL v2 45/65] qemu-iotests: Add VM method qtest() to iotests.py, Stefan Hajnoczi, 2015/02/16