From nobody Tue Feb 10 17:13:07 2026 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646087544714610.131864415496; Mon, 28 Feb 2022 14:32:24 -0800 (PST) Received: from localhost ([::1]:36532 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nOoZ5-0006vz-NT for importer@patchew.org; Mon, 28 Feb 2022 17:32:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47978) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOoSy-00048K-MS for qemu-devel@nongnu.org; Mon, 28 Feb 2022 17:26:06 -0500 Received: from [2001:41c9:1:41f::167] (port=51144 helo=mail.default.ilande.bv.iomart.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOoSx-0003QS-A4 for qemu-devel@nongnu.org; Mon, 28 Feb 2022 17:26:04 -0500 Received: from [2a00:23c4:8ba0:ca00:d4eb:dbd5:5a41:aefe] (helo=kentang.home) by mail.default.ilande.bv.iomart.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nOoSG-0004GN-8w; Mon, 28 Feb 2022 22:25:24 +0000 From: Mark Cave-Ayland To: laurent@vivier.eu, pbonzini@redhat.com, fam@euphon.net, qemu-devel@nongnu.org Date: Mon, 28 Feb 2022 22:25:23 +0000 Message-Id: <20220228222527.8234-7-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220228222527.8234-1-mark.cave-ayland@ilande.co.uk> References: <20220228222527.8234-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba0:ca00:d4eb:dbd5:5a41:aefe X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH 06/10] esp: introduce esp_set_pdma_cb() function 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.bv.iomart.io) X-Host-Lookup-Failed: Reverse DNS lookup failed for 2001:41c9:1:41f::167 (failed) 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.bv.iomart.io X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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" X-ZM-MESSAGEID: 1646087545940100003 Content-Type: text/plain; charset="utf-8" This function is to be used to set the current PDMA callback rather than accessing the ESPState pdma_cb function pointer directly. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/scsi/esp.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c index 58d0edbd56..d1640218c4 100644 --- a/hw/scsi/esp.c +++ b/hw/scsi/esp.c @@ -195,6 +195,11 @@ static void esp_pdma_write(ESPState *s, uint8_t val) esp_set_tc(s, dmalen); } =20 +static void esp_set_pdma_cb(ESPState *s, void (*cb)(ESPState *)) +{ + s->pdma_cb =3D cb; +} + static int esp_select(ESPState *s) { int target; @@ -356,7 +361,7 @@ static void handle_satn(ESPState *s) s->dma_cb =3D handle_satn; return; } - s->pdma_cb =3D satn_pdma_cb; + esp_set_pdma_cb(s, satn_pdma_cb); cmdlen =3D get_cmd(s, ESP_CMDFIFO_SZ); if (cmdlen > 0) { s->cmdfifo_cdb_offset =3D 1; @@ -387,7 +392,7 @@ static void handle_s_without_atn(ESPState *s) s->dma_cb =3D handle_s_without_atn; return; } - s->pdma_cb =3D s_without_satn_pdma_cb; + esp_set_pdma_cb(s, s_without_satn_pdma_cb); cmdlen =3D get_cmd(s, ESP_CMDFIFO_SZ); if (cmdlen > 0) { s->cmdfifo_cdb_offset =3D 0; @@ -422,7 +427,7 @@ static void handle_satn_stop(ESPState *s) s->dma_cb =3D handle_satn_stop; return; } - s->pdma_cb =3D satn_stop_pdma_cb; + esp_set_pdma_cb(s, satn_stop_pdma_cb); cmdlen =3D get_cmd(s, 1); if (cmdlen > 0) { trace_esp_handle_satn_stop(fifo8_num_used(&s->cmdfifo)); @@ -464,7 +469,7 @@ static void write_response(ESPState *s) s->rregs[ESP_RINTR] |=3D INTR_BS | INTR_FC; s->rregs[ESP_RSEQ] =3D SEQ_CD; } else { - s->pdma_cb =3D write_response_pdma_cb; + esp_set_pdma_cb(s, write_response_pdma_cb); esp_raise_drq(s); return; } @@ -604,7 +609,7 @@ static void esp_do_dma(ESPState *s) s->dma_memory_read(s->dma_opaque, buf, len); fifo8_push_all(&s->cmdfifo, buf, len); } else { - s->pdma_cb =3D do_dma_pdma_cb; + esp_set_pdma_cb(s, do_dma_pdma_cb); esp_raise_drq(s); return; } @@ -646,7 +651,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 { - s->pdma_cb =3D do_dma_pdma_cb; + esp_set_pdma_cb(s, do_dma_pdma_cb); esp_raise_drq(s); return; } @@ -678,7 +683,7 @@ static void esp_do_dma(ESPState *s) } =20 esp_set_tc(s, esp_get_tc(s) - len); - s->pdma_cb =3D do_dma_pdma_cb; + esp_set_pdma_cb(s, do_dma_pdma_cb); esp_raise_drq(s); =20 /* Indicate transfer to FIFO is complete */ --=20 2.20.1