aboutsummaryrefslogtreecommitdiff
path: root/tests/libqos/ahci.h
diff options
context:
space:
mode:
authorJohn Snow <jsnow@redhat.com>2016-01-11 14:10:43 -0500
committerJohn Snow <jsnow@redhat.com>2016-01-11 14:10:43 -0500
commit9350df7cea60265a134778bfb582494641ac7df6 (patch)
treedaed22576ab076420fba14f2f61bb424b90e2e74 /tests/libqos/ahci.h
parentb682d3a7cf249dc472e3fb76bf49afeaa3eba525 (diff)
downloadqemu-9350df7cea60265a134778bfb582494641ac7df6.zip
qemu-9350df7cea60265a134778bfb582494641ac7df6.tar.gz
qemu-9350df7cea60265a134778bfb582494641ac7df6.tar.bz2
libqos/ahci: add ahci_exec
add ahci_exec, which is a standard purpose flexible command dispatcher and tester for the AHCI device. The intent is to eventually cut down on the absurd amount of boilerplate inside of the AHCI qtest. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1452282920-21550-8-git-send-email-jsnow@redhat.com
Diffstat (limited to 'tests/libqos/ahci.h')
-rw-r--r--tests/libqos/ahci.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/libqos/ahci.h b/tests/libqos/ahci.h
index 705fbd6..2c2d2fc 100644
--- a/tests/libqos/ahci.h
+++ b/tests/libqos/ahci.h
@@ -462,6 +462,21 @@ typedef struct PRD {
/* Opaque, defined within ahci.c */
typedef struct AHCICommand AHCICommand;
+/* Options to ahci_exec */
+typedef struct AHCIOpts {
+ size_t size;
+ unsigned prd_size;
+ uint64_t lba;
+ uint64_t buffer;
+ bool atapi;
+ bool atapi_dma;
+ bool error;
+ int (*pre_cb)(AHCIQState*, AHCICommand*, const struct AHCIOpts *);
+ int (*mid_cb)(AHCIQState*, AHCICommand*, const struct AHCIOpts *);
+ int (*post_cb)(AHCIQState*, AHCICommand*, const struct AHCIOpts *);
+ void *opaque;
+} AHCIOpts;
+
/*** Macro Utilities ***/
#define BITANY(data, mask) (((data) & (mask)) != 0)
#define BITSET(data, mask) (((data) & (mask)) == (mask))
@@ -569,6 +584,8 @@ AHCICommand *ahci_guest_io_halt(AHCIQState *ahci, uint8_t port, uint8_t ide_cmd,
void ahci_guest_io_resume(AHCIQState *ahci, AHCICommand *cmd);
void ahci_io(AHCIQState *ahci, uint8_t port, uint8_t ide_cmd,
void *buffer, size_t bufsize, uint64_t sector);
+void ahci_exec(AHCIQState *ahci, uint8_t port,
+ uint8_t op, const AHCIOpts *opts);
/* Command Lifecycle */
AHCICommand *ahci_command_create(uint8_t command_name);