aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2018-02-08 13:47:53 -0300
committerPaolo Bonzini <pbonzini@redhat.com>2018-02-13 16:15:07 +0100
commitbc13038f3a2c7c9ddc1b33757fdcb152d1fbd5dc (patch)
treee4f3cfdafe1e804005c9c076daeff4cd7ad667e9 /tests
parent0c78f51eb4ac0bfaca7278f16d918052805d2ed8 (diff)
downloadqemu-bc13038f3a2c7c9ddc1b33757fdcb152d1fbd5dc.zip
qemu-bc13038f3a2c7c9ddc1b33757fdcb152d1fbd5dc.tar.gz
qemu-bc13038f3a2c7c9ddc1b33757fdcb152d1fbd5dc.tar.bz2
sdhci: add a check_capab_sdma() qtest
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20180208164818.7961-6-f4bug@amsat.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/sdhci-test.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/sdhci-test.c b/tests/sdhci-test.c
index f70c3a6..34d1c0d 100644
--- a/tests/sdhci-test.c
+++ b/tests/sdhci-test.c
@@ -15,6 +15,7 @@
#define SDHC_CAPAB 0x40
FIELD(SDHC_CAPAB, BASECLKFREQ, 8, 8); /* since v2 */
+FIELD(SDHC_CAPAB, SDMA, 22, 1);
#define SDHC_HCVER 0xFE
static const struct sdhci_t {
@@ -109,6 +110,15 @@ static void check_capab_baseclock(QSDHCI *s, uint8_t expec_freq)
g_assert_cmpuint(capab_freq, ==, expec_freq);
}
+static void check_capab_sdma(QSDHCI *s, bool supported)
+{
+ uint64_t capab, capab_sdma;
+
+ capab = sdhci_readq(s, SDHC_CAPAB);
+ capab_sdma = FIELD_EX64(capab, SDHC_CAPAB, SDMA);
+ g_assert_cmpuint(capab_sdma, ==, supported);
+}
+
static QSDHCI *machine_start(const struct sdhci_t *test)
{
QSDHCI *s = g_new0(QSDHCI, 1);
@@ -156,6 +166,7 @@ static void test_machine(const void *data)
check_capab_capareg(s, test->sdhci.capab.reg);
check_capab_readonly(s);
+ check_capab_sdma(s, test->sdhci.capab.sdma);
check_capab_baseclock(s, test->sdhci.baseclock);
machine_stop(s);