From patchwork Wed Jan 3 18:34:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 855173 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ts6TIOAL"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zBftk6CcMz9s7c for ; Thu, 4 Jan 2018 05:42:38 +1100 (AEDT) Received: from localhost ([::1]:60816 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eWnzo-0001VI-TT for incoming@patchwork.ozlabs.org; Wed, 03 Jan 2018 13:42:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34242) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eWnsx-0003q3-Pp for qemu-devel@nongnu.org; Wed, 03 Jan 2018 13:35:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eWnsx-0007xd-0q for qemu-devel@nongnu.org; Wed, 03 Jan 2018 13:35:31 -0500 Received: from mail-qt0-x244.google.com ([2607:f8b0:400d:c0d::244]:41362) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eWnsw-0007xK-S4 for qemu-devel@nongnu.org; Wed, 03 Jan 2018 13:35:30 -0500 Received: by mail-qt0-x244.google.com with SMTP id i40so3208195qti.8 for ; Wed, 03 Jan 2018 10:35:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LB2vR+xX5B7po0OaUd258WDwiRr1Lql0ZJ7HTew9kDU=; b=ts6TIOALxZPoJY+cKcgDuV06fGJQo4gCLHk3a9f5pf20WLDLu7oGJh7XLf7ZwxXqmC bW7//YxlN3nLDTcTI4h1vq/B729v0+gf1ffquOtLER8ONLBnsCuf4KlLlFqjz8kmfBol 13OX2thHqcfWEUXU8NnqpF3h34his1ngdSu4uZ5OZZGSgvzP8gBqlrXfpHIJTmbdMWRQ qsObDFERAQ70egTwYsXiTAUWxbwU3wqu53EFXaIA9i9jgYCqCvDaW3ALq3HpEAWFhqez xQyuINeRvHNEetBLxVKxsA4X1duekJTUnMOrCq6uQoGChFFf8wvGW7F4jOrLya9J/i+6 5vCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=LB2vR+xX5B7po0OaUd258WDwiRr1Lql0ZJ7HTew9kDU=; b=Chx3t+klhZH8Zs1ScE80if+LZEL1Uz16ZrdXHbYyXY0EHm2CwUC2qCD84U5+Fxt2v9 7GPKvW3b178/1+jH+SEIgBfSPhhttz8OF202OR0CJhCw3DA9NyISTVSaxh2ygEfVgRRu xjW9dTIgtZTpTYTUlHbY3HfDKueUrIatrVJGcEkR3fq0FpJxEGzawj7ru6K+MIPxrN8G oAXvxvnAG1vYi2RIJ+G3/BMbYlS1l1WkZ/mzFwBLR9iQuEAtc3VFY0joTtU54/1YULvM +iXOPc+8v1S2JCNdHvBo1tbTxXv8Oc5A4V2Nj2YzGaH8CCuEvTMn318JLUNiGZB5E101 TPQA== X-Gm-Message-State: AKGB3mJXDbxAMNgVl0jGtuu/mfeoL9sqK6+t/Iroglc5PWIatJbwtkHY WNFmb15qNVWnKT4xa3X38B6dRL8x X-Google-Smtp-Source: ACJfBovRpxGXcrNxHTCoD36IcGCA+pBldg7nJnjINwYr3xSQMXlhyjayjWOu7S842MIEJAXbdPrsHA== X-Received: by 10.237.37.47 with SMTP id v44mr3095679qtc.55.1515004530402; Wed, 03 Jan 2018 10:35:30 -0800 (PST) Received: from x1.lan ([138.117.48.219]) by smtp.gmail.com with ESMTPSA id 185sm992854qkd.1.2018.01.03.10.35.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Jan 2018 10:35:29 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Alistair Francis , "Edgar E . Iglesias" , Peter Maydell , Andrey Smirnov , Igor Mitsyanko , Krzysztof Kozlowski , Stefan Hajnoczi Date: Wed, 3 Jan 2018 15:34:15 -0300 Message-Id: <20180103183418.23730-23-f4bug@amsat.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180103183418.23730-1-f4bug@amsat.org> References: <20180103183418.23730-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::244 Subject: [Qemu-devel] [PATCH v4 22/25] sdhci: add a check_capab_baseclock() qtest X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Crosthwaite , =?utf-8?q?Philippe_Ma?= =?utf-8?q?thieu-Daud=C3=A9?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Stefan Hajnoczi --- tests/sdhci-test.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/sdhci-test.c b/tests/sdhci-test.c index 0443a23e45..2aa3fa0d3b 100644 --- a/tests/sdhci-test.c +++ b/tests/sdhci-test.c @@ -7,9 +7,11 @@ * See the COPYING file in the top-level directory. */ #include "qemu/osdep.h" +#include "hw/registerfields.h" #include "libqtest.h" #define SDHC_CAPAB 0x40 +FIELD(SDHC_CAPAB, BASECLKFREQ, 8, 8); /* since v2 */ #define SDHC_HCVER 0xFE static const struct sdhci_t { @@ -99,6 +101,18 @@ static void check_capab_readonly(uintptr_t addr) g_assert_cmpuint(capab1, ==, capab0); } +static void check_capab_baseclock(uintptr_t addr, uint8_t expected_freq) +{ + uint64_t capab, capab_freq; + + if (!expected_freq) { + return; + } + capab = sdhci_readq(addr, SDHC_CAPAB); + capab_freq = FIELD_EX64(capab, SDHC_CAPAB, BASECLKFREQ); + g_assert_cmpuint(capab_freq, ==, expected_freq); +} + static void test_machine(const void *data) { const struct sdhci_t *test = data; @@ -108,6 +122,7 @@ static void test_machine(const void *data) check_capab_capareg(test->sdhci.addr, test->sdhci.capab.reg); check_specs_version(test->sdhci.addr, test->sdhci.version); check_capab_readonly(test->sdhci.addr); + check_capab_baseclock(test->sdhci.addr, test->sdhci.baseclock); qtest_quit(global_qtest); }