summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Snow2015-07-04 08:06:03 +0200
committerJohn Snow2015-07-04 08:06:03 +0200
commit34475239b8f1fff0b715cb20f8b534b9d07a897e (patch)
treebd7ccf63078e7aad5b69187628f83172495aef56
parentahci: ncq sector count correction (diff)
downloadqemu-34475239b8f1fff0b715cb20f8b534b9d07a897e.tar.gz
qemu-34475239b8f1fff0b715cb20f8b534b9d07a897e.tar.xz
qemu-34475239b8f1fff0b715cb20f8b534b9d07a897e.zip
ahci/qtest: Execute IDENTIFY prior to data commands
If you try to execute an NCQ command before trying to engage with the device by issuing an IDENTIFY command, the error bits that are part of the signature will fool the test suite into thinking there was a failure. Issue IDENTIFY first on "boot", which will clear the signature out of the registers for us. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1435016308-6150-9-git-send-email-jsnow@redhat.com
-rw-r--r--tests/ahci-test.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/ahci-test.c b/tests/ahci-test.c
index 0a0ef2af14..ee1dc20a8f 100644
--- a/tests/ahci-test.c
+++ b/tests/ahci-test.c
@@ -228,6 +228,8 @@ static AHCIQState *ahci_boot_and_enable(const char *cli, ...)
{
AHCIQState *ahci;
va_list ap;
+ uint16_t buff[256];
+ uint8_t port;
if (cli) {
va_start(ap, cli);
@@ -239,6 +241,10 @@ static AHCIQState *ahci_boot_and_enable(const char *cli, ...)
ahci_pci_enable(ahci);
ahci_hba_enable(ahci);
+ /* Initialize test device */
+ port = ahci_port_select(ahci);
+ ahci_port_clear(ahci, port);
+ ahci_io(ahci, port, CMD_IDENTIFY, &buff, sizeof(buff), 0);
return ahci;
}