From nobody Fri Dec 19 08:11:49 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1511148864609542.8478915982532; Sun, 19 Nov 2017 19:34:24 -0800 (PST) Received: from localhost ([::1]:55246 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGcqg-0000Kn-74 for importer@patchew.org; Sun, 19 Nov 2017 22:34:18 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37499) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGchj-0001rx-Ok for qemu-devel@nongnu.org; Sun, 19 Nov 2017 22:25:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eGchg-0006a4-Kq for qemu-devel@nongnu.org; Sun, 19 Nov 2017 22:25:03 -0500 Received: from mail-io0-x242.google.com ([2607:f8b0:4001:c06::242]:42757) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eGche-0006Xi-5f; Sun, 19 Nov 2017 22:24:58 -0500 Received: by mail-io0-x242.google.com with SMTP id u42so14308230ioi.9; Sun, 19 Nov 2017 19:24:58 -0800 (PST) Received: from localhost.localdomain (173-29-146-33.client.mchsi.com. [173.29.146.33]) by smtp.gmail.com with ESMTPSA id o207sm4476119itc.27.2017.11.19.19.24.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Nov 2017 19:24:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4dZp8lHWlpNCTEQZ9tT4sRvjuDMrX2abFCZm1Yvlqz8=; b=X52f05ZQw0Xs3fDiV6t3asiQ5DWRPJyBEriZXJTgaG7rBpuosw55ll8N6+pKAuwDxk hysDKE+7K3gVDBtsGljdf7UZe5ufLUKLtFn6Ye3gcIhfVx+ow33toqzA70Bb7+MUWXP4 jN/GSxit8eQiGPsqpefRVvbQR9FucHA3G+7/v0UaGbhJNq5T2CG9k+PXwfvnIVVRP3d3 f2YugQMy45CJuwZY0iPH8tdv9icLSRqdBi4f7ziC85j3UmZ7fj5ru58NdpJxnyQfmpc8 X4TvVV6SL6KVvKajVOPYh95Vsqj9P9sRQOraN8f1EomitvnXOnChbqqKMv/4O948uhuu iftA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4dZp8lHWlpNCTEQZ9tT4sRvjuDMrX2abFCZm1Yvlqz8=; b=a9/oF0a7QTF/r4JeGy45L+gj0iR7U500XeYlQ8XQo0aeluPVs9YZ2+b5UGnSKRoij/ aGekmSdbxqZE734JDOA8DRrAqast4ur9JlIH5ngzJfcRVAw38znRTDQq7mxKgP0D0Vx3 Gz0q6T5KNuEB9D7iz7RLsF75tdh12SHUPdrL6vBLfGQubJPvhdxEv8SwpGX+58jf5S4Y 7miWqo6CdsjCyc22FdEBRRuL30gj4o/I8ajLT/Di5SpR2eUrskoYJNL4sBNPYPwK47eM 2+3a0FAx/GH1h7c3tf3mPt/RBHJFKA5ryIHqHsGmzQPbYwaWId8/tU4SQzUSqA66mA20 gd4w== X-Gm-Message-State: AJaThX4CuodPZvXSYkG7iKFxjzxe2mpXg8iBdI0n9aDQdW3SD09eAw4b vCAI1anOzfcM1vstcXyDEqUxoQ== X-Google-Smtp-Source: AGs4zMb64e1bCJsq1Nbc7Y9wkTzazpEbgs1IJ3XgOn9eMDQbkYWGQKfCfJs9kpH6oBb4nvoP9aIEtw== X-Received: by 10.107.139.12 with SMTP id n12mr12681869iod.1.1511148297595; Sun, 19 Nov 2017 19:24:57 -0800 (PST) From: Michael Davidsaver To: Alexander Graf , David Gibson , qemu-ppc@nongnu.org Date: Sun, 19 Nov 2017 21:24:20 -0600 Message-Id: <20171120032420.9134-13-mdavidsaver@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171120032420.9134-1-mdavidsaver@gmail.com> References: <20171120032420.9134-1-mdavidsaver@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4001:c06::242 Subject: [Qemu-devel] [PATCH 12/12] tests: add mvme3100-test 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: Michael Davidsaver , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Exercise some features of the mvme3100 CPLD logic and read from the eeprom w/ VPD. Signed-off-by: Michael Davidsaver --- tests/Makefile.include | 3 ++ tests/mvme3100-test.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 82 insertions(+) create mode 100644 tests/mvme3100-test.c diff --git a/tests/Makefile.include b/tests/Makefile.include index ad1c219423..7ea041a885 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -372,6 +372,8 @@ check-qtest-s390x-y +=3D tests/virtio-balloon-test$(EXE= SUF) check-qtest-s390x-y +=3D tests/virtio-console-test$(EXESUF) check-qtest-s390x-y +=3D tests/virtio-serial-test$(EXESUF) =20 +check-qtest-ppc-$(CONFIG_E500) +=3D tests/mvme3100-test$(EXESUF) + check-qtest-generic-y +=3D tests/qom-test$(EXESUF) check-qtest-generic-y +=3D tests/test-hmp$(EXESUF) =20 @@ -781,6 +783,7 @@ tests/i82801b11-test$(EXESUF): tests/i82801b11-test.o tests/ac97-test$(EXESUF): tests/ac97-test.o tests/es1370-test$(EXESUF): tests/es1370-test.o tests/intel-hda-test$(EXESUF): tests/intel-hda-test.o +tests/mvme3100-test$(EXESUF): tests/mvme3100-test.o $(libqos-e500-obj-y) tests/ioh3420-test$(EXESUF): tests/ioh3420-test.o tests/usb-hcd-ohci-test$(EXESUF): tests/usb-hcd-ohci-test.o $(libqos-usb-o= bj-y) tests/usb-hcd-uhci-test$(EXESUF): tests/usb-hcd-uhci-test.o $(libqos-usb-o= bj-y) diff --git a/tests/mvme3100-test.c b/tests/mvme3100-test.c new file mode 100644 index 0000000000..6dde8d1d29 --- /dev/null +++ b/tests/mvme3100-test.c @@ -0,0 +1,79 @@ +#include + +#include "qemu/osdep.h" +#include "libqtest.h" +#include "libqos/libqos.h" +#include "libqos/i2c.h" + +#define assert_equal(A, B) g_assert_cmphex((A), =3D=3D, (B)) + +static +I2CAdapter *i2c; + +static +void test_ccsr(void) +{ + /* CCSRBAR is self referential */ + assert_equal(readl(0xff700000), 0x000ff700); + + /* introspect memory size */ + assert_equal(readl(0xff702080), 0x80000000); + /* value is (ram_size-1)>>24 */ + assert_equal(readl(0xff702000), 15); +} + +static +void test_cpld(void) +{ + /* read/write to test register */ + assert_equal(readl(0xe2000010), 0x00000000); + assert_equal(readl(0xe2000014), 0xffffffff); + + writel(0xe2000010, 0x12345678); + + assert_equal(readl(0xe2000010), 0x12345678); + assert_equal(readl(0xe2000014), 0x12345678 ^ 0xffffffff); +} + +static +void test_eeprom(void) +{ + char buf[] =3D "\x00\x00MOTOROLA"; + + /* 1. zero address pointer + * 2. write 8 bytes, + * 3. re-zero address pointer + */ + i2c_send(i2c, 0xa8, (uint8_t *)buf, 10); + i2c_send(i2c, 0xa8, (uint8_t *)buf, 2); + + /* read 8 bytes */ + i2c_recv(i2c, 0xa8, (uint8_t *)buf, 8); + buf[8] =3D '\0'; + + /* Read header for Motorola VPD info */ + g_assert_cmpstr(buf, =3D=3D, "MOTOROLA"); +} + +int main(int argc, char *argv[]) +{ + int ret; + g_test_init(&argc, &argv, NULL); + + qtest_start("-machine mvme3100-1152"); + + i2c =3D e500_i2c_create(0xff700000); + + qtest_add_func("/mvme3100/ccsr", test_ccsr); + qtest_add_func("/mvme3100/cpld", test_cpld); + qtest_add_func("/mvme3100/eeprom", test_eeprom); + + ret =3D g_test_run(); + + printf("Tests done\n"); + + qtest_end(); + printf("Tests end\n"); + + return ret; +} --=20 2.11.0