[SeaBIOS] [PATCH] floppy: Support CMOS setting outside QEMU

Petr Cvek posted 1 patch 2 months, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/seabios tags/patchew/20ae5280-8721-da6e-93a2-6adb1f046c42@gmail.com
src/Kconfig     | 7 +++++++
src/hw/floppy.c | 2 +-
2 files changed, 8 insertions(+), 1 deletion(-)
[SeaBIOS] [PATCH] floppy: Support CMOS setting outside QEMU
Posted by Petr Cvek 2 months, 2 weeks ago
SeaBIOS can be used for booting legacy OS and also Linux is still using
CMOS address 0x10 to configure floppy controller. Under these assumptions
it makes sense to allow boot from CMOS defined floppy drives.

Signed-off-by: Petr Cvek <petrcvekcz@gmail.com>
---
 src/Kconfig     | 7 +++++++
 src/hw/floppy.c | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/Kconfig b/src/Kconfig
index 3a8ffa1..42b9614 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -227,6 +227,13 @@ menu "Hardware support"
         default y
         help
             Support floppy drive access.
+    config LEGACY_FLOPPY
+        depends on FLOPPY && COREBOOT
+        bool "Get floppy type from CMOS"
+        default n
+        help
+            Support boot from CMOS defined floppy. Used by legacy OSes
+            on IBM PC compatible machine under coreboot.
     config FLASH_FLOPPY
         depends on DRIVES
         bool "Floppy images from CBFS or fw_cfg"
diff --git a/src/hw/floppy.c b/src/hw/floppy.c
index 9e6647d..40af360 100644
--- a/src/hw/floppy.c
+++ b/src/hw/floppy.c
@@ -155,7 +155,7 @@ floppy_setup(void)
         return;
     dprintf(3, "init floppy drives\n");
 
-    if (CONFIG_QEMU) {
+    if (CONFIG_QEMU || CONFIG_LEGACY_FLOPPY) {
         u8 type = rtc_read(CMOS_FLOPPY_DRIVE_TYPE);
         if (type & 0xf0)
             addFloppy(0, type >> 4);
-- 
2.37.0

_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
[SeaBIOS] Re: [PATCH] floppy: Support CMOS setting outside QEMU
Posted by Kevin O'Connor 1 month, 3 weeks ago
On Wed, Jul 13, 2022 at 03:24:49AM +0200, Petr Cvek wrote:
> SeaBIOS can be used for booting legacy OS and also Linux is still using
> CMOS address 0x10 to configure floppy controller. Under these assumptions
> it makes sense to allow boot from CMOS defined floppy drives.

There was never really a standard for the layout of CMOS nor for the
encoding of floppy type.  Currently, SeaBIOS doesn't use CMOS for
anything when configured for coreboot mode and I think we should keep
it that way.  If you have a machine with a floppy drive that you'd
like to use with coorboot+SeaBIOS then you can set the "etc/floppy0"
or "etc/floppy1" cbfs files to activate support in SeaBIOS.

-Kevin
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
[SeaBIOS] Re: [PATCH] floppy: Support CMOS setting outside QEMU
Posted by Peter Stuge 1 month, 3 weeks ago
Kevin O'Connor wrote:
> > SeaBIOS can be used for booting legacy OS and also Linux is still using
> > CMOS address 0x10 to configure floppy controller. Under these assumptions
> > it makes sense to allow boot from CMOS defined floppy drives.
> 
> There was never really a standard for the layout of CMOS nor for the
> encoding of floppy type.

Ralf Brown's interrupt list disagrees:

--8<-- CMOS.LST
----------R10--------------------------------
CMOS 10h - IBM - FLOPPY DRIVE TYPE
Note:   a PC having a 5 1/4 1.2 Mb A: drive and a 1.44 Mb B: drive will
          have a value of 24h in byte 10h. With a single 1.44 drive: 40h.

Bitfields for floppy drives A/B types:
Bit(s)  Description     (Table C0007)
 7-4    first floppy disk drive type (see #C0008)
 3-0    second floppy disk drive type (see #C0008)

(Table C0008)
Values for floppy drive type:
 00h    no drive
 01h    360 KB 5.25 Drive
 02h    1.2 MB 5.25 Drive - note: not listed in PS/2 technical manual
 03h    720 KB 3.5 Drive
 04h    1.44 MB 3.5 Drive
 05h    2.88 MB 3.5 drive
 06h-0Fh unused
SeeAlso: #C0007
-->8--


> Currently, SeaBIOS doesn't use CMOS for anything when configured for
> coreboot mode and I think we should keep it that way.

The first either 15 or 48 bytes are explicitly reserved on all
coreboot mainboards and coreboot checksums bytes 16-45 when built
to use an option table.


> If you have a machine with a floppy drive that you'd
> like to use with coorboot+SeaBIOS then you can set the "etc/floppy0"
> or "etc/floppy1" cbfs files to activate support in SeaBIOS.

That's fine, but why reject the de-facto standard method?


Kind regards

//Peter
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
[SeaBIOS] Re: [PATCH] floppy: Support CMOS setting outside QEMU
Posted by Petr Cvek 1 month, 2 weeks ago

Dne 06. 08. 22 v 19:30 Peter Stuge napsal(a):
> Kevin O'Connor wrote:
>>> SeaBIOS can be used for booting legacy OS and also Linux is still using
>>> CMOS address 0x10 to configure floppy controller. Under these assumptions
>>> it makes sense to allow boot from CMOS defined floppy drives.
>>
>> There was never really a standard for the layout of CMOS nor for the
>> encoding of floppy type.
> 
> Ralf Brown's interrupt list disagrees:
> 
> --8<-- CMOS.LST
> ----------R10--------------------------------
> CMOS 10h - IBM - FLOPPY DRIVE TYPE
> Note:   a PC having a 5 1/4 1.2 Mb A: drive and a 1.44 Mb B: drive will
>           have a value of 24h in byte 10h. With a single 1.44 drive: 40h.
> 
> Bitfields for floppy drives A/B types:
> Bit(s)  Description     (Table C0007)
>  7-4    first floppy disk drive type (see #C0008)
>  3-0    second floppy disk drive type (see #C0008)
> 
> (Table C0008)
> Values for floppy drive type:
>  00h    no drive
>  01h    360 KB 5.25 Drive
>  02h    1.2 MB 5.25 Drive - note: not listed in PS/2 technical manual
>  03h    720 KB 3.5 Drive
>  04h    1.44 MB 3.5 Drive
>  05h    2.88 MB 3.5 drive
>  06h-0Fh unused
> SeeAlso: #C0007
> -->8--
> 

I agree, these will be probably used by older OSes and having the floppy type
to be able to change without reflashing is definitely useful.

> 
>> Currently, SeaBIOS doesn't use CMOS for anything when configured for
>> coreboot mode and I think we should keep it that way.
> 
> The first either 15 or 48 bytes are explicitly reserved on all
> coreboot mainboards and coreboot checksums bytes 16-45 when built
> to use an option table.
> 
> 
>> If you have a machine with a floppy drive that you'd
>> like to use with coorboot+SeaBIOS then you can set the "etc/floppy0"
>> or "etc/floppy1" cbfs files to activate support in SeaBIOS.
> 
> That's fine, but why reject the de-facto standard method?
> 

Also few other bytes (14h) in this range could be used by legacy OSes too.

> 
> Kind regards
> 
> //Peter
> _______________________________________________
> SeaBIOS mailing list -- seabios@seabios.org
> To unsubscribe send an email to seabios-leave@seabios.org
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org