aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2018-02-08 13:48:17 -0300
committerPaolo Bonzini <pbonzini@redhat.com>2018-02-13 16:15:09 +0100
commitf18e6d50e2b42410699ccffcf42d5c420bc5302b (patch)
treef838e57a6a142df2c2af02fe43d06274161e6920
parent09b9428db496fe9b497d27081f2904e76dc65277 (diff)
downloadqemu-f18e6d50e2b42410699ccffcf42d5c420bc5302b.zip
qemu-f18e6d50e2b42410699ccffcf42d5c420bc5302b.tar.gz
qemu-f18e6d50e2b42410699ccffcf42d5c420bc5302b.tar.bz2
sdhci: add a check_capab_v3() qtest
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20180208164818.7961-30-f4bug@amsat.org>
-rw-r--r--tests/sdhci-test.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/sdhci-test.c b/tests/sdhci-test.c
index 2474179..493023f 100644
--- a/tests/sdhci-test.c
+++ b/tests/sdhci-test.c
@@ -16,6 +16,8 @@
#define SDHC_CAPAB 0x40
FIELD(SDHC_CAPAB, BASECLKFREQ, 8, 8); /* since v2 */
FIELD(SDHC_CAPAB, SDMA, 22, 1);
+FIELD(SDHC_CAPAB, SDR, 32, 3); /* since v3 */
+FIELD(SDHC_CAPAB, DRIVER, 36, 3); /* since v3 */
#define SDHC_HCVER 0xFE
static const struct sdhci_t {
@@ -159,6 +161,20 @@ static void check_capab_sdma(QSDHCI *s, bool supported)
g_assert_cmpuint(capab_sdma, ==, supported);
}
+static void check_capab_v3(QSDHCI *s, uint8_t version)
+{
+ uint64_t capab, capab_v3;
+
+ if (version < 3) {
+ /* before v3 those fields are RESERVED */
+ capab = sdhci_readq(s, SDHC_CAPAB);
+ capab_v3 = FIELD_EX64(capab, SDHC_CAPAB, SDR);
+ g_assert_cmpuint(capab_v3, ==, 0);
+ capab_v3 = FIELD_EX64(capab, SDHC_CAPAB, DRIVER);
+ g_assert_cmpuint(capab_v3, ==, 0);
+ }
+}
+
static QSDHCI *machine_start(const struct sdhci_t *test)
{
QSDHCI *s = g_new0(QSDHCI, 1);
@@ -207,6 +223,7 @@ static void test_machine(const void *data)
check_specs_version(s, test->sdhci.version);
check_capab_capareg(s, test->sdhci.capab.reg);
check_capab_readonly(s);
+ check_capab_v3(s, test->sdhci.version);
check_capab_sdma(s, test->sdhci.capab.sdma);
check_capab_baseclock(s, test->sdhci.baseclock);