From nobody Sat Jul 25 18:55:00 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 1784048437087272.7224072899378; Tue, 14 Jul 2026 10:00:37 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 10A0354EC3A; Tue, 14 Jul 2026 17:00:35 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (nx73.node02.secure-mailgate.com [192.162.87.73]) by coreboot.org (Postfix) with ESMTP id 9B6C054E3D3 for ; Tue, 14 Jul 2026 17:00:16 +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 1wjgCt-001wei-5p; Tue, 14 Jul 2026 18:42:08 +0200 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (Authenticated sender: christian@quante.one) by web279.dogado.net (Postfix) with ESMTPSA id 5018A2823DF; Tue, 14 Jul 2026 18:42:06 +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=1784047327; bh=bGEY7lLIkXew+3/eTKHpMc8l6rz2hVl67UfKsJpIOrI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BC2KefTFMgYQunZkbTY3iVyNEoArpJryJiAxNJeAK67feQLxX6UH3OCl2i2X8LWPb HxM995+1wzJo1qFVcaG4kNYolpr2Au4NDLmge3HOYArS1Ei90gly/hMDcJC4HaDHyG AiTclqAZ/RBLlrpkk+sYAjU6ae6PTuaKKP21CZrU= X-SecureMailgate-Identity: christian@quante.one;web279.dogado.net From: Christian Quante To: seabios@seabios.org Date: Tue, 14 Jul 2026 18:41:49 +0200 Message-ID: <20260714164151.61002-2-christian@quante.one> In-Reply-To: <20260714164151.61002-1-christian@quante.one> References: <20260710131853.59862-1-christian@quante.one> <20260714164151.61002-1-christian@quante.one> MIME-Version: 1.0 X-PPP-Message-ID: <178404732691.1137172.1228132188132070244@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 zJ6mVE7ewsipSVIfs4ayJR0tIJmTffBebLaWBmBGS5+h1uiHzk/Rfxfh461YLyu3RZI1CD15pCOE 1vk99RMPx4XSOO6RFTrifNgKO3ZgdOtYechJ/ikE1WgRg4cS6A6B6pTstltS07kaQJ8I9sYal0h7 43VOpKNY+4MjijihZK0EMmf3P50Ajf/tIX00Fuu2beRqilmjgQ6jA3UwYgnsj5xBssn0tIIHA3aH QzCq60l8YRpcxCjc2gcMa3Btw+OTpzU5Yy8oe2B0dJEHaEmA56XdPYm3xWZdE/EXCl5gDnvd4gRp ujraUEUfoKObmOu2raPunNKcwzm+dw4UpUCm2a3kP4TQGBPHghFkFxouUaYdjR+R3ZWRuox4844j AQbbxw9GNmy7K0lh0AXXFT3Pt46BhqiWcJ5qC0lG/2bs31/E3ahF5MMcDI7KdpjQKYY3HuMkbxpI KUQzfI6KxMWMxCeGr8LQquCYCjDePNNRIK/1NH5THMtlYvyHAYGOGuNMcrA92rKKXukX8XVo3f3/ JxUPJR+t5nhiYvfdCx1TkJ59fZW/mXUxWFsIstcuEAdT+LecEOC2wM8oSA+doCRUve4lJkeuYP8a 6ykj0LkWB5hQ6nsDvccjqgmDvD9Wh/kSAu/CYcJOqIre05CguE1tP1nlenXa+GbjPeTU+gvuQJaj R4vlXL102p8rhkGjhZ9ohu/ssAude8XOICjh4eA+JR6TZt6YzE5PhY7dbccpibLJp6LroPqK4pWA eyFKR6XCaxMc6jly+EEBzFhEQhOL+GAm1jM1Gi5QnHfxs2W0E/+v8T5iFFUbbaozIPGLH1z1pRXW 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: JZCRSPQACXBPQDTJFP4M5M2DJ3KAANGU X-Message-ID-Hash: JZCRSPQACXBPQDTJFP4M5M2DJ3KAANGU 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 v3 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: 1784048440547158500 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 18:55:00 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 1784048303616717.563867041604; Tue, 14 Jul 2026 09:58:23 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 11D4354E3D3; Tue, 14 Jul 2026 16:58:19 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (nx73.node02.secure-mailgate.com [192.162.87.73]) by coreboot.org (Postfix) with ESMTP id B4A7454E26D for ; Tue, 14 Jul 2026 16:58: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 1wjgCt-001wgp-V5; Tue, 14 Jul 2026 18:42:09 +0200 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (Authenticated sender: christian@quante.one) by web279.dogado.net (Postfix) with ESMTPSA id 1C456282C8D; Tue, 14 Jul 2026 18:42:07 +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=1784047327; bh=2hCnWiGSmv/FCxL5yJIsVT7u/74pOJ5cSYR/wFBPQtY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ubxvM44Qqpc3Ew5gAE5t4zKE0LfzwQhdpxu4kQN+olADmECUaqWF4nsVVTKy5iq2P yttjpVkq2mtomxpPXZU6DaUfozxGP1QldzNpyorOxz+yl8fhSyK5l2lfcCkqDqmsM5 LmSe1x0L4+T9KqEOfc+1SydRRyMLbP/+KuZb62Z4= X-SecureMailgate-Identity: christian@quante.one;web279.dogado.net From: Christian Quante To: seabios@seabios.org Date: Tue, 14 Jul 2026 18:41:50 +0200 Message-ID: <20260714164151.61002-3-christian@quante.one> In-Reply-To: <20260714164151.61002-1-christian@quante.one> References: <20260710131853.59862-1-christian@quante.one> <20260714164151.61002-1-christian@quante.one> MIME-Version: 1.0 X-PPP-Message-ID: <178404732774.1137213.15543056616137442646@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.00201766097906) X-Recommended-Action: accept X-Filter-ID: 9kzQTOBWQUFZTohSKvQbgI7ZDo5ubYELi59AwcWUnuUynxG4MhWfvHxWHvY5GbWdYf1+RrZJgmC0 TLzk0MT5+Cu2SmbhJN1U9FKs8X3+Nt1HOctZ5X+40a9IXddeG3M38JQYgcgjsac3uQcQdCX4ROfH zJ6mVE7ewsipSVIfs4ZqVFYN7yVSc0It8428rxPeS5+h1uiHzk/Rfxfh461YLyu3RZI1CD15pCOE 1vk99RMPx4XSOO6RFTrifNgKO3ZgdOtYechJ/ikE1WgRg4cS6A6B6pTstltS07kaQJ8I9sYal0h7 43VOpKNY+4MjijihZK0EMmf3P50Ajf/tIX00Fuu2beRqilmjgQ6jA3UwYgm3QTha208ypFqQwBFb xm4JX7semJdl8Weuy8+tlMSTQwhoy9D5QZ6a84vJal7pM1XhlAOd290vPXa7Loma0jth7qAXzi6H u+vd1PUHqD56sKVpCSy8DvYjml2C5x08HjVOdbycUIjxTi/oScdKqdkqU23mck4kYaL7W/YjuX9F gtaPrsMji/nLJj58tIE9bJtlIqecxOBP1yJf91UNzkSEUDq6mKQ/XAiI42Mzh38yXz3dKxLhoxcm aInYbR5vlqHlDhVAB/0EYD/jnz2OZJv6szlVwj1n2JAvHUSGQgae904HZe+Npbm5PA9zxaDCuu7n enbrzWUw2X62ZQfetBN+Wd6yNxOSUIsmGCJDuSiGSNdj68Lf4FNI5GmjYNknO4X1WwpSOxYAbinP WCPuFtl//zjk+i4E/Lj3eqXeYiykZAmR1FwuHmVniRXbAusXcZM9tQrhDVxWCGj1JArKPJWkG7EB ouE/Lp65oEK6Kr4PFISAzVaFNHfkjGyFyiRzr7YOhfiboNBv0POUVLQJNXGP/GGMrN0VgEP1fddi hPZrzx1Lw2yMf4vpvhlM+vErQ1gn6IjLLbcvolUaG2pSKCEkiWrFfcvTzpdI3AEG059XQZHa/eWT 997han47ptmEKuR3OnKG9eRDP2/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: PDCEQ3HZU7BUF3ND2BRWNXFKT2J3KASM X-Message-ID-Hash: PDCEQ3HZU7BUF3ND2BRWNXFKT2J3KASM 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 v3 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: 1784048309306158500 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, read DIR again, and seek back if a medium turns out to be present, so that media sensing reads the track it always did. 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, 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. The wait is a real-hardware effect and cannot be reproduced on QEMU as it stands: QEMU completes READ ID on an empty drive and hands back a made-up sector ID, so media sensing never blocks. That is a bug of its own, and a fix is on qemu-devel [1] -- but it makes READ ID fail immediately rather than never complete, so it does not bring the wait back either. To measure what this patch removes I made QEMU leave the command unfinished the way hardware does. That change is local and not proposed upstream: it would need this series in place first, or every access to an empty drive under QEMU would cost ten seconds. INT 13h AH=3D02h on an empty A:, "-machine pc -device floppy,drive-type=3D1= 44": QEMU made to behave like hardware 10.13 s -> 0.11 s QEMU as it stands today 0.11 s -> 0.11 s So on stock QEMU this patch neither costs nor saves time; what it changes there is the error code, which 3/3 is about. 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 | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/src/hw/floppy.c b/src/hw/floppy.c index 8f053fe3..0469a791 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,49 @@ 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. +// +// Report DISK_RET_EMEDIA only when the drive is known to be empty -- an o= lder +// drive without a change line is reported as present, so this can only ev= er +// 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 ret; + + if (inb(PORT_FD_DIR) & FLOPPY_DIR_DSKCHG) { + dprintf(2, "Floppy_check_media %d: no medium\n", floppyid); + return DISK_RET_EMEDIA; + } + + // A medium is present. Put the head back on cylinder 0, where the ca= ller + // left it, so that media sensing reads the track it always did. + return floppy_drive_seek(floppyid, 0); +} + static int floppy_media_sense(struct drive_s *drive_gf) { @@ -513,6 +559,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 18:55:00 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 1784047369246604.9721038735996; Tue, 14 Jul 2026 09:42:49 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 1E46254EC5A; Tue, 14 Jul 2026 16:42:47 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (nx218.node02.secure-mailgate.com [192.162.87.218]) by coreboot.org (Postfix) with ESMTP id 2566A54E285 for ; Tue, 14 Jul 2026 16:42:12 +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 1wjgCu-001whO-Kq; Tue, 14 Jul 2026 18:42:09 +0200 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (Authenticated sender: christian@quante.one) by web279.dogado.net (Postfix) with ESMTPSA id ED6C62806BC; Tue, 14 Jul 2026 18:42:07 +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=1784047328; bh=7uJrDlarvFKOcf0zwcUCrRaLfcSMrYfw6yCvIUsgVts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MXckzXdAsCKjhUUl8mpflUNavc0eb4/ndGP3N0X+Y15SL3BfOWU6RtY0K/CmA1XBk hdtiITa0O2J4Nf3RGZG8hPQLrhW72ZuNAqTJpqlUjYdyQoGrYrAURUh8SLfJ0BBcHP kjb4cNPtYIawVi2ievTOhVpOuE2Jxc/ABk1RhVY4= X-SecureMailgate-Identity: christian@quante.one;web279.dogado.net From: Christian Quante To: seabios@seabios.org Date: Tue, 14 Jul 2026 18:41:51 +0200 Message-ID: <20260714164151.61002-4-christian@quante.one> In-Reply-To: <20260714164151.61002-1-christian@quante.one> References: <20260710131853.59862-1-christian@quante.one> <20260714164151.61002-1-christian@quante.one> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-PPP-Message-ID: <178404732846.1137281.4858916470341731066@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.00730749501133) X-Recommended-Action: accept X-Filter-ID: 9kzQTOBWQUFZTohSKvQbgI7ZDo5ubYELi59AwcWUnuXNqInme+wxKK8QNDnEbF0N2n7iFnr1ngo9 Xj0oHRWUQCu2SmbhJN1U9FKs8X3+Nt1HOctZ5X+40a9IXddeG3M38JQYgcgjsac3uQcQdCX4ROfH zJ6mVE7ewsipSVIfs4bgAs7VdUOsXd9NLGeFO/ATS5+h1uiHzk/Rfxfh461YLyu3RZI1CD15pCOE 1vk99RMPx4XSOO6RFTrifNgKO3ZgdOtYechJ/ikE1WgRg4cS6A6B6pTstltS07kaQJ8I9sYal0h7 43VOpKNY+4MjijihZK0EMmf3P50Ajf/tIX00Fuu2beRqilmjgQ6jA3UwYgm3QTha208ypFqQwBFb xm4JX7semJdl8Weuy8+tlMSTQwhoy9D5QZ6a84vJal7pM1XhlAOd290vPXa7Loma0jth7qAXzi6H u+vd1PUHqD56sKVpCSy8DvYjml2C5x08HjVOdbycUIjxTi/oScdKqdkqU23mck4kYaL7W/YjuX9F gtaPrsMji/nLJj58tIE9bJtlIqecxOBP1yJf91UNzkSEUDq6mKQ/XAiI42Mzh38yXz3dKxLhoxcm aInYbR5vlqHlDhVAB/0EYD/jnz2OZJv6szlVwj1n2JAvHUSGQgae904HZe+Npbm5PA9zxaDCuu7n enbrzWUw2X62ZQfetBN+Wd6yNxOSUIsmGCJDuSiGSNdj68Lf4FNI5GmjYNknO4X1WwpSOxYAbinP WCPuFtl/ebfIRVAPZLIdiVw5Gddu3jZsYV8QQ1BmPNwpHnzQVbU9tQrhDVxWCGj1JArKPJWkG7EB ouE/Lp65oEK6Kr4PFISAzVaFNHfkjGyFyiRzr7YOhfiboNBv0POUVLQJNXGP/GGMrN0VgEP1fddi hPZrzx1Lw2yMf4vpvhlM+vErQ1gn6IjLLbcvolUaG2pSKCEkiWrFfcvTzpdI3AEG059XQaorP+n+ EG6FTjZnx1RwPXp3OnKG9eRDP2/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: QBQRKUR7F2YFA3G2HR4X3FGV4NNMGN6O X-Message-ID-Hash: QBQRKUR7F2YFA3G2HR4X3FGV4NNMGN6O 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 v3 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: 1784047372878158500 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), which the INT 13h tables give as "time out, drive not ready". floppy_media_sense() keeps DISK_RET_EMEDIA for a medium it cannot read. Kevin O'Connor traced where 0xC0 came from: Bochs BIOS answers 0x0C here, "media type not found", and the value was transposed when the code was brought over at the initial checkin f076a3ee. Ralf Brown's interrupt list gives 0x0C as "unsupported track or invalid media" -- so 0xC0 has never been an INT 13h status code at all. It does not appear in the classic tables, 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. 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hw/floppy.c b/src/hw/floppy.c index 0469a791..ebed54f1 100644 --- a/src/hw/floppy.c +++ b/src/hw/floppy.c @@ -475,7 +475,7 @@ floppy_has_changeline(u8 ftype) // just recalibrated, which leaves the head on cylinder 0 and need not ste= p at // all, so step to cylinder 1 and look again. // -// Report DISK_RET_EMEDIA only when the drive is known to be empty -- an o= lder +// Report a missing medium only when the drive is known to be empty -- an = older // drive without a change line is reported as present, so this can only ev= er // fall back to the previous behaviour. static int @@ -495,7 +495,7 @@ floppy_check_media(struct drive_s *drive_gf, u8 floppyi= d) =20 if (inb(PORT_FD_DIR) & FLOPPY_DIR_DSKCHG) { dprintf(2, "Floppy_check_media %d: no medium\n", floppyid); - return DISK_RET_EMEDIA; + return DISK_RET_ETIMEOUT; } =20 // A medium is present. Put the head back on cylinder 0, where the ca= ller --=20 2.53.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org