From nobody Sat Dec 21 11:32:53 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 1691391226559380.9737905247878; Sun, 6 Aug 2023 23:53:46 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 8960621099; Mon, 7 Aug 2023 06:53:42 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 1D53922F83 for ; Mon, 7 Aug 2023 06:53:16 +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 1qSu6j-0003J3-9w; Mon, 07 Aug 2023 07:52:53 +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=Y4bDHS3RghMam4bmMrzF2bHTT8dX7I7VoYYKiAHbWao=; b=fuZAe2QzYuyp3mtBVv62yyu+Pv ULOy/Aqzfqp0M980cN9s7yNxXjJvTjDjvBAr0irC7D+mVRoQvp7OI2PP2CIiZmp6DogfoelKwscKH rd+CfBSfRcBz70tWyjTPTvw3EigcotF51a2D79Bb+w0KwVGxa7a3hwMimKwTepZmFN6be90eLEfXZ 2no/FZKTQGcFcDnOhx7TPgkYiReqtsmdqKwgHG3EOF1Eo1jLFT45OPDartBISGvf60bkLYw+xPEAY F/t//87D2vuDVbvrUbHZ0isxVx2JDjmNMj32eN0yBh+GDD0xkzjp6aAE1seEMwIxEXXdf+RdT1fmc ALNyjB2G9YWXUF36mRQ2pyi/FfIKw7oFMP73A7Y1WSYO44eoUyg0ktwox99SRsH7ba+lydZwVY3DO OzvRV1gkuUcPWPN9Xh0Sc1OfNGvcTn0OP0lRDJuwV6Dmt+FMZMrM9bE1TRnHDG851tmrL3hY6C7O/ mIimBEcJo/ToRqAzzFHQiX1ApiN7F8vhr7BHrLQCBt9O5ZeMyJGRFDcK5M5V6Ljl32FS/GzAxZkIo FzzvHX3xmQHdbQfRKKx6sLzHmVYH2qnZ9/xpqHLGWtMC22N7oNdENhN0dbpUp7bGSquHVfOllsXMF 9QF2IiKZq0Nt+PR+im7tO4fJTR6FNgLNbJzMmQhtg=; From: Mark Cave-Ayland To: seabios@seabios.org, pbonzini@redhat.com Date: Mon, 7 Aug 2023 07:52:58 +0100 Message-Id: <20230807065300.366070-2-mark.cave-ayland@ilande.co.uk> In-Reply-To: <20230807065300.366070-1-mark.cave-ayland@ilande.co.uk> References: <20230807065300.366070-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a00:23c4:8bae:9a00:bbcd:d46c:8df1:e0e5 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_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: 2RV3UGFOCSXU5DIJ6UYR3M2VL3SELFU5 X-Message-ID-Hash: 2RV3UGFOCSXU5DIJ6UYR3M2VL3SELFU5 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 v3 1/3] 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: 1691391227845100001 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: Paolo Bonzini 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 From nobody Sat Dec 21 11:32:53 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 1691391240285789.9836684976714; Sun, 6 Aug 2023 23:54:00 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id B2BC022981; Mon, 7 Aug 2023 06:53:55 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 4CCA621099 for ; Mon, 7 Aug 2023 06:53:20 +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 1qSu6n-0003J3-E4; Mon, 07 Aug 2023 07:52:57 +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=WHXSe4bYiEyz4VTTbTljNBFSguc4H+gClnZOhl7XW8I=; b=rD7ZV8RvbubIUbDGqvu1knZLTU dT3nIPJuTT2Pn4SQydVAI78up/zs8B4NUv2RAlkiNDvVtiCalQ6qnKTSMzBFIUv9HLoDOKI/BYzBC Ma1oE5EmvmgwFcsYO7Zw7u5LyA5fGA8sxqAdhjsEG9++f6OdGM50MTIQJjiftCPQyyj1ylW2H9U3r VR5M1olpqQbgFgVXzxB52DsRI8U/PlTqHl2phn/KnVCap3CMwuX4/urknp6L34/gt+OwCZeaXDxRo yYsJEuONAQB61HPcmYYQhrnCJXC8d6takMuXKgPTBUK0W+E87vMgOpYtWNYdY7tniymhOHpvgj8t5 F6k9f1sViKSb+fnMYlwvujb+xg3c1QSltyomNF9sgLyepb4YGTI1BQWTpJUN2GUBdwJyvcfyiTIda d2tkxEmuoMZ4JVfgCN6w1s2qaKktn98/cmttw5JI9Kr0e7PP1eWCNKGU74j1jPZse1S4K81EG7+T3 iQASx4z57i4cJQqJG7yNulkbF6gpvWMnby26MGj3Xpvg6y2KQxBeWDscph4+WBfsV2rvmT4LTEySc NiynKkj327LNo71rUlnvcCqcJEl0YUuETWTIYAe0kEh2BXDDmCe89bPlvfsh6rqbpyM2VN2iGOTFM C1wQRfAWehhB6JV/NjYmAZCRqJVm7H1J4S1i3sjys=; From: Mark Cave-Ayland To: seabios@seabios.org, pbonzini@redhat.com Date: Mon, 7 Aug 2023 07:52:59 +0100 Message-Id: <20230807065300.366070-3-mark.cave-ayland@ilande.co.uk> In-Reply-To: <20230807065300.366070-1-mark.cave-ayland@ilande.co.uk> References: <20230807065300.366070-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a00:23c4:8bae:9a00:bbcd:d46c:8df1:e0e5 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_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: QI42SE6PMGS4MJXBC6UBBKFBOZOBDVBT X-Message-ID-Hash: QI42SE6PMGS4MJXBC6UBBKFBOZOBDVBT 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 v3 2/3] esp-scsi: check for INTR_BS/INTR_FC instead of STAT_TC for command completion 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: 1691391263596100001 Content-Type: text/plain; charset="utf-8" The ESP SELATN command used to send SCSI commands from the ESP to the SCSI = bus is not a DMA command and therefore does not affect the STAT_TC bit. The only reason this works at all is due to a bug in QEMU which (currently) always updates the STAT_TC bit in ESP_RSTAT regardless of the state of the ESP_CMD= _DMA bit. According to the NCR datasheet [1] the INTR_BS/INTR_FC bits are set when the SELATN command has completed, so update the existing logic to check for the= se bits in ESP_RINTR instead. Note that the read of ESP_RINTR needs to be restricted to state =3D=3D 0 as reading ESP_RINTR resets the ESP_RSTAT regi= ster which breaks the STAT_TC check when state =3D=3D 1. This commit also includes an extra read of ESP_INTR to clear all the interr= upt bits before submitting the SELATN command to ensure that we don't accidenta= lly immediately progress to the data phase handling logic where ESP_RINTR bits = have already been set by a previous ESP command. [1] "NCR 53C94, 53C95, 53C96 Advanced SCSI Controller" NCR_53C94_53C95_53C96_Data_Sheet_Feb90.pdf Signed-off-by: Mark Cave-Ayland Reviewed-by: Paolo Bonzini --- src/hw/esp-scsi.c | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/src/hw/esp-scsi.c b/src/hw/esp-scsi.c index e4815aa..ebdbd02 100644 --- a/src/hw/esp-scsi.c +++ b/src/hw/esp-scsi.c @@ -57,6 +57,8 @@ #define ESP_STAT_MSG 0x04 #define ESP_STAT_TC 0x10 =20 +#define ESP_INTR_FC 0x08 +#define ESP_INTR_BS 0x10 #define ESP_INTR_DC 0x20 =20 struct esp_lun_s { @@ -97,8 +99,9 @@ esp_scsi_process_op(struct disk_op_s *op) =20 outb(target, iobase + ESP_WBUSID); =20 - /* Clear FIFO before sending command. */ + /* Clear FIFO and interrupts before sending command. */ outb(ESP_CMD_FLUSH, iobase + ESP_CMD); + inb(iobase + ESP_RINTR); =20 /* * We need to pass the LUN at the beginning of the command, and the FI= FO @@ -115,21 +118,26 @@ esp_scsi_process_op(struct disk_op_s *op) =20 for (state =3D 0;;) { u8 stat =3D inb(iobase + ESP_RSTAT); + u8 intr; =20 - /* Detect disconnected device. */ - if (state =3D=3D 0 && (inb(iobase + ESP_RINTR) & ESP_INTR_DC)) { - return DISK_RET_ENOTREADY; - } + if (state =3D=3D 0) { + intr =3D inb(iobase + ESP_RINTR); =20 - /* HBA reads command, clears CD, sets TC -> do DMA if needed. */ - if (state =3D=3D 0 && (stat & ESP_STAT_TC)) { - state++; - if (op->count && blocksize) { - /* Data phase. */ - u32 count =3D (u32)op->count * blocksize; - esp_scsi_dma(iobase, (u32)op->buf_fl, count, scsi_is_read(= op)); - outb(ESP_CMD_TI | ESP_CMD_DMA, iobase + ESP_CMD); - continue; + /* Detect disconnected device. */ + if (intr & ESP_INTR_DC) { + return DISK_RET_ENOTREADY; + } + + /* HBA reads command, executes it, sets BS/FC -> do DMA if nee= ded. */ + if (intr & (ESP_INTR_BS | ESP_INTR_FC)) { + state++; + if (op->count && blocksize) { + /* Data phase. */ + u32 count =3D (u32)op->count * blocksize; + esp_scsi_dma(iobase, (u32)op->buf_fl, count, scsi_is_r= ead(op)); + outb(ESP_CMD_TI | ESP_CMD_DMA, iobase + ESP_CMD); + continue; + } } } =20 --=20 2.39.2 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Sat Dec 21 11:32:53 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 169139125409172.9367200103444; Sun, 6 Aug 2023 23:54:14 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 2E75E22A61; Mon, 7 Aug 2023 06:54:10 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 73B2822981 for ; Mon, 7 Aug 2023 06:53:20 +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 1qSu6r-0003J3-J9; Mon, 07 Aug 2023 07:52:57 +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=7zDvXjHHn73QhsQsBLvCMphV0bH71sN4TYjHt2/xtMA=; b=J7ZaT/UeG2iCOOj0CSeR9K7oSH X3/rN/LpAfJZot78L5CnaXX/MbeNDVVlh3zfyetjTpUlYiKkFO/g6JijINgwNBPr9ktRL/hxb/kc0 7NEfTh4SLw1n3HtgZLY1BzZyfzVyLK1jbqzLljG3prXvlpOSxMNyGw0Dit7DWZXqau5PoALTaS2IU 7cRh+Of8apQT4ay1EV9/WSP3urYWu32otgcaRxQuD0CNHxm8cA46Scb6LheRaxRYSZv9V9YYL0yna zBteE1ocPeLw+X378qzJi4Rtl+p8Sh+Y7JXgKk4IrGeKOkNXeB3yzSp32/9Umc67Ea7l1wyC6sE8K CSgJRAn0g+heBhgZCTyflsc1h65ANmsVBhOdCoyneDUE5sFkB+iklSVpaCVe9li0yEU+5MTcjiLmT HjWdZbQxjUkAvAwi/JuUPUNUs6zq9Flcw661yJl+gd2q73Yki61Updyrp+sYcqAbwxVornrC3igjz Rml3NAGdvenM0CzRb+b9bPv5MRT77CYgRq/5K3PGBlNtUM0sVtZ6VpNILojgcWCYaCz9L2cnr/6bb MFNaYPKiaS5Vf0xmymFXg0rCSIabIPCZfXhaYS69UXOWQngQ/tfPlG1TG2QSod2+HHZtzs0fuW+7m Z5/HllP2o/si4ePDtF6fPy4A+5/iJv0gqWeKuSKxA=; From: Mark Cave-Ayland To: seabios@seabios.org, pbonzini@redhat.com Date: Mon, 7 Aug 2023 07:53:00 +0100 Message-Id: <20230807065300.366070-4-mark.cave-ayland@ilande.co.uk> In-Reply-To: <20230807065300.366070-1-mark.cave-ayland@ilande.co.uk> References: <20230807065300.366070-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a00:23c4:8bae:9a00:bbcd:d46c:8df1:e0e5 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_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: M5HX6AJVOWYSIXQUP3AFMKOYFAUKFPAP X-Message-ID-Hash: M5HX6AJVOWYSIXQUP3AFMKOYFAUKFPAP 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 v3 3/3] esp-scsi: handle non-DMA SCSI commands with no data phase 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: 1691391255193100001 Content-Type: text/plain; charset="utf-8" The existing esp-scsi state machine checks for the STAT_TC bit to exit stat= e 1 but in the case where there is no data phase, a non-DMA command is executed which doesn't set STAT_TC. This only works because QEMU currently always se= ts STAT_TC just after issuing every SCSI command. Update the esp-scsi state machine so that in the case where there is no data phase, we immediately execute CMD_ICCS instead of waiting for STAT_TC to be set which will never happen with a non-DMA CMD_SELATN command. Signed-off-by: Mark Cave-Ayland --- src/hw/esp-scsi.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/hw/esp-scsi.c b/src/hw/esp-scsi.c index ebdbd02..f19804f 100644 --- a/src/hw/esp-scsi.c +++ b/src/hw/esp-scsi.c @@ -137,19 +137,28 @@ esp_scsi_process_op(struct disk_op_s *op) esp_scsi_dma(iobase, (u32)op->buf_fl, count, scsi_is_r= ead(op)); outb(ESP_CMD_TI | ESP_CMD_DMA, iobase + ESP_CMD); continue; + } else { + /* No data phase. */ + state++; } } } =20 /* At end of DMA TC is set again -> complete command. */ if (state =3D=3D 1 && (stat & ESP_STAT_TC)) { + state++; + continue; + } + + /* Request message in data. */ + if (state =3D=3D 2) { state++; outb(ESP_CMD_ICCS, iobase + ESP_CMD); continue; } =20 /* Finally read data from the message in phase. */ - if (state =3D=3D 2 && (stat & ESP_STAT_MSG)) { + if (state =3D=3D 3 && (stat & ESP_STAT_MSG)) { state++; status =3D inb(iobase + ESP_FIFO); inb(iobase + ESP_FIFO); --=20 2.39.2 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org