[SeaBIOS] [PATCH] floppy: Fix failed media sense return code

Kevin O'Connor via SeaBIOS posted 1 patch 2 days, 14 hours ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/seabios tags/patchew/20260722172729.816870-1-kevin@koconnor.net
src/hw/floppy.c | 2 +-
src/std/disk.h  | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)
[SeaBIOS] [PATCH] floppy: Fix failed media sense return code
Posted by Kevin O'Connor via SeaBIOS 2 days, 14 hours ago
An error in floppy_media_sense() returned error code 0xc0.  However,
this appears to be a typo when porting the original bochs bios code,
as it uses 0x0c.  It appears this typo was introduced in the first
SeaBIOS commit (f076a3ee).

Change the code to return 0x0c (DISK_RET_EBADTRACK) on an error.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
---
 src/hw/floppy.c | 2 +-
 src/std/disk.h  | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/hw/floppy.c b/src/hw/floppy.c
index ebed54f..a51711a 100644
--- a/src/hw/floppy.c
+++ b/src/hw/floppy.c
@@ -515,7 +515,7 @@ floppy_media_sense(struct drive_s *drive_gf)
         // Attempt media sense.
         for (stype=1; ; stype++) {
             if (stype >= ARRAY_SIZE(FloppyInfo))
-                return DISK_RET_EMEDIA;
+                return DISK_RET_EBADTRACK;
             if (stype==ftype
                 || (GET_GLOBAL(FloppyInfo[stype].floppy_size)
                     != GET_GLOBAL(FloppyInfo[ftype].floppy_size))
diff --git a/src/std/disk.h b/src/std/disk.h
index 6397108..68ccecc 100644
--- a/src/std/disk.h
+++ b/src/std/disk.h
@@ -17,7 +17,6 @@
 #define DISK_RET_ELOCKED       0xb1
 #define DISK_RET_ENOTREMOVABLE 0xb2
 #define DISK_RET_ETOOMANYLOCKS 0xb4
-#define DISK_RET_EMEDIA        0xC0
 #define DISK_RET_ENOTREADY     0xAA
 
 
-- 
2.53.0


_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org