diff options
-rw-r--r-- | tests/sdhci-test.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/sdhci-test.c b/tests/sdhci-test.c index 34d1c0d137..4d8642627d 100644 --- a/tests/sdhci-test.c +++ b/tests/sdhci-test.c @@ -54,6 +54,19 @@ typedef struct QSDHCI { }; } QSDHCI; +static uint16_t sdhci_readw(QSDHCI *s, uint32_t reg) +{ + uint16_t val; + + if (s->pci.dev) { + val = qpci_io_readw(s->pci.dev, s->mem_bar, reg); + } else { + val = qtest_readw(global_qtest, s->addr + reg); + } + + return val; +} + static uint64_t sdhci_readq(QSDHCI *s, uint32_t reg) { uint64_t val; @@ -76,6 +89,16 @@ static void sdhci_writeq(QSDHCI *s, uint32_t reg, uint64_t val) } } +static void check_specs_version(QSDHCI *s, uint8_t version) +{ + uint32_t v; + + v = sdhci_readw(s, SDHC_HCVER); + v &= 0xff; + v += 1; + g_assert_cmpuint(v, ==, version); +} + static void check_capab_capareg(QSDHCI *s, uint64_t expec_capab) { uint64_t capab; @@ -164,6 +187,7 @@ static void test_machine(const void *data) s = machine_start(test); + check_specs_version(s, test->sdhci.version); check_capab_capareg(s, test->sdhci.capab.reg); check_capab_readonly(s); check_capab_sdma(s, test->sdhci.capab.sdma); |