From nobody Sat Dec 21 18:39:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1690969732203442.58262947824505; Wed, 2 Aug 2023 02:48:52 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 41BCE273F1; Wed, 2 Aug 2023 09:48:48 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 1616321D00 for ; Wed, 2 Aug 2023 09:48:23 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qR8SU-0005vd-0h; Wed, 02 Aug 2023 10:48:02 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ICnobOfi0mfkUYIuxs2YL2g65ndE4X1Hb8T7sIiN9e4=; b=BJ4kCj5+pVFn10j8algESqJaQR erPcaLkl4nnHWakb1SbFW+fChn05d1sDg7I2vye5bE/+zUH8LZZgrkxUIr4ecmJT0CIfEvo9Ju2mo aFgkzioO4lvnufzMplIuQrcPnH4o17K8GHv6HzNTrxxpHLcomCwwluz/woxRMbSszsutb9LQYp96W IT00ui2yIP5iRyxde45J7qhCsSjjksgew7wFcXgb08Ceol1NCywnyFD7oMQbRgOSlxhqNchptNWT1 P2GH/VsYf9GJ+iUIhVzUGq4FhQq+qs1Ev/TfBOhvV+dqCsHsQJTaR7bkQUEMrNs1I8LOpqVr46sgE 8sKuVAvc7qmo49WTioKL9SzRAOG0VJ+/N0x1bRGdBAKuZ2tBebK+aMKbr8cdJ4kyilv8wmxVXgCWq ejvAOQ5Wc2w6ZfSvPhDzLO1c72OaXH1sI9pnSVuwbA0lsmi+RXxo1KlZEYXYs54THQntMefSEI/aC wfR9ZoP1poi5urJnVIXdsV2UGSIeMpoTOekKx+U9qAsYGc6hCUpPcN3hWREPL8O6mGgScfHfh9RCR +yrtxcUC5ijCudUR5HwDWDrlnUWQrnCgEFE3lBHLWja+GPq+MJL030dQIRWqyer3HTx9tVwDr5Xok yPNx6iOWz1VqQIFmJqRgR0fgL7lgUKIyBU2hCyUHk=; From: Mark Cave-Ayland To: seabios@seabios.org, pbonzini@redhat.com Date: Wed, 2 Aug 2023 10:48:09 +0100 Message-Id: <20230802094810.58670-2-mark.cave-ayland@ilande.co.uk> In-Reply-To: <20230802094810.58670-1-mark.cave-ayland@ilande.co.uk> References: <20230802094810.58670-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 88.97.20.175 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.default.ilande.bv.iomart.io X-Spam-Status: No, score=-2.8 required=5.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED,URIBL_SBL_A autolearn=no autolearn_force=no version=3.4.2 X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) X-Spam-Level: *** Message-ID-Hash: 2RPOLP33OD65QRBTV5U2GC7F576HP6SI X-Message-ID-Hash: 2RPOLP33OD65QRBTV5U2GC7F576HP6SI X-MailFrom: mark.cave-ayland@ilande.co.uk X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.6b1 Precedence: list Subject: [SeaBIOS] [PATCH v2 1/2] esp-scsi: flush FIFO before sending SCSI command List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: --- X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1690969732606100001 Content-Type: text/plain; charset="utf-8" The ESP FIFO is used as a buffer for DMA requests and so isn't guaranteed to be empty in the case of SCSI errors or a mixed DMA/non-DMA request. Flush t= he FIFO before sending a SCSI command to guarantee that it is correctly positioned at the start of the FIFO. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- src/hw/esp-scsi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/hw/esp-scsi.c b/src/hw/esp-scsi.c index cc25f22..e4815aa 100644 --- a/src/hw/esp-scsi.c +++ b/src/hw/esp-scsi.c @@ -46,6 +46,7 @@ #define ESP_DMA_WMAC 0x58c =20 #define ESP_CMD_DMA 0x80 +#define ESP_CMD_FLUSH 0x01 #define ESP_CMD_RESET 0x02 #define ESP_CMD_TI 0x10 #define ESP_CMD_ICCS 0x11 @@ -96,6 +97,9 @@ esp_scsi_process_op(struct disk_op_s *op) =20 outb(target, iobase + ESP_WBUSID); =20 + /* Clear FIFO before sending command. */ + outb(ESP_CMD_FLUSH, iobase + ESP_CMD); + /* * We need to pass the LUN at the beginning of the command, and the FI= FO * is only 16 bytes, so we cannot support 16-byte CDBs. The alternati= ve --=20 2.39.2 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org