aboutsummaryrefslogtreecommitdiff
path: root/tests/libqos/ahci.c
diff options
context:
space:
mode:
authorJohn Snow <jsnow@redhat.com>2015-04-28 15:27:51 -0400
committerJohn Snow <jsnow@redhat.com>2015-04-28 15:27:51 -0400
commit727be1a7550b5caad0b94098a41de8033ad43f85 (patch)
tree56ba3043f0c411e957ef5c91d8845683f708e1dc /tests/libqos/ahci.c
parent122fdf2d8822699482723e6f50f34c9c3933360b (diff)
qtest/ahci: test different disk sectors
Test sector offset 0, 1, and the last sector(s) in LBA28 and LBA48 modes. Signed-off-by: John Snow <jsnow@redhat.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1426274523-22661-3-git-send-email-jsnow@redhat.com
Diffstat (limited to 'tests/libqos/ahci.c')
-rw-r--r--tests/libqos/ahci.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/libqos/ahci.c b/tests/libqos/ahci.c
index b0f39a5e32..a18c12bcc1 100644
--- a/tests/libqos/ahci.c
+++ b/tests/libqos/ahci.c
@@ -568,13 +568,15 @@ inline unsigned size_to_prdtl(unsigned bytes, unsigned bytes_per_prd)
/* Given a guest buffer address, perform an IO operation */
void ahci_guest_io(AHCIQState *ahci, uint8_t port, uint8_t ide_cmd,
- uint64_t buffer, size_t bufsize)
+ uint64_t buffer, size_t bufsize, uint64_t sector)
{
AHCICommand *cmd;
-
cmd = ahci_command_create(ide_cmd);
ahci_command_set_buffer(cmd, buffer);
ahci_command_set_size(cmd, bufsize);
+ if (sector) {
+ ahci_command_set_offset(cmd, sector);
+ }
ahci_command_commit(ahci, cmd, port);
ahci_command_issue(ahci, cmd);
ahci_command_verify(ahci, cmd);
@@ -612,7 +614,7 @@ static AHCICommandProp *ahci_command_find(uint8_t command_name)
/* Given a HOST buffer, create a buffer address and perform an IO operation. */
void ahci_io(AHCIQState *ahci, uint8_t port, uint8_t ide_cmd,
- void *buffer, size_t bufsize)
+ void *buffer, size_t bufsize, uint64_t sector)
{
uint64_t ptr;
AHCICommandProp *props;
@@ -626,7 +628,7 @@ void ahci_io(AHCIQState *ahci, uint8_t port, uint8_t ide_cmd,
memwrite(ptr, buffer, bufsize);
}
- ahci_guest_io(ahci, port, ide_cmd, ptr, bufsize);
+ ahci_guest_io(ahci, port, ide_cmd, ptr, bufsize, sector);
if (props->read) {
memread(ptr, buffer, bufsize);