[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 02/35] qtest/ahci: add test_max
From: |
John Snow |
Subject: |
[Qemu-devel] [PULL 02/35] qtest/ahci: add test_max |
Date: |
Sat, 4 Jul 2015 02:06:41 -0400 |
Test that the FIS delivered after a nondata command has appropriately
updated registers, just as we'd expect a data command to do.
Signed-off-by: John Snow <address@hidden>
Message-id: address@hidden
---
tests/ahci-test.c | 50 +++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 45 insertions(+), 5 deletions(-)
diff --git a/tests/ahci-test.c b/tests/ahci-test.c
index ae9415d..a7b4df2 100644
--- a/tests/ahci-test.c
+++ b/tests/ahci-test.c
@@ -890,21 +890,23 @@ static void ahci_test_io_rw_simple(AHCIQState *ahci,
unsigned bufsize,
g_free(rx);
}
-static void ahci_test_nondata(AHCIQState *ahci, uint8_t ide_cmd)
+static uint8_t ahci_test_nondata(AHCIQState *ahci, uint8_t ide_cmd)
{
- uint8_t px;
+ uint8_t port;
AHCICommand *cmd;
/* Sanitize */
- px = ahci_port_select(ahci);
- ahci_port_clear(ahci, px);
+ port = ahci_port_select(ahci);
+ ahci_port_clear(ahci, port);
/* Issue Command */
cmd = ahci_command_create(ide_cmd);
- ahci_command_commit(ahci, cmd, px);
+ ahci_command_commit(ahci, cmd, port);
ahci_command_issue(ahci, cmd);
ahci_command_verify(ahci, cmd);
ahci_command_free(cmd);
+
+ return port;
}
static void ahci_test_flush(AHCIQState *ahci)
@@ -912,6 +914,33 @@ static void ahci_test_flush(AHCIQState *ahci)
ahci_test_nondata(ahci, CMD_FLUSH_CACHE);
}
+static void ahci_test_max(AHCIQState *ahci)
+{
+ RegD2HFIS *d2h = g_malloc0(0x20);
+ uint64_t nsect;
+ uint8_t port;
+ uint8_t cmd;
+ uint64_t config_sect = TEST_IMAGE_SECTORS - 1;
+
+ if (config_sect > 0xFFFFFF) {
+ cmd = CMD_READ_MAX_EXT;
+ } else {
+ cmd = CMD_READ_MAX;
+ }
+
+ port = ahci_test_nondata(ahci, cmd);
+ memread(ahci->port[port].fb + 0x40, d2h, 0x20);
+ nsect = (uint64_t)d2h->lba_hi[2] << 40 |
+ (uint64_t)d2h->lba_hi[1] << 32 |
+ (uint64_t)d2h->lba_hi[0] << 24 |
+ (uint64_t)d2h->lba_lo[2] << 16 |
+ (uint64_t)d2h->lba_lo[1] << 8 |
+ (uint64_t)d2h->lba_lo[0];
+
+ g_assert_cmphex(nsect, ==, config_sect);
+ g_free(d2h);
+}
+
/******************************************************************************/
/* Test Interfaces
*/
@@ -1334,6 +1363,15 @@ static void test_flush_migrate(void)
ahci_shutdown(dst);
}
+static void test_max(void)
+{
+ AHCIQState *ahci;
+
+ ahci = ahci_boot_and_enable(NULL);
+ ahci_test_max(ahci);
+ ahci_shutdown(ahci);
+}
+
/******************************************************************************/
/* AHCI I/O Test Matrix Definitions
*/
@@ -1584,6 +1622,8 @@ int main(int argc, char **argv)
qtest_add_func("/ahci/io/dma/lba28/retry", test_halted_dma);
qtest_add_func("/ahci/migrate/dma/halted", test_migrate_halted_dma);
+ qtest_add_func("/ahci/max", test_max);
+
ret = g_test_run();
/* Cleanup */
--
2.1.0
- [Qemu-devel] [PULL 00/35] Ide patches, John Snow, 2015/07/04
- [Qemu-devel] [PULL 01/35] ahci: Do not ignore memory access read size, John Snow, 2015/07/04
- [Qemu-devel] [PULL 05/35] ahci: Rename NCQFIS structure fields, John Snow, 2015/07/04
- [Qemu-devel] [PULL 02/35] qtest/ahci: add test_max,
John Snow <=
- [Qemu-devel] [PULL 06/35] ahci: use shorter variables, John Snow, 2015/07/04
- [Qemu-devel] [PULL 04/35] qtest/ahci: add port_reset test, John Snow, 2015/07/04
- [Qemu-devel] [PULL 03/35] libqos/ahci: fix memory management bugs, John Snow, 2015/07/04
- [Qemu-devel] [PULL 07/35] ahci: add ncq_err helper, John Snow, 2015/07/04
- [Qemu-devel] [PULL 08/35] ahci: check for ncq prdtl overflow, John Snow, 2015/07/04
- [Qemu-devel] [PULL 09/35] ahci: separate prdtl from opts, John Snow, 2015/07/04
- [Qemu-devel] [PULL 10/35] ahci: add ncq debug checks, John Snow, 2015/07/04
- [Qemu-devel] [PULL 11/35] ahci: ncq sector count correction, John Snow, 2015/07/04
- [Qemu-devel] [PULL 12/35] ahci/qtest: Execute IDENTIFY prior to data commands, John Snow, 2015/07/04
- [Qemu-devel] [PULL 13/35] libqos/ahci: fix cmd_sanity for ncq, John Snow, 2015/07/04