From nobody Fri Oct 25 19:34:55 2024 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=1614896708; cv=none; d=zohomail.com; s=zohoarc; b=Spi2gfPV3DaJYbuzJd8+Qa33CphKpSm7/HvCH/Ibs/uCXyVDtI3KCZe6hXabGFTBlLy7fnBufScnTAz3MpTuhBo2mqnP4K51B3DC1cwvUtv+GT6Dwrtfx4k+WUv81IpfwKmP5hIzPwPOnlU08qxXczGe6Dr+49XYeLv8HR9LQnY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614896708; h=Content-Type:Content-Transfer-Encoding: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=DM6iGwzt3VSierIAMGw3alM3Bb/84prQXADmLzo/kns=; b=l6y5s4QbuOk8XyEfBnNvfLvG+JGDKx8FwG14SixRYXFrQL+XLR781jXmgP8qiiaHfYOCdKi2i5rElOGDJ8njW7P9ra7+4uMabBjoF41IlWE2QaSB8YH+GGe9xr+CioyeaBj33D/YDC/R6BSACtY2R1i3GFAKSh3//1Nb9hEwG/Y= 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 1614896708667965.9448912880365; Thu, 4 Mar 2021 14:25:08 -0800 (PST) Received: from localhost ([::1]:44248 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHwP5-0008G4-KW for importer@patchew.org; Thu, 04 Mar 2021 17:25:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53754) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHwDh-0007f7-Rj for qemu-devel@nongnu.org; Thu, 04 Mar 2021 17:13:21 -0500 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:40130 helo=mail.default.ilande.uk0.bigv.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHwDg-0006KA-3V for qemu-devel@nongnu.org; Thu, 04 Mar 2021 17:13:21 -0500 Received: from host86-148-34-47.range86-148.btcentralplus.com ([86.148.34.47] helo=kentang.home) by mail.default.ilande.uk0.bigv.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lHwDY-0008MJ-81; Thu, 04 Mar 2021 22:13:18 +0000 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, pbonzini@redhat.com, fam@euphon.net, laurent@vivier.eu Date: Thu, 4 Mar 2021 22:10:44 +0000 Message-Id: <20210304221103.6369-24-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210304221103.6369-1-mark.cave-ayland@ilande.co.uk> References: <20210304221103.6369-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 86.148.34.47 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 23/42] esp: use ti_wptr/ti_rptr to manage the current FIFO position for PDMA X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.uk0.bigv.io) 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=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.uk0.bigv.io 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, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" This eliminates the last user of the PDMA-specific pdma_cur variable which = can now be removed. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laurent Vivier --- hw/scsi/esp.c | 23 ++++++++--------------- include/hw/scsi/esp.h | 1 - 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c index bb3a9cd5e3..7bf2ec9c94 100644 --- a/hw/scsi/esp.c +++ b/hw/scsi/esp.c @@ -127,11 +127,9 @@ static uint32_t esp_get_stc(ESPState *s) return dmalen; } =20 -static void set_pdma(ESPState *s, enum pdma_origin_id origin, - uint32_t index, uint32_t len) +static void set_pdma(ESPState *s, enum pdma_origin_id origin, uint32_t len) { s->pdma_origin =3D origin; - s->pdma_cur =3D index; s->pdma_len =3D len; } =20 @@ -146,11 +144,10 @@ static uint8_t esp_pdma_read(ESPState *s) =20 switch (s->pdma_origin) { case TI: - val =3D s->ti_buf[s->pdma_cur++]; + val =3D s->ti_buf[s->ti_rptr++]; break; case CMD: val =3D s->cmdbuf[s->cmdlen++]; - s->pdma_cur++; break; case ASYNC: val =3D s->async_buf[0]; @@ -158,7 +155,6 @@ static uint8_t esp_pdma_read(ESPState *s) s->async_len--; s->async_buf++; } - s->pdma_cur++; break; default: g_assert_not_reached(); @@ -182,11 +178,10 @@ static void esp_pdma_write(ESPState *s, uint8_t val) =20 switch (s->pdma_origin) { case TI: - s->ti_buf[s->pdma_cur++] =3D val; + s->ti_buf[s->ti_wptr++] =3D val; break; case CMD: s->cmdbuf[s->cmdlen++] =3D val; - s->pdma_cur++; break; case ASYNC: s->async_buf[0] =3D val; @@ -194,7 +189,6 @@ static void esp_pdma_write(ESPState *s, uint8_t val) s->async_len--; s->async_buf++; } - s->pdma_cur++; break; default: g_assert_not_reached(); @@ -249,7 +243,7 @@ static uint32_t get_cmd(ESPState *s) if (s->dma_memory_read) { s->dma_memory_read(s->dma_opaque, buf, dmalen); } else { - set_pdma(s, CMD, 0, dmalen); + set_pdma(s, CMD, dmalen); esp_raise_drq(s); return 0; } @@ -412,7 +406,7 @@ static void write_response(ESPState *s) s->rregs[ESP_RINTR] =3D INTR_BS | INTR_FC; s->rregs[ESP_RSEQ] =3D SEQ_CD; } else { - set_pdma(s, TI, 0, 2); + set_pdma(s, TI, 2); s->pdma_cb =3D write_response_pdma_cb; esp_raise_drq(s); return; @@ -480,7 +474,7 @@ static void esp_do_dma(ESPState *s) if (s->dma_memory_read) { s->dma_memory_read(s->dma_opaque, &s->cmdbuf[s->cmdlen], len); } else { - set_pdma(s, CMD, s->cmdlen, len); + set_pdma(s, CMD, len); s->pdma_cb =3D do_dma_pdma_cb; esp_raise_drq(s); return; @@ -503,7 +497,7 @@ static void esp_do_dma(ESPState *s) if (s->dma_memory_read) { s->dma_memory_read(s->dma_opaque, s->async_buf, len); } else { - set_pdma(s, ASYNC, 0, len); + set_pdma(s, ASYNC, len); s->pdma_cb =3D do_dma_pdma_cb; esp_raise_drq(s); return; @@ -512,7 +506,7 @@ static void esp_do_dma(ESPState *s) if (s->dma_memory_write) { s->dma_memory_write(s->dma_opaque, s->async_buf, len); } else { - set_pdma(s, ASYNC, 0, len); + set_pdma(s, ASYNC, len); s->pdma_cb =3D do_dma_pdma_cb; esp_raise_drq(s); return; @@ -857,7 +851,6 @@ static const VMStateDescription vmstate_esp_pdma =3D { .fields =3D (VMStateField[]) { VMSTATE_INT32(pdma_origin, ESPState), VMSTATE_UINT32(pdma_len, ESPState), - VMSTATE_UINT32(pdma_cur, ESPState), VMSTATE_END_OF_LIST() } }; diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h index 55b0aee762..26bd015cf4 100644 --- a/include/hw/scsi/esp.h +++ b/include/hw/scsi/esp.h @@ -58,7 +58,6 @@ struct ESPState { void (*dma_cb)(ESPState *s); int pdma_origin; uint32_t pdma_len; - uint32_t pdma_cur; void (*pdma_cb)(ESPState *s); =20 uint8_t mig_version_id; --=20 2.20.1