From nobody Sat Jul 25 20:10:52 2026 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 Return-Path: Received: from coreboot.org (mail.coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1783971500356589.9332814775003; Mon, 13 Jul 2026 12:38:20 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 4496654EB8F; Mon, 13 Jul 2026 19:38:18 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (nx83.node02.secure-mailgate.com [192.162.87.83]) by coreboot.org (Postfix) with ESMTP id DECA854E4EF for ; Mon, 13 Jul 2026 19:37:55 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by node02.secure-mailgate.com with esmtps (TLS1.2) tls TLS_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1wjMTQ-007e6X-Ed; Mon, 13 Jul 2026 21:37:53 +0200 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (Authenticated sender: christian@quante.one) by web279.dogado.net (Postfix) with ESMTPSA id BFCEB282A6B; Mon, 13 Jul 2026 21:37:51 +0200 (CEST) X-SecureMailgate-Identity: christian@quante.one;web279.dogado.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quante.one; s=cloudpit; t=1783971472; bh=bGEY7lLIkXew+3/eTKHpMc8l6rz2hVl67UfKsJpIOrI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BiPQL824pJwwGhlf3afVZ/Z4C1caZLbhAus2kfDpJHs0tCMVoeG1JENH+eqMNKdBM bvG2hD6kkUo9grojHk6fy1ZI+pns1dxQ98LmxUCR9wB74nDlPy9m2r4iOnJpcINQSx 0YFiowXF0pikAX9mC6zZcPArUZ3yKJOkEoI2rXx4= X-SecureMailgate-Identity: christian@quante.one;web279.dogado.net From: Christian Quante To: seabios@seabios.org Date: Mon, 13 Jul 2026 21:35:27 +0200 Message-ID: <20260713193529.13004-2-christian@quante.one> In-Reply-To: <20260713193529.13004-1-christian@quante.one> References: <20260710131853.59862-1-christian@quante.one> <20260713193529.13004-1-christian@quante.one> MIME-Version: 1.0 X-PPP-Message-ID: <178397147224.1149777.11886801696350328806@web279.dogado.net> X-PPP-Vhost: quante.one X-SecureMailgate-Domain: web279.dogado.net X-SecureMailgate-Username: 31.47.255.59 X-SecureMailgate-Outgoing-Class: ham X-SecureMailgate-Outgoing-Evidence: Combined (0.03) X-Recommended-Action: accept X-Filter-ID: 9kzQTOBWQUFZTohSKvQbgI7ZDo5ubYELi59AwcWUnuWE6JF3x6rfpKfnD4hg738ZQl26UJZzup73 7C/QM//7giu2SmbhJN1U9FKs8X3+Nt1HOctZ5X+40a9IXddeG3M38JQYgcgjsac3uQcQdCX4ROfH zJ6mVE7ewsipSVIfs4ZWQfxYxFliexRUNrk7BtJ3S5+h1uiHzk/Rfxfh461YLyu3RZI1CD15pCOE 1vk99RPdEorPfEdXy94XZtjluxSTdOtYechJ/ikE1WgRg4cS6A6B6pTstltS07kaQJ8I9sYal0h7 43VOpKNY+4MjijihZK0EMmf3P50Ajf/tIX00Fuu2beRqilmjgQ6jA3UwYgnsj5xBssn0tIIHA3aH QzCq60l8YRpcxCjc2gcMa3Btw+OTpzU5Yy8oe2B0dJEHaEmA56XdPYm3xWZdE/EXCl5gDnvd4gRp ujraUEUfoKObmOu2raPunNKcwzm+dw4UpUCm2a3kP4TQGBPHghFkFxouUaYdjR+R3ZWRuox4844j AQbbxw9GNmy7K0lh0AXXFT3Pt46BhqiWcJ5qC0lG/2bs31/E3ahF5MMcDI7KdpjQKYY3HuMkbxpI KUQzfI6KxMWMxCeGr8LQquCYCjDePNNRIK/1NH5THMtlYvyHAYGOGuNMcrA92rKKXukX8XVo3f3/ JxUPJR+t5nhiYvfdCx1TkJ59fZW/mXUxWFsIstcuEAdT+LecEOC2wM8oSA+doCRGFMseaZh0vTl+ VwqQAF53B5hQ6nsDvccjqgmDvD9Wh/kSAu/CYcJOqIre05CguE1tP1nlenXa+GbjPeTU+gvuQJaj R4vlXL102p8rhkGjhZ9ohu/ssAude8XOICjh4eA+JR6TZt6YzE5PhY7dbccpibLJp6LroPqK4pWA eyFKR6XCaxMc6jly+EEBzFhEQhOL+GAm1jM1Gi5QnHfxs2W0jRceOK+WImaKCXu2JJh6AFz1pRXW hjh9fdbl44I0Df2BjPaKNO06KKJk593MMhOyNrM+RC/lTZnd7uJwgfOEv3poOl5JC4PE6jS4VuAW zIVI5e+cwgZZ/3rN1z/ww35mJXkVVPSc006zUgMG2KMDF/AZcJMXyXxXG5oZWE62IcEA7tYVzdXe EJDLX5L5N+U6PvwWy5OBXdqEG7TBtqXgwifoiMstty+iVRobalIoISR2PyW5cLuSbbpC1c/2zTYs X-Report-Abuse-To: spam@node04.secure-mailgate.com X-Complaints-To: abuse@node01.secure-mailgate.com Message-ID-Hash: 7YZSOR5ZYYGZRHKUH6BWBN6BUQFZTLCA X-Message-ID-Hash: 7YZSOR5ZYYGZRHKUH6BWBN6BUQFZTLCA X-MailFrom: christian@quante.one X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header Cc: Gerd Hoffmann , Christian Quante X-Mailman-Version: 3.3.11b1 Precedence: list Subject: [SeaBIOS] [PATCH v2 1/3] floppy: add floppy_drive_seek() 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: 1783971503378158500 Content-Type: text/plain; charset="utf-8" Wrap the SEEK command and the BDA bookkeeping that goes with it, the way floppy_drive_recal() already does for RECALIBRATE. No functional change; the next patch gains a second caller. Signed-off-by: Christian Quante --- src/hw/floppy.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/hw/floppy.c b/src/hw/floppy.c index 9e6647d4..8f053fe3 100644 --- a/src/hw/floppy.c +++ b/src/hw/floppy.c @@ -416,6 +416,21 @@ floppy_drive_recal(u8 floppyid) return DISK_RET_SUCCESS; } =20 +static int +floppy_drive_seek(u8 floppyid, u8 cylinder) +{ + dprintf(2, "Floppy_drive_seek %d to %d\n", floppyid, cylinder); + u8 param[2]; + param[0] =3D floppyid; + param[1] =3D cylinder; + int ret =3D floppy_drive_pio(floppyid, FC_SEEK, param); + if (ret) + return ret; + + SET_BDA(floppy_track[floppyid], cylinder); + return DISK_RET_SUCCESS; +} + static int floppy_drive_specify(void) { @@ -511,15 +526,10 @@ floppy_prep(struct drive_s *drive_gf, u8 cylinder) } =20 // Seek to cylinder if needed. - u8 lastcyl =3D GET_BDA(floppy_track[floppyid]); - if (cylinder !=3D lastcyl) { - u8 param[2]; - param[0] =3D floppyid; - param[1] =3D cylinder; - int ret =3D floppy_drive_pio(floppyid, FC_SEEK, param); + if (cylinder !=3D GET_BDA(floppy_track[floppyid])) { + int ret =3D floppy_drive_seek(floppyid, cylinder); if (ret) return ret; - SET_BDA(floppy_track[floppyid], cylinder); } =20 return DISK_RET_SUCCESS; --=20 2.53.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Sat Jul 25 20:10:52 2026 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 Return-Path: Received: from coreboot.org (mail.coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 17839715183581.3404915824106638; Mon, 13 Jul 2026 12:38:38 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 504A254EB61; Mon, 13 Jul 2026 19:38:36 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (nx103.node02.secure-mailgate.com [192.162.87.103]) by coreboot.org (Postfix) with ESMTP id 7DD3054E4EF for ; Mon, 13 Jul 2026 19:37:59 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by node02.secure-mailgate.com with esmtps (TLS1.2) tls TLS_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1wjMTT-007eA8-ME; Mon, 13 Jul 2026 21:37:56 +0200 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (Authenticated sender: christian@quante.one) by web279.dogado.net (Postfix) with ESMTPSA id 11A6A282A6B; Mon, 13 Jul 2026 21:37:55 +0200 (CEST) X-SecureMailgate-Identity: christian@quante.one;web279.dogado.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quante.one; s=cloudpit; t=1783971475; bh=ho9HizgE2AMuglfrW7Tf1rA6mzMpSIrbVs4LDgtrED0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OU1OWeCUkQSjrQjiRRIYXsF3OzrHgnPlGM/bDK0XYE5HAURxChu7PgI7i9/TKsSl9 +O0g4kllFaLm9qEoHSoEpiS/XDV3OrSyBvkWr4v3Hlp5uZXmMWgTDIA/z6kSyBGnPh d5Xe0OBoYwZHNZtkXKmmPpOHAQ0uVmTz/TYUFy3s= X-SecureMailgate-Identity: christian@quante.one;web279.dogado.net From: Christian Quante To: seabios@seabios.org Date: Mon, 13 Jul 2026 21:35:28 +0200 Message-ID: <20260713193529.13004-3-christian@quante.one> In-Reply-To: <20260713193529.13004-1-christian@quante.one> References: <20260710131853.59862-1-christian@quante.one> <20260713193529.13004-1-christian@quante.one> MIME-Version: 1.0 X-PPP-Message-ID: <178397147550.1149888.9500339901143447190@web279.dogado.net> X-PPP-Vhost: quante.one X-SecureMailgate-Domain: web279.dogado.net X-SecureMailgate-Username: 31.47.255.59 X-SecureMailgate-Outgoing-Class: ham X-SecureMailgate-Outgoing-Evidence: SB/global_tokens (0.0012513856958) X-Recommended-Action: accept X-Filter-ID: 9kzQTOBWQUFZTohSKvQbgI7ZDo5ubYELi59AwcWUnuVu4t7jIdYrPz0JwzgVSLVzqp67aYsyCkiU AIO2E1258iu2SmbhJN1U9FKs8X3+Nt1HOctZ5X+40a9IXddeG3M38JQYgcgjsac3uQcQdCX4ROfH zJ6mVE7ewsipSVIfs4ah3WCVN5shuB3NfXF1c2z5S5+h1uiHzk/Rfxfh461YLyu3RZI1CD15pCOE 1vk99RPdEorPfEdXy94XZtjluxSTdOtYechJ/ikE1WgRg4cS6A6B6pTstltS07kaQJ8I9sYal0h7 43VOpKNY+4MjijihZK0EMmf3P50Ajf/tIX00Fuu2beRqilmjgQ6jA3UwYgm3QTha208ypFqQwBFb xm4JX7semJdl8Weuy8+tlMSTQwhoy9D5QZ6a84vJal7pM1XhlAOd290vPXa7Loma0jth7qAXzi6H u+vd1PUHqD56sKVpCSy8DvYjml2C5x08HjVOdbycUIjxTi/oScdKqdkqU23mck4kYaL7W/YjuX9F gtaPrsMji/nLJj58tIE9bJtlIqecxOBP1yJf91UNzkSEUDq6mKQ/XAiI42Mzh38yXz3dKxLhoxcm aInYbR5vlqHlDhVAB/0EYD/jnz2OZJv6szlVwj1n2JAvHUSGQgae904HZe+Npbm5PA9zxaDCuu7n enbrzWUw2X62ZQfetBN+Wd6yNxOSUIsmGCJDuSiGSNdj68Lf4FNI5GmjYNknO4X1WwpSOxYAbinP WCPuFtl/VoXnJtsWNsYVIIkn7QRyQSC01dGS582vdIGGJfCYvwM9tQrhDVxWCGj1JArKPJWkG7EB ouE/Lp65oEK6Kr4PFISAzVaFNHfkjGyFyiRzr7YOhfiboNBv0POUVLQJNXGP/GGMrN0VgEP1fddi hPZrzx1Lw2yMf4vpvhlM+vErQ1gn6IjLLbcvolUaG2pSKCEkiWrFfcvTzpdI3AEG059XQZZCz9LK 39KzUylJRvNoHDV3OnKG9eRDP2/Ogb+c8D2oSvdcBJ1869L2y5ERFHC8NPIK4B7OUVSn0kbL6D23 dfd3aH2fATPqEIe+zbt2NwyT7DYzFfTn4NXnBjEun9DvZ0n9a1rfFCnSMsc+vEwrNstTbe4wBw6S kC2jAENWaINDgXBbKTIlqNpRK89muFbKwBsa9A+nmEd7cRVfyxrpZ1WT35ix5VehBc2cUR742vO7 eUcOGCmJTaorUhtlNRknxw== X-Report-Abuse-To: spam@node04.secure-mailgate.com X-Complaints-To: abuse@node01.secure-mailgate.com Message-ID-Hash: EFKONU76IE7CQWIN3YC3OU66I6OJHYJD X-Message-ID-Hash: EFKONU76IE7CQWIN3YC3OU66I6OJHYJD X-MailFrom: christian@quante.one X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header Cc: Gerd Hoffmann , Christian Quante X-Mailman-Version: 3.3.11b1 Precedence: list Subject: [SeaBIOS] [PATCH v2 2/3] floppy: detect an empty drive via the disk change line 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: 1783971521471158500 Content-Type: text/plain; charset="utf-8" floppy_prep() recalibrates and then calls floppy_media_sense(), which issues READ ID once per data rate. A drive with no medium spins no diskette and therefore produces no index pulses, so a real controller never completes READ ID and every attempt waits out FLOPPY_IRQ_TIMEOUT. Booting with an empty drive, or an INT 13h read of an empty A:, costs about ten seconds. The disk change line answers the same question immediately. It latches when the medium is removed and is cleared only by a step pulse with a diskette in the drive. A recalibrate leaves the head on cylinder 0 and need not step at all, so seek to cylinder 1 and read DIR again. Linux's floppy driver has done exactly this since 2.0 and never issues READ ID. Only the 1.2MB 5.25" drive and the 3.5" drives have the change line (CMOS types 2..5); on the older 5.25" types the pin is not driven and reads back as a permanent "changed". Restrict the probe to those types, and report any uncertainty as success, so that the code can only ever fall back to the current behaviour. The error code is unchanged: floppy_media_sense() already reports DISK_RET_EMEDIA once it has exhausted the data rates, so an empty drive still answers DISK_RET_EMEDIA -- just without the wait. Measured with qemu-system-x86_64, "-machine pc -device floppy, drive-type=3D144" and no medium, INT 13h AH=3D02h on drive A: before 0.11 s, AH =3D 0x20 (controller failure) after 0.11 s, AH =3D 0xC0 (no media) QEMU completes READ ID successfully on an empty drive, which hides the timeout; a fix for that is on qemu-devel [1]. With it applied, so that READ ID never completes as on real hardware, the same read takes 10.12 s before this change and 0.11 s after it. Booting from a diskette is unaffected, including the cold start where the change line is set for a freshly inserted medium. [1] https://lore.kernel.org/qemu-devel/20260710113134.43012-1-christian@qua= nte.one/ Signed-off-by: Christian Quante --- src/hw/floppy.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/src/hw/floppy.c b/src/hw/floppy.c index 8f053fe3..20033fa3 100644 --- a/src/hw/floppy.c +++ b/src/hw/floppy.c @@ -27,6 +27,9 @@ #define PORT_FD_DATA 0x03f5 #define PORT_FD_DIR 0x03f7 =20 +// Digital Input Register (read) +#define FLOPPY_DIR_DSKCHG 0x80 + #define FLOPPY_SIZE_CODE 0x02 // 512 byte sectors #define FLOPPY_DATALEN 0xff // Not used - because size code is 0x02 #define FLOPPY_MOTOR_TICKS 37 // ~2 seconds @@ -457,6 +460,47 @@ floppy_drive_readid(u8 floppyid, u8 data_rate, u8 head) return 0; } =20 +// Only the 1.2MB 5.25" drive and the 3.5" drives have a disk change line.= On +// the older 5.25" types the pin is not driven and reads back as a permane= nt +// "changed". +static int +floppy_has_changeline(u8 ftype) +{ + return ftype >=3D 2 && ftype <=3D 5; +} + +// Determine whether a diskette is present, without waiting for a command = to +// time out. The disk change line latches when the medium is removed and = is +// cleared only by a step pulse with a diskette in the drive. The caller = has +// just recalibrated, which leaves the head on cylinder 0 and need not ste= p at +// all, so step to cylinder 1 and look again. The head is left there; the +// caller seeks to the cylinder it wants anyway. +// +// Report DISK_RET_EMEDIA only when the drive is known to be empty -- any +// uncertainty is reported as success, so this can only ever fall back to = the +// previous behaviour. +static int +floppy_check_media(struct drive_s *drive_gf, u8 floppyid) +{ + if (!floppy_has_changeline(GET_GLOBALFLAT(drive_gf->floppy_type))) + return DISK_RET_SUCCESS; + + // The caller has just recalibrated this drive, so it is selected in t= he + // DOR and the DIR reflects its change line. + if (!(inb(PORT_FD_DIR) & FLOPPY_DIR_DSKCHG)) + return DISK_RET_SUCCESS; + + int ret =3D floppy_drive_seek(floppyid, 1); + if (ret) + return DISK_RET_SUCCESS; + + if (!(inb(PORT_FD_DIR) & FLOPPY_DIR_DSKCHG)) + return DISK_RET_SUCCESS; + + dprintf(2, "Floppy_check_media %d: no medium\n", floppyid); + return DISK_RET_EMEDIA; +} + static int floppy_media_sense(struct drive_s *drive_gf) { @@ -513,6 +557,13 @@ floppy_prep(struct drive_s *drive_gf, u8 cylinder) if (ret) return ret; =20 + // An empty drive gives no index pulses, so the READ ID that + // floppy_media_sense() issues would never complete and would wait= out + // its timeout once per data rate. Ask the disk change line inste= ad. + ret =3D floppy_check_media(drive_gf, floppyid); + if (ret) + return ret; + // Sense media. ret =3D floppy_media_sense(drive_gf); if (ret) --=20 2.53.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Sat Jul 25 20:10:52 2026 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 Return-Path: Received: from coreboot.org (mail.coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1783971537532825.7229514126591; Mon, 13 Jul 2026 12:38:57 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 71E7554EB56; Mon, 13 Jul 2026 19:38:55 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (nx238.node02.secure-mailgate.com [192.162.87.238]) by coreboot.org (Postfix) with ESMTP id E2DF054EB5B for ; Mon, 13 Jul 2026 19:38:01 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by node02.secure-mailgate.com with esmtps (TLS1.2) tls TLS_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1wjMTW-007eD6-Gu; Mon, 13 Jul 2026 21:37:59 +0200 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (Authenticated sender: christian@quante.one) by web279.dogado.net (Postfix) with ESMTPSA id C12A5282416; Mon, 13 Jul 2026 21:37:57 +0200 (CEST) X-SecureMailgate-Identity: christian@quante.one;web279.dogado.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quante.one; s=cloudpit; t=1783971478; bh=e/ZIoc+Kqy77EEc5W/TAlezn/86rOR9wTDAXVmJW1lE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=3F9f7s7PHQn16E+7Z9ZVeUkd1pvHqzrCBtzAOHk286L6qgmPreTNrhwpjhGbVSjpX OMChAbyQk2uGpQTz9zGgo+Ay3+5a3l8KPdtnjnjB1O+qJ5lH+VyJpYw9I18s54B9Em /IRcSAWtU784nwLtrLJ3tR7hAnHCKaBKQ+tuY8rU= X-SecureMailgate-Identity: christian@quante.one;web279.dogado.net From: Christian Quante To: seabios@seabios.org Date: Mon, 13 Jul 2026 21:35:29 +0200 Message-ID: <20260713193529.13004-4-christian@quante.one> In-Reply-To: <20260713193529.13004-1-christian@quante.one> References: <20260710131853.59862-1-christian@quante.one> <20260713193529.13004-1-christian@quante.one> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-PPP-Message-ID: <178397147832.1149961.4375737404124841662@web279.dogado.net> X-PPP-Vhost: quante.one X-SecureMailgate-Domain: web279.dogado.net X-SecureMailgate-Username: 31.47.255.59 X-SecureMailgate-Outgoing-Class: ham X-SecureMailgate-Outgoing-Evidence: Combined (0.02) X-Recommended-Action: accept X-Filter-ID: 9kzQTOBWQUFZTohSKvQbgI7ZDo5ubYELi59AwcWUnuXIdtfYTR1iemm2DmkhO5v6DduMCr2e/mR1 62ZcfdBkTyu2SmbhJN1U9FKs8X3+Nt1HOctZ5X+40a9IXddeG3M38JQYgcgjsac3uQcQdCX4ROfH zJ6mVE7ewsipSVIfs4bwdbtsmP7rt7XcJ/WVJ6mQS5+h1uiHzk/Rfxfh461YLyu3RZI1CD15pCOE 1vk99RPdEorPfEdXy94XZtjluxSTdOtYechJ/ikE1WgRg4cS6A6B6pTstltS07kaQJ8I9sYal0h7 43VOpKNY+4MjijihZK0EMmf3P50Ajf/tIX00Fuu2beRqilmjgQ6jA3UwYgnsj5xBssn0tIIHA3aH QzCq60l8YRpcxCjc2gcMa3Btw+OTpzU5Yy8oe2B0dJEHaEmA56XdPYm3xWZdE/EXCl5gDnvd4gRp ujraUEUfoKObmOu2raPunNKcwzm+dw4UpUCm2a3kP4TQGBPHghFkFxouUaYdjR+R3ZWRuox4844j AQbbxw9GNmy7K0lh0AXXFT3Pt46BhqiWcJ5qC0lG/2bs31/E3ahF5MMcDI7KdpjQKYY3HuMkbxpI KUQzfI6KxMWMxCeGr8LQquCYCjDePNNRIK/1NH5THMtlYvyHAYGOGuNMcrA92rKKXukX8XVo3f3/ JxUPJR+t5nhiYvfdCx1TkJ59fZW/mXUxWFsIstcuEAdT+LecEOC2wM8oSA+doCR7/SwklPUY7Ama 0PmZY+iQB5hQ6nsDvccjqgmDvD9Wh/kSAu/CYcJOqIre05CguE1tP1nlenXa+GbjPeTU+gvuQJaj R4vlXL102p8rhkGjhZ9ohu/ssAude8XOICjh4eA+JR6TZt6YzE5PhY7dbccpibLJp6LroPqK4pWA eyFKR6XCaxMc6jly+EEBzFhEQhOL+GAm1jM1Gi5QnHfxs2W06Rji2DxFyu/6+X2y/XkQ2Fz1pRXW hjh9fdbl44I0Df2BjPaKNO06KKJk593MMhOyNrM+RC/lTZnd7uJwgfOEv3poOl5JC4PE6jS4VuAW zIVI5e+cwgZZ/3rN1z/ww35mJXkVVPSc006zUgMG2KMDF/AZcJMXyXxXG5oZWE62IcEA7tYVzdXe EJDLX5L5N+U6PvwWy5OBXdqEG7TBtqXgwifoiMstty+iVRobalIoISR2PyW5cLuSbbpC1c/2zTYs X-Report-Abuse-To: spam@node04.secure-mailgate.com X-Complaints-To: abuse@node01.secure-mailgate.com Message-ID-Hash: 7ESYUK72HWXODHUC5M3FPLGKJCH5P5VQ X-Message-ID-Hash: 7ESYUK72HWXODHUC5M3FPLGKJCH5P5VQ X-MailFrom: christian@quante.one X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header Cc: Gerd Hoffmann , Christian Quante X-Mailman-Version: 3.3.11b1 Precedence: list Subject: [SeaBIOS] [PATCH v2 3/3] floppy: report an empty drive as not ready 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: 1783971539560158500 An empty drive and an unreadable diskette are different failures, and until the previous patch SeaBIOS could not tell them apart: both ended up in floppy_media_sense() exhausting the data rates and returning DISK_RET_EMEDIA (0xC0). Now that the disk change line identifies an absent medium, report it as DISK_RET_ETIMEOUT (0x80), the code the INT 13h documentation gives for "time out, drive not ready". floppy_media_sense() keeps DISK_RET_EMEDIA for a medium it cannot read. 0xC0 does not appear in the classic INT 13h status tables at all, and guests treat it accordingly. Measured on an empty drive, with SeaBIOS patched to return each code in turn. The guests here are German-language, so their messages are quoted as they appear, with the English sense in brackets: PC-DOS 7, "dir a:" 0x80 "Nicht bereit beim Lesen von Laufwerk A" [not ready reading drive A] 0xC0 "Allgemeiner Fehler beim Lesen von Laufwerk A" [general failure reading drive A] 0xAA same message as 0xC0 0x99 same message as 0xC0 <- invented, not a real code 0x06 no message at all; DOS retries forever Windows for Workgroups 3.11, File Manager, drive A: 0x80 "In Laufwerk A ist kein Datentr=C3=A4ger eingelegt. Legen Sie ei= nen Datentr=C3=A4ger ein, und versuchen Sie es erneut." [Wiederhole= n] [there is no disk in drive A; insert one and try again] 0xC0 "Der Datentr=C3=A4ger in Laufwerk A ist nicht formatiert. M=C3= =B6chten Sie, da=C3=9F der Datentr=C3=A4ger jetzt formatiert wird?" [Ja]= [Nein] [the disk in drive A is not formatted; format it now?] DOS gives 0xC0 the same message as the invented code 0x99, which is to say it does not recognise it. Windows does recognise it, and offers to format a diskette that is not there. Both are correct with 0x80. Bochs BIOS, from which SeaBIOS descends, returns 0x80 here as well ("SET_AH(0x80); // drive not ready (timeout)"). It has no READ ID media sensing; that arrived in SeaBIOS with commit e7c5a7ef, and DISK_RET_EMEDIA came with it. OS/2 2.11 and Linux are unaffected: both drive the controller through their own drivers rather than INT 13h. Not verified against real hardware -- I have none with a floppy drive. Signed-off-by: Christian Quante --- src/hw/floppy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hw/floppy.c b/src/hw/floppy.c index 20033fa3..d7249df4 100644 --- a/src/hw/floppy.c +++ b/src/hw/floppy.c @@ -498,7 +498,7 @@ floppy_check_media(struct drive_s *drive_gf, u8 floppyi= d) return DISK_RET_SUCCESS; =20 dprintf(2, "Floppy_check_media %d: no medium\n", floppyid); - return DISK_RET_EMEDIA; + return DISK_RET_ETIMEOUT; } =20 static int --=20 2.53.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org