Move floppy setup code from post.c to floppy.c.
authorKevin O'Connor <kevin@koconnor.net>
Sun, 13 Apr 2008 21:07:33 +0000 (17:07 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Sun, 13 Apr 2008 21:07:33 +0000 (17:07 -0400)
Makefile
src/disk.h
src/floppy.c
src/post.c

index d0b5c091e1f8b73a93a93ed0432f274cefff9253..5e66ab99a754c56483529451cfc18a904dc64da0 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -8,8 +8,8 @@
 OUT=out/
 
 # Source files
-SRCBOTH=output.c util.c ata.c kbd.c pci.c boot.c
-SRC16=$(SRCBOTH) floppy.c disk.c system.c clock.c serial.c mouse.c \
+SRCBOTH=output.c util.c floppy.c ata.c kbd.c pci.c boot.c
+SRC16=$(SRCBOTH) disk.c system.c clock.c serial.c mouse.c \
       cdrom.c apm.c pcibios.c
 SRC32=$(SRCBOTH) post.c rombios32.c post_menu.c
 TABLESRC=font.c cbt.c floppy_dbt.c
index a42cb97135b2f94b385b3b0eedae6a923a2fdad4..30ef0bb3e4ff4a60a3d076385c224ada5421f6cc 100644 (file)
@@ -101,6 +101,7 @@ void __disk_ret(const char *fname, struct bregs *regs, u8 code);
 
 // floppy.c
 extern struct floppy_ext_dbt_s diskette_param_table2;
+void floppy_drive_setup();
 void floppy_13(struct bregs *regs, u8 drive);
 void floppy_tick();
 
index c27ee87a5c4435f8a21a40541819393eafa36b49..fc5e43fc106d552e0a8915267a5e285798e41835 100644 (file)
@@ -40,6 +40,19 @@ struct floppy_ext_dbt_s diskette_param_table2 VISIBLE16 = {
     .drive_type     = 4,    // drive type in cmos
 };
 
+void
+floppy_drive_setup()
+{
+    u8 type = inb_cmos(CMOS_FLOPPY_DRIVE_TYPE);
+    u8 out = 0;
+    if (type & 0xf0)
+        out |= 0x07;
+    if (type & 0x0f)
+        out |= 0x70;
+    SET_BDA(floppy_harddisk_info, out);
+    outb(0x02, PORT_DMA1_MASK_REG);
+}
+
 // Oddities:
 //   Return codes vary greatly - AL not cleared consistenlty, BDA return
 //      status not set consistently, sometimes panics.
index bb69ed1f7bb04fa5e41cc2056e30f20bb89b5a99..f8a3de9aa21ff01986b47b05f52ee1bf726d2ced 100644 (file)
@@ -11,8 +11,9 @@
 #include "cmos.h" // CMOS_*
 #include "util.h" // memset
 #include "biosvar.h" // struct bios_data_area_s
-#include "ata.h"
-#include "kbd.h"
+#include "ata.h" // ata_detect
+#include "kbd.h" // kbd_setup
+#include "disk.h" // floppy_drive_setup
 
 #define bda ((struct bios_data_area_s *)MAKE_FARPTR(SEG_BDA, 0))
 #define ebda ((struct extended_bios_data_area_s *)MAKE_FARPTR(SEG_EBDA, 0))
@@ -62,6 +63,8 @@ init_handlers()
     SET_BDA(ivecs[0x74].offset, OFFSET_entry_74);
     SET_BDA(ivecs[0x75].offset, OFFSET_entry_75);
     SET_BDA(ivecs[0x10].offset, OFFSET_entry_10);
+
+    SET_BDA(ivecs[0x1E].offset, OFFSET_diskette_param_table2);
 }
 
 static void
@@ -180,21 +183,6 @@ pic_setup()
         outb(0x9f, PORT_PIC2_DATA);
 }
 
-static void
-floppy_drive_post()
-{
-    u8 type = inb_cmos(CMOS_FLOPPY_DRIVE_TYPE);
-    u8 out = 0;
-    if (type & 0xf0)
-        out |= 0x07;
-    if (type & 0x0f)
-        out |= 0x70;
-    SET_BDA(floppy_harddisk_info, out);
-    outb(0x02, PORT_DMA1_MASK_REG);
-
-    SET_BDA(ivecs[0x1E].offset, OFFSET_diskette_param_table2);
-}
-
 static void
 ata_init()
 {
@@ -373,7 +361,7 @@ post()
 
     rombios32_init();
 
-    floppy_drive_post();
+    floppy_drive_setup();
     hard_drive_post();
     if (CONFIG_ATA) {
         ata_init();