From nobody Sun Nov 16 07:42:54 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1599039356; cv=none; d=zohomail.com; s=zohoarc; b=jWmOnXPuzrNs+O8TjGP1r3norDTyDqyORlewL+MnkuuTAUcnJ1zxbArZxDZuyvGqXk001F22izfyGM/LEcrCtp6Kr7WKT/HdANF4xVdhV0U4LmGdQ4JcPyaIFjqtmbiWjDdE47+YS5ZgaKnd21PewxVyydGqeRDWtBt52nxd1ZY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599039356; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vBzqWfr0nXh5snb96gJAFIsrteKzwCdgU0+s+n9YQ9A=; b=OxrRb4vUNifIlMvjVC1XmKLDFcwKFhQNneVdO91kBzxMFwuLWBfaUCS8SApnoGLdVZxbvdyc//fGIi5VzkLb5fGwAMBiJKPMK0bSa9mr2GjrdbtfugzHqj7LQYAc/Va0ZI57TE/kpM+iRlDgLk1sE/5i8UHdUMBcnB+IBcNYJFg= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1599039356642758.3254359067932; Wed, 2 Sep 2020 02:35:56 -0700 (PDT) Received: from localhost ([::1]:40918 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kDPBL-0000cp-TS for importer@patchew.org; Wed, 02 Sep 2020 05:35:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36010) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kDP6v-0001NB-95; Wed, 02 Sep 2020 05:31:21 -0400 Received: from smtpout1.mo804.mail-out.ovh.net ([79.137.123.220]:47811) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kDP6r-0004Yx-CS; Wed, 02 Sep 2020 05:31:20 -0400 Received: from mxplan5.mail.ovh.net (unknown [10.109.138.217]) by mo804.mail-out.ovh.net (Postfix) with ESMTPS id 8EC1E5D1903C; Wed, 2 Sep 2020 11:31:14 +0200 (CEST) Received: from kaod.org (37.59.142.96) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2044.4; Wed, 2 Sep 2020 11:31:12 +0200 Authentication-Results: garm.ovh; auth=pass (GARM-96R001ce88ab86-4e22-48a0-9d8a-6ba7b98f6063, 725C0B02AD5EA5A9EE23B5614217EC25792C566F) smtp.auth=clg@kaod.org From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: Subject: [PATCH v2 9/9] aspeed/smc: Add support for RDSFDP command Date: Wed, 2 Sep 2020 11:31:07 +0200 Message-ID: <20200902093107.608000-10-clg@kaod.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200902093107.608000-1-clg@kaod.org> References: <20200902093107.608000-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.96] X-ClientProxiedBy: DAG8EX2.mxp5.local (172.16.2.72) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: c2758f96-87f8-4361-8a7c-1be6f7f0f2b0 X-Ovh-Tracer-Id: 7376896193109461868 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduiedrudefledgudejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojghfgggtgfhisehtkeertdertdejnecuhfhrohhmpeevrogurhhitgcunfgvucfiohgrthgvrhcuoegtlhhgsehkrghougdrohhrgheqnecuggftrfgrthhtvghrnhepheehfeegjeeitdfffeetjeduveejueefuefgtdefueelueetveeliefhhffgtdelnecukfhppedtrddtrddtrddtpdefjedrheelrddugedvrdelieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdqohhuthdphhgvlhhopehmgihplhgrnhehrdhmrghilhdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomheptghlgheskhgrohgurdhorhhgpdhrtghpthhtoheptghlgheskhgrohgurdhorhhg Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=79.137.123.220; envelope-from=clg@kaod.org; helo=smtpout1.mo804.mail-out.ovh.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/02 04:59:26 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Andrew Jeffery , Francisco Iglesias , Alistair Francis , qemu-arm@nongnu.org, Joel Stanley , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Modify the snooping routine to handle RDSFDP, 1 dummy and 3 bytes address space. Signed-off-by: C=C3=A9dric Le Goater --- include/hw/ssi/aspeed_smc.h | 1 + hw/ssi/aspeed_smc.c | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/include/hw/ssi/aspeed_smc.h b/include/hw/ssi/aspeed_smc.h index 6fbbb238f158..5f477eb9cf97 100644 --- a/include/hw/ssi/aspeed_smc.h +++ b/include/hw/ssi/aspeed_smc.h @@ -115,6 +115,7 @@ typedef struct AspeedSMCState { =20 AspeedSMCFlash *flashes; =20 + uint8_t snoop_addr_width; uint8_t snoop_index; uint8_t snoop_dummies; } AspeedSMCState; diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c index 795784e5f364..594f34668e7a 100644 --- a/hw/ssi/aspeed_smc.c +++ b/hw/ssi/aspeed_smc.c @@ -778,10 +778,15 @@ typedef enum { PP =3D 0x2, PP_4 =3D 0x12, DPP =3D 0xa2, QPP =3D 0x32, QPP_4 =3D 0x34, + RDSFDP =3D 0x5a, } FlashCMD; =20 -static int aspeed_smc_num_dummies(uint8_t command) +static int aspeed_smc_num_dummies(AspeedSMCFlash *fl, uint8_t command) { + AspeedSMCState *s =3D fl->controller; + + s->snoop_addr_width =3D aspeed_smc_flash_is_4byte(fl) ? 4 : 3; + switch (command) { /* check for dummies */ case READ: /* no dummy bytes/cycles */ case PP: @@ -798,6 +803,9 @@ static int aspeed_smc_num_dummies(uint8_t command) case DOR_4: case QOR_4: return 1; + case RDSFDP: + s->snoop_addr_width =3D 3; + return 1; case DIOR: case DIOR_4: return 2; @@ -813,8 +821,6 @@ static bool aspeed_smc_do_snoop(AspeedSMCFlash *fl, ui= nt64_t data, unsigned size) { AspeedSMCState *s =3D fl->controller; - uint8_t addr_width =3D aspeed_smc_flash_is_4byte(fl) ? 4 : 3; - trace_aspeed_smc_do_snoop(fl->id, s->snoop_index, s->snoop_dummies, (uint8_t) data & 0xff); =20 @@ -823,7 +829,7 @@ static bool aspeed_smc_do_snoop(AspeedSMCFlash *fl, ui= nt64_t data, =20 } else if (s->snoop_index =3D=3D SNOOP_START) { uint8_t cmd =3D data & 0xff; - int ndummies =3D aspeed_smc_num_dummies(cmd); + int ndummies =3D aspeed_smc_num_dummies(fl, cmd); =20 /* * No dummy cycles are expected with the current command. Turn @@ -836,7 +842,7 @@ static bool aspeed_smc_do_snoop(AspeedSMCFlash *fl, ui= nt64_t data, =20 s->snoop_dummies =3D ndummies * 8; =20 - } else if (s->snoop_index >=3D addr_width + 1) { + } else if (s->snoop_index >=3D s->snoop_addr_width + 1) { =20 /* The SPI transfer has reached the dummy cycles sequence */ for (; s->snoop_dummies; s->snoop_dummies--) { @@ -1407,10 +1413,11 @@ static void aspeed_smc_realize(DeviceState *dev, Er= ror **errp) =20 static const VMStateDescription vmstate_aspeed_smc =3D { .name =3D "aspeed.smc", - .version_id =3D 2, - .minimum_version_id =3D 2, + .version_id =3D 3, + .minimum_version_id =3D 3, .fields =3D (VMStateField[]) { VMSTATE_UINT32_ARRAY(regs, AspeedSMCState, ASPEED_SMC_R_MAX), + VMSTATE_UINT8(snoop_addr_width, AspeedSMCState), VMSTATE_UINT8(snoop_index, AspeedSMCState), VMSTATE_UINT8(snoop_dummies, AspeedSMCState), VMSTATE_END_OF_LIST() --=20 2.25.4